@perses-dev/plugin-system 0.54.0-beta.4 → 0.54.0-beta.6
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/cjs/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.js +283 -0
- package/dist/cjs/components/Annotations/AnnotationEditorForm/AnnotationPreview.js +252 -0
- package/dist/cjs/components/Annotations/AnnotationEditorForm/index.js +30 -0
- package/dist/cjs/components/Annotations/index.js +30 -0
- package/dist/cjs/components/index.js +1 -0
- package/dist/cjs/context/ValidationProvider.js +7 -1
- package/dist/cjs/model/annotations.js +16 -0
- package/dist/cjs/model/index.js +1 -0
- package/dist/cjs/runtime/annotations.js +148 -0
- package/dist/cjs/runtime/index.js +1 -0
- package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.d.ts +16 -0
- package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.d.ts.map +1 -0
- package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.js +270 -0
- package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.js.map +1 -0
- package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.d.ts +8 -0
- package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.d.ts.map +1 -0
- package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.js +198 -0
- package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.js.map +1 -0
- package/dist/components/Annotations/AnnotationEditorForm/index.d.ts +2 -0
- package/dist/components/Annotations/AnnotationEditorForm/index.d.ts.map +1 -0
- package/dist/components/Annotations/AnnotationEditorForm/index.js +15 -0
- package/dist/components/Annotations/AnnotationEditorForm/index.js.map +1 -0
- package/dist/components/Annotations/index.d.ts +2 -0
- package/dist/components/Annotations/index.d.ts.map +1 -0
- package/dist/components/Annotations/index.js +15 -0
- package/dist/components/Annotations/index.js.map +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/context/ValidationProvider.d.ts +3 -1
- package/dist/context/ValidationProvider.d.ts.map +1 -1
- package/dist/context/ValidationProvider.js +8 -2
- package/dist/context/ValidationProvider.js.map +1 -1
- package/dist/model/annotations.d.ts +28 -0
- package/dist/model/annotations.d.ts.map +1 -0
- package/dist/model/annotations.js +17 -0
- package/dist/model/annotations.js.map +1 -0
- package/dist/model/index.d.ts +1 -0
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +1 -0
- package/dist/model/index.js.map +1 -1
- package/dist/model/plugins.d.ts +2 -0
- package/dist/model/plugins.d.ts.map +1 -1
- package/dist/model/plugins.js.map +1 -1
- package/dist/runtime/annotations.d.ts +6 -0
- package/dist/runtime/annotations.d.ts.map +1 -0
- package/dist/runtime/annotations.js +129 -0
- package/dist/runtime/annotations.js.map +1 -0
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
// Copyright The Perses Authors
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
import React, { useMemo, useState } from 'react';
|
|
15
|
+
import { Card, CardContent, CardHeader, Chip, CircularProgress, Divider, IconButton, Stack, Typography } from '@mui/material';
|
|
16
|
+
import { useAnnotationData } from '@perses-dev/plugin-system';
|
|
17
|
+
import { InfoTooltip, useTimeZone } from '@perses-dev/components';
|
|
18
|
+
import AlertIcon from 'mdi-material-ui/Alert';
|
|
19
|
+
const formatDate = (timeMs, format)=>{
|
|
20
|
+
// Disallows NaN, Infinity, and -Infinity
|
|
21
|
+
if (!Number.isFinite(timeMs)) {
|
|
22
|
+
return {
|
|
23
|
+
date: 'N/A',
|
|
24
|
+
time: 'N/A'
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const d = new Date(timeMs);
|
|
28
|
+
return {
|
|
29
|
+
date: format(d, 'MMM dd, yyyy'),
|
|
30
|
+
time: format(d, 'HH:mm:ss')
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
function AnnotationPreviewCard({ value, formatWithUserTimeZone, ...props }) {
|
|
34
|
+
const start = formatDate(value.start, formatWithUserTimeZone);
|
|
35
|
+
const end = value.end !== undefined ? formatDate(value.start, formatWithUserTimeZone) : null;
|
|
36
|
+
const tags = useMemo(()=>{
|
|
37
|
+
return Object.entries(value.tags ?? []).map(([key, value])=>{
|
|
38
|
+
return {
|
|
39
|
+
key: key,
|
|
40
|
+
value: value
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
}, [
|
|
44
|
+
value.tags
|
|
45
|
+
]);
|
|
46
|
+
return /*#__PURE__*/ _jsx(Card, {
|
|
47
|
+
...props,
|
|
48
|
+
children: /*#__PURE__*/ _jsxs(CardContent, {
|
|
49
|
+
children: [
|
|
50
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
51
|
+
gap: 2,
|
|
52
|
+
children: [
|
|
53
|
+
value.title && /*#__PURE__*/ _jsx(Typography, {
|
|
54
|
+
variant: "h3",
|
|
55
|
+
children: value.title
|
|
56
|
+
}),
|
|
57
|
+
value.legend && /*#__PURE__*/ _jsx(Typography, {
|
|
58
|
+
children: value.legend
|
|
59
|
+
}),
|
|
60
|
+
/*#__PURE__*/ _jsx(Stack, {
|
|
61
|
+
flexWrap: "wrap",
|
|
62
|
+
direction: "row",
|
|
63
|
+
gap: 0.5,
|
|
64
|
+
children: tags.map((tag)=>/*#__PURE__*/ _jsx(Chip, {
|
|
65
|
+
size: "small",
|
|
66
|
+
label: `${tag.key}: ${tag.value}`
|
|
67
|
+
}, `${tag.key}=${tag.value}`))
|
|
68
|
+
})
|
|
69
|
+
]
|
|
70
|
+
}),
|
|
71
|
+
/*#__PURE__*/ _jsx(Divider, {
|
|
72
|
+
sx: {
|
|
73
|
+
marginY: 2
|
|
74
|
+
}
|
|
75
|
+
}),
|
|
76
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
77
|
+
gap: 0.5,
|
|
78
|
+
direction: "row",
|
|
79
|
+
children: [
|
|
80
|
+
/*#__PURE__*/ _jsxs(Typography, {
|
|
81
|
+
variant: "caption",
|
|
82
|
+
children: [
|
|
83
|
+
start.date,
|
|
84
|
+
" - ",
|
|
85
|
+
/*#__PURE__*/ _jsx("strong", {
|
|
86
|
+
children: start.time
|
|
87
|
+
})
|
|
88
|
+
]
|
|
89
|
+
}),
|
|
90
|
+
end && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
91
|
+
children: [
|
|
92
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
93
|
+
variant: "caption",
|
|
94
|
+
children: ' → '
|
|
95
|
+
}),
|
|
96
|
+
/*#__PURE__*/ _jsxs(Typography, {
|
|
97
|
+
variant: "caption",
|
|
98
|
+
children: [
|
|
99
|
+
end.date,
|
|
100
|
+
" - ",
|
|
101
|
+
/*#__PURE__*/ _jsx("strong", {
|
|
102
|
+
children: end.time
|
|
103
|
+
})
|
|
104
|
+
]
|
|
105
|
+
})
|
|
106
|
+
]
|
|
107
|
+
})
|
|
108
|
+
]
|
|
109
|
+
})
|
|
110
|
+
]
|
|
111
|
+
})
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
export function AnnotationPreview({ spec, ...props }) {
|
|
115
|
+
const { data, isFetching, error } = useAnnotationData(spec);
|
|
116
|
+
const { formatWithUserTimeZone } = useTimeZone();
|
|
117
|
+
const [showAll, setShowAll] = useState(false);
|
|
118
|
+
const annotationsToShow = showAll ? data : data?.slice(0, 1);
|
|
119
|
+
let notShown = 0;
|
|
120
|
+
if (data && data?.length > 0 && annotationsToShow) {
|
|
121
|
+
notShown = data.length - annotationsToShow.length;
|
|
122
|
+
}
|
|
123
|
+
const stateIndicator = useMemo(()=>{
|
|
124
|
+
if (isFetching) {
|
|
125
|
+
return /*#__PURE__*/ _jsx(CircularProgress, {
|
|
126
|
+
"aria-label": "loading",
|
|
127
|
+
size: "1.125rem"
|
|
128
|
+
});
|
|
129
|
+
} else if (error) {
|
|
130
|
+
return /*#__PURE__*/ _jsx(InfoTooltip, {
|
|
131
|
+
description: error.toString(),
|
|
132
|
+
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
133
|
+
"aria-label": "preview errors",
|
|
134
|
+
size: "small",
|
|
135
|
+
children: /*#__PURE__*/ _jsx(AlertIcon, {
|
|
136
|
+
fontSize: "inherit",
|
|
137
|
+
sx: {
|
|
138
|
+
color: (theme)=>theme.palette.error.main
|
|
139
|
+
}
|
|
140
|
+
})
|
|
141
|
+
})
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}, [
|
|
145
|
+
isFetching,
|
|
146
|
+
error
|
|
147
|
+
]);
|
|
148
|
+
return /*#__PURE__*/ _jsxs(Card, {
|
|
149
|
+
variant: "outlined",
|
|
150
|
+
...props,
|
|
151
|
+
children: [
|
|
152
|
+
/*#__PURE__*/ _jsx(CardHeader, {
|
|
153
|
+
title: /*#__PURE__*/ _jsxs(Stack, {
|
|
154
|
+
direction: "row",
|
|
155
|
+
justifyContent: "space-between",
|
|
156
|
+
children: [
|
|
157
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
158
|
+
variant: "h4",
|
|
159
|
+
children: "Preview Annotations"
|
|
160
|
+
}),
|
|
161
|
+
stateIndicator
|
|
162
|
+
]
|
|
163
|
+
})
|
|
164
|
+
}),
|
|
165
|
+
/*#__PURE__*/ _jsxs(CardContent, {
|
|
166
|
+
sx: {
|
|
167
|
+
display: 'flex',
|
|
168
|
+
flexWrap: 'wrap',
|
|
169
|
+
gap: 1,
|
|
170
|
+
paddingY: 0
|
|
171
|
+
},
|
|
172
|
+
children: [
|
|
173
|
+
annotationsToShow?.map((item, index)=>/*#__PURE__*/ _jsx(AnnotationPreviewCard, {
|
|
174
|
+
value: item,
|
|
175
|
+
formatWithUserTimeZone: formatWithUserTimeZone,
|
|
176
|
+
sx: {
|
|
177
|
+
width: '100%'
|
|
178
|
+
}
|
|
179
|
+
}, index)),
|
|
180
|
+
notShown > 0 && /*#__PURE__*/ _jsx(Chip, {
|
|
181
|
+
onClick: ()=>setShowAll(true),
|
|
182
|
+
variant: "outlined",
|
|
183
|
+
size: "small",
|
|
184
|
+
label: `+${notShown} more`
|
|
185
|
+
}),
|
|
186
|
+
showAll && data && data.length > 1 && /*#__PURE__*/ _jsx(Chip, {
|
|
187
|
+
onClick: ()=>setShowAll(false),
|
|
188
|
+
variant: "outlined",
|
|
189
|
+
size: "small",
|
|
190
|
+
label: "-"
|
|
191
|
+
})
|
|
192
|
+
]
|
|
193
|
+
})
|
|
194
|
+
]
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
//# sourceMappingURL=AnnotationPreview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Annotations/AnnotationEditorForm/AnnotationPreview.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { ReactNode, useMemo, useState } from 'react';\nimport { AnnotationData, AnnotationSpec } from '@perses-dev/spec';\nimport {\n Card,\n CardContent,\n CardHeader,\n CardProps,\n Chip,\n CircularProgress,\n Divider,\n IconButton,\n Stack,\n Typography,\n} from '@mui/material';\nimport { useAnnotationData } from '@perses-dev/plugin-system';\nimport { InfoTooltip, useTimeZone } from '@perses-dev/components';\nimport AlertIcon from 'mdi-material-ui/Alert';\n\nconst formatDate = (timeMs: number, format: (date: Date, format: string) => string): { date: string; time: string } => {\n // Disallows NaN, Infinity, and -Infinity\n if (!Number.isFinite(timeMs)) {\n return { date: 'N/A', time: 'N/A' };\n }\n\n const d = new Date(timeMs);\n return {\n date: format(d, 'MMM dd, yyyy'),\n time: format(d, 'HH:mm:ss'),\n };\n};\n\ninterface AnnotationPreviewCardProps extends CardProps {\n value: AnnotationData;\n formatWithUserTimeZone: (date: Date, format: string) => string;\n}\n\nfunction AnnotationPreviewCard({ value, formatWithUserTimeZone, ...props }: AnnotationPreviewCardProps): ReactNode {\n const start = formatDate(value.start, formatWithUserTimeZone);\n const end = value.end !== undefined ? formatDate(value.start, formatWithUserTimeZone) : null;\n\n const tags = useMemo(() => {\n return Object.entries(value.tags ?? []).map(([key, value]) => {\n return { key: key, value: value };\n });\n }, [value.tags]);\n\n return (\n <Card {...props}>\n <CardContent>\n <Stack gap={2}>\n {value.title && <Typography variant=\"h3\">{value.title}</Typography>}\n {value.legend && <Typography>{value.legend}</Typography>}\n\n <Stack flexWrap=\"wrap\" direction=\"row\" gap={0.5}>\n {tags.map((tag) => (\n <Chip size=\"small\" key={`${tag.key}=${tag.value}`} label={`${tag.key}: ${tag.value}`} />\n ))}\n </Stack>\n </Stack>\n\n <Divider sx={{ marginY: 2 }} />\n\n <Stack gap={0.5} direction=\"row\">\n <Typography variant=\"caption\">\n {start.date} - <strong>{start.time}</strong>\n </Typography>\n {end && (\n <>\n <Typography variant=\"caption\">{' → '}</Typography>\n <Typography variant=\"caption\">\n {end.date} - <strong>{end.time}</strong>\n </Typography>\n </>\n )}\n </Stack>\n </CardContent>\n </Card>\n );\n}\n\nexport interface AnnotationPreviewProps extends CardProps {\n spec: AnnotationSpec;\n}\n\nexport function AnnotationPreview({ spec, ...props }: AnnotationPreviewProps): ReactNode {\n const { data, isFetching, error } = useAnnotationData(spec);\n const { formatWithUserTimeZone } = useTimeZone();\n\n const [showAll, setShowAll] = useState<boolean>(false);\n const annotationsToShow = showAll ? data : data?.slice(0, 1);\n let notShown = 0;\n if (data && data?.length > 0 && annotationsToShow) {\n notShown = data.length - annotationsToShow.length;\n }\n\n const stateIndicator = useMemo((): ReactNode | undefined => {\n if (isFetching) {\n return <CircularProgress aria-label=\"loading\" size=\"1.125rem\" />;\n } else if (error) {\n return (\n <InfoTooltip description={error.toString()}>\n <IconButton aria-label=\"preview errors\" size=\"small\">\n <AlertIcon\n fontSize=\"inherit\"\n sx={{\n color: (theme) => theme.palette.error.main,\n }}\n />\n </IconButton>\n </InfoTooltip>\n );\n }\n }, [isFetching, error]);\n\n return (\n <Card variant=\"outlined\" {...props}>\n <CardHeader\n title={\n <Stack direction=\"row\" justifyContent=\"space-between\">\n <Typography variant=\"h4\">Preview Annotations</Typography>\n {stateIndicator}\n </Stack>\n }\n />\n <CardContent sx={{ display: 'flex', flexWrap: 'wrap', gap: 1, paddingY: 0 }}>\n {annotationsToShow?.map((item, index) => (\n <AnnotationPreviewCard\n key={index}\n value={item}\n formatWithUserTimeZone={formatWithUserTimeZone}\n sx={{ width: '100%' }}\n />\n ))}\n {notShown > 0 && (\n <Chip onClick={() => setShowAll(true)} variant=\"outlined\" size=\"small\" label={`+${notShown} more`} />\n )}\n {showAll && data && data.length > 1 && (\n <Chip onClick={() => setShowAll(false)} variant=\"outlined\" size=\"small\" label=\"-\" />\n )}\n </CardContent>\n </Card>\n );\n}\n"],"names":["React","useMemo","useState","Card","CardContent","CardHeader","Chip","CircularProgress","Divider","IconButton","Stack","Typography","useAnnotationData","InfoTooltip","useTimeZone","AlertIcon","formatDate","timeMs","format","Number","isFinite","date","time","d","Date","AnnotationPreviewCard","value","formatWithUserTimeZone","props","start","end","undefined","tags","Object","entries","map","key","gap","title","variant","legend","flexWrap","direction","tag","size","label","sx","marginY","strong","AnnotationPreview","spec","data","isFetching","error","showAll","setShowAll","annotationsToShow","slice","notShown","length","stateIndicator","aria-label","description","toString","fontSize","color","theme","palette","main","justifyContent","display","paddingY","item","index","width","onClick"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAOA,SAAoBC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAE5D,SACEC,IAAI,EACJC,WAAW,EACXC,UAAU,EAEVC,IAAI,EACJC,gBAAgB,EAChBC,OAAO,EACPC,UAAU,EACVC,KAAK,EACLC,UAAU,QACL,gBAAgB;AACvB,SAASC,iBAAiB,QAAQ,4BAA4B;AAC9D,SAASC,WAAW,EAAEC,WAAW,QAAQ,yBAAyB;AAClE,OAAOC,eAAe,wBAAwB;AAE9C,MAAMC,aAAa,CAACC,QAAgBC;IAClC,yCAAyC;IACzC,IAAI,CAACC,OAAOC,QAAQ,CAACH,SAAS;QAC5B,OAAO;YAAEI,MAAM;YAAOC,MAAM;QAAM;IACpC;IAEA,MAAMC,IAAI,IAAIC,KAAKP;IACnB,OAAO;QACLI,MAAMH,OAAOK,GAAG;QAChBD,MAAMJ,OAAOK,GAAG;IAClB;AACF;AAOA,SAASE,sBAAsB,EAAEC,KAAK,EAAEC,sBAAsB,EAAE,GAAGC,OAAmC;IACpG,MAAMC,QAAQb,WAAWU,MAAMG,KAAK,EAAEF;IACtC,MAAMG,MAAMJ,MAAMI,GAAG,KAAKC,YAA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BAAWK,MAAK;wBAAQC,OAAO,CAAC,CAAC,EAAEa,SAAS,KAAK,CAAC;;oBAElGJ,WAAWH,QAAQA,KAAKQ,MAAM,GAAG,mBAChC,KAACrD;wBAAKqE,SAAS,IAAMpB,WAAW;wBAAQhB,SAAQ;wBAAWK,MAAK;wBAAQC,OAAM;;;;;;AAKxF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Annotations/AnnotationEditorForm/index.ts"],"names":[],"mappings":"AAaA,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
export * from './AnnotationEditorForm';
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Annotations/AnnotationEditorForm/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './AnnotationEditorForm';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,yBAAyB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Annotations/index.ts"],"names":[],"mappings":"AAaA,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
export * from './AnnotationEditorForm';
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Annotations/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './AnnotationEditorForm';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,yBAAyB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qCAAqC,CAAC;AACpD,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qCAAqC,CAAC;AACpD,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
+
export * from './Annotations';
|
|
13
14
|
export * from './CalculationSelector';
|
|
14
15
|
export * from './DatasourceEditorForm';
|
|
15
16
|
export * from './DatasourceSelect';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './CalculationSelector';\nexport * from './DatasourceEditorForm';\nexport * from './DatasourceSelect';\nexport * from './HTTPSettingsEditor';\nexport * from './ItemSelectionActionsOptionsEditor';\nexport * from './LegendOptionsEditor';\nexport * from './MultiQueryEditor';\nexport * from './OptionsEditorRadios';\nexport * from './OptionsEditorTabs';\nexport * from './PanelSpecEditor';\nexport * from './PluginEditor';\nexport * from './PluginKindSelect';\nexport * from './PluginRegistry';\nexport * from './PluginSpecEditor';\nexport * from './TimeRangeControls';\nexport * from './Variables';\nexport * from './MetricLabelInput';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,wBAAwB;AACtC,cAAc,yBAAyB;AACvC,cAAc,qBAAqB;AACnC,cAAc,uBAAuB;AACrC,cAAc,sCAAsC;AACpD,cAAc,wBAAwB;AACtC,cAAc,qBAAqB;AACnC,cAAc,wBAAwB;AACtC,cAAc,sBAAsB;AACpC,cAAc,oBAAoB;AAClC,cAAc,iBAAiB;AAC/B,cAAc,qBAAqB;AACnC,cAAc,mBAAmB;AACjC,cAAc,qBAAqB;AACnC,cAAc,sBAAsB;AACpC,cAAc,cAAc;AAC5B,cAAc,qBAAqB"}
|
|
1
|
+
{"version":3,"sources":["../../src/components/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './Annotations';\nexport * from './CalculationSelector';\nexport * from './DatasourceEditorForm';\nexport * from './DatasourceSelect';\nexport * from './HTTPSettingsEditor';\nexport * from './ItemSelectionActionsOptionsEditor';\nexport * from './LegendOptionsEditor';\nexport * from './MultiQueryEditor';\nexport * from './OptionsEditorRadios';\nexport * from './OptionsEditorTabs';\nexport * from './PanelSpecEditor';\nexport * from './PluginEditor';\nexport * from './PluginKindSelect';\nexport * from './PluginRegistry';\nexport * from './PluginSpecEditor';\nexport * from './TimeRangeControls';\nexport * from './Variables';\nexport * from './MetricLabelInput';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,gBAAgB;AAC9B,cAAc,wBAAwB;AACtC,cAAc,yBAAyB;AACvC,cAAc,qBAAqB;AACnC,cAAc,uBAAuB;AACrC,cAAc,sCAAsC;AACpD,cAAc,wBAAwB;AACtC,cAAc,qBAAqB;AACnC,cAAc,wBAAwB;AACtC,cAAc,sBAAsB;AACpC,cAAc,oBAAoB;AAClC,cAAc,iBAAiB;AAC/B,cAAc,qBAAqB;AACnC,cAAc,mBAAmB;AACjC,cAAc,qBAAqB;AACnC,cAAc,sBAAsB;AACpC,cAAc,cAAc;AAC5B,cAAc,qBAAqB"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { PanelEditorValues, VariableDefinition, PluginSchema } from '@perses-dev/spec';
|
|
2
|
+
import { PanelEditorValues, VariableDefinition, PluginSchema, AnnotationSpec } from '@perses-dev/spec';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { DatasourceDefinition } from '@perses-dev/client';
|
|
5
5
|
export interface ValidationSchemas {
|
|
6
6
|
datasourceEditorSchema: z.Schema<DatasourceDefinition>;
|
|
7
7
|
panelEditorSchema: z.Schema<PanelEditorValues>;
|
|
8
8
|
variableEditorSchema: z.Schema<VariableDefinition>;
|
|
9
|
+
annotationEditorSchema: z.Schema<AnnotationSpec>;
|
|
9
10
|
setDatasourceEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;
|
|
10
11
|
setPanelEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;
|
|
11
12
|
setVariableEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;
|
|
13
|
+
setAnnotationEditorSchemaPlugin?: (pluginSchema: PluginSchema) => void;
|
|
12
14
|
}
|
|
13
15
|
export declare const ValidationSchemasContext: import("react").Context<ValidationSchemas | undefined>;
|
|
14
16
|
export declare function useValidationSchemas(): ValidationSchemas;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidationProvider.d.ts","sourceRoot":"","sources":["../../src/context/ValidationProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAiB,YAAY,EAAE,SAAS,EAAwB,MAAM,OAAO,CAAC;AACrF,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,
|
|
1
|
+
{"version":3,"file":"ValidationProvider.d.ts","sourceRoot":"","sources":["../../src/context/ValidationProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAiB,YAAY,EAAE,SAAS,EAAwB,MAAM,OAAO,CAAC;AACrF,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EAKZ,cAAc,EAGf,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAmC,oBAAoB,EAA8B,MAAM,oBAAoB,CAAC;AAEvH,MAAM,WAAW,iBAAiB;IAChC,sBAAsB,EAAE,CAAC,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;IACvD,iBAAiB,EAAE,CAAC,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAC/C,oBAAoB,EAAE,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;IACnD,sBAAsB,EAAE,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IACjD,+BAA+B,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;IACtE,0BAA0B,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;IACjE,6BAA6B,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;IACpE,+BAA+B,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;CACxE;AAED,eAAO,MAAM,wBAAwB,wDAA0D,CAAC;AAEhG,wBAAgB,oBAAoB,IAAI,iBAAiB,CAMxD;AAED,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,SAAS,CAAC;CACrB;AAKD,wBAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,EAAE,uBAAuB,GAAG,YAAY,CAwCtF"}
|
|
@@ -12,7 +12,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
14
|
import { createContext, useContext, useState } from 'react';
|
|
15
|
-
import { panelEditorSchema as defaultPanelEditorSchema, variableDefinitionSchema, buildPanelEditorSchema, buildVariableDefinitionSchema } from '@perses-dev/spec';
|
|
15
|
+
import { panelEditorSchema as defaultPanelEditorSchema, variableDefinitionSchema, buildPanelEditorSchema, buildVariableDefinitionSchema, annotationSpecSchema, buildAnnotationSpecSchema } from '@perses-dev/spec';
|
|
16
16
|
import { buildDatasourceDefinitionSchema, datasourceDefinitionSchema } from '@perses-dev/client';
|
|
17
17
|
export const ValidationSchemasContext = /*#__PURE__*/ createContext(undefined);
|
|
18
18
|
export function useValidationSchemas() {
|
|
@@ -28,6 +28,7 @@ export function useValidationSchemas() {
|
|
|
28
28
|
const [datasourceEditorSchema, setDatasourceEditorSchema] = useState(datasourceDefinitionSchema);
|
|
29
29
|
const [panelEditorSchema, setPanelEditorSchema] = useState(defaultPanelEditorSchema); // TODO I don't get why this does not compile
|
|
30
30
|
const [variableEditorSchema, setVariableEditorSchema] = useState(variableDefinitionSchema);
|
|
31
|
+
const [annotationEditorSchema, setAnnotationEditorSchema] = useState(annotationSpecSchema);
|
|
31
32
|
function setDatasourceEditorSchemaPlugin(pluginSchema) {
|
|
32
33
|
setDatasourceEditorSchema(buildDatasourceDefinitionSchema(pluginSchema));
|
|
33
34
|
}
|
|
@@ -37,14 +38,19 @@ export function useValidationSchemas() {
|
|
|
37
38
|
function setVariableEditorSchemaPlugin(pluginSchema) {
|
|
38
39
|
setVariableEditorSchema(buildVariableDefinitionSchema(pluginSchema));
|
|
39
40
|
}
|
|
41
|
+
function setAnnotationEditorSchemaPlugin(pluginSchema) {
|
|
42
|
+
setAnnotationEditorSchema(buildAnnotationSpecSchema(pluginSchema));
|
|
43
|
+
}
|
|
40
44
|
return /*#__PURE__*/ _jsx(ValidationSchemasContext.Provider, {
|
|
41
45
|
value: {
|
|
42
46
|
datasourceEditorSchema,
|
|
43
47
|
panelEditorSchema,
|
|
44
48
|
variableEditorSchema,
|
|
49
|
+
annotationEditorSchema,
|
|
45
50
|
setDatasourceEditorSchemaPlugin,
|
|
46
51
|
setPanelEditorSchemaPlugin,
|
|
47
|
-
setVariableEditorSchemaPlugin
|
|
52
|
+
setVariableEditorSchemaPlugin,
|
|
53
|
+
setAnnotationEditorSchemaPlugin
|
|
48
54
|
},
|
|
49
55
|
children: children
|
|
50
56
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/context/ValidationProvider.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { createContext, ReactElement, ReactNode, useContext, useState } from 'react';\nimport {\n PanelEditorValues,\n VariableDefinition,\n PluginSchema,\n panelEditorSchema as defaultPanelEditorSchema,\n variableDefinitionSchema,\n buildPanelEditorSchema,\n buildVariableDefinitionSchema,\n} from '@perses-dev/spec';\n\nimport { z } from 'zod';\nimport { buildDatasourceDefinitionSchema, DatasourceDefinition, datasourceDefinitionSchema } from '@perses-dev/client';\n\nexport interface ValidationSchemas {\n datasourceEditorSchema: z.Schema<DatasourceDefinition>;\n panelEditorSchema: z.Schema<PanelEditorValues>;\n variableEditorSchema: z.Schema<VariableDefinition>;\n setDatasourceEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;\n setPanelEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;\n setVariableEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;\n}\n\nexport const ValidationSchemasContext = createContext<ValidationSchemas | undefined>(undefined);\n\nexport function useValidationSchemas(): ValidationSchemas {\n const ctx = useContext(ValidationSchemasContext);\n if (ctx === undefined) {\n throw new Error('No ValidationSchemasContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\ninterface ValidationProviderProps {\n children: ReactNode;\n}\n\n/*\n * Provide validation schemas for forms handling plugins (datasources, variables, panels).\n */\nexport function ValidationProvider({ children }: ValidationProviderProps): ReactElement {\n const [datasourceEditorSchema, setDatasourceEditorSchema] =\n useState<z.Schema<DatasourceDefinition>>(datasourceDefinitionSchema);\n const [panelEditorSchema, setPanelEditorSchema] = useState<z.Schema<PanelEditorValues>>(defaultPanelEditorSchema); // TODO I don't get why this does not compile\n const [variableEditorSchema, setVariableEditorSchema] =\n useState<z.Schema<VariableDefinition>>(variableDefinitionSchema);\n\n function setDatasourceEditorSchemaPlugin(pluginSchema: PluginSchema): void {\n setDatasourceEditorSchema(buildDatasourceDefinitionSchema(pluginSchema));\n }\n\n function setPanelEditorSchemaPlugin(pluginSchema: PluginSchema): void {\n setPanelEditorSchema(buildPanelEditorSchema(pluginSchema));\n }\n\n function setVariableEditorSchemaPlugin(pluginSchema: PluginSchema): void {\n setVariableEditorSchema(buildVariableDefinitionSchema(pluginSchema));\n }\n\n return (\n <ValidationSchemasContext.Provider\n value={{\n datasourceEditorSchema,\n panelEditorSchema,\n variableEditorSchema,\n setDatasourceEditorSchemaPlugin,\n setPanelEditorSchemaPlugin,\n setVariableEditorSchemaPlugin,\n }}\n >\n {children}\n </ValidationSchemasContext.Provider>\n );\n}\n"],"names":["createContext","useContext","useState","panelEditorSchema","defaultPanelEditorSchema","variableDefinitionSchema","buildPanelEditorSchema","buildVariableDefinitionSchema","buildDatasourceDefinitionSchema","datasourceDefinitionSchema","ValidationSchemasContext","undefined","useValidationSchemas","ctx","Error","ValidationProvider","children","datasourceEditorSchema","setDatasourceEditorSchema","setPanelEditorSchema","variableEditorSchema","setVariableEditorSchema","setDatasourceEditorSchemaPlugin","pluginSchema","setPanelEditorSchemaPlugin","setVariableEditorSchemaPlugin","Provider","value"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,aAAa,EAA2BC,UAAU,EAAEC,QAAQ,QAAQ,QAAQ;AACrF,SAIEC,qBAAqBC,wBAAwB,EAC7CC,wBAAwB,EACxBC,sBAAsB,EACtBC,6BAA6B,
|
|
1
|
+
{"version":3,"sources":["../../src/context/ValidationProvider.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { createContext, ReactElement, ReactNode, useContext, useState } from 'react';\nimport {\n PanelEditorValues,\n VariableDefinition,\n PluginSchema,\n panelEditorSchema as defaultPanelEditorSchema,\n variableDefinitionSchema,\n buildPanelEditorSchema,\n buildVariableDefinitionSchema,\n AnnotationSpec,\n annotationSpecSchema,\n buildAnnotationSpecSchema,\n} from '@perses-dev/spec';\n\nimport { z } from 'zod';\nimport { buildDatasourceDefinitionSchema, DatasourceDefinition, datasourceDefinitionSchema } from '@perses-dev/client';\n\nexport interface ValidationSchemas {\n datasourceEditorSchema: z.Schema<DatasourceDefinition>;\n panelEditorSchema: z.Schema<PanelEditorValues>;\n variableEditorSchema: z.Schema<VariableDefinition>;\n annotationEditorSchema: z.Schema<AnnotationSpec>;\n setDatasourceEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;\n setPanelEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;\n setVariableEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;\n setAnnotationEditorSchemaPlugin?: (pluginSchema: PluginSchema) => void;\n}\n\nexport const ValidationSchemasContext = createContext<ValidationSchemas | undefined>(undefined);\n\nexport function useValidationSchemas(): ValidationSchemas {\n const ctx = useContext(ValidationSchemasContext);\n if (ctx === undefined) {\n throw new Error('No ValidationSchemasContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\ninterface ValidationProviderProps {\n children: ReactNode;\n}\n\n/*\n * Provide validation schemas for forms handling plugins (datasources, variables, panels).\n */\nexport function ValidationProvider({ children }: ValidationProviderProps): ReactElement {\n const [datasourceEditorSchema, setDatasourceEditorSchema] =\n useState<z.Schema<DatasourceDefinition>>(datasourceDefinitionSchema);\n const [panelEditorSchema, setPanelEditorSchema] = useState<z.Schema<PanelEditorValues>>(defaultPanelEditorSchema); // TODO I don't get why this does not compile\n const [variableEditorSchema, setVariableEditorSchema] =\n useState<z.Schema<VariableDefinition>>(variableDefinitionSchema);\n const [annotationEditorSchema, setAnnotationEditorSchema] = useState<z.Schema<AnnotationSpec>>(annotationSpecSchema);\n\n function setDatasourceEditorSchemaPlugin(pluginSchema: PluginSchema): void {\n setDatasourceEditorSchema(buildDatasourceDefinitionSchema(pluginSchema));\n }\n\n function setPanelEditorSchemaPlugin(pluginSchema: PluginSchema): void {\n setPanelEditorSchema(buildPanelEditorSchema(pluginSchema));\n }\n\n function setVariableEditorSchemaPlugin(pluginSchema: PluginSchema): void {\n setVariableEditorSchema(buildVariableDefinitionSchema(pluginSchema));\n }\n\n function setAnnotationEditorSchemaPlugin(pluginSchema: PluginSchema): void {\n setAnnotationEditorSchema(buildAnnotationSpecSchema(pluginSchema));\n }\n\n return (\n <ValidationSchemasContext.Provider\n value={{\n datasourceEditorSchema,\n panelEditorSchema,\n variableEditorSchema,\n annotationEditorSchema,\n setDatasourceEditorSchemaPlugin,\n setPanelEditorSchemaPlugin,\n setVariableEditorSchemaPlugin,\n setAnnotationEditorSchemaPlugin,\n }}\n >\n {children}\n </ValidationSchemasContext.Provider>\n );\n}\n"],"names":["createContext","useContext","useState","panelEditorSchema","defaultPanelEditorSchema","variableDefinitionSchema","buildPanelEditorSchema","buildVariableDefinitionSchema","annotationSpecSchema","buildAnnotationSpecSchema","buildDatasourceDefinitionSchema","datasourceDefinitionSchema","ValidationSchemasContext","undefined","useValidationSchemas","ctx","Error","ValidationProvider","children","datasourceEditorSchema","setDatasourceEditorSchema","setPanelEditorSchema","variableEditorSchema","setVariableEditorSchema","annotationEditorSchema","setAnnotationEditorSchema","setDatasourceEditorSchemaPlugin","pluginSchema","setPanelEditorSchemaPlugin","setVariableEditorSchemaPlugin","setAnnotationEditorSchemaPlugin","Provider","value"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,aAAa,EAA2BC,UAAU,EAAEC,QAAQ,QAAQ,QAAQ;AACrF,SAIEC,qBAAqBC,wBAAwB,EAC7CC,wBAAwB,EACxBC,sBAAsB,EACtBC,6BAA6B,EAE7BC,oBAAoB,EACpBC,yBAAyB,QACpB,mBAAmB;AAG1B,SAASC,+BAA+B,EAAwBC,0BAA0B,QAAQ,qBAAqB;AAavH,OAAO,MAAMC,yCAA2BZ,cAA6Ca,WAAW;AAEhG,OAAO,SAASC;IACd,MAAMC,MAAMd,WAAWW;IACvB,IAAIG,QAAQF,WAAW;QACrB,MAAM,IAAIG,MAAM;IAClB;IACA,OAAOD;AACT;AAMA;;CAEC,GACD,OAAO,SAASE,mBAAmB,EAAEC,QAAQ,EAA2B;IACtE,MAAM,CAACC,wBAAwBC,0BAA0B,GACvDlB,SAAyCS;IAC3C,MAAM,CAACR,mBAAmBkB,qBAAqB,GAAGnB,SAAsCE,2BAA2B,6CAA6C;IAChK,MAAM,CAACkB,sBAAsBC,wBAAwB,GACnDrB,SAAuCG;IACzC,MAAM,CAACmB,wBAAwBC,0BAA0B,GAAGvB,SAAmCM;IAE/F,SAASkB,gCAAgCC,YAA0B;QACjEP,0BAA0BV,gCAAgCiB;IAC5D;IAEA,SAASC,2BAA2BD,YAA0B;QAC5DN,qBAAqBf,uBAAuBqB;IAC9C;IAEA,SAASE,8BAA8BF,YAA0B;QAC/DJ,wBAAwBhB,8BAA8BoB;IACxD;IAEA,SAASG,gCAAgCH,YAA0B;QACjEF,0BAA0BhB,0BAA0BkB;IACtD;IAEA,qBACE,KAACf,yBAAyBmB,QAAQ;QAChCC,OAAO;YACLb;YACAhB;YACAmB;YACAE;YACAE;YACAE;YACAC;YACAC;QACF;kBAECZ;;AAGP"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AbsoluteTimeRange, AnnotationData, UnknownSpec } from '@perses-dev/spec';
|
|
2
|
+
import { DatasourceStore, VariableStateMap } from '@perses-dev/plugin-system';
|
|
3
|
+
import { Plugin } from './plugin-base';
|
|
4
|
+
/**
|
|
5
|
+
* An object containing all the dependencies of a AnnotationQuery.
|
|
6
|
+
*/
|
|
7
|
+
export type AnnotationQueryQueryPluginDependencies = {
|
|
8
|
+
/**
|
|
9
|
+
* Returns a list of variables name this annotation query depends on.
|
|
10
|
+
*/
|
|
11
|
+
variables?: string[];
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A plugin for running annotation queries.
|
|
15
|
+
*/
|
|
16
|
+
export interface AnnotationPlugin<Spec = UnknownSpec> extends Plugin<Spec> {
|
|
17
|
+
getAnnotationData: (spec: Spec, ctx: AnnotationContext, abortSignal?: AbortSignal) => Promise<AnnotationData[]>;
|
|
18
|
+
dependsOn?: (spec: Spec, ctx: AnnotationContext) => AnnotationQueryQueryPluginDependencies;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Context available to AnnotationQuery plugins at runtime.
|
|
22
|
+
*/
|
|
23
|
+
export interface AnnotationContext {
|
|
24
|
+
datasourceStore: DatasourceStore;
|
|
25
|
+
absoluteTimeRange: AbsoluteTimeRange;
|
|
26
|
+
variableState: VariableStateMap;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=annotations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../../src/model/annotations.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC;;GAEG;AACH,MAAM,MAAM,sCAAsC,GAAG;IACnD;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,IAAI,GAAG,WAAW,CAAE,SAAQ,MAAM,CAAC,IAAI,CAAC;IACxE,iBAAiB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,iBAAiB,EAAE,WAAW,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAChH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,iBAAiB,KAAK,sCAAsC,CAAC;CAC5F;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE,eAAe,CAAC;IACjC,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,aAAa,EAAE,gBAAgB,CAAC;CACjC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
/**
|
|
14
|
+
* Context available to AnnotationQuery plugins at runtime.
|
|
15
|
+
*/ export { };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=annotations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/annotations.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { AbsoluteTimeRange, AnnotationData, UnknownSpec } from '@perses-dev/spec';\nimport { DatasourceStore, VariableStateMap } from '@perses-dev/plugin-system';\nimport { Plugin } from './plugin-base';\n\n/**\n * An object containing all the dependencies of a AnnotationQuery.\n */\nexport type AnnotationQueryQueryPluginDependencies = {\n /**\n * Returns a list of variables name this annotation query depends on.\n */\n variables?: string[];\n};\n\n/**\n * A plugin for running annotation queries.\n */\nexport interface AnnotationPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getAnnotationData: (spec: Spec, ctx: AnnotationContext, abortSignal?: AbortSignal) => Promise<AnnotationData[]>;\n dependsOn?: (spec: Spec, ctx: AnnotationContext) => AnnotationQueryQueryPluginDependencies;\n}\n\n/**\n * Context available to AnnotationQuery plugins at runtime.\n */\nexport interface AnnotationContext {\n datasourceStore: DatasourceStore;\n absoluteTimeRange: AbsoluteTimeRange;\n variableState: VariableStateMap;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAwBjC;;CAEC,GACD,WAIC"}
|
package/dist/model/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAaA,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAaA,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
|
package/dist/model/index.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
+
export * from './annotations';
|
|
13
14
|
export * from './datasource';
|
|
14
15
|
export * from './legend';
|
|
15
16
|
export * from './log-queries';
|
package/dist/model/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './datasource';\nexport * from './legend';\nexport * from './log-queries';\nexport * from './log-volume-utils';\nexport * from './panels';\nexport * from './plugins';\nexport * from './plugin-base';\nexport * from './plugin-loading';\nexport * from './time-series-queries';\nexport * from './trace-queries';\nexport * from './profile-queries';\nexport * from './variables';\nexport * from './calculations';\nexport * from './alerts-queries';\nexport * from './silences-queries';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,eAAe;AAC7B,cAAc,WAAW;AACzB,cAAc,gBAAgB;AAC9B,cAAc,qBAAqB;AACnC,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,cAAc,gBAAgB;AAC9B,cAAc,mBAAmB;AACjC,cAAc,wBAAwB;AACtC,cAAc,kBAAkB;AAChC,cAAc,oBAAoB;AAClC,cAAc,cAAc;AAC5B,cAAc,iBAAiB;AAC/B,cAAc,mBAAmB;AACjC,cAAc,qBAAqB"}
|
|
1
|
+
{"version":3,"sources":["../../src/model/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './annotations';\nexport * from './datasource';\nexport * from './legend';\nexport * from './log-queries';\nexport * from './log-volume-utils';\nexport * from './panels';\nexport * from './plugins';\nexport * from './plugin-base';\nexport * from './plugin-loading';\nexport * from './time-series-queries';\nexport * from './trace-queries';\nexport * from './profile-queries';\nexport * from './variables';\nexport * from './calculations';\nexport * from './alerts-queries';\nexport * from './silences-queries';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,gBAAgB;AAC9B,cAAc,eAAe;AAC7B,cAAc,WAAW;AACzB,cAAc,gBAAgB;AAC9B,cAAc,qBAAqB;AACnC,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,cAAc,gBAAgB;AAC9B,cAAc,mBAAmB;AACjC,cAAc,wBAAwB;AACtC,cAAc,kBAAkB;AAChC,cAAc,oBAAoB;AAClC,cAAc,cAAc;AAC5B,cAAc,iBAAiB;AAC/B,cAAc,mBAAmB;AACjC,cAAc,qBAAqB"}
|
package/dist/model/plugins.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { ProfileQueryPlugin } from './profile-queries';
|
|
|
8
8
|
import { VariablePlugin } from './variables';
|
|
9
9
|
import { ExplorePlugin } from './explore';
|
|
10
10
|
import { LogQueryPlugin } from './log-queries';
|
|
11
|
+
import { AnnotationPlugin } from './annotations';
|
|
11
12
|
import { AlertsQueryPlugin } from './alerts-queries';
|
|
12
13
|
import { SilencesQueryPlugin } from './silences-queries';
|
|
13
14
|
export interface PluginModuleSpec {
|
|
@@ -62,6 +63,7 @@ export type PluginType = {
|
|
|
62
63
|
*/
|
|
63
64
|
export interface SupportedPlugins {
|
|
64
65
|
Variable: VariablePlugin;
|
|
66
|
+
Annotation: AnnotationPlugin;
|
|
65
67
|
Panel: PanelPlugin;
|
|
66
68
|
TimeSeriesQuery: TimeSeriesQueryPlugin;
|
|
67
69
|
TraceQuery: TraceQueryPlugin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/model/plugins.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,cAAc,EAA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AI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,MAAM,CAGT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model/plugins.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { UnknownSpec } from '@perses-dev/spec';\nimport { DatasourcePlugin } from './datasource';\nimport { PanelPlugin } from './panels';\nimport { Plugin } from './plugin-base';\nimport { TimeSeriesQueryPlugin } from './time-series-queries';\nimport { TraceQueryPlugin } from './trace-queries';\nimport { ProfileQueryPlugin } from './profile-queries';\nimport { VariablePlugin } from './variables';\nimport { ExplorePlugin } from './explore';\nimport { LogQueryPlugin } from './log-queries';\nimport { AlertsQueryPlugin } from './alerts-queries';\nimport { SilencesQueryPlugin } from './silences-queries';\n\nexport interface PluginModuleSpec {\n plugins: PluginMetadata[];\n}\n\nexport interface PluginMetadataWithModule extends PluginMetadata {\n module: PluginModuleMetadata;\n}\n\n/**\n * Metadata about an individual plugin that's part of a PluginModule.\n */\nexport interface PluginMetadata {\n kind: PluginType;\n metadata?: {\n version?: string;\n registry?: string;\n };\n spec: {\n name: string;\n display: {\n name: string;\n description?: string;\n };\n };\n}\n\n/**\n * Metadata about a module/package that contains plugins.\n */\nexport interface PluginModuleMetadata {\n name: string;\n version: string;\n registry?: string;\n}\n\n/**\n * Information about a module/package that contains plugins.\n */\nexport interface PluginModuleResource {\n kind: 'PluginModule';\n metadata: PluginModuleMetadata;\n spec: PluginModuleSpec;\n}\n\n/**\n * All supported plugin types. A plugin's implementation must extend from `Plugin<UnknownSpec>` to be considered a valid\n * `PluginType`.\n */\nexport type PluginType = {\n // Filter out implementations on SupportedPlugins that don't extend `Plugin<UnknownSpec>`\n [K in keyof SupportedPlugins]: SupportedPlugins[K] extends Plugin<UnknownSpec> ? K : never;\n}[keyof SupportedPlugins];\n\n/**\n * Map of plugin type key/string -> implementation type. Use Typescript module augmentation to extend the plugin system\n * with new plugin types.\n */\nexport interface SupportedPlugins {\n Variable: VariablePlugin;\n Panel: PanelPlugin;\n TimeSeriesQuery: TimeSeriesQueryPlugin;\n TraceQuery: TraceQueryPlugin;\n ProfileQuery: ProfileQueryPlugin;\n LogQuery: LogQueryPlugin;\n AlertsQuery: AlertsQueryPlugin;\n SilencesQuery: SilencesQueryPlugin;\n Datasource: DatasourcePlugin;\n Explore: ExplorePlugin;\n}\n\n/**\n * The implementation for a given plugin type.\n */\nexport type PluginImplementation<Type extends PluginType> = SupportedPlugins[Type];\n\n/**\n * Default plugin kinds by plugin type.\n */\ntype PluginKinds = Partial<Record<PluginType, string>>;\nexport type DefaultPluginKinds = Required<Pick<PluginKinds, 'TimeSeriesQuery'>> & Omit<PluginKinds, 'TimeSeriesQuery'>;\n\nexport type PluginCompoundKey<T extends PluginType> = {\n kind: T;\n name: string;\n registry?: string;\n version?: string;\n};\n\nexport function getPluginModuleCompoundKey(compoundKey: {\n kind: string;\n name: string;\n registry?: string;\n version?: string;\n}): string {\n const { kind, name, registry, version } = compoundKey;\n return `${kind}:${name}:${registry ?? ''}:${version ?? ''}`;\n}\n"],"names":["getPluginModuleCompoundKey","compoundKey","kind","name","registry","version"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;
|
|
1
|
+
{"version":3,"sources":["../../src/model/plugins.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { UnknownSpec } from '@perses-dev/spec';\nimport { DatasourcePlugin } from './datasource';\nimport { PanelPlugin } from './panels';\nimport { Plugin } from './plugin-base';\nimport { TimeSeriesQueryPlugin } from './time-series-queries';\nimport { TraceQueryPlugin } from './trace-queries';\nimport { ProfileQueryPlugin } from './profile-queries';\nimport { VariablePlugin } from './variables';\nimport { ExplorePlugin } from './explore';\nimport { LogQueryPlugin } from './log-queries';\nimport { AnnotationPlugin } from './annotations';\nimport { AlertsQueryPlugin } from './alerts-queries';\nimport { SilencesQueryPlugin } from './silences-queries';\n\nexport interface PluginModuleSpec {\n plugins: PluginMetadata[];\n}\n\nexport interface PluginMetadataWithModule extends PluginMetadata {\n module: PluginModuleMetadata;\n}\n\n/**\n * Metadata about an individual plugin that's part of a PluginModule.\n */\nexport interface PluginMetadata {\n kind: PluginType;\n metadata?: {\n version?: string;\n registry?: string;\n };\n spec: {\n name: string;\n display: {\n name: string;\n description?: string;\n };\n };\n}\n\n/**\n * Metadata about a module/package that contains plugins.\n */\nexport interface PluginModuleMetadata {\n name: string;\n version: string;\n registry?: string;\n}\n\n/**\n * Information about a module/package that contains plugins.\n */\nexport interface PluginModuleResource {\n kind: 'PluginModule';\n metadata: PluginModuleMetadata;\n spec: PluginModuleSpec;\n}\n\n/**\n * All supported plugin types. A plugin's implementation must extend from `Plugin<UnknownSpec>` to be considered a valid\n * `PluginType`.\n */\nexport type PluginType = {\n // Filter out implementations on SupportedPlugins that don't extend `Plugin<UnknownSpec>`\n [K in keyof SupportedPlugins]: SupportedPlugins[K] extends Plugin<UnknownSpec> ? K : never;\n}[keyof SupportedPlugins];\n\n/**\n * Map of plugin type key/string -> implementation type. Use Typescript module augmentation to extend the plugin system\n * with new plugin types.\n */\nexport interface SupportedPlugins {\n Variable: VariablePlugin;\n Annotation: AnnotationPlugin;\n Panel: PanelPlugin;\n TimeSeriesQuery: TimeSeriesQueryPlugin;\n TraceQuery: TraceQueryPlugin;\n ProfileQuery: ProfileQueryPlugin;\n LogQuery: LogQueryPlugin;\n AlertsQuery: AlertsQueryPlugin;\n SilencesQuery: SilencesQueryPlugin;\n Datasource: DatasourcePlugin;\n Explore: ExplorePlugin;\n}\n\n/**\n * The implementation for a given plugin type.\n */\nexport type PluginImplementation<Type extends PluginType> = SupportedPlugins[Type];\n\n/**\n * Default plugin kinds by plugin type.\n */\ntype PluginKinds = Partial<Record<PluginType, string>>;\nexport type DefaultPluginKinds = Required<Pick<PluginKinds, 'TimeSeriesQuery'>> & Omit<PluginKinds, 'TimeSeriesQuery'>;\n\nexport type PluginCompoundKey<T extends PluginType> = {\n kind: T;\n name: string;\n registry?: string;\n version?: string;\n};\n\nexport function getPluginModuleCompoundKey(compoundKey: {\n kind: string;\n name: string;\n registry?: string;\n version?: string;\n}): string {\n const { kind, name, registry, version } = compoundKey;\n return `${kind}:${name}:${registry ?? ''}:${version ?? ''}`;\n}\n"],"names":["getPluginModuleCompoundKey","compoundKey","kind","name","registry","version"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAyGjC,OAAO,SAASA,2BAA2BC,WAK1C;IACC,MAAM,EAAEC,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAE,GAAGJ;IAC1C,OAAO,GAAGC,KAAK,CAAC,EAAEC,KAAK,CAAC,EAAEC,YAAY,GAAG,CAAC,EAAEC,WAAW,IAAI;AAC7D"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AnnotationData, AnnotationSpec } from '@perses-dev/spec';
|
|
2
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
export declare const ANNOTATION_KEY = "Annotation";
|
|
4
|
+
export declare function useAnnotations(definitions: AnnotationSpec[]): Array<UseQueryResult<AnnotationData[]>>;
|
|
5
|
+
export declare function useAnnotationData(spec: AnnotationSpec): UseQueryResult<AnnotationData[]>;
|
|
6
|
+
//# sourceMappingURL=annotations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../../src/runtime/annotations.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAkC,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAQvF,eAAO,MAAM,cAAc,eAAe,CAAC;AA+C3C,wBAAgB,cAAc,CAAC,WAAW,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,EAAE,CAAC,CAAC,CA8BrG;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,cAAc,GAAG,cAAc,CAAC,cAAc,EAAE,CAAC,CAsCxF"}
|