Skip to content

Commit

Permalink
change update modal
Browse files Browse the repository at this point in the history
  • Loading branch information
kbeyro committed Jan 24, 2024
1 parent 08b1134 commit 7467cb8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ <h3><em style="color: #337ab7;">{{ translateState(appInstanceStatus?.state) }}</
<button class="btn btn-danger"
*roles="['ROLE_DOMAIN_ADMIN', 'ROLE_SYSTEM_ADMIN']"
(click)="this.appAbortModal.show()">{{'APP_INSTANCE.ABORT_BUTTON' | translate}}</button>
<button *roles="['ROLE_SYSTEM_ADMIN' ]">
<a role="button" (click)="this.openVersionUpdateModal()">
{{'APP_INSTANCES.MANUAL_UPDATE.HEADER' | translate}}
</a>
</button>
</div>

<!-- if application is already running -->
Expand Down Expand Up @@ -206,16 +211,19 @@ <h4 style="text-align: center">{{'APP_INSTANCES.MANUAL_UPDATE.HEADER' | translat
<div class="nmaas-modal-body">
<div class="" style="height: 150px">
<p>{{'APP_INSTANCES.MANUAL_UPDATE.BODY' | translate}}</p>
<div>
<div *ngIf="appVersions.length > 0">
<p-dropdown id="manualUpdate" [options]="appVersions" optionLabel="version" optionValue="version"
placeholder="Select version" emptyMessage="No version available"
[disabled]="appVersions.length === 0" [(ngModel)]="selectedVersion" name="manualUpdate"
ngDefaultControl></p-dropdown>
</div>
<div *ngIf="appVersions.length === 0" class="font-bold">
{{'No other versions available'}}
</div>
</div>
</div>
<div class="nmaas-modal-footer">
<button type="button" class="btn btn-primary " [disabled]="appVersions.length == 0"
<button type="button" class="btn btn-primary " [disabled]="appVersions.length === 0 || selectedVersion === ''"
(click)="this.manualUpdateVersion()">{{'APP_INSTANCES.MANUAL_UPDATE.YES_BUTTON' | translate}}</button>
<button type="button" class="btn btn-danger"
(click)="this.manualUpdateModal.hide()">{{'UNDEPLOY_MODAL.CANCEL_BUTTON' | translate}}</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ export class AppInstanceComponent implements OnInit, OnDestroy {
console.log('update app instance');
this.appInstanceService.getAppInstance(this.appInstanceId).subscribe(appInstance => {
this.appInstance = appInstance;
this.app = appInstance.application;
});
}

Expand Down Expand Up @@ -590,20 +591,18 @@ export class AppInstanceComponent implements OnInit, OnDestroy {

public openVersionUpdateModal() {
this.appsService.getApplicationVersions(this.appInstance.application.applicationBase.id).subscribe( versions => {
console.log('App Versions before filter', versions);
this.appVersions = versions.filter(val => val.state.toString() === 'ACTIVE')
console.log('App Versions after filter', this.appVersions);
this.appVersions = versions.filter(val => val.state.toString() === 'ACTIVE' && val.version !== this.appInstance.applicationVersion )
this.appVersions.sort(this.appVersionCompare)
console.log('App Versions after sort', this.appVersions);
})
this.manualUpdateModal.show();
}

public manualUpdateVersion() {
this.appInstanceService.manualUpdateVersion(this.appInstanceId, this.selectedVersion).subscribe( next => {
console.debug("manualy updated version");
})
this.manualUpdateModal.hide();
this.appInstanceService.manualUpdateVersion(this.appInstanceId, this.selectedVersion).subscribe( next => {
this.manualUpdateModal.hide();
this.updateAppInstance()
})

}


Expand Down

0 comments on commit 7467cb8

Please sign in to comment.