From 443cd8464de533e53e5bb1d90db4d81cfb39ca5b Mon Sep 17 00:00:00 2001 From: Lukas Burgey Date: Tue, 12 Jun 2018 16:46:12 +0200 Subject: [PATCH] Display the state of task items to the user --- src/app/service/service.component.html | 27 +++++++++++++++++-------- src/app/user.service.ts | 28 ++++++++++++++++++-------- 2 files changed, 39 insertions(+), 16 deletions(-) diff --git a/src/app/service/service.component.html b/src/app/service/service.component.html index d54750f..f1e61d2 100644 --- a/src/app/service/service.component.html +++ b/src/app/service/service.component.html @@ -6,21 +6,32 @@ diff --git a/src/app/user.service.ts b/src/app/user.service.ts index b6206f2..aa1e42e 100644 --- a/src/app/user.service.ts +++ b/src/app/user.service.ts @@ -49,7 +49,7 @@ export class UserService { public getIdPPreference(): Observable { let idpID = Number(this.cookieService.get(environment.idpCookieName)); - return this.http.get('/backend/auth/v1/info/').map( + return this.http.get('/backend/auth/v1/info').map( (authInfo: AuthInfo) => { let selected = authInfo.idps[1]; @@ -136,7 +136,7 @@ export class UserService { public updateState() { this.http - .get('/backend/api/state/') + .get('/backend/api/state') .subscribe( (data: UserState) => { this.updateData(data); @@ -154,11 +154,11 @@ export class UserService { public login(idp: IdP) { this.setIdPPreference(idp); - window.location.href = 'https://hdf-portal.data.kit.edu/backend/auth/v1/request/'; + window.location.href = 'https://hdf-portal.data.kit.edu/backend/auth/v1/request'; } public logout() { - this.http.post('/backend/auth/v1/logout/', {}).subscribe( + this.http.post('/backend/auth/v1/logout', {}).subscribe( data => { this.updateData(data); } @@ -170,7 +170,7 @@ export class UserService { 'type': 'add', 'key': key, }; - return this.http.post('/backend/api/sshkey/', body).subscribe( + return this.http.post('/backend/api/sshkey', body).subscribe( data => { this.updateData(data); }, @@ -187,7 +187,7 @@ export class UserService { 'type': 'remove', 'id': key.id, }; - return this.http.post('/backend/api/sshkey/', body).subscribe( + return this.http.post('/backend/api/sshkey', body).subscribe( (data) => { this.updateData(data); }, @@ -205,7 +205,7 @@ export class UserService { 'key': key.id, 'service': service.id, }; - return this.http.post('/backend/api/deployments/', body).subscribe( + return this.http.post('/backend/api/deployments', body).subscribe( (data) => { //this.snackBar.open('Deployed key ' + key.name); this.updateData(data); @@ -225,7 +225,7 @@ export class UserService { 'service': service.id, }; - return this.http.post('/backend/api/deployments/', body).subscribe( + return this.http.post('/backend/api/deployments', body).subscribe( (data) => { //this.snackBar.open('Withdrew key ' + key.name); this.updateData(data); @@ -315,4 +315,16 @@ export class UserService { } return false; } + + public taskState(site, service): string { + if (site && service) { + + for (const item of this.user.deployment_task_items){ + if (item.site.id == site.id && item.service.id == service.id) { + return item.state; + } + } + } + return "done"; + } } -- 2.22.2
- + storage {{ site.name }} - - - + + - - - + done - + + error + + + warning + +