diff --git a/app/src/lang/translations/en-US.yaml b/app/src/lang/translations/en-US.yaml index ad55310ce6..529253ea03 100644 --- a/app/src/lang/translations/en-US.yaml +++ b/app/src/lang/translations/en-US.yaml @@ -366,6 +366,7 @@ active: Active users: Users activity: Activity webhooks: Webhooks +decimals: Decimals field_width: Field Width add_filter: Add Filter upper_limit: Upper limit... diff --git a/app/src/modules/insights/routes/panel-configuration.vue b/app/src/modules/insights/routes/panel-configuration.vue index cf0c26eda6..ada7f353fb 100644 --- a/app/src/modules/insights/routes/panel-configuration.vue +++ b/app/src/modules/insights/routes/panel-configuration.vue @@ -90,6 +90,7 @@ export default defineComponent({ height: undefined, position_x: 1, position_y: 1, + options: props.panel?.options ?? {}, }); const selectItems = computed(() => { diff --git a/app/src/panels/metric/index.ts b/app/src/panels/metric/index.ts index 608849a026..2efc66b115 100644 --- a/app/src/panels/metric/index.ts +++ b/app/src/panels/metric/index.ts @@ -121,6 +121,36 @@ export default definePanel({ }, }, }, + { + field: 'prefix', + type: 'string', + name: '$t:prefix', + meta: { + interface: 'input', + width: 'half', + }, + }, + { + field: 'suffix', + type: 'string', + name: '$t:suffix', + meta: { + interface: 'input', + width: 'half', + }, + }, + { + field: 'decimals', + type: 'integer', + name: '$t:decimals', + meta: { + interface: 'input', + width: 'half', + }, + schema: { + default_value: 2, + }, + }, ], minWidth: 16, minHeight: 6, diff --git a/app/src/panels/metric/metric.vue b/app/src/panels/metric/metric.vue index c09d40480b..8dba701ff9 100644 --- a/app/src/panels/metric/metric.vue +++ b/app/src/panels/metric/metric.vue @@ -1,7 +1,11 @@ @@ -59,7 +63,7 @@ export default defineComponent({ }, }); - metric.value = Number(res.data.data[0].result).toFixed(props.options.decimals || 2); + metric.value = Number(res.data.data[0].result).toFixed(props.options.decimals ?? 2); } catch (err) { // oh no } finally { @@ -85,4 +89,11 @@ export default defineComponent({ .metric.has-header { height: calc(100% - 24px); } + +.suffix { + position: relative; + top: 7px; + font-weight: 700; + font-size: 24px; +}