Reworking config editor UI (#131)

* work in progress refactoring

* work in progress refactoring

* work in progress refactoring

* refactoring work in progress

* adding json-tree style into edit view

* removed redux

* adding routing

* fixing missing import

* simplification of Editor Service Guard

* fixing popover

* fixing service initialisation

* removing refresh button for now

* removed unused file

* fixing circular dependencies

* fixing testing config component

* reworking testing work in progress

* worki in progress commit

* fixing testing components

* fixing gitignore

* Delete bufferToggle.js

* minor cleaning

* minor fixes

* increase version, minor cleaning

* minor cleaning

* cleaning the code

* cleaning service metadata

* fixing submitting test case component

* removed copied code

* removing mysteriuos dynamicFieldsMap

* fixing editor view for undefined fields

* submitting test case

* fixing update of test case after submit

* fixing submiting test case

* minor code cleaning

* fixing broken template

* renamea file for ConfigStoreStateBuilder

* fixing test case editor

* remove ngrx dependencies
This commit is contained in:
Marian Novotny
2020-09-24 11:26:33 +01:00
committed by GitHub Enterprise
parent 8abfea2527
commit 9bc6f91b06
94 changed files with 4116 additions and 7972 deletions

View File

@@ -8,15 +8,10 @@ import { FormGroup } from '@angular/forms';
import { AppConfigService } from '@app/config';
import { EditorService } from '@services/editor.service';
import { ConfigData, ConfigWrapper, Deployment } from '@app/model';
import { Store } from '@ngrx/store';
import { FormlyFieldConfig, FormlyFormOptions } from '@ngx-formly/core';
import { FormlyJsonschema } from '@ngx-formly/core/json-schema';
import * as fromStore from 'app/store';
import { cloneDeep } from 'lodash';
import { Observable } from 'rxjs';
import { take } from 'rxjs/operators';
import { TestingDialogComponent } from '../testing/testing-dialog/testing-dialog.component';
import { JSONSchema7 } from 'json-schema';
@Component({
selector: 're-deploy-dialog',
@@ -26,13 +21,11 @@ import { JSONSchema7 } from 'json-schema';
export class DeployDialogComponent {
deployment: Deployment<ConfigWrapper<ConfigData>>;
environment: string;
isValid = undefined;
validating = true;
message: string;
exception: string;
statusCode: string;
serviceName$: Observable<string>;
deploymentSchema = {};
serviceName: string;
uiMetadata: UiMetadataMap;
@@ -47,19 +40,17 @@ export class DeployDialogComponent {
constructor(public dialogref: MatDialogRef<DeployDialogComponent>,
private config: AppConfigService,
public dialog: MatDialog,
private store: Store<fromStore.State>,
private service: EditorService,
private formlyJsonSchema: FormlyJsonschema,
@Inject(MAT_DIALOG_DATA) public data: Deployment<ConfigWrapper<ConfigData>>) {
this.store.select(fromStore.getServiceName).pipe(take(1)).subscribe(r => {
this.validating = false;
this.serviceName = r;
this.uiMetadata = this.config.getUiMetadata(r);
if (this.uiMetadata.deployment.extras !== undefined) {
this.fields = [this.formlyJsonSchema.toFieldConfig(this.createDeploymentSchema(r))];
} else {
this.service.configLoader.validateRelease(data).pipe(take(1))
.subscribe(s => {
this.serviceName = service.serviceName;
this.validating = false;
this.uiMetadata = this.config.getUiMetadata(this.serviceName);
if (this.uiMetadata.deployment.extras !== undefined) {
this.fields = [this.formlyJsonSchema.toFieldConfig(service.configLoader.createDeploymentSchema())];
} else {
this.service.configLoader.validateRelease(data).pipe(take(1))
.subscribe(s => {
if (s !== undefined) {
this.statusCode = s.status_code;
if (s.status_code !== StatusCode.OK) {
@@ -69,31 +60,15 @@ export class DeployDialogComponent {
this.validating = false;
this.isValid = s.status_code === StatusCode.OK ? true : false;
}
});
}
});
});
}
this.testEnabled = this.uiMetadata.testing.deploymentTestEnabled;
this.deployment = data;
this.environment = this.config.environment;
}
private createDeploymentSchema(serviceName: string): JSONSchema7 {
const depSchema = this.service.configLoader.originalSchema;
depSchema.properties[this.uiMetadata.deployment.config_array] = {};
delete depSchema.properties[this.uiMetadata.deployment.config_array];
delete depSchema.properties[this.uiMetadata.deployment.version];
depSchema.required = depSchema.required.filter(element => {
if (element !== this.uiMetadata.deployment.version && element !== this.uiMetadata.deployment.config_array) {
return true;
}
return false;
});
return depSchema;
}
onValidate() {
this.deployment = {...this.deployment, ...this.extrasData};
this.service.configLoader
@@ -118,12 +93,7 @@ export class DeployDialogComponent {
}
onClickTest() {
this.dialog.open(TestingDialogComponent, {
data: {
configDto: this.deployment,
singleConfig: false,
},
})
//TODO: add testing deployment
}
onClickClose() {