mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-14 00:37:33 +00:00
fix
This commit is contained in:
parent
dca555a461
commit
b014432632
@ -15,6 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { LegendOptions } from "@/types/dashboard";
|
import { LegendOptions } from "@/types/dashboard";
|
||||||
|
import { isUnDef } from "@/utils/is";
|
||||||
|
|
||||||
export default function useLegendProcess(legend?: LegendOptions) {
|
export default function useLegendProcess(legend?: LegendOptions) {
|
||||||
let isRight = false;
|
let isRight = false;
|
||||||
@ -22,7 +23,10 @@ export default function useLegendProcess(legend?: LegendOptions) {
|
|||||||
isRight = true;
|
isRight = true;
|
||||||
}
|
}
|
||||||
function showEchartsLegend(keys: string[]) {
|
function showEchartsLegend(keys: string[]) {
|
||||||
if (legend && !legend.show === undefined) {
|
if (legend && isUnDef(legend.show)) {
|
||||||
|
if (legend.asTable && legend.show) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return legend.show;
|
return legend.show;
|
||||||
}
|
}
|
||||||
if (keys.length === 1) {
|
if (keys.length === 1) {
|
||||||
|
@ -21,7 +21,7 @@ export function is(val: unknown, type: string): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function isDef<T = unknown>(val?: T): val is T {
|
export function isDef<T = unknown>(val?: T): val is T {
|
||||||
return typeof val !== "undefined";
|
return typeof val === "undefined";
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isUnDef<T = unknown>(val?: T): val is T {
|
export function isUnDef<T = unknown>(val?: T): val is T {
|
||||||
|
@ -32,6 +32,7 @@ limitations under the License. -->
|
|||||||
:data="states.source"
|
:data="states.source"
|
||||||
:config="{
|
:config="{
|
||||||
...graph,
|
...graph,
|
||||||
|
legend: (dashboardStore.selectedGrid.graph || {}).legend,
|
||||||
i: dashboardStore.selectedGrid.i,
|
i: dashboardStore.selectedGrid.i,
|
||||||
metrics: dashboardStore.selectedGrid.metrics,
|
metrics: dashboardStore.selectedGrid.metrics,
|
||||||
metricTypes: dashboardStore.selectedGrid.metricTypes,
|
metricTypes: dashboardStore.selectedGrid.metricTypes,
|
||||||
|
@ -24,7 +24,7 @@ limitations under the License. -->
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span class="label">{{ t("legendOptions") }}</span>
|
<span class="label">{{ t("legendOptions") }}</span>
|
||||||
<span class="label mr-5">{{ t("asTable") }}</span>
|
<span class="title mr-5">{{ t("asTable") }}</span>
|
||||||
<el-switch
|
<el-switch
|
||||||
v-model="legend.asTable"
|
v-model="legend.asTable"
|
||||||
active-text="Yes"
|
active-text="Yes"
|
||||||
@ -108,7 +108,10 @@ function updateLegendConfig(param: { [key: string]: unknown }) {
|
|||||||
...param,
|
...param,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
dashboardStore.selectWidget({ ...dashboardStore.selectedGrid, g });
|
dashboardStore.selectWidget({
|
||||||
|
...dashboardStore.selectedGrid,
|
||||||
|
graph: g,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||||||
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. -->
|
||||||
<template>
|
<template>
|
||||||
<div class="graph flex-v" :class="isRight ? 'flex-h' : 'flex-v'">
|
<div class="graph flex-v" :class="setRight ? 'flex-h' : 'flex-v'">
|
||||||
<Graph
|
<Graph
|
||||||
:option="option"
|
:option="option"
|
||||||
@select="clickEvent"
|
@select="clickEvent"
|
||||||
@ -24,7 +24,7 @@ limitations under the License. -->
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed } from "vue";
|
import { computed, ref } from "vue";
|
||||||
import type { PropType } from "vue";
|
import type { PropType } from "vue";
|
||||||
import {
|
import {
|
||||||
LineConfig,
|
LineConfig,
|
||||||
@ -64,11 +64,13 @@ const props = defineProps({
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const setRight = ref<boolean>(false);
|
||||||
|
const option = computed(() => getOption());
|
||||||
|
function getOption() {
|
||||||
const { showEchartsLegend, isRight, chartColors } = useLegendProcess(
|
const { showEchartsLegend, isRight, chartColors } = useLegendProcess(
|
||||||
props.config.legend
|
props.config.legend
|
||||||
);
|
);
|
||||||
const option = computed(() => getOption());
|
setRight.value = isRight;
|
||||||
function getOption() {
|
|
||||||
const keys = Object.keys(props.data || {}).filter(
|
const keys = Object.keys(props.data || {}).filter(
|
||||||
(i: any) => Array.isArray(props.data[i]) && props.data[i].length
|
(i: any) => Array.isArray(props.data[i]) && props.data[i].length
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user