mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-13 08:17:33 +00:00
feat: update
This commit is contained in:
parent
6555a1d5a6
commit
a19703908c
@ -14,23 +14,15 @@
|
|||||||
* 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.
|
||||||
*/
|
*/
|
||||||
import dayjs from "dayjs";
|
import { RespFields } from "./data";
|
||||||
import { RespFields, MetricQueryTypes, Calculations } from "./data";
|
|
||||||
import { ExpressionResultType } from "@/views/dashboard/data";
|
import { ExpressionResultType } from "@/views/dashboard/data";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
import { useDashboardStore } from "@/store/modules/dashboard";
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
import { useSelectorStore } from "@/store/modules/selectors";
|
import { useSelectorStore } from "@/store/modules/selectors";
|
||||||
import { useAppStoreWithOut } from "@/store/modules/app";
|
import { useAppStoreWithOut } from "@/store/modules/app";
|
||||||
import type { Instance, Endpoint, Service } from "@/types/selector";
|
|
||||||
import type { MetricConfigOpt } from "@/types/dashboard";
|
import type { MetricConfigOpt } from "@/types/dashboard";
|
||||||
import { MetricCatalog } from "@/views/dashboard/data";
|
|
||||||
import { calculateExp, aggregation } from "./useMetricsProcessor";
|
|
||||||
|
|
||||||
export function useExpressionsQueryProcessor(config: {
|
export function useExpressionsQueryProcessor(config: Indexable) {
|
||||||
metrics: string[];
|
|
||||||
metricTypes: string[];
|
|
||||||
metricConfig: MetricConfigOpt[];
|
|
||||||
}) {
|
|
||||||
if (!(config.metrics && config.metrics[0])) {
|
if (!(config.metrics && config.metrics[0])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -128,6 +128,23 @@ limitations under the License. -->
|
|||||||
|
|
||||||
function applyConfig() {
|
function applyConfig() {
|
||||||
dashboardStore.setConfigPanel(false);
|
dashboardStore.setConfigPanel(false);
|
||||||
|
const { metricMode } = dashboardStore.selectedGrid;
|
||||||
|
let p = {};
|
||||||
|
if (metricMode === "Expression") {
|
||||||
|
p = {
|
||||||
|
metrics: [],
|
||||||
|
metricTypes: [],
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
p = {
|
||||||
|
expressions: [],
|
||||||
|
typesOfMQE: [],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
dashboardStore.selectWidget({
|
||||||
|
...dashboardStore.selectedGrid,
|
||||||
|
...p,
|
||||||
|
});
|
||||||
dashboardStore.setConfigs(dashboardStore.selectedGrid);
|
dashboardStore.setConfigs(dashboardStore.selectedGrid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ limitations under the License. -->
|
|||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="item mb-10" v-show="!isExpression">
|
<div class="item mb-10" v-show="dashboardStore.selectedGrid.metricMode !== 'Expression'">
|
||||||
<span class="label">{{ t("aggregation") }}</span>
|
<span class="label">{{ t("aggregation") }}</span>
|
||||||
<SelectSingle
|
<SelectSingle
|
||||||
:value="currentMetric.calculation"
|
:value="currentMetric.calculation"
|
||||||
|
@ -77,6 +77,7 @@ limitations under the License. -->
|
|||||||
import graphs from "../graphs";
|
import graphs from "../graphs";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { useQueryProcessor, useSourceProcessor } from "@/hooks/useMetricsProcessor";
|
import { useQueryProcessor, useSourceProcessor } from "@/hooks/useMetricsProcessor";
|
||||||
|
import { useExpressionsQueryProcessor, useExpressionsSourceProcessor } from "@/hooks/useExpressionsProcessor";
|
||||||
import { EntityType, ListChartTypes } from "../data";
|
import { EntityType, ListChartTypes } from "../data";
|
||||||
import type { EventParams } from "@/types/dashboard";
|
import type { EventParams } from "@/types/dashboard";
|
||||||
import getDashboard from "@/hooks/useDashboardsSession";
|
import getDashboard from "@/hooks/useDashboardsSession";
|
||||||
@ -113,7 +114,14 @@ limitations under the License. -->
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function queryMetrics() {
|
async function queryMetrics() {
|
||||||
const params = await useQueryProcessor({ ...props.data });
|
const isExpression = props.data.metricMode === "Expression";
|
||||||
|
const params = isExpression
|
||||||
|
? await useExpressionsQueryProcessor({
|
||||||
|
metrics: props.data.expressions,
|
||||||
|
metricTypes: props.data.typesOfMQE,
|
||||||
|
metricConfig: props.data.metricConfig,
|
||||||
|
})
|
||||||
|
: await useQueryProcessor({ ...props.data });
|
||||||
|
|
||||||
if (!params) {
|
if (!params) {
|
||||||
state.source = {};
|
state.source = {};
|
||||||
@ -130,7 +138,12 @@ limitations under the License. -->
|
|||||||
metricTypes: props.data.metricTypes || [],
|
metricTypes: props.data.metricTypes || [],
|
||||||
metricConfig: props.data.metricConfig || [],
|
metricConfig: props.data.metricConfig || [],
|
||||||
};
|
};
|
||||||
state.source = useSourceProcessor(json, d);
|
const e = {
|
||||||
|
metrics: props.data.expressions || [],
|
||||||
|
metricTypes: props.data.typesOfMQE || [],
|
||||||
|
metricConfig: props.data.metricConfig || [],
|
||||||
|
};
|
||||||
|
state.source = isExpression ? await useExpressionsSourceProcessor(json, e) : await useSourceProcessor(json, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeWidget() {
|
function removeWidget() {
|
||||||
@ -166,7 +179,7 @@ limitations under the License. -->
|
|||||||
dashboardStore.selectWidget(props.data);
|
dashboardStore.selectWidget(props.data);
|
||||||
}
|
}
|
||||||
watch(
|
watch(
|
||||||
() => [props.data.metricTypes, props.data.metrics],
|
() => [props.data.metricTypes, props.data.metrics, props.data.expressions],
|
||||||
() => {
|
() => {
|
||||||
if (!dashboardStore.selectedGrid) {
|
if (!dashboardStore.selectedGrid) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user