@grafana/aws-sdk 0.0.31 → 0.0.32

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/README.md CHANGED
@@ -2,13 +2,16 @@
2
2
 
3
3
  This is a common package that can be used for all amazon plugins.
4
4
 
5
+ ## Frontend configuration
5
6
 
6
- ## Backend plugins (go sdk)
7
+ see the ./src folder
7
8
 
8
- see the ./pkg folder
9
- |
9
+ ## Drone configuration
10
10
 
11
- ## Frontend configuration
11
+ Drone signs the Drone configuration file. This needs to be run everytime the drone.yml file is modified. See https://github.com/grafana/deployment_tools/blob/master/docs/infrastructure/drone/signing.md for more info.
12
12
 
13
- see the ./src folder
13
+ To update the drone file run (note that you need to export your `DRONE_TOKEN` before):
14
14
 
15
+ ```
16
+ drone --server https://drone.grafana.net sign --save grafana/grafana-aws-sdk-react
17
+ ```
package/dist/index.d.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  export { ConnectionConfig, ConnectionConfigProps } from './ConnectionConfig';
2
+ export { ConfigSelect, InlineInput } from './sql/ConfigEditor';
3
+ export { ResourceSelector, ResourceSelectorProps } from './sql/ResourceSelector';
4
+ export { SQLQuery } from './sql/types';
5
+ export { QueryCodeEditor, FormatSelect, FillValueSelect } from './sql/QueryEditor';
6
+ export * from './sql/utils';
2
7
  export * from './types';
3
8
  export * from './regions';
4
9
  export * from './providers';
5
- export * from './selectors';
@@ -6,6 +6,7 @@ var React = require('react');
6
6
  var React__default = _interopDefault(React);
7
7
  var ui = require('@grafana/ui');
8
8
  var data = require('@grafana/data');
9
+ var lodash = require('lodash');
9
10
 
10
11
  /*! *****************************************************************************
11
12
  Copyright (c) Microsoft Corporation.
@@ -33,6 +34,44 @@ var __assign = function() {
33
34
  return __assign.apply(this, arguments);
34
35
  };
35
36
 
37
+ function __awaiter(thisArg, _arguments, P, generator) {
38
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
39
+ return new (P || (P = Promise))(function (resolve, reject) {
40
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
41
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
42
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
43
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
44
+ });
45
+ }
46
+
47
+ function __generator(thisArg, body) {
48
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
49
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
50
+ function verb(n) { return function (v) { return step([n, v]); }; }
51
+ function step(op) {
52
+ if (f) throw new TypeError("Generator is already executing.");
53
+ while (_) try {
54
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
55
+ if (y = 0, t) op = [op[0] & 2, t.value];
56
+ switch (op[0]) {
57
+ case 0: case 1: t = op; break;
58
+ case 4: _.label++; return { value: op[1], done: false };
59
+ case 5: _.label++; y = op[1]; op = [0]; continue;
60
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
61
+ default:
62
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
63
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
64
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
65
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
66
+ if (t[2]) _.ops.pop();
67
+ _.trys.pop(); continue;
68
+ }
69
+ op = body.call(thisArg, _);
70
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
71
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
72
+ }
73
+ }
74
+
36
75
  function __read(o, n) {
37
76
  var m = typeof Symbol === "function" && o[Symbol.iterator];
38
77
  if (!m) return o;
@@ -109,20 +148,6 @@ var awsAuthProviderOptions = [
109
148
  },
110
149
  ];
111
150
 
112
- var Components = {
113
- ConfigEditor: {
114
- SecretKey: {
115
- input: 'Config editor secret key input',
116
- },
117
- AccessKey: {
118
- input: 'Config editor access key input',
119
- },
120
- },
121
- };
122
- var selectors = {
123
- components: Components,
124
- };
125
-
126
151
  var toOption = function (value) { return ({ value: value, label: value }); };
127
152
  var ConnectionConfig = function (props) {
128
153
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
@@ -155,33 +180,279 @@ var ConnectionConfig = function (props) {
155
180
  }, [loadRegions]);
156
181
  return (React__default.createElement(ui.FieldSet, { label: skipHeader ? '' : 'Connection Details', "data-testid": "connection-config" },
157
182
  React__default.createElement(ui.InlineField, { label: "Authentication Provider", labelWidth: 28, tooltip: "Specify which AWS credentials chain to use." },
158
- React__default.createElement(ui.Select, { className: "width-30 aws-config-authType", value: currentProvider, options: awsAuthProviderOptions.filter(function (opt) { return awsAllowedAuthProviders.includes(opt.value); }), defaultValue: options.jsonData.authType, onChange: function (option) {
183
+ React__default.createElement(ui.Select, { "aria-label": "Authentication Provider", className: "width-30", value: currentProvider, options: awsAuthProviderOptions.filter(function (opt) { return awsAllowedAuthProviders.includes(opt.value); }), defaultValue: options.jsonData.authType, onChange: function (option) {
159
184
  data.onUpdateDatasourceJsonDataOptionSelect(props, 'authType')(option);
160
185
  } })),
161
186
  options.jsonData.authType === 'credentials' && (React__default.createElement(ui.InlineField, { label: "Credentials Profile Name", labelWidth: 28, tooltip: "Credentials profile name, as specified in ~/.aws/credentials, leave blank for default." },
162
- React__default.createElement(ui.Input, { className: "width-30", placeholder: "default", value: profile, onChange: data.onUpdateDatasourceJsonDataOption(props, 'profile') }))),
187
+ React__default.createElement(ui.Input, { "aria-label": "Credentials Profile Name", className: "width-30", placeholder: "default", value: profile, onChange: data.onUpdateDatasourceJsonDataOption(props, 'profile') }))),
163
188
  options.jsonData.authType === 'keys' && (React__default.createElement(React__default.Fragment, null,
164
189
  React__default.createElement(ui.InlineField, { label: "Access Key ID", labelWidth: 28 }, ((_c = props.options.secureJsonFields) === null || _c === void 0 ? void 0 : _c.accessKey) ? (React__default.createElement(ui.ButtonGroup, { className: "width-30" },
165
190
  React__default.createElement(ui.Input, { disabled: true, placeholder: "Configured" }),
166
- React__default.createElement(ui.ToolbarButton, { icon: "edit", tooltip: "Edit Access Key ID", type: "button", onClick: data.onUpdateDatasourceResetOption(props, 'accessKey') }))) : (React__default.createElement(ui.Input, { className: "width-30", value: (_e = (_d = options.secureJsonData) === null || _d === void 0 ? void 0 : _d.accessKey) !== null && _e !== void 0 ? _e : '', onChange: data.onUpdateDatasourceSecureJsonDataOption(props, 'accessKey'), "aria-label": selectors.components.ConfigEditor.AccessKey.input }))),
191
+ React__default.createElement(ui.ToolbarButton, { icon: "edit", tooltip: "Edit Access Key ID", type: "button", onClick: data.onUpdateDatasourceResetOption(props, 'accessKey') }))) : (React__default.createElement(ui.Input, { "aria-label": "Access Key ID", className: "width-30", value: (_e = (_d = options.secureJsonData) === null || _d === void 0 ? void 0 : _d.accessKey) !== null && _e !== void 0 ? _e : '', onChange: data.onUpdateDatasourceSecureJsonDataOption(props, 'accessKey') }))),
167
192
  React__default.createElement(ui.InlineField, { label: "Secret Access Key", labelWidth: 28 }, ((_f = props.options.secureJsonFields) === null || _f === void 0 ? void 0 : _f.secretKey) ? (React__default.createElement(ui.ButtonGroup, { className: "width-30" },
168
193
  React__default.createElement(ui.Input, { disabled: true, placeholder: "Configured" }),
169
- React__default.createElement(ui.ToolbarButton, { icon: "edit", type: "button", tooltip: "Edit Secret Access Key", onClick: data.onUpdateDatasourceResetOption(props, 'secretKey') }))) : (React__default.createElement(ui.Input, { className: "width-30", value: (_h = (_g = options.secureJsonData) === null || _g === void 0 ? void 0 : _g.secretKey) !== null && _h !== void 0 ? _h : '', onChange: data.onUpdateDatasourceSecureJsonDataOption(props, 'secretKey'), "aria-label": selectors.components.ConfigEditor.SecretKey.input }))))),
194
+ React__default.createElement(ui.ToolbarButton, { icon: "edit", type: "button", tooltip: "Edit Secret Access Key", onClick: data.onUpdateDatasourceResetOption(props, 'secretKey') }))) : (React__default.createElement(ui.Input, { "aria-label": "Secret Access Key", className: "width-30", value: (_h = (_g = options.secureJsonData) === null || _g === void 0 ? void 0 : _g.secretKey) !== null && _h !== void 0 ? _h : '', onChange: data.onUpdateDatasourceSecureJsonDataOption(props, 'secretKey') }))))),
170
195
  awsAssumeRoleEnabled && (React__default.createElement(React__default.Fragment, null,
171
196
  React__default.createElement(ui.InlineField, { label: "Assume Role ARN", labelWidth: 28, tooltip: "Optionally, specify the ARN of a role to assume. Specifying a role here will ensure that the selected authentication provider is used to assume the specified role rather than using the credentials directly. Leave blank if you don't need to assume a role at all" },
172
- React__default.createElement(ui.Input, { className: "width-30", placeholder: "arn:aws:iam:*", value: options.jsonData.assumeRoleArn || '', onChange: data.onUpdateDatasourceJsonDataOption(props, 'assumeRoleArn') })),
197
+ React__default.createElement(ui.Input, { "aria-label": "Assume Role ARN", className: "width-30", placeholder: "arn:aws:iam:*", value: options.jsonData.assumeRoleArn || '', onChange: data.onUpdateDatasourceJsonDataOption(props, 'assumeRoleArn') })),
173
198
  React__default.createElement(ui.InlineField, { label: "External ID", labelWidth: 28, tooltip: "If you are assuming a role in another account, that has been created with an external ID, specify the external ID here." },
174
- React__default.createElement(ui.Input, { className: "width-30", placeholder: "External ID", value: options.jsonData.externalId || '', onChange: data.onUpdateDatasourceJsonDataOption(props, 'externalId') })))),
199
+ React__default.createElement(ui.Input, { "aria-label": "External ID", className: "width-30", placeholder: "External ID", value: options.jsonData.externalId || '', onChange: data.onUpdateDatasourceJsonDataOption(props, 'externalId') })))),
175
200
  !skipEndpoint && (React__default.createElement(ui.InlineField, { label: "Endpoint", labelWidth: 28, tooltip: "Optionally, specify a custom endpoint for the service" },
176
- React__default.createElement(ui.Input, { className: "width-30", placeholder: (_j = props.defaultEndpoint) !== null && _j !== void 0 ? _j : 'https://{service}.{region}.amazonaws.com', value: options.jsonData.endpoint || '', onChange: data.onUpdateDatasourceJsonDataOption(props, 'endpoint') }))),
201
+ React__default.createElement(ui.Input, { "aria-label": "Endpoint", className: "width-30", placeholder: (_j = props.defaultEndpoint) !== null && _j !== void 0 ? _j : 'https://{service}.{region}.amazonaws.com', value: options.jsonData.endpoint || '', onChange: data.onUpdateDatasourceJsonDataOption(props, 'endpoint') }))),
177
202
  React__default.createElement(ui.InlineField, { label: "Default Region", labelWidth: 28, tooltip: "Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region." },
178
- React__default.createElement(ui.Select, { className: "width-30 aws-config-defaultRegion", value: regions.find(function (region) { return region.value === options.jsonData.defaultRegion; }), options: regions, defaultValue: options.jsonData.defaultRegion, allowCustomValue: true, onChange: data.onUpdateDatasourceJsonDataOptionSelect(props, 'defaultRegion'), formatCreateLabel: function (r) { return "Use region: " + r; } })),
203
+ React__default.createElement(ui.Select, { "aria-label": "Default Region", className: "width-30", value: regions.find(function (region) { return region.value === options.jsonData.defaultRegion; }), options: regions, defaultValue: options.jsonData.defaultRegion, allowCustomValue: true, onChange: data.onUpdateDatasourceJsonDataOptionSelect(props, 'defaultRegion'), formatCreateLabel: function (r) { return "Use region: " + r; } })),
179
204
  props.children));
180
205
  };
181
206
 
182
- exports.Components = Components;
207
+ var defaultKey = '__default';
208
+
209
+ function ResourceSelector(props) {
210
+ var _this = this;
211
+ var _a = __read(React.useState(props.value || props.default || null), 2), resource = _a[0], setResource = _a[1];
212
+ var _b = __read(React.useState(resource ? [resource] : []), 2), resources = _b[0], setResources = _b[1];
213
+ var _c = __read(React.useState(props.dependencies), 2), dependencies = _c[0], setDependencies = _c[1];
214
+ var _d = __read(React.useState(false), 2), isLoading = _d[0], setIsLoading = _d[1];
215
+ var _e = __read(React.useState(false), 2), fetched = _e[0], setFetched = _e[1];
216
+ var defaultOpts = React.useMemo(function () {
217
+ var opts = [
218
+ {
219
+ label: "default (" + props.default + ")",
220
+ value: defaultKey,
221
+ description: "Default value set in the data source",
222
+ },
223
+ ];
224
+ if (props.value && props.value !== defaultKey) {
225
+ opts.push({ label: props.value, value: props.value });
226
+ }
227
+ return opts;
228
+ }, [props.default, props.value]);
229
+ var _f = __read(React.useState(props.default ? defaultOpts : []), 2), options = _f[0], setOptions = _f[1];
230
+ React.useEffect(function () {
231
+ if (resources.length) {
232
+ var newOptions_1 = props.default ? defaultOpts : [];
233
+ resources.forEach(function (r) {
234
+ var value = typeof r === 'string' ? r : r.value;
235
+ if (!newOptions_1.find(function (o) { return o.value === value; })) {
236
+ typeof r === 'string' ? newOptions_1.push({ label: r, value: r }) : newOptions_1.push(r);
237
+ }
238
+ });
239
+ setOptions(newOptions_1);
240
+ }
241
+ else {
242
+ setOptions([]);
243
+ }
244
+ }, [resources, defaultOpts, props.default]);
245
+ React.useEffect(function () {
246
+ // A change in the dependencies cause a state clean-up
247
+ if (!lodash.isEqual(props.dependencies, dependencies)) {
248
+ setFetched(false);
249
+ setResources([]);
250
+ setResource(null);
251
+ props.onChange(null);
252
+ setDependencies(props.dependencies);
253
+ }
254
+ }, [props, dependencies]);
255
+ var fetch = function () { return __awaiter(_this, void 0, void 0, function () {
256
+ var resources_1;
257
+ return __generator(this, function (_a) {
258
+ switch (_a.label) {
259
+ case 0:
260
+ if (fetched) {
261
+ return [2 /*return*/];
262
+ }
263
+ if (!props.saveOptions) return [3 /*break*/, 2];
264
+ return [4 /*yield*/, props.saveOptions()];
265
+ case 1:
266
+ _a.sent();
267
+ _a.label = 2;
268
+ case 2:
269
+ _a.trys.push([2, , 4, 5]);
270
+ return [4 /*yield*/, props.fetch()];
271
+ case 3:
272
+ resources_1 = _a.sent();
273
+ setResources(resources_1);
274
+ return [3 /*break*/, 5];
275
+ case 4:
276
+ setFetched(true);
277
+ return [7 /*endfinally*/];
278
+ case 5: return [2 /*return*/];
279
+ }
280
+ });
281
+ }); };
282
+ var onChange = function (e) {
283
+ props.onChange(e);
284
+ if (e.value) {
285
+ setResource(e.value);
286
+ }
287
+ };
288
+ var onClick = function () { return __awaiter(_this, void 0, void 0, function () {
289
+ return __generator(this, function (_a) {
290
+ switch (_a.label) {
291
+ case 0:
292
+ setIsLoading(true);
293
+ _a.label = 1;
294
+ case 1:
295
+ _a.trys.push([1, , 3, 4]);
296
+ return [4 /*yield*/, fetch()];
297
+ case 2:
298
+ _a.sent();
299
+ return [3 /*break*/, 4];
300
+ case 3:
301
+ setIsLoading(false);
302
+ return [7 /*endfinally*/];
303
+ case 4: return [2 /*return*/];
304
+ }
305
+ });
306
+ }); };
307
+ return (React__default.createElement(ui.InlineField, { label: props.label, labelWidth: props.labelWidth, tooltip: props.tooltip, hidden: props.hidden },
308
+ React__default.createElement("div", { "data-testid": props['data-testid'], title: props.title },
309
+ React__default.createElement(ui.Select, { "aria-label": props.label, options: options, value: props.value, onChange: onChange, isLoading: isLoading, className: props.className || 'min-width-6', disabled: props.disabled, onOpenMenu: onClick }))));
310
+ }
311
+
312
+ function ConfigSelect(props) {
313
+ var jsonData = props.options.jsonData;
314
+ var commonProps = {
315
+ title: jsonData.defaultRegion ? '' : 'select a default region',
316
+ disabled: !jsonData.defaultRegion,
317
+ labelWidth: 28,
318
+ className: 'width-30',
319
+ };
320
+ // Any change in the AWS connection details will affect selectors
321
+ var dependencies = [
322
+ props.options.jsonData.assumeRoleArn,
323
+ props.options.jsonData.authType,
324
+ props.options.jsonData.defaultRegion,
325
+ props.options.jsonData.endpoint,
326
+ props.options.jsonData.externalId,
327
+ props.options.jsonData.profile,
328
+ ].concat(props.dependencies);
329
+ return (React__default.createElement(ResourceSelector, __assign({ label: props.label, "data-testid": props['data-testid'], onChange: props.onChange, fetch: props.fetch, value: props.value, saveOptions: props.saveOptions, dependencies: dependencies, hidden: props.hidden, disabled: props.disabled }, commonProps)));
330
+ }
331
+
332
+ function InlineInput(props) {
333
+ return (React__default.createElement(ui.InlineField, { label: props.label, labelWidth: 28, tooltip: props.tooltip, hidden: props.hidden, disabled: props.disabled },
334
+ React__default.createElement(ui.Input, { "data-testid": props['data-testid'], className: "width-30", value: props.value, onChange: props.onChange, placeholder: props.placeholder, disabled: props.disabled })));
335
+ }
336
+
337
+ function QueryCodeEditor(props) {
338
+ var getSuggestions = props.getSuggestions, query = props.query;
339
+ var rawSQL = lodash.defaults(props.query, { rawSQL: '' }).rawSQL;
340
+ var onRawSqlChange = function (rawSQL) {
341
+ var query = __assign(__assign({}, props.query), { rawSQL: rawSQL });
342
+ props.onChange(query);
343
+ props.onRunQuery();
344
+ };
345
+ // Use a reference for suggestions because a bug in CodeEditor getSuggestions
346
+ // https://github.com/grafana/grafana/issues/40121
347
+ // It was been fixed in 8.3 but keeping the workaround here to support older
348
+ // versions.
349
+ var suggestionsRef = React.useRef([]);
350
+ React.useEffect(function () {
351
+ suggestionsRef.current = getSuggestions(query);
352
+ }, [getSuggestions, query]);
353
+ return (React__default.createElement(ui.CodeEditor, __assign({ language: props.language, value: rawSQL, onBlur: onRawSqlChange, showMiniMap: false, showLineNumbers: true, getSuggestions: function () { return suggestionsRef.current; }, height: "240px" }, props.editorProps)));
354
+ }
355
+
356
+ function FormatSelect(props) {
357
+ var onChangeFormat = function (e) {
358
+ props.onChange(__assign(__assign({}, props.query), { format: e.value || 0 }));
359
+ props.onRunQuery();
360
+ };
361
+ return (React__default.createElement(ui.InlineField, { label: "Format as", labelWidth: 11 },
362
+ React__default.createElement(ui.Select, { "aria-label": "Format as", options: props.options, value: props.query.format, onChange: onChangeFormat, className: "width-12" })));
363
+ }
364
+
365
+ var FillValueOptions;
366
+ (function (FillValueOptions) {
367
+ FillValueOptions[FillValueOptions["Previous"] = 0] = "Previous";
368
+ FillValueOptions[FillValueOptions["Null"] = 1] = "Null";
369
+ FillValueOptions[FillValueOptions["Value"] = 2] = "Value";
370
+ })(FillValueOptions || (FillValueOptions = {}));
371
+ var SelectableFillValueOptions = [
372
+ {
373
+ label: 'Previous Value',
374
+ value: FillValueOptions.Previous,
375
+ },
376
+ {
377
+ label: 'NULL',
378
+ value: FillValueOptions.Null,
379
+ },
380
+ {
381
+ label: 'Value',
382
+ value: FillValueOptions.Value,
383
+ },
384
+ ];
385
+ function FillValueSelect(props) {
386
+ var _a, _b, _c;
387
+ return (React__default.createElement(React__default.Fragment, null,
388
+ React__default.createElement(ui.InlineField, { label: "Fill value", tooltip: "value to fill missing points" },
389
+ React__default.createElement(ui.Select, { "aria-label": "Fill value", options: SelectableFillValueOptions, value: (_b = (_a = props.query.fillMode) === null || _a === void 0 ? void 0 : _a.mode) !== null && _b !== void 0 ? _b : FillValueOptions.Previous, onChange: function (_a) {
390
+ var value = _a.value;
391
+ props.onChange(__assign(__assign({}, props.query), {
392
+ // Keep the fillMode.value in case FillValueOptions.Value mode is selected back
393
+ fillMode: __assign(__assign({}, props.query.fillMode), { mode: value }) }));
394
+ props.onRunQuery();
395
+ }, className: "width-12" })),
396
+ ((_c = props.query.fillMode) === null || _c === void 0 ? void 0 : _c.mode) === FillValueOptions.Value && (React__default.createElement(ui.InlineField, { label: "Value", labelWidth: 11 },
397
+ React__default.createElement(ui.Input, { type: "number", "aria-label": "Value", value: props.query.fillMode.value, onChange: function (_a) {
398
+ var currentTarget = _a.currentTarget;
399
+ return props.onChange(__assign(__assign({}, props.query), { fillMode: {
400
+ mode: FillValueOptions.Value,
401
+ value: currentTarget.valueAsNumber,
402
+ } }));
403
+ }, onBlur: function () { return props.onRunQuery(); } })))));
404
+ }
405
+
406
+ /**
407
+ * Do not execute queries that do not exist yet
408
+ */
409
+ function filterSQLQuery(query) {
410
+ return !!query.rawSQL;
411
+ }
412
+ function applySQLTemplateVariables(query, scopedVars, getTemplateSrv) {
413
+ var templateSrv = getTemplateSrv();
414
+ return __assign(__assign({}, query), { rawSQL: templateSrv.replace(query.rawSQL, scopedVars, interpolateVariable) });
415
+ }
416
+ function interpolateVariable(value) {
417
+ if (typeof value === 'string') {
418
+ return value;
419
+ }
420
+ var quotedValues = value.map(function (v) {
421
+ return quoteLiteral(v);
422
+ });
423
+ return quotedValues.join(',');
424
+ }
425
+ function quoteLiteral(value) {
426
+ return "'" + String(value).replace(/'/g, "''") + "'";
427
+ }
428
+ var appendTemplateVariablesAsSuggestions = function (getTemplateSrv, sugs) {
429
+ var templateSrv = getTemplateSrv();
430
+ var templateSugs = [];
431
+ templateSrv.getVariables().forEach(function (variable) {
432
+ var label = '$' + variable.name;
433
+ var val = templateSrv.replace(label);
434
+ if (val === label) {
435
+ val = '';
436
+ }
437
+ templateSugs.push({
438
+ label: label,
439
+ kind: ui.CodeEditorSuggestionItemKind.Text,
440
+ detail: "(Template Variable) " + val,
441
+ });
442
+ });
443
+ return sugs.concat(templateSugs);
444
+ };
445
+
446
+ exports.ConfigSelect = ConfigSelect;
183
447
  exports.ConnectionConfig = ConnectionConfig;
448
+ exports.FillValueSelect = FillValueSelect;
449
+ exports.FormatSelect = FormatSelect;
450
+ exports.InlineInput = InlineInput;
451
+ exports.QueryCodeEditor = QueryCodeEditor;
452
+ exports.ResourceSelector = ResourceSelector;
453
+ exports.appendTemplateVariablesAsSuggestions = appendTemplateVariablesAsSuggestions;
454
+ exports.applySQLTemplateVariables = applySQLTemplateVariables;
184
455
  exports.awsAuthProviderOptions = awsAuthProviderOptions;
185
- exports.selectors = selectors;
456
+ exports.filterSQLQuery = filterSQLQuery;
186
457
  exports.standardRegions = standardRegions;
187
458
  //# sourceMappingURL=index.development.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.development.js","sources":["../src/regions.ts","../src/types.ts","../src/providers.ts","../src/selectors.ts","../src/ConnectionConfig.tsx"],"sourcesContent":["export const standardRegions: string[] = [\n 'af-south-1',\n 'ap-east-1',\n 'ap-northeast-1',\n 'ap-northeast-2',\n 'ap-northeast-3',\n 'ap-south-1',\n 'ap-southeast-1',\n 'ap-southeast-2',\n 'ca-central-1',\n 'cn-north-1',\n 'cn-northwest-1',\n 'eu-central-1',\n 'eu-north-1',\n 'eu-west-1',\n 'eu-west-2',\n 'eu-west-3',\n 'me-south-1',\n 'sa-east-1',\n 'us-east-1',\n 'us-east-2',\n 'us-gov-east-1',\n 'us-gov-west-1',\n 'us-iso-east-1',\n 'us-isob-east-1',\n 'us-west-1',\n 'us-west-2',\n];\n","import { DataSourceJsonData } from '@grafana/data';\n\nexport enum AwsAuthType {\n Keys = 'keys',\n Credentials = 'credentials',\n Default = 'default', // was 'arn',\n EC2IAMRole = 'ec2_iam_role',\n /**\n * @deprecated use default\n */\n ARN = 'arn',\n}\n\nexport interface AwsAuthDataSourceJsonData extends DataSourceJsonData {\n authType?: AwsAuthType;\n assumeRoleArn?: string;\n externalId?: string;\n profile?: string; // Credentials profile name, as specified in ~/.aws/credentials\n defaultRegion?: string; // region if it is not defined by your credentials file\n endpoint?: string;\n}\n\nexport interface AwsAuthDataSourceSecureJsonData {\n accessKey?: string;\n secretKey?: string;\n}\n","import { SelectableValue } from '@grafana/data';\nimport { AwsAuthType } from './types';\n\nexport const awsAuthProviderOptions = [\n {\n label: 'Workspace IAM Role',\n value: AwsAuthType.EC2IAMRole,\n },\n {\n label: 'AWS SDK Default',\n value: AwsAuthType.Default,\n },\n {\n label: 'Access & secret key',\n value: AwsAuthType.Keys,\n },\n {\n label: 'Credentials file',\n value: AwsAuthType.Credentials,\n },\n] as Array<SelectableValue<AwsAuthType>>;\n","import { E2ESelectors } from '@grafana/e2e-selectors';\n\nexport const Components = {\n ConfigEditor: {\n SecretKey: {\n input: 'Config editor secret key input',\n },\n AccessKey: {\n input: 'Config editor access key input',\n },\n },\n};\n\nexport const selectors: { components: E2ESelectors<typeof Components> } = {\n components: Components,\n};\n","import React, { FC, useEffect, useState } from 'react';\nimport { Input, Select, InlineField, ButtonGroup, ToolbarButton, FieldSet } from '@grafana/ui';\nimport {\n DataSourcePluginOptionsEditorProps,\n onUpdateDatasourceJsonDataOptionSelect,\n onUpdateDatasourceResetOption,\n onUpdateDatasourceJsonDataOption,\n onUpdateDatasourceSecureJsonDataOption,\n} from '@grafana/data';\n\nimport { standardRegions } from './regions';\nimport { AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData, AwsAuthType } from './types';\nimport { awsAuthProviderOptions } from './providers';\nimport { selectors } from './selectors';\n\nconst toOption = (value: string) => ({ value, label: value });\n\nexport interface ConnectionConfigProps<J = AwsAuthDataSourceJsonData, S = AwsAuthDataSourceSecureJsonData>\n extends DataSourcePluginOptionsEditorProps<J, S> {\n standardRegions?: string[];\n loadRegions?: () => Promise<string[]>;\n defaultEndpoint?: string;\n skipHeader?: boolean;\n skipEndpoint?: boolean;\n children?: React.ReactNode;\n}\n\nexport const ConnectionConfig: FC<ConnectionConfigProps> = (props: ConnectionConfigProps) => {\n const [regions, setRegions] = useState((props.standardRegions || standardRegions).map(toOption));\n const { loadRegions, onOptionsChange, skipHeader = false, skipEndpoint = false } = props;\n const options = props.options;\n let profile = options.jsonData.profile;\n if (profile === undefined) {\n profile = options.database;\n }\n\n const settings = (window as any).grafanaBootData.settings;\n const awsAllowedAuthProviders = settings.awsAllowedAuthProviders ?? [\n AwsAuthType.Default,\n AwsAuthType.Keys,\n AwsAuthType.Credentials,\n ];\n const awsAssumeRoleEnabled = settings.awsAssumeRoleEnabled ?? true;\n\n const currentProvider = awsAuthProviderOptions.find((p) => p.value === options.jsonData.authType);\n\n useEffect(() => {\n // Make sure a authType exists in the current model\n if (!currentProvider && awsAllowedAuthProviders.length) {\n onOptionsChange({\n ...options,\n jsonData: {\n ...options.jsonData,\n authType: awsAllowedAuthProviders[0],\n },\n });\n }\n }, [currentProvider, options, onOptionsChange]);\n\n useEffect(() => {\n if (!loadRegions) {\n return;\n }\n\n loadRegions().then((regions) => setRegions(regions.map(toOption)));\n }, [loadRegions]);\n\n return (\n <FieldSet label={skipHeader ? '' : 'Connection Details'} data-testid=\"connection-config\">\n <InlineField\n label=\"Authentication Provider\"\n labelWidth={28}\n tooltip=\"Specify which AWS credentials chain to use.\"\n >\n <Select\n className=\"width-30 aws-config-authType\"\n value={currentProvider}\n options={awsAuthProviderOptions.filter((opt) => awsAllowedAuthProviders.includes(opt.value!))}\n defaultValue={options.jsonData.authType}\n onChange={(option) => {\n onUpdateDatasourceJsonDataOptionSelect(props, 'authType')(option);\n }}\n />\n </InlineField>\n {options.jsonData.authType === 'credentials' && (\n <InlineField\n label=\"Credentials Profile Name\"\n labelWidth={28}\n tooltip=\"Credentials profile name, as specified in ~/.aws/credentials, leave blank for default.\"\n >\n <Input\n className=\"width-30\"\n placeholder=\"default\"\n value={profile}\n onChange={onUpdateDatasourceJsonDataOption(props, 'profile')}\n />\n </InlineField>\n )}\n\n {options.jsonData.authType === 'keys' && (\n <>\n <InlineField label=\"Access Key ID\" labelWidth={28}>\n {props.options.secureJsonFields?.accessKey ? (\n <ButtonGroup className=\"width-30\">\n <Input disabled placeholder=\"Configured\" />\n <ToolbarButton\n icon=\"edit\"\n tooltip=\"Edit Access Key ID\"\n type=\"button\"\n onClick={onUpdateDatasourceResetOption(props as any, 'accessKey')}\n />\n </ButtonGroup>\n ) : (\n <Input\n className=\"width-30\"\n value={options.secureJsonData?.accessKey ?? ''}\n onChange={onUpdateDatasourceSecureJsonDataOption(props, 'accessKey')}\n aria-label={selectors.components.ConfigEditor.AccessKey.input}\n />\n )}\n </InlineField>\n\n <InlineField label=\"Secret Access Key\" labelWidth={28}>\n {props.options.secureJsonFields?.secretKey ? (\n <ButtonGroup className=\"width-30\">\n <Input disabled placeholder=\"Configured\" />\n <ToolbarButton\n icon=\"edit\"\n type=\"button\"\n tooltip=\"Edit Secret Access Key\"\n onClick={onUpdateDatasourceResetOption(props as any, 'secretKey')}\n />\n </ButtonGroup>\n ) : (\n <Input\n className=\"width-30\"\n value={options.secureJsonData?.secretKey ?? ''}\n onChange={onUpdateDatasourceSecureJsonDataOption(props, 'secretKey')}\n aria-label={selectors.components.ConfigEditor.SecretKey.input}\n />\n )}\n </InlineField>\n </>\n )}\n\n {awsAssumeRoleEnabled && (\n <>\n <InlineField\n label=\"Assume Role ARN\"\n labelWidth={28}\n tooltip=\"Optionally, specify the ARN of a role to assume. Specifying a role here will ensure that the selected authentication provider is used to assume the specified role rather than using the credentials directly. Leave blank if you don't need to assume a role at all\"\n >\n <Input\n className=\"width-30\"\n placeholder=\"arn:aws:iam:*\"\n value={options.jsonData.assumeRoleArn || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'assumeRoleArn')}\n />\n </InlineField>\n <InlineField\n label=\"External ID\"\n labelWidth={28}\n tooltip=\"If you are assuming a role in another account, that has been created with an external ID, specify the external ID here.\"\n >\n <Input\n className=\"width-30\"\n placeholder=\"External ID\"\n value={options.jsonData.externalId || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'externalId')}\n />\n </InlineField>\n </>\n )}\n {!skipEndpoint && (\n <InlineField label=\"Endpoint\" labelWidth={28} tooltip=\"Optionally, specify a custom endpoint for the service\">\n <Input\n className=\"width-30\"\n placeholder={props.defaultEndpoint ?? 'https://{service}.{region}.amazonaws.com'}\n value={options.jsonData.endpoint || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'endpoint')}\n />\n </InlineField>\n )}\n <InlineField\n label=\"Default Region\"\n labelWidth={28}\n tooltip=\"Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region.\"\n >\n <Select\n className=\"width-30 aws-config-defaultRegion\"\n value={regions.find((region) => region.value === options.jsonData.defaultRegion)}\n options={regions}\n defaultValue={options.jsonData.defaultRegion}\n allowCustomValue={true}\n onChange={onUpdateDatasourceJsonDataOptionSelect(props, 'defaultRegion')}\n formatCreateLabel={(r) => `Use region: ${r}`}\n />\n </InlineField>\n {props.children}\n </FieldSet>\n );\n};\n"],"names":["AwsAuthType","useState","useEffect","React","FieldSet","InlineField","Select","onUpdateDatasourceJsonDataOptionSelect","Input","onUpdateDatasourceJsonDataOption","ButtonGroup","ToolbarButton","onUpdateDatasourceResetOption","onUpdateDatasourceSecureJsonDataOption"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;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aAAa,GAAA,CAAC,EAChF,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,OAAO,CAAC,QAAQ,CAAC,aAAa,EAC5C,gBAAgB,EAAE,IAAI,EACtB,QAAQ,EAAEC,2CAAsC,CAAC,KAAK,EAAE,eAAe,CAAC,EACxE,iBAAiB,EAAE,UAAC,CAAC,IAAK,OAAA,iBAAe,CAAG,GAAA,GAC5C,CACU;QACb,KAAK,CAAC,QAAQ,CACN,EACX;AACJ;;;;;;;;"}
1
+ {"version":3,"file":"index.development.js","sources":["../src/regions.ts","../src/types.ts","../src/providers.ts","../src/ConnectionConfig.tsx","../src/sql/types.ts","../src/sql/ResourceSelector.tsx","../src/sql/ConfigEditor/ConfigSelect.tsx","../src/sql/ConfigEditor/InlineInput.tsx","../src/sql/QueryEditor/QueryCodeEditor.tsx","../src/sql/QueryEditor/FormatSelect.tsx","../src/sql/QueryEditor/FillValueSelect.tsx","../src/sql/utils/utils.ts"],"sourcesContent":["export const standardRegions: string[] = [\n 'af-south-1',\n 'ap-east-1',\n 'ap-northeast-1',\n 'ap-northeast-2',\n 'ap-northeast-3',\n 'ap-south-1',\n 'ap-southeast-1',\n 'ap-southeast-2',\n 'ca-central-1',\n 'cn-north-1',\n 'cn-northwest-1',\n 'eu-central-1',\n 'eu-north-1',\n 'eu-west-1',\n 'eu-west-2',\n 'eu-west-3',\n 'me-south-1',\n 'sa-east-1',\n 'us-east-1',\n 'us-east-2',\n 'us-gov-east-1',\n 'us-gov-west-1',\n 'us-iso-east-1',\n 'us-isob-east-1',\n 'us-west-1',\n 'us-west-2',\n];\n","import { DataSourceJsonData, DataSourceSettings } from '@grafana/data';\n\nexport enum AwsAuthType {\n Keys = 'keys',\n Credentials = 'credentials',\n Default = 'default', // was 'arn',\n EC2IAMRole = 'ec2_iam_role',\n /**\n * @deprecated use default\n */\n ARN = 'arn',\n}\n\nexport interface AwsAuthDataSourceJsonData extends DataSourceJsonData {\n authType?: AwsAuthType;\n assumeRoleArn?: string;\n externalId?: string;\n profile?: string; // Credentials profile name, as specified in ~/.aws/credentials\n defaultRegion?: string; // region if it is not defined by your credentials file\n endpoint?: string;\n}\n\nexport interface AwsAuthDataSourceSecureJsonData {\n accessKey?: string;\n secretKey?: string;\n sessionToken?: string;\n}\n\nexport type AwsAuthDataSourceSettings = DataSourceSettings<AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData>;\n","import { SelectableValue } from '@grafana/data';\nimport { AwsAuthType } from './types';\n\nexport const awsAuthProviderOptions = [\n {\n label: 'Workspace IAM Role',\n value: AwsAuthType.EC2IAMRole,\n },\n {\n label: 'AWS SDK Default',\n value: AwsAuthType.Default,\n },\n {\n label: 'Access & secret key',\n value: AwsAuthType.Keys,\n },\n {\n label: 'Credentials file',\n value: AwsAuthType.Credentials,\n },\n] as Array<SelectableValue<AwsAuthType>>;\n","import React, { FC, useEffect, useState } from 'react';\nimport { Input, Select, InlineField, ButtonGroup, ToolbarButton, FieldSet } from '@grafana/ui';\nimport {\n DataSourcePluginOptionsEditorProps,\n onUpdateDatasourceJsonDataOptionSelect,\n onUpdateDatasourceResetOption,\n onUpdateDatasourceJsonDataOption,\n onUpdateDatasourceSecureJsonDataOption,\n} from '@grafana/data';\n\nimport { standardRegions } from './regions';\nimport { AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData, AwsAuthType } from './types';\nimport { awsAuthProviderOptions } from './providers';\n\nconst toOption = (value: string) => ({ value, label: value });\n\nexport interface ConnectionConfigProps<J = AwsAuthDataSourceJsonData, S = AwsAuthDataSourceSecureJsonData>\n extends DataSourcePluginOptionsEditorProps<J, S> {\n standardRegions?: string[];\n loadRegions?: () => Promise<string[]>;\n defaultEndpoint?: string;\n skipHeader?: boolean;\n skipEndpoint?: boolean;\n children?: React.ReactNode;\n}\n\nexport const ConnectionConfig: FC<ConnectionConfigProps> = (props: ConnectionConfigProps) => {\n const [regions, setRegions] = useState((props.standardRegions || standardRegions).map(toOption));\n const { loadRegions, onOptionsChange, skipHeader = false, skipEndpoint = false } = props;\n const options = props.options;\n let profile = options.jsonData.profile;\n if (profile === undefined) {\n profile = options.database;\n }\n\n const settings = (window as any).grafanaBootData.settings;\n const awsAllowedAuthProviders = settings.awsAllowedAuthProviders ?? [\n AwsAuthType.Default,\n AwsAuthType.Keys,\n AwsAuthType.Credentials,\n ];\n const awsAssumeRoleEnabled = settings.awsAssumeRoleEnabled ?? true;\n\n const currentProvider = awsAuthProviderOptions.find((p) => p.value === options.jsonData.authType);\n\n useEffect(() => {\n // Make sure a authType exists in the current model\n if (!currentProvider && awsAllowedAuthProviders.length) {\n onOptionsChange({\n ...options,\n jsonData: {\n ...options.jsonData,\n authType: awsAllowedAuthProviders[0],\n },\n });\n }\n }, [currentProvider, options, onOptionsChange]);\n\n useEffect(() => {\n if (!loadRegions) {\n return;\n }\n\n loadRegions().then((regions) => setRegions(regions.map(toOption)));\n }, [loadRegions]);\n\n return (\n <FieldSet label={skipHeader ? '' : 'Connection Details'} data-testid=\"connection-config\">\n <InlineField\n label=\"Authentication Provider\"\n labelWidth={28}\n tooltip=\"Specify which AWS credentials chain to use.\"\n >\n <Select\n aria-label=\"Authentication Provider\"\n className=\"width-30\"\n value={currentProvider}\n options={awsAuthProviderOptions.filter((opt) => awsAllowedAuthProviders.includes(opt.value!))}\n defaultValue={options.jsonData.authType}\n onChange={(option) => {\n onUpdateDatasourceJsonDataOptionSelect(props, 'authType')(option);\n }}\n />\n </InlineField>\n {options.jsonData.authType === 'credentials' && (\n <InlineField\n label=\"Credentials Profile Name\"\n labelWidth={28}\n tooltip=\"Credentials profile name, as specified in ~/.aws/credentials, leave blank for default.\"\n >\n <Input\n aria-label=\"Credentials Profile Name\"\n className=\"width-30\"\n placeholder=\"default\"\n value={profile}\n onChange={onUpdateDatasourceJsonDataOption(props, 'profile')}\n />\n </InlineField>\n )}\n\n {options.jsonData.authType === 'keys' && (\n <>\n <InlineField label=\"Access Key ID\" labelWidth={28}>\n {props.options.secureJsonFields?.accessKey ? (\n <ButtonGroup className=\"width-30\">\n <Input disabled placeholder=\"Configured\" />\n <ToolbarButton\n icon=\"edit\"\n tooltip=\"Edit Access Key ID\"\n type=\"button\"\n onClick={onUpdateDatasourceResetOption(props as any, 'accessKey')}\n />\n </ButtonGroup>\n ) : (\n <Input\n aria-label=\"Access Key ID\"\n className=\"width-30\"\n value={options.secureJsonData?.accessKey ?? ''}\n onChange={onUpdateDatasourceSecureJsonDataOption(props, 'accessKey')}\n />\n )}\n </InlineField>\n\n <InlineField label=\"Secret Access Key\" labelWidth={28}>\n {props.options.secureJsonFields?.secretKey ? (\n <ButtonGroup className=\"width-30\">\n <Input disabled placeholder=\"Configured\" />\n <ToolbarButton\n icon=\"edit\"\n type=\"button\"\n tooltip=\"Edit Secret Access Key\"\n onClick={onUpdateDatasourceResetOption(props as any, 'secretKey')}\n />\n </ButtonGroup>\n ) : (\n <Input\n aria-label=\"Secret Access Key\"\n className=\"width-30\"\n value={options.secureJsonData?.secretKey ?? ''}\n onChange={onUpdateDatasourceSecureJsonDataOption(props, 'secretKey')}\n />\n )}\n </InlineField>\n </>\n )}\n\n {awsAssumeRoleEnabled && (\n <>\n <InlineField\n label=\"Assume Role ARN\"\n labelWidth={28}\n tooltip=\"Optionally, specify the ARN of a role to assume. Specifying a role here will ensure that the selected authentication provider is used to assume the specified role rather than using the credentials directly. Leave blank if you don't need to assume a role at all\"\n >\n <Input\n aria-label=\"Assume Role ARN\"\n className=\"width-30\"\n placeholder=\"arn:aws:iam:*\"\n value={options.jsonData.assumeRoleArn || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'assumeRoleArn')}\n />\n </InlineField>\n <InlineField\n label=\"External ID\"\n labelWidth={28}\n tooltip=\"If you are assuming a role in another account, that has been created with an external ID, specify the external ID here.\"\n >\n <Input\n aria-label=\"External ID\"\n className=\"width-30\"\n placeholder=\"External ID\"\n value={options.jsonData.externalId || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'externalId')}\n />\n </InlineField>\n </>\n )}\n {!skipEndpoint && (\n <InlineField label=\"Endpoint\" labelWidth={28} tooltip=\"Optionally, specify a custom endpoint for the service\">\n <Input\n aria-label=\"Endpoint\"\n className=\"width-30\"\n placeholder={props.defaultEndpoint ?? 'https://{service}.{region}.amazonaws.com'}\n value={options.jsonData.endpoint || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'endpoint')}\n />\n </InlineField>\n )}\n <InlineField\n label=\"Default Region\"\n labelWidth={28}\n tooltip=\"Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region.\"\n >\n <Select\n aria-label=\"Default Region\"\n className=\"width-30\"\n value={regions.find((region) => region.value === options.jsonData.defaultRegion)}\n options={regions}\n defaultValue={options.jsonData.defaultRegion}\n allowCustomValue={true}\n onChange={onUpdateDatasourceJsonDataOptionSelect(props, 'defaultRegion')}\n formatCreateLabel={(r) => `Use region: ${r}`}\n />\n </InlineField>\n {props.children}\n </FieldSet>\n );\n};\n","import { DataQuery } from '@grafana/data';\nimport { FillValueOptions } from './QueryEditor/FillValueSelect';\n\nexport const defaultKey = '__default';\n\nexport interface SQLQuery extends DataQuery {\n rawSQL: string;\n format?: number;\n fillMode?: { mode: FillValueOptions; value?: number };\n}\n","import React, { useState, useEffect, useMemo } from 'react';\nimport { SelectableValue } from '@grafana/data';\nimport { InlineField, Select } from '@grafana/ui';\nimport { isEqual } from 'lodash';\nimport { defaultKey } from './types';\n\nexport type ResourceSelectorProps = {\n value: string | null;\n fetch: () => Promise<Array<string | SelectableValue<string>>>;\n onChange: (e: SelectableValue<string> | null) => void;\n dependencies?: Array<string | null | undefined>;\n tooltip?: string;\n label?: string;\n 'data-testid'?: string;\n hidden?: boolean;\n // Options only needed for QueryEditor\n default?: string;\n // Options only needed for the ConfigEditor\n title?: string;\n disabled?: boolean;\n labelWidth?: number;\n className?: string;\n saveOptions?: () => Promise<void>;\n};\n\nexport function ResourceSelector(props: ResourceSelectorProps) {\n const [resource, setResource] = useState<string | null>(props.value || props.default || null);\n const [resources, setResources] = useState<Array<string | SelectableValue>>(resource ? [resource] : []);\n const [dependencies, setDependencies] = useState(props.dependencies);\n const [isLoading, setIsLoading] = useState(false);\n const [fetched, setFetched] = useState(false);\n const defaultOpts = useMemo(() => {\n const opts: Array<SelectableValue<string>> = [\n {\n label: `default (${props.default})`,\n value: defaultKey,\n description: `Default value set in the data source`,\n },\n ];\n if (props.value && props.value !== defaultKey) {\n opts.push({ label: props.value, value: props.value });\n }\n return opts;\n }, [props.default, props.value]);\n const [options, setOptions] = useState<Array<SelectableValue<string>>>(props.default ? defaultOpts : []);\n useEffect(() => {\n if (resources.length) {\n const newOptions: Array<SelectableValue<string>> = props.default ? defaultOpts : [];\n resources.forEach((r) => {\n const value = typeof r === 'string' ? r : r.value;\n if (!newOptions.find((o) => o.value === value)) {\n typeof r === 'string' ? newOptions.push({ label: r, value: r }) : newOptions.push(r);\n }\n });\n setOptions(newOptions);\n } else {\n setOptions([]);\n }\n }, [resources, defaultOpts, props.default]);\n\n useEffect(() => {\n // A change in the dependencies cause a state clean-up\n if (!isEqual(props.dependencies, dependencies)) {\n setFetched(false);\n setResources([]);\n setResource(null);\n props.onChange(null);\n setDependencies(props.dependencies);\n }\n }, [props, dependencies]);\n\n const fetch = async () => {\n if (fetched) {\n return;\n }\n if (props.saveOptions) {\n await props.saveOptions();\n }\n try {\n const resources = await props.fetch();\n setResources(resources);\n } finally {\n setFetched(true);\n }\n };\n\n const onChange = (e: SelectableValue<string>) => {\n props.onChange(e);\n if (e.value) {\n setResource(e.value);\n }\n };\n const onClick = async () => {\n setIsLoading(true);\n try {\n await fetch();\n } finally {\n setIsLoading(false);\n }\n };\n\n return (\n <InlineField label={props.label} labelWidth={props.labelWidth} tooltip={props.tooltip} hidden={props.hidden}>\n <div data-testid={props['data-testid']} title={props.title}>\n <Select\n aria-label={props.label}\n options={options}\n value={props.value}\n onChange={onChange}\n isLoading={isLoading}\n className={props.className || 'min-width-6'}\n disabled={props.disabled}\n onOpenMenu={onClick}\n />\n </div>\n </InlineField>\n );\n}\n","import React from 'react';\nimport { DataSourcePluginOptionsEditorProps, SelectableValue } from '@grafana/data';\nimport { AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData } from '../../types';\nimport { ResourceSelector } from '../ResourceSelector';\n\nexport interface ConfigSelectProps\n extends DataSourcePluginOptionsEditorProps<AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData> {\n value: string;\n fetch: () => Promise<Array<string | SelectableValue<string>>>;\n onChange: (e: SelectableValue<string> | null) => void;\n dependencies?: string[];\n label?: string;\n 'data-testid'?: string;\n hidden?: boolean;\n disabled?: boolean;\n saveOptions: () => Promise<void>;\n}\n\nexport function ConfigSelect(props: ConfigSelectProps) {\n const { jsonData } = props.options;\n const commonProps = {\n title: jsonData.defaultRegion ? '' : 'select a default region',\n disabled: !jsonData.defaultRegion,\n labelWidth: 28,\n className: 'width-30',\n };\n // Any change in the AWS connection details will affect selectors\n const dependencies: string[] = [\n props.options.jsonData.assumeRoleArn,\n props.options.jsonData.authType,\n props.options.jsonData.defaultRegion,\n props.options.jsonData.endpoint,\n props.options.jsonData.externalId,\n props.options.jsonData.profile,\n ].concat(props.dependencies);\n return (\n <ResourceSelector\n label={props.label}\n data-testid={props['data-testid']}\n onChange={props.onChange}\n fetch={props.fetch}\n value={props.value}\n saveOptions={props.saveOptions}\n dependencies={dependencies}\n hidden={props.hidden}\n disabled={props.disabled}\n {...commonProps}\n />\n );\n}\n","import React from 'react';\nimport { DataSourcePluginOptionsEditorProps } from '@grafana/data';\nimport { AwsAuthDataSourceSecureJsonData } from '../../types';\nimport { InlineField, Input } from '@grafana/ui';\nimport { FormEvent } from 'react-dom/node_modules/@types/react';\n\nexport interface InlineInputProps extends DataSourcePluginOptionsEditorProps<{}, AwsAuthDataSourceSecureJsonData> {\n value: string;\n onChange: (e: FormEvent<HTMLInputElement>) => void;\n label?: string;\n tooltip?: string;\n placeholder?: string;\n 'data-testid'?: string;\n hidden?: boolean;\n disabled?: boolean;\n}\n\nexport function InlineInput(props: InlineInputProps) {\n return (\n <InlineField\n label={props.label}\n labelWidth={28}\n tooltip={props.tooltip}\n hidden={props.hidden}\n disabled={props.disabled}\n >\n <Input\n data-testid={props['data-testid']}\n className=\"width-30\"\n value={props.value}\n onChange={props.onChange}\n placeholder={props.placeholder}\n disabled={props.disabled}\n />\n </InlineField>\n );\n}\n","import { defaults } from 'lodash';\n\nimport React, { useRef, useEffect } from 'react';\nimport { CodeEditor, CodeEditorSuggestionItem } from '@grafana/ui';\nimport { DataQuery } from '@grafana/data';\nimport { MonacoOptions } from '@grafana/ui/components/Monaco/types';\n\ntype EditorProps = {\n width?: number | string;\n height?: number | string;\n readOnly?: boolean;\n showMiniMap?: boolean;\n showLineNumbers?: boolean;\n monacoOptions?: MonacoOptions;\n};\n\ntype Props<TQuery extends DataQuery> = {\n query: TQuery;\n language: string;\n editorProps?: EditorProps;\n onChange: (value: TQuery) => void;\n onRunQuery: () => void;\n getSuggestions: (query: TQuery) => CodeEditorSuggestionItem[];\n};\n\nexport function QueryCodeEditor<TQuery extends DataQuery>(props: Props<TQuery>) {\n const { getSuggestions, query } = props;\n const { rawSQL } = defaults(props.query, { rawSQL: '' });\n const onRawSqlChange = (rawSQL: string) => {\n const query = {\n ...props.query,\n rawSQL,\n };\n props.onChange(query);\n props.onRunQuery();\n };\n\n // Use a reference for suggestions because a bug in CodeEditor getSuggestions\n // https://github.com/grafana/grafana/issues/40121\n // It was been fixed in 8.3 but keeping the workaround here to support older\n // versions.\n const suggestionsRef = useRef<CodeEditorSuggestionItem[]>([]);\n useEffect(() => {\n suggestionsRef.current = getSuggestions(query);\n }, [getSuggestions, query]);\n\n return (\n <CodeEditor\n language={props.language}\n value={rawSQL}\n onBlur={onRawSqlChange}\n showMiniMap={false}\n showLineNumbers={true}\n getSuggestions={() => suggestionsRef.current}\n height=\"240px\"\n {...props.editorProps}\n />\n );\n}\n","import React from 'react';\nimport { DataQuery, SelectableValue } from '@grafana/data';\nimport { InlineField, Select } from '@grafana/ui';\n\nexport type FormatSelectProps<TQuery extends DataQuery, FormatOptions> = {\n query: TQuery;\n options: Array<SelectableValue<FormatOptions>>;\n onChange: (value: TQuery) => void;\n onRunQuery: () => void;\n};\n\nexport function FormatSelect<TQuery extends DataQuery & Record<string, any>, FormatOptions>(\n props: FormatSelectProps<TQuery, FormatOptions>\n) {\n const onChangeFormat = (e: SelectableValue<FormatOptions>) => {\n props.onChange({\n ...props.query,\n format: e.value || 0,\n });\n props.onRunQuery();\n };\n return (\n <InlineField label=\"Format as\" labelWidth={11}>\n <Select\n aria-label=\"Format as\"\n options={props.options}\n value={props.query.format}\n onChange={onChangeFormat}\n className=\"width-12\"\n />\n </InlineField>\n );\n}\n","import React from 'react';\nimport { DataQuery, SelectableValue } from '@grafana/data';\nimport { InlineField, Input, Select } from '@grafana/ui';\n\nexport enum FillValueOptions {\n Previous,\n Null,\n Value,\n}\n\nexport const SelectableFillValueOptions: Array<SelectableValue<FillValueOptions>> = [\n {\n label: 'Previous Value',\n value: FillValueOptions.Previous,\n },\n {\n label: 'NULL',\n value: FillValueOptions.Null,\n },\n {\n label: 'Value',\n value: FillValueOptions.Value,\n },\n];\n\nexport type FillValueSelectProps<TQuery extends DataQuery> = {\n query: TQuery;\n onChange: (value: TQuery) => void;\n onRunQuery: () => void;\n};\n\nexport function FillValueSelect<TQuery extends DataQuery & Record<string, any>>(props: FillValueSelectProps<TQuery>) {\n return (\n <>\n <InlineField label=\"Fill value\" tooltip=\"value to fill missing points\">\n <Select\n aria-label=\"Fill value\"\n options={SelectableFillValueOptions}\n value={props.query.fillMode?.mode ?? FillValueOptions.Previous}\n onChange={({ value }) => {\n props.onChange({\n ...props.query,\n // Keep the fillMode.value in case FillValueOptions.Value mode is selected back\n fillMode: { ...props.query.fillMode, mode: value },\n });\n props.onRunQuery();\n }}\n className=\"width-12\"\n />\n </InlineField>\n {props.query.fillMode?.mode === FillValueOptions.Value && (\n <InlineField label=\"Value\" labelWidth={11}>\n <Input\n type=\"number\"\n aria-label=\"Value\"\n value={props.query.fillMode.value}\n onChange={({ currentTarget }: React.FormEvent<HTMLInputElement>) =>\n props.onChange({\n ...props.query,\n fillMode: {\n mode: FillValueOptions.Value,\n value: currentTarget.valueAsNumber,\n },\n })\n }\n onBlur={() => props.onRunQuery()}\n />\n </InlineField>\n )}\n </>\n );\n}\n","import { ScopedVars, VariableModel } from '@grafana/data';\nimport { SQLQuery } from '../types';\nimport { CodeEditorSuggestionItem, CodeEditorSuggestionItemKind } from '@grafana/ui';\n\n/**\n * Do not execute queries that do not exist yet\n */\nexport function filterSQLQuery(query: SQLQuery): boolean {\n return !!query.rawSQL;\n}\n\nexport function applySQLTemplateVariables(\n query: SQLQuery,\n scopedVars: ScopedVars,\n getTemplateSrv: () => any\n): SQLQuery {\n const templateSrv = getTemplateSrv();\n return {\n ...query,\n rawSQL: templateSrv.replace(query.rawSQL, scopedVars, interpolateVariable),\n };\n}\n\nfunction interpolateVariable(value: string | string[]) {\n if (typeof value === 'string') {\n return value;\n }\n\n const quotedValues = value.map((v) => {\n return quoteLiteral(v);\n });\n return quotedValues.join(',');\n}\n\nfunction quoteLiteral(value: any) {\n return \"'\" + String(value).replace(/'/g, \"''\") + \"'\";\n}\n\nexport const appendTemplateVariablesAsSuggestions = (getTemplateSrv: () => any, sugs: CodeEditorSuggestionItem[]) => {\n const templateSrv = getTemplateSrv();\n const templateSugs: CodeEditorSuggestionItem[] = [];\n templateSrv.getVariables().forEach((variable: VariableModel) => {\n const label = '$' + variable.name;\n let val = templateSrv.replace(label);\n if (val === label) {\n val = '';\n }\n templateSugs.push({\n label,\n kind: CodeEditorSuggestionItemKind.Text,\n detail: `(Template Variable) ${val}`,\n });\n });\n\n return sugs.concat(templateSugs);\n};\n"],"names":["AwsAuthType","useState","useEffect","React","FieldSet","InlineField","Select","onUpdateDatasourceJsonDataOptionSelect","Input","onUpdateDatasourceJsonDataOption","ButtonGroup","ToolbarButton","onUpdateDatasourceResetOption","onUpdateDatasourceSec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default"in e?e.default:e,n=require("@grafana/ui"),o=require("@grafana/data"),l=function(){return(l=Object.assign||function(e){for(var t,a=1,n=arguments.length;a<n;a++)for(var o in t=arguments[a])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};var s,i=["af-south-1","ap-east-1","ap-northeast-1","ap-northeast-2","ap-northeast-3","ap-south-1","ap-southeast-1","ap-southeast-2","ca-central-1","cn-north-1","cn-northwest-1","eu-central-1","eu-north-1","eu-west-1","eu-west-2","eu-west-3","me-south-1","sa-east-1","us-east-1","us-east-2","us-gov-east-1","us-gov-west-1","us-iso-east-1","us-isob-east-1","us-west-1","us-west-2"];(s=exports.AwsAuthType||(exports.AwsAuthType={})).Keys="keys",s.Credentials="credentials",s.Default="default",s.EC2IAMRole="ec2_iam_role",s.ARN="arn";var r=[{label:"Workspace IAM Role",value:exports.AwsAuthType.EC2IAMRole},{label:"AWS SDK Default",value:exports.AwsAuthType.Default},{label:"Access & secret key",value:exports.AwsAuthType.Keys},{label:"Credentials file",value:exports.AwsAuthType.Credentials}],u={ConfigEditor:{SecretKey:{input:"Config editor secret key input"},AccessKey:{input:"Config editor access key input"}}},c={components:u},d=function(e){return{value:e,label:e}};exports.Components=u,exports.ConnectionConfig=function(e){var s,u,p,h,f,y,m,v,g,D=function(e,t){var a="function"==typeof Symbol&&e[Symbol.iterator];if(!a)return e;var n,o,l=a.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=l.next()).done;)s.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(a=l.return)&&a.call(l)}finally{if(o)throw o.error}}return s}(t.useState((e.standardRegions||i).map(d)),2),w=D[0],b=D[1],A=e.loadRegions,E=e.onOptionsChange,C=e.skipHeader,I=void 0!==C&&C,x=e.skipEndpoint,S=void 0!==x&&x,K=e.options,R=K.jsonData.profile;void 0===R&&(R=K.database);var O=window.grafanaBootData.settings,T=null!==(s=O.awsAllowedAuthProviders)&&void 0!==s?s:[exports.AwsAuthType.Default,exports.AwsAuthType.Keys,exports.AwsAuthType.Credentials],j=null===(u=O.awsAssumeRoleEnabled)||void 0===u||u,N=r.find((function(e){return e.value===K.jsonData.authType}));return t.useEffect((function(){!N&&T.length&&E(l(l({},K),{jsonData:l(l({},K.jsonData),{authType:T[0]})}))}),[N,K,E]),t.useEffect((function(){A&&A().then((function(e){return b(e.map(d))}))}),[A]),a.createElement(n.FieldSet,{label:I?"":"Connection Details","data-testid":"connection-config"},a.createElement(n.InlineField,{label:"Authentication Provider",labelWidth:28,tooltip:"Specify which AWS credentials chain to use."},a.createElement(n.Select,{className:"width-30 aws-config-authType",value:N,options:r.filter((function(e){return T.includes(e.value)})),defaultValue:K.jsonData.authType,onChange:function(t){o.onUpdateDatasourceJsonDataOptionSelect(e,"authType")(t)}})),"credentials"===K.jsonData.authType&&a.createElement(n.InlineField,{label:"Credentials Profile Name",labelWidth:28,tooltip:"Credentials profile name, as specified in ~/.aws/credentials, leave blank for default."},a.createElement(n.Input,{className:"width-30",placeholder:"default",value:R,onChange:o.onUpdateDatasourceJsonDataOption(e,"profile")})),"keys"===K.jsonData.authType&&a.createElement(a.Fragment,null,a.createElement(n.InlineField,{label:"Access Key ID",labelWidth:28},(null===(p=e.options.secureJsonFields)||void 0===p?void 0:p.accessKey)?a.createElement(n.ButtonGroup,{className:"width-30"},a.createElement(n.Input,{disabled:!0,placeholder:"Configured"}),a.createElement(n.ToolbarButton,{icon:"edit",tooltip:"Edit Access Key ID",type:"button",onClick:o.onUpdateDatasourceResetOption(e,"accessKey")})):a.createElement(n.Input,{className:"width-30",value:null!==(f=null===(h=K.secureJsonData)||void 0===h?void 0:h.accessKey)&&void 0!==f?f:"",onChange:o.onUpdateDatasourceSecureJsonDataOption(e,"accessKey"),"aria-label":c.components.ConfigEditor.AccessKey.input})),a.createElement(n.InlineField,{label:"Secret Access Key",labelWidth:28},(null===(y=e.options.secureJsonFields)||void 0===y?void 0:y.secretKey)?a.createElement(n.ButtonGroup,{className:"width-30"},a.createElement(n.Input,{disabled:!0,placeholder:"Configured"}),a.createElement(n.ToolbarButton,{icon:"edit",type:"button",tooltip:"Edit Secret Access Key",onClick:o.onUpdateDatasourceResetOption(e,"secretKey")})):a.createElement(n.Input,{className:"width-30",value:null!==(v=null===(m=K.secureJsonData)||void 0===m?void 0:m.secretKey)&&void 0!==v?v:"",onChange:o.onUpdateDatasourceSecureJsonDataOption(e,"secretKey"),"aria-label":c.components.ConfigEditor.SecretKey.input}))),j&&a.createElement(a.Fragment,null,a.createElement(n.InlineField,{label:"Assume Role ARN",labelWidth:28,tooltip:"Optionally, specify the ARN of a role to assume. Specifying a role here will ensure that the selected authentication provider is used to assume the specified role rather than using the credentials directly. Leave blank if you don't need to assume a role at all"},a.createElement(n.Input,{className:"width-30",placeholder:"arn:aws:iam:*",value:K.jsonData.assumeRoleArn||"",onChange:o.onUpdateDatasourceJsonDataOption(e,"assumeRoleArn")})),a.createElement(n.InlineField,{label:"External ID",labelWidth:28,tooltip:"If you are assuming a role in another account, that has been created with an external ID, specify the external ID here."},a.createElement(n.Input,{className:"width-30",placeholder:"External ID",value:K.jsonData.externalId||"",onChange:o.onUpdateDatasourceJsonDataOption(e,"externalId")}))),!S&&a.createElement(n.InlineField,{label:"Endpoint",labelWidth:28,tooltip:"Optionally, specify a custom endpoint for the service"},a.createElement(n.Input,{className:"width-30",placeholder:null!==(g=e.defaultEndpoint)&&void 0!==g?g:"https://{service}.{region}.amazonaws.com",value:K.jsonData.endpoint||"",onChange:o.onUpdateDatasourceJsonDataOption(e,"endpoint")})),a.createElement(n.InlineField,{label:"Default Region",labelWidth:28,tooltip:"Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region."},a.createElement(n.Select,{className:"width-30 aws-config-defaultRegion",value:w.find((function(e){return e.value===K.jsonData.defaultRegion})),options:w,defaultValue:K.jsonData.defaultRegion,allowCustomValue:!0,onChange:o.onUpdateDatasourceJsonDataOptionSelect(e,"defaultRegion"),formatCreateLabel:function(e){return"Use region: "+e}})),e.children)},exports.awsAuthProviderOptions=r,exports.selectors=c,exports.standardRegions=i;
1
+ Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),a=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,n=require("@grafana/ui"),l=require("@grafana/data"),o=require("lodash"),r=function(){return(r=Object.assign||function(e){for(var t,a=1,n=arguments.length;a<n;a++)for(var l in t=arguments[a])Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l]);return e}).apply(this,arguments)};function i(e,t,a,n){return new(a||(a=Promise))((function(l,o){function r(e){try{u(n.next(e))}catch(e){o(e)}}function i(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?l(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(r,i)}u((n=n.apply(e,t||[])).next())}))}function u(e,t){var a,n,l,o,r={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(o){return function(i){return function(o){if(a)throw new TypeError("Generator is already executing.");for(;r;)try{if(a=1,n&&(l=2&o[0]?n.return:o[0]?n.throw||((l=n.return)&&l.call(n),0):n.next)&&!(l=l.call(n,o[1])).done)return l;switch(n=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return r.label++,{value:o[1],done:!1};case 5:r.label++,n=o[1],o=[0];continue;case 7:o=r.ops.pop(),r.trys.pop();continue;default:if(!(l=r.trys,(l=l.length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){r=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){r.label=o[1];break}if(6===o[0]&&r.label<l[1]){r.label=l[1],l=o;break}if(l&&r.label<l[2]){r.label=l[2],r.ops.push(o);break}l[2]&&r.ops.pop(),r.trys.pop();continue}o=t.call(e,r)}catch(e){o=[6,e],n=0}finally{a=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,i])}}}function s(e,t){var a="function"==typeof Symbol&&e[Symbol.iterator];if(!a)return e;var n,l,o=a.call(e),r=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)r.push(n.value)}catch(e){l={error:e}}finally{try{n&&!n.done&&(a=o.return)&&a.call(o)}finally{if(l)throw l.error}}return r}var c,d=["af-south-1","ap-east-1","ap-northeast-1","ap-northeast-2","ap-northeast-3","ap-south-1","ap-southeast-1","ap-southeast-2","ca-central-1","cn-north-1","cn-northwest-1","eu-central-1","eu-north-1","eu-west-1","eu-west-2","eu-west-3","me-south-1","sa-east-1","us-east-1","us-east-2","us-gov-east-1","us-gov-west-1","us-iso-east-1","us-isob-east-1","us-west-1","us-west-2"];(c=exports.AwsAuthType||(exports.AwsAuthType={})).Keys="keys",c.Credentials="credentials",c.Default="default",c.EC2IAMRole="ec2_iam_role",c.ARN="arn";var p,f=[{label:"Workspace IAM Role",value:exports.AwsAuthType.EC2IAMRole},{label:"AWS SDK Default",value:exports.AwsAuthType.Default},{label:"Access & secret key",value:exports.AwsAuthType.Keys},{label:"Credentials file",value:exports.AwsAuthType.Credentials}],h=function(e){return{value:e,label:e}};function v(e){var l=this,r=s(t.useState(e.value||e.default||null),2),c=r[0],d=r[1],p=s(t.useState(c?[c]:[]),2),f=p[0],h=p[1],v=s(t.useState(e.dependencies),2),b=v[0],m=v[1],y=s(t.useState(!1),2),g=y[0],w=y[1],E=s(t.useState(!1),2),D=E[0],S=E[1],A=t.useMemo((function(){var t=[{label:"default ("+e.default+")",value:"__default",description:"Default value set in the data source"}];return e.value&&"__default"!==e.value&&t.push({label:e.value,value:e.value}),t}),[e.default,e.value]),C=s(t.useState(e.default?A:[]),2),I=C[0],x=C[1];t.useEffect((function(){if(f.length){var t=e.default?A:[];f.forEach((function(e){var a="string"==typeof e?e:e.value;t.find((function(e){return e.value===a}))||("string"==typeof e?t.push({label:e,value:e}):t.push(e))})),x(t)}else x([])}),[f,A,e.default]),t.useEffect((function(){o.isEqual(e.dependencies,b)||(S(!1),h([]),d(null),e.onChange(null),m(e.dependencies))}),[e,b]);return a.createElement(n.InlineField,{label:e.label,labelWidth:e.labelWidth,tooltip:e.tooltip,hidden:e.hidden},a.createElement("div",{"data-testid":e["data-testid"],title:e.title},a.createElement(n.Select,{"aria-label":e.label,options:I,value:e.value,onChange:function(t){e.onChange(t),t.value&&d(t.value)},isLoading:g,className:e.className||"min-width-6",disabled:e.disabled,onOpenMenu:function(){return i(l,void 0,void 0,(function(){return u(this,(function(t){switch(t.label){case 0:w(!0),t.label=1;case 1:return t.trys.push([1,,3,4]),[4,i(l,void 0,void 0,(function(){var t;return u(this,(function(a){switch(a.label){case 0:return D?[2]:e.saveOptions?[4,e.saveOptions()]:[3,2];case 1:a.sent(),a.label=2;case 2:return a.trys.push([2,,4,5]),[4,e.fetch()];case 3:return t=a.sent(),h(t),[3,5];case 4:return S(!0),[7];case 5:return[2]}}))}))];case 2:return t.sent(),[3,4];case 3:return w(!1),[7];case 4:return[2]}}))}))}})))}!function(e){e[e.Previous=0]="Previous",e[e.Null=1]="Null",e[e.Value=2]="Value"}(p||(p={}));var b=[{label:"Previous Value",value:p.Previous},{label:"NULL",value:p.Null},{label:"Value",value:p.Value}];function m(e){return"string"==typeof e?e:e.map((function(e){return function(e){return"'"+String(e).replace(/'/g,"''")+"'"}(e)})).join(",")}exports.ConfigSelect=function(e){var t=e.options.jsonData,n={title:t.defaultRegion?"":"select a default region",disabled:!t.defaultRegion,labelWidth:28,className:"width-30"},l=[e.options.jsonData.assumeRoleArn,e.options.jsonData.authType,e.options.jsonData.defaultRegion,e.options.jsonData.endpoint,e.options.jsonData.externalId,e.options.jsonData.profile].concat(e.dependencies);return a.createElement(v,r({label:e.label,"data-testid":e["data-testid"],onChange:e.onChange,fetch:e.fetch,value:e.value,saveOptions:e.saveOptions,dependencies:l,hidden:e.hidden,disabled:e.disabled},n))},exports.ConnectionConfig=function(e){var o,i,u,c,p,v,b,m,y,g=s(t.useState((e.standardRegions||d).map(h)),2),w=g[0],E=g[1],D=e.loadRegions,S=e.onOptionsChange,A=e.skipHeader,C=void 0!==A&&A,I=e.skipEndpoint,x=void 0!==I&&I,R=e.options,N=R.jsonData.profile;void 0===N&&(N=R.database);var F=window.grafanaBootData.settings,j=null!==(o=F.awsAllowedAuthProviders)&&void 0!==o?o:[exports.AwsAuthType.Default,exports.AwsAuthType.Keys,exports.AwsAuthType.Credentials],O=null===(i=F.awsAssumeRoleEnabled)||void 0===i||i,T=f.find((function(e){return e.value===R.jsonData.authType}));return t.useEffect((function(){!T&&j.length&&S(r(r({},R),{jsonData:r(r({},R.jsonData),{authType:j[0]})}))}),[T,R,S]),t.useEffect((function(){D&&D().then((function(e){return E(e.map(h))}))}),[D]),a.createElement(n.FieldSet,{label:C?"":"Connection Details","data-testid":"connection-config"},a.createElement(n.InlineField,{label:"Authentication Provider",labelWidth:28,tooltip:"Specify which AWS credentials chain to use."},a.createElement(n.Select,{"aria-label":"Authentication Provider",className:"width-30",value:T,options:f.filter((function(e){return j.includes(e.value)})),defaultValue:R.jsonData.authType,onChange:function(t){l.onUpdateDatasourceJsonDataOptionSelect(e,"authType")(t)}})),"credentials"===R.jsonData.authType&&a.createElement(n.InlineField,{label:"Credentials Profile Name",labelWidth:28,tooltip:"Credentials profile name, as specified in ~/.aws/credentials, leave blank for default."},a.createElement(n.Input,{"aria-label":"Credentials Profile Name",className:"width-30",placeholder:"default",value:N,onChange:l.onUpdateDatasourceJsonDataOption(e,"profile")})),"keys"===R.jsonData.authType&&a.createElement(a.Fragment,null,a.createElement(n.InlineField,{label:"Access Key ID",labelWidth:28},(null===(u=e.options.secureJsonFields)||void 0===u?void 0:u.accessKey)?a.createElement(n.ButtonGroup,{className:"width-30"},a.createElement(n.Input,{disabled:!0,placeholder:"Configured"}),a.createElement(n.ToolbarButton,{icon:"edit",tooltip:"Edit Access Key ID",type:"button",onClick:l.onUpdateDatasourceResetOption(e,"accessKey")})):a.createElement(n.Input,{"aria-label":"Access Key ID",className:"width-30",value:null!==(p=null===(c=R.secureJsonData)||void 0===c?void 0:c.accessKey)&&void 0!==p?p:"",onChange:l.onUpdateDatasourceSecureJsonDataOption(e,"accessKey")})),a.createElement(n.InlineField,{label:"Secret Access Key",labelWidth:28},(null===(v=e.options.secureJsonFields)||void 0===v?void 0:v.secretKey)?a.createElement(n.ButtonGroup,{className:"width-30"},a.createElement(n.Input,{disabled:!0,placeholder:"Configured"}),a.createElement(n.ToolbarButton,{icon:"edit",type:"button",tooltip:"Edit Secret Access Key",onClick:l.onUpdateDatasourceResetOption(e,"secretKey")})):a.createElement(n.Input,{"aria-label":"Secret Access Key",className:"width-30",value:null!==(m=null===(b=R.secureJsonData)||void 0===b?void 0:b.secretKey)&&void 0!==m?m:"",onChange:l.onUpdateDatasourceSecureJsonDataOption(e,"secretKey")}))),O&&a.createElement(a.Fragment,null,a.createElement(n.InlineField,{label:"Assume Role ARN",labelWidth:28,tooltip:"Optionally, specify the ARN of a role to assume. Specifying a role here will ensure that the selected authentication provider is used to assume the specified role rather than using the credentials directly. Leave blank if you don't need to assume a role at all"},a.createElement(n.Input,{"aria-label":"Assume Role ARN",className:"width-30",placeholder:"arn:aws:iam:*",value:R.jsonData.assumeRoleArn||"",onChange:l.onUpdateDatasourceJsonDataOption(e,"assumeRoleArn")})),a.createElement(n.InlineField,{label:"External ID",labelWidth:28,tooltip:"If you are assuming a role in another account, that has been created with an external ID, specify the external ID here."},a.createElement(n.Input,{"aria-label":"External ID",className:"width-30",placeholder:"External ID",value:R.jsonData.externalId||"",onChange:l.onUpdateDatasourceJsonDataOption(e,"externalId")}))),!x&&a.createElement(n.InlineField,{label:"Endpoint",labelWidth:28,tooltip:"Optionally, specify a custom endpoint for the service"},a.createElement(n.Input,{"aria-label":"Endpoint",className:"width-30",placeholder:null!==(y=e.defaultEndpoint)&&void 0!==y?y:"https://{service}.{region}.amazonaws.com",value:R.jsonData.endpoint||"",onChange:l.onUpdateDatasourceJsonDataOption(e,"endpoint")})),a.createElement(n.InlineField,{label:"Default Region",labelWidth:28,tooltip:"Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region."},a.createElement(n.Select,{"aria-label":"Default Region",className:"width-30",value:w.find((function(e){return e.value===R.jsonData.defaultRegion})),options:w,defaultValue:R.jsonData.defaultRegion,allowCustomValue:!0,onChange:l.onUpdateDatasourceJsonDataOptionSelect(e,"defaultRegion"),formatCreateLabel:function(e){return"Use region: "+e}})),e.children)},exports.FillValueSelect=function(e){var t,l,o;return a.createElement(a.Fragment,null,a.createElement(n.InlineField,{label:"Fill value",tooltip:"value to fill missing points"},a.createElement(n.Select,{"aria-label":"Fill value",options:b,value:null!==(l=null===(t=e.query.fillMode)||void 0===t?void 0:t.mode)&&void 0!==l?l:p.Previous,onChange:function(t){var a=t.value;e.onChange(r(r({},e.query),{fillMode:r(r({},e.query.fillMode),{mode:a})})),e.onRunQuery()},className:"width-12"})),(null===(o=e.query.fillMode)||void 0===o?void 0:o.mode)===p.Value&&a.createElement(n.InlineField,{label:"Value",labelWidth:11},a.createElement(n.Input,{type:"number","aria-label":"Value",value:e.query.fillMode.value,onChange:function(t){var a=t.currentTarget;return e.onChange(r(r({},e.query),{fillMode:{mode:p.Value,value:a.valueAsNumber}}))},onBlur:function(){return e.onRunQuery()}})))},exports.FormatSelect=function(e){return a.createElement(n.InlineField,{label:"Format as",labelWidth:11},a.createElement(n.Select,{"aria-label":"Format as",options:e.options,value:e.query.format,onChange:function(t){e.onChange(r(r({},e.query),{format:t.value||0})),e.onRunQuery()},className:"width-12"}))},exports.InlineInput=function(e){return a.createElement(n.InlineField,{label:e.label,labelWidth:28,tooltip:e.tooltip,hidden:e.hidden,disabled:e.disabled},a.createElement(n.Input,{"data-testid":e["data-testid"],className:"width-30",value:e.value,onChange:e.onChange,placeholder:e.placeholder,disabled:e.disabled}))},exports.QueryCodeEditor=function(e){var l=e.getSuggestions,i=e.query,u=o.defaults(e.query,{rawSQL:""}).rawSQL,s=t.useRef([]);return t.useEffect((function(){s.current=l(i)}),[l,i]),a.createElement(n.CodeEditor,r({language:e.language,value:u,onBlur:function(t){var a=r(r({},e.query),{rawSQL:t});e.onChange(a),e.onRunQuery()},showMiniMap:!1,showLineNumbers:!0,getSuggestions:function(){return s.current},height:"240px"},e.editorProps))},exports.ResourceSelector=v,exports.appendTemplateVariablesAsSuggestions=function(e,t){var a=e(),l=[];return a.getVariables().forEach((function(e){var t="$"+e.name,o=a.replace(t);o===t&&(o=""),l.push({label:t,kind:n.CodeEditorSuggestionItemKind.Text,detail:"(Template Variable) "+o})})),t.concat(l)},exports.applySQLTemplateVariables=function(e,t,a){var n=a();return r(r({},e),{rawSQL:n.replace(e.rawSQL,t,m)})},exports.awsAuthProviderOptions=f,exports.filterSQLQuery=function(e){return!!e.rawSQL},exports.standardRegions=d;
2
2
  //# sourceMappingURL=index.production.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.production.js","sources":["../src/types.ts","../src/regions.ts","../src/providers.ts","../src/selectors.ts","../src/ConnectionConfig.tsx"],"sourcesContent":["import { DataSourceJsonData } from '@grafana/data';\n\nexport enum AwsAuthType {\n Keys = 'keys',\n Credentials = 'credentials',\n Default = 'default', // was 'arn',\n EC2IAMRole = 'ec2_iam_role',\n /**\n * @deprecated use default\n */\n ARN = 'arn',\n}\n\nexport interface AwsAuthDataSourceJsonData extends DataSourceJsonData {\n authType?: AwsAuthType;\n assumeRoleArn?: string;\n externalId?: string;\n profile?: string; // Credentials profile name, as specified in ~/.aws/credentials\n defaultRegion?: string; // region if it is not defined by your credentials file\n endpoint?: string;\n}\n\nexport interface AwsAuthDataSourceSecureJsonData {\n accessKey?: string;\n secretKey?: string;\n}\n","export const standardRegions: string[] = [\n 'af-south-1',\n 'ap-east-1',\n 'ap-northeast-1',\n 'ap-northeast-2',\n 'ap-northeast-3',\n 'ap-south-1',\n 'ap-southeast-1',\n 'ap-southeast-2',\n 'ca-central-1',\n 'cn-north-1',\n 'cn-northwest-1',\n 'eu-central-1',\n 'eu-north-1',\n 'eu-west-1',\n 'eu-west-2',\n 'eu-west-3',\n 'me-south-1',\n 'sa-east-1',\n 'us-east-1',\n 'us-east-2',\n 'us-gov-east-1',\n 'us-gov-west-1',\n 'us-iso-east-1',\n 'us-isob-east-1',\n 'us-west-1',\n 'us-west-2',\n];\n","import { SelectableValue } from '@grafana/data';\nimport { AwsAuthType } from './types';\n\nexport const awsAuthProviderOptions = [\n {\n label: 'Workspace IAM Role',\n value: AwsAuthType.EC2IAMRole,\n },\n {\n label: 'AWS SDK Default',\n value: AwsAuthType.Default,\n },\n {\n label: 'Access & secret key',\n value: AwsAuthType.Keys,\n },\n {\n label: 'Credentials file',\n value: AwsAuthType.Credentials,\n },\n] as Array<SelectableValue<AwsAuthType>>;\n","import { E2ESelectors } from '@grafana/e2e-selectors';\n\nexport const Components = {\n ConfigEditor: {\n SecretKey: {\n input: 'Config editor secret key input',\n },\n AccessKey: {\n input: 'Config editor access key input',\n },\n },\n};\n\nexport const selectors: { components: E2ESelectors<typeof Components> } = {\n components: Components,\n};\n","import React, { FC, useEffect, useState } from 'react';\nimport { Input, Select, InlineField, ButtonGroup, ToolbarButton, FieldSet } from '@grafana/ui';\nimport {\n DataSourcePluginOptionsEditorProps,\n onUpdateDatasourceJsonDataOptionSelect,\n onUpdateDatasourceResetOption,\n onUpdateDatasourceJsonDataOption,\n onUpdateDatasourceSecureJsonDataOption,\n} from '@grafana/data';\n\nimport { standardRegions } from './regions';\nimport { AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData, AwsAuthType } from './types';\nimport { awsAuthProviderOptions } from './providers';\nimport { selectors } from './selectors';\n\nconst toOption = (value: string) => ({ value, label: value });\n\nexport interface ConnectionConfigProps<J = AwsAuthDataSourceJsonData, S = AwsAuthDataSourceSecureJsonData>\n extends DataSourcePluginOptionsEditorProps<J, S> {\n standardRegions?: string[];\n loadRegions?: () => Promise<string[]>;\n defaultEndpoint?: string;\n skipHeader?: boolean;\n skipEndpoint?: boolean;\n children?: React.ReactNode;\n}\n\nexport const ConnectionConfig: FC<ConnectionConfigProps> = (props: ConnectionConfigProps) => {\n const [regions, setRegions] = useState((props.standardRegions || standardRegions).map(toOption));\n const { loadRegions, onOptionsChange, skipHeader = false, skipEndpoint = false } = props;\n const options = props.options;\n let profile = options.jsonData.profile;\n if (profile === undefined) {\n profile = options.database;\n }\n\n const settings = (window as any).grafanaBootData.settings;\n const awsAllowedAuthProviders = settings.awsAllowedAuthProviders ?? [\n AwsAuthType.Default,\n AwsAuthType.Keys,\n AwsAuthType.Credentials,\n ];\n const awsAssumeRoleEnabled = settings.awsAssumeRoleEnabled ?? true;\n\n const currentProvider = awsAuthProviderOptions.find((p) => p.value === options.jsonData.authType);\n\n useEffect(() => {\n // Make sure a authType exists in the current model\n if (!currentProvider && awsAllowedAuthProviders.length) {\n onOptionsChange({\n ...options,\n jsonData: {\n ...options.jsonData,\n authType: awsAllowedAuthProviders[0],\n },\n });\n }\n }, [currentProvider, options, onOptionsChange]);\n\n useEffect(() => {\n if (!loadRegions) {\n return;\n }\n\n loadRegions().then((regions) => setRegions(regions.map(toOption)));\n }, [loadRegions]);\n\n return (\n <FieldSet label={skipHeader ? '' : 'Connection Details'} data-testid=\"connection-config\">\n <InlineField\n label=\"Authentication Provider\"\n labelWidth={28}\n tooltip=\"Specify which AWS credentials chain to use.\"\n >\n <Select\n className=\"width-30 aws-config-authType\"\n value={currentProvider}\n options={awsAuthProviderOptions.filter((opt) => awsAllowedAuthProviders.includes(opt.value!))}\n defaultValue={options.jsonData.authType}\n onChange={(option) => {\n onUpdateDatasourceJsonDataOptionSelect(props, 'authType')(option);\n }}\n />\n </InlineField>\n {options.jsonData.authType === 'credentials' && (\n <InlineField\n label=\"Credentials Profile Name\"\n labelWidth={28}\n tooltip=\"Credentials profile name, as specified in ~/.aws/credentials, leave blank for default.\"\n >\n <Input\n className=\"width-30\"\n placeholder=\"default\"\n value={profile}\n onChange={onUpdateDatasourceJsonDataOption(props, 'profile')}\n />\n </InlineField>\n )}\n\n {options.jsonData.authType === 'keys' && (\n <>\n <InlineField label=\"Access Key ID\" labelWidth={28}>\n {props.options.secureJsonFields?.accessKey ? (\n <ButtonGroup className=\"width-30\">\n <Input disabled placeholder=\"Configured\" />\n <ToolbarButton\n icon=\"edit\"\n tooltip=\"Edit Access Key ID\"\n type=\"button\"\n onClick={onUpdateDatasourceResetOption(props as any, 'accessKey')}\n />\n </ButtonGroup>\n ) : (\n <Input\n className=\"width-30\"\n value={options.secureJsonData?.accessKey ?? ''}\n onChange={onUpdateDatasourceSecureJsonDataOption(props, 'accessKey')}\n aria-label={selectors.components.ConfigEditor.AccessKey.input}\n />\n )}\n </InlineField>\n\n <InlineField label=\"Secret Access Key\" labelWidth={28}>\n {props.options.secureJsonFields?.secretKey ? (\n <ButtonGroup className=\"width-30\">\n <Input disabled placeholder=\"Configured\" />\n <ToolbarButton\n icon=\"edit\"\n type=\"button\"\n tooltip=\"Edit Secret Access Key\"\n onClick={onUpdateDatasourceResetOption(props as any, 'secretKey')}\n />\n </ButtonGroup>\n ) : (\n <Input\n className=\"width-30\"\n value={options.secureJsonData?.secretKey ?? ''}\n onChange={onUpdateDatasourceSecureJsonDataOption(props, 'secretKey')}\n aria-label={selectors.components.ConfigEditor.SecretKey.input}\n />\n )}\n </InlineField>\n </>\n )}\n\n {awsAssumeRoleEnabled && (\n <>\n <InlineField\n label=\"Assume Role ARN\"\n labelWidth={28}\n tooltip=\"Optionally, specify the ARN of a role to assume. Specifying a role here will ensure that the selected authentication provider is used to assume the specified role rather than using the credentials directly. Leave blank if you don't need to assume a role at all\"\n >\n <Input\n className=\"width-30\"\n placeholder=\"arn:aws:iam:*\"\n value={options.jsonData.assumeRoleArn || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'assumeRoleArn')}\n />\n </InlineField>\n <InlineField\n label=\"External ID\"\n labelWidth={28}\n tooltip=\"If you are assuming a role in another account, that has been created with an external ID, specify the external ID here.\"\n >\n <Input\n className=\"width-30\"\n placeholder=\"External ID\"\n value={options.jsonData.externalId || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'externalId')}\n />\n </InlineField>\n </>\n )}\n {!skipEndpoint && (\n <InlineField label=\"Endpoint\" labelWidth={28} tooltip=\"Optionally, specify a custom endpoint for the service\">\n <Input\n className=\"width-30\"\n placeholder={props.defaultEndpoint ?? 'https://{service}.{region}.amazonaws.com'}\n value={options.jsonData.endpoint || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'endpoint')}\n />\n </InlineField>\n )}\n <InlineField\n label=\"Default Region\"\n labelWidth={28}\n tooltip=\"Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region.\"\n >\n <Select\n className=\"width-30 aws-config-defaultRegion\"\n value={regions.find((region) => region.value === options.jsonData.defaultRegion)}\n options={regions}\n defaultValue={options.jsonData.defaultRegion}\n allowCustomValue={true}\n onChange={onUpdateDatasourceJsonDataOptionSelect(props, 'defaultRegion')}\n formatCreateLabel={(r) => `Use region: ${r}`}\n />\n </InlineField>\n {props.children}\n </FieldSet>\n );\n};\n"],"names":["AwsAuthType","standardRegions","awsAuthProviderOptions","label","value","EC2IAMRole","Default","Keys","Credentials","Components","ConfigEditor","SecretKey","input","AccessKey","selectors","components","toOption","props","_k","__read","useState","map","regions","setRegions","loadRegions","onOptionsChange","_l","skipHeader","_m","skipEndpoint","options","profile","jsonData","undefined","database","settings","window","grafanaBootData","awsAllowedAuthProviders","awsAssumeRoleEnabled","currentProvider","find","p","authType","useEffect","length","then","React","FieldSet","InlineField","labelWidth","tooltip","Select","className","filter","opt","includes","defaultValue","onChange","option","onUpdateDatasourceJsonDataOptionSelect","Input","placeholder","onUpdateDatasourceJsonDataOption","secureJsonFields","accessKey","ButtonGroup","disabled","ToolbarButton","icon","type","onClick","onUpdateDatasourceResetOption","secureJsonData","onUpdateDatasourceSecureJsonDataOption","secretKey","assumeRoleArn","externalId","defaultEndpoint","endpoint","region","defaultRegion","allowCustomValue","formatCreateLabel","r","children"],"mappings":"8YAEYA,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EAAQ2C,qCAAgBE,yBAAa,GAC5CjB,SAAUgB,yCAAuCzD,EAAO,0BAC5CH,EAAUC,WAAWL,aAAaC,UAAUC,UAOjE2B,GACCQ,gCACEA,gBAACE,eACC9C,MAAM,kBACN+C,WAAY,GACZC,QAAQ,wQAERJ,gBAACc,SACCR,UAAU,WACVS,YAAY,gBACZ1D,MAAO0B,EAAQE,SAAS4C,eAAiB,GACzClB,SAAUK,mCAAiC9C,EAAO,oBAGtD8B,gBAACE,eACC9C,MAAM,cACN+C,WAAY,GACZC,QAAQ,2HAERJ,gBAACc,SACCR,UAAU,WACVS,YAAY,cACZ1D,MAAO0B,EAAQE,SAAS6C,YAAc,GACtCnB,SAAUK,mCAAiC9C,EAAO,mBAKxDY,GACAkB,gBAACE,eAAY9C,MAAM,WAAW+C,WAAY,GAAIC,QAAQ,yDACpDJ,gBAACc,SACCR,UAAU,WACVS,sBAAa7C,EAAM6D,+BAAmB,2CACtC1E,MAAO0B,EAAQE,SAAS+C,UAAY,GACpCrB,SAAUK,mCAAiC9C,EAAO,eAIxD8B,gBAACE,eACC9C,MAAM,iBACN+C,WAAY,GACZC,QAAQ,qFAERJ,gBAACK,UACCC,UAAU,oCACVjD,MAAOkB,EAAQmB,MAAK,SAACuC,GAAW,OAAAA,EAAO5E,QAAU0B,EAAQE,SAASiD,iBAClEnD,QAASR,EACTmC,aAAc3B,EAAQE,SAASiD,cAC/BC,kBAAkB,EAClBxB,SAAUE,yCAAuC3C,EAAO,iBACxDkE,kBAAmB,SAACC,GAAM,MAAA,eAAeA,MAG5CnE,EAAMoE"}
1
+ {"version":3,"file":"index.production.js","sources":["../src/types.ts","../src/regions.ts","../src/sql/QueryEditor/FillValueSelect.tsx","../src/providers.ts","../src/ConnectionConfig.tsx","../src/sql/ResourceSelector.tsx","../src/sql/types.ts","../src/sql/utils/utils.ts","../src/sql/ConfigEditor/ConfigSelect.tsx","../src/sql/QueryEditor/FormatSelect.tsx","../src/sql/ConfigEditor/InlineInput.tsx","../src/sql/QueryEditor/QueryCodeEditor.tsx"],"sourcesContent":["import { DataSourceJsonData, DataSourceSettings } from '@grafana/data';\n\nexport enum AwsAuthType {\n Keys = 'keys',\n Credentials = 'credentials',\n Default = 'default', // was 'arn',\n EC2IAMRole = 'ec2_iam_role',\n /**\n * @deprecated use default\n */\n ARN = 'arn',\n}\n\nexport interface AwsAuthDataSourceJsonData extends DataSourceJsonData {\n authType?: AwsAuthType;\n assumeRoleArn?: string;\n externalId?: string;\n profile?: string; // Credentials profile name, as specified in ~/.aws/credentials\n defaultRegion?: string; // region if it is not defined by your credentials file\n endpoint?: string;\n}\n\nexport interface AwsAuthDataSourceSecureJsonData {\n accessKey?: string;\n secretKey?: string;\n sessionToken?: string;\n}\n\nexport type AwsAuthDataSourceSettings = DataSourceSettings<AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData>;\n","export const standardRegions: string[] = [\n 'af-south-1',\n 'ap-east-1',\n 'ap-northeast-1',\n 'ap-northeast-2',\n 'ap-northeast-3',\n 'ap-south-1',\n 'ap-southeast-1',\n 'ap-southeast-2',\n 'ca-central-1',\n 'cn-north-1',\n 'cn-northwest-1',\n 'eu-central-1',\n 'eu-north-1',\n 'eu-west-1',\n 'eu-west-2',\n 'eu-west-3',\n 'me-south-1',\n 'sa-east-1',\n 'us-east-1',\n 'us-east-2',\n 'us-gov-east-1',\n 'us-gov-west-1',\n 'us-iso-east-1',\n 'us-isob-east-1',\n 'us-west-1',\n 'us-west-2',\n];\n","import React from 'react';\nimport { DataQuery, SelectableValue } from '@grafana/data';\nimport { InlineField, Input, Select } from '@grafana/ui';\n\nexport enum FillValueOptions {\n Previous,\n Null,\n Value,\n}\n\nexport const SelectableFillValueOptions: Array<SelectableValue<FillValueOptions>> = [\n {\n label: 'Previous Value',\n value: FillValueOptions.Previous,\n },\n {\n label: 'NULL',\n value: FillValueOptions.Null,\n },\n {\n label: 'Value',\n value: FillValueOptions.Value,\n },\n];\n\nexport type FillValueSelectProps<TQuery extends DataQuery> = {\n query: TQuery;\n onChange: (value: TQuery) => void;\n onRunQuery: () => void;\n};\n\nexport function FillValueSelect<TQuery extends DataQuery & Record<string, any>>(props: FillValueSelectProps<TQuery>) {\n return (\n <>\n <InlineField label=\"Fill value\" tooltip=\"value to fill missing points\">\n <Select\n aria-label=\"Fill value\"\n options={SelectableFillValueOptions}\n value={props.query.fillMode?.mode ?? FillValueOptions.Previous}\n onChange={({ value }) => {\n props.onChange({\n ...props.query,\n // Keep the fillMode.value in case FillValueOptions.Value mode is selected back\n fillMode: { ...props.query.fillMode, mode: value },\n });\n props.onRunQuery();\n }}\n className=\"width-12\"\n />\n </InlineField>\n {props.query.fillMode?.mode === FillValueOptions.Value && (\n <InlineField label=\"Value\" labelWidth={11}>\n <Input\n type=\"number\"\n aria-label=\"Value\"\n value={props.query.fillMode.value}\n onChange={({ currentTarget }: React.FormEvent<HTMLInputElement>) =>\n props.onChange({\n ...props.query,\n fillMode: {\n mode: FillValueOptions.Value,\n value: currentTarget.valueAsNumber,\n },\n })\n }\n onBlur={() => props.onRunQuery()}\n />\n </InlineField>\n )}\n </>\n );\n}\n","import { SelectableValue } from '@grafana/data';\nimport { AwsAuthType } from './types';\n\nexport const awsAuthProviderOptions = [\n {\n label: 'Workspace IAM Role',\n value: AwsAuthType.EC2IAMRole,\n },\n {\n label: 'AWS SDK Default',\n value: AwsAuthType.Default,\n },\n {\n label: 'Access & secret key',\n value: AwsAuthType.Keys,\n },\n {\n label: 'Credentials file',\n value: AwsAuthType.Credentials,\n },\n] as Array<SelectableValue<AwsAuthType>>;\n","import React, { FC, useEffect, useState } from 'react';\nimport { Input, Select, InlineField, ButtonGroup, ToolbarButton, FieldSet } from '@grafana/ui';\nimport {\n DataSourcePluginOptionsEditorProps,\n onUpdateDatasourceJsonDataOptionSelect,\n onUpdateDatasourceResetOption,\n onUpdateDatasourceJsonDataOption,\n onUpdateDatasourceSecureJsonDataOption,\n} from '@grafana/data';\n\nimport { standardRegions } from './regions';\nimport { AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData, AwsAuthType } from './types';\nimport { awsAuthProviderOptions } from './providers';\n\nconst toOption = (value: string) => ({ value, label: value });\n\nexport interface ConnectionConfigProps<J = AwsAuthDataSourceJsonData, S = AwsAuthDataSourceSecureJsonData>\n extends DataSourcePluginOptionsEditorProps<J, S> {\n standardRegions?: string[];\n loadRegions?: () => Promise<string[]>;\n defaultEndpoint?: string;\n skipHeader?: boolean;\n skipEndpoint?: boolean;\n children?: React.ReactNode;\n}\n\nexport const ConnectionConfig: FC<ConnectionConfigProps> = (props: ConnectionConfigProps) => {\n const [regions, setRegions] = useState((props.standardRegions || standardRegions).map(toOption));\n const { loadRegions, onOptionsChange, skipHeader = false, skipEndpoint = false } = props;\n const options = props.options;\n let profile = options.jsonData.profile;\n if (profile === undefined) {\n profile = options.database;\n }\n\n const settings = (window as any).grafanaBootData.settings;\n const awsAllowedAuthProviders = settings.awsAllowedAuthProviders ?? [\n AwsAuthType.Default,\n AwsAuthType.Keys,\n AwsAuthType.Credentials,\n ];\n const awsAssumeRoleEnabled = settings.awsAssumeRoleEnabled ?? true;\n\n const currentProvider = awsAuthProviderOptions.find((p) => p.value === options.jsonData.authType);\n\n useEffect(() => {\n // Make sure a authType exists in the current model\n if (!currentProvider && awsAllowedAuthProviders.length) {\n onOptionsChange({\n ...options,\n jsonData: {\n ...options.jsonData,\n authType: awsAllowedAuthProviders[0],\n },\n });\n }\n }, [currentProvider, options, onOptionsChange]);\n\n useEffect(() => {\n if (!loadRegions) {\n return;\n }\n\n loadRegions().then((regions) => setRegions(regions.map(toOption)));\n }, [loadRegions]);\n\n return (\n <FieldSet label={skipHeader ? '' : 'Connection Details'} data-testid=\"connection-config\">\n <InlineField\n label=\"Authentication Provider\"\n labelWidth={28}\n tooltip=\"Specify which AWS credentials chain to use.\"\n >\n <Select\n aria-label=\"Authentication Provider\"\n className=\"width-30\"\n value={currentProvider}\n options={awsAuthProviderOptions.filter((opt) => awsAllowedAuthProviders.includes(opt.value!))}\n defaultValue={options.jsonData.authType}\n onChange={(option) => {\n onUpdateDatasourceJsonDataOptionSelect(props, 'authType')(option);\n }}\n />\n </InlineField>\n {options.jsonData.authType === 'credentials' && (\n <InlineField\n label=\"Credentials Profile Name\"\n labelWidth={28}\n tooltip=\"Credentials profile name, as specified in ~/.aws/credentials, leave blank for default.\"\n >\n <Input\n aria-label=\"Credentials Profile Name\"\n className=\"width-30\"\n placeholder=\"default\"\n value={profile}\n onChange={onUpdateDatasourceJsonDataOption(props, 'profile')}\n />\n </InlineField>\n )}\n\n {options.jsonData.authType === 'keys' && (\n <>\n <InlineField label=\"Access Key ID\" labelWidth={28}>\n {props.options.secureJsonFields?.accessKey ? (\n <ButtonGroup className=\"width-30\">\n <Input disabled placeholder=\"Configured\" />\n <ToolbarButton\n icon=\"edit\"\n tooltip=\"Edit Access Key ID\"\n type=\"button\"\n onClick={onUpdateDatasourceResetOption(props as any, 'accessKey')}\n />\n </ButtonGroup>\n ) : (\n <Input\n aria-label=\"Access Key ID\"\n className=\"width-30\"\n value={options.secureJsonData?.accessKey ?? ''}\n onChange={onUpdateDatasourceSecureJsonDataOption(props, 'accessKey')}\n />\n )}\n </InlineField>\n\n <InlineField label=\"Secret Access Key\" labelWidth={28}>\n {props.options.secureJsonFields?.secretKey ? (\n <ButtonGroup className=\"width-30\">\n <Input disabled placeholder=\"Configured\" />\n <ToolbarButton\n icon=\"edit\"\n type=\"button\"\n tooltip=\"Edit Secret Access Key\"\n onClick={onUpdateDatasourceResetOption(props as any, 'secretKey')}\n />\n </ButtonGroup>\n ) : (\n <Input\n aria-label=\"Secret Access Key\"\n className=\"width-30\"\n value={options.secureJsonData?.secretKey ?? ''}\n onChange={onUpdateDatasourceSecureJsonDataOption(props, 'secretKey')}\n />\n )}\n </InlineField>\n </>\n )}\n\n {awsAssumeRoleEnabled && (\n <>\n <InlineField\n label=\"Assume Role ARN\"\n labelWidth={28}\n tooltip=\"Optionally, specify the ARN of a role to assume. Specifying a role here will ensure that the selected authentication provider is used to assume the specified role rather than using the credentials directly. Leave blank if you don't need to assume a role at all\"\n >\n <Input\n aria-label=\"Assume Role ARN\"\n className=\"width-30\"\n placeholder=\"arn:aws:iam:*\"\n value={options.jsonData.assumeRoleArn || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'assumeRoleArn')}\n />\n </InlineField>\n <InlineField\n label=\"External ID\"\n labelWidth={28}\n tooltip=\"If you are assuming a role in another account, that has been created with an external ID, specify the external ID here.\"\n >\n <Input\n aria-label=\"External ID\"\n className=\"width-30\"\n placeholder=\"External ID\"\n value={options.jsonData.externalId || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'externalId')}\n />\n </InlineField>\n </>\n )}\n {!skipEndpoint && (\n <InlineField label=\"Endpoint\" labelWidth={28} tooltip=\"Optionally, specify a custom endpoint for the service\">\n <Input\n aria-label=\"Endpoint\"\n className=\"width-30\"\n placeholder={props.defaultEndpoint ?? 'https://{service}.{region}.amazonaws.com'}\n value={options.jsonData.endpoint || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'endpoint')}\n />\n </InlineField>\n )}\n <InlineField\n label=\"Default Region\"\n labelWidth={28}\n tooltip=\"Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region.\"\n >\n <Select\n aria-label=\"Default Region\"\n className=\"width-30\"\n value={regions.find((region) => region.value === options.jsonData.defaultRegion)}\n options={regions}\n defaultValue={options.jsonData.defaultRegion}\n allowCustomValue={true}\n onChange={onUpdateDatasourceJsonDataOptionSelect(props, 'defaultRegion')}\n formatCreateLabel={(r) => `Use region: ${r}`}\n />\n </InlineField>\n {props.children}\n </FieldSet>\n );\n};\n","import React, { useState, useEffect, useMemo } from 'react';\nimport { SelectableValue } from '@grafana/data';\nimport { InlineField, Select } from '@grafana/ui';\nimport { isEqual } from 'lodash';\nimport { defaultKey } from './types';\n\nexport type ResourceSelectorProps = {\n value: string | null;\n fetch: () => Promise<Array<string | SelectableValue<string>>>;\n onChange: (e: SelectableValue<string> | null) => void;\n dependencies?: Array<string | null | undefined>;\n tooltip?: string;\n label?: string;\n 'data-testid'?: string;\n hidden?: boolean;\n // Options only needed for QueryEditor\n default?: string;\n // Options only needed for the ConfigEditor\n title?: string;\n disabled?: boolean;\n labelWidth?: number;\n className?: string;\n saveOptions?: () => Promise<void>;\n};\n\nexport function ResourceSelector(props: ResourceSelectorProps) {\n const [resource, setResource] = useState<string | null>(props.value || props.default || null);\n const [resources, setResources] = useState<Array<string | SelectableValue>>(resource ? [resource] : []);\n const [dependencies, setDependencies] = useState(props.dependencies);\n const [isLoading, setIsLoading] = useState(false);\n const [fetched, setFetched] = useState(false);\n const defaultOpts = useMemo(() => {\n const opts: Array<SelectableValue<string>> = [\n {\n label: `default (${props.default})`,\n value: defaultKey,\n description: `Default value set in the data source`,\n },\n ];\n if (props.value && props.value !== defaultKey) {\n opts.push({ label: props.value, value: props.value });\n }\n return opts;\n }, [props.default, props.value]);\n const [options, setOptions] = useState<Array<SelectableValue<string>>>(props.default ? defaultOpts : []);\n useEffect(() => {\n if (resources.length) {\n const newOptions: Array<SelectableValue<string>> = props.default ? defaultOpts : [];\n resources.forEach((r) => {\n const value = typeof r === 'string' ? r : r.value;\n if (!newOptions.find((o) => o.value === value)) {\n typeof r === 'string' ? newOptions.push({ label: r, value: r }) : newOptions.push(r);\n }\n });\n setOptions(newOptions);\n } else {\n setOptions([]);\n }\n }, [resources, defaultOpts, props.default]);\n\n useEffect(() => {\n // A change in the dependencies cause a state clean-up\n if (!isEqual(props.dependencies, dependencies)) {\n setFetched(false);\n setResources([]);\n setResource(null);\n props.onChange(null);\n setDependencies(props.dependencies);\n }\n }, [props, dependencies]);\n\n const fetch = async () => {\n if (fetched) {\n return;\n }\n if (props.saveOptions) {\n await props.saveOptions();\n }\n try {\n const resources = await props.fetch();\n setResources(resources);\n } finally {\n setFetched(true);\n }\n };\n\n const onChange = (e: SelectableValue<string>) => {\n props.onChange(e);\n if (e.value) {\n setResource(e.value);\n }\n };\n const onClick = async () => {\n setIsLoading(true);\n try {\n await fetch();\n } finally {\n setIsLoading(false);\n }\n };\n\n return (\n <InlineField label={props.label} labelWidth={props.labelWidth} tooltip={props.tooltip} hidden={props.hidden}>\n <div data-testid={props['data-testid']} title={props.title}>\n <Select\n aria-label={props.label}\n options={options}\n value={props.value}\n onChange={onChange}\n isLoading={isLoading}\n className={props.className || 'min-width-6'}\n disabled={props.disabled}\n onOpenMenu={onClick}\n />\n </div>\n </InlineField>\n );\n}\n","import { DataQuery } from '@grafana/data';\nimport { FillValueOptions } from './QueryEditor/FillValueSelect';\n\nexport const defaultKey = '__default';\n\nexport interface SQLQuery extends DataQuery {\n rawSQL: string;\n format?: number;\n fillMode?: { mode: FillValueOptions; value?: number };\n}\n","import { ScopedVars, VariableModel } from '@grafana/data';\nimport { SQLQuery } from '../types';\nimport { CodeEditorSuggestionItem, CodeEditorSuggestionItemKind } from '@grafana/ui';\n\n/**\n * Do not execute queries that do not exist yet\n */\nexport function filterSQLQuery(query: SQLQuery): boolean {\n return !!query.rawSQL;\n}\n\nexport function applySQLTemplateVariables(\n query: SQLQuery,\n scopedVars: ScopedVars,\n getTemplateSrv: () => any\n): SQLQuery {\n const templateSrv = getTemplateSrv();\n return {\n ...query,\n rawSQL: templateSrv.replace(query.rawSQL, scopedVars, interpolateVariable),\n };\n}\n\nfunction interpolateVariable(value: string | string[]) {\n if (typeof value === 'string') {\n return value;\n }\n\n const quotedValues = value.map((v) => {\n return quoteLiteral(v);\n });\n return quotedValues.join(',');\n}\n\nfunction quoteLiteral(value: any) {\n return \"'\" + String(value).replace(/'/g, \"''\") + \"'\";\n}\n\nexport const appendTemplateVariablesAsSuggestions = (getTemplateSrv: () => any, sugs: CodeEditorSuggestionItem[]) => {\n const templateSrv = getTemplateSrv();\n const templateSugs: CodeEditorSuggestionItem[] = [];\n templateSrv.getVariables().forEach((variable: VariableModel) => {\n const label = '$' + variable.name;\n let val = templateSrv.replace(label);\n if (val === label) {\n val = '';\n }\n templateSugs.push({\n label,\n kind: CodeEditorSuggestionItemKind.Text,\n detail: `(Template Variable) ${val}`,\n });\n });\n\n return sugs.concat(templateSugs);\n};\n","import React from 'react';\nimport { DataSourcePluginOptionsEditorProps, SelectableValue } from '@grafana/data';\nimport { AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData } from '../../types';\nimport { ResourceSelector } from '../ResourceSelector';\n\nexport interface ConfigSelectProps\n extends DataSourcePluginOptionsEditorProps<AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData> {\n value: string;\n fetch: () => Promise<Array<string | SelectableValue<string>>>;\n onChange: (e: SelectableValue<string> | null) => void;\n dependencies?: string[];\n label?: string;\n 'data-testid'?: string;\n hidden?: boolean;\n disabled?: boolean;\n saveOptions: () => Promise<void>;\n}\n\nexport function ConfigSelect(props: ConfigSelectProps) {\n const { jsonData } = props.options;\n const commonProps = {\n title: jsonData.defaultRegion ? '' : 'select a default region',\n disabled: !jsonData.defaultRegion,\n labelWidth: 28,\n className: 'width-30',\n };\n // Any change in the AWS connection details will affect selectors\n const dependencies: string[] = [\n props.options.jsonData.assumeRoleArn,\n props.options.jsonData.authType,\n props.options.jsonData.defaultRegion,\n props.options.jsonData.endpoint,\n props.options.jsonData.externalId,\n props.options.jsonData.profile,\n ].concat(props.dependencies);\n return (\n <ResourceSelector\n label={props.label}\n data-testid={props['data-testid']}\n onChange={props.onChange}\n fetch={props.fetch}\n value={props.value}\n saveOptions={props.saveOptions}\n dependencies={dependencies}\n hidden={props.hidden}\n disabled={props.disabled}\n {...commonProps}\n />\n );\n}\n","import React from 'react';\nimport { DataQuery, SelectableValue } from '@grafana/data';\nimport { InlineField, Select } from '@grafana/ui';\n\nexport type FormatSelectProps<TQuery extends DataQuery, FormatOptions> = {\n query: TQuery;\n options: Array<SelectableValue<FormatOptions>>;\n onChange: (value: TQuery) => void;\n onRunQuery: () => void;\n};\n\nexport function FormatSelect<TQuery extends DataQuery & Record<string, any>, FormatOptions>(\n props: FormatSelectProps<TQuery, FormatOptions>\n) {\n const onChangeFormat = (e: SelectableValue<FormatOptions>) => {\n props.onChange({\n ...props.query,\n format: e.value || 0,\n });\n props.onRunQuery();\n };\n return (\n <InlineField label=\"Format as\" labelWidth={11}>\n <Select\n aria-label=\"Format as\"\n options={props.options}\n value={props.query.format}\n onChange={onChangeFormat}\n className=\"width-12\"\n />\n </InlineField>\n );\n}\n","import React from 'react';\nimport { DataSourcePluginOptionsEditorProps } from '@grafana/data';\nimport { AwsAuthDataSourceSecureJsonData } from '../../types';\nimport { InlineField, Input } from '@grafana/ui';\nimport { FormEvent } from 'react-dom/node_modules/@types/react';\n\nexport interface InlineInputProps extends DataSourcePluginOptionsEditorProps<{}, AwsAuthDataSourceSecureJsonData> {\n value: string;\n onChange: (e: FormEvent<HTMLInputElement>) => void;\n label?: string;\n tooltip?: string;\n placeholder?: string;\n 'data-testid'?: string;\n hidden?: boolean;\n disabled?: boolean;\n}\n\nexport function InlineInput(props: InlineInputProps) {\n return (\n <InlineField\n label={props.label}\n labelWidth={28}\n tooltip={props.tooltip}\n hidden={props.hidden}\n disabled={props.disabled}\n >\n <Input\n data-testid={props['data-testid']}\n className=\"width-30\"\n value={props.value}\n onChange={props.onChange}\n placeholder={props.placeholder}\n disabled={props.disabled}\n />\n </InlineField>\n );\n}\n","import { defaults } from 'lodash';\n\nimport React, { useRef, useEffect } from 'react';\nimport { CodeEditor, CodeEditorSuggestionItem } from '@grafana/ui';\nimport { DataQuery } from '@grafana/data';\nimport { MonacoOptions } from '@grafana/ui/components/Monaco/types';\n\ntype EditorProps = {\n width?: number | string;\n height?: number | string;\n readOnly?: boolean;\n showMiniMap?: boolean;\n showLineNumbers?: boolean;\n monacoOptions?: MonacoOptions;\n};\n\ntype Props<TQuery extends DataQuery> = {\n query: TQuery;\n language: string;\n editorProps?: EditorProps;\n onChange: (value: TQuery) => void;\n onRunQuery: () => void;\n getSuggestions: (query: TQuery) => CodeEditorSuggestionItem[];\n};\n\nexport function QueryCodeEditor<TQuery extends DataQuery>(props: Props<TQuery>) {\n const { getSuggestions, query } = props;\n const { rawSQL } = defaults(props.query, { rawSQL: '' });\n const onRawSqlChange = (rawSQL: string) => {\n const query = {\n ...props.query,\n rawSQL,\n };\n props.onChange(query);\n props.onRunQuery();\n };\n\n // Use a reference for suggestions because a bug in CodeEditor getSuggestions\n // https://github.com/grafana/grafana/issues/40121\n // It was been fixed in 8.3 but keeping the workaround here to support older\n // versions.\n const suggestionsRef = useRef<CodeEditorSuggestionItem[]>([]);\n useEffect(() => {\n suggestionsRef.current = getSuggestions(query);\n }, [getSuggestions, query]);\n\n return (\n <CodeEditor\n language={props.language}\n value={rawSQL}\n onBlur={onRawSqlChange}\n showMiniMap={false}\n showLineNumbers={true}\n getSuggestions={() => suggestionsRef.current}\n height=\"240px\"\n {...props.editorProps}\n />\n );\n}\n"],"names":["AwsAuthType","standardRegions","FillValueOptions","awsAuthProviderOptions","label","value","EC2IAMRole","Default","Keys","Credentials","toOption","ResourceSelector","props","_a","__read","useState","default","resource","setResource","_b","resources","setResources","_c","dependencies","setDependencies","_d","isLoading","setIsLoading","_e","fetched","setFetched","defaultOpts","useMemo","opts","description","push","_f","options","setOptions","useEffect","length","newOptions_1","forEach","r","find","o","isEqual","onChange","React","InlineField","labelWidth","tooltip","hidden","title","Select","e","className","disabled","onOpenMenu","saveOptions","fetch","resources_1","SelectableFillValueOptions","Previous","Null","Value","interpolateVariable","map","v","String","replace","quoteLiteral","join","jsonData","commonProps","defaultRegion","assumeRoleArn","authType","endpoint","externalId","profile","concat","_k","regions","setRegions","loadRegions","onOptionsChange","_l","skipHeader","_m","skipEndpoint","undefined","database","settings","window","grafanaBootData","awsAllowedAuthProviders","awsAssumeRoleEnabled","currentProvider","p","then","FieldSet","filter","opt","includes","defaultValue","option","onUpdateDatasourceJsonDataOptionSelect","Input","placeholder","onUpdateDatasourceJsonDataOption","secureJsonFields","accessKey","ButtonGroup","ToolbarButton","icon","type","onClick","onUpdateDatasourceResetOption","secureJsonData","onUpdateDatasourceSecureJsonDataOption","secretKey","defaultEndpoint","region","allowCustomValue","formatCreateLabel","children","query","fillMode","mode","onRunQuery","currentTarget","valueAsNumber","onBlur","format","getSuggestions","rawSQL","defaults","suggestionsRef","useRef","current","CodeEditor","language","showMiniMap","showLineNumbers","height","editorProps","getTemplateSrv","sugs","templateSrv","templateSugs","getVariables","variable","name","val","kind","CodeEditorSuggestionItemKind","Text","detail","scopedVars"],"mappings":"sgEAEYA,ECFCC,EAA4B,CACvC,aACA,YACA,iBACA,iBACA,iBACA,aACA,iBACA,iBACA,eACA,aACA,iBACA,eACA,aACA,YACA,YACA,YACA,aACA,YACA,YACA,YACA,gBACA,gBACA,gBACA,iBACA,YACA,cDxBUD,EAAAA,sBAAAA,qCAEVA,4BACAA,oBACAA,4BAIAA,gBENUE,ECDCC,EAAyB,CACpC,CACEC,MAAO,qBACPC,MAAOL,oBAAYM,YAErB,CACEF,MAAO,kBACPC,MAAOL,oBAAYO,SAErB,CACEH,MAAO,sBACPC,MAAOL,oBAAYQ,MAErB,CACEJ,MAAO,mBACPC,MAAOL,oBAAYS,cCJjBC,EAAW,SAACL,GAAkB,OAAGA,QAAOD,MAAOC,aCWrCM,EAAiBC,GAAjC,WACQC,EAAAC,EAA0BC,WAAwBH,EAAMP,OAASO,EAAMI,SAAW,SAAjFC,OAAUC,OACXC,EAAAL,EAA4BC,WAA0CE,EAAW,CAACA,GAAY,OAA7FG,OAAWC,OACZC,EAAAR,EAAkCC,WAASH,EAAMW,iBAAhDA,OAAcC,OACfC,EAAAX,EAA4BC,YAAS,MAApCW,OAAWC,OACZC,EAAAd,EAAwBC,YAAS,MAAhCc,OAASC,OACVC,EAAcC,WAAQ,WAC1B,IAAMC,EAAuC,CAC3C,CACE7B,MAAO,YAAYQ,EAAMI,YACzBX,MChCkB,YDiClB6B,YAAa,yCAMjB,OAHItB,EAAMP,OCpCY,cDoCHO,EAAMP,OACvB4B,EAAKE,KAAK,CAAE/B,MAAOQ,EAA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AMuC,QACfC,OAAQxC,EAAMwC,OACdK,SAAU7C,EAAM6C,UAEhBT,gBAAC4D,uBACchG,EAAM,eACnB4C,UAAU,WACVnD,MAAOO,EAAMP,MACb0C,SAAUnC,EAAMmC,SAChB8D,YAAajG,EAAMiG,YACnBpD,SAAU7C,EAAM6C,8CCPkC7C,GAChD,IAAA2H,EAA0B3H,iBAAVmH,EAAUnH,QAC1B4H,EAAWC,WAAS7H,EAAMmH,MAAO,CAAES,OAAQ,YAc7CE,EAAiBC,SAAmC,IAK1D,OAJApG,aAAU,WACRmG,EAAeE,QAAUL,EAAeR,KACvC,CAACQ,EAAgBR,IAGlB/E,gBAAC6F,gBACCC,SAAUlI,EAAMkI,SAChBzI,MAAOmI,EACPH,OAtBmB,SAACG,GACtB,IAAMT,SACDnH,EAAMmH,QACTS,WAEF5H,EAAMmC,SAASgF,GACfnH,EAAMsH,cAiBJa,aAAa,EACbC,iBAAiB,EACjBT,eAAgB,WAAM,OAAAG,EAAeE,SACrCK,OAAO,SACHrI,EAAMsI,uFJjBoC,SAACC,EAA2BC,GAC9E,IAAMC,EAAcF,IACdG,EAA2C,GAcjD,OAbAD,EAAYE,eAAe7G,SAAQ,SAAC8G,GAClC,IAAMpJ,EAAQ,IAAMoJ,EAASC,KACzBC,EAAML,EAAY/E,QAAQlE,GAC1BsJ,IAAQtJ,IACVsJ,EAAM,IAERJ,EAAanH,KAAK,CAChB/B,QACAuJ,KAAMC,+BAA6BC,KACnCC,OAAQ,uBAAuBJ,OAI5BN,EAAKnE,OAAOqE,+CA1CnBvB,EACAgC,EACAZ,GAEA,IAAME,EAAcF,IACpB,cACKpB,IACHS,OAAQa,EAAY/E,QAAQyD,EAAMS,OAAQuB,EAAY7F,uEAZ3B6D,GAC7B,QAASA,EAAMS"}
@@ -0,0 +1,14 @@
1
+ import { DataSourcePluginOptionsEditorProps, SelectableValue } from '@grafana/data';
2
+ import { AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData } from '../../types';
3
+ export interface ConfigSelectProps extends DataSourcePluginOptionsEditorProps<AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData> {
4
+ value: string;
5
+ fetch: () => Promise<Array<string | SelectableValue<string>>>;
6
+ onChange: (e: SelectableValue<string> | null) => void;
7
+ dependencies?: string[];
8
+ label?: string;
9
+ 'data-testid'?: string;
10
+ hidden?: boolean;
11
+ disabled?: boolean;
12
+ saveOptions: () => Promise<void>;
13
+ }
14
+ export declare function ConfigSelect(props: ConfigSelectProps): JSX.Element;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ import { DataSourcePluginOptionsEditorProps } from '@grafana/data';
2
+ import { AwsAuthDataSourceSecureJsonData } from '../../types';
3
+ import { FormEvent } from 'react-dom/node_modules/@types/react';
4
+ export interface InlineInputProps extends DataSourcePluginOptionsEditorProps<{}, AwsAuthDataSourceSecureJsonData> {
5
+ value: string;
6
+ onChange: (e: FormEvent<HTMLInputElement>) => void;
7
+ label?: string;
8
+ tooltip?: string;
9
+ placeholder?: string;
10
+ 'data-testid'?: string;
11
+ hidden?: boolean;
12
+ disabled?: boolean;
13
+ }
14
+ export declare function InlineInput(props: InlineInputProps): JSX.Element;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { DataSourcePluginOptionsEditorProps } from '@grafana/data';
2
+ import { AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData } from 'types';
3
+ export declare const mockDatasourceOptions: DataSourcePluginOptionsEditorProps<AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData>;
@@ -0,0 +1,2 @@
1
+ export { ConfigSelect, ConfigSelectProps } from './ConfigSelect';
2
+ export { InlineInput, InlineInputProps } from './InlineInput';
@@ -0,0 +1,13 @@
1
+ import { DataQuery, SelectableValue } from '@grafana/data';
2
+ export declare enum FillValueOptions {
3
+ Previous = 0,
4
+ Null = 1,
5
+ Value = 2
6
+ }
7
+ export declare const SelectableFillValueOptions: Array<SelectableValue<FillValueOptions>>;
8
+ export declare type FillValueSelectProps<TQuery extends DataQuery> = {
9
+ query: TQuery;
10
+ onChange: (value: TQuery) => void;
11
+ onRunQuery: () => void;
12
+ };
13
+ export declare function FillValueSelect<TQuery extends DataQuery & Record<string, any>>(props: FillValueSelectProps<TQuery>): JSX.Element;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/extend-expect';
@@ -0,0 +1,8 @@
1
+ import { DataQuery, SelectableValue } from '@grafana/data';
2
+ export declare type FormatSelectProps<TQuery extends DataQuery, FormatOptions> = {
3
+ query: TQuery;
4
+ options: Array<SelectableValue<FormatOptions>>;
5
+ onChange: (value: TQuery) => void;
6
+ onRunQuery: () => void;
7
+ };
8
+ export declare function FormatSelect<TQuery extends DataQuery & Record<string, any>, FormatOptions>(props: FormatSelectProps<TQuery, FormatOptions>): JSX.Element;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/extend-expect';
@@ -0,0 +1,21 @@
1
+ import { CodeEditorSuggestionItem } from '@grafana/ui';
2
+ import { DataQuery } from '@grafana/data';
3
+ import { MonacoOptions } from '@grafana/ui/components/Monaco/types';
4
+ declare type EditorProps = {
5
+ width?: number | string;
6
+ height?: number | string;
7
+ readOnly?: boolean;
8
+ showMiniMap?: boolean;
9
+ showLineNumbers?: boolean;
10
+ monacoOptions?: MonacoOptions;
11
+ };
12
+ declare type Props<TQuery extends DataQuery> = {
13
+ query: TQuery;
14
+ language: string;
15
+ editorProps?: EditorProps;
16
+ onChange: (value: TQuery) => void;
17
+ onRunQuery: () => void;
18
+ getSuggestions: (query: TQuery) => CodeEditorSuggestionItem[];
19
+ };
20
+ export declare function QueryCodeEditor<TQuery extends DataQuery>(props: Props<TQuery>): JSX.Element;
21
+ export {};
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/extend-expect';
@@ -0,0 +1,6 @@
1
+ import { SQLQuery } from '../../types';
2
+ export declare enum SQLOptions {
3
+ Table = 0,
4
+ TimeSeries = 1
5
+ }
6
+ export declare const mockQuery: SQLQuery;
@@ -0,0 +1,3 @@
1
+ export { QueryCodeEditor } from './QueryCodeEditor';
2
+ export { FormatSelect } from './FormatSelect';
3
+ export { FillValueSelect } from './FillValueSelect';
@@ -0,0 +1,18 @@
1
+ import { SelectableValue } from '@grafana/data';
2
+ export declare type ResourceSelectorProps = {
3
+ value: string | null;
4
+ fetch: () => Promise<Array<string | SelectableValue<string>>>;
5
+ onChange: (e: SelectableValue<string> | null) => void;
6
+ dependencies?: Array<string | null | undefined>;
7
+ tooltip?: string;
8
+ label?: string;
9
+ 'data-testid'?: string;
10
+ hidden?: boolean;
11
+ default?: string;
12
+ title?: string;
13
+ disabled?: boolean;
14
+ labelWidth?: number;
15
+ className?: string;
16
+ saveOptions?: () => Promise<void>;
17
+ };
18
+ export declare function ResourceSelector(props: ResourceSelectorProps): JSX.Element;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import { DataQuery } from '@grafana/data';
2
+ import { FillValueOptions } from './QueryEditor/FillValueSelect';
3
+ export declare const defaultKey = "__default";
4
+ export interface SQLQuery extends DataQuery {
5
+ rawSQL: string;
6
+ format?: number;
7
+ fillMode?: {
8
+ mode: FillValueOptions;
9
+ value?: number;
10
+ };
11
+ }
@@ -0,0 +1 @@
1
+ export * from './utils';
@@ -0,0 +1,9 @@
1
+ import { ScopedVars } from '@grafana/data';
2
+ import { SQLQuery } from '../types';
3
+ import { CodeEditorSuggestionItem } from '@grafana/ui';
4
+ /**
5
+ * Do not execute queries that do not exist yet
6
+ */
7
+ export declare function filterSQLQuery(query: SQLQuery): boolean;
8
+ export declare function applySQLTemplateVariables(query: SQLQuery, scopedVars: ScopedVars, getTemplateSrv: () => any): SQLQuery;
9
+ export declare const appendTemplateVariablesAsSuggestions: (getTemplateSrv: () => any, sugs: CodeEditorSuggestionItem[]) => CodeEditorSuggestionItem[];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { DataSourceJsonData } from '@grafana/data';
1
+ import { DataSourceJsonData, DataSourceSettings } from '@grafana/data';
2
2
  export declare enum AwsAuthType {
3
3
  Keys = "keys",
4
4
  Credentials = "credentials",
@@ -20,4 +20,6 @@ export interface AwsAuthDataSourceJsonData extends DataSourceJsonData {
20
20
  export interface AwsAuthDataSourceSecureJsonData {
21
21
  accessKey?: string;
22
22
  secretKey?: string;
23
+ sessionToken?: string;
23
24
  }
25
+ export declare type AwsAuthDataSourceSettings = DataSourceSettings<AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/aws-sdk",
3
- "version": "0.0.31",
3
+ "version": "0.0.32",
4
4
  "description": "Common AWS features for grafana",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -9,14 +9,14 @@
9
9
  "bundle": "rollup -c rollup.config.ts",
10
10
  "clean": "rimraf ./dist ./compiled",
11
11
  "typecheck": "tsc --noEmit",
12
- "publish": "npm publish --access=public --scope=grafana",
13
- "test": "jest --notify --watch"
12
+ "test": "jest --notify --watch",
13
+ "test-ci": "grafana-toolkit plugin:test"
14
14
  },
15
15
  "files": [
16
16
  "index.js",
17
17
  "dist"
18
18
  ],
19
- "repository": "github:grafana/grafana-aws-sdk",
19
+ "repository": "github:grafana/grafana-aws-sdk-react",
20
20
  "author": "Grafana Labs <team@grafana.com> (https://grafanap.com)",
21
21
  "license": "Apache-2.0",
22
22
  "dependencies": {},
@@ -24,11 +24,10 @@
24
24
  "@babel/preset-env": "^7.13.12",
25
25
  "@babel/preset-react": "^7.13.13",
26
26
  "@babel/preset-typescript": "^7.13.0",
27
- "@grafana/data": "^7.5.0",
28
- "@grafana/e2e-selectors": "^7.5.4",
29
- "@grafana/toolkit": "^7.5.1",
27
+ "@grafana/data": "^8.2.1",
28
+ "@grafana/toolkit": "^8.2.1",
30
29
  "@grafana/tsconfig": "^1.0.0-rc1",
31
- "@grafana/ui": "^7.5.0",
30
+ "@grafana/ui": "^8.2.1",
32
31
  "@rollup/plugin-commonjs": "11.0.2",
33
32
  "@rollup/plugin-json": "4.0.3",
34
33
  "@rollup/plugin-node-resolve": "7.1.1",
@@ -48,6 +47,7 @@
48
47
  "babel-jest": "^26.6.3",
49
48
  "jest": "^26.6.3",
50
49
  "pretty-format": "25.1.0",
50
+ "react-select-event": "^5.3.0",
51
51
  "react-test-renderer": "^17.0.2",
52
52
  "rimraf": "^3.0.2",
53
53
  "rollup": "2.0.6",
package/CHANGELOG.md DELETED
@@ -1,7 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- ## v1.0.0
6
-
7
- - Initial Release
@@ -1,14 +0,0 @@
1
- import { E2ESelectors } from '@grafana/e2e-selectors';
2
- export declare const Components: {
3
- ConfigEditor: {
4
- SecretKey: {
5
- input: string;
6
- };
7
- AccessKey: {
8
- input: string;
9
- };
10
- };
11
- };
12
- export declare const selectors: {
13
- components: E2ESelectors<typeof Components>;
14
- };