= ({
{displayTitle && (
diff --git a/app/vmui/packages/vmui/src/pages/TracePage/JsonForm/style.scss b/app/vmui/packages/vmui/src/pages/TracePage/JsonForm/style.scss
index d57235e7d..acaaf9395 100644
--- a/app/vmui/packages/vmui/src/pages/TracePage/JsonForm/style.scss
+++ b/app/vmui/packages/vmui/src/pages/TracePage/JsonForm/style.scss
@@ -2,15 +2,21 @@
.vm-json-form {
display: grid;
- grid-template-rows: auto calc(70vh - 78px - ($padding-medium*3)) auto;
+ grid-template-rows: auto calc(($vh * 70) - 78px - ($padding-medium*3)) auto;
gap: $padding-global;
width: 70vw;
max-width: 1000px;
max-height: 900px;
overflow: hidden;
+ &_mobile {
+ width: 100%;
+ min-height: 100%;
+ grid-template-rows: auto 1fr auto;
+ }
+
&_one-field {
- grid-template-rows: calc(70vh - 78px - ($padding-medium*3)) auto;
+ grid-template-rows: calc(($vh * 70) - 78px - ($padding-medium*3)) auto;
}
.vm-text-field_textarea {
@@ -29,6 +35,14 @@
justify-content: space-between;
gap: $padding-small;
+ @media (max-width: 500px) {
+ flex-direction: column;
+
+ button {
+ flex-grow: 1;
+ }
+ }
+
&__controls {
flex-grow: 1;
display: flex;
@@ -36,10 +50,22 @@
justify-content: flex-start;
gap: $padding-small;
+ @media (max-width: 500px) {
+ grid-template-columns: repeat(2, 1fr);
+ justify-content: center;
+ width: 100%;
+ }
+
&_right {
display: grid;
grid-template-columns: repeat(2, 90px);
justify-content: flex-end;
+
+ @media (max-width: 500px) {
+ grid-template-columns: repeat(2, 1fr);
+ justify-content: center;
+ width: 100%;
+ }
}
}
}
diff --git a/app/vmui/packages/vmui/src/pages/TracePage/style.scss b/app/vmui/packages/vmui/src/pages/TracePage/style.scss
index b871ae2c6..56e05b0c6 100644
--- a/app/vmui/packages/vmui/src/pages/TracePage/style.scss
+++ b/app/vmui/packages/vmui/src/pages/TracePage/style.scss
@@ -3,9 +3,12 @@
.vm-trace-page {
display: flex;
flex-direction: column;
- padding: $padding-global;
min-height: 100%;
+ @media (max-width: 768px) {
+ padding: $padding-medium 0;
+ }
+
&-controls {
display: grid;
grid-template-columns: 1fr 1fr;
@@ -21,6 +24,11 @@
gap: $padding-global;
margin-bottom: $padding-medium;
+ @media (max-width: 768px) {
+ grid-template-columns: 1fr;
+ padding: 0 $padding-medium;
+ }
+
&-errors {
display: grid;
align-items: flex-start;
@@ -28,6 +36,10 @@
grid-template-columns: 1fr;
gap: $padding-medium;
+ @media (max-width: 768px) {
+ grid-row: 2;
+ }
+
&-item {
position: relative;
display: grid;
diff --git a/app/vmui/packages/vmui/src/styles/components/table.scss b/app/vmui/packages/vmui/src/styles/components/table.scss
index c7e7e36f2..4f794baa8 100644
--- a/app/vmui/packages/vmui/src/styles/components/table.scss
+++ b/app/vmui/packages/vmui/src/styles/components/table.scss
@@ -16,9 +16,6 @@
}
&_header {
- position: sticky;
- top: 0;
- z-index: 2;
}
&_selected {
diff --git a/app/vmui/packages/vmui/src/styles/core.scss b/app/vmui/packages/vmui/src/styles/core.scss
index b262574c9..87d5eba7d 100644
--- a/app/vmui/packages/vmui/src/styles/core.scss
+++ b/app/vmui/packages/vmui/src/styles/core.scss
@@ -13,12 +13,13 @@ html, body, #root {
}
body {
- overflow: scroll;
+ overflow: auto;
}
* {
font: inherit;
cursor: inherit;
+ touch-action: pan-x pan-y;
}
code {
diff --git a/app/vmui/packages/vmui/src/styles/variables.scss b/app/vmui/packages/vmui/src/styles/variables.scss
index 4e889fb2d..67f5df6fd 100644
--- a/app/vmui/packages/vmui/src/styles/variables.scss
+++ b/app/vmui/packages/vmui/src/styles/variables.scss
@@ -61,3 +61,4 @@ $box-shadow: var(--box-shadow);
$box-shadow-popper: var(--box-shadow-popper);
$color-hover-black: var(--color-hover-black);
+$vh: var(--vh);
diff --git a/app/vmui/packages/vmui/src/utils/detect-device.ts b/app/vmui/packages/vmui/src/utils/detect-device.ts
new file mode 100644
index 000000000..d21c989e5
--- /dev/null
+++ b/app/vmui/packages/vmui/src/utils/detect-device.ts
@@ -0,0 +1,29 @@
+const desktopOs = {
+ windows: "Windows",
+ mac: "Mac OS",
+ linux: "Linux"
+};
+
+export const getOs = () => {
+ return Object.values(desktopOs).find(os => navigator.userAgent.indexOf(os) >= 0) || "unknown";
+};
+
+export const isMacOs = () => {
+ return getOs() === desktopOs.mac;
+};
+
+export const isMobileAgent = () => {
+ const mobileUserAgents = [
+ "Android",
+ "webOS",
+ "iPhone",
+ "iPad",
+ "iPod",
+ "BlackBerry",
+ "Windows Phone",
+ ];
+
+ // check for common mobile user agents
+ const matches = mobileUserAgents.map(m => navigator.userAgent.match(new RegExp(m, "i")));
+ return matches.some(m => m);
+};
diff --git a/app/vmui/packages/vmui/src/utils/detect-os.ts b/app/vmui/packages/vmui/src/utils/detect-os.ts
deleted file mode 100644
index ee0ca40d2..000000000
--- a/app/vmui/packages/vmui/src/utils/detect-os.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-const desktopOs = {
- windows: "Windows",
- mac: "Mac OS",
- linux: "Linux"
-};
-
-export const getOs = () : string => {
- return Object.values(desktopOs).find(os => navigator.userAgent.indexOf(os) >= 0) || "unknown";
-};
-
-export const isMacOs = (): boolean => {
- return getOs() === desktopOs.mac;
-};
\ No newline at end of file
diff --git a/app/vmui/packages/vmui/src/utils/time.ts b/app/vmui/packages/vmui/src/utils/time.ts
index 235080801..c2429f4ac 100644
--- a/app/vmui/packages/vmui/src/utils/time.ts
+++ b/app/vmui/packages/vmui/src/utils/time.ts
@@ -145,7 +145,10 @@ export const checkDurationLimit = (dur: string): string => {
return dur;
};
-export const dateFromSeconds = (epochTimeInSeconds: number): Date => dayjs(epochTimeInSeconds * 1000).toDate();
+export const dateFromSeconds = (epochTimeInSeconds: number): Date => {
+ const date = dayjs(epochTimeInSeconds * 1000);
+ return date.isValid() ? date.toDate() : new Date();
+};
const getYesterday = () => dayjs().tz().subtract(1, "day").endOf("day").toDate();
const getToday = () => dayjs().tz().endOf("day").toDate();
diff --git a/app/vmui/packages/vmui/src/utils/uplot/events.ts b/app/vmui/packages/vmui/src/utils/uplot/events.ts
index 22ae690e6..6410f701f 100644
--- a/app/vmui/packages/vmui/src/utils/uplot/events.ts
+++ b/app/vmui/packages/vmui/src/utils/uplot/events.ts
@@ -2,23 +2,33 @@ import { DragArgs } from "./types";
export const dragChart = ({ e, factor = 0.85, u, setPanning, setPlotScale }: DragArgs): void => {
e.preventDefault();
+ const isMouseEvent = e instanceof MouseEvent;
+
setPanning(true);
- const leftStart = e.clientX;
+ const leftStart = isMouseEvent ? e.clientX : e.touches[0].clientX;
const xUnitsPerPx = u.posToVal(1, "x") - u.posToVal(0, "x");
const scXMin = u.scales.x.min || 0;
const scXMax = u.scales.x.max || 0;
- const mouseMove = (e: MouseEvent) => {
+ const mouseMove = (e: MouseEvent | TouchEvent) => {
+ const isMouseEvent = e instanceof MouseEvent;
+ if (!isMouseEvent && e.touches.length > 1) return;
e.preventDefault();
- const dx = xUnitsPerPx * ((e.clientX - leftStart) * factor);
+
+ const clientX = isMouseEvent ? e.clientX : e.touches[0].clientX;
+ const dx = xUnitsPerPx * ((clientX - leftStart) * factor);
setPlotScale({ u, min: scXMin - dx, max: scXMax - dx });
};
const mouseUp = () => {
setPanning(false);
document.removeEventListener("mousemove", mouseMove);
document.removeEventListener("mouseup", mouseUp);
+ document.removeEventListener("touchmove", mouseMove);
+ document.removeEventListener("touchend", mouseUp);
};
document.addEventListener("mousemove", mouseMove);
document.addEventListener("mouseup", mouseUp);
+ document.addEventListener("touchmove", mouseMove);
+ document.addEventListener("touchend", mouseUp);
};
diff --git a/app/vmui/packages/vmui/src/utils/uplot/helpers.ts b/app/vmui/packages/vmui/src/utils/uplot/helpers.ts
index b095c86f7..9a2c363a3 100644
--- a/app/vmui/packages/vmui/src/utils/uplot/helpers.ts
+++ b/app/vmui/packages/vmui/src/utils/uplot/helpers.ts
@@ -79,7 +79,7 @@ export const sizeAxis = (u: uPlot, values: string[], axisIdx: number, cycleNum:
let axisSize = 6 + (axis?.ticks?.size || 0) + (axis.gap || 0);
const longestVal = (values ?? []).reduce((acc, val) => val.length > acc.length ? val : acc, "");
- if (longestVal != "") axisSize += getTextWidth(longestVal, u.ctx.font);
+ if (longestVal != "") axisSize += getTextWidth(longestVal, "10px Arial");
return Math.ceil(axisSize);
};
diff --git a/app/vmui/packages/vmui/src/utils/uplot/plugin.js b/app/vmui/packages/vmui/src/utils/uplot/plugin.js
index a2e23e970..ba7ba0616 100644
--- a/app/vmui/packages/vmui/src/utils/uplot/plugin.js
+++ b/app/vmui/packages/vmui/src/utils/uplot/plugin.js
@@ -1,6 +1,7 @@
/* eslint-disable */
import uPlot from "uplot";
import {getCssVariable} from "../theme";
+import {sizeAxis} from "./helpers";
export const seriesBarsPlugin = (opts) => {
let pxRatio;
@@ -262,7 +263,9 @@ export const seriesBarsPlugin = (opts) => {
},
values: u => u.data[0],
gap: 15,
- size: ori === 0 ? 40 : 150,
+ size: sizeAxis,
+ stroke: getCssVariable("color-text"),
+ font: "10px Arial",
labelSize: 20,
grid: {show: false},
ticks: {show: false},
diff --git a/app/vmui/packages/vmui/src/utils/uplot/types.ts b/app/vmui/packages/vmui/src/utils/uplot/types.ts
index e46850228..7da1135d3 100644
--- a/app/vmui/packages/vmui/src/utils/uplot/types.ts
+++ b/app/vmui/packages/vmui/src/utils/uplot/types.ts
@@ -8,7 +8,7 @@ export interface HideSeriesArgs {
}
export interface DragArgs {
- e: MouseEvent,
+ e: MouseEvent | TouchEvent,
u: uPlot,
factor: number,
setPanning: (enable: boolean) => void,