Skip to content

Commit

Permalink
feat(frontend): mysql、spider库表校验规则调整 #6595
Browse files Browse the repository at this point in the history
  • Loading branch information
jinquantianxia committed Sep 10, 2024
1 parent a0f0ed8 commit 3439562
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import { makeMap, random } from '@utils';

interface Props {
allowEmpty?: boolean;
checkDuplicate?: boolean;
}

Expand All @@ -39,6 +40,7 @@
}

const props = withDefaults(defineProps<Props>(), {
allowEmpty: false,
checkDuplicate: false,
});

Expand All @@ -57,7 +59,13 @@

const rules = [
{
validator: (value: string[]) => value && value.length > 0,
validator: (value: string[]) => {
if (props.allowEmpty) {
return true;
}

return value && value.length > 0;
},
message: t('DB 名不能为空'),
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
<td style="padding: 0">
<RenderDbName
ref="ignoreDbnamesRef"
v-model="localIgnoreDbnames" />
v-model="localIgnoreDbnames"
allow-empty />
</td>
<td style="padding: 0">
<RenderSql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
ref="ignoreTablesRef"
:allow-asterisk="false"
:cluster-id="localClusterId"
:model-value="data.ignoreTables" />
:model-value="data.ignoreTables"
:required="false" />
</td>
<OperateColumn
:removeable="removeable"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
<div
v-for="name in previewDataList"
:key="name"
v-overflow-tips
class="name-item">
{{ name }}
</div>
Expand All @@ -72,7 +73,7 @@
import RenderDbName from '@views/mysql/common/edit-field/DbName.vue';
export type DbsType = Omit<Props['data'], 'sourceClusterId' | 'targetClusters'>
export type DbsType = Omit<Props['data'], 'sourceClusterId' | 'targetClusters'>;
interface Props {
data: {
Expand Down Expand Up @@ -147,38 +148,40 @@
});
</script>
<style lang="less" scoped>
.preview-main {
padding: 16px 24px;
.preview-header {
margin: 24px 0 16px;
display: flex;
.title {
font-weight: 700;
color: #313238;
.preview-main {
padding: 16px 24px;
.preview-header {
margin: 24px 0 16px;
display: flex;
.title {
font-weight: 700;
color: #313238;
}
}
}
.preview-copy {
width: 100%;
display: flex;
justify-content: flex-end;
margin-bottom: 8px;
margin-top: -24px;
}
.preview-content {
display: flex;
flex-wrap: wrap;
padding: 16px;
background: #f5f7fa;
.preview-copy {
width: 100%;
display: flex;
justify-content: flex-end;
margin-bottom: 8px;
margin-top: -24px;
}
.name-item {
width: 260px;
line-height: 24px;
margin: 0 13px 0 0;
.preview-content {
display: flex;
flex-wrap: wrap;
padding: 16px;
background: #f5f7fa;
.name-item {
width: 260px;
line-height: 24px;
margin: 0 13px 0 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
}
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,10 @@
};

const handleIgnoreDbsChange = (value: string[]) => {
if (isDropDatabase.value && value.length > 0) {
ignoreTables.value = ['*'];
return;
}

// if (isDropDatabase.value && value.length > 0) {
// ignoreTables.value = ['*'];
// return;
// }
ignoreTables.value = [];
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@
ref="ignoreTablesRefs"
:allow-asterisk="false"
:cluster-id="localClusterId"
:model-value="backupInfoItem.ignoreTables" />
:model-value="backupInfoItem.ignoreTables"
:required="false" />
</td>
<OperateColumn
:removeable="removeable"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,10 @@
};

const handleIgnoreDbsChange = (value: string[]) => {
if (isDropDatabase.value && value.length > 0) {
ignoreTables.value = ['*'];
return;
}

// if (isDropDatabase.value && value.length > 0) {
// ignoreTables.value = ['*'];
// return;
// }
ignoreTables.value = [];
};

Expand Down

0 comments on commit 3439562

Please sign in to comment.