mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-22 16:48:30 +01:00
Merge pull request #5632 from ninjadq/fix_ui_issues
Fix UI related issues
This commit is contained in:
commit
7cf3f286ca
@ -40,7 +40,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="left">{{'HELM_CHART.VERSION' | translate }}</td>
|
||||
<td class="left">{{'HELM_CHART.APP_VERSION' | translate }}</td>
|
||||
<td class="left">{{ summary.appVersion }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -24,7 +24,7 @@
|
||||
<div *ngIf="!isCardView" class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
|
||||
<clr-datagrid (clrDgRefresh)="refresh($event)" [clrDgLoading]="loading" [(clrDgSelected)]="selectedRows">
|
||||
<clr-dg-action-bar>
|
||||
<button type="button" class="btn btn-sm btn-secondary" [disabled]="!hasProjectAdminRole" (click)="onChartUpload($event)">
|
||||
<button type="button" class="btn btn-sm btn-secondary" [disabled]="!developerRoleOrAbove" (click)="onChartUpload($event)">
|
||||
<clr-icon shape="upload" size="16"></clr-icon> {{'HELM_CHART.UPLOAD' | translate}}
|
||||
</button>
|
||||
</clr-dg-action-bar>
|
||||
@ -45,7 +45,10 @@
|
||||
<clr-dg-cell>{{ chart.created | date }}</clr-dg-cell>
|
||||
</clr-dg-row>
|
||||
<clr-dg-footer>
|
||||
<clr-dg-pagination #pagination [clrDgPageSize]="pageSize">
|
||||
<clr-dg-pagination #pagination [clrDgPageSize]="pageSize" [clrDgTotalItems]="totalCount">
|
||||
<span *ngIf="pagination.totalItems">
|
||||
{{pagination.firstItem + 1}} - {{pagination.lastItem + 1}} {{'HELM_CHART.OF' | translate}}
|
||||
</span>
|
||||
{{pagination.totalItems}} {{'HELM_CHART.ITEMS'| translate}}
|
||||
</clr-dg-pagination>
|
||||
</clr-dg-footer>
|
||||
@ -83,26 +86,35 @@
|
||||
<span class="spinner"></span>
|
||||
</div>
|
||||
</div>
|
||||
<clr-modal [(clrModalOpen)]="isUploadModalOpen" [clrModalStaticBackdrop]="true">
|
||||
<h3 class="modal-title">{{'HELM_CHART.UPLOAD_TITLE' | translate}}</h3>
|
||||
<clr-modal [(clrModalOpen)]="isUploadModalOpen" [clrModalStaticBackdrop]="true" [clrModalClosable]="false">
|
||||
<h3 class="modal-title">{{'HELM_CHART.UPLOAD_TITLE' | translate | titlecase}}</h3>
|
||||
<div class="modal-body">
|
||||
<form #chartUploadForm="ngForm" enctype="multipart/form-data" (ngSubmit)="upload()">
|
||||
<section class="form-block">
|
||||
<div class="form-group">
|
||||
<label for="chart"> {{'HELM_CHART.CHART_FILE' | translate}} </label>
|
||||
<input type="file" id="chart" name="chart" ngModel (change)="onChartFileChangeEvent($event)">
|
||||
<label class="filename-label"> {{'HELM_CHART.CHART_FILE' | translate}} </label>
|
||||
<input class="filename-input" type="text" placeholder="{{this.chartFile?.name || 'BUTTON.NO_FILE' | translate}}" disabled>
|
||||
<label for="chart" class="btn btn-secondary btn-sm file-browser-btn">{{'BUTTON.BROWSE' | translate}}</label>
|
||||
<input class="file-input" type="file" id="chart" name="chart" ngModel (change)="onChartFileChangeEvent($event)">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="prov"> {{'HELM_CHART.CHART_PROV' | translate}} </label>
|
||||
<input type="file" id="prov" name="prov" ngModel (change)="onProvFileChangeEvent($event)">
|
||||
<label class="filename-label"> {{'HELM_CHART.CHART_PROV' | translate}} </label>
|
||||
<input class="filename-input" type="text" placeholder="{{this.provFile?.name || 'BUTTON.NO_FILE' | translate}}" disabled>
|
||||
<label for="prov" class="btn btn-secondary btn-sm file-browser-btn">{{'BUTTON.BROWSE' | translate}}</label>
|
||||
<input class="file-input" type="file" id="prov" name="prov" ngModel (change)="onProvFileChangeEvent($event)">
|
||||
</div>
|
||||
</section>
|
||||
<button type="submit" class="btn btn-secondary" [disabled]="isUploading">
|
||||
<span>{{'HELM_CHART.UPLOAD' | translate}}</span>
|
||||
</button>
|
||||
<span *ngIf="isUploading" class="spinner spinner-inline">
|
||||
Loading...
|
||||
</span>
|
||||
<div class="row flex-items-xs-right">
|
||||
<button class="btn btn-secondary" [disabled]="isUploading" (click)="cancelUpload()">
|
||||
<span>{{'BUTTON.CANCEL' | translate}}</span>
|
||||
</button>
|
||||
<button type="submit" class="btn btn-primary" [disabled]="isUploading">
|
||||
<span>{{'HELM_CHART.UPLOAD' | translate}}</span>
|
||||
<span *ngIf="isUploading" class="spinner spinner-inline">
|
||||
Loading...
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</clr-modal>
|
||||
|
@ -76,4 +76,35 @@ $size60:60px;
|
||||
|
||||
.margin-right-12 {
|
||||
margin-right:12px;
|
||||
}
|
||||
|
||||
.file-input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.filename-span {
|
||||
@include text-overflow;
|
||||
display: inline-block;
|
||||
width: 50%;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
clr-modal {
|
||||
.form-group {
|
||||
padding-left: 6rem;
|
||||
|
||||
.filename-label {
|
||||
padding-top: 9px;
|
||||
}
|
||||
|
||||
.filename-input {
|
||||
margin-top: 12px;
|
||||
width: 68%;
|
||||
}
|
||||
|
||||
.file-browser-btn {
|
||||
margin-left: 15px;
|
||||
max-width: 25%;
|
||||
}
|
||||
}
|
||||
}
|
@ -5,8 +5,10 @@ import {
|
||||
ChangeDetectionStrategy,
|
||||
Output,
|
||||
EventEmitter,
|
||||
ViewChild,
|
||||
ChangeDetectorRef
|
||||
} from "@angular/core";
|
||||
import { NgForm } from '@angular/forms';
|
||||
import { TranslateService } from "@ngx-translate/core";
|
||||
import { State } from "clarity-angular";
|
||||
|
||||
@ -15,6 +17,7 @@ import { ErrorHandler } from "../error-handler/error-handler";
|
||||
import { toPromise, DEFAULT_PAGE_SIZE } from "../utils";
|
||||
import { HelmChartService } from "../service/helm-chart.service";
|
||||
import { DefaultHelmIcon} from "../shared/shared.const";
|
||||
import { Roles } from './../shared/shared.const';
|
||||
|
||||
@Component({
|
||||
selector: "hbr-helm-chart",
|
||||
@ -28,6 +31,7 @@ export class HelmChartComponent implements OnInit {
|
||||
@Input() projectName = "unknown";
|
||||
@Input() urlPrefix: string;
|
||||
@Input() hasSignedIn: boolean;
|
||||
@Input() projectRoleID = Roles.OTHER;
|
||||
@Input() hasProjectAdminRole: boolean;
|
||||
@Output() chartClickEvt = new EventEmitter<any>();
|
||||
@Output() chartDownloadEve = new EventEmitter<string>();
|
||||
@ -56,6 +60,8 @@ export class HelmChartComponent implements OnInit {
|
||||
totalCount = 0;
|
||||
currentState: State;
|
||||
|
||||
@ViewChild('chartUploadForm') uploadForm: NgForm;
|
||||
|
||||
constructor(
|
||||
private errorHandler: ErrorHandler,
|
||||
private translateService: TranslateService,
|
||||
@ -68,6 +74,10 @@ export class HelmChartComponent implements OnInit {
|
||||
return this.systemInfo ? this.systemInfo.registry_url : "";
|
||||
}
|
||||
|
||||
public get developerRoleOrAbove(): boolean {
|
||||
return this.projectRoleID === Roles.DEVELOPER || this.hasProjectAdminRole;
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
// Get system info for tag views
|
||||
toPromise<SystemInfo>(this.systemInfoService.getSystemInfo())
|
||||
@ -95,6 +105,7 @@ export class HelmChartComponent implements OnInit {
|
||||
charts => {
|
||||
this.charts = charts.filter(x => x.name.includes(this.lastFilteredChartName));
|
||||
this.chartsCopy = charts.map(x => Object.assign({}, x));
|
||||
this.totalCount = charts.length;
|
||||
},
|
||||
err => {
|
||||
this.errorHandler.error(err);
|
||||
@ -106,10 +117,22 @@ export class HelmChartComponent implements OnInit {
|
||||
this.chartClickEvt.emit(item.name);
|
||||
}
|
||||
|
||||
resetUploadForm() {
|
||||
this.chartFile = null;
|
||||
this.provFile = null;
|
||||
this.uploadForm.reset();
|
||||
}
|
||||
|
||||
onChartUpload() {
|
||||
this.resetUploadForm();
|
||||
this.isUploadModalOpen = true;
|
||||
}
|
||||
|
||||
cancelUpload() {
|
||||
this.resetUploadForm();
|
||||
this.isUploadModalOpen = false;
|
||||
}
|
||||
|
||||
upload() {
|
||||
if (!this.chartFile && !this.provFile) {
|
||||
return;
|
||||
|
@ -38,10 +38,6 @@
|
||||
<clr-datagrid (clrDgRefresh)="refresh($event)" [clrDgLoading]="loading" [(clrDgSelected)]="selectedRows">
|
||||
<clr-dg-action-bar>
|
||||
<button type="button" class="btn btn-sm btn-secondary"
|
||||
[disabled]="!hasProjectAdminRole"
|
||||
(click)="versionUpload($event)">
|
||||
<clr-icon shape="upload" size="16"></clr-icon> {{'HELM_CHART.UPLOAD' | translate}}</button>
|
||||
<button type="button" class="btn btn-sm btn-secondary"
|
||||
[disabled]="!(selectedRows.length===1)"
|
||||
(click)="versionDownload()">
|
||||
<clr-icon shape="download" size="16"></clr-icon> {{'HELM_CHART.DOWNLOAD' | translate}}</button>
|
||||
@ -70,8 +66,11 @@
|
||||
<clr-dg-cell>{{ v.created | date}}</clr-dg-cell>
|
||||
</clr-dg-row>
|
||||
<clr-dg-footer>
|
||||
<clr-dg-pagination #pagination [clrDgPageSize]="pageSize">
|
||||
{{pagination.totalItems}} {{'HELM_CHART.ITEMS' | translate}}
|
||||
<clr-dg-pagination #pagination [clrDgPageSize]="pageSize" [clrDgTotalItems]="totalCount">
|
||||
<span *ngIf="pagination.totalItems">
|
||||
{{pagination.firstItem + 1}} - {{pagination.lastItem + 1}} {{'HELM_CHART.OF' | translate}}
|
||||
</span>
|
||||
{{pagination.totalItems}} {{'HELM_CHART.ITEMS'| translate}}
|
||||
</clr-dg-pagination>
|
||||
</clr-dg-footer>
|
||||
</clr-datagrid>
|
||||
@ -104,13 +103,16 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="card-label">{{'HELM_CHART.VERSION' | translate}}</label>
|
||||
<div>{{item.appVersion}}</div>
|
||||
<div>{{item.version}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<clr-dropdown [clrCloseMenuOnItemClick]="false">
|
||||
<button type="button" class="btn btn-link" (click)="versionDownload($event, item)">{{'HELM_CHART.DOWNLOAD' | translate}}</button>
|
||||
<button type="button" class="btn btn-link" (click)="deleteVersionCard($event, item)">{{'BUTTON.DELETE' | translate}}</button>
|
||||
<button type="button" class="btn btn-link"
|
||||
(click)="versionDownload($event, item)">{{'HELM_CHART.DOWNLOAD' | translate}}</button>
|
||||
<button type="button" class="btn btn-link"
|
||||
[disabled]="selectedRows.length<=0 || !hasProjectAdminRole"
|
||||
(click)="deleteVersionCard($event, item)">{{'BUTTON.DELETE' | translate}}</button>
|
||||
</clr-dropdown>
|
||||
</div>
|
||||
</a>
|
||||
@ -120,28 +122,5 @@
|
||||
<span class="spinner"></span>
|
||||
</div>
|
||||
</div>
|
||||
<clr-modal [(clrModalOpen)]="isUploadModalOpen" [clrModalStaticBackdrop]="true">
|
||||
<h3 class="modal-title">{{'HELM_CHART.UPLOAD_TITLE' | translate}}</h3>
|
||||
<div class="modal-body">
|
||||
<form #chartUploadForm="ngForm" enctype="multipart/form-data" (ngSubmit)="upload()">
|
||||
<section class="form-block">
|
||||
<div class="form-group">
|
||||
<label for="chart"> {{'HELM_CHART.CHART_FILE' | translate}} </label>
|
||||
<input type="file" id="chart" name="chart" ngModel (change)="onChartFileChangeEvent($event)">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="prov"> {{'HELM_CHART.CHART_PROV' | translate}} </label>
|
||||
<input type="file" id="prov" name="prov" ngModel (change)="onProvFileChangeEvent($event)">
|
||||
</div>
|
||||
</section>
|
||||
<button type="submit" class="btn btn-secondary" [disabled]="isUploading">
|
||||
<span>{{'HELM_CHART.UPLOAD' | translate}}</span>
|
||||
</button>
|
||||
<span *ngIf="isUploading" class="spinner spinner-inline">
|
||||
Loading...
|
||||
</span>
|
||||
</form>
|
||||
</div>
|
||||
</clr-modal>
|
||||
<confirmation-dialog #confirmationDialog (confirmAction)="confirmDeletion($event)"></confirmation-dialog>
|
||||
</div>
|
@ -8,7 +8,6 @@ import {
|
||||
Output,
|
||||
EventEmitter
|
||||
} from "@angular/core";
|
||||
import { NgForm } from "@angular/forms";
|
||||
import { Observable } from "rxjs/Observable";
|
||||
import "rxjs/add/observable/forkJoin";
|
||||
|
||||
@ -72,16 +71,12 @@ export class ChartVersionComponent implements OnInit {
|
||||
totalCount = 0;
|
||||
currentState: State;
|
||||
|
||||
isUploading = false;
|
||||
isUploadModalOpen = false;
|
||||
chartFile: File;
|
||||
provFile: File;
|
||||
|
||||
@ViewChild("confirmationDialog")
|
||||
confirmationDialog: ConfirmationDialogComponent;
|
||||
|
||||
@ViewChild("chartUploadForm") form: NgForm;
|
||||
|
||||
constructor(
|
||||
private errorHandler: ErrorHandler,
|
||||
private translateService: TranslateService,
|
||||
@ -122,6 +117,7 @@ export class ChartVersionComponent implements OnInit {
|
||||
versions => {
|
||||
this.chartVersions = versions.filter(x => x.version.includes(this.lastFilteredVersionName));
|
||||
this.versionsCopy = versions.map(x => Object.assign({}, x));
|
||||
this.totalCount = versions.length;
|
||||
},
|
||||
err => {
|
||||
this.errorHandler.error(err);
|
||||
@ -201,9 +197,6 @@ export class ChartVersionComponent implements OnInit {
|
||||
}
|
||||
);
|
||||
}
|
||||
versionUpload() {
|
||||
this.isUploadModalOpen = true;
|
||||
}
|
||||
|
||||
showCard(cardView: boolean) {
|
||||
if (this.isCardView === cardView) {
|
||||
@ -236,30 +229,6 @@ export class ChartVersionComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
upload() {
|
||||
if (!this.chartFile && !this.provFile) {
|
||||
return;
|
||||
}
|
||||
if (this.isUploading) { return; };
|
||||
this.isUploading = true;
|
||||
this.helmChartService
|
||||
.uploadChart(this.projectName, this.chartFile, this.provFile)
|
||||
.finally(() => {
|
||||
this.isUploading = false;
|
||||
this.isUploadModalOpen = false;
|
||||
this.refresh();
|
||||
let hnd = setInterval(() => this.cdr.markForCheck(), 100);
|
||||
setTimeout(() => clearInterval(hnd), 3000);
|
||||
})
|
||||
.subscribe(
|
||||
() => {
|
||||
this.translateService.get("HELM_CHART.FILE_UPLOADED")
|
||||
.subscribe(res => this.errorHandler.info(res));
|
||||
},
|
||||
err => this.errorHandler.error(err)
|
||||
);
|
||||
}
|
||||
|
||||
onChartFileChangeEvent(event) {
|
||||
if (event.target.files && event.target.files.length > 0) {
|
||||
this.chartFile = event.target.files[0];
|
||||
@ -275,21 +244,20 @@ export class ChartVersionComponent implements OnInit {
|
||||
env.stopPropagation();
|
||||
this.openVersionDeleteModal([version]);
|
||||
}
|
||||
|
||||
openVersionDeleteModal(versions: HelmChartVersion[]) {
|
||||
let versionNames = versions.map(v => v.name).join(",");
|
||||
this.translateService.get("HELM_CHART.DELETE_CHART_VERSION").subscribe(key => {
|
||||
let message = new ConfirmationMessage(
|
||||
"HELM_CHART.DELETE_CHART_VERSION_TITLE",
|
||||
key,
|
||||
versionNames,
|
||||
versions,
|
||||
ConfirmationTargets.HELM_CHART,
|
||||
ConfirmationButtons.DELETE_CANCEL
|
||||
);
|
||||
this.confirmationDialog.open(message);
|
||||
let hnd = setInterval(() => this.cdr.markForCheck(), 100);
|
||||
setTimeout(() => clearInterval(hnd), 2000);
|
||||
});
|
||||
let versionNames = versions.map(v => v.version).join(",");
|
||||
let message = new ConfirmationMessage(
|
||||
"HELM_CHART.DELETE_CHART_VERSION_TITLE",
|
||||
"HELM_CHART.DELETE_CHART_VERSION",
|
||||
versionNames,
|
||||
versions,
|
||||
ConfirmationTargets.HELM_CHART,
|
||||
ConfirmationButtons.DELETE_CANCEL
|
||||
);
|
||||
this.confirmationDialog.open(message);
|
||||
let hnd = setInterval(() => this.cdr.markForCheck(), 100);
|
||||
setTimeout(() => clearInterval(hnd), 2000);
|
||||
}
|
||||
|
||||
confirmDeletion(message: ConfirmationAcknowledgement) {
|
||||
|
@ -92,3 +92,10 @@ export const LabelColor = [
|
||||
export const RoleMapping = { 'projectAdmin': 'MEMBER.PROJECT_ADMIN', 'developer': 'MEMBER.DEVELOPER', 'guest': 'MEMBER.GUEST' };
|
||||
|
||||
export const DefaultHelmIcon = '/static/images/helm-gray.png';
|
||||
|
||||
export enum Roles {
|
||||
PROJECT_ADMIN = 1,
|
||||
DEVELOPER = 2,
|
||||
GUEST = 3,
|
||||
OTHER = 0,
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
[class.invalid]="isDNInvalid">
|
||||
<input type="text" id="ldap_group_dn" name="ldap_group_dn"
|
||||
required
|
||||
[disabled]="mode !== 'create'"
|
||||
[(ngModel)]="group.ldap_group_dn"
|
||||
#groupDN="ngModel">
|
||||
<span class="tooltip-content">
|
||||
@ -26,11 +27,19 @@
|
||||
<label id="type">LDAP</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="group_name">{{'GROUP.NAME' | translate}}</label>
|
||||
<label for="group_name">
|
||||
<label for="group_name" class="required">{{'GROUP.NAME' | translate}}</label>
|
||||
<label for="group_name"
|
||||
aria-haspopup="true"
|
||||
role="tooltip"
|
||||
class="tooltip tooltip-validation tooltip-sm tooltip-right"
|
||||
[class.invalid]="isNameInvalid">
|
||||
<input type="text" id="group_name" name="group_name"
|
||||
required
|
||||
[(ngModel)]="group.group_name"
|
||||
#groupDN="ngModel">
|
||||
#groupName="ngModel">
|
||||
<span class="tooltip-content">
|
||||
{{dnTooltip | translate}}
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -45,6 +45,10 @@ export class AddGroupModalComponent implements OnInit, OnDestroy {
|
||||
let dnControl = this.groupForm.controls['ldap_group_dn'];
|
||||
return dnControl && dnControl.invalid && (dnControl.dirty || dnControl.touched);
|
||||
}
|
||||
public get isNameInvalid(): boolean {
|
||||
let dnControl = this.groupForm.controls['group_name'];
|
||||
return dnControl && dnControl.invalid && (dnControl.dirty || dnControl.touched);
|
||||
}
|
||||
|
||||
public get isFormValid(): boolean {
|
||||
return this.groupForm.valid;
|
||||
|
@ -30,7 +30,10 @@
|
||||
</clr-dg-row>
|
||||
<clr-dg-footer>
|
||||
<clr-dg-pagination #pagination [clrDgPageSize]="15">
|
||||
{{pagination.firstItem + 1}} - {{pagination.lastItem + 1}} {{'USER.OF' | translate }} {{pagination.totalItems}} {{'GROUP.GROUPS' | translate}}
|
||||
<span *ngIf="pagination.totalItems">
|
||||
{{pagination.firstItem + 1}} - {{pagination.lastItem + 1}} {{'GROUP.OF' | translate}}
|
||||
</span>
|
||||
{{pagination.totalItems}} {{'GROUP.ITEMS' | translate}}
|
||||
</clr-dg-pagination>
|
||||
</clr-dg-footer>
|
||||
</clr-datagrid>
|
||||
|
@ -36,7 +36,7 @@ export class ChartDetailComponent implements OnInit {
|
||||
let resolverData = this.route.snapshot.data;
|
||||
if (resolverData) {
|
||||
this.project = <Project>(resolverData["projectResolver"]);
|
||||
this.roleName = RoleMapping[this.project.role_name];
|
||||
this.roleName = this.project.role_name;
|
||||
this.hasProjectAdminRole = this.project.has_project_admin_role;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import { Component, OnInit } from '@angular/core';
|
||||
import { Project } from './../project';
|
||||
import { SessionUser } from './../../shared/session-user';
|
||||
import { SessionService } from './../../shared/session.service';
|
||||
import { RoleMapping } from '../../shared/shared.const';
|
||||
|
||||
@Component({
|
||||
selector: 'list-chart-version',
|
||||
@ -40,7 +39,7 @@ export class ListChartVersionsComponent implements OnInit {
|
||||
if (resolverData) {
|
||||
let project = <Project>(resolverData["projectResolver"]);
|
||||
this.hasProjectAdminRole = project.has_project_admin_role;
|
||||
this.roleName = RoleMapping[project.role_name];
|
||||
this.roleName = project.role_name;
|
||||
this.projectName = project.name;
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
[projectName]='projectName'
|
||||
[urlPrefix]='urlPrefix'
|
||||
[hasSignedIn]='hasSignedIn'
|
||||
[projectRoleID]='project_member_role_id'
|
||||
[hasProjectAdminRole]='hasProjectAdminRole'
|
||||
(chartClickEvt)='onChartClick($event)'>
|
||||
</hbr-helm-chart>
|
||||
|
@ -18,6 +18,7 @@ export class ListChartsComponent implements OnInit {
|
||||
urlPrefix: string;
|
||||
hasSignedIn: boolean;
|
||||
hasProjectAdminRole: boolean;
|
||||
project_member_role_id: number;
|
||||
currentUser: SessionUser;
|
||||
|
||||
constructor(
|
||||
@ -35,6 +36,8 @@ export class ListChartsComponent implements OnInit {
|
||||
let project = <Project>(resolverData["projectResolver"]);
|
||||
this.projectName = project.name;
|
||||
this.hasProjectAdminRole = project.has_project_admin_role;
|
||||
this.project_member_role_id = project.current_user_role_id;
|
||||
console.log(this.project_member_role_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,10 @@
|
||||
</clr-dg-row>
|
||||
|
||||
<clr-dg-footer>
|
||||
<clr-dg-pagination #pagination [clrDgPageSize]="5">
|
||||
<clr-dg-pagination #pagination [clrDgPageSize]="5" [clrDgTotalItems]="totalCount">
|
||||
<span *ngIf="pagination.totalItems">
|
||||
{{pagination.firstItem + 1}} - {{pagination.lastItem + 1}} {{'MEMBER.OF' | translate}}
|
||||
</span>
|
||||
{{pagination.totalItems}} {{'MEMBER.ITEMS' | translate}}
|
||||
</clr-dg-pagination>
|
||||
</clr-dg-footer>
|
||||
|
@ -34,6 +34,7 @@ export class AddGroupComponent implements OnInit {
|
||||
group = new UserGroup();
|
||||
selectedGroups: UserGroup[] = [];
|
||||
groups: UserGroup[] = [];
|
||||
totalCount = 0;
|
||||
|
||||
dnTooltip = 'TOOLTIP.ITEM_REQUIRED';
|
||||
|
||||
@ -76,6 +77,7 @@ export class AddGroupComponent implements OnInit {
|
||||
return group.group_name.includes(this.currentTerm)
|
||||
&& !this.memberList.some(member => member.entity_type === 'g' && member.entity_id === group.id);
|
||||
});
|
||||
this.totalCount = groups.length;
|
||||
this.onLoading = false;
|
||||
this.ref.detectChanges();
|
||||
});
|
||||
@ -87,6 +89,7 @@ export class AddGroupComponent implements OnInit {
|
||||
}
|
||||
|
||||
resetModaldata() {
|
||||
this.createGroupMode = false;
|
||||
this.group = new UserGroup();
|
||||
this.selectedRole = 1;
|
||||
this.selectedGroups = [];
|
||||
|
@ -19,7 +19,6 @@ import { Project } from '../project';
|
||||
import { SessionService } from '../../shared/session.service';
|
||||
import { ProjectService } from '../../project/project.service';
|
||||
|
||||
import { RoleMapping } from '../../shared/shared.const';
|
||||
import {AppConfigService} from "../../app-config.service";
|
||||
|
||||
@Component({
|
||||
@ -46,7 +45,7 @@ export class ProjectDetailComponent {
|
||||
this.route.data.subscribe(data => {
|
||||
this.currentProject = <Project>data['projectResolver'];
|
||||
this.isMember = this.currentProject.is_member;
|
||||
this.roleName = RoleMapping[this.currentProject.role_name];
|
||||
this.roleName = this.currentProject.role_name;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { RoleInfo } from './../shared/shared.const';
|
||||
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -19,6 +20,8 @@ import { ProjectService } from './project.service';
|
||||
import { SessionService } from '../shared/session.service';
|
||||
import 'rxjs/add/operator/mergeMap';
|
||||
|
||||
import { Roles } from '../shared/shared.const'
|
||||
|
||||
@Injectable()
|
||||
export class ProjectRoutingResolver implements Resolve<Project> {
|
||||
|
||||
@ -40,17 +43,14 @@ export class ProjectRoutingResolver implements Resolve<Project> {
|
||||
if (project) {
|
||||
let currentUser = this.sessionService.getCurrentUser();
|
||||
if (currentUser) {
|
||||
let projectMembers = this.sessionService.getProjectMembers();
|
||||
if (projectMembers) {
|
||||
let currentMember = projectMembers.find(m => m.entity_id === currentUser.user_id);
|
||||
if (currentMember) {
|
||||
project.is_member = true;
|
||||
project.has_project_admin_role = (currentMember.role_name === 'projectAdmin');
|
||||
project.role_name = currentMember.role_name;
|
||||
}
|
||||
}
|
||||
if (currentUser.has_admin_role) {
|
||||
project.has_project_admin_role = true;
|
||||
project.is_member = true;
|
||||
project.role_name = 'MEMBER.SYS_ADMIN';
|
||||
} else {
|
||||
project.has_project_admin_role = (project.current_user_role_id === Roles.PROJECT_ADMIN);
|
||||
project.is_member = (project.current_user_role_id > 0);
|
||||
project.role_name = RoleInfo[project.current_user_role_id];
|
||||
}
|
||||
}
|
||||
return project;
|
||||
|
@ -83,3 +83,10 @@ export const ProjectRoles = [
|
||||
{ id: 2, value: "MEMBER.DEVELOPER" },
|
||||
{ id: 3, value: "MEMBER.GUEST" }
|
||||
];
|
||||
|
||||
export enum Roles {
|
||||
PROJECT_ADMIN = 1,
|
||||
DEVELOPER = 2,
|
||||
GUEST = 3,
|
||||
OTHER = 0,
|
||||
}
|
||||
|
@ -36,7 +36,10 @@
|
||||
"EDIT": "EDIT",
|
||||
"SWITCH": "SWITCH",
|
||||
"REPLICATE": "REPLICATE",
|
||||
"ACTIONS": "Actions"
|
||||
"ACTIONS": "Actions",
|
||||
"BROWSE": "Browse",
|
||||
"UPLOAD": "Upload",
|
||||
"NO_FILE": "No file selected"
|
||||
},
|
||||
"BATCH": {
|
||||
"DELETED_SUCCESS": "Deleted successfully",
|
||||
@ -265,7 +268,9 @@
|
||||
"REG_TIME": "Registration Time",
|
||||
"ADD_GROUP_SUCCESS": "Add group success",
|
||||
"EDIT_GROUP_SUCCESS": "Edit group success",
|
||||
"LDAP_TYPE": "LDAP"
|
||||
"LDAP_TYPE": "LDAP",
|
||||
"OF": "of",
|
||||
"ITEMS": "items"
|
||||
},
|
||||
"AUDIT_LOG": {
|
||||
"USERNAME": "Username",
|
||||
@ -487,6 +492,7 @@
|
||||
"MAINTAINERS": "Maintainers",
|
||||
"PULLS": "Pull Count",
|
||||
"VERSION": "Version",
|
||||
"APP_VERSION": "Application Version",
|
||||
"INSTALL": "Install",
|
||||
"INSTALL_CHART": "Install Chart",
|
||||
"NAME": "Name",
|
||||
|
@ -36,8 +36,10 @@
|
||||
"EDIT": "EDITAR",
|
||||
"SWITCH": "SWITCH",
|
||||
"REPLICATE": "REPLICATE",
|
||||
"ACTIONS": "Actions"
|
||||
|
||||
"ACTIONS": "Actions",
|
||||
"BROWSE": "Browse",
|
||||
"UPLOAD": "Upload",
|
||||
"NO_FILE": "No file selected"
|
||||
},
|
||||
"BATCH": {
|
||||
"DELETED_SUCCESS": "Deleted successfully",
|
||||
@ -264,7 +266,9 @@
|
||||
"REG_TIME": "Registration Time",
|
||||
"ADD_GROUP_SUCCESS": "Add group success",
|
||||
"EDIT_GROUP_SUCCESS": "Edit group success",
|
||||
"LDAP_TYPE": "LDAP"
|
||||
"LDAP_TYPE": "LDAP",
|
||||
"OF": "of",
|
||||
"ITEMS": "items"
|
||||
},
|
||||
"AUDIT_LOG": {
|
||||
"USERNAME": "Nombre de usuario",
|
||||
@ -486,6 +490,7 @@
|
||||
"MAINTAINERS": "Maintainers",
|
||||
"PULLS": "Pull Count",
|
||||
"VERSION": "Version",
|
||||
"APP_VERSION": "Application Version",
|
||||
"INSTALL": "Install",
|
||||
"INSTALL_CHART": "Install Chart",
|
||||
"NAME": "Name",
|
||||
|
@ -33,7 +33,10 @@
|
||||
"NO": "NON",
|
||||
"NEGATIVE": "NEGATIF",
|
||||
"COPY": "COPIER",
|
||||
"ACTIONS": "Actions"
|
||||
"ACTIONS": "Actions",
|
||||
"BROWSE": "Browse",
|
||||
"UPLOAD": "Upload",
|
||||
"NO_FILE": "No file selected"
|
||||
},
|
||||
"TOOLTIP": {
|
||||
"EMAIL": "L'email doit être une adresse email valide comme name@example.com.",
|
||||
@ -248,7 +251,9 @@
|
||||
"REG_TIME": "Registration Time",
|
||||
"ADD_GROUP_SUCCESS": "Add group success",
|
||||
"EDIT_GROUP_SUCCESS": "Edit group success",
|
||||
"LDAP_TYPE": "LDAP"
|
||||
"LDAP_TYPE": "LDAP",
|
||||
"OF": "of",
|
||||
"ITEMS": "items"
|
||||
},
|
||||
"AUDIT_LOG": {
|
||||
"USERNAME": "Nom d'utilisateur",
|
||||
@ -462,6 +467,7 @@
|
||||
"MAINTAINERS": "Maintainers",
|
||||
"PULLS": "Pull Count",
|
||||
"VERSION": "Version",
|
||||
"APP_VERSION": "Application Version",
|
||||
"INSTALL": "Install",
|
||||
"INSTALL_CHART": "Install Chart",
|
||||
"NAME": "Name",
|
||||
|
@ -36,7 +36,10 @@
|
||||
"EDIT": "编辑",
|
||||
"SWITCH": "切换",
|
||||
"REPLICATE": "复制",
|
||||
"ACTIONS": "操作"
|
||||
"ACTIONS": "操作",
|
||||
"BROWSE": "选择文件",
|
||||
"UPLOAD": "上传",
|
||||
"NO_FILE": "未选择文件"
|
||||
},
|
||||
"BATCH": {
|
||||
"DELETED_SUCCESS": "删除成功",
|
||||
@ -264,7 +267,9 @@
|
||||
"REG_TIME": "注册时间",
|
||||
"ADD_GROUP_SUCCESS": "添加组成功",
|
||||
"EDIT_GROUP_SUCCESS": "修改组成功",
|
||||
"LDAP_TYPE": "LDAP"
|
||||
"LDAP_TYPE": "LDAP",
|
||||
"OF": "共计",
|
||||
"ITEMS": "条记录"
|
||||
},
|
||||
"AUDIT_LOG": {
|
||||
"USERNAME": "用户名",
|
||||
@ -492,8 +497,9 @@
|
||||
"REPO": "仓库",
|
||||
"FILTER_FOR_CHARTS": "过滤Chart",
|
||||
"DELETE": "删除",
|
||||
"OF": "的",
|
||||
"OF": "共计",
|
||||
"VERSIONS": "版本",
|
||||
"APP_VERSION": "应用版本",
|
||||
"IMAGES": "镜像",
|
||||
"ENGINE": "引擎",
|
||||
"ACTION": "动作",
|
||||
@ -511,7 +517,7 @@
|
||||
"SIGN": "签名",
|
||||
"SIGNED": "已签名",
|
||||
"UNSIGNED": "未签名",
|
||||
"ITEMS": "项",
|
||||
"ITEMS": "条记录",
|
||||
"NO_README": "此Chart未提供README文件",
|
||||
"SECURITY": "安全",
|
||||
"ACTIVE": "正常",
|
||||
|
Loading…
Reference in New Issue
Block a user