mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-06 00:09:22 +00:00
### **User description** 1. removed defineProps , defineEmits as they are not required to import while using <script setup> because they are built in compiler macros 2. removed unused imports 3. added tbody around tr td inside table which was throwing an error ___ ### **PR Type** Bug fix, Enhancement ___ ### **Description** - Wrap table rows with tbody in DateTime - Remove unused Vue imports and emits - Clean up dead code and variables - Minor formatting and consistency fixes ___ ### Diagram Walkthrough ```mermaid flowchart LR A["Vue components"] -- "remove unused imports/defines" --> B["Cleaner scripts"] A -- "table rows wrapped with tbody" --> C["Valid HTML structure"] C -- "prevents runtime/warning errors" --> D["Stabler UI"] ``` <details> <summary><h3> File Walkthrough</h3></summary> <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Bug fix</strong></td><td><details><summary>1 files</summary><table> <tr> <td><strong>DateTime.vue</strong><dd><code>Add tbody wrapper to table rows</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8026/files#diff-c06c96ba750be6fc82f517a53ba809efff8aa619aba203b871d4d2aeb7f64f60">+78/-76</a> </td> </tr> </table></details></td></tr><tr><td><strong>Enhancement</strong></td><td><details><summary>21 files</summary><table> <tr> <td><strong>FileItem.vue</strong><dd><code>Drop unused defineProps/defineEmits imports</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8026/files#diff-ba91340f65190fae07746a2877b42357f3c4b10eb9969e7fc6fe393655bc8752">+1/-1</a> </td> </tr> <tr> <td><strong>AddDestination.vue</strong><dd><code>Remove unused Vue APIs and service import</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8026/files#diff-61b295458e13049a538f5014124855d58dce664dfbd644b57a964a37a07b7a3f">+0/-4</a> </td> </tr> <tr> <td><strong>AddTemplate.vue</strong><dd><code>Trim unused Vue composition imports</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8026/files#diff-2508a43827e6b35c07f3222deebd9945101ca6bc32b9dc592e6253ab99908bba">+0/-4</a> </td> </tr> <tr> <td><strong>AlertsContainer.vue</strong><dd><code>Simplify imports to only computed</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8026/files#diff-39b487d54970cff4a1ccdfbb49a4ccb38f7131bb9d30944ce1c6e86d3f818148">+1/-1</a> </td> </tr> <tr> <td><strong>FieldsInput.vue</strong><dd><code>Remove unused defineProps from imports</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8026/files#diff-a2dcba327fb56cd4cb52efb06fccc256a71fd8a551b826c6c94e71dad75524f5">+1/-1</a> </td> </tr> <tr> <td><strong>FilterCondition.vue</strong><dd><code>Drop unused defineProps import</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8026/files#diff-53916e2402d0ee094fcd63f0ec0c99ceffde4fa042f9001203d2e2e1b7709e10">+1/-1</a> </td> </tr> <tr> <td><strong>VariablesInput.vue</strong><dd><code>Remove unused defineProps import line</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8026/files#diff-23a647aa1acfc95bc726629f0daa54005e3da1ed5b16482ceccef0649f680a74">+0/-1</a> </td> </tr> <tr> <td><strong>AddCipherKey.vue</strong><dd><code>Remove unused defineEmits from imports</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8026/files#diff-ff5ae3a9b070fe2b3650f177ced0d87e9449ae7375a0b117ee299238293df110">+1/-1</a> </td> </tr> <tr> <td><strong>AppTabs.vue</strong><dd><code>Remove unused defineProps from import</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8026/files#diff-f69ae88c0f2018ea808724a0eaee5bd008fd1608c52f7ca20215fc6033f00573">+1/-1</a> </td> </tr> <tr> <td><strong>FunctionsToolbar.vue</strong><dd><code>Prune unused composition API imports</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8026/files#diff-8283d2ff9c4a66b4b59eac306672aca2d54655a462e2ddb88e14e039d79dcdaf">+0/-4</a> </td> </tr> <tr> <td><strong>EntityPermissionTable.vue</strong><dd><code>Remove unused defineEmits/defineProps imports</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8026/files#diff-07b373cc19e7893c8a8a29f5e6d10b8c74d15d6ad3a4d04f5c06b55d0d8de395">+1/-2</a> </td> </tr> <tr> <td><strong>PermissionsTable.vue</strong><dd><code>Remove unused defineEmits import</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8026/files#diff-609d4d7245b7309cf30cc45c22c996c6b068ebc042a9673e75ee3bbd2aa00a2a">+0/-1</a> </td> </tr> <tr> <td><strong>AssociateFunction.vue</strong><dd><code>Remove unused emits and lifecycle imports</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8026/files#diff-24a5b2df69327a6477227ea674939dea19dd6d393b4bfcf807089d71e6391152">+0/-2</a> </td> </tr> <tr> <td><strong>ExternalDestination.vue</strong><dd><code>Remove unused Vue/imports and reactive</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8026/files#diff-7ed6a9ef676d7d6db5440d4157512f731bad58716c351ca39015125a8a9d2df5">+0/-3</a> </td> </tr> <tr> <td><strong>Stream.vue</strong><dd><code>Drop unused imports and services</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8026/files#diff-1a17ced9dc89022502cab0a6f9b97b413c2a2c4f8219733d063fc0180d361739">+1/-2</a> </td> </tr> <tr> <td><strong>PipelineEditor.vue</strong><dd><code>Remove unused defineEmits import</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8026/files#diff-68c21f647336067eb79737ce9aca2d49632f2fa1c0878bcfdae55607e3473a15">+0/-1</a> </td> </tr> <tr> <td><strong>StreamSelection.vue</strong><dd><code>Remove unused defineEmits import</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8026/files#diff-461440be35cc15b6b78700c8a61747ea9fb601a750af5292fa2d04b6fc96d595">+1/-1</a> </td> </tr> <tr> <td><strong>TenstackTable.vue</strong><dd><code>Remove unused defineEmits import</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8026/files#diff-bc3c669f5ab65a42ae378df1f7d6b35014c9c220790bdcc72b47f55d1385dc22">+0/-1</a> </td> </tr> <tr> <td><strong>CellActions.vue</strong><dd><code>Remove unused imports and helpers</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8026/files#diff-de54e5b8cd9503c53f3f802ac7bc7e3d25846f1657c77cd99534d9f60673992e">+1/-2</a> </td> </tr> <tr> <td><strong>CustomNode.vue</strong><dd><code>Remove unused refs and image vars</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8026/files#diff-b9d83cd503b6d3470b238accaaea0b4decf567add8ad4727c63c9e583725f408">+1/-5</a> </td> </tr> <tr> <td><strong>AdvancedValuesFilter.vue</strong><dd><code>Remove unused defineEmits import</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8026/files#diff-19f84276e3e0eebf0af0707cc9480e2dd7434c8e77be13456a1c0607860af3b2">+1/-1</a> </td> </tr> </table></details></td></tr></tr></tbody></table> </details> ___
117 lines
2.4 KiB
Vue
117 lines
2.4 KiB
Vue
<template>
|
|
<li
|
|
class="tw-cursor-pointer tw-py-[1px] tw-px-2 hover:tw-bg-gray-200 tw-text-[14px] tw-rounded-[2px] tw-flex tw-h-[25px] file-item"
|
|
:class="{
|
|
'bg-primary tw-text-white': isActive,
|
|
}"
|
|
@click="openFile"
|
|
>
|
|
<div class="tw-w-[calc(100%-40px)] tw-flex tw-items-center">
|
|
<template v-if="isEditing">
|
|
<input
|
|
ref="nameInput"
|
|
v-model.trim="fileName"
|
|
class="tw-w-full tw-border tw-rounded tw-h-full tw-bg-transparent tw-border-none tw-outline-none"
|
|
:class="isActive ? 'tw-text-white' : 'tw-text-black'"
|
|
@blur="onBlur"
|
|
/>
|
|
</template>
|
|
<template v-else>
|
|
{{ fileName }}
|
|
</template>
|
|
</div>
|
|
<div
|
|
class="tw-w-[36px] tw-flex tw-items-center tw-space-x-2 tw-ml-auto file-actions"
|
|
>
|
|
<button
|
|
@click.stop="editFile"
|
|
:class="isActive ? 'tw-text-gray-100' : 'tw-text-gray-600'"
|
|
>
|
|
<q-icon name="edit" />
|
|
</button>
|
|
<button
|
|
@click.stop="deleteFile"
|
|
:class="isActive ? 'tw-text-gray-100' : 'tw-text-gray-600'"
|
|
>
|
|
<q-icon name="delete" />
|
|
</button>
|
|
</div>
|
|
</li>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { ref, computed, nextTick, watch } from "vue";
|
|
|
|
const props = defineProps<{
|
|
name: string;
|
|
isActive: boolean;
|
|
editMode: boolean;
|
|
}>();
|
|
|
|
const emit = defineEmits(["open-file", "update:name", "delete-file"]);
|
|
|
|
const isEditing = ref(false);
|
|
|
|
const nameInput = ref<HTMLInputElement | null>(null);
|
|
|
|
const openFile = () => {
|
|
emit("open-file");
|
|
};
|
|
|
|
const prevFileName = ref(props.name);
|
|
|
|
const fileName = computed({
|
|
get: () => props.name,
|
|
set: (val) => {
|
|
emit("update:name", val);
|
|
},
|
|
});
|
|
|
|
const editFile = async () => {
|
|
if (fileName.value) prevFileName.value = fileName.value;
|
|
focusInput();
|
|
};
|
|
|
|
const focusInput = async () => {
|
|
isEditing.value = true;
|
|
await nextTick();
|
|
nameInput.value?.focus();
|
|
};
|
|
|
|
watch(
|
|
() => props.editMode,
|
|
(val) => {
|
|
if (val) {
|
|
focusInput();
|
|
}
|
|
},
|
|
{
|
|
immediate: true,
|
|
},
|
|
);
|
|
|
|
const onBlur = () => {
|
|
isEditing.value = false;
|
|
if (!props.name) {
|
|
emit("update:name", prevFileName.value || "new.py");
|
|
}
|
|
};
|
|
|
|
const deleteFile = () => {
|
|
emit("delete-file");
|
|
};
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.file-item {
|
|
.file-actions {
|
|
visibility: hidden;
|
|
}
|
|
&:hover {
|
|
.file-actions {
|
|
visibility: visible;
|
|
}
|
|
}
|
|
}
|
|
</style>
|