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-datagrid (clrDgRefresh)="refresh($event)" [clrDgLoading]="loading" [(clrDgSelected)]="selectedRows">
<clr-dg-action-bar> <clr-dg-action-bar>
<button type="button" class="btn btn-sm btn-secondary" <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)" [disabled]="!(selectedRows.length===1)"
(click)="versionDownload()"> (click)="versionDownload()">
<clr-icon shape="download" size="16"></clr-icon>&nbsp;{{'HELM_CHART.DOWNLOAD' | translate}}</button> <clr-icon shape="download" size="16"></clr-icon>&nbsp;{{'HELM_CHART.DOWNLOAD' | translate}}</button>
@ -120,28 +116,5 @@
<span class="spinner"></span> <span class="spinner"></span>
</div> </div>
</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> <confirmation-dialog #confirmationDialog (confirmAction)="confirmDeletion($event)"></confirmation-dialog>
</div> </div>

View File

@ -8,7 +8,6 @@ import {
Output, Output,
EventEmitter EventEmitter
} from "@angular/core"; } from "@angular/core";
import { NgForm } from "@angular/forms";
import { Observable } from "rxjs/Observable"; import { Observable } from "rxjs/Observable";
import "rxjs/add/observable/forkJoin"; import "rxjs/add/observable/forkJoin";
@ -72,16 +71,12 @@ export class ChartVersionComponent implements OnInit {
totalCount = 0; totalCount = 0;
currentState: State; currentState: State;
isUploading = false;
isUploadModalOpen = false;
chartFile: File; chartFile: File;
provFile: File; provFile: File;
@ViewChild("confirmationDialog") @ViewChild("confirmationDialog")
confirmationDialog: ConfirmationDialogComponent; confirmationDialog: ConfirmationDialogComponent;
@ViewChild("chartUploadForm") form: NgForm;
constructor( constructor(
private errorHandler: ErrorHandler, private errorHandler: ErrorHandler,
private translateService: TranslateService, private translateService: TranslateService,
@ -201,9 +196,6 @@ export class ChartVersionComponent implements OnInit {
} }
); );
} }
versionUpload() {
this.isUploadModalOpen = true;
}
showCard(cardView: boolean) { showCard(cardView: boolean) {
if (this.isCardView === cardView) { 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) { onChartFileChangeEvent(event) {
if (event.target.files && event.target.files.length > 0) { if (event.target.files && event.target.files.length > 0) {
this.chartFile = event.target.files[0]; this.chartFile = event.target.files[0];
@ -275,6 +243,7 @@ export class ChartVersionComponent implements OnInit {
env.stopPropagation(); env.stopPropagation();
this.openVersionDeleteModal([version]); this.openVersionDeleteModal([version]);
} }
openVersionDeleteModal(versions: HelmChartVersion[]) { openVersionDeleteModal(versions: HelmChartVersion[]) {
let versionNames = versions.map(v => v.name).join(","); let versionNames = versions.map(v => v.name).join(",");
this.translateService.get("HELM_CHART.DELETE_CHART_VERSION").subscribe(key => { this.translateService.get("HELM_CHART.DELETE_CHART_VERSION").subscribe(key => {