Skip to content

Commit

Permalink
Merge pull request #2970 from the-deep/add/analysis-overview-query
Browse files Browse the repository at this point in the history
Add/analysis overview query
  • Loading branch information
AdityaKhatri authored Nov 22, 2024
2 parents 576353d + e2835f2 commit abf2d1d
Show file tree
Hide file tree
Showing 15 changed files with 870 additions and 715 deletions.
89 changes: 0 additions & 89 deletions app/types/analysisModule.tsx

This file was deleted.

15 changes: 0 additions & 15 deletions app/types/analyticalFramework.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions app/types/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@ export * from './common';
export * from './project';
export * from './lead';
export * from './entry';
export * from './analysisModule';
export * from './user';
export * from './organization';
export * from './analyticalFramework';
168 changes: 0 additions & 168 deletions app/types/project.tsx
Original file line number Diff line number Diff line change
@@ -1,173 +1,5 @@
import { ProjectRoleTypeEnum } from '#generated/types';

import { BasicElement } from '.';
import { OrganizationDetails } from './organization';

interface VisaulizationEnabledOptions {
entry: boolean;
assessment: boolean;
}

export interface Membership {
id: number;
member: number;
memberEmail: string;
memberName: string;
addedByName: string;
addedBy: number;
memberOrganization?: string;
memberStatus: 'admin' | 'member';
project: number;
role: number;
roleDetails: {
id: number;
title: string;
level: number;
};
joinedAt: string;
userGroupOptions: BasicElement[];
}

export interface ProjectDetails {
analysisFramework?: number;
analysisFrameworkTitle?: string;
assessmentTemplate?: number;
assessmentTemplateTitle?: string;

id: number;
createdAt: string;
createdBy: number;
createdByName: string;
modifiedAt: string;
modifiedBy: number;
modifiedByName: string;
startDate?: string;
endDate?: string;
isDefault?: boolean;
isPrivate: boolean;
description?: string;
title: string;
isVisualizationEnabled: VisaulizationEnabledOptions;
versionId: number;
regions: BasicRegion[];

memberStatus: 'admin' | 'member';
role: number;
status: string;
statusDisplay: string;

memberships: Membership[];
userGroups: BasicElement[];
organizations: ProjectOrganization[];
}

type OrganizationTypes = 'lead_organization' | 'international_partner' | 'national_partner' | 'donor' | 'government';

interface ProjectOrganization {
id: number;
organization: number;
organizationDetails: OrganizationDetails;
organizationType: OrganizationTypes;
organizationTypeDisplay: string;
}

interface ProjectSummaryItem {
count: number;
id: number;
title: string;
}

interface ActivitySummaryItem {
project: number;
count: number;
date: string;
}

export interface ProjectRecentActivity {
projects: ProjectSummaryItem[];
activities: ActivitySummaryItem[];
}

export interface ProjectsSummary {
projectsCount: number;
totalLeadsCount: number;
totalLeadsTaggedCount: number;
totalLeadsTaggedAndVerifiedCount: number;
recentEntriesActivity: ProjectRecentActivity;
}

interface Permission {
view?: boolean;
create?: boolean;
modify?: boolean;
delete?: boolean;
}

export interface ProjectRole {
id: number;
leadPermissions: Permission;
entryPermissions: Permission;
setupPermissions: Permission;
exportPermissions: Permission;
assessmentPermissions: Permission;
title: string;
description: string;
level: number;
isCreatorRole: boolean;
isDefaultRole: boolean;
type: string;
}

interface AdminLevel {
id: number;
title: string;
// clientId: string;
level: number;
nameProp?: string;
codeProp?: string;
parentNameProp?: string;
parentCodeProp?: string;
}

export interface BasicRegion {
id: number;
title: string;
isPublished: boolean;
}

export interface Region extends BasicRegion {
createdAt: string;
modifiedAt: string;
createdBy: number;
modifiedBy: number;
createdByName: string;
modifiedByName: string;
versionId: number;
adminLevels: AdminLevel[];
code: string;
title: string;
public: boolean;
isPublished: boolean;
}

interface GeoShapeFile {
id: number;
title: string;
file: string;
mimeType: string;
}

export interface AdminLevelGeoArea extends AdminLevel {
geoShapeFileDetails?: GeoShapeFile;
geojsonFile?: string;
boundsFile?: string;
tolerance: number;
staleGeoAreas: boolean;
region: number;
geoShapeFile: number;
parent?: number;
}

export interface GeoAreaBounds {
minX: number;
minY: number;
Expand Down
22 changes: 0 additions & 22 deletions app/types/user.tsx

This file was deleted.

22 changes: 3 additions & 19 deletions app/views/AnalysisDashboard/Analysis/AnalysisCloneModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ import {
createSubmitHandler,
} from '@togglecorp/toggle-form';

import { useRequest, useLazyRequest } from '#base/utils/restRequest';
import { useLazyRequest } from '#base/utils/restRequest';
import NonFieldError from '#components/NonFieldError';
import _ts from '#ts';
import { AnalysisElement } from '#types/analysisModule';

import styles from './styles.css';

Expand Down Expand Up @@ -64,7 +63,7 @@ interface CloneProperties {
interface Props {
onClose: () => void;
projectId: string;
analysisId: number;
analysisId: string;
onClone: () => void;
}

Expand All @@ -85,25 +84,10 @@ function AnalysisCloneModal(props: Props) {
setFieldValue,
validate,
setError,
setValue,
} = useForm(schema, defaultFormValue);

const error = getErrorObject(riskyError);

const {
pending: pendingAnalysisGet,
} = useRequest<AnalysisElement>({
url: `server://projects/${projectId}/analysis/${analysisId}/`,
method: 'GET',
onSuccess: (response) => {
setValue({
title: response.title,
startDate: response.startDate,
endDate: response.endDate,
});
},
});

const {
pending: pendingAnalysisClone,
trigger: triggerAnalysisClone,
Expand Down Expand Up @@ -132,7 +116,7 @@ function AnalysisCloneModal(props: Props) {
submit();
}, [triggerAnalysisClone, setError, validate]);

const pending = pendingAnalysisClone || pendingAnalysisGet;
const pending = pendingAnalysisClone;

return (
<Modal
Expand Down
Loading

0 comments on commit abf2d1d

Please sign in to comment.