diff --git a/components.d.ts b/components.d.ts index bfa34015..dafde06b 100644 --- a/components.d.ts +++ b/components.d.ts @@ -25,7 +25,6 @@ declare module 'vue' { AGrid: typeof import('@arco-design/web-vue')['Grid']; AGridItem: typeof import('@arco-design/web-vue')['GridItem']; AInput: typeof import('@arco-design/web-vue')['Input']; - AInputGroup: typeof import('@arco-design/web-vue')['InputGroup']; AInputNumber: typeof import('@arco-design/web-vue')['InputNumber']; AInputPassword: typeof import('@arco-design/web-vue')['InputPassword']; AInputSearch: typeof import('@arco-design/web-vue')['InputSearch']; diff --git a/src/views/application-management/environments/config/interface.ts b/src/views/application-management/environments/config/interface.ts index 4202888f..85248bc7 100644 --- a/src/views/application-management/environments/config/interface.ts +++ b/src/views/application-management/environments/config/interface.ts @@ -1,6 +1,6 @@ import { ServiceRowData } from '@/views/application-management/services/config/interface'; import { ConnectorRowData } from '@/views/operation-hub/connectors/config/interface'; -import { DataListItem } from '@/types/global'; +import { DataListItem, AxiosRequestPayload } from '@/types/global'; export interface EnvironmentRow extends DataListItem { id: string; @@ -19,18 +19,22 @@ export interface EnvironmentRow extends DataListItem { connectorIDs: string[]; } -export interface EnvironFormData { - draft?: boolean; - preview?: boolean; - projectID?: string; - id?: string; - name: string; - type: string; - description: string; - connectorIDs: string[]; - connectors: any[]; - edges?: any[]; - labels?: Record; - resources?: any[]; - variables?: any[]; +export interface EnvironFormData extends AxiosRequestPayload { + metadata: { + name: string; + namespace: string; + labels: object; + }; + spec: { + type: string; + description: string; + draft?: boolean; + preview?: boolean; + connectorIDs: string[]; + connectors: any[]; + edges?: any[]; + labels?: Record; + resources?: any[]; + variables?: any[]; + }; } diff --git a/src/views/application-management/environments/pages/edit.vue b/src/views/application-management/environments/pages/edit.vue index 3ff2b0d1..cace4fcd 100644 --- a/src/views/application-management/environments/pages/edit.vue +++ b/src/views/application-management/environments/pages/edit.vue @@ -40,7 +40,7 @@ > ([]); const formData = ref({ - projectID: route.params.projectId as string, - name: '', - type: '', - description: '', + apiVersion, + kind: ResourceKinds.Environment, + metadata: { + namespace: projectName, + name: '', + labels: {} + }, + spec: { + type: '', + description: '', + connectorIDs: [], + connectors: [], + variables: [], + edges: [], + labels: {}, + resources: [] + }, connectorIDs: [], connectors: [], variables: [], @@ -401,15 +416,16 @@ [HintKeyMaps.var]: [...projectVariables.value, ...variables] }; }); - // const EnvironmentTypeList = computed(() => { - // return _.map(userStore.applicableEnvironmentTypes, (item) => { - // return { - // label: t(EnvironmentTypeMap[item] || ''), - // value: item, - // order: EnvironmentTypeOrder[item] - // }; - // }).sort((a, b) => a.order - b.order); - // }); + const EnvironmentTypeList = computed(() => { + // userStore.applicableEnvironmentTypes + return _.map(_.keys(EnvironmentTypeMap), (item) => { + return { + label: t(EnvironmentTypeMap[item] || ''), + value: item, + order: EnvironmentTypeOrder[item] + }; + }).sort((a, b) => a.order - b.order); + }); const selectableConnectors = computed(() => { return _.filter(connectorList.value, (item) => { return item.applicableEnvironmentType === formData.value.type; @@ -420,10 +436,10 @@ if (isCloneAction) { return t('applications.environment.clone'); } - if (!name) { + if (!envName) { return t('operation.environments.create'); } - if (name && pageAction.value === PageAction.EDIT) { + if (envName && pageAction.value === PageAction.EDIT) { return t('operation.environments.edit'); } return t('operation.environments.view'); @@ -439,8 +455,8 @@ if (route.name === PROJECT.EnvDetail) { pageAction.value = userStore.hasProjectResourceActions({ resource: Resources.Environments, - environmentID: name, - projectID: route.params.projectId, + environmentID: envName, + projectID: route.params.projectName, actions: ['POST'] }) ? PageAction.EDIT @@ -453,8 +469,8 @@ } const hasPermission = userStore.hasProjectResourceActions({ resource: Resources.Environments, - environmentID: name, - projectID: route.params.projectId, + environmentID: envName, + projectID: route.params.projectName, actions: ['POST'] }); return pageAction.value === PageAction.VIEW && hasPermission; @@ -504,10 +520,10 @@ }; const getItemEnvironmentInfo = async () => { copyFormData = cloneDeep(formData.value); - if (!name) return; + if (!envName) return; try { const { data } = await queryItemEnvironments({ - environmentName: name, + environmentName: envName, namespace: projectName }); formData.value = data; @@ -525,7 +541,7 @@ copyFormData = cloneDeep(formData.value); } catch (error) { formData.value = { - projectID: route.params.projectId as string, + projectID: route.params.projectName as string, name: '', type: '', description: '', @@ -596,11 +612,11 @@ if (isCloneAction) { handleCloneEnvironment(data); } - if (name && !isCloneAction) { + if (envName && !isCloneAction) { await updateEnvironment(data); } else if (isCloneAction) { await cloneEnvironment(data, environmentName); - } else if (!name && !environmentName) { + } else if (!envName && !environmentName) { await createEnvironment({ data, namespace: projectName @@ -720,7 +736,7 @@ } }; const setLabels = () => { - labelsData.value.labels = _.cloneDeep(formData.value.labels); + labelsData.value.labels = _.cloneDeep(formData.value.metadata.labels); }; const init = async () => { setBreadCrumbList(); diff --git a/src/views/config/resource-kinds.ts b/src/views/config/resource-kinds.ts index 932f33c2..55d8baae 100644 --- a/src/views/config/resource-kinds.ts +++ b/src/views/config/resource-kinds.ts @@ -8,7 +8,8 @@ export default { Settings: 'Settings', Project: 'Project', Variable: 'Variable', - Connector: 'Connector' + Connector: 'Connector', + Environment: 'Environment' }; export const apiVersion = 'walrus.seal.io/v1'; diff --git a/src/views/operation-hub/catalogs/api/index.ts b/src/views/operation-hub/catalogs/api/index.ts index 49d515d4..1445a2fe 100644 --- a/src/views/operation-hub/catalogs/api/index.ts +++ b/src/views/operation-hub/catalogs/api/index.ts @@ -72,7 +72,7 @@ export function refreshCatalog(data: { name: string; item: object; }) { - const url = `/${NAMESPACES}/${data.namespace}/${CatalogAPI}/${data.name}`; + const url = `/${NAMESPACES}/${data.namespace}/${CatalogAPI}/${data.name}/status`; return axios.put(`${url}`, data.item); } diff --git a/src/views/operation-hub/catalogs/components/catalog-basic.vue b/src/views/operation-hub/catalogs/components/catalog-basic.vue index 3639c77d..977ce969 100644 --- a/src/views/operation-hub/catalogs/components/catalog-basic.vue +++ b/src/views/operation-hub/catalogs/components/catalog-basic.vue @@ -61,8 +61,7 @@ spec: { ...props.formData.spec, vcsSource: { - ...props.formData.spec.vcsSource, - token: '' + ...props.formData.spec.vcsSource } } }); @@ -161,14 +160,8 @@ show-word-limit > - + - - - {authentication.value === 'bearer' && ( + */} + {/* {authentication.value === 'bearer' && ( - )} + )} */} ); } diff --git a/src/views/operation-hub/catalogs/components/catalog-modal.vue b/src/views/operation-hub/catalogs/components/catalog-modal.vue index 180e5a2f..4d6bb2a1 100644 --- a/src/views/operation-hub/catalogs/components/catalog-modal.vue +++ b/src/views/operation-hub/catalogs/components/catalog-modal.vue @@ -110,8 +110,7 @@ description: '', vcsSource: { platform: 'Github', - url: '', - token: '' + url: '' }, filtering: { excludeFilter: '', @@ -157,8 +156,7 @@ description: '', vcsSource: { platform: 'Github', - url: '', - token: '' + url: '' }, filtering: { excludeFilter: '', diff --git a/src/views/operation-hub/catalogs/components/list-view.vue b/src/views/operation-hub/catalogs/components/list-view.vue index e1652b1f..d99dd592 100644 --- a/src/views/operation-hub/catalogs/components/list-view.vue +++ b/src/views/operation-hub/catalogs/components/list-view.vue @@ -338,14 +338,7 @@ ..._.omit(row, ['disabled']), status: { ...row.status, - lastSyncTime: new Date().toISOString(), - conditions: [ - ...row.status?.conditions, - { - type: 'Refresh', - status: 'Unknown' - } - ] + conditions: [] } } }); diff --git a/src/views/operation-hub/connectors/config/index.ts b/src/views/operation-hub/connectors/config/index.ts index 5c564f7d..d9b8b54b 100644 --- a/src/views/operation-hub/connectors/config/index.ts +++ b/src/views/operation-hub/connectors/config/index.ts @@ -97,7 +97,7 @@ export const CommonCloudProviderKeys = [ label: 'AccessKey', value: '', key: 'access_key', - visible: true, + sensitive: false, required: true, type: 'string' }, @@ -105,7 +105,7 @@ export const CommonCloudProviderKeys = [ label: 'SecretKey', value: '', key: 'secret_key', - visible: false, + sensitive: true, required: true, type: 'string' }, @@ -113,7 +113,7 @@ export const CommonCloudProviderKeys = [ label: 'operation.connectors.table.region', value: '', key: 'region', - visible: true, + sensitive: false, required: true, type: 'string' } @@ -124,7 +124,7 @@ export const AzureRMCloudProviderKeys = [ label: 'applications.applications.detail.env', value: '', key: 'environment', - visible: true, + sensitive: false, type: 'string', required: false, default: 'public', @@ -139,7 +139,7 @@ export const AzureRMCloudProviderKeys = [ label: 'ClientID', value: '', key: 'client_id', - visible: true, + sensitive: false, required: true, type: 'string' }, @@ -147,7 +147,7 @@ export const AzureRMCloudProviderKeys = [ label: 'ClientSecret', value: '', key: 'client_secret', - visible: false, + sensitive: true, required: true, type: 'string' }, @@ -155,7 +155,7 @@ export const AzureRMCloudProviderKeys = [ label: 'SubscriptionID', value: '', key: 'subscription_id', - visible: true, + sensitive: false, required: true, type: 'string' }, @@ -163,7 +163,7 @@ export const AzureRMCloudProviderKeys = [ label: 'TenantID', value: '', key: 'tenant_id', - visible: true, + sensitive: false, required: true, type: 'string' } @@ -174,7 +174,7 @@ export const GoogleCloudProviderKeys = [ label: 'applications.projects.table.project', value: '', key: 'project', - visible: true, + sensitive: false, required: true, type: 'string' }, @@ -182,7 +182,7 @@ export const GoogleCloudProviderKeys = [ label: 'operation.connectors.table.region', value: '', key: 'region', - visible: true, + sensitive: false, required: true, type: 'string' }, @@ -190,7 +190,7 @@ export const GoogleCloudProviderKeys = [ label: 'operation.connectors.table.zones', value: '', key: 'zone', - visible: true, + sensitive: false, required: true, type: 'string' }, @@ -199,7 +199,7 @@ export const GoogleCloudProviderKeys = [ value: '', description: 'operation.connectors.table.credentials.desc', key: 'credentials', - visible: false, + sensitive: true, required: true, type: 'string' } diff --git a/src/views/operation-hub/connectors/config/interface.ts b/src/views/operation-hub/connectors/config/interface.ts index 1a8394de..09242576 100644 --- a/src/views/operation-hub/connectors/config/interface.ts +++ b/src/views/operation-hub/connectors/config/interface.ts @@ -9,8 +9,8 @@ export interface ConnectorRowData extends DataListItem { config: { version: string; data: { - kubeconfig: { - visible: boolean; + [k: string]: { + sensitive: boolean; value: string; type: string; }; @@ -25,7 +25,7 @@ export interface CustomAttrbute { type: string; default?: any; extraCom?: string; - visible?: boolean; + sensitive?: boolean; extraProps?: any; error?: string; style?: object; @@ -44,7 +44,7 @@ export interface ConnectorFormData extends AxiosRequestPayload { version: string; data: { [key: string]: { - visible: boolean; + sensitive: boolean; value: string; type: string; }; @@ -67,7 +67,7 @@ export interface ProviderKey { label: string; value: string; key: string; - visible: boolean; + sensitive: boolean; required: boolean; type: string; } diff --git a/src/views/operation-hub/connectors/pages/cloud-provider.vue b/src/views/operation-hub/connectors/pages/cloud-provider.vue index 0ee04ab5..2f7febf7 100644 --- a/src/views/operation-hub/connectors/pages/cloud-provider.vue +++ b/src/views/operation-hub/connectors/pages/cloud-provider.vue @@ -97,17 +97,17 @@ data: { access_key: { value: '', - visible: true, + sensitive: false, type: 'string' }, secret_key: { value: '', - visible: false, + sensitive: true, type: 'string' }, region: { value: '', - visible: true, + sensitive: false, type: 'string' } } @@ -203,7 +203,7 @@ (obj, item) => { obj[item.key] = { value: '', - visible: item.visible, + sensitive: item.sensitive, type: item.type }; return obj; @@ -388,7 +388,7 @@ > ); } - if (item.visible) { + if (!item.sensitive) { return ( - {!row.visible + {row.sensitive ? '******' : get( formData.value, diff --git a/src/views/operation-hub/connectors/pages/custom-detail.vue b/src/views/operation-hub/connectors/pages/custom-detail.vue index 74d9c6f3..66038d62 100644 --- a/src/views/operation-hub/connectors/pages/custom-detail.vue +++ b/src/views/operation-hub/connectors/pages/custom-detail.vue @@ -176,7 +176,7 @@ >