From a8b116c4c4ee97ce7b5e74857fbcf3f6ac42518f Mon Sep 17 00:00:00 2001 From: polo <826770122@qq.com> Date: Wed, 13 Dec 2023 19:24:13 +0800 Subject: [PATCH 1/6] fix: fix bugs --- .../src/hooks/use-getapi-data.ts | 5 +- src/dashboard-front-new/src/views/home.vue | 171 ++++++++++-------- 2 files changed, 98 insertions(+), 78 deletions(-) diff --git a/src/dashboard-front-new/src/hooks/use-getapi-data.ts b/src/dashboard-front-new/src/hooks/use-getapi-data.ts index 2d9d11376..0122f5843 100644 --- a/src/dashboard-front-new/src/hooks/use-getapi-data.ts +++ b/src/dashboard-front-new/src/hooks/use-getapi-data.ts @@ -9,6 +9,7 @@ const initPagination: IPagination = { count: 0, }; const pagination = ref(initPagination); +const dataList = ref([]); export const useGetApiList = (filter: any) => { const getGatewaysListData = async () => { @@ -19,7 +20,8 @@ export const useGetApiList = (filter: any) => { ...filter.value, }; const res = await getGatewaysList(parmas); - return res.results; + dataList.value = res.results; + return dataList.value; } catch (error) {} }; @@ -34,5 +36,6 @@ export const useGetApiList = (filter: any) => { return { getGatewaysListData, + dataList, }; }; diff --git a/src/dashboard-front-new/src/views/home.vue b/src/dashboard-front-new/src/views/home.vue index 08f3a9b1a..19120356b 100644 --- a/src/dashboard-front-new/src/views/home.vue +++ b/src/dashboard-front-new/src/views/home.vue @@ -9,7 +9,7 @@ > {{ t('新建网关') }} - +
-
-
{{ t('网关名') }}
-
{{ t('创建者') }}
-
{{ t('环境列表') }}
-
{{ t('资源数量') }}
-
{{ t('操作') }}
-
-
-
-
- - - {{ item.name }} - - {{ t('官方') }} - {{ t('已停用') }} -
-
{{ item.created_by }}
-
-
+
+
+
{{ t('网关名') }}
+
{{ t('创建者') }}
+
{{ t('环境列表') }}
+
{{ t('资源数量') }}
+
{{ t('操作') }}
+
+
+
+
+ - - - {{ envItem.name }} - + class="name mr10" :class="item.status ? '' : 'deact-name'" + @click="handleGoPage('apigwResource', item.id)"> + {{ item.name }} - - +{{ item.stages.length - item.tagOrder }} - - + {{ t('官方') }} + {{ t('已停用') }} +
+
{{ item.created_by }}
+
+
+ + + + {{ envItem.name }} + + + + +{{ item.stages.length - item.tagOrder }} + + +
+
+
+ {{ item.resource_count }}
+
+ + 环境概览 + + + 资源配置 + + + 流水日志 +
-
-
{{ item.resource_count }}
-
- - 环境概览 - - - 资源配置 - - - 流水日志 -
+
+
+
+ {{ t('暂无数据') }} +
+
+ +
- ('created_time'); -const filterNameData = ref({ name: '' }); +const filterKey = ref('updated_time'); +const filterNameData = ref({ keyword: '' }); // 弹窗 const dialogData = ref({ isShow: false, @@ -251,16 +261,22 @@ const gatewaysList = ref([]); const curYear = (new Date()).getFullYear(); const filterData = ref([ - { value: 'created_time', label: t('创建时间') }, { value: 'updated_time', label: t('更新时间') }, + { value: 'created_time', label: t('创建时间') }, { value: 'name', label: t('字母 A-Z') }, ]); // 获取网关数据方法 const { getGatewaysListData, + dataList, } = useGetApiList(filterNameData); +// 赋值给列表 +watch(() => dataList.value, (val: any[]) => { + gatewaysList.value = val; +}); + // 页面初始化 const init = async () => { @@ -321,6 +337,7 @@ const resetDialogData = () => { initDialogData.is_public = true; }; +// 列表排序 const handleChange = (v: string) => { switch (v) { case 'created_time': From 455653d608717f75e1e3ac6b03c7942c35aa917d Mon Sep 17 00:00:00 2001 From: polo <826770122@qq.com> Date: Wed, 13 Dec 2023 20:46:38 +0800 Subject: [PATCH 2/6] fix: fix bugs --- src/dashboard-front-new/src/views/resource/setting/index.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dashboard-front-new/src/views/resource/setting/index.vue b/src/dashboard-front-new/src/views/resource/setting/index.vue index 959b2d504..828d58dca 100644 --- a/src/dashboard-front-new/src/views/resource/setting/index.vue +++ b/src/dashboard-front-new/src/views/resource/setting/index.vue @@ -833,7 +833,7 @@ watch( } }); } else { - getList(); + filterData.value.keyword = ''; } }, ); @@ -854,7 +854,7 @@ onMounted(() => { // max-height: 280px; } .resource-content{ - height: calc(100% - 90px); + height: calc(100% - 68px); min-height: 600px; .left-wraper{ position: relative; From 6c8110cc31da78229e2cdbeba026bb6957ccdac2 Mon Sep 17 00:00:00 2001 From: polo <826770122@qq.com> Date: Thu, 14 Dec 2023 15:50:25 +0800 Subject: [PATCH 3/6] feat: fix bugs --- src/dashboard-front-new/src/http/gateway.ts | 3 +++ src/dashboard-front-new/src/store/common.ts | 5 +++++ src/dashboard-front-new/src/views/home.vue | 8 ++++---- src/dashboard-front-new/src/views/main.vue | 10 +++++++++- .../resource/setting/comps/back-config.vue | 13 ++++++++----- .../views/resource/setting/comps/base-info.vue | 18 ++++++++++-------- .../resource/setting/comps/front-config.vue | 13 +++++-------- .../src/views/resource/setting/edit.vue | 11 +++++++---- .../src/views/resource/setting/index.vue | 14 ++++++++++---- 9 files changed, 61 insertions(+), 34 deletions(-) diff --git a/src/dashboard-front-new/src/http/gateway.ts b/src/dashboard-front-new/src/http/gateway.ts index 9799f55de..711a9c538 100644 --- a/src/dashboard-front-new/src/http/gateway.ts +++ b/src/dashboard-front-new/src/http/gateway.ts @@ -6,6 +6,9 @@ const { BK_DASHBOARD_URL, CREATE_CHAT_API, SEND_CHAT_API } = window; // 获取网关列表 export const getGatewaysList = (data: any) => fetch.get(`${BK_DASHBOARD_URL}/gateways/?${json2Query(data)}`); +// 获取网关详情 +export const getGatewaysDetail = (apigwId: number) => fetch.get(`${BK_DASHBOARD_URL}/gateways/${apigwId}/`); + // 新建网关 export const createGateway = (data: any) => fetch.post(`${BK_DASHBOARD_URL}/gateways/`, data); diff --git a/src/dashboard-front-new/src/store/common.ts b/src/dashboard-front-new/src/store/common.ts index 3f4a18e74..d62996024 100644 --- a/src/dashboard-front-new/src/store/common.ts +++ b/src/dashboard-front-new/src/store/common.ts @@ -40,6 +40,7 @@ export const useCommon = defineStore('common', { name: 'ANY', }, ], + curApigwData: { allow_update_gateway_auth: false }, }), actions: { setApigwId(apigwId: number) { @@ -48,5 +49,9 @@ export const useCommon = defineStore('common', { setApigwName(name: string) { this.apigwName = name; }, + setCurApigwData(data: any) { + this.curApigwData = data; + console.log('this.curApigwData', this.curApigwData); + }, }, }); diff --git a/src/dashboard-front-new/src/views/home.vue b/src/dashboard-front-new/src/views/home.vue index 19120356b..04d23e510 100644 --- a/src/dashboard-front-new/src/views/home.vue +++ b/src/dashboard-front-new/src/views/home.vue @@ -41,7 +41,7 @@ class="table-item flex-row align-items-center" v-for="item in gatewaysList" :key="item.id" :class="item.is24HoursAgo ? '' : 'newly-item'"> -
+
@@ -140,7 +141,7 @@ const backConfigData = ref({ id: '', config: { path: '', - method: '', + method: 'GET', match_subpath: false, }, }); @@ -216,8 +217,10 @@ const validate = async () => { onMounted(() => { // 事件总线监听重新获取环境列表 - mitt.on('front-path', (value: string) => { - frontPath.value = value; + mitt.on('front-config', (value: any) => { + console.log('value', value); + frontPath.value = value.path; + backConfigData.value.config.match_subpath = value.match_subpath; }); init(); }); @@ -238,7 +241,7 @@ defineExpose({ } .w700{ max-width: 700px !important; - width: 70% !important; + width: 73% !important; } .w568{ max-width: 568px !important; diff --git a/src/dashboard-front-new/src/views/resource/setting/comps/base-info.vue b/src/dashboard-front-new/src/views/resource/setting/comps/base-info.vue index 8120816af..6a57eef4a 100644 --- a/src/dashboard-front-new/src/views/resource/setting/comps/base-info.vue +++ b/src/dashboard-front-new/src/views/resource/setting/comps/base-info.vue @@ -39,7 +39,9 @@ - + {{ t('蓝鲸应用认证') }} @@ -52,6 +54,7 @@ > @@ -93,20 +96,20 @@ const props = defineProps({ const formRef = ref(null); const { t } = useI18n(); const common = useCommon(); +const { curApigwData } = common; const formData = ref({ name: '', description: '', label_ids: [], auth_config: { - auth_verified_required: false, - app_verified_required: false, - resource_perm_required: false, + auth_verified_required: true, + app_verified_required: true, + resource_perm_required: true, }, - is_public: false, - allow_apply_permission: false, + is_public: true, + allow_apply_permission: true, }); -console.log('formData1', props.detail); const labelsData = ref([]); const rules = { @@ -134,7 +137,6 @@ watch( const { name, description, auth_config, is_public, allow_apply_permission, labels } = val; const label_ids = labels.map((e: {id: number, name: string}) => e.id); formData.value = { name: props.isClone ? `${name}_clone` : name, description, auth_config, is_public, allow_apply_permission, label_ids }; - console.log('formData', formData.value); } }, { immediate: true }, diff --git a/src/dashboard-front-new/src/views/resource/setting/comps/front-config.vue b/src/dashboard-front-new/src/views/resource/setting/comps/front-config.vue index b150abfbe..d22aa0693 100644 --- a/src/dashboard-front-new/src/views/resource/setting/comps/front-config.vue +++ b/src/dashboard-front-new/src/views/resource/setting/comps/front-config.vue @@ -7,6 +7,7 @@ required> @@ -54,7 +55,7 @@ const { t } = useI18n(); const cloneTips = ref(t('请求方法+请求路径在网关下唯一,请至少调整其中一项')); const common = useCommon(); const frontConfigData = ref({ - path: '', + path: 'GET', method: '', match_subpath: false, }); @@ -111,21 +112,17 @@ watch( validate(); }, 500); } - - - // setTimeout(() => { - // rules - // }, 1000); } }, { immediate: true }, ); watch( - () => frontConfigData.value.path, + () => frontConfigData.value, (val: any) => { - mitt.emit('front-path', val); + mitt.emit('front-config', val); }, + { deep: true }, ); const validate = async () => { diff --git a/src/dashboard-front-new/src/views/resource/setting/edit.vue b/src/dashboard-front-new/src/views/resource/setting/edit.vue index 57a10ac7f..d05f6f61f 100644 --- a/src/dashboard-front-new/src/views/resource/setting/edit.vue +++ b/src/dashboard-front-new/src/views/resource/setting/edit.vue @@ -6,8 +6,8 @@ use-card-theme > - {{ t('基础信息') }}