Skip to content

Commit

Permalink
fix(frontend): table问题修复 #9155
Browse files Browse the repository at this point in the history
  • Loading branch information
hLinx committed Jan 21, 2025
1 parent b702063 commit 3d93f44
Show file tree
Hide file tree
Showing 50 changed files with 265 additions and 274 deletions.
2 changes: 1 addition & 1 deletion dbm-ui/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@blueking/login-modal": "^1.0.5",
"@blueking/notice-component": "2.0.5",
"@blueking/sub-saas": "0.0.0-beta.6",
"@blueking/table": "^0.0.1-beta.33",
"@blueking/table": "^0.0.1-beta.34",
"@icon-cool/bk-icon-bk-biz-components": "^0.0.4",
"@vueuse/core": "^12.0.0",
"axios": "^1.7.9",
Expand Down
2 changes: 1 addition & 1 deletion dbm-ui/frontend/src/components/db-table/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
remotePagination: true,
allowRowClickSelect: false,
remoteSort: false,
showSettings: true,
showSettings: false,
});

const emits = defineEmits<Emits>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@
ref="tableRef"
:columns="columns"
:data-source="dataSource"
releate-url-query
style="margin-bottom: 34px" />
<template #footer>
<BkButton @click="handleHideMore">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
:columns="columns"
:data-source="getPermissionRules"
:max-height="700"
:settings="settings"
@clear-search="handleClearSearch" />
</div>
<template #footer>
Expand Down Expand Up @@ -124,23 +123,6 @@
},
];
const settings = {
fields: [
{
label: t('账号名称'),
field: 'user',
},
{
label: t('访问DB'),
field: 'access_db',
},
{
label: t('权限'),
field: 'privilege',
},
],
checked: ['user', 'access_db', 'privilege'],
};
const columns = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
:columns="columns"
:data-source="dataSource"
:max-height="700"
row-hover="auto"
@clear-search="handleClearSearch" />
</template>

Expand All @@ -44,25 +43,25 @@

import DbTable from '@components/db-table/index.vue';

interface Props {
export interface Props<T> {
accountType: AccountTypes,
selectedList?: T[]
}

interface Emits {
export interface Emits<T> {
(e: 'change', value: UnwrapRef<typeof selectedMap>): void,
(e: 'delete', value: T[]): void
}

interface Expose {
export interface Expose {
searchData: (value?: Record<string, string>) => void
}

const props = withDefaults(defineProps<Props>(), {
const props = withDefaults(defineProps<Props<T>>(), {
selectMode: false,
selectedList: () => [],
});
const emits = defineEmits<Emits>();
const emits = defineEmits<Emits<T>>();

const renderList = (row: T) => (
expandMap.value[row.account.account_id]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,41 @@
<BkTableColumn
field="entry"
:label="t('访问入口')"
:width="260">
:width="300">
<template #default="{ data }: { data: ClusterEntryInfo }">
<template v-if="['master_entry', 'proxy_entry'].includes(data.role)">
<BkTag
v-if="data.cluster_entry_type === 'polaris'"
class="entry-polary-tag"
size="small"
theme="success">
{{ t('北极星') }}
</BkTag>
<BkTag
v-else-if="data.cluster_entry_type === 'clb'"
class="entry-clb-tag"
size="small"
theme="success">
CLB
</BkTag>
<BkTag
v-else
size="small"
theme="info">
{{ t('主') }}
</BkTag>
</template>
<BkTag
v-if="data.role === 'master_entry'"
v-if="data.role === 'slave_entry'"
size="small"
theme="success">
{{ t('') }}
{{ t('') }}
</BkTag>
<BkTag
v-else
v-if="data.role === 'node_entry'"
size="small"
theme="info">
{{ t('从') }}
theme="success">
Nodes
</BkTag>
{{ data.entry }}
</template>
Expand All @@ -57,7 +79,7 @@
field="ips"
label="Bind IP"
:show-overflow="false"
:width="240">
:width="200">
<template #default="{ data }: { data: ClusterEntryInfo }">
<RenderBindIps
v-if="data.ips"
Expand All @@ -71,7 +93,6 @@
</BkLoading>
</BkDialog>
</template>

<script setup lang="tsx">
import { useI18n } from 'vue-i18n';
import { useRequest } from 'vue-request';
Expand All @@ -84,7 +105,7 @@
import RenderBindIps from './RenderBindIps.vue';

export interface ClusterEntryInfo {
type: string;
cluster_entry_type: string;
entry: string;
role: string;
ips: string;
Expand Down Expand Up @@ -125,7 +146,7 @@
onSuccess: (data) => {
tableData.value = data
.map((item) => ({
type: item.cluster_entry_type,
cluster_entry_type: item.cluster_entry_type,
entry: item.entry,
role: item.role,
ips: item.isDns
Expand All @@ -152,16 +173,36 @@
emits('success');
};
</script>

<style lang="less" scoped>
.entry-config-table-box {
max-height: fit-content;
}
</style>
<style lang="less">
.entry-config-dialog {
.bk-modal-footer {
display: none;
}

.entry-config-table-box {
max-height: fit-content;
}

.entry-clb-tag {
color: #8e3aff;
cursor: pointer;
background-color: #f2edff;

&:hover {
color: #8e3aff;
background-color: #e3d9fe;
}
}

.entry-polary-tag {
color: #3a84ff;
cursor: pointer;
background-color: #edf4ff;

&:hover {
color: #3a84ff;
background-color: #e1ecff;
}
}
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
selectable
:settings="tableSetting"
:show-overflow="false"
show-settings
@clear-search="clearSearchValue"
@column-filter="columnFilterChange"
@column-sort="columnSortChange"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
selectable
:settings="tableSetting"
:show-overflow="false"
show-settings
@clear-search="clearSearchValue"
@column-filter="columnFilterChange"
@column-sort="columnSortChange"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
selectable
:settings="tableSetting"
:show-overflow="false"
show-settings
@clear-search="clearSearchValue"
@column-filter="columnFilterChange"
@column-sort="columnSortChange"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
:data-source="getInfluxdbInstanceList"
:row-class="setRowClass"
:settings="renderSettings"
show-settings
style="margin-bottom: 34px"
@clear-search="clearSearchValue"
@column-filter="columnFilterChange"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
selectable
:settings="tableSetting"
:show-overflow="false"
show-settings
@clear-search="clearSearchValue"
@column-filter="columnFilterChange"
@column-sort="columnSortChange"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,21 @@
:validate-values="validateSearchValues"
@change="handleSearchValueChange" />
</div>
<div
class="table-wrapper"
:class="{ 'is-shrink-table': isStretchLayoutOpen }">
<DbTable
ref="tableRef"
:columns="columns"
:data-source="dataSource"
releate-url-query
:row-class="setRowClass"
selectable
:settings="settings"
:show-overflow="false"
@clear-search="clearSearchValue"
@column-filter="columnFilterChange"
@column-sort="columnSortChange"
@selection="handleSelection"
@setting-change="updateTableSettings" />
</div>
<DbTable
ref="tableRef"
:columns="columns"
:data-source="dataSource"
releate-url-query
:row-class="setRowClass"
selectable
:settings="settings"
:show-overflow="false"
show-settings
@clear-search="clearSearchValue"
@column-filter="columnFilterChange"
@column-sort="columnSortChange"
@selection="handleSelection"
@setting-change="updateTableSettings" />
</div>
</template>
<script setup lang="tsx">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
selectable
:settings="tableSetting"
:show-overflow="false"
show-settings
@clear-search="clearSearchValue"
@column-filter="columnFilterChange"
@column-sort="columnSortChange"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
selectable
:settings="tableSetting"
:show-overflow="false"
show-settings
@clear-search="clearSearchValue"
@column-filter="columnFilterChange"
@column-sort="columnSortChange"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
selectable
selection-key="target_cluster_id"
:settings="settings"
show-settings
@clear-search="handleClearFilters"
@column-filter="handleColumnFilter"
@selection="handleSelection" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
</BkAlert>
<DbTable
ref="tableRef"
class="table-box"
class="table-box mb-24"
:columns="columns"
:data-source="listDumperInstance"
primary-key="dumper_id"
Expand All @@ -118,7 +118,7 @@
}"
selectable
:settings="settings"
style="margin-bottom: 34px"
show-settings
@clear-search="handleClearFilters"
@column-filter="handleColumnFilter"
@request-finished="handleTableRequestFinished"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
selectable
:settings="settings"
:show-overflow="false"
show-settings
@clear-search="clearSearchValue"
@column-filter="columnFilterChange"
@column-sort="columnSortChange"
Expand Down Expand Up @@ -579,10 +580,6 @@
}
}

.table-wrapper {
background-color: white;
}

tr.is-offline {
.vxe-cell {
color: @disable-color;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,18 @@
:validate-values="validateSearchValues"
@change="handleSearchValueChange" />
</div>
<div
class="table-wrapper"
:class="{ 'is-shrink-table': isStretchLayoutOpen }">
<DbTable
ref="tableRef"
:columns="columns"
:data-source="getTendbhaInstanceList"
releate-url-query
:row-class="setRowClass"
:settings="settings"
@clear-search="clearSearchValue"
@column-filter="columnFilterChange"
@column-sort="columnSortChange"
@setting-change="updateTableSettings" />
</div>
<DbTable
ref="tableRef"
:columns="columns"
:data-source="getTendbhaInstanceList"
releate-url-query
:row-class="setRowClass"
:settings="settings"
show-settings
@clear-search="clearSearchValue"
@column-filter="columnFilterChange"
@column-sort="columnSortChange"
@setting-change="updateTableSettings" />
</div>
</template>

Expand Down
Loading

0 comments on commit 3d93f44

Please sign in to comment.