fix: update query conditions for the browser logs (#106)

This commit is contained in:
Fine0830 2022-06-14 11:26:53 +08:00 committed by GitHub
parent f9aa6600a7
commit 0828f8a7aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 72 additions and 27 deletions

View File

@ -161,7 +161,7 @@ const msg = {
dashboard: "Dashboard", dashboard: "Dashboard",
topology: "Topology", topology: "Topology",
trace: "Trace", trace: "Trace",
alarm: "Alarms", alarm: "Alerting",
auto: "Auto", auto: "Auto",
reload: "Reload", reload: "Reload",
version: "Version", version: "Version",

View File

@ -161,7 +161,7 @@ const msg = {
dashboard: "Panel", dashboard: "Panel",
topology: "Topología", topology: "Topología",
trace: "Traza", trace: "Traza",
alarm: "Alarmas", alarm: "Recordatorio en curso",
auto: "Auto", auto: "Auto",
reload: "Recargar", reload: "Recargar",
version: "Versión", version: "Versión",

View File

@ -30,13 +30,13 @@ export const routesAlarm: Array<RouteRecordRaw> = [
component: Layout, component: Layout,
children: [ children: [
{ {
path: "/alarm", path: "/alerting",
name: "Alarm", name: "Alarm",
meta: { meta: {
exact: false, exact: false,
}, },
component: () => component: () =>
import(/* webpackChunkName: "alarms" */ "@/views/Alarm.vue"), import(/* webpackChunkName: "alerting" */ "@/views/Alarm.vue"),
}, },
], ],
}, },

View File

@ -24,7 +24,7 @@ import Header from "./alarm/Header.vue";
import Content from "./alarm/Content.vue"; import Content from "./alarm/Content.vue";
const appStore = useAppStoreWithOut(); const appStore = useAppStoreWithOut();
appStore.setPageTitle("Alarm"); appStore.setPageTitle("Alerting");
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.alarm { .alarm {

View File

@ -50,6 +50,16 @@ limitations under the License. -->
@query="searchEndpoints" @query="searchEndpoints"
/> />
</div> </div>
<div class="mr-5" v-if="isBrowser">
<span class="grey mr-5"> {{ t("category") }}: </span>
<Selector
size="small"
:value="state.category.value"
:options="ErrorCategory"
placeholder="Select a category"
@change="changeField('category', $event)"
/>
</div>
<el-button <el-button
class="search-btn" class="search-btn"
size="small" size="small"
@ -59,14 +69,14 @@ limitations under the License. -->
{{ t("search") }} {{ t("search") }}
</el-button> </el-button>
</div> </div>
<div class="flex-h row"> <div class="flex-h row" v-show="!isBrowser">
<div class="mr-5 traceId" v-show="!isBrowser"> <div class="mr-5 traceId">
<span class="grey mr-5">{{ t("traceID") }}:</span> <span class="grey mr-5">{{ t("traceID") }}:</span>
<el-input v-model="traceId" class="inputs-max" size="small" /> <el-input v-model="traceId" class="inputs-max" size="small" />
</div> </div>
<ConditionTags :type="'LOG'" @update="updateTags" /> <ConditionTags :type="'LOG'" @update="updateTags" />
</div> </div>
<div class="row tips"> <div class="row tips" v-show="!isBrowser">
<b>{{ t("conditionNotice") }}</b> <b>{{ t("conditionNotice") }}</b>
</div> </div>
<div class="flex-h" v-show="!isBrowser"> <div class="flex-h" v-show="!isBrowser">
@ -130,6 +140,7 @@ import { useSelectorStore } from "@/store/modules/selectors";
import ConditionTags from "@/views/components/ConditionTags.vue"; import ConditionTags from "@/views/components/ConditionTags.vue";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { EntityType } from "../../data"; import { EntityType } from "../../data";
import { ErrorCategory } from "./data";
const { t } = useI18n(); const { t } = useI18n();
const appStore = useAppStoreWithOut(); const appStore = useAppStoreWithOut();
@ -148,6 +159,7 @@ const state = reactive<any>({
instance: { value: "0", label: "All" }, instance: { value: "0", label: "All" },
endpoint: { value: "0", label: "All" }, endpoint: { value: "0", label: "All" },
service: { value: "", label: "" }, service: { value: "", label: "" },
category: { value: "ALL", label: "All" },
}); });
init(); init();
@ -219,25 +231,32 @@ function searchLogs() {
if (dashboardStore.entity === EntityType[3].value) { if (dashboardStore.entity === EntityType[3].value) {
instance = selectorStore.currentPod.id; instance = selectorStore.currentPod.id;
} }
logStore.setLogCondition({ if (dashboardStore.layerId === "BROWSER") {
serviceId: selectorStore.currentService logStore.setLogCondition({
? selectorStore.currentService.id serviceId: selectorStore.currentService
: state.service.id, ? selectorStore.currentService.id
endpointId: endpoint || state.endpoint.id || undefined, : state.service.id,
serviceInstanceId: instance || state.instance.id || undefined, pagePathId: endpoint || state.endpoint.id || undefined,
queryDuration: appStore.durationTime, serviceVersionId: instance || state.instance.id || undefined,
keywordsOfContent: paging: { pageNum: 1, pageSize: 15 },
dashboardStore.layerId === "BROWSER" queryDuration: appStore.durationTime,
? undefined category: state.category.value,
: keywordsOfContent.value, });
excludingKeywordsOfContent: } else {
dashboardStore.layerId === "BROWSER" logStore.setLogCondition({
? undefined serviceId: selectorStore.currentService
: excludingKeywordsOfContent.value, ? selectorStore.currentService.id
tags: tagsMap.value.length ? tagsMap.value : undefined, : state.service.id,
paging: { pageNum: 1, pageSize: 15 }, endpointId: endpoint || state.endpoint.id || undefined,
relatedTrace: traceId.value ? { traceId: traceId.value } : undefined, serviceInstanceId: instance || state.instance.id || undefined,
}); queryDuration: appStore.durationTime,
keywordsOfContent: keywordsOfContent.value,
excludingKeywordsOfContent: excludingKeywordsOfContent.value,
tags: tagsMap.value.length ? tagsMap.value : undefined,
paging: { pageNum: 1, pageSize: 15 },
relatedTrace: traceId.value ? { traceId: traceId.value } : undefined,
});
}
queryLogs(); queryLogs();
} }
async function queryLogs() { async function queryLogs() {

View File

@ -0,0 +1,26 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* 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.
*/
export const ErrorCategory = [
{ label: "All", value: "ALL" },
{ label: "AJAX", value: "AJAX" },
{ label: "Resource", value: "RESOURCE" },
{ label: "Vue", value: "VUE" },
{ label: "Promise", value: "PROMISE" },
{ label: "JS", value: "JS" },
{ label: "Unknown", value: "UNKNOWN" },
];