mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-01 20:14:30 +00:00
refactor: set selectedGrid
This commit is contained in:
parent
0f01ac34a9
commit
400a1ae536
@ -16,21 +16,23 @@ limitations under the License. -->
|
|||||||
<div class="widget-config flex-v">
|
<div class="widget-config flex-v">
|
||||||
<div class="graph" v-loading="loading">
|
<div class="graph" v-loading="loading">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<span>{{ states.widget.title }}</span>
|
<span>{{ selectedGrid.widget.title }}</span>
|
||||||
<div class="tips" v-show="states.widget.tips">
|
<div class="tips" v-show="selectedGrid.widget.tips">
|
||||||
<el-tooltip :content="states.widget.tips">
|
<el-tooltip :content="selectedGrid.widget.tips">
|
||||||
<Icon iconName="info_outline" size="sm" />
|
<Icon iconName="info_outline" size="sm" />
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="render-chart">
|
<div class="render-chart">
|
||||||
<component
|
<component
|
||||||
:is="states.graph.type"
|
:is="selectedGrid.graph.type"
|
||||||
:intervalTime="appStoreWithOut.intervalTime"
|
:intervalTime="appStoreWithOut.intervalTime"
|
||||||
:data="states.source"
|
:data="states.source"
|
||||||
:config="states.graph"
|
:config="selectedGrid.graph"
|
||||||
/>
|
/>
|
||||||
<div v-show="!states.graph.type" class="no-data">{{ t("noData") }}</div>
|
<div v-show="!selectedGrid.graph.type" class="no-data">
|
||||||
|
{{ t("noData") }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="collapse" :style="{ height: configHeight + 'px' }">
|
<div class="collapse" :style="{ height: configHeight + 'px' }">
|
||||||
@ -39,12 +41,7 @@ limitations under the License. -->
|
|||||||
:style="{ '--el-collapse-header-font-size': '15px' }"
|
:style="{ '--el-collapse-header-font-size': '15px' }"
|
||||||
>
|
>
|
||||||
<el-collapse-item :title="t('metricName')" name="1">
|
<el-collapse-item :title="t('metricName')" name="1">
|
||||||
<MetricOptions
|
<MetricOptions @update="getSource" @loading="setLoading" />
|
||||||
:graph="states.graph"
|
|
||||||
@update="getSource"
|
|
||||||
@apply="getMetricsConfig"
|
|
||||||
@loading="setLoading"
|
|
||||||
/>
|
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
<el-collapse-item :title="t('selectVisualization')" name="2">
|
<el-collapse-item :title="t('selectVisualization')" name="2">
|
||||||
<div class="chart-types">
|
<div class="chart-types">
|
||||||
@ -52,34 +49,20 @@ limitations under the License. -->
|
|||||||
v-for="(type, index) in states.visType"
|
v-for="(type, index) in states.visType"
|
||||||
:key="index"
|
:key="index"
|
||||||
@click="changeChartType(type)"
|
@click="changeChartType(type)"
|
||||||
:class="{ active: type.value === states.graph.type }"
|
:class="{ active: type.value === selectedGrid.graph.type }"
|
||||||
>
|
>
|
||||||
{{ type.label }}
|
{{ type.label }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
<el-collapse-item :title="t('graphStyles')" name="3">
|
<el-collapse-item :title="t('graphStyles')" name="3">
|
||||||
<component
|
<component :is="`${selectedGrid.graph.type}Config`" />
|
||||||
:is="`${states.graph.type}Config`"
|
|
||||||
:config="{
|
|
||||||
...states.graph,
|
|
||||||
metrics: states.metrics,
|
|
||||||
metricTypes: states.metricTypes,
|
|
||||||
}"
|
|
||||||
@update="updateGraphOptions"
|
|
||||||
/>
|
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
<el-collapse-item :title="t('widgetOptions')" name="4">
|
<el-collapse-item :title="t('widgetOptions')" name="4">
|
||||||
<WidgetOptions
|
<WidgetOptions />
|
||||||
:config="states.widget"
|
|
||||||
@update="updateWidgetOptions"
|
|
||||||
/>
|
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
<el-collapse-item :title="t('standardOptions')" name="5">
|
<el-collapse-item :title="t('standardOptions')" name="5">
|
||||||
<StandardOptions
|
<StandardOptions />
|
||||||
:config="states.standard"
|
|
||||||
@update="updateStandardOptions"
|
|
||||||
/>
|
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
</el-collapse>
|
</el-collapse>
|
||||||
</div>
|
</div>
|
||||||
@ -106,7 +89,6 @@ import {
|
|||||||
EntityType,
|
EntityType,
|
||||||
} from "../data";
|
} from "../data";
|
||||||
import { Option } from "@/types/app";
|
import { Option } from "@/types/app";
|
||||||
import { WidgetConfig, GraphConfig, StandardConfig } from "@/types/dashboard";
|
|
||||||
import graphs from "../graphs";
|
import graphs from "../graphs";
|
||||||
import configs from "./graph-styles";
|
import configs from "./graph-styles";
|
||||||
import WidgetOptions from "./WidgetOptions.vue";
|
import WidgetOptions from "./WidgetOptions.vue";
|
||||||
@ -133,26 +115,16 @@ export default defineComponent({
|
|||||||
activeNames: string;
|
activeNames: string;
|
||||||
source: any;
|
source: any;
|
||||||
index: string;
|
index: string;
|
||||||
graph: GraphConfig | any;
|
|
||||||
widget: WidgetConfig | any;
|
|
||||||
standard: StandardConfig;
|
|
||||||
visType: Option[];
|
visType: Option[];
|
||||||
isTable: boolean;
|
isTable: boolean;
|
||||||
metrics: string[];
|
|
||||||
metricTypes: string[];
|
|
||||||
}>({
|
}>({
|
||||||
activeNames: "1",
|
activeNames: "1",
|
||||||
source: {},
|
source: {},
|
||||||
index: selectedGrid.i,
|
index: selectedGrid.i,
|
||||||
graph: selectedGrid.graph,
|
|
||||||
widget: selectedGrid.widget,
|
|
||||||
standard: selectedGrid.standard,
|
|
||||||
visType: [],
|
visType: [],
|
||||||
isTable: false,
|
isTable: false,
|
||||||
metrics: [],
|
|
||||||
metricTypes: [],
|
|
||||||
});
|
});
|
||||||
states.isTable = TableChartTypes.includes(states.graph.type || "");
|
states.isTable = TableChartTypes.includes(selectedGrid.graph.type || "");
|
||||||
|
|
||||||
if (entity === EntityType[0].value) {
|
if (entity === EntityType[0].value) {
|
||||||
states.visType = ChartTypes.filter(
|
states.visType = ChartTypes.filter(
|
||||||
@ -169,62 +141,24 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function changeChartType(item: Option) {
|
function changeChartType(item: Option) {
|
||||||
states.graph = {
|
const graph = {
|
||||||
|
...selectedGrid.graph,
|
||||||
...DefaultGraphConfig[item.value],
|
...DefaultGraphConfig[item.value],
|
||||||
};
|
};
|
||||||
states.isTable = TableChartTypes.includes(states.graph.type);
|
states.isTable = TableChartTypes.includes(selectedGrid.graph.type);
|
||||||
}
|
dashboardStore.selectWidget({ ...selectedGrid, graph });
|
||||||
function updateWidgetOptions(param: { [key: string]: unknown }) {
|
|
||||||
states.widget = {
|
|
||||||
...states.widget,
|
|
||||||
...param,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateGraphOptions(param: { [key: string]: unknown }) {
|
|
||||||
states.graph = {
|
|
||||||
...states.graph,
|
|
||||||
...param,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateStandardOptions(param: { [key: string]: unknown }) {
|
|
||||||
states.standard = {
|
|
||||||
...states.standard,
|
|
||||||
...param,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSource(source: unknown) {
|
function getSource(source: unknown) {
|
||||||
states.source = source;
|
states.source = source;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMetricsConfig(opts: {
|
|
||||||
metrics?: string[];
|
|
||||||
metricTypes?: string[];
|
|
||||||
}) {
|
|
||||||
if (opts.metrics !== undefined) {
|
|
||||||
states.metrics = opts.metrics;
|
|
||||||
}
|
|
||||||
if (opts.metricTypes !== undefined) {
|
|
||||||
states.metricTypes = opts.metricTypes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setLoading(load: boolean) {
|
function setLoading(load: boolean) {
|
||||||
loading.value = load;
|
loading.value = load;
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyConfig() {
|
function applyConfig() {
|
||||||
const opts = {
|
dashboardStore.setConfigs(dashboardStore.selectedGrid);
|
||||||
...dashboardStore.selectedGrid,
|
|
||||||
metrics: states.metrics,
|
|
||||||
metricTypes: states.metricTypes,
|
|
||||||
widget: states.widget,
|
|
||||||
graph: states.graph,
|
|
||||||
standard: states.standard,
|
|
||||||
};
|
|
||||||
dashboardStore.setConfigs(opts);
|
|
||||||
dashboardStore.setConfigPanel(false);
|
dashboardStore.setConfigPanel(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,13 +168,10 @@ export default defineComponent({
|
|||||||
changeChartType,
|
changeChartType,
|
||||||
t,
|
t,
|
||||||
appStoreWithOut,
|
appStoreWithOut,
|
||||||
updateWidgetOptions,
|
|
||||||
configHeight,
|
configHeight,
|
||||||
updateGraphOptions,
|
selectedGrid,
|
||||||
updateStandardOptions,
|
|
||||||
applyConfig,
|
applyConfig,
|
||||||
getSource,
|
getSource,
|
||||||
getMetricsConfig,
|
|
||||||
setLoading,
|
setLoading,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -70,7 +70,6 @@ limitations under the License. -->
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { reactive, watch } from "vue";
|
import { reactive, watch } from "vue";
|
||||||
import type { PropType } from "vue";
|
|
||||||
import { Option } from "@/types/app";
|
import { Option } from "@/types/app";
|
||||||
import { GraphConfig } from "@/types/dashboard";
|
import { GraphConfig } from "@/types/dashboard";
|
||||||
import { useDashboardStore } from "@/store/modules/dashboard";
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
@ -79,14 +78,8 @@ import { ElMessage } from "element-plus";
|
|||||||
import Icon from "@/components/Icon.vue";
|
import Icon from "@/components/Icon.vue";
|
||||||
import { useQueryProcessor, useSourceProcessor } from "@/hooks/useProcessor";
|
import { useQueryProcessor, useSourceProcessor } from "@/hooks/useProcessor";
|
||||||
|
|
||||||
/*global defineProps, defineEmits */
|
/*global defineEmits */
|
||||||
const props = defineProps({
|
const emit = defineEmits(["update", "loading"]);
|
||||||
graph: {
|
|
||||||
type: Object as PropType<GraphConfig>,
|
|
||||||
default: () => ({}),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const emit = defineEmits(["update", "apply", "loading"]);
|
|
||||||
const dashboardStore = useDashboardStore();
|
const dashboardStore = useDashboardStore();
|
||||||
const { selectedGrid, entity } = dashboardStore;
|
const { selectedGrid, entity } = dashboardStore;
|
||||||
const { metrics, metricTypes } = selectedGrid;
|
const { metrics, metricTypes } = selectedGrid;
|
||||||
@ -99,13 +92,13 @@ const states = reactive<{
|
|||||||
metricList: (Option & { type: string })[];
|
metricList: (Option & { type: string })[];
|
||||||
graph: GraphConfig | any;
|
graph: GraphConfig | any;
|
||||||
}>({
|
}>({
|
||||||
metrics: metrics && metrics.length ? selectedGrid.metrics : [""],
|
metrics: metrics && metrics.length ? metrics : [""],
|
||||||
metricTypes: metricTypes && metricTypes.length ? metricTypes : [""],
|
metricTypes: metricTypes && metricTypes.length ? metricTypes : [""],
|
||||||
metricTypeList: [],
|
metricTypeList: [],
|
||||||
visType: [],
|
visType: [],
|
||||||
isTable: false,
|
isTable: false,
|
||||||
metricList: [],
|
metricList: [],
|
||||||
graph: props.graph,
|
graph: selectedGrid.graph,
|
||||||
});
|
});
|
||||||
states.isTable = TableChartTypes.includes(states.graph.type);
|
states.isTable = TableChartTypes.includes(states.graph.type);
|
||||||
|
|
||||||
@ -141,7 +134,6 @@ function changeMetrics(index: number, arr: (Option & { type: string })[]) {
|
|||||||
if (!arr.length) {
|
if (!arr.length) {
|
||||||
states.metricTypeList = [];
|
states.metricTypeList = [];
|
||||||
states.metricTypes = [];
|
states.metricTypes = [];
|
||||||
emit("apply", { metricTypes: states.metricTypes });
|
|
||||||
dashboardStore.selectWidget({
|
dashboardStore.selectWidget({
|
||||||
...selectedGrid,
|
...selectedGrid,
|
||||||
...{ metricTypes: states.metricTypes, metrics: states.metrics },
|
...{ metricTypes: states.metricTypes, metrics: states.metrics },
|
||||||
@ -157,7 +149,6 @@ function changeMetrics(index: number, arr: (Option & { type: string })[]) {
|
|||||||
...selectedGrid,
|
...selectedGrid,
|
||||||
...{ metricTypes: states.metricTypes, metrics: states.metrics },
|
...{ metricTypes: states.metricTypes, metrics: states.metrics },
|
||||||
});
|
});
|
||||||
emit("apply", { metricTypes: states.metricTypes, metrics: states.metrics });
|
|
||||||
queryMetrics();
|
queryMetrics();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,7 +175,6 @@ function changeMetricType(index: number, opt: Option[]) {
|
|||||||
...selectedGrid,
|
...selectedGrid,
|
||||||
...{ metricTypes: states.metricTypes },
|
...{ metricTypes: states.metricTypes },
|
||||||
});
|
});
|
||||||
emit("apply", { metricTypes: states.metricTypes });
|
|
||||||
queryMetrics();
|
queryMetrics();
|
||||||
}
|
}
|
||||||
async function queryMetrics() {
|
async function queryMetrics() {
|
||||||
@ -222,8 +212,8 @@ function deleteMetric(index: number) {
|
|||||||
states.metricTypes.splice(index, 1);
|
states.metricTypes.splice(index, 1);
|
||||||
}
|
}
|
||||||
watch(
|
watch(
|
||||||
() => props.graph,
|
() => selectedGrid.graph,
|
||||||
(data: any) => {
|
(data: { type: string }) => {
|
||||||
states.isTable = TableChartTypes.includes(data.type);
|
states.isTable = TableChartTypes.includes(data.type);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -119,20 +119,13 @@ limitations under the License. -->
|
|||||||
import { reactive } from "vue";
|
import { reactive } from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { SortOrder } from "../data";
|
import { SortOrder } from "../data";
|
||||||
import { StandardConfig } from "@/types/dashboard";
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
import type { PropType } from "vue";
|
|
||||||
|
|
||||||
/*global defineProps, defineEmits */
|
const dashboardStore = useDashboardStore();
|
||||||
const props = defineProps({
|
const { selectedGrid } = dashboardStore;
|
||||||
config: {
|
|
||||||
type: Object as PropType<StandardConfig>,
|
|
||||||
default: () => ({ unit: "", sortOrder: "DES" }),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const emits = defineEmits(["update"]);
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
unit: props.config.unit,
|
unit: selectedGrid.standard.unit,
|
||||||
max: "",
|
max: "",
|
||||||
min: "",
|
min: "",
|
||||||
plus: "",
|
plus: "",
|
||||||
@ -141,11 +134,15 @@ const state = reactive({
|
|||||||
divide: "",
|
divide: "",
|
||||||
milliseconds: "",
|
milliseconds: "",
|
||||||
seconds: "",
|
seconds: "",
|
||||||
sortOrder: props.config.sortOrder,
|
sortOrder: selectedGrid.standard.sortOrder,
|
||||||
});
|
});
|
||||||
|
|
||||||
function changeStandardOpt(param: { [key: string]: unknown }) {
|
function changeStandardOpt(param: { [key: string]: unknown }) {
|
||||||
emits("update", param);
|
const standard = {
|
||||||
|
...selectedGrid.standard,
|
||||||
|
...param,
|
||||||
|
};
|
||||||
|
dashboardStore.selectWidget({ ...selectedGrid, standard });
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@ -37,23 +37,20 @@ limitations under the License. -->
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { WidgetConfig } from "@/types/dashboard";
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
import type { PropType } from "vue";
|
|
||||||
|
|
||||||
/*global defineProps, defineEmits */
|
|
||||||
const props = defineProps({
|
|
||||||
config: {
|
|
||||||
type: Object as PropType<WidgetConfig>,
|
|
||||||
default: () => ({ title: "", tooltips: "" }),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const emits = defineEmits(["update"]);
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const title = ref<string>(props.config.title || "");
|
const dashboardStore = useDashboardStore();
|
||||||
const tips = ref<string>(props.config.tips || "");
|
const { selectedGrid } = dashboardStore;
|
||||||
|
const title = ref<string>(selectedGrid.widget.title || "");
|
||||||
|
const tips = ref<string>(selectedGrid.widget.tips || "");
|
||||||
|
|
||||||
function updateWidgetConfig(param: { [key: string]: unknown }) {
|
function updateWidgetConfig(param: { [key: string]: unknown }) {
|
||||||
emits("update", param);
|
const widget = {
|
||||||
|
...selectedGrid.widget,
|
||||||
|
...param,
|
||||||
|
};
|
||||||
|
dashboardStore.selectWidget({ ...selectedGrid, widget });
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@ -29,24 +29,21 @@ limitations under the License. -->
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import type { PropType } from "vue";
|
|
||||||
import { AreaConfig } from "@/types/dashboard";
|
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
|
|
||||||
/*global defineProps, defineEmits */
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const dashboardStore = useDashboardStore();
|
||||||
|
const { selectedGrid } = dashboardStore;
|
||||||
|
|
||||||
const props = defineProps({
|
const opacity = ref(selectedGrid.graph.opacity);
|
||||||
config: {
|
|
||||||
type: Object as PropType<AreaConfig>,
|
|
||||||
default: () => ({ opacity: 0.4 }),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const emits = defineEmits(["update"]);
|
|
||||||
const opacity = ref(props.config.opacity);
|
|
||||||
|
|
||||||
function updateConfig(param: { [key: string]: unknown }) {
|
function updateConfig(param: { [key: string]: unknown }) {
|
||||||
emits("update", param);
|
const graph = {
|
||||||
|
...selectedGrid.graph,
|
||||||
|
...param,
|
||||||
|
};
|
||||||
|
dashboardStore.selectWidget({ ...selectedGrid, graph });
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@ -25,24 +25,20 @@ limitations under the License. -->
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import type { PropType } from "vue";
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
import { BarConfig } from "@/types/dashboard";
|
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
|
|
||||||
/*global defineProps, defineEmits */
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const dashboardStore = useDashboardStore();
|
||||||
const props = defineProps({
|
const { selectedGrid } = dashboardStore;
|
||||||
config: {
|
const showBackground = ref(selectedGrid.graph.showBackground || false);
|
||||||
type: Object as PropType<BarConfig>,
|
|
||||||
default: () => ({ showBackground: true, barWidth: 30 }),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const emits = defineEmits(["update"]);
|
|
||||||
const showBackground = ref(props.config.showBackground || false);
|
|
||||||
|
|
||||||
function changeConfig(param: { [key: string]: unknown }) {
|
function changeConfig(param: { [key: string]: unknown }) {
|
||||||
emits("update", param);
|
const graph = {
|
||||||
|
...selectedGrid.graph,
|
||||||
|
...param,
|
||||||
|
};
|
||||||
|
dashboardStore.selectWidget({ ...selectedGrid, graph });
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@ -29,24 +29,20 @@ limitations under the License. -->
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import type { PropType } from "vue";
|
|
||||||
import { CardConfig } from "@/types/dashboard";
|
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
|
|
||||||
/*global defineProps, defineEmits */
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const dashboardStore = useDashboardStore();
|
||||||
const props = defineProps({
|
const { selectedGrid } = dashboardStore;
|
||||||
config: {
|
const fontSize = ref(selectedGrid.graph.fontSize);
|
||||||
type: Object as PropType<CardConfig>,
|
|
||||||
default: () => ({ fontSize: 12 }),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const emits = defineEmits(["update"]);
|
|
||||||
const fontSize = ref(props.config.fontSize);
|
|
||||||
|
|
||||||
function updateConfig(param: { [key: string]: unknown }) {
|
function updateConfig(param: { [key: string]: unknown }) {
|
||||||
emits("update", param);
|
const graph = {
|
||||||
|
...selectedGrid.graph,
|
||||||
|
...param,
|
||||||
|
};
|
||||||
|
dashboardStore.selectWidget({ ...selectedGrid, graph });
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@ -29,24 +29,21 @@ limitations under the License. -->
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import type { PropType } from "vue";
|
|
||||||
import { EndpointListConfig } from "@/types/dashboard";
|
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
|
|
||||||
/*global defineProps, defineEmits */
|
const dashboardStore = useDashboardStore();
|
||||||
|
const { selectedGrid } = dashboardStore;
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const props = defineProps({
|
const fontSize = ref(selectedGrid.graph.fontSize);
|
||||||
config: {
|
|
||||||
type: Object as PropType<EndpointListConfig>,
|
|
||||||
default: () => ({ fontSize: 12 }),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const emits = defineEmits(["update"]);
|
|
||||||
const fontSize = ref(props.config.fontSize);
|
|
||||||
|
|
||||||
function updateConfig(param: { [key: string]: unknown }) {
|
function updateConfig(param: { [key: string]: unknown }) {
|
||||||
emits("update", param);
|
const graph = {
|
||||||
|
...selectedGrid.graph,
|
||||||
|
...param,
|
||||||
|
};
|
||||||
|
dashboardStore.selectWidget({ ...selectedGrid, graph });
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@ -29,24 +29,20 @@ limitations under the License. -->
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import type { PropType } from "vue";
|
|
||||||
import { InstanceListConfig } from "@/types/dashboard";
|
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
|
|
||||||
/*global defineProps, defineEmits */
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const dashboardStore = useDashboardStore();
|
||||||
const props = defineProps({
|
const { selectedGrid } = dashboardStore;
|
||||||
config: {
|
const fontSize = ref(selectedGrid.graph.fontSize);
|
||||||
type: Object as PropType<InstanceListConfig>,
|
|
||||||
default: () => ({ fontSize: 12 }),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const emits = defineEmits(["update"]);
|
|
||||||
const fontSize = ref(props.config.fontSize);
|
|
||||||
|
|
||||||
function updateConfig(param: { [key: string]: unknown }) {
|
function updateConfig(param: { [key: string]: unknown }) {
|
||||||
emits("update", param);
|
const graph = {
|
||||||
|
...selectedGrid.graph,
|
||||||
|
...param,
|
||||||
|
};
|
||||||
|
dashboardStore.selectWidget({ ...selectedGrid, graph });
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@ -43,25 +43,22 @@ limitations under the License. -->
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import type { PropType } from "vue";
|
|
||||||
import { LineConfig } from "@/types/dashboard";
|
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
|
|
||||||
/*global defineProps, defineEmits */
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const props = defineProps({
|
const dashboardStore = useDashboardStore();
|
||||||
config: {
|
const { selectedGrid } = dashboardStore;
|
||||||
type: Object as PropType<LineConfig>,
|
const smooth = ref(selectedGrid.graph.smooth);
|
||||||
default: () => ({}),
|
const showSymbol = ref(selectedGrid.graph.showSymbol);
|
||||||
},
|
const step = ref(selectedGrid.graph.step);
|
||||||
});
|
|
||||||
const emits = defineEmits(["update"]);
|
|
||||||
const smooth = ref(props.config.smooth);
|
|
||||||
const showSymbol = ref(props.config.showSymbol);
|
|
||||||
const step = ref(props.config.step);
|
|
||||||
|
|
||||||
function updateConfig(param: { [key: string]: unknown }) {
|
function updateConfig(param: { [key: string]: unknown }) {
|
||||||
emits("update", param);
|
const graph = {
|
||||||
|
...selectedGrid.graph,
|
||||||
|
...param,
|
||||||
|
};
|
||||||
|
dashboardStore.selectWidget({ ...selectedGrid, graph });
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@ -29,24 +29,20 @@ limitations under the License. -->
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import type { PropType } from "vue";
|
|
||||||
import { ServiceListConfig } from "@/types/dashboard";
|
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
|
|
||||||
/*global defineProps, defineEmits */
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const dashboardStore = useDashboardStore();
|
||||||
const props = defineProps({
|
const { selectedGrid } = dashboardStore;
|
||||||
config: {
|
const fontSize = ref(selectedGrid.graph.fontSize);
|
||||||
type: Object as PropType<ServiceListConfig>,
|
|
||||||
default: () => ({ fontSize: 12 }),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const emits = defineEmits(["update"]);
|
|
||||||
const fontSize = ref(props.config.fontSize);
|
|
||||||
|
|
||||||
function updateConfig(param: { [key: string]: unknown }) {
|
function updateConfig(param: { [key: string]: unknown }) {
|
||||||
emits("update", param);
|
const graph = {
|
||||||
|
...selectedGrid.graph,
|
||||||
|
...param,
|
||||||
|
};
|
||||||
|
dashboardStore.selectWidget({ ...selectedGrid, graph });
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@ -45,29 +45,22 @@ limitations under the License. -->
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import type { PropType } from "vue";
|
|
||||||
import { TableConfig } from "@/types/dashboard";
|
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
|
|
||||||
/*global defineProps, defineEmits */
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const props = defineProps({
|
const dashboardStore = useDashboardStore();
|
||||||
config: {
|
const { selectedGrid } = dashboardStore;
|
||||||
type: Object as PropType<TableConfig>,
|
const showTableValues = ref(selectedGrid.graph.showTableValues);
|
||||||
default: () => ({
|
const tableHeaderCol1 = ref(selectedGrid.graph.tableHeaderCol1);
|
||||||
showTableValues: true,
|
const tableHeaderCol2 = ref(selectedGrid.graph.tableHeaderCol2);
|
||||||
tableHeaderCol1: "",
|
|
||||||
tableHeaderCol2: "",
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const emits = defineEmits(["update"]);
|
|
||||||
const showTableValues = ref(props.config.showTableValues);
|
|
||||||
const tableHeaderCol1 = ref(props.config.tableHeaderCol1);
|
|
||||||
const tableHeaderCol2 = ref(props.config.tableHeaderCol2);
|
|
||||||
|
|
||||||
function updateConfig(param: { [key: string]: unknown }) {
|
function updateConfig(param: { [key: string]: unknown }) {
|
||||||
emits("update", param);
|
const graph = {
|
||||||
|
...selectedGrid.graph,
|
||||||
|
...param,
|
||||||
|
};
|
||||||
|
dashboardStore.selectWidget({ ...selectedGrid, graph });
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@ -29,25 +29,20 @@ limitations under the License. -->
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import type { PropType } from "vue";
|
|
||||||
import { TopListConfig } from "@/types/dashboard";
|
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
|
|
||||||
/*global defineProps, defineEmits */
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const props = defineProps({
|
const dashboardStore = useDashboardStore();
|
||||||
config: {
|
const { selectedGrid } = dashboardStore;
|
||||||
type: Object as PropType<TopListConfig>,
|
const topN = ref(selectedGrid.graph.topN);
|
||||||
default: () => ({
|
|
||||||
topN: 10,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const emits = defineEmits(["update"]);
|
|
||||||
const topN = ref(props.config.topN);
|
|
||||||
|
|
||||||
function updateConfig(param: { [key: string]: unknown }) {
|
function updateConfig(param: { [key: string]: unknown }) {
|
||||||
emits("update", param);
|
const graph = {
|
||||||
|
...selectedGrid.graph,
|
||||||
|
...param,
|
||||||
|
};
|
||||||
|
dashboardStore.selectWidget({ ...selectedGrid, graph });
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@ -20,7 +20,6 @@ import { computed } from "vue";
|
|||||||
import type { PropType } from "vue";
|
import type { PropType } from "vue";
|
||||||
import { Event } from "@/types/events";
|
import { Event } from "@/types/events";
|
||||||
import { LineConfig } from "@/types/dashboard";
|
import { LineConfig } from "@/types/dashboard";
|
||||||
import { config } from "@vue/test-utils";
|
|
||||||
|
|
||||||
/*global defineProps */
|
/*global defineProps */
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
Loading…
Reference in New Issue
Block a user