You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2022/06/08 04:07:25 UTC

[skywalking-booster-ui] branch main updated: fix: disable the query button without containers on the on-demand log widget. (#105)

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-booster-ui.git


The following commit(s) were added to refs/heads/main by this push:
     new f9aa660  fix: disable the query button without containers on the on-demand log widget. (#105)
f9aa660 is described below

commit f9aa6600a7070769040d1cd14cc5158dcd9b4299
Author: Fine0830 <fi...@outlook.com>
AuthorDate: Wed Jun 8 12:07:21 2022 +0800

    fix: disable the query button without containers on the on-demand log widget. (#105)
---
 src/views/dashboard/related/demand-log/Content.vue | 12 ++++++++----
 src/views/dashboard/related/demand-log/Header.vue  |  9 +++++++++
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/src/views/dashboard/related/demand-log/Content.vue b/src/views/dashboard/related/demand-log/Content.vue
index b06d49d..c92b8b3 100644
--- a/src/views/dashboard/related/demand-log/Content.vue
+++ b/src/views/dashboard/related/demand-log/Content.vue
@@ -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
 limitations under the License. -->
 <template>
+  <span v-if="demandLogStore.message">{{ demandLogStore.message }}</span>
   <div
+    v-else
     v-loading="demandLogStore.loadLogs"
     class="log-content"
     ref="logContent"
     style="width: calc(100% - 10px); height: calc(100% - 140px)"
-  >
-    <span v-if="demandLogStore.message">{{ demandLogStore.message }}</span>
-  </div>
+  ></div>
 </template>
 <script lang="ts" setup>
 import { onMounted, ref, onUnmounted, watch, toRaw } from "vue";
@@ -36,7 +36,9 @@ onMounted(() => {
 });
 async function init() {
   const monaco = await import("monaco-editor");
-  monacoInstanceGen(monaco);
+  setTimeout(() => {
+    monacoInstanceGen(monaco);
+  }, 500);
   window.addEventListener("resize", () => {
     editorLayout();
   });
@@ -50,6 +52,7 @@ function monacoInstanceGen(monaco: any) {
     readonly: true,
   });
   toRaw(monacoInstance.value).updateOptions({ readOnly: true });
+  editorLayout();
 }
 function editorLayout() {
   if (!logContent.value) {
@@ -67,6 +70,7 @@ onUnmounted(() => {
   }
   toRaw(monacoInstance.value).dispose();
   monacoInstance.value = null;
+  demandLogStore.setLogs("");
 });
 watch(
   () => demandLogStore.logs,
diff --git a/src/views/dashboard/related/demand-log/Header.vue b/src/views/dashboard/related/demand-log/Header.vue
index b7f26ce..3e25b19 100644
--- a/src/views/dashboard/related/demand-log/Header.vue
+++ b/src/views/dashboard/related/demand-log/Header.vue
@@ -118,6 +118,7 @@ limitations under the License. -->
       size="small"
       type="primary"
       @click="runInterval"
+      :disabled="disabled"
     >
       <Icon
         size="middle"
@@ -158,6 +159,7 @@ const state = reactive<any>({
   duration: { label: "From 30 minutes ago", value: 1800 },
   interval: { label: "30 seconds", value: 30 },
 });
+const disabled = ref<boolean>(true);
 /*global Nullable */
 const intervalFn = ref<Nullable<any>>(null);
 
@@ -187,11 +189,18 @@ async function getContainers() {
     state.instance.id || selectorStore.currentPod.id
   );
   if (resp.errors) {
+    disabled.value = true;
     ElMessage.error(resp.errors);
     return;
   }
+  if (resp.data.containers.errorReason) {
+    disabled.value = true;
+    ElMessage.warning(resp.data.containers.errorReason);
+    return;
+  }
   if (demandLogStore.containers.length) {
     state.container = demandLogStore.containers[0];
+    disabled.value = false;
   }
 }
 async function getInstances() {