-
Notifications
You must be signed in to change notification settings - Fork 832
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #508 from BennieMeng/feature/deplayment-replica
Feature/deplayment replica
- Loading branch information
Showing
26 changed files
with
313 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/frontend/src/app/admin/namespace/migrate-namespace/migrate-namespace.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<wayne-modal [isValid]="isValid"> | ||
<span header>命名空间迁移</span> | ||
<content> | ||
<form #namespaceForm="ngForm" clrForm clrLayout="horizontal"> | ||
<clr-input-container> | ||
<label>当前空间: </label> | ||
<input type="text" clrInput id="ns_name" [(ngModel)]="currentNamespace.name" name="ns_name" size="36" readonly> | ||
</clr-input-container> | ||
<clr-select-container> | ||
<label>目标空间: </label> | ||
<select clrSelect name="target" [(ngModel)]="target"> | ||
<option *ngFor="let namespace of namespaces" [value]="namespace.id">{{namespace.name}}</option> | ||
</select> | ||
</clr-select-container> | ||
</form> | ||
</content> | ||
</wayne-modal> |
Empty file.
25 changes: 25 additions & 0 deletions
25
src/frontend/src/app/admin/namespace/migrate-namespace/migrate-namespace.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { MigrateNamespaceComponent } from './migrate-namespace.component'; | ||
|
||
describe('MigrateNamespaceComponent', () => { | ||
let component: MigrateNamespaceComponent; | ||
let fixture: ComponentFixture<MigrateNamespaceComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ MigrateNamespaceComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(MigrateNamespaceComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
78 changes: 78 additions & 0 deletions
78
src/frontend/src/app/admin/namespace/migrate-namespace/migrate-namespace.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core'; | ||
import { Namespace } from 'app/shared/model/v1/namespace'; | ||
import { NgForm } from '@angular/forms'; | ||
import { ModalComponent } from 'app/shared/modal/modal.component'; | ||
import { ModalService } from 'app/shared/modal/modal.service'; | ||
import { Subscription } from 'rxjs'; | ||
import { NamespaceService } from 'app/shared/client/v1/namespace.service'; | ||
import { MessageHandlerService } from 'app/shared/message-handler/message-handler.service'; | ||
@Component({ | ||
selector: 'migrate-namespace', | ||
templateUrl: './migrate-namespace.component.html', | ||
styleUrls: ['./migrate-namespace.component.scss'] | ||
}) | ||
export class MigrateNamespaceComponent implements OnInit, OnDestroy { | ||
namespaceForm: NgForm; | ||
@ViewChild('namespaceForm', { static: false }) | ||
currentForm: NgForm; | ||
@ViewChild(ModalComponent, { static: false }) | ||
modalComponent: ModalComponent; | ||
|
||
currentNamespace: Namespace = new Namespace; | ||
target: number; | ||
namespaces: Namespace[] = []; | ||
subscription: Subscription; | ||
constructor( | ||
private modalService: ModalService, | ||
private namespaceService: NamespaceService, | ||
private message: MessageHandlerService | ||
) { | ||
this.subscription = this.modalService.modalObservable$.subscribe(res => { | ||
switch (res.method) { | ||
case 'cancel': | ||
this.cancelEvent(); | ||
break; | ||
case 'confirm': | ||
this.confirmEvent(); | ||
break; | ||
} | ||
}); | ||
} | ||
|
||
ngOnInit() { | ||
} | ||
|
||
ngOnDestroy() { | ||
this.subscription.unsubscribe(); | ||
} | ||
|
||
cancelEvent() { | ||
this.namespaces = []; | ||
this.modalComponent.opened = false; | ||
} | ||
|
||
confirmEvent() { | ||
this.namespaceService.migrateNamespace(this.currentNamespace.id, Number(this.target)) | ||
.subscribe( | ||
res => { | ||
this.message.showSuccess(`${this.currentNamespace.name}迁移成功`); | ||
this.modalComponent.opened = false; | ||
}, | ||
error => this.message.error(error) | ||
); | ||
} | ||
|
||
open(ns: Namespace, namespaceList: Namespace[]) { | ||
this.target = undefined; | ||
this.currentNamespace = ns; | ||
this.modalComponent.opened = true; | ||
this.namespaces = namespaceList.filter(namespace => { | ||
return namespace.id !== ns.id; | ||
}) || []; | ||
} | ||
|
||
public get isValid() { | ||
return !!this.target; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.