@gravitee/gamma-lib-observability 3.3.0-beta.6 → 3.3.0-beta.6-feat-targets-panel-header.5aaad46
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.js
CHANGED
|
@@ -15846,26 +15846,45 @@ function mb({ target: e, subject: t, metrics: n, metricsHint: r, readOnly: i, su
|
|
|
15846
15846
|
//#region src/targets/TargetsPanel.tsx
|
|
15847
15847
|
var hb = { height: 208 };
|
|
15848
15848
|
function gb(e) {
|
|
15849
|
-
|
|
15850
|
-
|
|
15851
|
-
|
|
15852
|
-
|
|
15853
|
-
|
|
15849
|
+
if (!bv()) {
|
|
15850
|
+
let t = /* @__PURE__ */ z(X, {
|
|
15851
|
+
role: "status",
|
|
15852
|
+
"aria-label": "Loading targets",
|
|
15853
|
+
className: Z("rounded-xl", !e.header && e.className),
|
|
15854
|
+
style: hb
|
|
15855
|
+
});
|
|
15856
|
+
return e.header ? /* @__PURE__ */ B("div", {
|
|
15857
|
+
className: Z("flex min-w-0 flex-col gap-6", e.className),
|
|
15858
|
+
children: [/* @__PURE__ */ z(_b, { header: e.header }), t]
|
|
15859
|
+
}) : t;
|
|
15860
|
+
}
|
|
15861
|
+
return /* @__PURE__ */ z(yb, { ...e });
|
|
15862
|
+
}
|
|
15863
|
+
function _b({ header: e, actions: t }) {
|
|
15864
|
+
return /* @__PURE__ */ B("div", {
|
|
15865
|
+
className: "flex flex-wrap items-start justify-between gap-4",
|
|
15866
|
+
children: [/* @__PURE__ */ z("div", {
|
|
15867
|
+
className: "min-w-0",
|
|
15868
|
+
children: e
|
|
15869
|
+
}), t && /* @__PURE__ */ z("div", {
|
|
15870
|
+
className: "flex shrink-0 flex-wrap items-center gap-2",
|
|
15871
|
+
children: t
|
|
15872
|
+
})]
|
|
15854
15873
|
});
|
|
15855
15874
|
}
|
|
15856
|
-
function
|
|
15875
|
+
function vb(e, t) {
|
|
15857
15876
|
return e !== void 0 && e.rules === t.rules && e.missed === t.missed && e.total === t.total && e.held === t.held && e.verdicts === t.verdicts;
|
|
15858
15877
|
}
|
|
15859
|
-
function
|
|
15860
|
-
let
|
|
15878
|
+
function yb({ reference: e, apiIds: t, apiTypes: n, ruleApiTypes: r, readOnly: i = !1, suggestions: a, onChanged: o, emptyDescription: s = "Nothing is watching this subject yet.", defaults: c, describeReason: l, header: u, toolbar: d, emptyActions: f, className: p }) {
|
|
15879
|
+
let m = {
|
|
15861
15880
|
reference: e,
|
|
15862
15881
|
apiIds: t,
|
|
15863
15882
|
apiTypes: n,
|
|
15864
15883
|
ruleApiTypes: r
|
|
15865
|
-
},
|
|
15884
|
+
}, h = kv(e), g = Nv(Yv(m)), { metrics: _ } = g, v = Fv(Yv(m), g), y = pb(e, o), [b, x] = L(!1), [S, C] = L({}), w = M((e, t) => C((n) => vb(n[e], t) ? n : {
|
|
15866
15885
|
...n,
|
|
15867
15886
|
[e]: t
|
|
15868
|
-
}), []),
|
|
15887
|
+
}), []), T = (h.data ?? []).map((e) => S[e.id]).filter((e) => e !== void 0).reduce((e, t) => ({
|
|
15869
15888
|
rules: e.rules + t.rules,
|
|
15870
15889
|
missed: e.missed + t.missed,
|
|
15871
15890
|
total: e.total + t.total,
|
|
@@ -15877,32 +15896,36 @@ function vb({ reference: e, apiIds: t, apiTypes: n, ruleApiTypes: r, readOnly: i
|
|
|
15877
15896
|
total: 0,
|
|
15878
15897
|
held: 0,
|
|
15879
15898
|
verdicts: 0
|
|
15899
|
+
}), E = /* @__PURE__ */ B(U, {
|
|
15900
|
+
size: u ? void 0 : "sm",
|
|
15901
|
+
onClick: () => x(!0),
|
|
15902
|
+
children: [/* @__PURE__ */ z(je, { "aria-hidden": "true" }), "New target"]
|
|
15880
15903
|
});
|
|
15881
15904
|
return /* @__PURE__ */ B("div", {
|
|
15882
|
-
className: Z("flex min-w-0 flex-col gap-6",
|
|
15905
|
+
className: Z("flex min-w-0 flex-col gap-6", p),
|
|
15883
15906
|
children: [
|
|
15884
|
-
|
|
15885
|
-
|
|
15886
|
-
|
|
15907
|
+
u && /* @__PURE__ */ z(_b, {
|
|
15908
|
+
header: u,
|
|
15909
|
+
actions: !i && h.data && /* @__PURE__ */ B(R, { children: [h.data.length > 0 && d, E] })
|
|
15887
15910
|
}),
|
|
15888
|
-
|
|
15911
|
+
h.error && /* @__PURE__ */ z(bl, {
|
|
15889
15912
|
message: h.error.message,
|
|
15890
|
-
onRetry: h.refetch
|
|
15913
|
+
onRetry: () => void h.refetch()
|
|
15891
15914
|
}),
|
|
15892
|
-
|
|
15915
|
+
!h.error && g.error && /* @__PURE__ */ z(bl, {
|
|
15916
|
+
message: g.error.message,
|
|
15917
|
+
onRetry: g.refetch
|
|
15918
|
+
}),
|
|
15919
|
+
h.isPending && !h.error && /* @__PURE__ */ z("div", {
|
|
15893
15920
|
className: "flex flex-col gap-4",
|
|
15894
15921
|
children: [0, 1].map((e) => /* @__PURE__ */ z(X, {
|
|
15895
15922
|
className: "rounded-xl",
|
|
15896
15923
|
style: hb
|
|
15897
15924
|
}, e))
|
|
15898
15925
|
}),
|
|
15899
|
-
|
|
15926
|
+
h.data && h.data.length > 0 && /* @__PURE__ */ B(R, { children: [!i && !u && /* @__PURE__ */ B("div", {
|
|
15900
15927
|
className: "flex flex-wrap items-center justify-end gap-2",
|
|
15901
|
-
children: [
|
|
15902
|
-
size: "sm",
|
|
15903
|
-
onClick: () => b(!0),
|
|
15904
|
-
children: [/* @__PURE__ */ z(je, { "aria-hidden": "true" }), "New target"]
|
|
15905
|
-
})]
|
|
15928
|
+
children: [d, E]
|
|
15906
15929
|
}), /* @__PURE__ */ z(lt, { children: /* @__PURE__ */ B(ut, {
|
|
15907
15930
|
className: "flex flex-wrap items-start gap-10 px-6 py-5",
|
|
15908
15931
|
children: [
|
|
@@ -15911,7 +15934,7 @@ function vb({ reference: e, apiIds: t, apiTypes: n, ruleApiTypes: r, readOnly: i
|
|
|
15911
15934
|
children: "Targets configured"
|
|
15912
15935
|
}), /* @__PURE__ */ z("p", {
|
|
15913
15936
|
className: "text-2xl font-medium",
|
|
15914
|
-
children:
|
|
15937
|
+
children: T.rules
|
|
15915
15938
|
})] }),
|
|
15916
15939
|
/* @__PURE__ */ B("div", { children: [
|
|
15917
15940
|
/* @__PURE__ */ z("p", {
|
|
@@ -15919,12 +15942,12 @@ function vb({ reference: e, apiIds: t, apiTypes: n, ruleApiTypes: r, readOnly: i
|
|
|
15919
15942
|
children: "Missed right now"
|
|
15920
15943
|
}),
|
|
15921
15944
|
/* @__PURE__ */ z("p", {
|
|
15922
|
-
className: `text-2xl font-medium ${
|
|
15923
|
-
children:
|
|
15945
|
+
className: `text-2xl font-medium ${T.missed > 0 ? "text-destructive" : ""}`,
|
|
15946
|
+
children: T.verdicts === 0 ? "—" : T.missed
|
|
15924
15947
|
}),
|
|
15925
15948
|
/* @__PURE__ */ z("p", {
|
|
15926
15949
|
className: "text-muted-foreground text-xs",
|
|
15927
|
-
children:
|
|
15950
|
+
children: T.verdicts === 0 ? T.total === 0 ? "not evaluated yet" : "no verdict in the latest window" : `of ${T.verdicts} evaluated`
|
|
15928
15951
|
})
|
|
15929
15952
|
] }),
|
|
15930
15953
|
/* @__PURE__ */ B("div", { children: [
|
|
@@ -15934,28 +15957,28 @@ function vb({ reference: e, apiIds: t, apiTypes: n, ruleApiTypes: r, readOnly: i
|
|
|
15934
15957
|
}),
|
|
15935
15958
|
/* @__PURE__ */ z("p", {
|
|
15936
15959
|
className: "text-2xl font-medium",
|
|
15937
|
-
children:
|
|
15960
|
+
children: T.total === 0 ? "—" : `${Math.round(T.held / T.total * 100)}%`
|
|
15938
15961
|
}),
|
|
15939
15962
|
/* @__PURE__ */ z("p", {
|
|
15940
15963
|
className: "text-muted-foreground text-xs",
|
|
15941
|
-
children:
|
|
15964
|
+
children: T.total === 0 ? "not evaluated yet" : `${T.held} of ${T.total}`
|
|
15942
15965
|
})
|
|
15943
15966
|
] })
|
|
15944
15967
|
]
|
|
15945
15968
|
}) })] }),
|
|
15946
|
-
|
|
15969
|
+
h.data?.map((e) => /* @__PURE__ */ z(mb, {
|
|
15947
15970
|
target: e,
|
|
15948
|
-
subject:
|
|
15949
|
-
metrics:
|
|
15950
|
-
metricsHint:
|
|
15971
|
+
subject: m,
|
|
15972
|
+
metrics: _,
|
|
15973
|
+
metricsHint: v,
|
|
15951
15974
|
readOnly: i,
|
|
15952
15975
|
suggestions: a,
|
|
15953
15976
|
defaults: c,
|
|
15954
15977
|
describeReason: l,
|
|
15955
15978
|
onChanged: o,
|
|
15956
|
-
onStats:
|
|
15979
|
+
onStats: w
|
|
15957
15980
|
}, e.id)),
|
|
15958
|
-
|
|
15981
|
+
h.data && h.data.length === 0 && /* @__PURE__ */ z(lt, { children: /* @__PURE__ */ B(ut, {
|
|
15959
15982
|
className: "px-6 py-5",
|
|
15960
15983
|
children: [
|
|
15961
15984
|
/* @__PURE__ */ z("p", {
|
|
@@ -15970,27 +15993,23 @@ function vb({ reference: e, apiIds: t, apiTypes: n, ruleApiTypes: r, readOnly: i
|
|
|
15970
15993
|
className: "text-muted-foreground text-sm",
|
|
15971
15994
|
children: "No API is attributed to this subject yet. Targets can be declared now and are evaluated once one is."
|
|
15972
15995
|
}),
|
|
15973
|
-
!i && /* @__PURE__ */ B("div", {
|
|
15996
|
+
!i && (!u || f) && /* @__PURE__ */ B("div", {
|
|
15974
15997
|
className: "mt-3 flex flex-wrap items-center gap-2",
|
|
15975
|
-
children: [
|
|
15976
|
-
size: "sm",
|
|
15977
|
-
onClick: () => b(!0),
|
|
15978
|
-
children: [/* @__PURE__ */ z(je, { "aria-hidden": "true" }), "New target"]
|
|
15979
|
-
})]
|
|
15998
|
+
children: [f, !u && E]
|
|
15980
15999
|
})
|
|
15981
16000
|
]
|
|
15982
16001
|
}) }),
|
|
15983
16002
|
/* @__PURE__ */ z(Zv, {
|
|
15984
|
-
open:
|
|
15985
|
-
subject:
|
|
15986
|
-
metrics:
|
|
15987
|
-
metricsHint:
|
|
16003
|
+
open: b,
|
|
16004
|
+
subject: m,
|
|
16005
|
+
metrics: _,
|
|
16006
|
+
metricsHint: v,
|
|
15988
16007
|
suggestions: a,
|
|
15989
|
-
saving:
|
|
16008
|
+
saving: y.isSaving,
|
|
15990
16009
|
onSave: async (e) => {
|
|
15991
|
-
await
|
|
16010
|
+
await y.createTarget(e), x(!1);
|
|
15992
16011
|
},
|
|
15993
|
-
onClose: () =>
|
|
16012
|
+
onClose: () => x(!1)
|
|
15994
16013
|
})
|
|
15995
16014
|
]
|
|
15996
16015
|
});
|
|
@@ -17,7 +17,16 @@ export interface TargetsPanelProps extends TargetsSubjectProps {
|
|
|
17
17
|
readonly defaults?: readonly TargetDefaultRule[];
|
|
18
18
|
/** The host's own reading of a skipped window, tried before the panel's (no traffic, too few calls). */
|
|
19
19
|
readonly describeReason?: DescribeRuleReason;
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* The host's page header: its title, and a description if it has one. Given it, the panel draws it with
|
|
22
|
+
* "New target" and the toolbar at its end, as the page's primary action, instead of in a row of their own below
|
|
23
|
+
* the host's header; the empty state then keeps only `emptyActions`. Shown while the targets load too.
|
|
24
|
+
*/
|
|
25
|
+
readonly header?: ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* Actions of the host's own beside "New target": above the summary, or at the end of `header` when one is given;
|
|
28
|
+
* a restore of its defaults, say.
|
|
29
|
+
*/
|
|
21
30
|
readonly toolbar?: ReactNode;
|
|
22
31
|
/** Actions of the host's own in the empty state, beside "New target". */
|
|
23
32
|
readonly emptyActions?: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TargetsPanel.d.ts","sourceRoot":"","sources":["../../src/targets/TargetsPanel.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAyB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAI9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAkB,KAAK,iBAAiB,EAAE,KAAK,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G;IACxG,QAAQ,CAAC,cAAc,CAAC,EAAE,kBAAkB,CAAC;IAC7C;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;IAC7B,yEAAyE;IACzE,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,CAAC;IAClC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAKD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CAsBpD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravitee/gamma-lib-observability",
|
|
3
|
-
"version": "3.3.0-beta.6",
|
|
3
|
+
"version": "3.3.0-beta.6-feat-targets-panel-header.5aaad46",
|
|
4
4
|
"description": "Shared observability library for Gamma modules — dashboards, logs, tracing UI components and integration with business rules.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "yarn@4.14.1",
|