Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task/WG-261: mock v3 project designsafe #220

Merged
merged 2 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions angular/src/app/fixtures/projectv3.fixture.ts
Original file line number Diff line number Diff line change
@@ -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 };
19 changes: 19 additions & 0 deletions angular/src/app/services/agave-systems.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down Expand Up @@ -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[] {
Expand Down
Loading