fix prometheus dashboard values for luxon migration (#2564)

This commit is contained in:
Prakash Senthil Vel
2023-01-10 23:52:45 +05:30
committed by GitHub
parent 35ab508109
commit dc8d4b4ca1
8 changed files with 32 additions and 24 deletions

View File

@@ -116,7 +116,8 @@ const BarChartWidget = ({
if (loading) {
let stepCalc = 0;
if (timeStart !== null && timeEnd !== null) {
const secondsInPeriod = timeEnd.unix() - timeStart.unix();
const secondsInPeriod =
timeEnd.toUnixInteger() - timeStart.toUnixInteger();
const periods = Math.floor(secondsInPeriod / 60);
stepCalc = periods < 1 ? 15 : periods;
@@ -128,9 +129,9 @@ const BarChartWidget = ({
`/api/v1/${apiPrefix}/info/widgets/${
panelItem.id
}/?step=${stepCalc}&${
timeStart !== null ? `&start=${timeStart.unix()}` : ""
timeStart !== null ? `&start=${timeStart.toUnixInteger()}` : ""
}${timeStart !== null && timeEnd !== null ? "&" : ""}${
timeEnd !== null ? `end=${timeEnd.unix()}` : ""
timeEnd !== null ? `end=${timeEnd.toUnixInteger()}` : ""
}`
)
.then((res: any) => {

View File

@@ -65,7 +65,8 @@ const CapacityItem = ({
if (loading) {
let stepCalc = 0;
if (timeStart !== null && timeEnd !== null) {
const secondsInPeriod = timeEnd.unix() - timeStart.unix();
const secondsInPeriod =
timeEnd.toUnixInteger() - timeStart.toUnixInteger();
const periods = Math.floor(secondsInPeriod / 60);
stepCalc = periods < 1 ? 15 : periods;
@@ -75,9 +76,9 @@ const CapacityItem = ({
.invoke(
"GET",
`/api/v1/${apiPrefix}/info/widgets/${value.id}/?step=${stepCalc}&${
timeStart !== null ? `&start=${timeStart.unix()}` : ""
timeStart !== null ? `&start=${timeStart.toUnixInteger()}` : ""
}${timeStart !== null && timeEnd !== null ? "&" : ""}${
timeEnd !== null ? `end=${timeEnd.unix()}` : ""
timeEnd !== null ? `end=${timeEnd.toUnixInteger()}` : ""
}`
)
.then((res: any) => {

View File

@@ -56,7 +56,8 @@ const EntityStateStatItem = ({
if (loading) {
let stepCalc = 0;
if (timeStart !== null && timeEnd !== null) {
const secondsInPeriod = timeEnd.unix() - timeStart.unix();
const secondsInPeriod =
timeEnd.toUnixInteger() - timeStart.toUnixInteger();
const periods = Math.floor(secondsInPeriod / 60);
stepCalc = periods < 1 ? 15 : periods;
@@ -68,9 +69,9 @@ const EntityStateStatItem = ({
`/api/v1/${apiPrefix}/info/widgets/${
panelItem.id
}/?step=${stepCalc}&${
timeStart !== null ? `&start=${timeStart.unix()}` : ""
timeStart !== null ? `&start=${timeStart.toUnixInteger()}` : ""
}${timeStart !== null && timeEnd !== null ? "&" : ""}${
timeEnd !== null ? `end=${timeEnd.unix()}` : ""
timeEnd !== null ? `end=${timeEnd.toUnixInteger()}` : ""
}`
)
.then((res: any) => {

View File

@@ -127,7 +127,8 @@ const LinearGraphWidget = ({
if (loading) {
let stepCalc = 0;
if (timeStart !== null && timeEnd !== null) {
const secondsInPeriod = timeEnd.unix() - timeStart.unix();
const secondsInPeriod =
timeEnd.toUnixInteger() - timeStart.toUnixInteger();
const periods = Math.floor(secondsInPeriod / 60);
stepCalc = periods < 1 ? 15 : periods;
@@ -139,9 +140,9 @@ const LinearGraphWidget = ({
`/api/v1/${apiPrefix}/info/widgets/${
panelItem.id
}/?step=${stepCalc}&${
timeStart !== null ? `&start=${timeStart.unix()}` : ""
timeStart !== null ? `&start=${timeStart.toUnixInteger()}` : ""
}${timeStart !== null && timeEnd !== null ? "&" : ""}${
timeEnd !== null ? `end=${timeEnd.unix()}` : ""
timeEnd !== null ? `end=${timeEnd.toUnixInteger()}` : ""
}`
)
.then((res: any) => {

View File

@@ -96,7 +96,8 @@ const PieChartWidget = ({
if (loading) {
let stepCalc = 0;
if (timeStart !== null && timeEnd !== null) {
const secondsInPeriod = timeEnd.unix() - timeStart.unix();
const secondsInPeriod =
timeEnd.toUnixInteger() - timeStart.toUnixInteger();
const periods = Math.floor(secondsInPeriod / 60);
stepCalc = periods < 1 ? 15 : periods;
@@ -108,9 +109,9 @@ const PieChartWidget = ({
`/api/v1/${apiPrefix}/info/widgets/${
panelItem.id
}/?step=${stepCalc}&${
timeStart !== null ? `&start=${timeStart.unix()}` : ""
timeStart !== null ? `&start=${timeStart.toUnixInteger()}` : ""
}${timeStart !== null && timeEnd !== null ? "&" : ""}${
timeEnd !== null ? `end=${timeEnd.unix()}` : ""
timeEnd !== null ? `end=${timeEnd.toUnixInteger()}` : ""
}`
)
.then((res: any) => {

View File

@@ -90,7 +90,8 @@ const SimpleWidget = ({
if (loading) {
let stepCalc = 0;
if (timeStart !== null && timeEnd !== null) {
const secondsInPeriod = timeEnd.unix() - timeStart.unix();
const secondsInPeriod =
timeEnd.toUnixInteger() - timeStart.toUnixInteger();
const periods = Math.floor(secondsInPeriod / 60);
stepCalc = periods < 1 ? 15 : periods;
@@ -102,9 +103,9 @@ const SimpleWidget = ({
`/api/v1/${apiPrefix}/info/widgets/${
panelItem.id
}/?step=${stepCalc}&${
timeStart !== null ? `&start=${timeStart.unix()}` : ""
timeStart !== null ? `&start=${timeStart.toUnixInteger()}` : ""
}${timeStart !== null && timeEnd !== null ? "&" : ""}${
timeEnd !== null ? `end=${timeEnd.unix()}` : ""
timeEnd !== null ? `end=${timeEnd.toUnixInteger()}` : ""
}`
)
.then((res: any) => {

View File

@@ -63,7 +63,8 @@ const SingleRepWidget = ({
if (loading) {
let stepCalc = 0;
if (timeStart !== null && timeEnd !== null) {
const secondsInPeriod = timeEnd.unix() - timeStart.unix();
const secondsInPeriod =
timeEnd.toUnixInteger() - timeStart.toUnixInteger();
const periods = Math.floor(secondsInPeriod / 60);
stepCalc = periods < 1 ? 15 : periods;
@@ -75,9 +76,9 @@ const SingleRepWidget = ({
`/api/v1/${apiPrefix}/info/widgets/${
panelItem.id
}/?step=${stepCalc}&${
timeStart !== null ? `&start=${timeStart.unix()}` : ""
timeStart !== null ? `&start=${timeStart.toUnixInteger()}` : ""
}${timeStart !== null && timeEnd !== null ? "&" : ""}${
timeEnd !== null ? `end=${timeEnd.unix()}` : ""
timeEnd !== null ? `end=${timeEnd.toUnixInteger()}` : ""
}`
)
.then((res: any) => {

View File

@@ -96,7 +96,8 @@ const SingleValueWidget = ({
if (loading) {
let stepCalc = 0;
if (timeStart !== null && timeEnd !== null) {
const secondsInPeriod = timeEnd.unix() - timeStart.unix();
const secondsInPeriod =
timeEnd.toUnixInteger() - timeStart.toUnixInteger();
const periods = Math.floor(secondsInPeriod / 60);
stepCalc = periods < 1 ? 15 : periods;
@@ -108,9 +109,9 @@ const SingleValueWidget = ({
`/api/v1/${apiPrefix}/info/widgets/${
panelItem.id
}/?step=${stepCalc}&${
timeStart !== null ? `&start=${timeStart.unix()}` : ""
timeStart !== null ? `&start=${timeStart.toUnixInteger()}` : ""
}${timeStart !== null && timeEnd !== null ? "&" : ""}${
timeEnd !== null ? `end=${timeEnd.unix()}` : ""
timeEnd !== null ? `end=${timeEnd.toUnixInteger()}` : ""
}`
)
.then((res: any) => {