diff --git a/angular/src/app/fixtures/projectv3.fixture.ts b/angular/src/app/fixtures/projectv3.fixture.ts new file mode 100644 index 00000000..df7c2939 --- /dev/null +++ b/angular/src/app/fixtures/projectv3.fixture.ts @@ -0,0 +1,72 @@ +const projectFixturev3 = { + result: [ + { + uuid: '4983294419299528210-242ac118-0001-012', + name: 'designsafe.project', + value: { + ef: '', + dois: [], + title: 'TEST: Hazmapper/TapisV3 project', + users: [ + { + role: 'pi', + user: null, + username: 'nathanf', + authorship: null, + }, + { + role: 'co_pi', + user: null, + username: 'tgrafft', + authorship: null, + }, + { + role: 'co_pi', + user: null, + username: 'thbrown', + authorship: null, + }, + { + role: 'team_member', + user: null, + username: 'sal', + authorship: null, + }, + { + role: 'team_member', + user: null, + username: 'khan263s', + authorship: null, + }, + { + role: 'team_member', + user: null, + username: 'wbomar', + authorship: null, + }, + { + role: 'team_member', + user: null, + username: 'jgentle', + authorship: null, + }, + { + role: 'team_member', + user: null, + username: 'smassie', + authorship: null, + }, + ], + projectId: 'PRJ-2224', + description: '', + hazmapperMaps: [], + }, + created: '2024-02-28T14:28:24.101-06:00', + lastUpdated: '2024-02-28T14:28:24.101-06:00', + associationIds: [], + }, + ], + total: 1, +}; + +export { projectFixturev3 }; diff --git a/angular/src/app/services/agave-systems.service.ts b/angular/src/app/services/agave-systems.service.ts index d7783e81..7599a5a0 100644 --- a/angular/src/app/services/agave-systems.service.ts +++ b/angular/src/app/services/agave-systems.service.ts @@ -7,6 +7,7 @@ import { map } from 'rxjs/operators'; import { HttpClient } from '@angular/common/http'; import { EnvService } from '../services/env.service'; import { Project } from '../models/models'; +import { projectFixturev3 } from '../fixtures/projectv3.fixture'; export interface AgaveProjectsData { projects: SystemSummary[]; @@ -82,6 +83,24 @@ export class AgaveSystemsService { } ); */ + const useMockSuccess = true; // Change this to false to simulate an error + if (useMockSuccess) { + const mockResponse = projectFixturev3; + const projectSystems = mockResponse.result.map((project) => { + return { + id: 'project-' + project.uuid, + name: project.value.projectId, + description: project.value.title, + }; + }); + this._projects.next(projectSystems); + this._loadingProjects.next(false); + } else { + const errorMessage = 'An error occurred. Contact support'; + this._projects.next(null); + this._loadingProjectsFailedMessage.next(errorMessage); + this._loadingProjects.next(false); + } } getProjectMetadata(projects: Project[], dsProjects: SystemSummary[]): Project[] {