mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-02 06:14:01 +00:00
feat: add a calculation for cpm5d
(#239)
This commit is contained in:
parent
72060f8227
commit
220525a2d9
@ -30,7 +30,6 @@ export enum Calculations {
|
|||||||
ByteToMB = "byteToMB",
|
ByteToMB = "byteToMB",
|
||||||
ByteToGB = "byteToGB",
|
ByteToGB = "byteToGB",
|
||||||
Apdex = "apdex",
|
Apdex = "apdex",
|
||||||
Precision = "precision",
|
|
||||||
ConvertSeconds = "convertSeconds",
|
ConvertSeconds = "convertSeconds",
|
||||||
ConvertMilliseconds = "convertMilliseconds",
|
ConvertMilliseconds = "convertMilliseconds",
|
||||||
MsToS = "msTos",
|
MsToS = "msTos",
|
||||||
@ -39,6 +38,7 @@ export enum Calculations {
|
|||||||
ApdexAvg = "apdexAvg",
|
ApdexAvg = "apdexAvg",
|
||||||
SecondToDay = "secondToDay",
|
SecondToDay = "secondToDay",
|
||||||
NanosecondToMillisecond = "nanosecondToMillisecond",
|
NanosecondToMillisecond = "nanosecondToMillisecond",
|
||||||
|
CPM5D = "cpm5d",
|
||||||
}
|
}
|
||||||
export enum sizeEnum {
|
export enum sizeEnum {
|
||||||
XS = "XS",
|
XS = "XS",
|
||||||
@ -67,7 +67,7 @@ screenMap.set(sizeEnum.LG, screenEnum.LG);
|
|||||||
screenMap.set(sizeEnum.XL, screenEnum.XL);
|
screenMap.set(sizeEnum.XL, screenEnum.XL);
|
||||||
screenMap.set(sizeEnum.XXL, screenEnum.XXL);
|
screenMap.set(sizeEnum.XXL, screenEnum.XXL);
|
||||||
|
|
||||||
export const RespFields: any = {
|
export const RespFields: { [key: string]: string } = {
|
||||||
readMetricsValues: `{
|
readMetricsValues: `{
|
||||||
label
|
label
|
||||||
values {
|
values {
|
||||||
|
@ -398,15 +398,15 @@ export function aggregation(val: number, config: { calculation?: string }): numb
|
|||||||
case Calculations.Apdex:
|
case Calculations.Apdex:
|
||||||
data = (val / 10000).toFixed(2);
|
data = (val / 10000).toFixed(2);
|
||||||
break;
|
break;
|
||||||
|
case Calculations.CPM5D:
|
||||||
|
data = val / 100000 < 1 && val / 100000 !== 0 ? (val / 100000).toFixed(5) : (val / 100000).toFixed(2);
|
||||||
|
break;
|
||||||
case Calculations.ConvertSeconds:
|
case Calculations.ConvertSeconds:
|
||||||
data = dayjs(val * 1000).format("YYYY-MM-DD HH:mm:ss");
|
data = dayjs(val * 1000).format("YYYY-MM-DD HH:mm:ss");
|
||||||
break;
|
break;
|
||||||
case Calculations.ConvertMilliseconds:
|
case Calculations.ConvertMilliseconds:
|
||||||
data = dayjs(val).format("YYYY-MM-DD HH:mm:ss");
|
data = dayjs(val).format("YYYY-MM-DD HH:mm:ss");
|
||||||
break;
|
break;
|
||||||
case Calculations.Precision:
|
|
||||||
data = data.toFixed(2);
|
|
||||||
break;
|
|
||||||
case Calculations.MsToS:
|
case Calculations.MsToS:
|
||||||
data = (val / 1000).toFixed(2);
|
data = (val / 1000).toFixed(2);
|
||||||
break;
|
break;
|
||||||
|
@ -117,7 +117,6 @@ limitations under the License. -->
|
|||||||
.side-bar {
|
.side-bar {
|
||||||
background: #252a2f;
|
background: #252a2f;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: hidden;
|
|
||||||
margin-bottom: 180px;
|
margin-bottom: 180px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -471,7 +471,7 @@ limitations under the License. -->
|
|||||||
.dashboard-list {
|
.dashboard-list {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
overflow: hidden;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-with-search {
|
.input-with-search {
|
||||||
|
@ -309,7 +309,7 @@ export const CalculationOpts = [
|
|||||||
value: "convertMilliseconds",
|
value: "convertMilliseconds",
|
||||||
},
|
},
|
||||||
{ label: "Seconds to YYYY-MM-DD HH:mm:ss", value: "convertSeconds" },
|
{ label: "Seconds to YYYY-MM-DD HH:mm:ss", value: "convertSeconds" },
|
||||||
{ label: "Precision is 2", value: "precision" },
|
{ label: "CPM5D", value: "cpm5d" },
|
||||||
{ label: "Milliseconds to seconds", value: "msTos" },
|
{ label: "Milliseconds to seconds", value: "msTos" },
|
||||||
{ label: "Seconds to days", value: "secondToDay" },
|
{ label: "Seconds to days", value: "secondToDay" },
|
||||||
{ label: "Nanoseconds to milliseconds", value: "nanosecondToMillisecond" },
|
{ label: "Nanoseconds to milliseconds", value: "nanosecondToMillisecond" },
|
||||||
|
@ -22,7 +22,7 @@ limitations under the License. -->
|
|||||||
justifyContent: config.textAlign || 'center',
|
justifyContent: config.textAlign || 'center',
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
{{ singleVal.toFixed(2) }}
|
{{ singleVal }}
|
||||||
<span class="unit" v-show="config.showUnit && unit">
|
<span class="unit" v-show="config.showUnit && unit">
|
||||||
{{ decodeURIComponent(unit) }}
|
{{ decodeURIComponent(unit) }}
|
||||||
</span>
|
</span>
|
||||||
@ -38,7 +38,7 @@ limitations under the License. -->
|
|||||||
/*global defineProps */
|
/*global defineProps */
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
data: {
|
data: {
|
||||||
type: Object as PropType<{ [key: string]: number }>,
|
type: Object as PropType<{ [key: string]: any }>,
|
||||||
default: () => ({}),
|
default: () => ({}),
|
||||||
},
|
},
|
||||||
config: {
|
config: {
|
||||||
@ -54,7 +54,9 @@ limitations under the License. -->
|
|||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const metricConfig = computed(() => props.config.metricConfig || []);
|
const metricConfig = computed(() => props.config.metricConfig || []);
|
||||||
const key = computed(() => Object.keys(props.data)[0]);
|
const key = computed(() => Object.keys(props.data)[0]);
|
||||||
const singleVal = computed(() => Number(props.data[key.value]));
|
const singleVal = computed(() =>
|
||||||
|
Array.isArray(props.data[key.value]) ? props.data[key.value][0] : props.data[key.value],
|
||||||
|
);
|
||||||
const unit = computed(() => metricConfig.value[0] && encodeURIComponent(metricConfig.value[0].unit || ""));
|
const unit = computed(() => metricConfig.value[0] && encodeURIComponent(metricConfig.value[0].unit || ""));
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
Loading…
Reference in New Issue
Block a user