@perses-dev/plugin-system 0.52.0 → 0.53.0-beta.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/dist/cjs/components/{DatasourceSelect.js → DatasourceSelect/DatasourceSelect.js} +2 -2
- package/dist/cjs/components/DatasourceSelect/index.js +30 -0
- package/dist/cjs/components/MultiQueryEditor/MultiQueryEditor.js +11 -5
- package/dist/cjs/components/MultiQueryEditor/QueryEditorContainer.js +5 -3
- package/dist/cjs/components/PluginEditor/PluginEditor.js +3 -2
- package/dist/cjs/components/PluginEditor/plugin-editor-api.js +4 -4
- package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +9 -3
- package/dist/cjs/components/PluginRegistry/PluginRegistry.js +2 -2
- package/dist/cjs/components/PluginRegistry/plugin-indexes.js +2 -2
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +5 -1
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +25 -34
- package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +33 -19
- package/dist/cjs/components/Variables/VariableEditorForm/index.js +1 -0
- package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +47 -0
- package/dist/cjs/components/Variables/variable-model.js +3 -3
- package/dist/cjs/components/index.js +0 -1
- package/dist/cjs/context/index.js +0 -1
- package/dist/cjs/remote/remotePluginLoader.js +19 -4
- package/dist/cjs/runtime/UsageMetricsProvider.js +4 -3
- package/dist/cjs/runtime/time-series-queries.js +4 -4
- package/dist/cjs/runtime/trace-queries.js +0 -11
- package/dist/cjs/test/mock-data.js +158 -0
- package/dist/cjs/utils/event.js +30 -0
- package/dist/cjs/utils/index.js +1 -0
- package/dist/components/{DatasourceSelect.d.ts → DatasourceSelect/DatasourceSelect.d.ts} +1 -1
- package/dist/components/DatasourceSelect/DatasourceSelect.d.ts.map +1 -0
- package/dist/components/{DatasourceSelect.js → DatasourceSelect/DatasourceSelect.js} +2 -2
- package/dist/components/DatasourceSelect/DatasourceSelect.js.map +1 -0
- package/dist/components/DatasourceSelect/index.d.ts +2 -0
- package/dist/components/DatasourceSelect/index.d.ts.map +1 -0
- package/dist/components/DatasourceSelect/index.js +15 -0
- package/dist/components/DatasourceSelect/index.js.map +1 -0
- package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts +1 -0
- package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts.map +1 -1
- package/dist/components/MultiQueryEditor/MultiQueryEditor.js +11 -5
- package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -1
- package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts +1 -0
- package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts.map +1 -1
- package/dist/components/MultiQueryEditor/QueryEditorContainer.js +5 -3
- package/dist/components/MultiQueryEditor/QueryEditorContainer.js.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.d.ts.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.js +3 -2
- package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.d.ts +1 -0
- package/dist/components/PluginEditor/plugin-editor-api.d.ts.map +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.js +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +1 -0
- package/dist/components/PluginKindSelect/PluginKindSelect.d.ts.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.js +9 -3
- package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.d.ts.map +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.js +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
- package/dist/components/PluginRegistry/plugin-indexes.d.ts.map +1 -1
- package/dist/components/PluginRegistry/plugin-indexes.js +1 -1
- package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js +5 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +25 -34
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts +2 -0
- package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js +33 -19
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/index.d.ts +1 -0
- package/dist/components/Variables/VariableEditorForm/index.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/index.js +1 -0
- package/dist/components/Variables/VariableEditorForm/index.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +6 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +44 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
- package/dist/components/Variables/variable-model.js +3 -3
- package/dist/components/Variables/variable-model.js.map +1 -1
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +0 -1
- package/dist/components/index.js.map +1 -1
- package/dist/context/index.d.ts +0 -1
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +0 -1
- package/dist/context/index.js.map +1 -1
- package/dist/model/time-series-queries.d.ts +1 -1
- package/dist/model/time-series-queries.d.ts.map +1 -1
- package/dist/model/time-series-queries.js.map +1 -1
- package/dist/model/variables.d.ts +1 -1
- package/dist/model/variables.d.ts.map +1 -1
- package/dist/model/variables.js.map +1 -1
- package/dist/remote/remotePluginLoader.d.ts +18 -1
- package/dist/remote/remotePluginLoader.d.ts.map +1 -1
- package/dist/remote/remotePluginLoader.js +22 -4
- package/dist/remote/remotePluginLoader.js.map +1 -1
- package/dist/runtime/UsageMetricsProvider.d.ts +3 -1
- package/dist/runtime/UsageMetricsProvider.d.ts.map +1 -1
- package/dist/runtime/UsageMetricsProvider.js +4 -3
- package/dist/runtime/UsageMetricsProvider.js.map +1 -1
- package/dist/runtime/profile-queries.d.ts.map +1 -1
- package/dist/runtime/profile-queries.js.map +1 -1
- package/dist/runtime/time-series-queries.d.ts.map +1 -1
- package/dist/runtime/time-series-queries.js +4 -4
- package/dist/runtime/time-series-queries.js.map +1 -1
- package/dist/runtime/trace-queries.d.ts +1 -5
- package/dist/runtime/trace-queries.d.ts.map +1 -1
- package/dist/runtime/trace-queries.js +0 -8
- package/dist/runtime/trace-queries.js.map +1 -1
- package/dist/test/mock-data.d.ts +134 -0
- package/dist/test/mock-data.d.ts.map +1 -1
- package/dist/test/mock-data.js +135 -0
- package/dist/test/mock-data.js.map +1 -1
- package/dist/utils/event.d.ts +8 -0
- package/dist/utils/event.d.ts.map +1 -0
- package/dist/utils/event.js +27 -0
- package/dist/utils/event.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/cjs/components/ProjectSelect.js +0 -96
- package/dist/cjs/context/ProjectStoreProvider.js +0 -81
- package/dist/cjs/context/query-params.js +0 -49
- package/dist/components/DatasourceSelect.d.ts.map +0 -1
- package/dist/components/DatasourceSelect.js.map +0 -1
- package/dist/components/ProjectSelect.d.ts +0 -15
- package/dist/components/ProjectSelect.d.ts.map +0 -1
- package/dist/components/ProjectSelect.js +0 -91
- package/dist/components/ProjectSelect.js.map +0 -1
- package/dist/context/ProjectStoreProvider.d.ts +0 -16
- package/dist/context/ProjectStoreProvider.d.ts.map +0 -1
- package/dist/context/ProjectStoreProvider.js +0 -59
- package/dist/context/ProjectStoreProvider.js.map +0 -1
- package/dist/context/query-params.d.ts +0 -5
- package/dist/context/query-params.d.ts.map +0 -1
- package/dist/context/query-params.js +0 -41
- package/dist/context/query-params.js.map +0 -1
package/dist/test/mock-data.js
CHANGED
|
@@ -122,5 +122,140 @@ export const MOCK_PROFILE_DATA = {
|
|
|
122
122
|
name: 'cpu'
|
|
123
123
|
}
|
|
124
124
|
};
|
|
125
|
+
// Remote Plugin Loader Test Fixtures
|
|
126
|
+
export const MOCK_VALID_PLUGIN_METADATA = {
|
|
127
|
+
kind: 'Panel',
|
|
128
|
+
spec: {
|
|
129
|
+
name: 'testPlugin',
|
|
130
|
+
display: {
|
|
131
|
+
name: 'Test Plugin',
|
|
132
|
+
description: 'A test plugin for unit testing'
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
export const MOCK_VALID_PLUGIN_MODULE_RESOURCE = {
|
|
137
|
+
kind: 'PluginModule',
|
|
138
|
+
metadata: {
|
|
139
|
+
name: 'test-module',
|
|
140
|
+
version: '1.0.0'
|
|
141
|
+
},
|
|
142
|
+
spec: {
|
|
143
|
+
plugins: [
|
|
144
|
+
MOCK_VALID_PLUGIN_METADATA
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
export const MOCK_INVALID_PLUGIN_MODULE = {
|
|
149
|
+
// Missing required fields
|
|
150
|
+
metadata: {
|
|
151
|
+
name: 'invalid-module'
|
|
152
|
+
},
|
|
153
|
+
spec: {
|
|
154
|
+
plugins: [
|
|
155
|
+
{
|
|
156
|
+
// Missing required fields
|
|
157
|
+
kind: 'Panel'
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
export const MOCK_MIXED_VALIDITY_PLUGIN_MODULES = [
|
|
163
|
+
MOCK_VALID_PLUGIN_MODULE_RESOURCE,
|
|
164
|
+
MOCK_INVALID_PLUGIN_MODULE,
|
|
165
|
+
{
|
|
166
|
+
kind: 'PluginModule',
|
|
167
|
+
metadata: {
|
|
168
|
+
name: 'another-valid-module',
|
|
169
|
+
version: '2.0.0'
|
|
170
|
+
},
|
|
171
|
+
spec: {
|
|
172
|
+
plugins: [
|
|
173
|
+
{
|
|
174
|
+
kind: 'Variable',
|
|
175
|
+
spec: {
|
|
176
|
+
name: 'anotherPlugin',
|
|
177
|
+
display: {
|
|
178
|
+
name: 'Another Plugin'
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
];
|
|
186
|
+
export const MOCK_REMOTE_PLUGIN_MODULE = {
|
|
187
|
+
testPlugin: {
|
|
188
|
+
component: ()=>null,
|
|
189
|
+
createDefaultOptions: ()=>({})
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
export const MOCK_MULTI_PLUGIN_MODULE = {
|
|
193
|
+
kind: 'PluginModule',
|
|
194
|
+
metadata: {
|
|
195
|
+
name: 'multi-plugin-module',
|
|
196
|
+
version: '1.0.0'
|
|
197
|
+
},
|
|
198
|
+
spec: {
|
|
199
|
+
plugins: [
|
|
200
|
+
{
|
|
201
|
+
kind: 'Panel',
|
|
202
|
+
spec: {
|
|
203
|
+
name: 'plugin1',
|
|
204
|
+
display: {
|
|
205
|
+
name: 'Plugin 1'
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
kind: 'Variable',
|
|
211
|
+
spec: {
|
|
212
|
+
name: 'plugin2',
|
|
213
|
+
display: {
|
|
214
|
+
name: 'Plugin 2'
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
]
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
export const MOCK_PARTIAL_FAILURE_MODULE = {
|
|
222
|
+
kind: 'PluginModule',
|
|
223
|
+
metadata: {
|
|
224
|
+
name: 'partial-failure-module',
|
|
225
|
+
version: '1.0.0'
|
|
226
|
+
},
|
|
227
|
+
spec: {
|
|
228
|
+
plugins: [
|
|
229
|
+
{
|
|
230
|
+
kind: 'Panel',
|
|
231
|
+
spec: {
|
|
232
|
+
name: 'workingPlugin',
|
|
233
|
+
display: {
|
|
234
|
+
name: 'Working Plugin'
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
kind: 'Variable',
|
|
240
|
+
spec: {
|
|
241
|
+
name: 'failingPlugin',
|
|
242
|
+
display: {
|
|
243
|
+
name: 'Failing Plugin'
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
]
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
export const MOCK_EMPTY_PLUGIN_MODULE = {
|
|
251
|
+
kind: 'PluginModule',
|
|
252
|
+
metadata: {
|
|
253
|
+
name: 'empty-module',
|
|
254
|
+
version: '1.0.0'
|
|
255
|
+
},
|
|
256
|
+
spec: {
|
|
257
|
+
plugins: []
|
|
258
|
+
}
|
|
259
|
+
};
|
|
125
260
|
|
|
126
261
|
//# sourceMappingURL=mock-data.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/test/mock-data.ts"],"sourcesContent":["// Copyright 2023 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 { LogData, ProfileData, TimeSeriesData, TraceData } from '@perses-dev/core';\n\nexport const MOCK_TIME_SERIES_DATA: TimeSeriesData = {\n timeRange: {\n start: new Date(1666625490000),\n end: new Date(1666625535000),\n },\n stepMs: 24379,\n series: [\n {\n name: 'device=\"/dev/vda1\", env=\"demo\", fstype=\"ext4\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/\"',\n values: [\n [1666479357903, 0.27700745551584494],\n [1666479382282, 0.27701284657366565],\n ],\n },\n {\n name: 'device=\"/dev/vda15\", env=\"demo\", fstype=\"vfat\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/boot/efi\"',\n values: [\n [1666479357903, 0.08486496097624885],\n [1666479382282, 0.08486496097624885],\n ],\n },\n ],\n};\n\nexport const MOCK_TRACE_DATA: TraceData = {\n searchResult: [\n {\n durationMs: 1120,\n serviceStats: {\n 'shop-backend': {\n spanCount: 4,\n errorCount: 0,\n },\n 'cart-service': {\n spanCount: 2,\n errorCount: 0,\n },\n 'article-service': {\n spanCount: 2,\n errorCount: 0,\n },\n 'auth-service': {\n spanCount: 1,\n errorCount: 0,\n },\n postgres: {\n spanCount: 1,\n errorCount: 0,\n },\n },\n startTimeUnixMs: 1699916103945861,\n traceId: '95ba9202315c29c801b5aa41452aa775',\n rootServiceName: 'shop-backend',\n rootTraceName: 'article-to-cart',\n },\n ],\n metadata: {\n executedQueryString: '{ duration > 1000ms }',\n },\n};\n\nexport const MOCK_LOG_DATA: LogData = {\n totalCount: 2,\n entries: [\n {\n timestamp: 1666479357903,\n line: 'Error: Something went wrong',\n labels: {\n level: 'error',\n service: 'backend',\n },\n },\n {\n timestamp: 1666479382282,\n line: 'Info: Request processed successfully',\n labels: {\n level: 'info',\n service: 'frontend',\n },\n },\n ],\n};\n\nexport const MOCK_PROFILE_DATA: ProfileData = {\n profile: {\n stackTrace: {\n id: 0,\n name: 'root',\n level: 0,\n start: 1699916103945861,\n end: 1699916105065861,\n total: 1000,\n self: 500,\n children: [],\n },\n },\n metadata: {\n spyName: '',\n sampleRate: 1000000000,\n units: 'samples',\n name: 'cpu',\n },\n};\n"],"names":["MOCK_TIME_SERIES_DATA","timeRange","start","Date","end","stepMs","series","name","values","MOCK_TRACE_DATA","searchResult","durationMs","serviceStats","spanCount","errorCount","postgres","startTimeUnixMs","traceId","rootServiceName","rootTraceName","metadata","executedQueryString","MOCK_LOG_DATA","totalCount","entries","timestamp","line","labels","level","service","MOCK_PROFILE_DATA","profile","stackTrace","id","total","self","children","spyName","sampleRate","units"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAO,MAAMA,wBAAwC;IACnDC,WAAW;QACTC,OAAO,IAAIC,KAAK;QAChBC,KAAK,IAAID,KAAK;IAChB;IACAE,QAAQ;IACRC,QAAQ;QACN;YACEC,MAAM;YACNC,QAAQ;gBACN;oBAAC;oBAAe;iBAAoB;gBACpC;oBAAC;oBAAe;iBAAoB;aACrC;QACH;QACA;YACED,MAAM;YACNC,QAAQ;gBACN;oBAAC;oBAAe;iBAAoB;gBACpC;oBAAC;oBAAe;iBAAoB;aACrC;QACH;KACD;AACH,EAAE;AAEF,OAAO,MAAMC,kBAA6B;IACxCC,cAAc;QACZ;YACEC,YAAY;YACZC,cAAc;gBACZ,gBAAgB;oBACdC,WAAW;oBACXC,YAAY;gBACd;gBACA,gBAAgB;oBACdD,WAAW;oBACXC,YAAY;gBACd;gBACA,mBAAmB;oBACjBD,WAAW;oBACXC,YAAY;gBACd;gBACA,gBAAgB;oBACdD,WAAW;oBACXC,YAAY;gBACd;gBACAC,UAAU;oBACRF,WAAW;oBACXC,YAAY;gBACd;YACF;YACAE,iBAAiB;YACjBC,SAAS;YACTC,iBAAiB;YACjBC,eAAe;QACjB;KACD;IACDC,UAAU;QACRC,qBAAqB;IACvB;AACF,EAAE;AAEF,OAAO,MAAMC,gBAAyB;IACpCC,YAAY;IACZC,SAAS;QACP;YACEC,WAAW;YACXC,MAAM;YACNC,QAAQ;gBACNC,OAAO;gBACPC,SAAS;YACX;QACF;QACA;YACEJ,WAAW;YACXC,MAAM;YACNC,QAAQ;gBACNC,OAAO;gBACPC,SAAS;YACX;QACF;KACD;AACH,EAAE;AAEF,OAAO,MAAMC,oBAAiC;IAC5CC,SAAS;QACPC,YAAY;YACVC,IAAI;YACJ1B,MAAM;YACNqB,OAAO;YACP1B,OAAO;YACPE,KAAK;YACL8B,OAAO;YACPC,MAAM;YACNC,UAAU,EAAE;QACd;IACF;IACAhB,UAAU;QACRiB,SAAS;QACTC,YAAY;QACZC,OAAO;QACPhC,MAAM;IACR;AACF,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../../src/test/mock-data.ts"],"sourcesContent":["// Copyright 2023 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 { LogData, ProfileData, TimeSeriesData, TraceData } from '@perses-dev/core';\n\nexport const MOCK_TIME_SERIES_DATA: TimeSeriesData = {\n timeRange: {\n start: new Date(1666625490000),\n end: new Date(1666625535000),\n },\n stepMs: 24379,\n series: [\n {\n name: 'device=\"/dev/vda1\", env=\"demo\", fstype=\"ext4\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/\"',\n values: [\n [1666479357903, 0.27700745551584494],\n [1666479382282, 0.27701284657366565],\n ],\n },\n {\n name: 'device=\"/dev/vda15\", env=\"demo\", fstype=\"vfat\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/boot/efi\"',\n values: [\n [1666479357903, 0.08486496097624885],\n [1666479382282, 0.08486496097624885],\n ],\n },\n ],\n};\n\nexport const MOCK_TRACE_DATA: TraceData = {\n searchResult: [\n {\n durationMs: 1120,\n serviceStats: {\n 'shop-backend': {\n spanCount: 4,\n errorCount: 0,\n },\n 'cart-service': {\n spanCount: 2,\n errorCount: 0,\n },\n 'article-service': {\n spanCount: 2,\n errorCount: 0,\n },\n 'auth-service': {\n spanCount: 1,\n errorCount: 0,\n },\n postgres: {\n spanCount: 1,\n errorCount: 0,\n },\n },\n startTimeUnixMs: 1699916103945861,\n traceId: '95ba9202315c29c801b5aa41452aa775',\n rootServiceName: 'shop-backend',\n rootTraceName: 'article-to-cart',\n },\n ],\n metadata: {\n executedQueryString: '{ duration > 1000ms }',\n },\n};\n\nexport const MOCK_LOG_DATA: LogData = {\n totalCount: 2,\n entries: [\n {\n timestamp: 1666479357903,\n line: 'Error: Something went wrong',\n labels: {\n level: 'error',\n service: 'backend',\n },\n },\n {\n timestamp: 1666479382282,\n line: 'Info: Request processed successfully',\n labels: {\n level: 'info',\n service: 'frontend',\n },\n },\n ],\n};\n\nexport const MOCK_PROFILE_DATA: ProfileData = {\n profile: {\n stackTrace: {\n id: 0,\n name: 'root',\n level: 0,\n start: 1699916103945861,\n end: 1699916105065861,\n total: 1000,\n self: 500,\n children: [],\n },\n },\n metadata: {\n spyName: '',\n sampleRate: 1000000000,\n units: 'samples',\n name: 'cpu',\n },\n};\n\n// Remote Plugin Loader Test Fixtures\nexport const MOCK_VALID_PLUGIN_METADATA = {\n kind: 'Panel' as const,\n spec: {\n name: 'testPlugin',\n display: {\n name: 'Test Plugin',\n description: 'A test plugin for unit testing',\n },\n },\n};\n\nexport const MOCK_VALID_PLUGIN_MODULE_RESOURCE = {\n kind: 'PluginModule' as const,\n metadata: {\n name: 'test-module',\n version: '1.0.0',\n },\n spec: {\n plugins: [MOCK_VALID_PLUGIN_METADATA],\n },\n};\n\nexport const MOCK_INVALID_PLUGIN_MODULE = {\n // Missing required fields\n metadata: {\n name: 'invalid-module',\n },\n spec: {\n plugins: [\n {\n // Missing required fields\n kind: 'Panel',\n },\n ],\n },\n};\n\nexport const MOCK_MIXED_VALIDITY_PLUGIN_MODULES = [\n MOCK_VALID_PLUGIN_MODULE_RESOURCE,\n MOCK_INVALID_PLUGIN_MODULE,\n {\n kind: 'PluginModule' as const,\n metadata: {\n name: 'another-valid-module',\n version: '2.0.0',\n },\n spec: {\n plugins: [\n {\n kind: 'Variable' as const,\n spec: {\n name: 'anotherPlugin',\n display: {\n name: 'Another Plugin',\n },\n },\n },\n ],\n },\n },\n];\n\nexport const MOCK_REMOTE_PLUGIN_MODULE = {\n testPlugin: {\n component: (): null => null,\n createDefaultOptions: (): Record<string, unknown> => ({}),\n },\n};\n\nexport const MOCK_MULTI_PLUGIN_MODULE = {\n kind: 'PluginModule' as const,\n metadata: {\n name: 'multi-plugin-module',\n version: '1.0.0',\n },\n spec: {\n plugins: [\n {\n kind: 'Panel' as const,\n spec: {\n name: 'plugin1',\n display: { name: 'Plugin 1' },\n },\n },\n {\n kind: 'Variable' as const,\n spec: {\n name: 'plugin2',\n display: { name: 'Plugin 2' },\n },\n },\n ],\n },\n};\n\nexport const MOCK_PARTIAL_FAILURE_MODULE = {\n kind: 'PluginModule' as const,\n metadata: {\n name: 'partial-failure-module',\n version: '1.0.0',\n },\n spec: {\n plugins: [\n {\n kind: 'Panel' as const,\n spec: {\n name: 'workingPlugin',\n display: { name: 'Working Plugin' },\n },\n },\n {\n kind: 'Variable' as const,\n spec: {\n name: 'failingPlugin',\n display: { name: 'Failing Plugin' },\n },\n },\n ],\n },\n};\n\nexport const MOCK_EMPTY_PLUGIN_MODULE = {\n kind: 'PluginModule' as const,\n metadata: {\n name: 'empty-module',\n version: '1.0.0',\n },\n spec: {\n plugins: [],\n },\n};\n"],"names":["MOCK_TIME_SERIES_DATA","timeRange","start","Date","end","stepMs","series","name","values","MOCK_TRACE_DATA","searchResult","durationMs","serviceStats","spanCount","errorCount","postgres","startTimeUnixMs","traceId","rootServiceName","rootTraceName","metadata","executedQueryString","MOCK_LOG_DATA","totalCount","entries","timestamp","line","labels","level","service","MOCK_PROFILE_DATA","profile","stackTrace","id","total","self","children","spyName","sampleRate","units","MOCK_VALID_PLUGIN_METADATA","kind","spec","display","description","MOCK_VALID_PLUGIN_MODULE_RESOURCE","version","plugins","MOCK_INVALID_PLUGIN_MODULE","MOCK_MIXED_VALIDITY_PLUGIN_MODULES","MOCK_REMOTE_PLUGIN_MODULE","testPlugin","component","createDefaultOptions","MOCK_MULTI_PLUGIN_MODULE","MOCK_PARTIAL_FAILURE_MODULE","MOCK_EMPTY_PLUGIN_MODULE"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAO,MAAMA,wBAAwC;IACnDC,WAAW;QACTC,OAAO,IAAIC,KAAK;QAChBC,KAAK,IAAID,KAAK;IAChB;IACAE,QAAQ;IACRC,QAAQ;QACN;YACEC,MAAM;YACNC,QAAQ;gBACN;oBAAC;oBAAe;iBAAoB;gBACpC;oBAAC;oBAAe;iBAAoB;aACrC;QACH;QACA;YACED,MAAM;YACNC,QAAQ;gBACN;oBAAC;oBAAe;iBAAoB;gBACpC;oBAAC;oBAAe;iBAAoB;aACrC;QACH;KACD;AACH,EAAE;AAEF,OAAO,MAAMC,kBAA6B;IACxCC,cAAc;QACZ;YACEC,YAAY;YACZC,cAAc;gBACZ,gBAAgB;oBACdC,WAAW;oBACXC,YAAY;gBACd;gBACA,gBAAgB;oBACdD,WAAW;oBACXC,YAAY;gBACd;gBACA,mBAAmB;oBACjBD,WAAW;oBACXC,YAAY;gBACd;gBACA,gBAAgB;oBACdD,WAAW;oBACXC,YAAY;gBACd;gBACAC,UAAU;oBACRF,WAAW;oBACXC,YAAY;gBACd;YACF;YACAE,iBAAiB;YACjBC,SAAS;YACTC,iBAAiB;YACjBC,eAAe;QACjB;KACD;IACDC,UAAU;QACRC,qBAAqB;IACvB;AACF,EA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Y;QACvBC,sBAAsB,IAAgC,CAAA,CAAC,CAAA;IACzD;AACF,EAAE;AAEF,OAAO,MAAMC,2BAA2B;IACtCb,MAAM;IACNrB,UAAU;QACRb,MAAM;QACNuC,SAAS;IACX;IACAJ,MAAM;QACJK,SAAS;YACP;gBACEN,MAAM;gBACNC,MAAM;oBACJnC,MAAM;oBACNoC,SAAS;wBAAEpC,MAAM;oBAAW;gBAC9B;YACF;YACA;gBACEkC,MAAM;gBACNC,MAAM;oBACJnC,MAAM;oBACNoC,SAAS;wBAAEpC,MAAM;oBAAW;gBAC9B;YACF;SACD;IACH;AACF,EAAE;AAEF,OAAO,MAAMgD,8BAA8B;IACzCd,MAAM;IACNrB,UAAU;QACRb,MAAM;QACNuC,SAAS;IACX;IACAJ,MAAM;QACJK,SAAS;YACP;gBACEN,MAAM;gBACNC,MAAM;oBACJnC,MAAM;oBACNoC,SAAS;wBAAEpC,MAAM;oBAAiB;gBACpC;YACF;YACA;gBACEkC,MAAM;gBACNC,MAAM;oBACJnC,MAAM;oBACNoC,SAAS;wBAAEpC,MAAM;oBAAiB;gBACpC;YACF;SACD;IACH;AACF,EAAE;AAEF,OAAO,MAAMiD,2BAA2B;IACtCf,MAAM;IACNrB,UAAU;QACRb,MAAM;QACNuC,SAAS;IACX;IACAJ,MAAM;QACJK,SAAS,EAAE;IACb;AACF,EAAE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A (temporary) userland implementation of `useEvent` from this React RFC: https://github.com/reactjs/rfcs/pull/220.
|
|
3
|
+
*
|
|
4
|
+
* Typically useful for getting a stable reference to an "event" function (i.e. one that isn't called during render
|
|
5
|
+
* but is called later in a useEffect or event handler) that accesses state or props.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useEvent<T extends unknown[], U>(handler: (...args: T) => U): (...args: T) => U;
|
|
8
|
+
//# sourceMappingURL=event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../src/utils/event.ts"],"names":[],"mappings":"AAeA;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,CAO9F"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Copyright 2023 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
|
+
import { useRef, useLayoutEffect, useCallback } from 'react';
|
|
14
|
+
/**
|
|
15
|
+
* A (temporary) userland implementation of `useEvent` from this React RFC: https://github.com/reactjs/rfcs/pull/220.
|
|
16
|
+
*
|
|
17
|
+
* Typically useful for getting a stable reference to an "event" function (i.e. one that isn't called during render
|
|
18
|
+
* but is called later in a useEffect or event handler) that accesses state or props.
|
|
19
|
+
*/ export function useEvent(handler) {
|
|
20
|
+
const handlerRef = useRef(handler);
|
|
21
|
+
useLayoutEffect(()=>{
|
|
22
|
+
handlerRef.current = handler;
|
|
23
|
+
});
|
|
24
|
+
return useCallback((...args)=>handlerRef.current(...args), []);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/event.ts"],"sourcesContent":["// Copyright 2023 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 { useRef, useLayoutEffect, useCallback } from 'react';\n\n/**\n * A (temporary) userland implementation of `useEvent` from this React RFC: https://github.com/reactjs/rfcs/pull/220.\n *\n * Typically useful for getting a stable reference to an \"event\" function (i.e. one that isn't called during render\n * but is called later in a useEffect or event handler) that accesses state or props.\n */\nexport function useEvent<T extends unknown[], U>(handler: (...args: T) => U): (...args: T) => U {\n const handlerRef = useRef(handler);\n useLayoutEffect(() => {\n handlerRef.current = handler;\n });\n\n return useCallback((...args) => handlerRef.current(...args), []);\n}\n"],"names":["useRef","useLayoutEffect","useCallback","useEvent","handler","handlerRef","current","args"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,MAAM,EAAEC,eAAe,EAAEC,WAAW,QAAQ,QAAQ;AAE7D;;;;;CAKC,GACD,OAAO,SAASC,SAAiCC,OAA0B;IACzE,MAAMC,aAAaL,OAAOI;IAC1BH,gBAAgB;QACdI,WAAWC,OAAO,GAAGF;IACvB;IAEA,OAAOF,YAAY,CAAC,GAAGK,OAASF,WAAWC,OAAO,IAAIC,OAAO,EAAE;AACjE"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAaA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAaA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
|
package/dist/utils/index.js
CHANGED
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["// Copyright 2023 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 './action';\nexport * from './variables';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,WAAW;AACzB,cAAc,cAAc"}
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["// Copyright 2023 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 './action';\nexport * from './event';\nexport * from './variables';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,WAAW;AACzB,cAAc,UAAU;AACxB,cAAc,cAAc"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perses-dev/plugin-system",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.53.0-beta.1",
|
|
4
4
|
"description": "The plugin feature in Pereses",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/perses/perses/blob/main/README.md",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@module-federation/enhanced": "^0.19.1",
|
|
32
|
-
"@perses-dev/components": "0.
|
|
33
|
-
"@perses-dev/core": "0.
|
|
32
|
+
"@perses-dev/components": "0.53.0-beta.1",
|
|
33
|
+
"@perses-dev/core": "0.53.0-beta.1",
|
|
34
34
|
"date-fns": "^4.1.0",
|
|
35
35
|
"date-fns-tz": "^3.2.0",
|
|
36
36
|
"immer": "^10.1.1",
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 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
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
Object.defineProperty(exports, "ProjectSelect", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function() {
|
|
20
|
-
return ProjectSelect;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
-
const _material = require("@mui/material");
|
|
25
|
-
const _context = require("../context");
|
|
26
|
-
function ProjectSelect(props) {
|
|
27
|
-
const { onChange, value, ...others } = props;
|
|
28
|
-
const { data, isLoading } = (0, _context.useProjectList)();
|
|
29
|
-
// While loading available values, just use an empty string so MUI select doesn't warn about values out of range
|
|
30
|
-
const optionValue = isLoading ? '' : projectToOptionValue(value);
|
|
31
|
-
// When the user makes a selection, convert the string option value back to a DatasourceSelector
|
|
32
|
-
const handleChange = (e)=>{
|
|
33
|
-
const next = optionValueToSelector(e.target.value);
|
|
34
|
-
onChange(next);
|
|
35
|
-
};
|
|
36
|
-
// TODO:
|
|
37
|
-
// - Does this need a loading indicator of some kind?
|
|
38
|
-
// - The group's edit link is not clickable once selected.
|
|
39
|
-
// - The group's edit link is disabled if datasource is overridden.
|
|
40
|
-
// Ref: https://github.com/mui/material-ui/issues/36572
|
|
41
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Select, {
|
|
42
|
-
...others,
|
|
43
|
-
value: optionValue,
|
|
44
|
-
onChange: handleChange,
|
|
45
|
-
children: [
|
|
46
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
47
|
-
value: "none",
|
|
48
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
|
|
49
|
-
direction: "row",
|
|
50
|
-
alignItems: "center",
|
|
51
|
-
justifyContent: "space-between",
|
|
52
|
-
width: "100%",
|
|
53
|
-
height: 32,
|
|
54
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.ListItemText, {
|
|
55
|
-
children: "None"
|
|
56
|
-
})
|
|
57
|
-
})
|
|
58
|
-
}),
|
|
59
|
-
data?.map((project)=>[
|
|
60
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
61
|
-
value: project.metadata.name,
|
|
62
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
|
|
63
|
-
direction: "row",
|
|
64
|
-
alignItems: "center",
|
|
65
|
-
justifyContent: "space-between",
|
|
66
|
-
width: "100%",
|
|
67
|
-
height: 32,
|
|
68
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.ListItemText, {
|
|
69
|
-
children: project.metadata.name
|
|
70
|
-
})
|
|
71
|
-
})
|
|
72
|
-
}, project.metadata.name)
|
|
73
|
-
])
|
|
74
|
-
]
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Given a ProjectSelectItemSelector,
|
|
79
|
-
* returns a string value that can be used as a Select input value.
|
|
80
|
-
* @param selector
|
|
81
|
-
*/ function projectToOptionValue(project) {
|
|
82
|
-
return project.metadata.name ?? 'none';
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Given an option value name,
|
|
86
|
-
* returns a ProjectResource to be used by the query data model.
|
|
87
|
-
* @param optionValue
|
|
88
|
-
*/ function optionValueToSelector(optionValue) {
|
|
89
|
-
return {
|
|
90
|
-
kind: 'Project',
|
|
91
|
-
metadata: {
|
|
92
|
-
name: optionValue
|
|
93
|
-
},
|
|
94
|
-
spec: {}
|
|
95
|
-
};
|
|
96
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
// Copyright 2023 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
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
function _export(target, all) {
|
|
18
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: all[name]
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
_export(exports, {
|
|
24
|
-
ProjectStoreContext: function() {
|
|
25
|
-
return ProjectStoreContext;
|
|
26
|
-
},
|
|
27
|
-
ProjectStoreProvider: function() {
|
|
28
|
-
return ProjectStoreProvider;
|
|
29
|
-
},
|
|
30
|
-
useProjectList: function() {
|
|
31
|
-
return useProjectList;
|
|
32
|
-
},
|
|
33
|
-
useProjectStore: function() {
|
|
34
|
-
return useProjectStore;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
const _jsxruntime = require("react/jsx-runtime");
|
|
38
|
-
const _reactquery = require("@tanstack/react-query");
|
|
39
|
-
const _react = require("react");
|
|
40
|
-
const _core = require("@perses-dev/core");
|
|
41
|
-
const _queryparams = require("./query-params");
|
|
42
|
-
const ProjectStoreContext = /*#__PURE__*/ (0, _react.createContext)(undefined);
|
|
43
|
-
function useProjectList() {
|
|
44
|
-
return (0, _reactquery.useQuery)({
|
|
45
|
-
queryKey: [
|
|
46
|
-
'projects'
|
|
47
|
-
],
|
|
48
|
-
queryFn: ()=>{
|
|
49
|
-
return (0, _core.fetchJson)('/api/v1/projects');
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
function useProjectStore() {
|
|
54
|
-
const ctx = (0, _react.useContext)(ProjectStoreContext);
|
|
55
|
-
if (ctx === undefined) {
|
|
56
|
-
throw new Error('No ProjectStoreContext found. Did you forget a Provider?');
|
|
57
|
-
}
|
|
58
|
-
return ctx;
|
|
59
|
-
}
|
|
60
|
-
function ProjectStoreProvider(props) {
|
|
61
|
-
const { children, enabledURLParams } = props;
|
|
62
|
-
const { project, setProject } = (0, _queryparams.useSetProjectParams)(enabledURLParams);
|
|
63
|
-
const contextValue = (0, _react.useMemo)(()=>({
|
|
64
|
-
project: {
|
|
65
|
-
kind: 'Project',
|
|
66
|
-
metadata: {
|
|
67
|
-
name: project
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
setProject: (project)=>{
|
|
71
|
-
setProject(project.metadata.name);
|
|
72
|
-
}
|
|
73
|
-
}), [
|
|
74
|
-
project,
|
|
75
|
-
setProject
|
|
76
|
-
]);
|
|
77
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(ProjectStoreContext.Provider, {
|
|
78
|
-
value: contextValue,
|
|
79
|
-
children: children
|
|
80
|
-
});
|
|
81
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 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
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
Object.defineProperty(exports, "useSetProjectParams", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function() {
|
|
20
|
-
return useSetProjectParams;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
const _react = require("react");
|
|
24
|
-
const _usequeryparams = require("use-query-params");
|
|
25
|
-
function useSetProjectParams(enabledURLParams = true) {
|
|
26
|
-
const [query, setQuery] = (0, _usequeryparams.useQueryParams)({
|
|
27
|
-
project: ''
|
|
28
|
-
}, {
|
|
29
|
-
updateType: 'replaceIn'
|
|
30
|
-
});
|
|
31
|
-
const [projectState, setProjectState] = (0, _react.useState)('none');
|
|
32
|
-
const setProject = (0, _react.useCallback)((project)=>{
|
|
33
|
-
return setQuery({
|
|
34
|
-
project
|
|
35
|
-
});
|
|
36
|
-
}, [
|
|
37
|
-
setQuery
|
|
38
|
-
]);
|
|
39
|
-
if (enabledURLParams) {
|
|
40
|
-
return {
|
|
41
|
-
project: query.project || 'none',
|
|
42
|
-
setProject
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
return {
|
|
46
|
-
project: projectState,
|
|
47
|
-
setProject: setProjectState
|
|
48
|
-
};
|
|
49
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DatasourceSelect.d.ts","sourceRoot":"","sources":["../../src/components/DatasourceSelect.tsx"],"names":[],"mappings":"AAcA,OAAO,EAML,mBAAmB,EACnB,eAAe,EAGhB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAW,MAAM,OAAO,CAAC;AAC9C,OAAO,EAEL,yBAAyB,EACzB,4BAA4B,EAG5B,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAOpB,KAAK,eAAe,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,CAAC;AAWzD,MAAM,MAAM,qBAAqB,CAAC,CAAC,GAAG,kBAAkB,IAAI,CAAC,GAAG,YAAY,CAAC;AAE7E,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,mBAAmB,GAAG,eAAe,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC;IACjH,KAAK,EAAE,qBAAqB,CAAC;IAC7B,QAAQ,EAAE,CAAC,IAAI,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAChD,oBAAoB,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,YAAY,CAkH3E;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,YAAY,CAahH;AAKD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,4BAA4B,GAAG,YAAY,GAAG,MAAM,CAKnG;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,qBAAqB,CAehF;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,qBAAqB,GAAG,SAAS,GAAG,KAAK,IAAI,YAAY,CAEpG;AAED,eAAO,MAAM,+BAA+B,UACnC,qBAAqB,GAAG,SAAS,aAC7B,gBAAgB,8BACC,yBAAyB,EAAE,GAAG,SAAS,KAClE,kBAAkB,GAAG,SA4BvB,CAAC;AAEF,eAAO,MAAM,kCAAkC,UACtC,qBAAqB,wBACN,MAAM,KAC3B,kBAQF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/DatasourceSelect.tsx"],"sourcesContent":["// Copyright 2023 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 OpenInNewIcon from 'mdi-material-ui/OpenInNew';\nimport {\n Stack,\n ListItemText,\n Chip,\n IconButton,\n Box,\n OutlinedSelectProps,\n BaseSelectProps,\n Autocomplete,\n TextField,\n} from '@mui/material';\nimport { DatasourceSelector, VariableName } from '@perses-dev/core';\nimport { ReactElement, useMemo } from 'react';\nimport {\n DatasourceSelectItem,\n DatasourceSelectItemGroup,\n DatasourceSelectItemSelector,\n useListDatasourceSelectItems,\n useVariableValues,\n VariableStateMap,\n} from '../runtime';\nimport { parseVariables } from '../utils';\n\nconst DATASOURCE_VARIABLE_VALUE_PREFIX = '__DATASOURCE_VARIABLE_VALUE__';\nconst VARIABLE_IDENTIFIER = '$';\n// Props on MUI Select that we don't want people to pass because we're either redefining them or providing them in\n// this component\ntype OmittedMuiProps = 'children' | 'value' | 'onChange';\n\ntype DataSourceOption = {\n groupEditLink?: string;\n groupLabel?: string;\n value: string;\n} & Omit<DatasourceSelectItem, 'selector'> &\n Omit<DatasourceSelectItem['selector'], 'kind'>;\n\nconst emptyDatasourceOption: DataSourceOption = { name: '', value: '' };\n\nexport type DatasourceSelectValue<T = DatasourceSelector> = T | VariableName;\n\nexport interface DatasourceSelectProps extends Omit<OutlinedSelectProps & BaseSelectProps<string>, OmittedMuiProps> {\n value: DatasourceSelectValue;\n onChange: (next: DatasourceSelectValue) => void;\n datasourcePluginKind: string;\n project?: string;\n}\n\n/**\n * Displays a MUI input for selecting a Datasource of a particular kind. Note: The 'value' and `onChange` handler for\n * the input deal with a `DatasourceSelector`.\n */\nexport function DatasourceSelect(props: DatasourceSelectProps): ReactElement {\n const { datasourcePluginKind, value, project, readOnly, onChange, ...others } = props;\n const { data, isLoading } = useListDatasourceSelectItems(datasourcePluginKind, project);\n const variables = useVariableValues();\n\n const defaultValue = useMemo<VariableName | DatasourceSelectItemSelector>(() => {\n if (isVariableDatasource(value)) {\n return value;\n }\n\n const group = (data ?? [])\n .flatMap((itemGroup) => itemGroup.items)\n .find((item) => {\n return value.kind === item.selector.kind && value.name === item.selector.name && !item.overridden;\n })?.selector.group;\n return { ...value, group };\n }, [value, data]);\n\n const options = useMemo<DataSourceOption[]>(() => {\n const datasourceOptions = (data || []).flatMap<DataSourceOption>((itemGroup) =>\n itemGroup.items.map<DataSourceOption>((item) => ({\n groupLabel: itemGroup.group,\n groupEditLink: itemGroup.editLink,\n name: item.name,\n overriding: item.overriding,\n overridden: item.overridden,\n saved: item.saved ?? true,\n group: item.selector.group,\n value: selectorToOptionValue(item.selector),\n }))\n );\n\n const datasourceOptionsMap = new Map(datasourceOptions.map((option) => [option.name, option]));\n\n const variableOptions = Object.entries(variables).flatMap<DataSourceOption>(([name, variable]) => {\n if (Array.isArray(variable.value)) return [];\n\n const associatedDatasource = datasourceOptionsMap.get(variable.value ?? '');\n if (!associatedDatasource) return [];\n\n return {\n groupLabel: 'Variables',\n name: `${VARIABLE_IDENTIFIER}${name}`,\n saved: true,\n value: `${DATASOURCE_VARIABLE_VALUE_PREFIX}${VARIABLE_IDENTIFIER}${name}`,\n };\n });\n\n return [...datasourceOptions, ...variableOptions];\n }, [data, variables]);\n\n // While loading available values, just use an empty datasource option so MUI select doesn't warn about values out of range\n const optionValue = isLoading\n ? emptyDatasourceOption\n : options.find((option) => option.value === selectorToOptionValue(defaultValue));\n\n // When the user makes a selection, convert the string option value back to a DatasourceSelector\n const handleChange = (selectedOption: DataSourceOption | null): void => {\n if (selectedOption) {\n const next = optionValueToSelector(selectedOption?.value || '');\n onChange(next);\n } else {\n onChange({ kind: datasourcePluginKind });\n }\n };\n\n // We use a fake action event when we click on the action of the chip (hijack the \"delete\" feature).\n // This is because the href link action is on the `deleteIcon` property already, but the `onDelete` property\n // controls its visibility.\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n const fakeActionEvent = (): void => {};\n\n return (\n <Autocomplete<DataSourceOption>\n readOnly={readOnly}\n options={options}\n renderInput={(params) => <TextField {...params} label={others.label} placeholder=\"\" />}\n groupBy={(option) => option.groupLabel || 'No group'}\n getOptionLabel={(option) => {\n return option.name;\n }}\n onChange={(_, v) => handleChange(v)}\n value={optionValue}\n renderOption={(props, option) => {\n return (\n <li {...props} key={option.value}>\n <Stack direction=\"row\" alignItems=\"center\" justifyContent=\"space-between\" width=\"100%\">\n <ListItemText>\n <DatasourceName name={option.name} overridden={option.overridden} overriding={option.overriding} />\n </ListItemText>\n {!option.saved && <ListItemText>Save the dashboard to enable this datasource</ListItemText>}\n <ListItemText style={{ textAlign: 'right' }}>\n {option.groupLabel && option.groupLabel.length > 0 && (\n <Chip\n disabled={false}\n label={option.groupLabel}\n size=\"small\"\n onDelete={option.groupEditLink ? fakeActionEvent : undefined}\n deleteIcon={\n option.groupEditLink ? (\n <IconButton href={option.groupEditLink} target=\"_blank\">\n <OpenInNewIcon fontSize=\"small\" />\n </IconButton>\n ) : undefined\n }\n />\n )}\n </ListItemText>\n </Stack>\n </li>\n );\n }}\n />\n );\n}\n\nexport function DatasourceName(props: { name: string; overridden?: boolean; overriding?: boolean }): ReactElement {\n const { name, overridden, overriding } = props;\n return (\n <>\n {`${name} `}\n {!overridden && overriding && (\n <Box display=\"inline\" fontWeight=\"normal\" color={(theme) => theme.palette.primary.main}>\n (overriding)\n </Box>\n )}\n {overridden && '(overridden)'}\n </>\n );\n}\n\n// Delimiter used to stringify/parse option values\nconst OPTION_VALUE_DELIMITER = '_____';\n\n/**\n * Given a DatasourceSelectItemSelector,\n * returns a string value like `{kind}_____{group}_____{name}` that can be used as a Select input value.\n * @param selector\n */\nexport function selectorToOptionValue(selector: DatasourceSelectItemSelector | VariableName): string {\n if (isVariableDatasource(selector)) {\n return `${DATASOURCE_VARIABLE_VALUE_PREFIX}${selector}`;\n }\n return [selector.kind, selector.group ?? '', selector.name ?? ''].join(OPTION_VALUE_DELIMITER);\n}\n\n/**\n * Given an option value name like `{kind}_____{group}_____{name}`,\n * returns a DatasourceSelector to be used by the query data model.\n * @param optionValue\n */\nexport function optionValueToSelector(optionValue: string): DatasourceSelectValue {\n if (optionValue.startsWith(DATASOURCE_VARIABLE_VALUE_PREFIX)) {\n return optionValue.split(DATASOURCE_VARIABLE_VALUE_PREFIX)[1]!;\n }\n\n const words = optionValue.split(OPTION_VALUE_DELIMITER);\n const kind = words[0];\n const name = words[2];\n if (kind === undefined || name === undefined) {\n throw new Error('Invalid optionValue string');\n }\n return {\n kind,\n name: name === '' ? undefined : name,\n };\n}\n\nexport function isVariableDatasource(value: DatasourceSelectValue | undefined): value is VariableName {\n return typeof value === 'string' && value.startsWith(VARIABLE_IDENTIFIER);\n}\n\nexport const datasourceSelectValueToSelector = (\n value: DatasourceSelectValue | undefined,\n variables: VariableStateMap,\n datasourceSelectItemGroups: DatasourceSelectItemGroup[] | undefined\n): DatasourceSelector | undefined => {\n if (!isVariableDatasource(value)) {\n return value;\n }\n\n const [variableName] = parseVariables(value);\n const variable = variables[variableName ?? ''];\n\n // If the variable is not defined or if its value is an array, we cannot determine a selector and return undefined\n if (!variable || Array.isArray(variable.value)) {\n return undefined;\n }\n\n const associatedDatasource = (datasourceSelectItemGroups || [])\n .flatMap((itemGroup) => itemGroup.items)\n .find((datasource) => datasource.name === variable.value);\n\n // If the variable value is not a datasource, we cannot determine a selector and return undefined\n if (associatedDatasource === undefined) {\n return undefined;\n }\n\n const datasourceSelector: DatasourceSelector = {\n kind: associatedDatasource.selector.kind,\n name: associatedDatasource.selector.name,\n };\n\n return datasourceSelector;\n};\n\nexport const useDatasourceSelectValueToSelector = (\n value: DatasourceSelectValue,\n datasourcePluginKind: string\n): DatasourceSelector => {\n const { data } = useListDatasourceSelectItems(datasourcePluginKind);\n const variables = useVariableValues();\n if (!isVariableDatasource(value)) {\n return value;\n }\n\n return datasourceSelectValueToSelector(value, variables, data) ?? { kind: datasourcePluginKind };\n};\n"],"names":["OpenInNewIcon","Stack","ListItemText","Chip","IconButton","Box","Autocomplete","TextField","useMemo","useListDatasourceSelectItems","useVariableValues","parseVariables","DATASOURCE_VARIABLE_VALUE_PREFIX","VARIABLE_IDENTIFIER","emptyDatasourceOption","name","value","DatasourceSelect","props","datasourcePluginKind","project","readOnly","onChange","others","data","isLoading","variables","defaultValue","isVariableDatasource","group","flatMap","itemGroup","items","find","item","kind","selector","overridden","options","datasourceOptions","map","groupLabel","groupEditLink","editLink","overriding","saved","selectorToOptionValue","datasourceOptionsMap","Map","option","variableOptions","Object","entries","variable","Array","isArray","associatedDatasource","get","optionValue","handleChange","selectedOption","next","optionValueToSelector","fakeActionEvent","renderInput","params","label","placeholder","groupBy","getOptionLabel","_","v","renderOption","li","key","direction","alignItems","justifyContent","width","DatasourceName","style","textAlign","length","disabled","size","onDelete","undefined","deleteIcon","href","target","fontSize","display","fontWeight","color","theme","palette","primary","main","OPTION_VALUE_DELIMITER","join","startsWith","split","words","Error","datasourceSelectValueToSelector","datasourceSelectItemGroups","variableName","datasource","datasourceSelector","useDatasourceSelectValueToSelector"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAEjC,OAAOA,mBAAmB,4BAA4B;AACtD,SACEC,KAAK,EACLC,YAAY,EACZC,IAAI,EACJC,UAAU,EACVC,GAAG,EAGHC,YAAY,EACZC,SAAS,QACJ,gBAAgB;AAEvB,SAAuBC,OAAO,QAAQ,QAAQ;AAC9C,SAIEC,4BAA4B,EAC5BC,iBAAiB,QAEZ,aAAa;AACpB,SAASC,cAAc,QAAQ,WAAW;AAE1C,MAAMC,mCAAmC;AACzC,MAAMC,sBAAsB;AAY5B,MAAMC,wBAA0C;IAAEC,MAAM;IAAIC,OAAO;AAAG;AAWtE;;;CAGC,GACD,OAAO,SAASC,iBAAiBC,KAA4B;IAC3D,MAAM,EAAEC,oBAAoB,EAAEH,KAAK,EAAEI,OAAO,EAAEC,QAAQ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F,OACAG;IAEA,MAAM,EAAEK,IAAI,EAAE,GAAGf,6BAA6BU;IAC9C,MAAMO,YAAYhB;IAClB,IAAI,CAACkB,qBAAqBZ,QAAQ;QAChC,OAAOA;IACT;IAEA,OAAOwF,gCAAgCxF,OAAOU,WAAWF,SAAS;QAAEW,MAAMhB;IAAqB;AACjG,EAAE"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { SelectProps } from '@mui/material';
|
|
2
|
-
import { ProjectResource } from '@perses-dev/core';
|
|
3
|
-
import { ReactElement } from 'react';
|
|
4
|
-
type OmittedMuiProps = 'children' | 'value' | 'onChange';
|
|
5
|
-
export interface ProjectSelectProps extends Omit<SelectProps<string>, OmittedMuiProps> {
|
|
6
|
-
onChange: (next: ProjectResource) => void;
|
|
7
|
-
value: ProjectResource;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Displays a MUI input for selecting a Project of a particular kind. Note: The 'value' and `onChange` handler for
|
|
11
|
-
* the input deal with a `ProjectSelector`.
|
|
12
|
-
*/
|
|
13
|
-
export declare function ProjectSelect(props: ProjectSelectProps): ReactElement;
|
|
14
|
-
export {};
|
|
15
|
-
//# sourceMappingURL=ProjectSelect.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectSelect.d.ts","sourceRoot":"","sources":["../../src/components/ProjectSelect.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAU,WAAW,EAAiC,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAKrC,KAAK,eAAe,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,CAAC;AAEzD,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC;IACpF,QAAQ,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,CAAC;IAC1C,KAAK,EAAE,eAAe,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,YAAY,CAmCrE"}
|