Commit f4622c00 authored by Lukas Burgey's avatar Lukas Burgey

Remove obsolete component

parent a309c283
......@@ -27,7 +27,6 @@ import { SshkeysModule } from './sshkeys/sshkeys.module';
// declarations
import { AppComponent } from './app.component';
import { BodyComponent } from './body/body.component';
import { ServiceComponent } from './service/service.component';
import { HeaderComponent } from './header/header.component';
import { FooterComponent } from './footer/footer.component';
import { VoDataComponent } from './vo-data/vo-data.component';
......@@ -54,7 +53,6 @@ import { VoDataComponent } from './vo-data/vo-data.component';
HeaderComponent,
BodyComponent,
FooterComponent,
ServiceComponent,
VoDataComponent,
],
providers: [
......
<mat-expansion-panel *ngIf="service">
<mat-expansion-panel-header>
<mat-panel-title>{{ service.name }}</mat-panel-title>
<mat-panel-description>{{ service.description }}</mat-panel-description>
</mat-expansion-panel-header>
<table style="margin-bottom: 30px; margin: auto;">
<thead>
<tr>
<td style="min-width: 150px;">Site</td>
<td>State</td>
<td style="min-width: 150px;"></td>
</tr>
</thead>
<tbody>
<tr *ngFor="let site of service.site" style="height: 42px;">
<td>
<span matTooltip="Provided at site {{ site.name }}" style="margin-right: 10px;">
<mat-icon style="vertical-align: middle; padding-right: 5px;">storage</mat-icon>
{{ site.name }}
</span>
</td>
<td>
<span [ngSwitch]="stateItem(site)?.state" class="childs-inline">
<mat-icon *ngSwitchCase="'deployed'" matTooltip="The credentials are deployed for the service {{ service.name }}. Click to see details.">call_made</mat-icon>
<mat-icon *ngSwitchCase="'questionnaire'" matTooltip="The site {{ site.name }} needs more data to deploy your credentials. Please click to submit the data.">warning</mat-icon>
<mat-progress-spinner *ngSwitchCase="'deployment_pending'" diameter="24" mode="indeterminate" matTooltip="Waiting for the deployment of the credentials to the site {{ site.name }}"></mat-progress-spinner>
<mat-progress-spinner *ngSwitchCase="'removal_pending'" diameter="24" mode="indeterminate" matTooltip="Waiting for the removal of the credentials from the site {{ site.name }}"></mat-progress-spinner>
<mat-icon *ngSwitchCase="'not_deployed'" mat-icon-button matTooltip="The credentials are not deployed for the service {{ service.name }}.">call_received</mat-icon>
<mat-icon *ngSwitchCase="'failed'" mat-icon-button matTooltip="Site {{ site.name }} failed to deploy the credentials. The deployment will be retried. Click for details.">error</mat-icon>
<mat-icon *ngSwitchCase="'rejected'" mat-icon-button matTooltip="Site {{ site.name }} rejected the deployment of the credentials. Click for details.">error</mat-icon>
<mat-icon *ngSwitchDefault mat-icon-button matTooltip="Access to this service was never requested.">call_received</mat-icon>
</span>
</td>
<td>
<span [ngSwitch]="stateItem(site)?.state">
<button *ngSwitchCase="'questionnaire'" (click)="dialog.openQuestionnaire(stateItem(site))" mat-raised-button class="mat-elevation-z6"> Questionnaire </button>
<button *ngSwitchCase="'deployed'" (click)="dialog.openCredentials(stateItem(site))" mat-raised-button class="mat-elevation-z6"> Credentials </button>
<button *ngSwitchCase="'failed'" (click)="dialog.openMessage(stateItem(site))" mat-raised-button class="mat-elevation-z6"> Failure </button>
<button *ngSwitchCase="'rejected'" (click)="dialog.openMessage(stateItem(site))" mat-raised-button class="mat-elevation-z6"> Rejected </button>
</span>
</td>
</tr>
</tbody>
</table>
<mat-action-row>
<div [ngSwitch]="deployment?.state_target">
<span *ngSwitchCase="'not_deployed'" style="margin-right: 15px;">
You did not request access to this service.
</span>
<span *ngSwitchCase="'deployed'" style="margin-right: 15px;">
You requested access to this service.
</span>
<span *ngSwitchDefault style="margin-right: 15px;">
You never requested access to this service.
</span>
</div>
<div [ngSwitch]="deployment?.state_target">
<button *ngSwitchCase="'not_deployed'" (click)="changeDeployment('add')" mat-raised-button color="primary" matTooltip="Deploy credentials to the service">
Deploy credentials
</button>
<button *ngSwitchCase="'deployed'" (click)="changeDeployment('remove')" mat-raised-button color="primary" matTooltip="Remove credentials from the service">
Remove credentials
</button>
<button *ngSwitchDefault (click)="changeDeployment('add')" mat-raised-button color="primary" matTooltip="Deploy credentials to the service for the first time">
Deploy credentials
</button>
</div>
</mat-action-row>
</mat-expansion-panel>
import { Component, OnInit, Input } from '@angular/core';
import { MatCheckboxChange } from '@angular/material/checkbox';
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
import { UserService } from '../user.service';
import { DialogService } from '../dialogues/dialog.service';
import * as t from '../types/types.module';
@Component({
selector: 'app-service',
templateUrl: './service.component.html',
styleUrls: ['./service.component.css']
})
export class ServiceComponent implements OnInit {
@Input() service: t.Service;
@Input() deployment: t.Deployment;
constructor(
public userService: UserService,
public dialog: DialogService,
public http: HttpClient,
) {
}
ngOnInit() {
}
public stateItem(site: t.Site): t.DeploymentState | undefined {
if (this.deployment) {
return this.deployment.states.find(
item => {
return item.site.id === site.id
}
);
}
return undefined;
}
public changeDeployment(action: string) {
const body = {
'type': action,
'service': this.service.id,
};
return this.http.post('/backend/api/deployments', body).subscribe(
(newDep: t.Deployment) => {
// update the deployment
this.deployment = newDep;
},
);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment