-
- {activePanel && activePanel !== Panel.Manage && (
-
- {activePanel === Panel.Assets && (
-
- )}
- {activePanel === Panel.Filters && (
-
- )}
-
- )}
- {activePanel === Panel.Manage && (
-
- )}
-
-
-
- {selectedFeature && (
-
-
toggleSelectedFeature(selectedFeature.id)}
- isPublicView={activeProject.public}
+
+
+
+
+
+
+ {activePanel && activePanel !== Panel.Manage && (
+
+ {activePanel === Panel.Assets && (
+
+ )}
+ {activePanel === Panel.Filters && (
+
+ )}
+
+ )}
+ {activePanel === Panel.Manage && (
+
+ )}
+
+
- )}
+ {selectedFeature && (
+
+
toggleSelectedFeature(selectedFeature.id)}
+ isPublicView={activeProject.public}
+ />
+
+ )}
+
-
+
);
};
diff --git a/react/src/test/handlers.ts b/react/src/test/handlers.ts
index cfb81aec..a52e17c6 100644
--- a/react/src/test/handlers.ts
+++ b/react/src/test/handlers.ts
@@ -2,6 +2,12 @@ import { http, HttpResponse } from 'msw';
import { testDevConfiguration } from '@hazmapper/__fixtures__/appConfigurationFixture';
import { systems } from '@hazmapper/__fixtures__/systemsFixture';
import { featureCollection } from '@hazmapper/__fixtures__/featuresFixture';
+import {
+ projectMock,
+ designSafeProjectMock,
+} from '@hazmapper/__fixtures__/projectFixtures';
+import { users } from '@hazmapper/__fixtures__/usersFixtures';
+import { tileServerLayers } from '@hazmapper/__fixtures__/tileServerLayerFixture';
// ArcGIS tiles GET
export const arcgis_tiles = http.get('https://tiles.arcgis.com/*', () => {
@@ -11,13 +17,33 @@ export const arcgis_tiles = http.get('https://tiles.arcgis.com/*', () => {
// DesignSafe Projects GET
export const designsafe_projects = http.get(
`${testDevConfiguration.designsafePortalUrl}/api/projects/v2/`,
- () => HttpResponse.json({ results: [] }, { status: 200 })
+ () => HttpResponse.json({ results: [designSafeProjectMock] }, { status: 200 })
);
-// GeoAPI Projects GET
-export const geoapi_projects_list = http.get(
+// DesignSafe (single) Project GET
+export const designsafe_project = http.get(
+ `${testDevConfiguration.designsafePortalUrl}/api/projects/v2/:designSafeProjectUUID/`,
+ () =>
+ HttpResponse.json({ baseProject: designSafeProjectMock }, { status: 200 })
+);
+
+// GeoAPI Projects GET - handles both list and single project (i.e query is "?uuid=uuid")
+export const geoapi_get_projects = http.get(
`${testDevConfiguration.geoapiUrl}/projects/`,
- () => HttpResponse.json({}, { status: 200 })
+ ({ request }) => {
+ const url = new URL(request.url);
+ const uuid = url.searchParams.get('uuid');
+
+ // If uuid is provided, return single project in array
+ if (uuid) {
+ return HttpResponse.json([projectMock], { status: 200 });
+ }
+
+ // No uuid means list all projects
+ return HttpResponse.json([projectMock /* other projects */], {
+ status: 200,
+ });
+ }
);
// GeoAPI Project Features GET
@@ -26,6 +52,18 @@ export const geoapi_project_features = http.get(
() => HttpResponse.json(featureCollection, { status: 200 })
);
+// GeoAPI Project Users GET
+export const geoapi_project_users = http.get(
+ `${testDevConfiguration.geoapiUrl}/projects/:projectId/users/`,
+ () => HttpResponse.json(users, { status: 200 })
+);
+
+// GeoAPI Project Tile Servers GET
+export const geoapi_project_tile_servers = http.get(
+ `${testDevConfiguration.geoapiUrl}/projects/:projectId/tile-servers/`,
+ () => HttpResponse.json(tileServerLayers, { status: 200 })
+);
+
// Tapis Systems GET
export const tapis_systems = http.get(
`${testDevConfiguration.tapisUrl}/v3/systems/`,
@@ -48,9 +86,12 @@ export const tapis_files_listing = http.get(
// Export all handlers together for server setup
export const defaultHandlers = [
arcgis_tiles,
+ designsafe_project,
designsafe_projects,
- geoapi_projects_list,
+ geoapi_get_projects,
geoapi_project_features,
+ geoapi_project_users,
+ geoapi_project_tile_servers,
tapis_files_listing,
tapis_systems,
];
diff --git a/react/src/test/testUtil.tsx b/react/src/test/testUtil.tsx
index 739846e7..13d758d7 100644
--- a/react/src/test/testUtil.tsx
+++ b/react/src/test/testUtil.tsx
@@ -6,6 +6,7 @@ import { MemoryRouter } from 'react-router-dom';
import { setupServer } from 'msw/node';
import store from '@hazmapper/redux/store';
import { defaultHandlers } from '@hazmapper/test/handlers';
+import { MapPositionProvider } from '@hazmapper/context/MapContext';
export const server = setupServer(...defaultHandlers);
@@ -27,9 +28,11 @@ export function renderInTest(children: ReactElement, path = '/') {
return render(
-
- {children}
-
+
+
+ {children}
+
+
);
@@ -38,9 +41,11 @@ export function renderInTest(children: ReactElement, path = '/') {
export const TestWrapper = ({ children }: { children: React.ReactNode }) => (
-
- {children}
-
+
+
+ {children}
+
+
);
diff --git a/react/src/types/index.ts b/react/src/types/index.ts
index 46ebc71e..56694c41 100644
--- a/react/src/types/index.ts
+++ b/react/src/types/index.ts
@@ -5,6 +5,7 @@ export type {
DesignSafeProjectCollection,
DesignSafeProject,
ProjectRequest,
+ ProjectUser,
} from './projects';
export type { AuthState, AuthenticatedUser, AuthToken } from './auth';
export type { System } from './systems';
diff --git a/react/src/types/projects.ts b/react/src/types/projects.ts
index 71ae7ff5..5ec99390 100644
--- a/react/src/types/projects.ts
+++ b/react/src/types/projects.ts
@@ -11,12 +11,84 @@ export interface Project {
streetview_instances?: any;
ds_project?: DesignSafeProject;
}
+
+interface DesignSafeProjectValue {
+ dois: string[] /* always empty, deprecated? */;
+ title: string;
+ users: any[];
+ keywords: string[];
+ nhEvents: string[];
+ dataTypes: string[];
+ projectId: string;
+ nhLatitude: string;
+ nhLocation: string;
+ description: string;
+ nhLongitude: string;
+ projectType: string;
+ hazmapperMaps?: any[];
+}
+
+/**
+ * Partial interface for DesignSafe project value data.
+ * Note: This represents key fields only, not all available fields.
+ * Some fields (e.g. dois) may be deprecated.
+ */
+interface DesignSafeProjectValue {
+ // Core project identifiers
+ projectId: string;
+ title: string;
+ description: string;
+ projectType: string;
+
+ // Users and access
+ users: any[];
+
+ // Users - Deprecated: no longer used in v2 DS
+ pi?: string;
+ coPis?: any[];
+ teamMembers?: string[];
+ guestMembers?: string[];
+
+ // Location data
+ nhLatitude: string;
+ nhLongitude: string;
+ nhLocation: string;
+
+ // Classifications and metadata
+ keywords: string[];
+ dataTypes: string[];
+ nhEvents: string[];
+ dois: string[]; // Deprecated: appears to always empty array
+
+ // Natural Hazard specific
+ nhEvent: string;
+ nhTypes: string[];
+
+ // Related features
+ hazmapperMaps?: any[];
+ facilities: string[];
+ associatedProjects: string[];
+ referencedData: any[];
+
+ // Other
+ ef?: string;
+ authors?: any[];
+ frTypes?: any[];
+ fileObjs?: any[];
+ fileTags?: string[];
+ awardNumbers?: string[];
+ tombstone?: boolean;
+}
+
export interface DesignSafeProject {
uuid: string;
- projectId: any;
- title: any;
- value: any;
+ name: string;
+ value: DesignSafeProjectValue;
+ created: string;
+ lastUpdated: string;
+ associationIds?: any[];
}
+
export interface DesignSafeProjectCollection {
result?: DesignSafeProject[];
}
@@ -31,3 +103,8 @@ export interface ProjectRequest {
watch_content?: boolean;
watch_users?: boolean;
}
+
+export interface ProjectUser {
+ id: number;
+ username: string;
+}