mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-03-01 03:24:14 +08:00
fix(container/log): enable close-on-click-modal and wrap log update in nextTick (#7960)
Refs #7547
This commit is contained in:
parent
56858dd74c
commit
b1f337020c
@ -59,7 +59,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import { dateFormatForName } from '@/utils/util';
|
import { dateFormatForName } from '@/utils/util';
|
||||||
import { computed, onBeforeUnmount, reactive, ref, shallowRef, watch } from 'vue';
|
import { computed, nextTick, onBeforeUnmount, reactive, ref, shallowRef, watch } from 'vue';
|
||||||
import { Codemirror } from 'vue-codemirror';
|
import { Codemirror } from 'vue-codemirror';
|
||||||
import { javascript } from '@codemirror/lang-javascript';
|
import { javascript } from '@codemirror/lang-javascript';
|
||||||
import { oneDark } from '@codemirror/theme-one-dark';
|
import { oneDark } from '@codemirror/theme-one-dark';
|
||||||
@ -145,11 +145,13 @@ const searchLogs = async () => {
|
|||||||
);
|
);
|
||||||
terminalSocket.value.onmessage = (event) => {
|
terminalSocket.value.onmessage = (event) => {
|
||||||
logInfo.value += event.data;
|
logInfo.value += event.data;
|
||||||
|
nextTick(() => {
|
||||||
const state = view.value.state;
|
const state = view.value.state;
|
||||||
view.value.dispatch({
|
view.value.dispatch({
|
||||||
selection: { anchor: state.doc.length, head: state.doc.length },
|
selection: { anchor: state.doc.length, head: state.doc.length },
|
||||||
scrollIntoView: true,
|
scrollIntoView: true,
|
||||||
});
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
import { cleanContainerLog } from '@/api/modules/container';
|
import { cleanContainerLog } from '@/api/modules/container';
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import { dateFormatForName, downloadWithContent } from '@/utils/util';
|
import { dateFormatForName, downloadWithContent } from '@/utils/util';
|
||||||
import { onBeforeUnmount, reactive, ref, shallowRef } from 'vue';
|
import { nextTick, onBeforeUnmount, reactive, ref, shallowRef } from 'vue';
|
||||||
import { Codemirror } from 'vue-codemirror';
|
import { Codemirror } from 'vue-codemirror';
|
||||||
import { javascript } from '@codemirror/lang-javascript';
|
import { javascript } from '@codemirror/lang-javascript';
|
||||||
import { oneDark } from '@codemirror/theme-one-dark';
|
import { oneDark } from '@codemirror/theme-one-dark';
|
||||||
@ -113,11 +113,13 @@ const searchLogs = async () => {
|
|||||||
);
|
);
|
||||||
terminalSocket.value.onmessage = (event) => {
|
terminalSocket.value.onmessage = (event) => {
|
||||||
logInfo.value += event.data;
|
logInfo.value += event.data;
|
||||||
|
nextTick(() => {
|
||||||
const state = view.value.state;
|
const state = view.value.state;
|
||||||
view.value.dispatch({
|
view.value.dispatch({
|
||||||
selection: { anchor: state.doc.length, head: state.doc.length },
|
selection: { anchor: state.doc.length, head: state.doc.length },
|
||||||
scrollIntoView: true,
|
scrollIntoView: true,
|
||||||
});
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
import { cleanContainerLog, DownloadFile } from '@/api/modules/container';
|
import { cleanContainerLog, DownloadFile } from '@/api/modules/container';
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import { dateFormatForName } from '@/utils/util';
|
import { dateFormatForName } from '@/utils/util';
|
||||||
import { computed, onBeforeUnmount, reactive, ref, shallowRef, watch } from 'vue';
|
import { computed, nextTick, onBeforeUnmount, reactive, ref, shallowRef, watch } from 'vue';
|
||||||
import { Codemirror } from 'vue-codemirror';
|
import { Codemirror } from 'vue-codemirror';
|
||||||
import { javascript } from '@codemirror/lang-javascript';
|
import { javascript } from '@codemirror/lang-javascript';
|
||||||
import { oneDark } from '@codemirror/theme-one-dark';
|
import { oneDark } from '@codemirror/theme-one-dark';
|
||||||
@ -152,11 +152,13 @@ const searchLogs = async () => {
|
|||||||
);
|
);
|
||||||
terminalSocket.value.onmessage = (event) => {
|
terminalSocket.value.onmessage = (event) => {
|
||||||
logInfo.value += event.data.replace(/\x1B\[[0-?]*[ -/]*[@-~]/g, '');
|
logInfo.value += event.data.replace(/\x1B\[[0-?]*[ -/]*[@-~]/g, '');
|
||||||
|
nextTick(() => {
|
||||||
const state = view.value.state;
|
const state = view.value.state;
|
||||||
view.value.dispatch({
|
view.value.dispatch({
|
||||||
selection: { anchor: state.doc.length, head: state.doc.length },
|
selection: { anchor: state.doc.length, head: state.doc.length },
|
||||||
scrollIntoView: true,
|
scrollIntoView: true,
|
||||||
});
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user