Skip to content

Commit dc8d4b4

Browse files
authored
fix prometheus dashboard values for luxon migration (#2564)
1 parent 35ab508 commit dc8d4b4

File tree

8 files changed

+32
-24
lines changed

8 files changed

+32
-24
lines changed

portal-ui/src/screens/Console/Dashboard/Prometheus/Widgets/BarChartWidget.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ const BarChartWidget = ({
116116
if (loading) {
117117
let stepCalc = 0;
118118
if (timeStart !== null && timeEnd !== null) {
119-
const secondsInPeriod = timeEnd.unix() - timeStart.unix();
119+
const secondsInPeriod =
120+
timeEnd.toUnixInteger() - timeStart.toUnixInteger();
120121
const periods = Math.floor(secondsInPeriod / 60);
121122

122123
stepCalc = periods < 1 ? 15 : periods;
@@ -128,9 +129,9 @@ const BarChartWidget = ({
128129
`/api/v1/${apiPrefix}/info/widgets/${
129130
panelItem.id
130131
}/?step=${stepCalc}&${
131-
timeStart !== null ? `&start=${timeStart.unix()}` : ""
132+
timeStart !== null ? `&start=${timeStart.toUnixInteger()}` : ""
132133
}${timeStart !== null && timeEnd !== null ? "&" : ""}${
133-
timeEnd !== null ? `end=${timeEnd.unix()}` : ""
134+
timeEnd !== null ? `end=${timeEnd.toUnixInteger()}` : ""
134135
}`
135136
)
136137
.then((res: any) => {

portal-ui/src/screens/Console/Dashboard/Prometheus/Widgets/CapacityItem.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ const CapacityItem = ({
6565
if (loading) {
6666
let stepCalc = 0;
6767
if (timeStart !== null && timeEnd !== null) {
68-
const secondsInPeriod = timeEnd.unix() - timeStart.unix();
68+
const secondsInPeriod =
69+
timeEnd.toUnixInteger() - timeStart.toUnixInteger();
6970
const periods = Math.floor(secondsInPeriod / 60);
7071

7172
stepCalc = periods < 1 ? 15 : periods;
@@ -75,9 +76,9 @@ const CapacityItem = ({
7576
.invoke(
7677
"GET",
7778
`/api/v1/${apiPrefix}/info/widgets/${value.id}/?step=${stepCalc}&${
78-
timeStart !== null ? `&start=${timeStart.unix()}` : ""
79+
timeStart !== null ? `&start=${timeStart.toUnixInteger()}` : ""
7980
}${timeStart !== null && timeEnd !== null ? "&" : ""}${
80-
timeEnd !== null ? `end=${timeEnd.unix()}` : ""
81+
timeEnd !== null ? `end=${timeEnd.toUnixInteger()}` : ""
8182
}`
8283
)
8384
.then((res: any) => {

portal-ui/src/screens/Console/Dashboard/Prometheus/Widgets/EntityStateStatItem.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ const EntityStateStatItem = ({
5656
if (loading) {
5757
let stepCalc = 0;
5858
if (timeStart !== null && timeEnd !== null) {
59-
const secondsInPeriod = timeEnd.unix() - timeStart.unix();
59+
const secondsInPeriod =
60+
timeEnd.toUnixInteger() - timeStart.toUnixInteger();
6061
const periods = Math.floor(secondsInPeriod / 60);
6162

6263
stepCalc = periods < 1 ? 15 : periods;
@@ -68,9 +69,9 @@ const EntityStateStatItem = ({
6869
`/api/v1/${apiPrefix}/info/widgets/${
6970
panelItem.id
7071
}/?step=${stepCalc}&${
71-
timeStart !== null ? `&start=${timeStart.unix()}` : ""
72+
timeStart !== null ? `&start=${timeStart.toUnixInteger()}` : ""
7273
}${timeStart !== null && timeEnd !== null ? "&" : ""}${
73-
timeEnd !== null ? `end=${timeEnd.unix()}` : ""
74+
timeEnd !== null ? `end=${timeEnd.toUnixInteger()}` : ""
7475
}`
7576
)
7677
.then((res: any) => {

portal-ui/src/screens/Console/Dashboard/Prometheus/Widgets/LinearGraphWidget.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ const LinearGraphWidget = ({
127127
if (loading) {
128128
let stepCalc = 0;
129129
if (timeStart !== null && timeEnd !== null) {
130-
const secondsInPeriod = timeEnd.unix() - timeStart.unix();
130+
const secondsInPeriod =
131+
timeEnd.toUnixInteger() - timeStart.toUnixInteger();
131132
const periods = Math.floor(secondsInPeriod / 60);
132133

133134
stepCalc = periods < 1 ? 15 : periods;
@@ -139,9 +140,9 @@ const LinearGraphWidget = ({
139140
`/api/v1/${apiPrefix}/info/widgets/${
140141
panelItem.id
141142
}/?step=${stepCalc}&${
142-
timeStart !== null ? `&start=${timeStart.unix()}` : ""
143+
timeStart !== null ? `&start=${timeStart.toUnixInteger()}` : ""
143144
}${timeStart !== null && timeEnd !== null ? "&" : ""}${
144-
timeEnd !== null ? `end=${timeEnd.unix()}` : ""
145+
timeEnd !== null ? `end=${timeEnd.toUnixInteger()}` : ""
145146
}`
146147
)
147148
.then((res: any) => {

portal-ui/src/screens/Console/Dashboard/Prometheus/Widgets/PieChartWidget.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ const PieChartWidget = ({
9696
if (loading) {
9797
let stepCalc = 0;
9898
if (timeStart !== null && timeEnd !== null) {
99-
const secondsInPeriod = timeEnd.unix() - timeStart.unix();
99+
const secondsInPeriod =
100+
timeEnd.toUnixInteger() - timeStart.toUnixInteger();
100101
const periods = Math.floor(secondsInPeriod / 60);
101102

102103
stepCalc = periods < 1 ? 15 : periods;
@@ -108,9 +109,9 @@ const PieChartWidget = ({
108109
`/api/v1/${apiPrefix}/info/widgets/${
109110
panelItem.id
110111
}/?step=${stepCalc}&${
111-
timeStart !== null ? `&start=${timeStart.unix()}` : ""
112+
timeStart !== null ? `&start=${timeStart.toUnixInteger()}` : ""
112113
}${timeStart !== null && timeEnd !== null ? "&" : ""}${
113-
timeEnd !== null ? `end=${timeEnd.unix()}` : ""
114+
timeEnd !== null ? `end=${timeEnd.toUnixInteger()}` : ""
114115
}`
115116
)
116117
.then((res: any) => {

portal-ui/src/screens/Console/Dashboard/Prometheus/Widgets/SimpleWidget.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ const SimpleWidget = ({
9090
if (loading) {
9191
let stepCalc = 0;
9292
if (timeStart !== null && timeEnd !== null) {
93-
const secondsInPeriod = timeEnd.unix() - timeStart.unix();
93+
const secondsInPeriod =
94+
timeEnd.toUnixInteger() - timeStart.toUnixInteger();
9495
const periods = Math.floor(secondsInPeriod / 60);
9596

9697
stepCalc = periods < 1 ? 15 : periods;
@@ -102,9 +103,9 @@ const SimpleWidget = ({
102103
`/api/v1/${apiPrefix}/info/widgets/${
103104
panelItem.id
104105
}/?step=${stepCalc}&${
105-
timeStart !== null ? `&start=${timeStart.unix()}` : ""
106+
timeStart !== null ? `&start=${timeStart.toUnixInteger()}` : ""
106107
}${timeStart !== null && timeEnd !== null ? "&" : ""}${
107-
timeEnd !== null ? `end=${timeEnd.unix()}` : ""
108+
timeEnd !== null ? `end=${timeEnd.toUnixInteger()}` : ""
108109
}`
109110
)
110111
.then((res: any) => {

portal-ui/src/screens/Console/Dashboard/Prometheus/Widgets/SingleRepWidget.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ const SingleRepWidget = ({
6363
if (loading) {
6464
let stepCalc = 0;
6565
if (timeStart !== null && timeEnd !== null) {
66-
const secondsInPeriod = timeEnd.unix() - timeStart.unix();
66+
const secondsInPeriod =
67+
timeEnd.toUnixInteger() - timeStart.toUnixInteger();
6768
const periods = Math.floor(secondsInPeriod / 60);
6869

6970
stepCalc = periods < 1 ? 15 : periods;
@@ -75,9 +76,9 @@ const SingleRepWidget = ({
7576
`/api/v1/${apiPrefix}/info/widgets/${
7677
panelItem.id
7778
}/?step=${stepCalc}&${
78-
timeStart !== null ? `&start=${timeStart.unix()}` : ""
79+
timeStart !== null ? `&start=${timeStart.toUnixInteger()}` : ""
7980
}${timeStart !== null && timeEnd !== null ? "&" : ""}${
80-
timeEnd !== null ? `end=${timeEnd.unix()}` : ""
81+
timeEnd !== null ? `end=${timeEnd.toUnixInteger()}` : ""
8182
}`
8283
)
8384
.then((res: any) => {

portal-ui/src/screens/Console/Dashboard/Prometheus/Widgets/SingleValueWidget.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ const SingleValueWidget = ({
9696
if (loading) {
9797
let stepCalc = 0;
9898
if (timeStart !== null && timeEnd !== null) {
99-
const secondsInPeriod = timeEnd.unix() - timeStart.unix();
99+
const secondsInPeriod =
100+
timeEnd.toUnixInteger() - timeStart.toUnixInteger();
100101
const periods = Math.floor(secondsInPeriod / 60);
101102

102103
stepCalc = periods < 1 ? 15 : periods;
@@ -108,9 +109,9 @@ const SingleValueWidget = ({
108109
`/api/v1/${apiPrefix}/info/widgets/${
109110
panelItem.id
110111
}/?step=${stepCalc}&${
111-
timeStart !== null ? `&start=${timeStart.unix()}` : ""
112+
timeStart !== null ? `&start=${timeStart.toUnixInteger()}` : ""
112113
}${timeStart !== null && timeEnd !== null ? "&" : ""}${
113-
timeEnd !== null ? `end=${timeEnd.unix()}` : ""
114+
timeEnd !== null ? `end=${timeEnd.toUnixInteger()}` : ""
114115
}`
115116
)
116117
.then((res: any) => {

0 commit comments

Comments
 (0)