Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
150b9769
Commit
150b9769
authored
Mar 19, 2019
by
Andrej Ocenas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use SecretFormField in MSSql and Postgres datasources
parent
d8167ffb
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
18 deletions
+53
-18
public/app/core/angular_wrappers.ts
+8
-1
public/app/plugins/datasource/mssql/config_ctrl.ts
+14
-0
public/app/plugins/datasource/mssql/partials/config.html
+9
-9
public/app/plugins/datasource/postgres/config_ctrl.ts
+13
-0
public/app/plugins/datasource/postgres/partials/config.html
+9
-8
No files found.
public/app/core/angular_wrappers.ts
View file @
150b9769
...
...
@@ -9,7 +9,7 @@ import { TagFilter } from './components/TagFilter/TagFilter';
import
{
SideMenu
}
from
'./components/sidemenu/SideMenu'
;
import
{
MetricSelect
}
from
'./components/Select/MetricSelect'
;
import
AppNotificationList
from
'./components/AppNotifications/AppNotificationList'
;
import
{
ColorPicker
,
SeriesColorPickerPopoverWithTheme
}
from
'@grafana/ui'
;
import
{
ColorPicker
,
SeriesColorPickerPopoverWithTheme
,
SecretFormField
}
from
'@grafana/ui'
;
import
{
FunctionEditor
}
from
'app/plugins/datasource/graphite/FunctionEditor'
;
export
function
registerAngularDirectives
()
{
...
...
@@ -59,4 +59,11 @@ export function registerAngularDirectives() {
[
'datasource'
,
{
watchDepth
:
'reference'
}],
[
'templateSrv'
,
{
watchDepth
:
'reference'
}],
]);
react2AngularDirective
(
'secretFormField'
,
SecretFormField
,
[
'value'
,
'isConfigured'
,
'inputWidth'
,
[
'onReset'
,
{
watchDepth
:
'reference'
,
wrapApply
:
true
}],
[
'onChange'
,
{
watchDepth
:
'reference'
,
wrapApply
:
true
}],
]);
}
public/app/plugins/datasource/mssql/config_ctrl.ts
View file @
150b9769
import
{
SyntheticEvent
}
from
'react'
;
export
class
MssqlConfigCtrl
{
static
templateUrl
=
'partials/config.html'
;
...
...
@@ -7,4 +9,16 @@ export class MssqlConfigCtrl {
constructor
(
$scope
)
{
this
.
current
.
jsonData
.
encrypt
=
this
.
current
.
jsonData
.
encrypt
||
'false'
;
}
onPasswordReset
=
(
event
:
SyntheticEvent
<
HTMLInputElement
>
)
=>
{
event
.
preventDefault
();
this
.
current
.
secureJsonFields
.
password
=
false
;
this
.
current
.
secureJsonData
=
this
.
current
.
secureJsonData
||
{};
this
.
current
.
secureJsonData
.
password
=
''
;
};
onPasswordChange
=
(
event
:
SyntheticEvent
<
HTMLInputElement
>
)
=>
{
this
.
current
.
secureJsonData
=
this
.
current
.
secureJsonData
||
{};
this
.
current
.
secureJsonData
.
password
=
event
.
currentTarget
.
value
;
};
}
public/app/plugins/datasource/mssql/partials/config.html
View file @
150b9769
...
...
@@ -17,15 +17,15 @@
<span
class=
"gf-form-label width-7"
>
User
</span>
<input
type=
"text"
class=
"gf-form-input"
ng-model=
'ctrl.current.user'
placeholder=
"user"
></input>
</div>
<div
class=
"gf-form max-width-15"
ng-if=
"!ctrl.current.secureJsonFields.password
"
>
<span
class=
"gf-form-label width-7"
>
Password
</span>
<input
type=
"password"
class=
"gf-form-input"
ng-model=
'ctrl.current.secureJsonData.password'
placeholder=
"password"
></input>
</div>
<div
class=
"gf-form max-width-19"
ng-if=
"ctrl.current.secureJsonFields.password"
>
<span
class=
"gf-form-label width-7"
>
Password
</span>
<input
type=
"text"
class=
"gf-form-input"
disabled=
"disabled"
value=
"configured"
>
<a
class=
"btn btn-secondary gf-form-btn"
href=
"#"
ng-click=
"ctrl.current.secureJsonFields.password = false"
>
reset
</a
>
</div>
<div
class=
"gf-form
"
>
<secret-form-field
isConfigured=
"ctrl.current.secureJsonFields.password"
value=
"ctrl.current.secureJsonData.password"
on-reset=
"ctrl.onPasswordReset"
on-change=
"ctrl.onPasswordChange"
inputWidth=
"9"
/
>
</div>
</div>
<div
class=
"gf-form"
>
...
...
public/app/plugins/datasource/postgres/config_ctrl.ts
View file @
150b9769
import
_
from
'lodash'
;
import
{
SyntheticEvent
}
from
'react'
;
export
class
PostgresConfigCtrl
{
static
templateUrl
=
'partials/config.html'
;
...
...
@@ -52,6 +53,18 @@ export class PostgresConfigCtrl {
this
.
showTimescaleDBHelp
=
!
this
.
showTimescaleDBHelp
;
}
onPasswordReset
=
(
event
:
SyntheticEvent
<
HTMLInputElement
>
)
=>
{
event
.
preventDefault
();
this
.
current
.
secureJsonFields
.
password
=
false
;
this
.
current
.
secureJsonData
=
this
.
current
.
secureJsonData
||
{};
this
.
current
.
secureJsonData
.
password
=
''
;
};
onPasswordChange
=
(
event
:
SyntheticEvent
<
HTMLInputElement
>
)
=>
{
this
.
current
.
secureJsonData
=
this
.
current
.
secureJsonData
||
{};
this
.
current
.
secureJsonData
.
password
=
event
.
currentTarget
.
value
;
};
// the value portion is derived from postgres server_version_num/100
postgresVersions
=
[
{
name
:
'9.3'
,
value
:
903
},
...
...
public/app/plugins/datasource/postgres/partials/config.html
View file @
150b9769
...
...
@@ -17,16 +17,17 @@
<span
class=
"gf-form-label width-7"
>
User
</span>
<input
type=
"text"
class=
"gf-form-input"
ng-model=
'ctrl.current.user'
placeholder=
"user"
></input>
</div>
<div
class=
"gf-form max-width-15"
ng-if=
"!ctrl.current.secureJsonFields.password
"
>
<span
class=
"gf-form-label width-7"
>
Password
</span>
<input
type=
"password"
class=
"gf-form-input"
ng-model=
'ctrl.current.secureJsonData.password'
placeholder=
"password"
></input>
</div>
<div
class=
"gf-form max-width-19"
ng-if=
"ctrl.current.secureJsonFields.password"
>
<span
class=
"gf-form-label width-7"
>
Password
</span>
<input
type=
"text"
class=
"gf-form-input"
disabled=
"disabled"
value=
"configured"
>
<a
class=
"btn btn-secondary gf-form-btn"
href=
"#"
ng-click=
"ctrl.current.secureJsonFields.password = false"
>
reset
</a
>
<div
class=
"gf-form
"
>
<secret-form-field
isConfigured=
"ctrl.current.secureJsonFields.password"
value=
"ctrl.current.secureJsonData.password"
on-reset=
"ctrl.onPasswordReset"
on-change=
"ctrl.onPasswordChange"
inputWidth=
"9"
/
>
</div>
</div>
<div
class=
"gf-form"
>
<label
class=
"gf-form-label width-7"
>
SSL Mode
</label>
<div
class=
"gf-form-select-wrapper max-width-15 gf-form-select-wrapper--has-help-icon"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment