mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-10-15 04:09:14 +00:00
feat: add content decorations to Table and Card widgets (#419)
This commit is contained in:
@@ -22,7 +22,7 @@ limitations under the License. -->
|
||||
justifyContent: config.textAlign || 'center',
|
||||
}"
|
||||
>
|
||||
{{ singleVal }}
|
||||
{{ decorations[singleVal] || singleVal }}
|
||||
<span class="unit" v-show="config.showUnit && unit">
|
||||
{{ decodeURIComponent(unit) }}
|
||||
</span>
|
||||
@@ -48,11 +48,13 @@ limitations under the License. -->
|
||||
showUnit: true,
|
||||
textAlign: "center",
|
||||
metricConfig: [],
|
||||
decorations: {},
|
||||
}),
|
||||
},
|
||||
});
|
||||
const { t } = useI18n();
|
||||
const metricConfig = computed(() => props.config.metricConfig || []);
|
||||
const decorations = computed(() => props.config.decorations || {});
|
||||
const key = computed(() => Object.keys(props.data)[0]);
|
||||
const singleVal = computed(() =>
|
||||
Array.isArray(props.data[key.value]) ? props.data[key.value][0] : props.data[key.value],
|
||||
|
@@ -37,7 +37,7 @@ limitations under the License. -->
|
||||
>{{ k.split("=")[1] }}</div
|
||||
>
|
||||
<div class="value-col" v-if="config.showTableValues">
|
||||
{{ data[(keys as string[]).join(",")][data[(keys as string[]).join(",")].length - 1 || 0] }}
|
||||
{{ getColValue(keys) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -58,12 +58,14 @@ limitations under the License. -->
|
||||
showTableValues: boolean;
|
||||
tableHeaderCol2: string;
|
||||
typesOfMQE: string[];
|
||||
decorations: {};
|
||||
}>,
|
||||
default: () => ({ showTableValues: true }),
|
||||
},
|
||||
});
|
||||
|
||||
const { t } = useI18n();
|
||||
const decorations = computed<{ [key: number]: string }>(() => props.config.decorations || {});
|
||||
const nameWidth = computed(() => (props.config.showTableValues ? 80 : 100));
|
||||
const dataKeys = computed(() => {
|
||||
const keys = Object.keys(props.data || {}).filter(
|
||||
@@ -73,6 +75,10 @@ limitations under the License. -->
|
||||
|
||||
return list;
|
||||
});
|
||||
function getColValue(keys: string[]) {
|
||||
const val = props.data[(keys as string[]).join(",")][props.data[(keys as string[]).join(",")].length - 1 || 0];
|
||||
return decorations.value[val] || val;
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.chart-table {
|
||||
|
Reference in New Issue
Block a user