@kwirthmagnify/kwirth-homepage-clusterized 0.1.1
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/front.js +107 -0
- package/package.json +7 -0
package/front.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(() => {
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
10
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
|
|
29
|
+
// kwirth-globals:react
|
|
30
|
+
var require_react = __commonJS({
|
|
31
|
+
"kwirth-globals:react"(exports, module) {
|
|
32
|
+
var _m = window.__kwirth__.React;
|
|
33
|
+
var _d = _m != null && "default" in Object(_m) ? _m.default : _m;
|
|
34
|
+
if (typeof _d !== "function" && _d != null && typeof _d.default !== "undefined") _d = _d.default;
|
|
35
|
+
module.exports = Object.assign({}, typeof _m === "object" && _m !== null ? _m : {}, { default: _d, __esModule: true });
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// kwirth-globals:@mui/material
|
|
40
|
+
var require_material = __commonJS({
|
|
41
|
+
"kwirth-globals:@mui/material"(exports, module) {
|
|
42
|
+
var _m = window.__kwirth__.MUI.material;
|
|
43
|
+
var _d = _m != null && "default" in Object(_m) ? _m.default : _m;
|
|
44
|
+
if (typeof _d !== "function" && _d != null && typeof _d.default !== "undefined") _d = _d.default;
|
|
45
|
+
module.exports = Object.assign({}, typeof _m === "object" && _m !== null ? _m : {}, { default: _d, __esModule: true });
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// kwirth-globals:@mui/icons-material
|
|
50
|
+
var require_icons_material = __commonJS({
|
|
51
|
+
"kwirth-globals:@mui/icons-material"(exports, module) {
|
|
52
|
+
var _m = window.__kwirth__.MUI.icons;
|
|
53
|
+
var _d = _m != null && "default" in Object(_m) ? _m.default : _m;
|
|
54
|
+
if (typeof _d !== "function" && _d != null && typeof _d.default !== "undefined") _d = _d.default;
|
|
55
|
+
module.exports = Object.assign({}, typeof _m === "object" && _m !== null ? _m : {}, { default: _d, __esModule: true });
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// src/front/Clusterized.tsx
|
|
60
|
+
var import_react = __toESM(require_react(), 1);
|
|
61
|
+
var import_material = __toESM(require_material(), 1);
|
|
62
|
+
var import_icons_material = __toESM(require_icons_material(), 1);
|
|
63
|
+
var StatusLight = ({ color, active, label }) => /* @__PURE__ */ import_react.default.createElement(import_material.Tooltip, { title: label }, /* @__PURE__ */ import_react.default.createElement(import_material.Box, { sx: {
|
|
64
|
+
width: 14,
|
|
65
|
+
height: 14,
|
|
66
|
+
borderRadius: "50%",
|
|
67
|
+
bgcolor: color,
|
|
68
|
+
opacity: active ? 1 : 0.2,
|
|
69
|
+
boxShadow: active ? `0 0 6px 2px ${color}` : "none",
|
|
70
|
+
transition: "all 0.3s ease",
|
|
71
|
+
cursor: "default"
|
|
72
|
+
} }));
|
|
73
|
+
var Clusterized = (props) => {
|
|
74
|
+
const launchMagnify = (clusterName) => {
|
|
75
|
+
props.onHomepageSelectTab({
|
|
76
|
+
name: clusterName,
|
|
77
|
+
description: "",
|
|
78
|
+
channel: "magnify",
|
|
79
|
+
channelObject: {
|
|
80
|
+
clusterName,
|
|
81
|
+
view: "cluster",
|
|
82
|
+
namespace: "",
|
|
83
|
+
group: "",
|
|
84
|
+
pod: "",
|
|
85
|
+
container: ""
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
return /* @__PURE__ */ import_react.default.createElement(import_material.Box, { sx: { p: 2, display: "flex", flexDirection: "column", gap: 2, overflowY: "auto", height: "100%" } }, props.clusters.map((cluster) => /* @__PURE__ */ import_react.default.createElement(import_material.Card, { key: cluster.name, variant: "outlined" }, /* @__PURE__ */ import_react.default.createElement(import_material.CardContent, { sx: { py: 1.5, "&:last-child": { pb: 1.5 } } }, /* @__PURE__ */ import_react.default.createElement(import_material.Stack, { direction: "row", alignItems: "center", spacing: 2 }, /* @__PURE__ */ import_react.default.createElement(import_material.Box, { sx: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ import_react.default.createElement(import_material.Typography, { variant: "h6", sx: { lineHeight: 1.3 } }, cluster.name), /* @__PURE__ */ import_react.default.createElement(import_material.Typography, { variant: "caption", color: "text.secondary", sx: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", display: "block" } }, cluster.url)), /* @__PURE__ */ import_react.default.createElement(import_material.Stack, { direction: "row", spacing: 0.75, alignItems: "center" }, /* @__PURE__ */ import_react.default.createElement(StatusLight, { color: "#4caf50", label: "Healthy" }), /* @__PURE__ */ import_react.default.createElement(StatusLight, { color: "#ff9800", label: "Warning" }), /* @__PURE__ */ import_react.default.createElement(StatusLight, { color: "#f44336", label: "Critical" })), /* @__PURE__ */ import_react.default.createElement(
|
|
90
|
+
import_material.Button,
|
|
91
|
+
{
|
|
92
|
+
variant: "outlined",
|
|
93
|
+
size: "small",
|
|
94
|
+
startIcon: /* @__PURE__ */ import_react.default.createElement(import_icons_material.OpenInBrowser, null),
|
|
95
|
+
onClick: () => launchMagnify(cluster.name)
|
|
96
|
+
},
|
|
97
|
+
"Magnify"
|
|
98
|
+
))))), props.clusters.length === 0 && /* @__PURE__ */ import_react.default.createElement(import_material.Typography, { variant: "body2", color: "text.secondary", sx: { p: 2 } }, "No clusters defined. Add a cluster to get started."));
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// src/front/index.ts
|
|
102
|
+
window.__kwirth_homepages__["clusterized"] = {
|
|
103
|
+
homepageId: "clusterized",
|
|
104
|
+
displayName: "Clusterized",
|
|
105
|
+
Component: Clusterized
|
|
106
|
+
};
|
|
107
|
+
})();
|
package/package.json
ADDED