@sentio/ui-dashboard 0.3.12 → 0.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +316 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +213 -84
- package/dist/index.d.ts +213 -84
- package/dist/index.js +1293 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1303 -2
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -30,6 +30,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
AddPanel: () => AddPanel,
|
|
34
|
+
AddPanelSlideover: () => AddPanelSlideover,
|
|
33
35
|
AggregateInput: () => AggregateInput,
|
|
34
36
|
AreaIcon: () => AreaIcon_default,
|
|
35
37
|
ArgumentInput: () => ArgumentInput,
|
|
@@ -41,7 +43,10 @@ __export(index_exports, {
|
|
|
41
43
|
ChartLegend: () => ChartLegend,
|
|
42
44
|
ChartTooltip: () => ChartTooltip,
|
|
43
45
|
ChartTypeButtonGroup: () => ChartTypeButtonGroup,
|
|
46
|
+
CodeBlockWithTitle: () => CodeBlockWithTitle,
|
|
47
|
+
CurlDialog: () => CurlDialog,
|
|
44
48
|
DEFAULT_HIGHLIGHT_KEY: () => DEFAULT_HIGHLIGHT_KEY,
|
|
49
|
+
DashboardButtonsMemo: () => DashboardButtonsMemo,
|
|
45
50
|
DashboardRefresh: () => DashboardRefresh,
|
|
46
51
|
DataControls: () => DataControls,
|
|
47
52
|
EditDashboardDialog: () => EditDashboardDialog,
|
|
@@ -49,7 +54,10 @@ __export(index_exports, {
|
|
|
49
54
|
ErrorChart: () => ErrorChart,
|
|
50
55
|
EventsFunctionCategories: () => EventsFunctionCategories,
|
|
51
56
|
EventsFunctionMap: () => EventsFunctionMap,
|
|
57
|
+
ExportChartMenu: () => ExportChartMenu,
|
|
52
58
|
ExportDashboardDialog: () => ExportDashboardDialog,
|
|
59
|
+
ExportType: () => ExportType,
|
|
60
|
+
ExtraSettingMenu: () => ExtraSettingMenu,
|
|
53
61
|
FunctionInput: () => FunctionInput,
|
|
54
62
|
FunctionMap: () => FunctionMap,
|
|
55
63
|
FunctionsCategories: () => FunctionsCategories,
|
|
@@ -62,6 +70,7 @@ __export(index_exports, {
|
|
|
62
70
|
LineControls: () => LineControls,
|
|
63
71
|
LineIcon: () => LineIcon_default,
|
|
64
72
|
MarkerControls: () => MarkerControls,
|
|
73
|
+
PanelOwner: () => PanelOwner,
|
|
65
74
|
PieChart: () => PieChart2,
|
|
66
75
|
PieChartControls: () => PieChartControls,
|
|
67
76
|
PieIcon: () => PieIcon_default,
|
|
@@ -69,6 +78,7 @@ __export(index_exports, {
|
|
|
69
78
|
QueryValueControls: () => QueryValueControls,
|
|
70
79
|
QueryValueIcon: () => QueryValueIcon_default,
|
|
71
80
|
ReactEChartsBase: () => ReactEChartsBase,
|
|
81
|
+
ReadonlyExtraSettingMenu: () => ReadonlyExtraSettingMenu,
|
|
72
82
|
RefreshButton: () => RefreshButton,
|
|
73
83
|
RefreshContext: () => RefreshContext,
|
|
74
84
|
ScatterChartTooltip: () => ScatterChartTooltip,
|
|
@@ -81,21 +91,33 @@ __export(index_exports, {
|
|
|
81
91
|
TableIcon: () => TableIcon_default,
|
|
82
92
|
TimeRangeOverride: () => TimeRangeOverride,
|
|
83
93
|
TimeSeriesChart: () => TimeSeriesChart,
|
|
94
|
+
UserInfo: () => UserInfo,
|
|
84
95
|
ValueControls: () => ValueControls,
|
|
85
96
|
ValueFormatters: () => ValueFormatters,
|
|
86
97
|
ValueOptions: () => ValueOptions,
|
|
87
98
|
ValueStringMapping: () => ValueStringMapping,
|
|
88
99
|
XAxisControls: () => XAxisControls,
|
|
89
100
|
YaxisControls: () => YaxisControls,
|
|
101
|
+
defaultAnalyticChart: () => defaultAnalyticChart,
|
|
90
102
|
defaultBarGaugeConfig: () => defaultConfig2,
|
|
91
103
|
defaultDataConfig: () => defaultConfig5,
|
|
104
|
+
defaultEventChart: () => defaultEventChart,
|
|
105
|
+
defaultGroupChart: () => defaultGroupChart,
|
|
106
|
+
defaultInsightChart: () => defaultInsightChart,
|
|
107
|
+
defaultMetricChart: () => defaultMetricChart,
|
|
108
|
+
defaultNoteChart: () => defaultNoteChart,
|
|
92
109
|
defaultPieConfig: () => defaultConfig,
|
|
93
110
|
defaultQueryValueConfig: () => defaultConfig9,
|
|
111
|
+
defaultRetentionChart: () => defaultRetentionChart,
|
|
94
112
|
defaultScatterConfig: () => defaultConfig6,
|
|
113
|
+
defaultSqlChart: () => defaultSqlChart,
|
|
95
114
|
defaultTableConfig: () => defaultConfig7,
|
|
96
115
|
defaultTimeRangeOverrideConfig: () => defaultConfig8,
|
|
97
116
|
defaultValueConfig: () => defaultConfig3,
|
|
98
117
|
defaultValueControlsConfig: () => defaultConfig4,
|
|
118
|
+
escapeBody: () => escapeBody,
|
|
119
|
+
generateCurlCode: () => generateCurlCode,
|
|
120
|
+
generateNodeCode: () => generateNodeCode,
|
|
99
121
|
getDefaultValueConfig: () => getDefaultValueConfig,
|
|
100
122
|
getHighlightHex: () => getHighlightHex,
|
|
101
123
|
isAggrOrRollupFunction: () => isAggrOrRollupFunction,
|
|
@@ -6683,8 +6705,8 @@ function aliasTemplate(alias, labels) {
|
|
|
6683
6705
|
function escapeColumnId(id) {
|
|
6684
6706
|
return id.replace(/[\W_.]+/g, "_");
|
|
6685
6707
|
}
|
|
6686
|
-
function getColumnNameId(labels, alias,
|
|
6687
|
-
const s = aliasTemplate(alias, labels) || (0, import_lodash12.startCase)(
|
|
6708
|
+
function getColumnNameId(labels, alias, displayName2) {
|
|
6709
|
+
const s = aliasTemplate(alias, labels) || (0, import_lodash12.startCase)(displayName2);
|
|
6688
6710
|
return { columnName: s, columnId: escapeColumnId(s) };
|
|
6689
6711
|
}
|
|
6690
6712
|
|
|
@@ -8027,8 +8049,1257 @@ function ExportDashboardDialog({
|
|
|
8027
8049
|
}
|
|
8028
8050
|
);
|
|
8029
8051
|
}
|
|
8052
|
+
|
|
8053
|
+
// src/dashboard/CurlDialog.tsx
|
|
8054
|
+
var import_react36 = require("react");
|
|
8055
|
+
var import_react37 = require("@headlessui/react");
|
|
8056
|
+
var import_ui_core39 = require("@sentio/ui-core");
|
|
8057
|
+
var import_tb = require("react-icons/tb");
|
|
8058
|
+
var import_lu13 = require("react-icons/lu");
|
|
8059
|
+
var import_omit = __toESM(require("lodash/omit"));
|
|
8060
|
+
|
|
8061
|
+
// src/common/CodeBlock.tsx
|
|
8062
|
+
var import_react34 = __toESM(require("@monaco-editor/react"));
|
|
8063
|
+
var import_react35 = require("react");
|
|
8064
|
+
var import_ui_core38 = require("@sentio/ui-core");
|
|
8065
|
+
var import_lu12 = require("react-icons/lu");
|
|
8066
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
8067
|
+
var LANGUAGE_MAP = {
|
|
8068
|
+
bash: "shell",
|
|
8069
|
+
jsx: "javascript",
|
|
8070
|
+
tsx: "typescript"
|
|
8071
|
+
};
|
|
8072
|
+
function toMonacoLanguage(lang) {
|
|
8073
|
+
return LANGUAGE_MAP[lang] ?? lang;
|
|
8074
|
+
}
|
|
8075
|
+
var BASE_OPTIONS = {
|
|
8076
|
+
readOnly: true,
|
|
8077
|
+
scrollBeyondLastLine: false,
|
|
8078
|
+
minimap: { enabled: false },
|
|
8079
|
+
renderLineHighlight: "none",
|
|
8080
|
+
folding: false
|
|
8081
|
+
};
|
|
8082
|
+
var CodeBlockWithTitle = ({
|
|
8083
|
+
title,
|
|
8084
|
+
icon,
|
|
8085
|
+
value,
|
|
8086
|
+
language,
|
|
8087
|
+
showLineNumbers,
|
|
8088
|
+
maxHeight = "300px",
|
|
8089
|
+
className,
|
|
8090
|
+
onBeforeMount
|
|
8091
|
+
}) => {
|
|
8092
|
+
const isDarkMode = (0, import_ui_core38.useDarkMode)();
|
|
8093
|
+
const [collapsed, setCollapsed] = (0, import_react35.useState)(false);
|
|
8094
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
8095
|
+
"div",
|
|
8096
|
+
{
|
|
8097
|
+
className: (0, import_ui_core38.classNames)(
|
|
8098
|
+
"text-icontent border-main overflow-hidden rounded-lg border",
|
|
8099
|
+
className
|
|
8100
|
+
),
|
|
8101
|
+
children: [
|
|
8102
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
8103
|
+
"div",
|
|
8104
|
+
{
|
|
8105
|
+
className: "flex w-full cursor-pointer items-center justify-between border-b bg-gray-200 p-2",
|
|
8106
|
+
onClick: () => setCollapsed((c) => !c),
|
|
8107
|
+
children: [
|
|
8108
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { className: "text-ilabel text-text-foreground font-medium", children: [
|
|
8109
|
+
icon,
|
|
8110
|
+
title
|
|
8111
|
+
] }),
|
|
8112
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
8113
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_ui_core38.CopyButton, { text: value, size: 16 }) }),
|
|
8114
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
8115
|
+
import_lu12.LuChevronDown,
|
|
8116
|
+
{
|
|
8117
|
+
className: (0, import_ui_core38.classNames)(
|
|
8118
|
+
"text-text-foreground-secondary h-4 w-4 transition-transform duration-200",
|
|
8119
|
+
collapsed ? "-rotate-90" : ""
|
|
8120
|
+
)
|
|
8121
|
+
}
|
|
8122
|
+
)
|
|
8123
|
+
] })
|
|
8124
|
+
]
|
|
8125
|
+
}
|
|
8126
|
+
),
|
|
8127
|
+
!collapsed && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
8128
|
+
import_react34.default,
|
|
8129
|
+
{
|
|
8130
|
+
theme: isDarkMode ? "sentio-dark" : "sentio",
|
|
8131
|
+
language: toMonacoLanguage(language),
|
|
8132
|
+
value,
|
|
8133
|
+
height: maxHeight,
|
|
8134
|
+
beforeMount: onBeforeMount,
|
|
8135
|
+
options: {
|
|
8136
|
+
...BASE_OPTIONS,
|
|
8137
|
+
lineNumbers: showLineNumbers ? "on" : "off"
|
|
8138
|
+
}
|
|
8139
|
+
}
|
|
8140
|
+
)
|
|
8141
|
+
]
|
|
8142
|
+
}
|
|
8143
|
+
);
|
|
8144
|
+
};
|
|
8145
|
+
|
|
8146
|
+
// src/dashboard/code-utils.ts
|
|
8147
|
+
var import_isEmpty = __toESM(require("lodash/isEmpty"));
|
|
8148
|
+
function escapeBody(body) {
|
|
8149
|
+
if (typeof body !== "string") return body;
|
|
8150
|
+
return body.replace(/'/g, `'\\''`);
|
|
8151
|
+
}
|
|
8152
|
+
function generateNodeCode(url, data, headers, apiKey = "<API_KEY>", method = "POST", apiKeyPosition = "header") {
|
|
8153
|
+
if (apiKeyPosition === "header") {
|
|
8154
|
+
headers = headers ? { ...headers, "api-key": apiKey } : { "api-key": apiKey };
|
|
8155
|
+
} else {
|
|
8156
|
+
url = url.includes("?") ? `${url}&api-key=${apiKey}` : `${url}?api-key=${apiKey}`;
|
|
8157
|
+
}
|
|
8158
|
+
return `const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));
|
|
8159
|
+
|
|
8160
|
+
const url = '${url}';
|
|
8161
|
+
const data = ${JSON.stringify(data, null, 2)};
|
|
8162
|
+
const method = '${method}';
|
|
8163
|
+
${headers ? `const headers = ${JSON.stringify(headers, null, 2)};` : ""}
|
|
8164
|
+
|
|
8165
|
+
fetch(url, {
|
|
8166
|
+
method,
|
|
8167
|
+
headers: {
|
|
8168
|
+
'Content-Type': 'application/json',${headers ? "\n ...headers," : ""}
|
|
8169
|
+
},
|
|
8170
|
+
body: method === 'GET' ? undefined : JSON.stringify(data),
|
|
8171
|
+
})
|
|
8172
|
+
.then(response => {
|
|
8173
|
+
if (!response.ok) {
|
|
8174
|
+
throw new Error('Network response was not ok');
|
|
8175
|
+
}
|
|
8176
|
+
return response.json();
|
|
8177
|
+
})
|
|
8178
|
+
.then(data => {
|
|
8179
|
+
// Do something with the data
|
|
8180
|
+
console.log(data);
|
|
8181
|
+
})
|
|
8182
|
+
.catch(error => {
|
|
8183
|
+
// Handle the error
|
|
8184
|
+
console.error('Error:', error);
|
|
8185
|
+
});
|
|
8186
|
+
|
|
8187
|
+
`;
|
|
8188
|
+
}
|
|
8189
|
+
function generateCurlCode(url, data, headers, apiKey = "<API_KEY>", method = "POST", apiKeyPosition = "header") {
|
|
8190
|
+
if (apiKeyPosition === "header") {
|
|
8191
|
+
headers = headers ? { ...headers, "api-key": apiKey } : { "api-key": apiKey };
|
|
8192
|
+
} else {
|
|
8193
|
+
url = url.includes("?") ? `${url}&api-key=${apiKey}` : `${url}?api-key=${apiKey}`;
|
|
8194
|
+
}
|
|
8195
|
+
let curlCommand = `curl -L -X ${method} '${url}' \\
|
|
8196
|
+
-H 'Content-Type: application/json'`;
|
|
8197
|
+
if (headers && !(0, import_isEmpty.default)(headers)) {
|
|
8198
|
+
curlCommand += " \\\n" + Object.entries(headers).map(([key, value]) => ` -H '${key}: ${value}' \\`).join("\n");
|
|
8199
|
+
} else {
|
|
8200
|
+
curlCommand += ` \\`;
|
|
8201
|
+
}
|
|
8202
|
+
if (data) {
|
|
8203
|
+
curlCommand += `
|
|
8204
|
+
--data-raw '${escapeBody(JSON.stringify(data, null, 2))}'`;
|
|
8205
|
+
} else {
|
|
8206
|
+
curlCommand = curlCommand.slice(0, -1);
|
|
8207
|
+
}
|
|
8208
|
+
return curlCommand;
|
|
8209
|
+
}
|
|
8210
|
+
|
|
8211
|
+
// src/dashboard/CurlDialog.tsx
|
|
8212
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
8213
|
+
var ExportType = /* @__PURE__ */ ((ExportType2) => {
|
|
8214
|
+
ExportType2["CURL"] = "curl";
|
|
8215
|
+
ExportType2["NODE"] = "node";
|
|
8216
|
+
return ExportType2;
|
|
8217
|
+
})(ExportType || {});
|
|
8218
|
+
function CurlDialog({
|
|
8219
|
+
open,
|
|
8220
|
+
onClose,
|
|
8221
|
+
payload,
|
|
8222
|
+
apiHost = "",
|
|
8223
|
+
apiUrl,
|
|
8224
|
+
headers,
|
|
8225
|
+
defaultType = "curl" /* CURL */,
|
|
8226
|
+
noOmit,
|
|
8227
|
+
onBeforeMount
|
|
8228
|
+
}) {
|
|
8229
|
+
const data = noOmit ? payload : (0, import_omit.default)(payload, ["projectSlug", "projectOwner", "projectId"]);
|
|
8230
|
+
const [type, setType] = (0, import_react36.useState)(defaultType);
|
|
8231
|
+
const [curlContent, setCurlContent] = (0, import_react36.useState)("");
|
|
8232
|
+
const [curlContentWithApiKey, setCurlContentWithApiKey] = (0, import_react36.useState)("");
|
|
8233
|
+
const [nodeContent, setNodeContent] = (0, import_react36.useState)("");
|
|
8234
|
+
(0, import_react36.useEffect)(() => {
|
|
8235
|
+
let path = apiUrl || "";
|
|
8236
|
+
path = path.startsWith("/api/") ? path.substring(4) : path;
|
|
8237
|
+
const url = path.startsWith("/") ? `${apiHost}${path}` : path;
|
|
8238
|
+
setCurlContent(generateCurlCode(url, data, headers));
|
|
8239
|
+
setCurlContentWithApiKey(
|
|
8240
|
+
generateCurlCode(url, data, headers, void 0, void 0, "param")
|
|
8241
|
+
);
|
|
8242
|
+
setNodeContent(generateNodeCode(url, data, headers));
|
|
8243
|
+
}, [apiUrl, apiHost, data, headers]);
|
|
8244
|
+
(0, import_react36.useEffect)(() => {
|
|
8245
|
+
setType(defaultType);
|
|
8246
|
+
}, [defaultType]);
|
|
8247
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react37.Transition.Root, { show: open, as: import_react36.Fragment, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
8248
|
+
import_react37.Dialog,
|
|
8249
|
+
{
|
|
8250
|
+
as: "div",
|
|
8251
|
+
className: "text-icontent relative z-10",
|
|
8252
|
+
onClose,
|
|
8253
|
+
children: [
|
|
8254
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
8255
|
+
import_react37.Transition.Child,
|
|
8256
|
+
{
|
|
8257
|
+
as: import_react36.Fragment,
|
|
8258
|
+
enter: "ease-out duration-300",
|
|
8259
|
+
enterFrom: "opacity-0",
|
|
8260
|
+
enterTo: "opacity-100",
|
|
8261
|
+
leave: "ease-in duration-200",
|
|
8262
|
+
leaveFrom: "opacity-100",
|
|
8263
|
+
leaveTo: "opacity-0",
|
|
8264
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "fixed inset-0 bg-gray-200/40 transition-opacity dark:bg-gray-200/50" })
|
|
8265
|
+
}
|
|
8266
|
+
),
|
|
8267
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "fixed inset-0 z-10 overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
8268
|
+
import_react37.Transition.Child,
|
|
8269
|
+
{
|
|
8270
|
+
as: import_react36.Fragment,
|
|
8271
|
+
enter: "ease-out duration-300",
|
|
8272
|
+
enterFrom: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",
|
|
8273
|
+
enterTo: "opacity-100 translate-y-0 sm:scale-100",
|
|
8274
|
+
leave: "ease-in duration-200",
|
|
8275
|
+
leaveFrom: "opacity-100 translate-y-0 sm:scale-100",
|
|
8276
|
+
leaveTo: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",
|
|
8277
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_react37.Dialog.Panel, { className: "bg-default-bg relative transform overflow-hidden rounded-lg pb-4 pt-5 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-4xl", children: [
|
|
8278
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
8279
|
+
import_react37.Dialog.Title,
|
|
8280
|
+
{
|
|
8281
|
+
as: "h3",
|
|
8282
|
+
className: "text-text-foreground px-4 text-lg font-medium leading-6 sm:px-6",
|
|
8283
|
+
children: "Export As Code Snippet"
|
|
8284
|
+
}
|
|
8285
|
+
),
|
|
8286
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "my-2 space-y-4 border-t px-4 pt-4 sm:px-6", children: [
|
|
8287
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "text-icontent bg-primary-50 flex w-full flex-wrap items-center justify-between gap-y-1 rounded-md px-4 py-2 font-medium", children: [
|
|
8288
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("span", { children: [
|
|
8289
|
+
"Replace",
|
|
8290
|
+
" ",
|
|
8291
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("code", { className: "text-primary-600 dark:text-primary-800", children: "<API_KEY>" }),
|
|
8292
|
+
` `,
|
|
8293
|
+
"with your real API key."
|
|
8294
|
+
] }),
|
|
8295
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("a", { href: "/profile/apikeys", target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "border-primary-400 text-primary-600 dark:text-primary-800 dark:border-primary-600 hover:bg-primary-100 active:bg-primary-200 flex flex-row items-center justify-center gap-1 rounded-md border border-solid pb-[7px] pl-2.5 pr-2.5 pt-[7px]", children: [
|
|
8296
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "text-icontent text-left font-medium", children: "Create a new API Key" }),
|
|
8297
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_lu13.LuArrowRight, { className: "h-4 w-4" })
|
|
8298
|
+
] }) })
|
|
8299
|
+
] }),
|
|
8300
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
8301
|
+
import_ui_core39.NewButtonGroup,
|
|
8302
|
+
{
|
|
8303
|
+
value: type,
|
|
8304
|
+
onChange: setType,
|
|
8305
|
+
buttons: [
|
|
8306
|
+
{
|
|
8307
|
+
label: "Shell",
|
|
8308
|
+
value: "curl" /* CURL */,
|
|
8309
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_ui_core39.ShellIcon, { className: "mr-2 h-4 w-4" })
|
|
8310
|
+
},
|
|
8311
|
+
{
|
|
8312
|
+
label: "Node",
|
|
8313
|
+
value: "node" /* NODE */,
|
|
8314
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_tb.TbBrandNodejs, { className: "mr-2 h-4 w-4" })
|
|
8315
|
+
}
|
|
8316
|
+
]
|
|
8317
|
+
}
|
|
8318
|
+
) }),
|
|
8319
|
+
type === "curl" /* CURL */ && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
8320
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
8321
|
+
CodeBlockWithTitle,
|
|
8322
|
+
{
|
|
8323
|
+
value: curlContent,
|
|
8324
|
+
showLineNumbers: true,
|
|
8325
|
+
language: "bash",
|
|
8326
|
+
title: "Shell (Auth with Header)",
|
|
8327
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_tb.TbTerminal, { className: "mr-2 inline-block h-4 w-4" }),
|
|
8328
|
+
onBeforeMount
|
|
8329
|
+
}
|
|
8330
|
+
),
|
|
8331
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
8332
|
+
CodeBlockWithTitle,
|
|
8333
|
+
{
|
|
8334
|
+
value: curlContentWithApiKey,
|
|
8335
|
+
showLineNumbers: true,
|
|
8336
|
+
language: "bash",
|
|
8337
|
+
title: "Shell (Auth with Query Param)",
|
|
8338
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_tb.TbTerminal, { className: "mr-2 inline-block h-4 w-4" }),
|
|
8339
|
+
onBeforeMount
|
|
8340
|
+
}
|
|
8341
|
+
)
|
|
8342
|
+
] }),
|
|
8343
|
+
type === "node" /* NODE */ && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
8344
|
+
CodeBlockWithTitle,
|
|
8345
|
+
{
|
|
8346
|
+
value: nodeContent,
|
|
8347
|
+
showLineNumbers: true,
|
|
8348
|
+
language: "typescript",
|
|
8349
|
+
title: "Nodejs",
|
|
8350
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_tb.TbBrandNodejs, { className: "mr-2 inline-block h-4 w-4" }),
|
|
8351
|
+
onBeforeMount
|
|
8352
|
+
}
|
|
8353
|
+
)
|
|
8354
|
+
] })
|
|
8355
|
+
] })
|
|
8356
|
+
}
|
|
8357
|
+
) }) })
|
|
8358
|
+
]
|
|
8359
|
+
}
|
|
8360
|
+
) });
|
|
8361
|
+
}
|
|
8362
|
+
|
|
8363
|
+
// src/dashboard/PanelOwner.tsx
|
|
8364
|
+
var import_ui_core41 = require("@sentio/ui-core");
|
|
8365
|
+
|
|
8366
|
+
// src/common/ImgWithFallback.tsx
|
|
8367
|
+
var import_react38 = require("react");
|
|
8368
|
+
var import_ui_core40 = require("@sentio/ui-core");
|
|
8369
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
8370
|
+
var TRANSPARENT_GIF = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==";
|
|
8371
|
+
var ImgWithFallback = ({
|
|
8372
|
+
src,
|
|
8373
|
+
fallback = TRANSPARENT_GIF,
|
|
8374
|
+
...props
|
|
8375
|
+
}) => {
|
|
8376
|
+
const [loadError, setLoadError] = (0, import_react38.useState)(false);
|
|
8377
|
+
(0, import_react38.useEffect)(() => {
|
|
8378
|
+
setLoadError(false);
|
|
8379
|
+
}, [src]);
|
|
8380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
8381
|
+
"img",
|
|
8382
|
+
{
|
|
8383
|
+
alt: "",
|
|
8384
|
+
"data-src": src,
|
|
8385
|
+
src: loadError ? fallback : src ?? fallback,
|
|
8386
|
+
...props,
|
|
8387
|
+
className: (0, import_ui_core40.classNames)(
|
|
8388
|
+
props.className,
|
|
8389
|
+
loadError && "bg-gray-200 dark:bg-gray-700"
|
|
8390
|
+
),
|
|
8391
|
+
onError: () => {
|
|
8392
|
+
setLoadError(true);
|
|
8393
|
+
}
|
|
8394
|
+
}
|
|
8395
|
+
);
|
|
8396
|
+
};
|
|
8397
|
+
|
|
8398
|
+
// src/dashboard/PanelOwner.tsx
|
|
8399
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
8400
|
+
var USER_CONTAINER_CLASSES = "inline-flex items-center gap-1 px-1 text-xs cursor-pointer";
|
|
8401
|
+
var AVATAR_CLASSES = "h-3 w-3 rounded-full";
|
|
8402
|
+
var TOOLTIP_CLASSES = "flex items-center gap-2";
|
|
8403
|
+
var LABEL_CLASSES = "text-xs font-semibold text-text-foreground-secondary";
|
|
8404
|
+
function displayName(user) {
|
|
8405
|
+
return user.firstName && user.lastName ? `${user.firstName} ${user.lastName}` : user.username;
|
|
8406
|
+
}
|
|
8407
|
+
var UserInfo = ({
|
|
8408
|
+
avatarSrc,
|
|
8409
|
+
avatarAlt,
|
|
8410
|
+
username,
|
|
8411
|
+
containerClassName = USER_CONTAINER_CLASSES
|
|
8412
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: containerClassName, children: [
|
|
8413
|
+
avatarSrc && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
8414
|
+
ImgWithFallback,
|
|
8415
|
+
{
|
|
8416
|
+
className: AVATAR_CLASSES,
|
|
8417
|
+
src: avatarSrc,
|
|
8418
|
+
alt: avatarAlt || username || ""
|
|
8419
|
+
}
|
|
8420
|
+
),
|
|
8421
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "max-w-[120px] truncate", children: username })
|
|
8422
|
+
] });
|
|
8423
|
+
var TooltipUserDisplay = ({
|
|
8424
|
+
user,
|
|
8425
|
+
label,
|
|
8426
|
+
onNavigateToUser
|
|
8427
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col gap-1 p-1", children: [
|
|
8428
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: LABEL_CLASSES, children: label }),
|
|
8429
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: TOOLTIP_CLASSES, children: [
|
|
8430
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
8431
|
+
ImgWithFallback,
|
|
8432
|
+
{
|
|
8433
|
+
className: "h-4 w-4 rounded-full",
|
|
8434
|
+
src: user.picture,
|
|
8435
|
+
alt: user.username
|
|
8436
|
+
}
|
|
8437
|
+
),
|
|
8438
|
+
onNavigateToUser && user.username ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
8439
|
+
"a",
|
|
8440
|
+
{
|
|
8441
|
+
className: "text-xs font-medium hover:underline",
|
|
8442
|
+
href: `/user/${user.username}`,
|
|
8443
|
+
onClick: (e) => {
|
|
8444
|
+
e.preventDefault();
|
|
8445
|
+
onNavigateToUser(user.username);
|
|
8446
|
+
},
|
|
8447
|
+
children: displayName(user)
|
|
8448
|
+
}
|
|
8449
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "text-xs font-medium", children: displayName(user) })
|
|
8450
|
+
] })
|
|
8451
|
+
] });
|
|
8452
|
+
var UserWithTooltip = ({
|
|
8453
|
+
mainUser,
|
|
8454
|
+
tooltipUser,
|
|
8455
|
+
tooltipLabel,
|
|
8456
|
+
onNavigateToUser
|
|
8457
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
8458
|
+
import_ui_core41.PopoverTooltip,
|
|
8459
|
+
{
|
|
8460
|
+
text: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
8461
|
+
TooltipUserDisplay,
|
|
8462
|
+
{
|
|
8463
|
+
user: tooltipUser,
|
|
8464
|
+
label: tooltipLabel,
|
|
8465
|
+
onNavigateToUser
|
|
8466
|
+
}
|
|
8467
|
+
),
|
|
8468
|
+
maxWidth: "max-w-[240px]",
|
|
8469
|
+
offsetOptions: 10,
|
|
8470
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
8471
|
+
UserInfo,
|
|
8472
|
+
{
|
|
8473
|
+
avatarSrc: mainUser.picture,
|
|
8474
|
+
avatarAlt: mainUser.username,
|
|
8475
|
+
username: mainUser.username
|
|
8476
|
+
}
|
|
8477
|
+
)
|
|
8478
|
+
}
|
|
8479
|
+
);
|
|
8480
|
+
var UserWithBothTooltip = ({
|
|
8481
|
+
mainUser,
|
|
8482
|
+
creator,
|
|
8483
|
+
updater,
|
|
8484
|
+
onNavigateToUser
|
|
8485
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
8486
|
+
import_ui_core41.PopoverTooltip,
|
|
8487
|
+
{
|
|
8488
|
+
text: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "space-y-3 p-1", children: [
|
|
8489
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
8490
|
+
TooltipUserDisplay,
|
|
8491
|
+
{
|
|
8492
|
+
user: creator,
|
|
8493
|
+
label: "Created by",
|
|
8494
|
+
onNavigateToUser
|
|
8495
|
+
}
|
|
8496
|
+
),
|
|
8497
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
8498
|
+
TooltipUserDisplay,
|
|
8499
|
+
{
|
|
8500
|
+
user: updater,
|
|
8501
|
+
label: "Last updated by",
|
|
8502
|
+
onNavigateToUser
|
|
8503
|
+
}
|
|
8504
|
+
)
|
|
8505
|
+
] }),
|
|
8506
|
+
maxWidth: "max-w-[280px]",
|
|
8507
|
+
offsetOptions: 10,
|
|
8508
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
8509
|
+
UserInfo,
|
|
8510
|
+
{
|
|
8511
|
+
avatarSrc: mainUser.picture,
|
|
8512
|
+
avatarAlt: mainUser.username,
|
|
8513
|
+
username: mainUser.username
|
|
8514
|
+
}
|
|
8515
|
+
)
|
|
8516
|
+
}
|
|
8517
|
+
);
|
|
8518
|
+
var PanelOwner = ({
|
|
8519
|
+
creator,
|
|
8520
|
+
updater,
|
|
8521
|
+
ownerName,
|
|
8522
|
+
ownerAvatarUrl,
|
|
8523
|
+
onNavigateToUser
|
|
8524
|
+
}) => {
|
|
8525
|
+
if (!creator && !updater) {
|
|
8526
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
8527
|
+
UserInfo,
|
|
8528
|
+
{
|
|
8529
|
+
avatarSrc: ownerAvatarUrl,
|
|
8530
|
+
avatarAlt: ownerName,
|
|
8531
|
+
username: ownerName
|
|
8532
|
+
}
|
|
8533
|
+
);
|
|
8534
|
+
}
|
|
8535
|
+
if (creator && updater) {
|
|
8536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
8537
|
+
UserWithBothTooltip,
|
|
8538
|
+
{
|
|
8539
|
+
mainUser: updater,
|
|
8540
|
+
creator,
|
|
8541
|
+
updater,
|
|
8542
|
+
onNavigateToUser
|
|
8543
|
+
}
|
|
8544
|
+
);
|
|
8545
|
+
}
|
|
8546
|
+
if (creator) {
|
|
8547
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
8548
|
+
UserWithTooltip,
|
|
8549
|
+
{
|
|
8550
|
+
mainUser: creator,
|
|
8551
|
+
tooltipUser: creator,
|
|
8552
|
+
tooltipLabel: "Created by",
|
|
8553
|
+
onNavigateToUser
|
|
8554
|
+
}
|
|
8555
|
+
);
|
|
8556
|
+
}
|
|
8557
|
+
if (updater) {
|
|
8558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
8559
|
+
UserWithTooltip,
|
|
8560
|
+
{
|
|
8561
|
+
mainUser: updater,
|
|
8562
|
+
tooltipUser: updater,
|
|
8563
|
+
tooltipLabel: "Last updated by",
|
|
8564
|
+
onNavigateToUser
|
|
8565
|
+
}
|
|
8566
|
+
);
|
|
8567
|
+
}
|
|
8568
|
+
return null;
|
|
8569
|
+
};
|
|
8570
|
+
|
|
8571
|
+
// src/dashboard/AddPanel.tsx
|
|
8572
|
+
var import_react40 = require("react");
|
|
8573
|
+
var import_ui_core43 = require("@sentio/ui-core");
|
|
8574
|
+
var import_lu14 = require("react-icons/lu");
|
|
8575
|
+
|
|
8576
|
+
// src/dashboard/AddPanelSlideover.tsx
|
|
8577
|
+
var import_react39 = require("react");
|
|
8578
|
+
var import_ui_core42 = require("@sentio/ui-core");
|
|
8579
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
8580
|
+
var PanelCard = ({
|
|
8581
|
+
icon,
|
|
8582
|
+
label,
|
|
8583
|
+
onClick,
|
|
8584
|
+
dataType
|
|
8585
|
+
}) => {
|
|
8586
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
8587
|
+
"div",
|
|
8588
|
+
{
|
|
8589
|
+
onClick: (e) => onClick?.(e),
|
|
8590
|
+
className: "group cursor-pointer space-y-2",
|
|
8591
|
+
"data-type": dataType,
|
|
8592
|
+
children: [
|
|
8593
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "group-hover:bg-hover rounded-md p-4 transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "mx-auto grid h-14 w-14 items-center justify-center", children: icon }) }),
|
|
8594
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "group-hover:text-text-foreground text-text-foreground-secondary w-full text-center text-xs group-hover:font-medium", children: label })
|
|
8595
|
+
]
|
|
8596
|
+
}
|
|
8597
|
+
);
|
|
8598
|
+
};
|
|
8599
|
+
var AnotationsPanels = [
|
|
8600
|
+
{
|
|
8601
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_ui_core42.NoteIcon, {}),
|
|
8602
|
+
label: "Note",
|
|
8603
|
+
type: "annotations.note"
|
|
8604
|
+
}
|
|
8605
|
+
];
|
|
8606
|
+
var InsightsPanels = [
|
|
8607
|
+
{
|
|
8608
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_ui_core42.LinesIcon, {}),
|
|
8609
|
+
label: "Lines",
|
|
8610
|
+
type: "insights.line",
|
|
8611
|
+
chartType: "LINE"
|
|
8612
|
+
},
|
|
8613
|
+
{ icon: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_ui_core42.BarsIcon, {}), label: "Bars", type: "insights.bar", chartType: "BAR" },
|
|
8614
|
+
{
|
|
8615
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_ui_core42.AreasIcon, {}),
|
|
8616
|
+
label: "Areas",
|
|
8617
|
+
type: "insights.area",
|
|
8618
|
+
chartType: "AREA"
|
|
8619
|
+
},
|
|
8620
|
+
{
|
|
8621
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_ui_core42.GaugeIcon, {}),
|
|
8622
|
+
label: "Bar Gauge",
|
|
8623
|
+
type: "insights.bargauge",
|
|
8624
|
+
chartType: "BAR_GAUGE"
|
|
8625
|
+
},
|
|
8626
|
+
{
|
|
8627
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_ui_core42.ScatterIcon, {}),
|
|
8628
|
+
label: "Scatter",
|
|
8629
|
+
type: "insights.scatter",
|
|
8630
|
+
chartType: "SCATTER"
|
|
8631
|
+
},
|
|
8632
|
+
{
|
|
8633
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_ui_core42.QueryValueIcon, {}),
|
|
8634
|
+
label: "Query Value",
|
|
8635
|
+
type: "insights.queryvalue",
|
|
8636
|
+
chartType: "QUERY_VALUE"
|
|
8637
|
+
},
|
|
8638
|
+
{
|
|
8639
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_ui_core42.TableIcon, {}),
|
|
8640
|
+
label: "Table",
|
|
8641
|
+
type: "insights.table",
|
|
8642
|
+
chartType: "TABLE"
|
|
8643
|
+
},
|
|
8644
|
+
{ icon: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_ui_core42.PieIcon, {}), label: "Pie", type: "insights.pie", chartType: "PIE" }
|
|
8645
|
+
];
|
|
8646
|
+
var EventsPanels = [
|
|
8647
|
+
{
|
|
8648
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_ui_core42.EventLogsIcon, {}),
|
|
8649
|
+
label: "Event Logs",
|
|
8650
|
+
type: "events.log"
|
|
8651
|
+
}
|
|
8652
|
+
];
|
|
8653
|
+
var SqlPanels = [
|
|
8654
|
+
{
|
|
8655
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_ui_core42.SQlIcon, {}),
|
|
8656
|
+
label: "SQL Chart",
|
|
8657
|
+
type: "sql.table",
|
|
8658
|
+
chartType: "TABLE"
|
|
8659
|
+
}
|
|
8660
|
+
];
|
|
8661
|
+
var ContainerPanels = [
|
|
8662
|
+
{
|
|
8663
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_ui_core42.GroupsIcon, {}),
|
|
8664
|
+
label: "Empty Group",
|
|
8665
|
+
type: "group.container"
|
|
8666
|
+
}
|
|
8667
|
+
];
|
|
8668
|
+
function defaultLinkGenerator(chartType, datasource, query) {
|
|
8669
|
+
const { owner, slug, id: dashboardId, ...restQuery } = query;
|
|
8670
|
+
const search = new URLSearchParams();
|
|
8671
|
+
for (const [key, value] of Object.entries(restQuery)) {
|
|
8672
|
+
if (Array.isArray(value)) {
|
|
8673
|
+
value.forEach((v) => search.append(key, v));
|
|
8674
|
+
} else if (value != null) {
|
|
8675
|
+
search.append(key, value);
|
|
8676
|
+
}
|
|
8677
|
+
}
|
|
8678
|
+
const qs = search.toString();
|
|
8679
|
+
const url = `/${owner}/${slug}/dashboards/${dashboardId}/panels/new`;
|
|
8680
|
+
return `${url}${qs ? `?${qs}` : ""}#tab=edit&chart_type=${chartType}&datasource=${datasource}`;
|
|
8681
|
+
}
|
|
8682
|
+
var AddPanelSlideover = ({
|
|
8683
|
+
open,
|
|
8684
|
+
onClose,
|
|
8685
|
+
onSelect,
|
|
8686
|
+
routerQuery = {},
|
|
8687
|
+
generateLinkHref = defaultLinkGenerator,
|
|
8688
|
+
allowImport
|
|
8689
|
+
}) => {
|
|
8690
|
+
const onClick = (0, import_react39.useCallback)(
|
|
8691
|
+
(evt) => {
|
|
8692
|
+
evt.stopPropagation();
|
|
8693
|
+
const target = evt.currentTarget;
|
|
8694
|
+
const type = target.getAttribute("data-type");
|
|
8695
|
+
if (type && onSelect) {
|
|
8696
|
+
onSelect(type);
|
|
8697
|
+
}
|
|
8698
|
+
},
|
|
8699
|
+
[onSelect]
|
|
8700
|
+
);
|
|
8701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_ui_core42.SlideOver, { open, onClose, title: "Add Panel", size: "xs", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "relative h-full w-full space-y-6 overflow-y-auto px-4 py-6", children: [
|
|
8702
|
+
allowImport && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { children: [
|
|
8703
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("h3", { className: "text-ilabel font-ilabel text-text-foreground-secondary mb-2", children: "Import & SQL" }),
|
|
8704
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "grid grid-cols-2 gap-x-2.5 gap-y-5", children: [
|
|
8705
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
8706
|
+
PanelCard,
|
|
8707
|
+
{
|
|
8708
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_ui_core42.ImportIcon, { className: "h-14 w-auto" }),
|
|
8709
|
+
dataType: "",
|
|
8710
|
+
label: "Import",
|
|
8711
|
+
onClick: (evt) => {
|
|
8712
|
+
evt.stopPropagation();
|
|
8713
|
+
onSelect?.("import");
|
|
8714
|
+
}
|
|
8715
|
+
}
|
|
8716
|
+
),
|
|
8717
|
+
SqlPanels.map(({ icon, label, type }, index) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
8718
|
+
"a",
|
|
8719
|
+
{
|
|
8720
|
+
href: generateLinkHref("TABLE", "SQL", routerQuery),
|
|
8721
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PanelCard, { icon, label, dataType: type })
|
|
8722
|
+
},
|
|
8723
|
+
index
|
|
8724
|
+
))
|
|
8725
|
+
] })
|
|
8726
|
+
] }),
|
|
8727
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { children: [
|
|
8728
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("h3", { className: "text-ilabel font-ilabel text-text-foreground-secondary mb-2", children: "Containers" }),
|
|
8729
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "grid grid-cols-2 gap-x-2.5 gap-y-5", children: ContainerPanels.map(({ icon, label, type }, index) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
8730
|
+
PanelCard,
|
|
8731
|
+
{
|
|
8732
|
+
icon,
|
|
8733
|
+
label,
|
|
8734
|
+
dataType: type,
|
|
8735
|
+
onClick
|
|
8736
|
+
},
|
|
8737
|
+
index
|
|
8738
|
+
)) })
|
|
8739
|
+
] }),
|
|
8740
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { children: [
|
|
8741
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("h3", { className: "text-ilabel font-ilabel text-text-foreground-secondary mb-2", children: "Insights" }),
|
|
8742
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "grid grid-cols-2 gap-x-2.5 gap-y-5", children: InsightsPanels.map(({ icon, label, type, chartType }, index) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
8743
|
+
"a",
|
|
8744
|
+
{
|
|
8745
|
+
href: generateLinkHref(chartType, "INSIGHTS", routerQuery),
|
|
8746
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PanelCard, { icon, label, dataType: type })
|
|
8747
|
+
},
|
|
8748
|
+
index
|
|
8749
|
+
)) })
|
|
8750
|
+
] }),
|
|
8751
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { children: [
|
|
8752
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("h3", { className: "text-ilabel font-ilabel text-text-foreground-secondary mb-2", children: "Anotations" }),
|
|
8753
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "grid grid-cols-2 gap-x-2.5 gap-y-5", children: AnotationsPanels.map(({ icon, label, type }, index) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
8754
|
+
PanelCard,
|
|
8755
|
+
{
|
|
8756
|
+
icon,
|
|
8757
|
+
label,
|
|
8758
|
+
dataType: type,
|
|
8759
|
+
onClick
|
|
8760
|
+
},
|
|
8761
|
+
index
|
|
8762
|
+
)) })
|
|
8763
|
+
] }),
|
|
8764
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { children: [
|
|
8765
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("h3", { className: "text-ilabel font-ilabel text-text-foreground-secondary mb-2", children: "Events" }),
|
|
8766
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "grid grid-cols-2 gap-x-2.5 gap-y-5", children: EventsPanels.map(({ icon, label, type }, index) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
8767
|
+
PanelCard,
|
|
8768
|
+
{
|
|
8769
|
+
icon,
|
|
8770
|
+
label,
|
|
8771
|
+
dataType: type,
|
|
8772
|
+
onClick
|
|
8773
|
+
},
|
|
8774
|
+
index
|
|
8775
|
+
)) })
|
|
8776
|
+
] }),
|
|
8777
|
+
!allowImport && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { children: [
|
|
8778
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("h3", { className: "text-ilabel font-ilabel text-text-foreground-secondary mb-2", children: "SQL" }),
|
|
8779
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "grid grid-cols-2 gap-x-2.5 gap-y-5", children: SqlPanels.map(({ icon, label, type }, index) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
8780
|
+
"a",
|
|
8781
|
+
{
|
|
8782
|
+
href: generateLinkHref("TABLE", "SQL", routerQuery),
|
|
8783
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PanelCard, { icon, label, dataType: type })
|
|
8784
|
+
},
|
|
8785
|
+
index
|
|
8786
|
+
)) })
|
|
8787
|
+
] })
|
|
8788
|
+
] }) });
|
|
8789
|
+
};
|
|
8790
|
+
|
|
8791
|
+
// src/dashboard/AddPanel.tsx
|
|
8792
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
8793
|
+
var defaultMetricChart = {
|
|
8794
|
+
type: "LINE",
|
|
8795
|
+
datasourceType: "METRICS"
|
|
8796
|
+
};
|
|
8797
|
+
var defaultNoteChart = {
|
|
8798
|
+
type: "NOTE",
|
|
8799
|
+
note: {
|
|
8800
|
+
content: ""
|
|
8801
|
+
},
|
|
8802
|
+
datasourceType: "NOTES"
|
|
8803
|
+
};
|
|
8804
|
+
var defaultAnalyticChart = {
|
|
8805
|
+
type: "LINE",
|
|
8806
|
+
datasourceType: "ANALYTICS",
|
|
8807
|
+
config: {
|
|
8808
|
+
timeRangeOverride: {
|
|
8809
|
+
timeRange: {
|
|
8810
|
+
interval: { unit: "d", value: 1 }
|
|
8811
|
+
}
|
|
8812
|
+
}
|
|
8813
|
+
}
|
|
8814
|
+
};
|
|
8815
|
+
var defaultInsightChart = {
|
|
8816
|
+
type: "LINE",
|
|
8817
|
+
datasourceType: "INSIGHTS",
|
|
8818
|
+
insightsQueries: [
|
|
8819
|
+
{
|
|
8820
|
+
dataSource: "METRICS",
|
|
8821
|
+
metricsQuery: {
|
|
8822
|
+
query: "",
|
|
8823
|
+
alias: "",
|
|
8824
|
+
id: "a"
|
|
8825
|
+
}
|
|
8826
|
+
}
|
|
8827
|
+
],
|
|
8828
|
+
config: {
|
|
8829
|
+
timeRangeOverride: {
|
|
8830
|
+
timeRange: {}
|
|
8831
|
+
}
|
|
8832
|
+
}
|
|
8833
|
+
};
|
|
8834
|
+
var defaultEventChart = {
|
|
8835
|
+
type: "TABLE",
|
|
8836
|
+
datasourceType: "EVENTS",
|
|
8837
|
+
eventLogsConfig: {
|
|
8838
|
+
columnsConfig: {},
|
|
8839
|
+
query: "",
|
|
8840
|
+
timeRangeOverride: {
|
|
8841
|
+
enabled: false
|
|
8842
|
+
}
|
|
8843
|
+
}
|
|
8844
|
+
};
|
|
8845
|
+
var defaultGroupChart = {
|
|
8846
|
+
type: "GROUP",
|
|
8847
|
+
datasourceType: "GROUP",
|
|
8848
|
+
group: {
|
|
8849
|
+
title: "New Group",
|
|
8850
|
+
collapsed: false
|
|
8851
|
+
}
|
|
8852
|
+
};
|
|
8853
|
+
var defaultRetentionChart = {
|
|
8854
|
+
type: "LINE",
|
|
8855
|
+
datasourceType: "RETENTION",
|
|
8856
|
+
config: {
|
|
8857
|
+
timeRangeOverride: {
|
|
8858
|
+
timeRange: {}
|
|
8859
|
+
}
|
|
8860
|
+
},
|
|
8861
|
+
retentionQuery: {
|
|
8862
|
+
resources: [
|
|
8863
|
+
{ eventNames: [], filter: { timeFilter: { type: "Disable" } } },
|
|
8864
|
+
{ eventNames: [], filter: { timeFilter: { type: "Disable" } } }
|
|
8865
|
+
],
|
|
8866
|
+
windowSize: 7,
|
|
8867
|
+
interval: { unit: "Day", value: 1 },
|
|
8868
|
+
groupBy: [],
|
|
8869
|
+
segmentBy: [],
|
|
8870
|
+
criteria: "On"
|
|
8871
|
+
}
|
|
8872
|
+
};
|
|
8873
|
+
var defaultSqlChart = {
|
|
8874
|
+
type: "TABLE",
|
|
8875
|
+
datasourceType: "SQL",
|
|
8876
|
+
sqlQuery: JSON.stringify({ sql: "", size: 100, version: "AUTO" })
|
|
8877
|
+
};
|
|
8878
|
+
var AddPanel = (0, import_react40.forwardRef)(function AddPanel2({ onNewPanel, onImportPanel, saving, routerQuery, generateLinkHref }, ref) {
|
|
8879
|
+
const [slideOverVisible, setSlideOverVisible] = (0, import_react40.useState)(false);
|
|
8880
|
+
const closeSlideOver = (0, import_react40.useCallback)(() => setSlideOverVisible(false), []);
|
|
8881
|
+
const openSlideOver = (0, import_react40.useCallback)(() => setSlideOverVisible(true), []);
|
|
8882
|
+
const onSelectNewPanel = (0, import_react40.useCallback)(
|
|
8883
|
+
(type) => {
|
|
8884
|
+
const [chartCategory, chartType] = type.split(".");
|
|
8885
|
+
let chart;
|
|
8886
|
+
switch (chartCategory) {
|
|
8887
|
+
case "import":
|
|
8888
|
+
onImportPanel();
|
|
8889
|
+
closeSlideOver();
|
|
8890
|
+
return;
|
|
8891
|
+
case "annotations":
|
|
8892
|
+
chart = { ...defaultNoteChart };
|
|
8893
|
+
break;
|
|
8894
|
+
case "group":
|
|
8895
|
+
closeSlideOver();
|
|
8896
|
+
onNewPanel({ ...defaultGroupChart });
|
|
8897
|
+
return;
|
|
8898
|
+
case "analytics":
|
|
8899
|
+
chart = { ...defaultAnalyticChart };
|
|
8900
|
+
break;
|
|
8901
|
+
case "insights":
|
|
8902
|
+
chart = { ...defaultInsightChart };
|
|
8903
|
+
break;
|
|
8904
|
+
case "events":
|
|
8905
|
+
chart = { ...defaultEventChart };
|
|
8906
|
+
break;
|
|
8907
|
+
case "retention":
|
|
8908
|
+
chart = { ...defaultRetentionChart };
|
|
8909
|
+
break;
|
|
8910
|
+
case "sql":
|
|
8911
|
+
chart = { ...defaultSqlChart };
|
|
8912
|
+
break;
|
|
8913
|
+
case "timeseries":
|
|
8914
|
+
default:
|
|
8915
|
+
chart = { ...defaultMetricChart };
|
|
8916
|
+
}
|
|
8917
|
+
switch (chartType) {
|
|
8918
|
+
case "line":
|
|
8919
|
+
chart.type = "LINE";
|
|
8920
|
+
break;
|
|
8921
|
+
case "bar":
|
|
8922
|
+
chart.type = "BAR";
|
|
8923
|
+
break;
|
|
8924
|
+
case "area":
|
|
8925
|
+
chart.type = "AREA";
|
|
8926
|
+
break;
|
|
8927
|
+
case "bargauge":
|
|
8928
|
+
chart.type = "BAR_GAUGE";
|
|
8929
|
+
break;
|
|
8930
|
+
case "queryvalue":
|
|
8931
|
+
chart.type = "QUERY_VALUE";
|
|
8932
|
+
break;
|
|
8933
|
+
case "table":
|
|
8934
|
+
chart.type = "TABLE";
|
|
8935
|
+
break;
|
|
8936
|
+
case "pie":
|
|
8937
|
+
chart.type = "PIE";
|
|
8938
|
+
break;
|
|
8939
|
+
case "note":
|
|
8940
|
+
chart.type = "NOTE";
|
|
8941
|
+
break;
|
|
8942
|
+
case "log":
|
|
8943
|
+
chart.type = "TABLE";
|
|
8944
|
+
break;
|
|
8945
|
+
default:
|
|
8946
|
+
chart = void 0;
|
|
8947
|
+
}
|
|
8948
|
+
if (chart) {
|
|
8949
|
+
closeSlideOver();
|
|
8950
|
+
onNewPanel(chart);
|
|
8951
|
+
}
|
|
8952
|
+
},
|
|
8953
|
+
[closeSlideOver, onNewPanel, onImportPanel]
|
|
8954
|
+
);
|
|
8955
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "inline-flex", children: [
|
|
8956
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
8957
|
+
import_ui_core43.Button,
|
|
8958
|
+
{
|
|
8959
|
+
ref,
|
|
8960
|
+
processing: saving,
|
|
8961
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_lu14.LuPlus, {}),
|
|
8962
|
+
role: "primary",
|
|
8963
|
+
onClick: openSlideOver,
|
|
8964
|
+
size: "md",
|
|
8965
|
+
children: "Add Panel"
|
|
8966
|
+
}
|
|
8967
|
+
),
|
|
8968
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
8969
|
+
AddPanelSlideover,
|
|
8970
|
+
{
|
|
8971
|
+
open: slideOverVisible,
|
|
8972
|
+
onClose: closeSlideOver,
|
|
8973
|
+
onSelect: onSelectNewPanel,
|
|
8974
|
+
routerQuery,
|
|
8975
|
+
generateLinkHref,
|
|
8976
|
+
allowImport: true
|
|
8977
|
+
}
|
|
8978
|
+
)
|
|
8979
|
+
] });
|
|
8980
|
+
});
|
|
8981
|
+
|
|
8982
|
+
// src/dashboard/DashboardButtons.tsx
|
|
8983
|
+
var import_react42 = require("react");
|
|
8984
|
+
var import_ui_core46 = require("@sentio/ui-core");
|
|
8985
|
+
|
|
8986
|
+
// src/dashboard/ExportChartMenu.tsx
|
|
8987
|
+
var import_react41 = require("react");
|
|
8988
|
+
var import_immer17 = require("immer");
|
|
8989
|
+
var import_ui_core44 = require("@sentio/ui-core");
|
|
8990
|
+
var import_ai = require("react-icons/ai");
|
|
8991
|
+
var import_lu15 = require("react-icons/lu");
|
|
8992
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
8993
|
+
var DefaultMenuItems = [
|
|
8994
|
+
[
|
|
8995
|
+
{
|
|
8996
|
+
label: "Take a snapshot",
|
|
8997
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lu15.LuCamera, { className: "mr-2 w-4" }),
|
|
8998
|
+
key: "snapshot"
|
|
8999
|
+
}
|
|
9000
|
+
],
|
|
9001
|
+
[
|
|
9002
|
+
{
|
|
9003
|
+
key: "png",
|
|
9004
|
+
label: "Export as PNG",
|
|
9005
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lu15.LuSquareArrowOutUpRight, { className: "mr-2 w-4" })
|
|
9006
|
+
},
|
|
9007
|
+
{
|
|
9008
|
+
key: "svg",
|
|
9009
|
+
label: "Export as SVG",
|
|
9010
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lu15.LuDownload, { className: "mr-2 w-4" })
|
|
9011
|
+
},
|
|
9012
|
+
{
|
|
9013
|
+
key: "csv",
|
|
9014
|
+
label: "Export as CSV",
|
|
9015
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lu15.LuDownload, { className: "mr-2 w-4" })
|
|
9016
|
+
}
|
|
9017
|
+
],
|
|
9018
|
+
[
|
|
9019
|
+
{
|
|
9020
|
+
label: "Export as API",
|
|
9021
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_ai.AiOutlineApi, { className: "mr-2 h-4 w-4" }),
|
|
9022
|
+
key: "curl"
|
|
9023
|
+
}
|
|
9024
|
+
]
|
|
9025
|
+
];
|
|
9026
|
+
function ExportChartMenu({
|
|
9027
|
+
allowEdit,
|
|
9028
|
+
onSelect,
|
|
9029
|
+
allowEmbed,
|
|
9030
|
+
canExportCurl,
|
|
9031
|
+
exportCurlHint
|
|
9032
|
+
}) {
|
|
9033
|
+
const menuItems2 = (0, import_react41.useMemo)(() => {
|
|
9034
|
+
return (0, import_immer17.produce)(DefaultMenuItems, (draft) => {
|
|
9035
|
+
draft[0][0].disabled = !allowEdit;
|
|
9036
|
+
const last = draft[draft.length - 1];
|
|
9037
|
+
last[0].disabled = !canExportCurl || !allowEdit;
|
|
9038
|
+
last[0].disabledHint = exportCurlHint;
|
|
9039
|
+
if (allowEmbed) {
|
|
9040
|
+
last.push({
|
|
9041
|
+
label: "Embed Iframe",
|
|
9042
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lu15.LuLink2, { className: "mr-2 h-4 w-4" }),
|
|
9043
|
+
key: "embed"
|
|
9044
|
+
});
|
|
9045
|
+
}
|
|
9046
|
+
});
|
|
9047
|
+
}, [allowEdit, canExportCurl, exportCurlHint, allowEmbed]);
|
|
9048
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
9049
|
+
import_ui_core44.PopupMenuButton,
|
|
9050
|
+
{
|
|
9051
|
+
items: menuItems2,
|
|
9052
|
+
onSelect,
|
|
9053
|
+
ariaLabel: "export",
|
|
9054
|
+
buttonIcon: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lu15.LuSquareArrowOutUpRight, { className: "w-4" }),
|
|
9055
|
+
buttonClassName: "cursor-pointer"
|
|
9056
|
+
}
|
|
9057
|
+
);
|
|
9058
|
+
}
|
|
9059
|
+
|
|
9060
|
+
// src/dashboard/ExtraSettingMenu.tsx
|
|
9061
|
+
var import_lu16 = require("react-icons/lu");
|
|
9062
|
+
var import_ui_core45 = require("@sentio/ui-core");
|
|
9063
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
9064
|
+
var menuItems = [
|
|
9065
|
+
[
|
|
9066
|
+
{
|
|
9067
|
+
label: "Clone",
|
|
9068
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_lu16.LuLayers2, { className: "mr-2 w-4" }),
|
|
9069
|
+
key: "clone"
|
|
9070
|
+
},
|
|
9071
|
+
{
|
|
9072
|
+
label: "Copy configuration",
|
|
9073
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_lu16.LuClipboard, { className: "mr-2 w-4" }),
|
|
9074
|
+
key: "copy"
|
|
9075
|
+
}
|
|
9076
|
+
],
|
|
9077
|
+
[
|
|
9078
|
+
{
|
|
9079
|
+
label: "Delete",
|
|
9080
|
+
key: "delete",
|
|
9081
|
+
status: "danger",
|
|
9082
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_lu16.LuTrash2, { className: "mr-2 w-4" })
|
|
9083
|
+
}
|
|
9084
|
+
]
|
|
9085
|
+
];
|
|
9086
|
+
function ExtraSettingMenu({ onSelect }) {
|
|
9087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
9088
|
+
import_ui_core45.PopupMenuButton,
|
|
9089
|
+
{
|
|
9090
|
+
items: menuItems,
|
|
9091
|
+
onSelect,
|
|
9092
|
+
ariaLabel: "settings",
|
|
9093
|
+
buttonIcon: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_lu16.LuSettings, { className: "w-4" }),
|
|
9094
|
+
buttonClassName: "cursor-pointer"
|
|
9095
|
+
}
|
|
9096
|
+
);
|
|
9097
|
+
}
|
|
9098
|
+
function ReadonlyExtraSettingMenu({ onSelect }) {
|
|
9099
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
9100
|
+
import_ui_core45.PopupMenuButton,
|
|
9101
|
+
{
|
|
9102
|
+
items: [
|
|
9103
|
+
[
|
|
9104
|
+
{
|
|
9105
|
+
label: "Copy configuration",
|
|
9106
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_lu16.LuClipboard, { className: "mr-2 w-4" }),
|
|
9107
|
+
key: "copy"
|
|
9108
|
+
}
|
|
9109
|
+
]
|
|
9110
|
+
],
|
|
9111
|
+
onSelect,
|
|
9112
|
+
ariaLabel: "settings",
|
|
9113
|
+
buttonIcon: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_lu16.LuSettings, { className: "w-4" }),
|
|
9114
|
+
buttonClassName: "cursor-pointer"
|
|
9115
|
+
}
|
|
9116
|
+
);
|
|
9117
|
+
}
|
|
9118
|
+
|
|
9119
|
+
// src/dashboard/DashboardButtons.tsx
|
|
9120
|
+
var import_ai2 = require("react-icons/ai");
|
|
9121
|
+
var import_lu17 = require("react-icons/lu");
|
|
9122
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
9123
|
+
var StaticButtons = {
|
|
9124
|
+
fullscreen: {
|
|
9125
|
+
label: "Full screen",
|
|
9126
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_lu17.LuExpand, { className: "mr-2 w-4" }),
|
|
9127
|
+
key: "fullscreen"
|
|
9128
|
+
},
|
|
9129
|
+
refresh: {
|
|
9130
|
+
label: "Refresh panel",
|
|
9131
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_lu17.LuRefreshCw, { className: "mr-2 w-4" }),
|
|
9132
|
+
key: "refresh"
|
|
9133
|
+
},
|
|
9134
|
+
edit: {
|
|
9135
|
+
label: "Edit panel",
|
|
9136
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_lu17.LuPencil, { className: "mr-2 w-4" }),
|
|
9137
|
+
key: "edit"
|
|
9138
|
+
},
|
|
9139
|
+
clone: {
|
|
9140
|
+
label: "Clone",
|
|
9141
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_lu17.LuLayers2, { className: "mr-2 w-4" }),
|
|
9142
|
+
key: "clone"
|
|
9143
|
+
},
|
|
9144
|
+
copy: {
|
|
9145
|
+
label: "Copy configuration",
|
|
9146
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_lu17.LuClipboard, { className: "mr-2 w-4" }),
|
|
9147
|
+
key: "copy"
|
|
9148
|
+
},
|
|
9149
|
+
delete: {
|
|
9150
|
+
label: "Delete",
|
|
9151
|
+
key: "delete",
|
|
9152
|
+
status: "danger",
|
|
9153
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_lu17.LuTrash2, { className: "mr-2 w-4" })
|
|
9154
|
+
}
|
|
9155
|
+
};
|
|
9156
|
+
var DashboardButtons = ({
|
|
9157
|
+
allowEdit,
|
|
9158
|
+
onMenuSelect,
|
|
9159
|
+
allowExport = true,
|
|
9160
|
+
allowFullScreen = true,
|
|
9161
|
+
allowViewPanel = true,
|
|
9162
|
+
allowEmbed = false,
|
|
9163
|
+
canExportCurl = false,
|
|
9164
|
+
exportCurlHint
|
|
9165
|
+
}) => {
|
|
9166
|
+
const menuRef = (0, import_react42.useRef)(null);
|
|
9167
|
+
const exportButton = allowExport ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
9168
|
+
ExportChartMenu,
|
|
9169
|
+
{
|
|
9170
|
+
allowEdit,
|
|
9171
|
+
onSelect: onMenuSelect,
|
|
9172
|
+
allowEmbed,
|
|
9173
|
+
canExportCurl,
|
|
9174
|
+
exportCurlHint
|
|
9175
|
+
}
|
|
9176
|
+
) : null;
|
|
9177
|
+
const fullScreenButton = allowFullScreen ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
9178
|
+
"button",
|
|
9179
|
+
{
|
|
9180
|
+
type: "button",
|
|
9181
|
+
className: "text-text-foreground-secondary hover:text-primary-600 w-6 px-1",
|
|
9182
|
+
"aria-label": "Full screen",
|
|
9183
|
+
onClick: () => {
|
|
9184
|
+
onMenuSelect("fullscreen");
|
|
9185
|
+
},
|
|
9186
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_lu17.LuExpand, {})
|
|
9187
|
+
}
|
|
9188
|
+
) : null;
|
|
9189
|
+
const items = (0, import_react42.useMemo)(() => {
|
|
9190
|
+
const ret = [];
|
|
9191
|
+
const curlItem = {
|
|
9192
|
+
label: "Export as API",
|
|
9193
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_ai2.AiOutlineApi, { className: "mr-2 h-4 w-4" }),
|
|
9194
|
+
key: "curl"
|
|
9195
|
+
};
|
|
9196
|
+
if (!canExportCurl) {
|
|
9197
|
+
curlItem.disabled = true;
|
|
9198
|
+
curlItem.disabledHint = exportCurlHint;
|
|
9199
|
+
}
|
|
9200
|
+
const lastGroup = [curlItem];
|
|
9201
|
+
if (allowEmbed) {
|
|
9202
|
+
lastGroup.push({
|
|
9203
|
+
label: "Embed Iframe",
|
|
9204
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_lu17.LuLink2, { className: "mr-2 h-4 w-4" }),
|
|
9205
|
+
key: "embed"
|
|
9206
|
+
});
|
|
9207
|
+
}
|
|
9208
|
+
const exportGroup = {
|
|
9209
|
+
label: "Export",
|
|
9210
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_lu17.LuSquareArrowOutUpRight, { className: "mr-2 w-4" }),
|
|
9211
|
+
key: "export",
|
|
9212
|
+
items: [
|
|
9213
|
+
[
|
|
9214
|
+
{
|
|
9215
|
+
label: "Take a snapshot",
|
|
9216
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_lu17.LuCamera, { className: "mr-2 w-4" }),
|
|
9217
|
+
key: "snapshot"
|
|
9218
|
+
}
|
|
9219
|
+
],
|
|
9220
|
+
[
|
|
9221
|
+
{
|
|
9222
|
+
key: "png",
|
|
9223
|
+
label: "Export as PNG",
|
|
9224
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_lu17.LuSquareArrowOutUpRight, { className: "mr-2 w-4" })
|
|
9225
|
+
},
|
|
9226
|
+
{
|
|
9227
|
+
key: "svg",
|
|
9228
|
+
label: "Export as SVG",
|
|
9229
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_lu17.LuDownload, { className: "mr-2 w-4" })
|
|
9230
|
+
},
|
|
9231
|
+
{
|
|
9232
|
+
key: "csv",
|
|
9233
|
+
label: "Export as CSV",
|
|
9234
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_lu17.LuDownload, { className: "mr-2 w-4" })
|
|
9235
|
+
}
|
|
9236
|
+
],
|
|
9237
|
+
lastGroup
|
|
9238
|
+
]
|
|
9239
|
+
};
|
|
9240
|
+
if (allowFullScreen || allowExport) {
|
|
9241
|
+
ret.push([
|
|
9242
|
+
...allowFullScreen ? [StaticButtons.fullscreen] : [],
|
|
9243
|
+
...allowExport ? [exportGroup] : []
|
|
9244
|
+
]);
|
|
9245
|
+
}
|
|
9246
|
+
const editButtons = [StaticButtons.refresh];
|
|
9247
|
+
if (allowViewPanel) {
|
|
9248
|
+
editButtons.push(StaticButtons.edit);
|
|
9249
|
+
}
|
|
9250
|
+
ret.push(editButtons);
|
|
9251
|
+
if (allowEdit) {
|
|
9252
|
+
ret.push(
|
|
9253
|
+
[StaticButtons.clone, StaticButtons.copy],
|
|
9254
|
+
[StaticButtons.delete]
|
|
9255
|
+
);
|
|
9256
|
+
} else if (allowViewPanel) {
|
|
9257
|
+
ret.push([StaticButtons.copy]);
|
|
9258
|
+
}
|
|
9259
|
+
return ret;
|
|
9260
|
+
}, [
|
|
9261
|
+
allowEdit,
|
|
9262
|
+
allowExport,
|
|
9263
|
+
allowFullScreen,
|
|
9264
|
+
allowViewPanel,
|
|
9265
|
+
allowEmbed,
|
|
9266
|
+
canExportCurl,
|
|
9267
|
+
exportCurlHint
|
|
9268
|
+
]);
|
|
9269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
|
|
9270
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "hidden group-[.xs]:flex", ref: menuRef, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
9271
|
+
import_ui_core46.PopupMenuButton,
|
|
9272
|
+
{
|
|
9273
|
+
onSelect: onMenuSelect,
|
|
9274
|
+
items,
|
|
9275
|
+
ariaLabel: "dropdown menu",
|
|
9276
|
+
buttonIcon: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_lu17.LuSettings, { className: "w-4" })
|
|
9277
|
+
}
|
|
9278
|
+
) }),
|
|
9279
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex group-[.xs]:hidden", children: [
|
|
9280
|
+
fullScreenButton,
|
|
9281
|
+
exportButton,
|
|
9282
|
+
allowViewPanel && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
9283
|
+
"button",
|
|
9284
|
+
{
|
|
9285
|
+
type: "button",
|
|
9286
|
+
className: "text-text-foreground-secondary hover:text-primary-600 w-6 px-1",
|
|
9287
|
+
"aria-label": "Edit panel",
|
|
9288
|
+
onClick: () => {
|
|
9289
|
+
onMenuSelect("edit");
|
|
9290
|
+
},
|
|
9291
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_lu17.LuPencil, {})
|
|
9292
|
+
}
|
|
9293
|
+
),
|
|
9294
|
+
allowEdit ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ExtraSettingMenu, { onSelect: onMenuSelect }) : allowViewPanel ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ReadonlyExtraSettingMenu, { onSelect: onMenuSelect }) : null
|
|
9295
|
+
] })
|
|
9296
|
+
] });
|
|
9297
|
+
};
|
|
9298
|
+
var DashboardButtonsMemo = (0, import_react42.memo)(DashboardButtons);
|
|
8030
9299
|
// Annotate the CommonJS export names for ESM import in node:
|
|
8031
9300
|
0 && (module.exports = {
|
|
9301
|
+
AddPanel,
|
|
9302
|
+
AddPanelSlideover,
|
|
8032
9303
|
AggregateInput,
|
|
8033
9304
|
AreaIcon,
|
|
8034
9305
|
ArgumentInput,
|
|
@@ -8040,7 +9311,10 @@ function ExportDashboardDialog({
|
|
|
8040
9311
|
ChartLegend,
|
|
8041
9312
|
ChartTooltip,
|
|
8042
9313
|
ChartTypeButtonGroup,
|
|
9314
|
+
CodeBlockWithTitle,
|
|
9315
|
+
CurlDialog,
|
|
8043
9316
|
DEFAULT_HIGHLIGHT_KEY,
|
|
9317
|
+
DashboardButtonsMemo,
|
|
8044
9318
|
DashboardRefresh,
|
|
8045
9319
|
DataControls,
|
|
8046
9320
|
EditDashboardDialog,
|
|
@@ -8048,7 +9322,10 @@ function ExportDashboardDialog({
|
|
|
8048
9322
|
ErrorChart,
|
|
8049
9323
|
EventsFunctionCategories,
|
|
8050
9324
|
EventsFunctionMap,
|
|
9325
|
+
ExportChartMenu,
|
|
8051
9326
|
ExportDashboardDialog,
|
|
9327
|
+
ExportType,
|
|
9328
|
+
ExtraSettingMenu,
|
|
8052
9329
|
FunctionInput,
|
|
8053
9330
|
FunctionMap,
|
|
8054
9331
|
FunctionsCategories,
|
|
@@ -8061,6 +9338,7 @@ function ExportDashboardDialog({
|
|
|
8061
9338
|
LineControls,
|
|
8062
9339
|
LineIcon,
|
|
8063
9340
|
MarkerControls,
|
|
9341
|
+
PanelOwner,
|
|
8064
9342
|
PieChart,
|
|
8065
9343
|
PieChartControls,
|
|
8066
9344
|
PieIcon,
|
|
@@ -8068,6 +9346,7 @@ function ExportDashboardDialog({
|
|
|
8068
9346
|
QueryValueControls,
|
|
8069
9347
|
QueryValueIcon,
|
|
8070
9348
|
ReactEChartsBase,
|
|
9349
|
+
ReadonlyExtraSettingMenu,
|
|
8071
9350
|
RefreshButton,
|
|
8072
9351
|
RefreshContext,
|
|
8073
9352
|
ScatterChartTooltip,
|
|
@@ -8080,21 +9359,33 @@ function ExportDashboardDialog({
|
|
|
8080
9359
|
TableIcon,
|
|
8081
9360
|
TimeRangeOverride,
|
|
8082
9361
|
TimeSeriesChart,
|
|
9362
|
+
UserInfo,
|
|
8083
9363
|
ValueControls,
|
|
8084
9364
|
ValueFormatters,
|
|
8085
9365
|
ValueOptions,
|
|
8086
9366
|
ValueStringMapping,
|
|
8087
9367
|
XAxisControls,
|
|
8088
9368
|
YaxisControls,
|
|
9369
|
+
defaultAnalyticChart,
|
|
8089
9370
|
defaultBarGaugeConfig,
|
|
8090
9371
|
defaultDataConfig,
|
|
9372
|
+
defaultEventChart,
|
|
9373
|
+
defaultGroupChart,
|
|
9374
|
+
defaultInsightChart,
|
|
9375
|
+
defaultMetricChart,
|
|
9376
|
+
defaultNoteChart,
|
|
8091
9377
|
defaultPieConfig,
|
|
8092
9378
|
defaultQueryValueConfig,
|
|
9379
|
+
defaultRetentionChart,
|
|
8093
9380
|
defaultScatterConfig,
|
|
9381
|
+
defaultSqlChart,
|
|
8094
9382
|
defaultTableConfig,
|
|
8095
9383
|
defaultTimeRangeOverrideConfig,
|
|
8096
9384
|
defaultValueConfig,
|
|
8097
9385
|
defaultValueControlsConfig,
|
|
9386
|
+
escapeBody,
|
|
9387
|
+
generateCurlCode,
|
|
9388
|
+
generateNodeCode,
|
|
8098
9389
|
getDefaultValueConfig,
|
|
8099
9390
|
getHighlightHex,
|
|
8100
9391
|
isAggrOrRollupFunction,
|