diff --git a/src/app/pages/env/env.component.ts b/src/app/pages/env/env.component.ts index e53e94068..25313a159 100644 --- a/src/app/pages/env/env.component.ts +++ b/src/app/pages/env/env.component.ts @@ -99,9 +99,13 @@ export class EnvComponent implements OnInit, OnDestroy { handleSaveEnv() { // * update list after call save api - const { parameters, ...other } = this.envInfo; + const { parameters, name, ...other } = this.envInfo; + if (!name) { + this.message.error('Name is not allowed to be empty.'); + return; + } const data = parameters.filter((it) => it.name && it.value); - this.envService.create({ ...other, parameters: data }).subscribe((result: Environment) => { + this.envService.create({ ...other, name, parameters: data }).subscribe((result: Environment) => { this.envInfo = result; this.activeUuid = Number(result.uuid); this.handleSwitchEnv(result.uuid); @@ -116,9 +120,13 @@ export class EnvComponent implements OnInit, OnDestroy { handleUpdateEnv(uuid: string | number) { // * update env - const { parameters, ...other } = this.envInfo; + const { parameters, name, ...other } = this.envInfo; + if (!name) { + this.message.error('Name is not allowed to be empty.'); + return; + } const data = parameters.filter((it) => it.name && it.value); - this.envService.update({ ...other, parameters: data }, uuid).subscribe((result: Environment) => { + this.envService.update({ ...other, name, parameters: data }, uuid).subscribe((result: Environment) => { this.message.success('Save suceess'); this.getAllEnv(); }); diff --git a/src/app/shared/components/params-import/params-import.component.ts b/src/app/shared/components/params-import/params-import.component.ts index 002a7b2ed..a0c5cdadd 100644 --- a/src/app/shared/components/params-import/params-import.component.ts +++ b/src/app/shared/components/params-import/params-import.component.ts @@ -52,7 +52,6 @@ export class ParamsImportComponent { if (this.contentType === 'json') { try { paramCode = JSON.parse(this.paramCode); - console.log('lll', paramCode); } catch (error) { this.message.error('JSON格式不合法'); return; @@ -86,7 +85,6 @@ export class ParamsImportComponent { console.warn('The code that you input is no-equal to the root type.'); } // if (whatType(paramCode) === 'object') { - // console.log('kk', paramCode); // * transform to array of table format. // } if (this.rootType === 'array' && whatType(paramCode) === 'array') { @@ -96,6 +94,7 @@ export class ParamsImportComponent { } // * tree to array for table render const cacheData = flatData(Object.keys(paramCode).map((it) => parseTree(it, paramCode[it]))); + // TODO delete useless attribute in cacheData switch (type) { case 'mixin': { diff --git a/src/app/utils/data-transfer/data-transfer.ts b/src/app/utils/data-transfer/data-transfer.ts index a8b6e41cf..54a988a73 100644 --- a/src/app/utils/data-transfer/data-transfer.ts +++ b/src/app/utils/data-transfer/data-transfer.ts @@ -130,7 +130,6 @@ interface uiData { } export const xml2UiData = (text) => { const data: any[] = xml2json(text); - console.log('=>', data); const result = {}; const mapAttr = (obj: any) => { const { tagName, attr, children, content } = obj;