diff --git a/src/composer/src/app/app.module.ts b/src/composer/src/app/app.module.ts
index 0083051..f570e33 100644
--- a/src/composer/src/app/app.module.ts
+++ b/src/composer/src/app/app.module.ts
@@ -68,6 +68,7 @@ import { GlobalDialogComponent } from './core/components/dialogs/global-dialog/g
import { CodemirrorModule } from '@ctrl/ngx-codemirror';
import { RecipeComponent, DialogPublishRecipe, DialogRecipeDetails } from './core/components/recipe/recipe.component';
import { BuildDialogComponent } from './core/components/dialogs/build-dialog/build-dialog.component';
+import { DeployDialogComponent } from './core/components/dialogs/deploy-dialog/deploy-dialog.component';
export function getHighlightLanguages() {
return {
@@ -105,7 +106,8 @@ export function getHighlightLanguages() {
RecipeComponent,
DialogPublishRecipe,
DialogRecipeDetails,
- BuildDialogComponent
+ BuildDialogComponent,
+ DeployDialogComponent
],
imports: [
BrowserModule,
diff --git a/src/composer/src/app/core/components/dialogs/deploy-dialog/deploy-dialog.component.html b/src/composer/src/app/core/components/dialogs/deploy-dialog/deploy-dialog.component.html
new file mode 100644
index 0000000..5ad3e9d
--- /dev/null
+++ b/src/composer/src/app/core/components/dialogs/deploy-dialog/deploy-dialog.component.html
@@ -0,0 +1,133 @@
+
Deploy Config
+
+
+
+
+
+
+
+
+ Command
+
+
+
Preferences
+
+
+
+
+
+ Labels
+
+
+
+
+
+
+
+
+
+
diff --git a/src/composer/src/app/core/components/dialogs/deploy-dialog/deploy-dialog.component.scss b/src/composer/src/app/core/components/dialogs/deploy-dialog/deploy-dialog.component.scss
new file mode 100644
index 0000000..e69de29
diff --git a/src/composer/src/app/core/components/dialogs/deploy-dialog/deploy-dialog.component.spec.ts b/src/composer/src/app/core/components/dialogs/deploy-dialog/deploy-dialog.component.spec.ts
new file mode 100644
index 0000000..320adbe
--- /dev/null
+++ b/src/composer/src/app/core/components/dialogs/deploy-dialog/deploy-dialog.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { DeployDialogComponent } from './deploy-dialog.component';
+
+describe('DeployDialogComponent', () => {
+ let component: DeployDialogComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ DeployDialogComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(DeployDialogComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/composer/src/app/core/components/dialogs/deploy-dialog/deploy-dialog.component.ts b/src/composer/src/app/core/components/dialogs/deploy-dialog/deploy-dialog.component.ts
new file mode 100644
index 0000000..274d4b7
--- /dev/null
+++ b/src/composer/src/app/core/components/dialogs/deploy-dialog/deploy-dialog.component.ts
@@ -0,0 +1,87 @@
+import { Component, OnInit, ViewChild, Inject } from '@angular/core'
+import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'
+import { FormControl, Validators, FormGroup, FormBuilder, AbstractControl } from '@angular/forms'
+import { KeyValueComponent } from '../../common/key-value/key-value/key-value.component'
+import { Service, ServiceDeploy } from '../../../store/models'
+import { CheckCircleComponent } from '../../widgets/check-circle/check-circle.component'
+import { Store } from '@ngrx/store'
+import * as ProjectActions from './../../../store/project.actions'
+import { EventEmitterService } from 'src/app/core/services/event-emitter.service'
+
+@Component({
+ selector: 'app-deploy-dialog',
+ templateUrl: './deploy-dialog.component.html',
+ styleUrls: ['./deploy-dialog.component.scss']
+})
+export class DeployDialogComponent implements OnInit {
+ @ViewChild(CheckCircleComponent) checkCircle: CheckCircleComponent
+ @ViewChild('preferences') preferences: KeyValueComponent
+ @ViewChild('labels') labels: KeyValueComponent
+
+ formGeneral: FormGroup
+ currentPreferences: [] = []
+ currentLabels: [] = []
+ constructor(public dialogRef: MatDialogRef, private formBuilder: FormBuilder, @Inject(MAT_DIALOG_DATA) public data: Service, private store: Store, private eventEmitterService: EventEmitterService,) { }
+
+ ngOnInit(): void {
+ this.formGeneral = this.formBuilder.group({
+ mode: new FormControl(''),
+ replicas: new FormControl(''),
+ update_config: this.formBuilder.group({
+ parallelism: new FormControl('', [Validators.pattern('^[0-9]+$')]),
+ delay: new FormControl(''),
+ order: new FormControl('')
+ }),
+ rollback_config: new FormControl(''),
+ restart_policy: this.formBuilder.group({
+ condition: new FormControl(''),
+ delay: new FormControl(''),
+ parallelism: new FormControl('', [Validators.pattern('^[0-9]+$')]),
+ window: new FormControl(''),
+ }),
+ endpoint_mode: new FormControl(''),
+ placement: new FormControl(''),
+ max_replicas_per_node: new FormControl('', [Validators.pattern('^[0-9]+$')]),
+ resources: this.formBuilder.group({
+ limits: this.formBuilder.group({
+ cpus: new FormControl(''),
+ memory: new FormControl('')
+ }),
+ reservations: this.formBuilder.group({
+ cpus: new FormControl(''),
+ memory: new FormControl('')
+ })
+ })
+ })
+
+ if(this.data.deploy) {
+ this.data.deploy.labels.forEach(val => this.currentLabels.push(val))
+ this.data.deploy.placement.preferences.forEach(val => this.currentPreferences.push(val))
+
+ this.formGeneral.patchValue({
+ ...this.data.deploy,
+ placement: this.data.deploy.placement.constraints.join(',')
+ })
+ }
+ }
+
+ onSave(): void {
+ const fields: ServiceDeploy = {
+ ...this.formGeneral.getRawValue(),
+ placement: {
+ constraints: this.formGeneral.get('placement').value.split(','),
+ preferences: this.preferences.getKeyValuePaies()
+ },
+ labels: this.labels.getKeyValuePaies(),
+ }
+
+ this.store.dispatch(ProjectActions.UpdateService({data: {...this.data, deploy: fields}}))
+ this.checkCircle.showCircle()
+ this.eventEmitterService.broadcast('save:project', {})
+ }
+
+ closeModal(): void {
+ this.dialogRef.close()
+ }
+
+}
diff --git a/src/composer/src/app/core/store/models.ts b/src/composer/src/app/core/store/models.ts
index 7549ca1..d4a1a87 100644
--- a/src/composer/src/app/core/store/models.ts
+++ b/src/composer/src/app/core/store/models.ts
@@ -47,6 +47,7 @@ export interface ServiceDeploy {
delay: string
order: string
}
+ rollback_config: string
restart_policy: {
condition: string
delay: string
@@ -88,7 +89,7 @@ export interface Service {
init: boolean
isolation: string
container_name?: string
- deploy: object
+ deploy: ServiceDeploy
build: ServiceBuildObject
image: string
restart: string