Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Volume Import Wizard #740

Merged
merged 8 commits into from May 15, 2018
Merged
7 changes: 7 additions & 0 deletions proxy.config.json.skel
Expand Up @@ -5,5 +5,12 @@
"changeOrigin": true,
"pathRewrite": {"^/api" : "http://$SERVER$/api"},
"loglevel": "debug"
},
"/_upload": {
"target": "http://$SERVER$",
"secure": false,
"changeOrigin": true,
"pathRewrite": {"^/_upload" : "http://$SERVER$/_upload"},
"loglevel": "debug"
}
}
@@ -1,7 +1,7 @@
<!-- <ng-template [ngTemplateOutlet]="templateTop" [ngTemplateOutletContext]="this"></ng-template> -->
<mat-card>
<form [formGroup]="formGroup" #entityForm="ngForm">
<mat-horizontal-stepper [linear]="conf?.isLinear" formArrayName="formArray">
<mat-horizontal-stepper [linear]="conf?.isLinear" formArrayName="formArray" #stepper>
<div *ngFor="let step of conf.wizardConfig; let i = index">
<mat-step formGroupName="{{i}}" [stepControl]="formArray?.get([i])">
<ng-template matStepLabel>{{step.label | translate}}</ng-template>
Expand All @@ -14,7 +14,11 @@
<mat-card-actions class="wizard-action">
<button id="goback_button" color="accent" *ngIf="i == 0 ? true : false" class="btn btn-block btn-raised btn-lg btn-primary" (click)="goBack()" mat-raised-button color="accent">{{"Cancel" | translate}}</button>
<button mat-raised-button matStepperPrevious *ngIf="i == 0 ? false : true" color="accent">{{"Back" | translate}}</button>
<button mat-raised-button matStepperNext color="primary" >{{"Next" | translate}}</button>
<button *ngIf="!conf.customNext" mat-raised-button matStepperNext color="primary" >{{"Next" | translate}}</button>
<button *ngIf="conf.customNext" (click)="conf.customNext(stepper)" mat-raised-button color="primary">{{customNextText | translate}}</button>
<span *ngFor="let custBtn of conf.custActions">
<button id="cust_button_{{custBtn.name}}" mat-button *ngIf="!conf.isCustActionVisible || conf.isCustActionVisible(custBtn.id)" type="button" (click)="custBtn['function']()">{{custBtn.name | translate}}</button>
</span>
</mat-card-actions>
</mat-step>
</div>
Expand All @@ -29,7 +33,7 @@
{{"Confirm your information" | translate}}
<mat-card-actions class="wizard-action">
<button mat-raised-button matStepperPrevious color="accent">{{"Back" | translate}}</button>
<button mat-raised-button color="primary" (click)="onSubmit()">{{"Submit" | translate}}</button>
<button mat-raised-button color="primary" (click)="onSubmit()">{{saveSubmitText | translate}}</button>
</mat-card-actions>
</mat-step>
</mat-horizontal-stepper>
Expand Down
Expand Up @@ -3,6 +3,7 @@ import { Router, ActivatedRoute } from '@angular/router';
import { RestService, WebSocketService } from '../../../../services';
import { AbstractControl, FormBuilder, FormGroup, FormArray, Validators } from '@angular/forms';
import { TranslateService } from '@ngx-translate/core';
import { T } from '../../../../translate-marker';

import { FieldConfig } from '../../entity/entity-form/models/field-config.interface';
import { EntityFormService } from '../../entity/entity-form/services/entity-form.service';
Expand All @@ -29,6 +30,9 @@ export class EntityWizardComponent implements OnInit {

public busy: Subscription;

public saveSubmitText = T("Submit");
public customNextText = T("Next");

get formArray(): AbstractControl | null { return this.formGroup.get('formArray'); }

constructor(protected rest: RestService, protected ws: WebSocketService,
Expand Down Expand Up @@ -62,6 +66,10 @@ export class EntityWizardComponent implements OnInit {
}
}

if (this.conf.saveSubmitText) {
this.saveSubmitText = this.conf.saveSubmitText;
}

if (this.conf.afterInit) {
this.conf.afterInit(this);
}
Expand Down
9 changes: 4 additions & 5 deletions src/app/pages/storage/storage.module.ts
Expand Up @@ -24,7 +24,6 @@ import { DiskComponent, ManagerComponent, VdevComponent } from './volumes/manage
// import { VolumesEditComponent } from './volumes/volumes-edit/';
import { VolumeDeleteComponent } from './volumes/volume-delete/';
import { VolumesListComponent } from './volumes/volumes-list/';
import { VolumeImportListComponent } from './volumes/volume-import/';
import { routing } from './storage.routing';
import { ZvolAddComponent } from './volumes/zvol/zvol-add'
import { ZvolEditComponent } from './volumes/zvol/zvol-edit/';
Expand All @@ -39,7 +38,8 @@ import { VolumeUnlockFormComponent } from 'app/pages/storage/volumes/volumeunloc
import { VolumeRekeyFormComponent } from 'app/pages/storage/volumes/volumerekey-form';
import { VolumeAddkeyFormComponent } from 'app/pages/storage/volumes/volumeaddkey-form';
import { VolumeCreatekeyFormComponent } from 'app/pages/storage/volumes/volumecreatekey-form/volumecreatekey-form.component';
import { VolumeUnencryptImportListComponent } from './volumes/volume-unencryptimports';
import { VolumeImportWizardComponent} from './volumes/volume-import-wizard';
import { MessageService } from '../common/entity/entity-form/services/message.service';


@NgModule({
Expand All @@ -62,8 +62,7 @@ import { VolumeUnencryptImportListComponent } from './volumes/volume-unencryptim
VolumeCreatekeyFormComponent,
ZvolAddComponent,
ZvolEditComponent,
VolumeImportListComponent,
VolumeUnencryptImportListComponent,
VolumeImportWizardComponent,
SnapshotListComponent,
SnapshotCloneComponent,
SnapshotRollbackComponent,
Expand All @@ -77,7 +76,7 @@ import { VolumeUnencryptImportListComponent } from './volumes/volume-unencryptim
DiskFormComponent,
DiskWipeComponent
],
providers : [UserService, StorageService]
providers : [UserService, StorageService, MessageService]
})
export class StorageModule {
}
9 changes: 2 additions & 7 deletions src/app/pages/storage/storage.routing.ts
Expand Up @@ -13,7 +13,6 @@ import { VolumeDeleteComponent } from './volumes/volume-delete/index';
import { VolumesListComponent } from './volumes/volumes-list/';
import { ZvolAddComponent } from './volumes/zvol/zvol-add/';
import { ZvolEditComponent } from './volumes/zvol/zvol-edit/';
import { VolumeImportListComponent } from './volumes/volume-import/';
import { VMwareSnapshotFormComponent } from './VMware-snapshot/VMware-snapshot';
import { VMwareSnapshotListComponent } from './VMware-snapshot/VMware-snapshot-list';
import { ImportDiskComponent } from './import-disk/import-disk.component';
Expand All @@ -24,7 +23,7 @@ import { DiskWipeComponent } from './disks/disk-wipe/disk-wipe.component';
import { VolumeUnlockFormComponent } from 'app/pages/storage/volumes/volumeunlock-form/volumeunlock-form.component';
import { VolumeRekeyFormComponent } from 'app/pages/storage/volumes/volumerekey-form';
import { VolumeCreatekeyFormComponent } from 'app/pages/storage/volumes/volumecreatekey-form';
import { VolumeUnencryptImportListComponent } from './volumes/volume-unencryptimports';
import { VolumeImportWizardComponent} from './volumes/volume-import-wizard';

export const routes: Routes = [
{
Expand Down Expand Up @@ -68,13 +67,9 @@ export const routes: Routes = [
data: { title: 'Extend Pool', breadcrumb: 'Extend Pool' }
},
{
path: 'import_list', component: VolumeImportListComponent,
path: 'import', component: VolumeImportWizardComponent,
data: { title: 'Import Pool', breadcrumb: 'Import Pool' }
},
{
path: 'unencryptimport_list', component: VolumeUnencryptImportListComponent,
data: { title: 'UnEncrypt Pool', breadcrumb: 'UnEncrypt Pool' }
},
{
path: 'status/:pk', component: StatusComponent,
data: { title: 'Scrub Status', breadcrumb: 'Scrub Status' }
Expand Down
@@ -0,0 +1 @@
export { VolumeImportWizardComponent } from './volume-import-wizard.component';