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 Sep 7, 2023
1 parent 4207e9a commit 9cac90f
Show file tree
Hide file tree
Showing 60 changed files with 315 additions and 212 deletions.
2 changes: 1 addition & 1 deletion dbm-ui/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@blueking/ip-selector": "0.0.1-beta.116",
"@vueuse/core": "10.2.1",
"axios": "1.2.1",
"bkui-vue": "0.0.2-beta.29",
"bkui-vue": "0.0.2-beta.35",
"date-fns": "2.28.0",
"dayjs": "1.11.9",
"html-to-image": "1.11.3",
Expand Down
19 changes: 19 additions & 0 deletions dbm-ui/frontend/src/components/db-popconfirm/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,18 @@
offset: [0, 12],
zIndex: 999999,
hideOnClick: true,
popperOptions: {
strategy: 'fixed',
modifiers: [
{
name: 'flip',
options: {
fallbackPlacements: ['top-start', 'top-end'],
allowedAutoPlacements: ['top-start', 'top-end'],
},
},
],
},
});
}
});
Expand Down Expand Up @@ -154,5 +166,12 @@
content: none;
}
}

&[data-placement^="top-end"]{
& > .tippy-arrow{
right: -6px;
left: unset !important;
}
}
}
</style>
6 changes: 5 additions & 1 deletion dbm-ui/frontend/src/components/db-table/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@

const fetchListData = (loading = true) => {
isReady = true;
console.log('from dadta source statatat = ');
Promise.resolve()
.then(() => {
isLoading.value = loading;
Expand All @@ -306,6 +307,8 @@
...sortParams,
};

isAnomalies.value = false;

props.dataSource(params)
.then((data) => {
tableData.value = data;
Expand All @@ -324,7 +327,8 @@

emits('requestSuccess', data);
})
.catch(() => {
.catch((error) => {
console.error('request error: ', error);
tableData.value.results = [];
pagination.count = 0;
isAnomalies.value = true;
Expand Down
5 changes: 1 addition & 4 deletions dbm-ui/frontend/src/helper/validator/is-ip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,4 @@
* the specific language governing permissions and limitations under the License.
*/

export const isIp = (str: string): boolean => {
console.log('asda', str);
return true;
};
export const isIp = (str: string): boolean => true;
6 changes: 3 additions & 3 deletions dbm-ui/frontend/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@
"请选择版本名称": "Please select a version name",
"MySQL单节点": "MySQL standalone",
"MySQL高可用": "MySQL HA",
"TendisCache集群": "TendisCache",
"Tendisplus存储版集群": "Tendisplus",
"TendisCache": "TendisCache",
"Tendisplus": "Tendisplus",
"上一步": "Previous",
"下一步": "Next step",
"保存后将会引用最新的配置_如涉及重启的实例_将在重启后生效": "After saving, the latest configuration will be referenced. If the instance involves restarting, it will take effect after restarting",
Expand Down Expand Up @@ -1206,7 +1206,7 @@
"是否继续提交单据": "Do you want to continue to submit the ticket",
"InfluxDB版本": "InfluxDB version",
"InfluxDB集群部署": "InfluxDB cluster deployment",
"TendisSSD存储版集群": "TendisSSD storage cluster",
"TendisSSD": "TendisSSD",
"分组名": "Group name",
"新建分组": "New group",
"申请InfluxDB集群部署": "Apply for InfluxDB cluster deployment",
Expand Down
18 changes: 9 additions & 9 deletions dbm-ui/frontend/src/locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,7 @@
"发布记录详情": "发布记录详情",
"范围值": "范围值",
"请设置范围值": "请设置范围值",
"Tendisplus存储版集群": "Tendisplus 存储版集群",
"TendisCache集群": "TendisCache 集群",
"TendisCache": "TendisCache",
"MySQL高可用": "MySQL 高可用",
"MySQL单节点": "MySQL 单节点",
"发布后_所有业务下的新增的实例将会引用当前最新配置": "发布后,所有业务下的新增的实例将会引用当前最新配置",
Expand Down Expand Up @@ -1221,7 +1220,6 @@
"InfluxDB版本": "InfluxDB 版本",
"分组名": "分组名",
"新建分组": "新建分组",
"TendisSSD存储版集群": "TendisSSD 存储版集群",
"主机数数量即为实例数量_建议规格至少为2核4G": "主机数数量即为实例数量,建议规格至少为 2 核 4 G",
"InfluxDB实例管理": "【InfluxDB】实例管理",
"实例管理": "实例管理",
Expand Down Expand Up @@ -1510,7 +1508,7 @@
"复制异常 IP": "复制异常 IP",
"导入设置": "导入设置",
"当前已经有n个导入任务正在进行中,": "当前已经有{0}个导入任务正在进行中,",
"主从切换:针对TendisSSD、TendisCache集群,主从切换是把Slave提升为Master,原Master被剔除,针对Tendisplus集群,主从切换是把Slave和Master互换": "主从切换:针对TendisSSD、TendisCache集群,主从切换是把Slave提升为Master,原Master被剔除,针对Tendisplus集群,主从切换是把Slave和Master互换",
"主从切换:针对TendisSSD、TendisCache,主从切换是把Slave提升为Master,原Master被剔除,针对Tendisplus集群,主从切换是把Slave和Master互换": "主从切换:针对TendisSSD、TendisCache,主从切换是把Slave提升为Master,原Master被剔除,针对Tendisplus集群,主从切换是把Slave和Master互换",
"主故障切换": "主故障切换",
"主库故障主机": "主库故障主机",
"业务空闲机": "业务空闲机",
Expand Down Expand Up @@ -1790,9 +1788,9 @@
"所属云区域": "所属云区域",
"运维节点 IP": "运维节点 IP",
"云区域不能为空": "云区域不能为空",
"执行前检测连接,如有连接": "执行前检测连接,如有连接",
"检查延迟": "检查延迟",
"检查校验结果": "检查校验结果",
"检查业务来源的连接": "检查业务来源的连接",
"检查主从同步延迟": "检查主从同步延迟",
"检查主从数据校验结果": "检查主从数据校验结果",
"源 DB 名": "源 DB 名",
"新 DB 名": "新 DB 名",
"DB 重命名:database 重命名": "DB 重命名:database 重命名",
Expand Down Expand Up @@ -1938,8 +1936,8 @@
"授权人": "授权人",
"授权时间": "授权时间",
"账号规则": "账号规则",
"TendisSSD集群": "TendisSSD 集群",
"TendisPlus集群": "TendisPlus 集群",
"TendisSSD": "TendisSSD",
"Tendisplus": "Tendisplus",
"请选择版本": "请选择版本",
"DB 名不能为空": "DB 名不能为空",
"一格仅支持单个 % 对象": "一格仅支持单个 % 对象",
Expand Down Expand Up @@ -2054,5 +2052,7 @@
"集群部署、扩缩容等操作新主机的任务,如任务执行失败,相应的主机将会被挪到这里,等待人工确认": "集群部署、扩缩容等操作新主机的任务,如任务执行失败,相应的主机将会被挪到这里,等待人工确认",
"请输入表名称,支持通配符“%”,含通配符的仅支持单个": "请输入表名称,支持通配符“%”,含通配符的仅支持单个",
"目标 DB 不能为*": "目标 DB 不能为*",
"主机将被落到空闲机,如需要可再次导入": "主机将被落到空闲机,如需要可再次导入",
"保存并执行": "保存并执行",
"这行勿动!新增翻译请在上一行添加!": ""
}
4 changes: 4 additions & 0 deletions dbm-ui/frontend/src/services/model/partition/partition-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,8 @@ export default class PartitionLog {
PartitionLog.STATUS_RUNNING,
].includes(this.status);
}

get isFailed() {
return this.status === PartitionLog.STATUS_FAILED;
}
}
6 changes: 3 additions & 3 deletions dbm-ui/frontend/src/services/model/redis/redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
import { PipelineStatus } from '@common/const';

export const enum RedisClusterTypes {
PredixyTendisplusCluster = 'PredixyTendisplusCluster', // Tendisplus存储版集群
TwemproxyRedisInstance = 'TwemproxyRedisInstance', // TendisCache集群
TwemproxyTendisSSDInstance = 'TwemproxyTendisSSDInstance', // TendisSSD集群
PredixyTendisplusCluster = 'PredixyTendisplusCluster', // Tendisplus
TwemproxyRedisInstance = 'TwemproxyRedisInstance', // TendisCache
TwemproxyTendisSSDInstance = 'TwemproxyTendisSSDInstance', // TendisSSD
}

interface Node {
Expand Down
65 changes: 49 additions & 16 deletions dbm-ui/frontend/src/services/model/spider/tendbCluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,37 @@ export default class TendbCluster {
this.operations = this.initOperations(payload.operations);
}

// 操作中的状态
get operationRunningStatus() {
if (this.operations.length < 1) {
return '';
}
const operation = this.operations[0];
if (operation.status !== 'RUNNING') {
return '';
}
return operation.ticket_type;
}
// 操作中的状态描述文本
get operationStatusText() {
return TendbCluster.operationTextMap[this.operationRunningStatus];
}
// 操作中的状态 icon
get operationStatusIcon() {
return TendbCluster.operationIconMap[this.operationRunningStatus];
}
// 操作中的单据 ID
get operationTicketId() {
if (this.operations.length < 1) {
return 0;
}
const operation = this.operations[0];
if (operation.status !== 'RUNNING') {
return 0;
}
return operation.ticket_id;
}

get operationDisabled() {
// 集群异常不支持操作
if (this.status === STATUS_ABNORMAL) {
Expand All @@ -160,6 +191,7 @@ export default class TendbCluster {
if (this.phase !== 'online') {
return true;
}

// 各个操作互斥,有其他任务进行中禁用操作按钮
if (this.operations.find(item => item.status === 'RUNNING')) {
return true;
Expand All @@ -175,21 +207,22 @@ export default class TendbCluster {
if (!Array.isArray(payload)) {
return [];
}
return payload.map(item => ({
...item,
operationDisabled: this.operationDisabled,
// 操作中的状态描述文本
get operationStatusText() {
return TendbCluster.operationTextMap[item.ticket_type];
},
// 操作中的状态 icon
get operationStatusIcon() {
return TendbCluster.operationIconMap[item.ticket_type];
},
// 操作中的单据 ID
get operationTicketId() {
return item.ticket_id ?? 0;
},
}));
return payload;
// return payload.map(item => ({
// ...item,
// operationDisabled: this.operationDisabled,
// // 操作中的状态描述文本
// get operationStatusText() {
// return TendbCluster.operationTextMap[item.ticket_type];
// },
// // 操作中的状态 icon
// get operationStatusIcon() {
// return TendbCluster.operationIconMap[item.ticket_type];
// },
// // 操作中的单据 ID
// get operationTicketId() {
// return item.ticket_id ?? 0;
// },
// }));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@

// 添加配置项
const handleAddConfItem = (index: number) => {
// console.log('will add after index: ', index);
state.data.conf_items.splice(index + 1, 0, {
conf_name: '',
conf_name_lc: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,10 +445,8 @@
*/
function handleSelected(index: number, value: string) {
const selected = props.parameters.find(item => item.conf_name === value);
// console.log('selected: ', selected);
if (selected) {
emits('onChangeParameterItem', index, selected);
// props.data[index] = Object.assign(_.cloneDeep(selected), { op_type: 'add' });
}
}

Expand All @@ -464,9 +462,7 @@
* enums multiple change
*/
function handleChangeMultipleEnums(index: number, key: string, value: string[]) {
// console.log('multiple select change: ', value);
emits('onChangeMultipleEnums', index, key, value);
// props.data[index].value_default = value.join(',');
}

/**
Expand Down
6 changes: 3 additions & 3 deletions dbm-ui/frontend/src/views/db-configure/components/TopTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@
}, {
moduleId: 'redis',
id: ClusterTypes.TWEMPROXY_REDIS_INSTANCE,
name: t('TendisCache集群'),
name: t('TendisCache'),
}, {
moduleId: 'redis',
id: ClusterTypes.TWEMPROXY_TENDIS_SSD_INSTANCE,
name: t('TendisSSD存储版集群'),
name: t('TendisSSD'),
}, {
moduleId: 'redis',
id: ClusterTypes.PREDIXY_TENDISPLUS_CLUSTER,
name: t('Tendisplus存储版集群'),
name: t('Tendisplus'),
}, {
moduleId: 'bigdata',
id: ClusterTypes.ES,
Expand Down
2 changes: 1 addition & 1 deletion dbm-ui/frontend/src/views/deployment-plan/list/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
label="TendisCache"
name="tendiscache" />
<BkTabPanel
label="TendisPlus"
label="Tendisplus"
name="tendisplus" />
<BkTabPanel
label="TendisSSD"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,6 @@

nodeInfoMap.cold.totalDisk = coldDiskTotal;
nodeInfoMap.cold.originalHostList = coldOriginalHostList;

console.log('nodeInfoMap = ', nodeInfoMap);
})
.finally(() => {
isLoading.value = false;
Expand Down
5 changes: 1 addition & 4 deletions dbm-ui/frontend/src/views/hdfs-manage/apply/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,7 @@
trigger: 'change',
},
{
validator: (value: number) => {
console.log('hhto post = ', value);
return ![2181, 8480, 8485].includes(value);
},
validator: (value: number) => ![2181, 8480, 8485].includes(value),
message: t('禁用2181_8480_8485'),
trigger: 'change',
},
Expand Down
29 changes: 22 additions & 7 deletions dbm-ui/frontend/src/views/hdfs-manage/list/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@
</div>
</template>
<script setup lang="tsx">
import type { Table } from 'bkui-vue';
import { InfoBox } from 'bkui-vue';
import {
onMounted,
Expand Down Expand Up @@ -198,7 +197,7 @@
}
return 100;
});
const columns = computed<InstanceType<typeof Table>['$props']['columns']>(() => [
const columns = computed(() => [
{
label: 'ID',
field: 'id',
Expand All @@ -214,17 +213,33 @@
render: ({ data }: {data: HdfsModel}) => (
<div style="line-height: 14px; display: flex;">
<div>
<a href="javascript:" onClick={() => handleToDetails(data)}>{data.cluster_name}</a>
<div style='color: #C4C6CC;'>{data.cluster_alias || '--'}</div>
<bk-button
text
onClick={() => handleToDetails(data)}>
{data.cluster_name}
</bk-button>
<div style='color: #C4C6CC;'>
{data.cluster_alias || '--'}
</div>
</div>
<RenderOperationTag data={data} style='margin-left: 3px;' />
<db-icon v-show={!checkClusterOnline(data)} svg type="yijinyong" style="width: 38px; height: 16px; margin-left: 4px;" />
<RenderOperationTag
data={data}
style='margin-left: 3px;' />
<db-icon
v-show={!checkClusterOnline(data)}
svg
type="yijinyong"
style="width: 38px; height: 16px; margin-left: 4px;" />
{
isRecentDays(data.create_at, 24 * 3)
? <span class="glob-new-tag cluster-tag ml-4" data-text="NEW" />
: null
}
<i class="db-icon-copy mt-2" v-bk-tooltips={t('复制集群名称')} onClick={() => copy(data.cluster_name)} />
<db-icon
class="mt-2"
v-bk-tooltips={t('复制集群名称')}
type="copy"
onClick={() => copy(data.cluster_name)} />
</div>
),
},
Expand Down
Loading

0 comments on commit 9cac90f

Please sign in to comment.