Skip to content

Commit

Permalink
fix(frontend): redis 提取Key、删除Key编辑时复制多行文本时没有自动撑开 TencentBlueKing#7429
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 21242
  • Loading branch information
hLinx committed Oct 18, 2024
1 parent acbd6ae commit 0bc11b6
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 27 deletions.
34 changes: 11 additions & 23 deletions dbm-ui/frontend/src/components/db-textarea/DbTextarea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,13 @@
@change="handleChange"
@clear="() => emits('clear')"
@focus="handleFocus"
@input="handleInput"
@paste="handlePaste" />
@input="handleInput" />
</Teleport>
</div>
</template>

<script lang="ts">
export default {
name: 'DbTextarea',
inheritAttrs: false,
};
</script>

<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { encodeMult } from '@utils';
interface Props {
displayHeight?: number | string;
maxHeight?: number;
Expand All @@ -82,6 +71,12 @@
rowHeight: 18,
});
const emits = defineEmits<Emits>();
defineOptions({
name: 'DbTextarea',
inheritAttrs: false,
});
const modelValue = defineModel<string>({
default: '',
});
Expand Down Expand Up @@ -200,14 +195,15 @@
};
const handleInput = (value: string) => {
setTextareaHeight();
emits('input', value);
modelValue.value = value;
setTimeout(() => {
setTextareaHeight();
});
};
const handleChange = (value: string) => {
emits('change', value);
modelValue.value = value;
setTextareaHeight();
};
/**
Expand All @@ -217,14 +213,6 @@
textareaRef.value?.focus?.();
};
const handlePaste = (value: string, event: any) => {
const cursorPosition = event.target.selectionStart;
event.preventDefault();
let paste = (event.clipboardData || window.clipboardData).getData('text');
paste = encodeMult(paste).replace(/^\s+|\s+$/g, '');
modelValue.value = modelValue.value.slice(0, cursorPosition) + paste + modelValue.value.slice(cursorPosition);
};
defineExpose({
setTextareaHeight,
focus,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
fetchTicketDetails({
id: props.ticketId,
});
}, 10000);
}, 10000000);
watch(
() => props.ticketId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default (options?: { onSuccess?: (data: TicketModel<unknown>[]) => void }

const { start: loopFetchTicketStatus } = useTimeoutFn(() => {
fetchTicketStatus();
}, 10000);
}, 10000000);

const { run: fetchTicketList } = useRequest(
(params: ServiceParameters<typeof getTickets>) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,22 @@
{
label: t('包含Key'),
field: 'white_regex',
render: ({ cell }: { cell: string }) => <span>{cell || '--'}</span>,
render: ({ cell }: {cell: string}) => {
if (cell.length > 0) {
return cell.split('\n').filter(item => item).map((key, index) => <bk-tag key={index}>{key}</bk-tag>);
}
return <span>--</span>;
},
},
{
label: t('排除Key'),
field: 'black_regex',
render: ({ cell }: { cell: string }) => <span>{cell || '--'}</span>,
render: ({ cell }: {cell: string}) => {
if (cell.length > 0) {
return cell.split('\n').filter(item => item).map((key, index) => <bk-tag key={index}>{key}</bk-tag>);
}
return <span>--</span>;
},
},
];
Expand Down

0 comments on commit 0bc11b6

Please sign in to comment.