fix(console): application state, add project role bulk, user grant explanations, i18n, ngsw update prompt #341

This commit is contained in:
Max Peintner
2020-07-03 15:07:43 +02:00
committed by GitHub
parent 7b67b55f4e
commit 73a4b7baef
9 changed files with 42 additions and 24 deletions
+2 -1
View File
@@ -19,7 +19,8 @@
<mat-menu #menu="matMenu">
<mat-progress-bar *ngIf="orgLoading" color="accent" mode="indeterminate"></mat-progress-bar>
<button class="show-all" mat-menu-item [routerLink]="[ '/org/overview' ]">Show all organizations</button>
<button class="show-all" mat-menu-item
[routerLink]="[ '/org/overview' ]">{{'MENU.SHOWORGS' | translate}}</button>
<button [ngClass]="{'active': temporg.id === org?.id}" [disabled]="!temporg.id" *ngFor="let temporg of orgs"
mat-menu-item (click)="setActiveOrg(temporg)">
@@ -144,13 +144,13 @@ export class AppDetailComponent implements OnInit, OnDestroy {
public changeState(event: MatButtonToggleChange): void {
if (event.value === AppState.APPSTATE_ACTIVE) {
this.projectService.ReactivateApplication(this.app.id).then(() => {
this.projectService.ReactivateApplication(this.projectId, this.app.id).then(() => {
this.toast.showInfo('Reactivated Application');
}).catch((error: any) => {
this.toast.showError(error.message);
});
} else if (event.value === AppState.APPSTATE_INACTIVE) {
this.projectService.DectivateApplication(this.app.id).then(() => {
this.projectService.DeactivateApplication(this.projectId, this.app.id).then(() => {
this.toast.showInfo('Deactivated Application');
}).catch((error: any) => {
this.toast.showError(error.message);
@@ -10,10 +10,11 @@
<ng-container *ngIf="currentCreateStep === 1">
<h1>{{'PROJECT.GRANT.CREATE.SEL_ORG' | translate}}</h1>
<p>{{'PROJECT.GRANT.CREATE.SEL_ORG_DESC' | translate}}</p>
<form (ngSubmit)="searchOrg(domain.value)">
<mat-form-field class="org-domain">
<mat-label>{{'PROJECT.GRANT.CREATE.SEL_ORG' | translate}}</mat-label>
<mat-label>{{'PROJECT.GRANT.CREATE.SEL_ORG_FORMFIELD' | translate}}</mat-label>
<input #domain matInput />
</mat-form-field>
@@ -84,12 +84,15 @@ export class ProjectRoleCreateComponent implements OnInit, OnDestroy {
}
public addRole(): void {
const promises = this.formArray.value.map((role: ProjectRoleAdd.AsObject) => {
role.id = this.projectId;
return this.projectService.AddProjectRole(role);
const rolesToAdd: ProjectRoleAdd[] = this.formArray.value.map((element: any) => {
const role = new ProjectRoleAdd();
role.setKey(element.key);
role.setDisplayName(element.displayName);
role.setGroup(element.group);
return role;
});
Promise.all(promises).then(() => {
this.projectService.BulkAddProjectRole(this.projectId, rolesToAdd).then(() => {
this.router.navigate(['projects', this.projectId]);
}).catch(data => {
this.toast.showError(data.message);
@@ -25,7 +25,7 @@
</ng-container>
<ng-container *ngIf="filter && filter == UserGrantSearchKey.USERGRANTSEARCHKEY_PROJECT_ID">
<h1>{{'PROJECT.GRANT.CREATE.SEL_PROJECT' | translate}}</h1>
<h1>{{'PROJECT.GRANT.CREATE.SEL_USER' | translate}}</h1>
<app-search-user-autocomplete class="block" singleOutput="true" (selectionChanged)="selectUser($event)">
</app-search-user-autocomplete>
+7 -3
View File
@@ -297,9 +297,11 @@ export class ProjectService {
);
}
public async ReactivateApplication(appId: string): Promise<Application> {
public async ReactivateApplication(projectId: string, appId: string): Promise<Application> {
const req = new ApplicationID();
req.setId(appId);
req.setProjectId(projectId);
return await this.request(
c => c.reactivateApplication,
req,
@@ -307,9 +309,11 @@ export class ProjectService {
);
}
public async DectivateApplication(projectId: string): Promise<Application> {
public async DeactivateApplication(projectId: string, appId: string): Promise<Application> {
const req = new ApplicationID();
req.setId(projectId);
req.setId(appId);
req.setProjectId(projectId);
return await this.request(
c => c.deactivateApplication,
req,
+2 -1
View File
@@ -2,12 +2,13 @@ import { Injectable } from '@angular/core';
import { MatSnackBar } from '@angular/material/snack-bar';
import { SwUpdate } from '@angular/service-worker';
@Injectable({
providedIn: 'root',
})
export class UpdateService {
constructor(private swUpdate: SwUpdate, snackbar: MatSnackBar) {
this.swUpdate.checkForUpdate();
this.swUpdate.available.subscribe((evt) => {
const snack = snackbar.open('Update Available', 'Reload');