From d6595ecd518719fdb64cecfea9a7fb2777bf4e9b Mon Sep 17 00:00:00 2001 From: buqiyuan <1743369777@qq.com> Date: Fri, 3 Mar 2023 11:27:48 +0800 Subject: [PATCH] fix: import api env validate --- .../extension-select/import-api/import-api.component.ts | 6 ++++-- .../project/api/env/env-edit/env-edit.component.ts | 2 +- .../src/app/shared/services/storage/db/schema/env.json | 4 +++- .../browser/src/app/shared/services/storage/index.model.ts | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/workbench/browser/src/app/modules/extension-select/import-api/import-api.component.ts b/src/workbench/browser/src/app/modules/extension-select/import-api/import-api.component.ts index b0ff24c80..896dd11de 100644 --- a/src/workbench/browser/src/app/modules/extension-select/import-api/import-api.component.ts +++ b/src/workbench/browser/src/app/modules/extension-select/import-api/import-api.component.ts @@ -5,7 +5,7 @@ import { FeatureInfo } from 'eo/workbench/browser/src/app/shared/models/extensio import { ExtensionService } from 'eo/workbench/browser/src/app/shared/services/extensions/extension.service'; import { Message, MessageService } from 'eo/workbench/browser/src/app/shared/services/message'; import { ApiService } from 'eo/workbench/browser/src/app/shared/services/storage/api.service'; -import { parseAndCheckCollections } from 'eo/workbench/browser/src/app/shared/services/storage/db/validate/validate'; +import { parseAndCheckCollections, parseAndCheckEnv } from 'eo/workbench/browser/src/app/shared/services/storage/db/validate/validate'; import { TraceService } from 'eo/workbench/browser/src/app/shared/services/trace.service'; import { StoreService } from 'eo/workbench/browser/src/app/shared/store/state.service'; import { Subject } from 'rxjs'; @@ -124,10 +124,12 @@ export class ImportApiComponent implements OnInit { try { console.log('content', content); const collections = parseAndCheckCollections(data.collections); + const environmentList = data.environmentList.filter(n => parseAndCheckEnv(n).validate); const [result, err] = await this.apiService.api_projectImport({ ...{ ...data, - collections + collections, + environmentList }, projectUuid: this.store.getCurrentProjectID, workSpaceUuid: this.store.getCurrentWorkspaceUuid diff --git a/src/workbench/browser/src/app/pages/workspace/project/api/env/env-edit/env-edit.component.ts b/src/workbench/browser/src/app/pages/workspace/project/api/env/env-edit/env-edit.component.ts index ffb0ecd41..1bbe04548 100644 --- a/src/workbench/browser/src/app/pages/workspace/project/api/env/env-edit/env-edit.component.ts +++ b/src/workbench/browser/src/app/pages/workspace/project/api/env/env-edit/env-edit.component.ts @@ -132,7 +132,7 @@ export class EnvEditComponent implements OnDestroy, TabViewComponent { this.model = { name: '', hostUri: '', - parameters: [] + parameters: '[]' }; this.initialModel = eoDeepCopy(this.model); } else { diff --git a/src/workbench/browser/src/app/shared/services/storage/db/schema/env.json b/src/workbench/browser/src/app/shared/services/storage/db/schema/env.json index e7031f835..e8881f3b2 100644 --- a/src/workbench/browser/src/app/shared/services/storage/db/schema/env.json +++ b/src/workbench/browser/src/app/shared/services/storage/db/schema/env.json @@ -13,7 +13,9 @@ "name": { "type": "string" }, - "parameters": {}, + "parameters": { + "type": "string" + }, "projectUuid": { "type": "string" }, diff --git a/src/workbench/browser/src/app/shared/services/storage/index.model.ts b/src/workbench/browser/src/app/shared/services/storage/index.model.ts index 150d2819b..b704a7a88 100644 --- a/src/workbench/browser/src/app/shared/services/storage/index.model.ts +++ b/src/workbench/browser/src/app/shared/services/storage/index.model.ts @@ -235,7 +235,7 @@ export interface Environment extends StorageModel { /** * Env parameters */ - parameters?: Array<{ name: string; value: string; description: string }>; + parameters?: string; } /**