query logs with trace id

This commit is contained in:
Qiuxia Fan 2022-07-26 17:15:27 +08:00
parent 7ae484671b
commit 19b85285ba
3 changed files with 17 additions and 6 deletions

View File

@ -47,6 +47,7 @@ export interface LayoutConfig {
startTime: string;
endTime: string;
};
traceId?: string;
};
}

View File

@ -130,7 +130,7 @@ limitations under the License. -->
</div>
</template>
<script lang="ts" setup>
import { ref, reactive, watch, onUnmounted } from "vue";
import { ref, reactive, watch, onUnmounted, inject } from "vue";
import { useI18n } from "vue-i18n";
import { Option } from "@/types/app";
import { useLogStore } from "@/store/modules/log";
@ -141,8 +141,10 @@ import ConditionTags from "@/views/components/ConditionTags.vue";
import { ElMessage } from "element-plus";
import { EntityType } from "../../data";
import { ErrorCategory } from "./data";
import { LayoutConfig } from "@/types/dashboard";
/*global defineProps */
/*global defineProps */
const options: LayoutConfig | undefined = inject("options");
const props = defineProps({
needQuery: { type: Boolean, default: true },
});
@ -151,7 +153,9 @@ const appStore = useAppStoreWithOut();
const selectorStore = useSelectorStore();
const dashboardStore = useDashboardStore();
const logStore = useLogStore();
const traceId = ref<string>("");
const traceId = ref<string>(
(options && options.filters && options.filters.traceId) || ""
);
const keywordsOfContent = ref<string[]>([]);
const excludingKeywordsOfContent = ref<string[]>([]);
const tagsList = ref<string[]>([]);
@ -325,6 +329,12 @@ function removeExcludeContent(index: number) {
}
onUnmounted(() => {
logStore.resetCondition();
const item = {
...options,
filters: undefined,
};
dashboardStore.setWidget(item);
traceId.value = "";
});
watch(
() => selectorStore.currentService,

View File

@ -140,8 +140,8 @@ export default defineComponent({
LogTable,
},
setup() {
/*global Nullable */
const options: LayoutConfig | undefined = inject("options");
/*global Nullable, Recordable */
const options: Recordable<LayoutConfig> = inject("options") || {};
const { t } = useI18n();
const traceStore = useTraceStore();
const loading = ref<boolean>(false);
@ -189,7 +189,7 @@ export default defineComponent({
};
dashboardStore.setWidget(item);
const logTabIndex = widget.id.split("-");
const traceTabindex = options?.id?.split("-") || [];
const traceTabindex = (options.id as any).split("-") || [];
let container: Nullable<Element>;
if (logTabIndex[1] === undefined) {