Skip to content

Commit

Permalink
fix(frontend): spider工具箱自测问题 #902
Browse files Browse the repository at this point in the history
  • Loading branch information
hLinx committed Oct 11, 2023
1 parent fccf0e2 commit 6bf30d8
Show file tree
Hide file tree
Showing 45 changed files with 623 additions and 468 deletions.
1 change: 1 addition & 0 deletions dbm-ui/frontend/src/locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -2223,5 +2223,6 @@
"修改的是管理账号的密码": "修改的是管理账号的密码",
"失败的实例": "失败的实例",
"返回": "返回",
"忽略 DB 和忽略表名需同时为空或者同时有值": "忽略 DB 和忽略表名需同时为空或者同时有值",
"这行勿动!新增翻译请在上一行添加!": ""
}
10 changes: 4 additions & 6 deletions dbm-ui/frontend/src/services/types/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
* the specific language governing permissions and limitations under the License.
*/

import type { ConfLevels } from '@common/const';

/**
* 查询平台配置列表参数
*/
Expand Down Expand Up @@ -106,10 +104,10 @@ export interface ConfigVersionParams {
meta_cluster_type: string
conf_type: string
version: string
bk_biz_id: number
level_name: ConfLevels
level_value: string
level_info?: string
bk_biz_id?: number
level_name?: string
level_value?: number
level_info?: any
revision?: string
}

Expand Down
2 changes: 1 addition & 1 deletion dbm-ui/frontend/src/types/auto-imports.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ declare global {
// for type re-export
declare global {
// @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
}
3 changes: 3 additions & 0 deletions dbm-ui/frontend/src/views/db-configure/Index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<RouterView />
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@

import MainBreadcrumbs from '@components/layouts/MainBreadcrumbs.vue';

import DetailsBase from '../../components/DetailsBase.vue';
import PublishRecord from '../../components/PublishRecord.vue';
import { useLevelParams } from '../../hooks/useLevelParams';
import DetailsBase from '../components/DetailsBase.vue';
import PublishRecord from '../components/PublishRecord.vue';
import { useLevelParams } from '../hooks/useLevelParams';

interface Props {
clusterType: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@
});
}
const routeParams = {
name: isApp ? 'DatabaseConfigDetails' : 'DatabaseConfig',
name: isApp ? 'DbConfigureDetail' : 'DbConfigureList',
params,
query,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
-->

<template>
<div class="database-config">
<div class="business-db-configure-list-page">
<TopTab @change="handleChangeTab" />
<template v-if="activeTab">
<Content :key="activeTab" />
Expand All @@ -23,9 +23,9 @@
<script setup lang="ts">
import { useMainViewStore } from '@stores';

import TopTab from '../components/TopTab.vue';
import TopTab from '../../components/TopTab.vue';

import Content from './Content.vue';
import Content from './components/Content.vue';

const router = useRouter();
const route = useRoute();
Expand Down Expand Up @@ -60,8 +60,8 @@
});
</script>

<style lang="less" scoped>
.database-config {
<style lang="less">
.business-db-configure-list-page {
height: 100%;
padding-top: 41px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@
v-bk-tooltips="$t('新建DB模块')"
class="content-tree-add db-icon-add"
@click.stop="createModule" />
<!-- <span class="content-tree-count">{{item.count}}</span>
<span v-if="item.version" class="content-tree-version">{{item.version}}</span> -->
</div>
</template>
<template #empty>
Expand All @@ -79,7 +77,9 @@
:key="treeState.activeNode.id"
class="content-details">
<div class="content-details-title">
<strong class="content-details-title-name">{{ treeState.activeNode.name }}</strong>
<strong class="content-details-title-name">
{{ treeState.activeNode.name }}
</strong>
<BkTag theme="info">
{{ treeState.activeNode.tag }}
</BkTag>
Expand All @@ -94,15 +94,20 @@
</template>

<script setup lang="ts">
import { clusterTypeInfos, ClusterTypes, type ClusterTypesValues, ConfLevels } from '@common/const';
import {
clusterTypeInfos,
ClusterTypes,
type ClusterTypesValues,
ConfLevels,
} from '@common/const';

import EmptyStatus from '@components/empty-status/EmptyStatus.vue';

import ConfigBusiness from './biz/ConfigInfo.vue';
import ConfigCluster from './cluster/ConfigInfo.vue';
import type { TreeData, TreeState } from './common/types';
import { useTreeData } from './hooks/useTreeData';
import ConfigModule from './module/ConfigInfo.vue';
import type { TreeData, TreeState } from './types';

const route = useRoute();
const treeState = reactive<TreeState>({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

import { useGlobalBizs } from '@stores';

import type { TreeData } from '../common/types';
import type { TreeData } from '../types';

interface Props {
confType: string
Expand Down Expand Up @@ -157,7 +157,7 @@
*/
const handleToDetails = (row: ConfigListItem) => {
router.push({
name: 'DatabaseConfigDetails',
name: 'DbConfigureDetail',
params: {
version: row.version,
...changeViewParams.value,
Expand All @@ -170,7 +170,7 @@
*/
const handleToEdit = (row: ConfigListItem) => {
router.push({
name: 'DatabaseConfigEdit',
name: 'DbConfigureEdit',
params: {
version: row.version,
...changeViewParams.value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@

import type { ClusterTypesValues } from '@common/const';

import { extraClusterConfs, getDefaultConf } from '../../common/const';
import type { ConfType } from '../../common/types';
import { extraClusterConfs, getDefaultConf } from '@views/db-configure/common/const';
import type { ConfType } from '@views/db-configure/common/types';

import ConfigDatabase from './ConfigDatabase.vue';

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
<!--
* TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-DB管理系统(BlueKing-BK-DBM) available.
*
* Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License athttps://opensource.org/licenses/MIT
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for
* the specific language governing permissions and limitations under the License.
-->

<template>
<div class="config-biz-details">
<MainBreadcrumbs>
<template #append>
<div class="operations" />
</template>
</MainBreadcrumbs>
<BkTab
v-model:active="state.activeTab"
class="top-tabs"
type="unborder-card">
<BkTabPanel
v-for="tab of tabs"
:key="tab.name"
v-bind="tab" />
</BkTab>
<div class="details-content db-scroll-y">
<template v-if="state.activeTab === 'publish'">
<PublishRecord :fetch-params="fetchParams" />
</template>
<template v-else>
<DetailsBase
:data="state.data"
:fetch-params="fetchParams"
:level="ConfLevels.APP"
:loading="state.loading"
:sticky-top="-26"
@update-info="handleUpdateInfo" />
</template>
</div>
</div>
</template>

<script setup lang="ts">
import { useI18n } from 'vue-i18n';

import { getLevelConfig } from '@services/configs';
import type {
ConfigBaseDetails,
GetLevelConfigParams,
} from '@services/types/configs';

import { useMainViewStore } from '@stores';

import { confLevelInfos, ConfLevels } from '@common/const';

import MainBreadcrumbs from '@components/layouts/MainBreadcrumbs.vue';

import DetailsBase from '@views/db-configure/components/DetailsBase.vue';
import PublishRecord from '@views/db-configure/components/PublishRecord.vue';
import { useLevelParams } from '@views/db-configure/hooks/useLevelParams';

interface Props {
clusterType: string,
confType: string,
version: string,
}

const props = defineProps<Props>();

const { t } = useI18n();
const state = reactive({
loading: false,
activeTab: 'base',
data: {} as ConfigBaseDetails,
});

// 获取业务层级相关参数
const levelParams = useLevelParams(false);
const fetchParams = computed(() => ({
meta_cluster_type: props.clusterType,
conf_type: props.confType,
version: props.version,
...levelParams.value,
}));

/**
* 设置自定义面包屑
*/
const mainViewStore = useMainViewStore();
nextTick(() => {
mainViewStore.$patch({
customBreadcrumbs: true,
hasPadding: false,
});
});
watch(() => state.data, () => {
mainViewStore.breadCrumbsTitle = state.data.name;
mainViewStore.tags = [{
theme: '',
text: state.data.version,
}, {
theme: 'info',
text: confLevelInfos[ConfLevels.APP].tagText,
}];
}, { deep: true });

/**
* 顶部 tabs
*/
const tabs = reactive([{
label: t('基础信息'),
name: 'base',
}, {
label: t('发布记录'),
name: 'publish',
}]);

/**
* 查询配置详情
*/
const fetchLevelConfig = () => {
state.loading = true;
getLevelConfig(fetchParams.value as GetLevelConfigParams)
.then((res) => {
state.data = res;
})
.finally(() => {
state.loading = false;
});
};
fetchLevelConfig();

// 更新基础信息
function handleUpdateInfo({ key, value }: { key: string, value: string }) {
Object.assign(state.data, { [key]: value });
}
</script>

<style lang="less" scoped>
@import "@styles/mixins.less";

.config-biz-details {
height: 100%;

:deep(.base-card) {
margin-bottom: 16px;
}
}

.operations {
.flex-center();

&__button {
width: 76px;
margin-left: 8px;
font-size: @font-size-mini;
}

&__more {
display: block;
width: 26px;
margin-left: 8px;
font-size: @font-size-large;
line-height: 26px;
cursor: pointer;
border-radius: 2px;

&:hover {
background-color: @bg-dark-gray;
}
}
}

.details-content {
height: calc(100% - 52px);
padding: 66px 24px 24px;

:deep(.details-base) {
height: 100%;
}
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@
import {
defaultConfTitles,
extraParamertesCluster,
} from '../../common/const';
import type { ExtraConfListItem } from '../../common/types';
import DetailsBase from '../../components/DetailsBase.vue';
} from '@views/db-configure/common/const';
import type { ExtraConfListItem } from '@views/db-configure/common/types';
import DetailsBase from '@views/db-configure/components/DetailsBase.vue';

import { useBaseDetails } from '../hooks/useBaseDetails';

interface Props {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

import { DBTypes } from '@common/const';

import ConfigEmpty from '../components/ConfigEmpty.vue';
import ConfigEmpty from '../ConfigEmpty.vue';
import { useBaseDetails } from '../hooks/useBaseDetails';

import ConfigDetails from './ConfigDetails.vue';
Expand Down
Loading

0 comments on commit 6bf30d8

Please sign in to comment.