Skip to content

Commit 2552cd7

Browse files
authored
CT-248: Hide the API key on subsequent visits to the configuration page (#62)
* Hide the API key on subsequent visits to the configuration page * Changelog
1 parent b154fc8 commit 2552cd7

File tree

6 files changed

+59
-6
lines changed

6 files changed

+59
-6
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 2.3.0
4+
5+
Obscure the API key on the configuration page on subsequent visits (#62) (Yan Shnayder)
6+
Releases will now also be made in `.zip` format for use with `grafana-cli`
7+
38
## 2.2.0
49

510
Support variable substitution in Power Queries (#54) (Yan Shnayder)

dist/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ from GitHub.
5050
Stable version:
5151

5252
```bash
53-
tar -xvf scalyr_grafana_plugin_44eb7da.tar.gz
53+
tar -xvf scalyr_grafana_plugin_fcf8a75.tar.gz
5454
cp -rf dist/ /var/lib/grafana/plugins/scalyr/
5555
```
5656

dist/module.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/partials/config.html

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,35 @@
11
<div class="gf-form-group">
22
<div class="gf-form-inline">
3-
<div class="gf-form">
3+
<div class="gf-form" ng-if="ctrl.showKey">
44
<span class="gf-form-label width-10">Scalyr API Key</span>
55
<input
66
type="text"
77
class="gf-form-input width-30 gf-form-input--has-help-icon"
8-
ng-model="ctrl.current.jsonData.scalyrApiKey"
8+
ng-model="ctrl.current.jsonData.scalyrApiKeyView"
99
spellcheck='false'
1010
placeholder="Scalyr API Key"
11+
ng-change="ctrl.onChangeKey()"
1112
></input>
1213
<info-popover mode="right-absolute">
1314
Set this to your read Log Access Key
1415
</info-popover>
1516
</div>
17+
<div class="gf-form" ng-if="!ctrl.showKey">
18+
<div class="gf-form">
19+
<span class="gf-form-label width-10">Scalyr API Key</span>
20+
<input
21+
type="text"
22+
class="gf-form-input width-30 gf-form-input--has-help-icon"
23+
spellcheck='false'
24+
placeholder="Scalyr API Key"
25+
disabled
26+
></input>
27+
<info-popover mode="right-absolute">
28+
Set this to your read Log Access Key
29+
</info-popover>
30+
</div>
31+
<button class="btn navbar-button gf-timepicker-nav-btn width-5" ng-click="ctrl.resetKey()">Reset</button>
32+
</div>
1633
</div>
1734
<div class="gf-form-inline">
1835
<div class="gf-form">

src/config_ctrl.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,24 @@
11

22
export class GenericConfigCtrl {
33
constructor($scope) {
4+
this.showKey = true;
45
this.scope = $scope;
56
if (!this.current.jsonData.scalyrUrl) {
67
this.current.jsonData.scalyrUrl = 'https://www.scalyr.com';
78
}
9+
if (this.current.jsonData.scalyrApiKey) {
10+
this.showKey = false;
11+
}
12+
}
13+
14+
onChangeKey() {
15+
this.current.jsonData.scalyrApiKey = this.current.jsonData.scalyrApiKeyView
16+
}
17+
18+
resetKey() {
19+
this.current.jsonData.scalyrApiKey = "";
20+
this.current.jsonData.scalyrApiKeyView = "";
21+
this.showKey = true;
822
}
923
}
1024

src/partials/config.html

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,35 @@
11
<div class="gf-form-group">
22
<div class="gf-form-inline">
3-
<div class="gf-form">
3+
<div class="gf-form" ng-if="ctrl.showKey">
44
<span class="gf-form-label width-10">Scalyr API Key</span>
55
<input
66
type="text"
77
class="gf-form-input width-30 gf-form-input--has-help-icon"
8-
ng-model="ctrl.current.jsonData.scalyrApiKey"
8+
ng-model="ctrl.current.jsonData.scalyrApiKeyView"
99
spellcheck='false'
1010
placeholder="Scalyr API Key"
11+
ng-change="ctrl.onChangeKey()"
1112
></input>
1213
<info-popover mode="right-absolute">
1314
Set this to your read Log Access Key
1415
</info-popover>
1516
</div>
17+
<div class="gf-form" ng-if="!ctrl.showKey">
18+
<div class="gf-form">
19+
<span class="gf-form-label width-10">Scalyr API Key</span>
20+
<input
21+
type="text"
22+
class="gf-form-input width-30 gf-form-input--has-help-icon"
23+
spellcheck='false'
24+
placeholder="Scalyr API Key"
25+
disabled
26+
></input>
27+
<info-popover mode="right-absolute">
28+
Set this to your read Log Access Key
29+
</info-popover>
30+
</div>
31+
<button class="btn navbar-button gf-timepicker-nav-btn width-5" ng-click="ctrl.resetKey()">Reset</button>
32+
</div>
1633
</div>
1734
<div class="gf-form-inline">
1835
<div class="gf-form">

0 commit comments

Comments
 (0)