Remove Upload Button on Chart Version List

There is no method to constrict which chart to upload, so remove this button

Signed-off-by: Qian Deng <dengq@vmware.com>
This commit is contained in:
Qian Deng 2018-08-15 10:28:47 +08:00
parent 579124d069
commit a8ab6e3b1f
2 changed files with 1 additions and 59 deletions

View File

@ -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>&nbsp;{{'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>&nbsp;{{'HELM_CHART.DOWNLOAD' | translate}}</button>
@ -120,28 +116,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>

View File

@ -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,
@ -201,9 +196,6 @@ export class ChartVersionComponent implements OnInit {
}
);
}
versionUpload() {
this.isUploadModalOpen = true;
}
showCard(cardView: boolean) {
if (this.isCardView === cardView) {
@ -236,30 +228,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,6 +243,7 @@ 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 => {