Skip to content

Commit

Permalink
Merge pull request #4 from bmcsoftware/feedback_correction
Browse files Browse the repository at this point in the history
feedback changes from grafana
  • Loading branch information
abhijeet-teli committed Feb 16, 2022
2 parents 3d942ac + c390abc commit 5f10568
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 68 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!-- 2.0.0 START -->

# 2.0.0 (2022-16-01)

### Features and enhancements
- **Log:** Use new query type log to fetch the log data from BMC Helix Log Analytics in your environment.
6 changes: 6 additions & 0 deletions dist/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!-- 2.0.0 START -->

# 2.0.0 (2022-16-01)

### Features and enhancements
- **Log:** Use new query type log to fetch the log data from BMC Helix Log Analytics in your environment.
20 changes: 10 additions & 10 deletions dist/MANIFEST.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ Hash: SHA512
"signedByOrgName": "BMC Software",
"plugin": "bmchelix-ade-datasource",
"version": "2.0.0",
"time": 1643868850143,
"time": 1645008319393,
"keyId": "7e4d0c6a708866e7",
"files": {
"CHANGELOG.md": "53dfa578bab65f10e411224d34e84ddbc686cf91f02f2dc1767277fc09603b95",
"gpx_bmchelix-ade-datasource_darwin_amd64": "4220596b907cee108bdc61a8b0f77b30a518598b9cbb07a961bab36ca1eda7ec",
"gpx_bmchelix-ade-datasource_darwin_arm64": "36a33beb9f305a42ab7b7a1198dcba42de8d8f5cd43cd28b4225164b2c00a670",
"gpx_bmchelix-ade-datasource_linux_amd64": "f36aa5814fe65c11ad396c922f11bbf6be3dd50067a1e19557f46e3274eb0bf2",
Expand All @@ -21,9 +22,8 @@ Hash: SHA512
"img/grafana_icon.svg": "44a75989e1b74eeb5f441e321308a01d8fe0005891de65075aa63661475883c1",
"img/logo.svg": "ab97c27e5086935b588cdd33b5bb35320bb0f8c03ebc5a5e0d618892e1f73c19",
"LICENSE": "2e2fe007304853ac72ab4389a8c72bb86b9337e6f17f90b392b79ce2e5b480d4",
"module.js": "98b12c44afe62e02f90ce5776bee645cd3f6fb82c611e34b78c961e358fd9316",
"module.js.LICENSE.txt": "0d8f66cd4afb566cb5b7e1540c68f43b939d3eba12ace290f18abc4f4cb53ed0",
"module.js.map": "f4faa2f2911a619069533e826893f290f3331ecfbb36f6f32e9dc3877513eb5c",
"module.js": "f83cc4d8fe5f5b67bd95ac4d490df1088b25e06f01b1163a4e2c852cfa619911",
"module.js.map": "ae1c679e5ba97136ea2599697bd2c979794654d69cdf774d8c309d54723b25c8",
"partials/annotations.editor.html": "d215148e5b7c07831d0c3eacc4ebaa32c4e96b088eb1cff08f13826fd227d4a9",
"partials/cloudsecurity/cloudsecurity.query.editor.html": "9a465868dc545c6652b1ca0338edb2a2cb628294ee2fb6039c535769468815c8",
"partials/event/annotations.editor.html": "d2521f4d07730028f15d9dc99a060e5060db798ed574b9b74fe752078c5bee35",
Expand All @@ -46,17 +46,17 @@ Hash: SHA512
"partials/remedy/remedy.qual.query.html": "4401bd1b1f2bf94323280f77caecdb513bdeaf1faf70127225fc62d0b6ff5a71",
"partials/remedy/remedy.query.editor.html": "26d63cd6fdbdbfe030e3840fa63447b9a30b66c58660eff926e86c652db7c6ff",
"partials/remedy/remedy.where.query.html": "903faaff89a8503aaae0c90adfe3212583732d7c9bcda87c44ab0c034b2496a7",
"plugin.json": "747d960dc9b43eeba0e0967076583a6141d79327089ea6bd43c9c60709379d17",
"plugin.json": "bbbe2e00dbd574955e91f480db71225aea0710125a77d6c7931996597390d501",
"README.md": "2d0d3b6a2b56fea9036c5bf461188ace49eaef242ec0a3624e8a297236af7b08"
}
}
-----BEGIN PGP SIGNATURE-----
Version: OpenPGP.js v4.10.1
Comment: https://openpgpjs.org

wqAEARMKAAYFAmH7crIACgkQfk0ManCIZudHCAIHWfJit0U2D8Yy5jV5UKAQ
6H7+oJQTccSz1c7/KLtFNFwrYCmJFVKknTURtHFB7eYlgSbbfXJZaSVBnpVP
OSrq11cCBjZ6sdTmxA4g9Ajcx5y5k1XVJ0VkCE1jIu5iPkN/nGYebF0eYp2R
Cmb/0tZhlKc24DtLHvna3ZpcWgpJ0Gqtjzhg
=hB9o
wqEEARMKAAYFAmIM1b8ACgkQfk0ManCIZud+XAIJAbNF/P+1Mi++0/qRlKEf
0vaS1pjm0uO4rT+fhs+beTI6dOhuFX0CpZq0gKxPFa+HTyu7W4fQX2Uecddr
uAzau6l0AgUXkn7nbjIBr809nkrJ+H0uiVXo/REWtfFgKIJCV1vdnDMfar6Z
H3aI+T+6agWIilL9dx0z3oi0twzDLHCMi4IZcg==
=pGWA
-----END PGP SIGNATURE-----
40 changes: 21 additions & 19 deletions dist/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -19388,10 +19388,8 @@ var EntConfigEditor =
function (_super) {
Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(EntConfigEditor, _super);

function EntConfigEditor(props) {
var _a, _b, _c, _d, _e, _f;

var _this = _super.call(this, props) || this;
function EntConfigEditor() {
var _this = _super !== null && _super.apply(this, arguments) || this;

_this.onUpdateURL = function (e) {
var _a = _this.props,
Expand All @@ -19404,32 +19402,36 @@ function (_super) {
};

_this.onResetAccessKey = function () {
var options = _this.props.options;
var secureJsonData = options.secureJsonData || {};

_this.setState(Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])(Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, _this.state), {
accessKeyConfigured: false
}));

_this.props.options.jsonData.accessKey = '';
Object(_grafana_data__WEBPACK_IMPORTED_MODULE_1__["onUpdateDatasourceJsonDataOption"])(_this.props, 'accessKey');
secureJsonData.accessKey = '';
Object(_grafana_data__WEBPACK_IMPORTED_MODULE_1__["onUpdateDatasourceSecureJsonDataOption"])(_this.props, 'accessKey');
};

_this.onResetSecretKey = function () {
var options = _this.props.options;
var secureJsonData = options.secureJsonData || {};

_this.setState(Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])(Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, _this.state), {
secretKeyConfigured: false
}));

_this.props.options.jsonData.secretKey = '';
Object(_grafana_data__WEBPACK_IMPORTED_MODULE_1__["onUpdateDatasourceJsonDataOption"])(_this.props, 'secretKey');
secureJsonData.secretKey = '';
Object(_grafana_data__WEBPACK_IMPORTED_MODULE_1__["onUpdateDatasourceSecureJsonDataOption"])(_this.props, 'secretKey');
};

_this.state = {
accessKeyConfigured: ((_c = (_b = (_a = _this.props.options) === null || _a === void 0 ? void 0 : _a.jsonData) === null || _b === void 0 ? void 0 : _b.accessKey) === null || _c === void 0 ? void 0 : _c.length) > 0,
secretKeyConfigured: ((_f = (_e = (_d = _this.props.options) === null || _d === void 0 ? void 0 : _d.jsonData) === null || _e === void 0 ? void 0 : _e.secretKey) === null || _f === void 0 ? void 0 : _f.length) > 0
};
return _this;
}

EntConfigEditor.prototype.render = function () {
var options = this.props.options;
var secureJsonFields = options.secureJsonFields;
var secureJsonData = options.secureJsonData || {};
return react__WEBPACK_IMPORTED_MODULE_3___default.a.createElement("div", {
className: "gf-form-group"
}, react__WEBPACK_IMPORTED_MODULE_3___default.a.createElement("div", {
Expand Down Expand Up @@ -19461,27 +19463,27 @@ function (_super) {
}, react__WEBPACK_IMPORTED_MODULE_3___default.a.createElement("div", {
className: "gf-form"
}, react__WEBPACK_IMPORTED_MODULE_3___default.a.createElement(SecretFormField, {
isConfigured: this.state.accessKeyConfigured,
value: options.jsonData.accessKey || '',
isConfigured: secureJsonFields && secureJsonFields.accessKey,
value: secureJsonData.accessKey || '',
label: "Access key",
labelWidth: 10,
inputWidth: 20,
placeholder: 'XXXXX-XXXXXXXXX-XXXXX',
onReset: this.onResetAccessKey,
onChange: Object(_grafana_data__WEBPACK_IMPORTED_MODULE_1__["onUpdateDatasourceJsonDataOption"])(this.props, 'accessKey')
onChange: Object(_grafana_data__WEBPACK_IMPORTED_MODULE_1__["onUpdateDatasourceSecureJsonDataOption"])(this.props, 'accessKey')
}))), react__WEBPACK_IMPORTED_MODULE_3___default.a.createElement("div", {
className: "gf-form-inline"
}, react__WEBPACK_IMPORTED_MODULE_3___default.a.createElement("div", {
className: "gf-form"
}, react__WEBPACK_IMPORTED_MODULE_3___default.a.createElement(SecretFormField, {
isConfigured: this.state.secretKeyConfigured,
value: options.jsonData.secretKey || '',
isConfigured: secureJsonFields && secureJsonFields.secretKey,
value: secureJsonData.secretKey || '',
label: "Secret key",
labelWidth: 10,
inputWidth: 20,
placeholder: 'XXXXX-XXXXXXXXX-XXXXX',
onReset: this.onResetSecretKey,
onChange: Object(_grafana_data__WEBPACK_IMPORTED_MODULE_1__["onUpdateDatasourceJsonDataOption"])(this.props, 'secretKey')
onChange: Object(_grafana_data__WEBPACK_IMPORTED_MODULE_1__["onUpdateDatasourceSecureJsonDataOption"])(this.props, 'secretKey')
}))));
};

Expand Down Expand Up @@ -30552,7 +30554,7 @@ function (_super) {
}, react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_grafana_ui__WEBPACK_IMPORTED_MODULE_3__["InlineFormLabel"], {
className: "query-keyword",
width: 7,
tooltip: "Controls the name of the time series, using name or pattern. For example\n {{hostname}} will be replaced with label value for the label hostname."
tooltip: "Controls the name of the time series, using name or pattern. For example\r\n {{hostname}} will be replaced with label value for the label hostname."
}, "Legend"), react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("input", {
type: "text",
className: "gf-form-input",
Expand Down
14 changes: 0 additions & 14 deletions dist/module.js.LICENSE.txt

This file was deleted.

2 changes: 1 addition & 1 deletion dist/module.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"links": [],
"screenshots": [],
"version": "2.0.0",
"updated": "2022-02-03"
"updated": "2022-02-16"
},
"dependencies": {
"grafanaDependency": ">=7.3.1",
Expand Down
45 changes: 24 additions & 21 deletions src/configurations/EntConfigEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { DataSourcePluginOptionsEditorProps, onUpdateDatasourceJsonDataOption } from '@grafana/data';
import {
DataSourcePluginOptionsEditorProps,
onUpdateDatasourceJsonDataOption,
onUpdateDatasourceSecureJsonDataOption,
} from '@grafana/data';
import { InlineFormLabel, LegacyForms } from '@grafana/ui';
import React, { PureComponent } from 'react';
import { BMCDataSourceOptions } from '../types';
import { BMCDataSourceOptions, HelixSecureJsonData } from '../types';
const { Input, SecretFormField } = LegacyForms;

interface Props extends DataSourcePluginOptionsEditorProps<BMCDataSourceOptions> {}
Expand All @@ -12,14 +16,7 @@ interface State {
}

export class EntConfigEditor extends PureComponent<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
accessKeyConfigured: this.props.options?.jsonData?.accessKey?.length > 0,
secretKeyConfigured: this.props.options?.jsonData?.secretKey?.length > 0,
};
}


onUpdateURL = (e: React.SyntheticEvent<HTMLInputElement>) => {
const { options, onOptionsChange } = this.props;
onOptionsChange({
Expand All @@ -30,25 +27,31 @@ export class EntConfigEditor extends PureComponent<Props, State> {
};

onResetAccessKey = () => {
const { options } = this.props;
const secureJsonData = (options.secureJsonData || {}) as HelixSecureJsonData;
this.setState({
...this.state,
accessKeyConfigured: false,
});
this.props.options.jsonData.accessKey = '';
onUpdateDatasourceJsonDataOption(this.props, 'accessKey');
secureJsonData.accessKey = '';
onUpdateDatasourceSecureJsonDataOption(this.props, 'accessKey');
};

onResetSecretKey = () => {
const { options } = this.props;
const secureJsonData = (options.secureJsonData || {}) as HelixSecureJsonData;
this.setState({
...this.state,
secretKeyConfigured: false,
});
this.props.options.jsonData.secretKey = '';
onUpdateDatasourceJsonDataOption(this.props, 'secretKey');
secureJsonData.secretKey = '';
onUpdateDatasourceSecureJsonDataOption(this.props, 'secretKey');
};

render() {
const { options } = this.props;
const { secureJsonFields } = options;
const secureJsonData = (options.secureJsonData || {}) as HelixSecureJsonData;
return (
<div className="gf-form-group">
<div className="gf-form-inline">
Expand All @@ -58,7 +61,7 @@ export class EntConfigEditor extends PureComponent<Props, State> {
<Input className="width-20" value={options.url || ''} onChange={this.onUpdateURL} />
</div>
</div>
</div>
</div>
<div className="gf-form-inline">
<div className="gf-form">
<InlineFormLabel className="width-10">Tenant ID</InlineFormLabel>
Expand All @@ -74,28 +77,28 @@ export class EntConfigEditor extends PureComponent<Props, State> {
<div className="gf-form-inline">
<div className="gf-form">
<SecretFormField
isConfigured={this.state.accessKeyConfigured}
value={options.jsonData.accessKey || ''}
isConfigured={(secureJsonFields && secureJsonFields.accessKey) as boolean}
value={secureJsonData.accessKey || ''}
label="Access key"
labelWidth={10}
inputWidth={20}
placeholder={'XXXXX-XXXXXXXXX-XXXXX'}
onReset={this.onResetAccessKey}
onChange={onUpdateDatasourceJsonDataOption(this.props, 'accessKey')}
onChange={onUpdateDatasourceSecureJsonDataOption(this.props, 'accessKey')}
/>
</div>
</div>
<div className="gf-form-inline">
<div className="gf-form">
<SecretFormField
isConfigured={this.state.secretKeyConfigured}
value={options.jsonData.secretKey || ''}
isConfigured={(secureJsonFields && secureJsonFields.secretKey) as boolean}
value={secureJsonData.secretKey || ''}
label="Secret key"
labelWidth={10}
inputWidth={20}
placeholder={'XXXXX-XXXXXXXXX-XXXXX'}
onReset={this.onResetSecretKey}
onChange={onUpdateDatasourceJsonDataOption(this.props, 'secretKey')}
onChange={onUpdateDatasourceSecureJsonDataOption(this.props, 'secretKey')}
/>
</div>
</div>
Expand Down
7 changes: 5 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ export interface BMCDataSourceOptions extends DataSourceJsonData {
platformQueue: string;
tenantURL: string;
tenantId: string;
accessKey: string;
secretKey: string;
}

export interface HelixSecureJsonData {
accessKey?: string;
secretKey?: string;
}

export const queryTypeOptions: any = [
Expand Down

0 comments on commit 5f10568

Please sign in to comment.