Skip to content

Commit

Permalink
task/WG-274: Update projects for next (#232)
Browse files Browse the repository at this point in the history
* task/WG-274: Updatiing Projects Endpoint for DS Next

* Fix Enviroment

* using PRJ (ds_id) for user panel links

* Designsafe projects/v2 response now has 'result' instead of 'projects' key

* Removed todo.

---------

Co-authored-by: Taylor Grafft <tgrafft@wireless-10-150-16-163.public.utexas.edu>
Co-authored-by: Taylor Grafft <tgrafft@TACCs-MacBook-Pro.local>
Co-authored-by: Nathan Franklin <nathan.franklin@gmail.com>
  • Loading branch information
4 people authored Apr 30, 2024
1 parent c1827f2 commit b5b1a87
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,18 @@ export class UsersPanelComponent implements OnInit {

ngOnInit() {
this.agaveSystemsService.list();

combineLatest([this.projectsService.activeProject, this.agaveSystemsService.projects]).subscribe(([activeProject, dsProjects]) => {
if (activeProject) {
const portalUrl = this.envService.portalUrl + 'data/browser/';
this.activeProject = this.agaveSystemsService.getProjectMetadata([activeProject], dsProjects)[0];
if (activeProject.system_id) {
if (activeProject.system_id.startsWith('project')) {
this.dsHref = portalUrl + 'projects/' + activeProject.system_id.substr(8) + '/' + activeProject.system_path + '/';
this.dsHref = portalUrl + 'projects/' + activeProject.ds_id + '/' + activeProject.system_path + '/';
if (activeProject.ds_id) {
this.projectHref = portalUrl + 'projects/' + activeProject.system_id.substr(8) + '/';
this.projectHref = portalUrl + 'projects/' + activeProject.ds_id + '/';
}
} else {
this.myDataHref = portalUrl + 'agave/' + activeProject.system_id;
this.myDataHref = portalUrl + 'tapis/' + activeProject.system_id;
this.dsHref = this.myDataHref + activeProject.system_path + '/';
}
}
Expand Down
2 changes: 1 addition & 1 deletion angular/src/app/models/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,5 +241,5 @@ export interface DesignSafeProject {
}

export interface DesignSafeProjectCollection {
projects: DesignSafeProject[];
result: DesignSafeProject[];
}
29 changes: 4 additions & 25 deletions angular/src/app/services/agave-systems.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +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';
import { DesignSafeProjectCollection } from '../models/models';

export interface AgaveProjectsData {
projects: SystemSummary[];
Expand Down Expand Up @@ -59,14 +59,12 @@ export class AgaveSystemsService {
this._loadingProjects.next(true);
this._loadingProjectsFailedMessage.next(null);

// TODO_TAPISV3 mock a response from projects endpoint and use designsafe directly i.e. /api/projects
// See https://tacc-main.atlassian.net/browse/WG-261
this._projects.next([]);
this._loadingProjects.next(false);
/*
this.http.get<DesignSafeProjectCollection>(this.envService.designSafeUrl + `/projects/v2/`).subscribe(

this.http.get<DesignSafeProjectCollection>(this.envService.designSafeUrl + `/api/projects/v2/`).subscribe(
(resp) => {
const projectSystems = resp.projects.map((project) => {
const projectSystems = resp.result.map((project) => {
return {
id: 'project-' + project.uuid,
name: project.value.projectId,
Expand All @@ -82,25 +80,6 @@ export class AgaveSystemsService {
this._loadingProjects.next(false);
}
);
*/
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
5 changes: 2 additions & 3 deletions angular/src/app/services/env.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ export class EnvService {
}

get designSafeUrl(): string {
// TODO_TAPISV3 just used for projects endpoint so shoud this be designsafe portal and not tapis tenant.
return 'https://designsafe.tapis.io/';
return 'https://designsafeci-next.tacc.utexas.edu';
}

get portalUrl(): string {
Expand Down Expand Up @@ -119,7 +118,7 @@ export class EnvService {
if (/^localhost/.test(hostname) || /^hazmapper.local/.test(hostname)) {
this._env = EnvironmentType.Local;
this._apiUrl = this.getApiUrl(environment.backend);
this._portalUrl = this.getPortalUrl(environment.backend);
this._portalUrl = this.getPortalUrl(EnvironmentType.Experimental);
// TODO: Currently taggit is hosted on same port 4200
// Have to change port on taggit or hazmapper (requires adding callbackUrl to that port)
this._taggitUrl = 'http://localhost:4200/taggit';
Expand Down

0 comments on commit b5b1a87

Please sign in to comment.