mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-10 07:55:20 +00:00
fix: disable the query button without containers on the on-demand log widget. (#105)
This commit is contained in:
parent
3c37d7c197
commit
f9aa6600a7
@ -13,14 +13,14 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License. -->
|
limitations under the License. -->
|
||||||
<template>
|
<template>
|
||||||
|
<span v-if="demandLogStore.message">{{ demandLogStore.message }}</span>
|
||||||
<div
|
<div
|
||||||
|
v-else
|
||||||
v-loading="demandLogStore.loadLogs"
|
v-loading="demandLogStore.loadLogs"
|
||||||
class="log-content"
|
class="log-content"
|
||||||
ref="logContent"
|
ref="logContent"
|
||||||
style="width: calc(100% - 10px); height: calc(100% - 140px)"
|
style="width: calc(100% - 10px); height: calc(100% - 140px)"
|
||||||
>
|
></div>
|
||||||
<span v-if="demandLogStore.message">{{ demandLogStore.message }}</span>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, ref, onUnmounted, watch, toRaw } from "vue";
|
import { onMounted, ref, onUnmounted, watch, toRaw } from "vue";
|
||||||
@ -36,7 +36,9 @@ onMounted(() => {
|
|||||||
});
|
});
|
||||||
async function init() {
|
async function init() {
|
||||||
const monaco = await import("monaco-editor");
|
const monaco = await import("monaco-editor");
|
||||||
monacoInstanceGen(monaco);
|
setTimeout(() => {
|
||||||
|
monacoInstanceGen(monaco);
|
||||||
|
}, 500);
|
||||||
window.addEventListener("resize", () => {
|
window.addEventListener("resize", () => {
|
||||||
editorLayout();
|
editorLayout();
|
||||||
});
|
});
|
||||||
@ -50,6 +52,7 @@ function monacoInstanceGen(monaco: any) {
|
|||||||
readonly: true,
|
readonly: true,
|
||||||
});
|
});
|
||||||
toRaw(monacoInstance.value).updateOptions({ readOnly: true });
|
toRaw(monacoInstance.value).updateOptions({ readOnly: true });
|
||||||
|
editorLayout();
|
||||||
}
|
}
|
||||||
function editorLayout() {
|
function editorLayout() {
|
||||||
if (!logContent.value) {
|
if (!logContent.value) {
|
||||||
@ -67,6 +70,7 @@ onUnmounted(() => {
|
|||||||
}
|
}
|
||||||
toRaw(monacoInstance.value).dispose();
|
toRaw(monacoInstance.value).dispose();
|
||||||
monacoInstance.value = null;
|
monacoInstance.value = null;
|
||||||
|
demandLogStore.setLogs("");
|
||||||
});
|
});
|
||||||
watch(
|
watch(
|
||||||
() => demandLogStore.logs,
|
() => demandLogStore.logs,
|
||||||
|
@ -118,6 +118,7 @@ limitations under the License. -->
|
|||||||
size="small"
|
size="small"
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="runInterval"
|
@click="runInterval"
|
||||||
|
:disabled="disabled"
|
||||||
>
|
>
|
||||||
<Icon
|
<Icon
|
||||||
size="middle"
|
size="middle"
|
||||||
@ -158,6 +159,7 @@ const state = reactive<any>({
|
|||||||
duration: { label: "From 30 minutes ago", value: 1800 },
|
duration: { label: "From 30 minutes ago", value: 1800 },
|
||||||
interval: { label: "30 seconds", value: 30 },
|
interval: { label: "30 seconds", value: 30 },
|
||||||
});
|
});
|
||||||
|
const disabled = ref<boolean>(true);
|
||||||
/*global Nullable */
|
/*global Nullable */
|
||||||
const intervalFn = ref<Nullable<any>>(null);
|
const intervalFn = ref<Nullable<any>>(null);
|
||||||
|
|
||||||
@ -187,11 +189,18 @@ async function getContainers() {
|
|||||||
state.instance.id || selectorStore.currentPod.id
|
state.instance.id || selectorStore.currentPod.id
|
||||||
);
|
);
|
||||||
if (resp.errors) {
|
if (resp.errors) {
|
||||||
|
disabled.value = true;
|
||||||
ElMessage.error(resp.errors);
|
ElMessage.error(resp.errors);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (resp.data.containers.errorReason) {
|
||||||
|
disabled.value = true;
|
||||||
|
ElMessage.warning(resp.data.containers.errorReason);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (demandLogStore.containers.length) {
|
if (demandLogStore.containers.length) {
|
||||||
state.container = demandLogStore.containers[0];
|
state.container = demandLogStore.containers[0];
|
||||||
|
disabled.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function getInstances() {
|
async function getInstances() {
|
||||||
|
Loading…
Reference in New Issue
Block a user