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
98fa17f0
Commit
98fa17f0
authored
Jan 28, 2019
by
Johannes Schill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: Fix typings and add Page-component to DataSourceSettingsPage #14762
parent
3372dc94
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
15 deletions
+15
-15
public/app/features/datasources/settings/DataSourceSettingsPage.tsx
+15
-15
public/app/features/datasources/settings/__snapshots__/DataSourceSettingsPage.test.tsx.snap
+0
-0
No files found.
public/app/features/datasources/settings/DataSourceSettingsPage.tsx
View file @
98fa17f0
...
...
@@ -4,8 +4,7 @@ import { hot } from 'react-hot-loader';
import
{
connect
}
from
'react-redux'
;
// Components
import
PageHeader
from
'app/core/components/PageHeader/PageHeader'
;
import
PageLoader
from
'app/core/components/PageLoader/PageLoader'
;
import
Page
from
'app/core/components/Page/Page'
;
import
PluginSettings
from
'./PluginSettings'
;
import
BasicSettings
from
'./BasicSettings'
;
import
ButtonRow
from
'./ButtonRow'
;
...
...
@@ -51,7 +50,7 @@ enum DataSourceStates {
}
export
class
DataSourceSettingsPage
extends
PureComponent
<
Props
,
State
>
{
constructor
(
props
)
{
constructor
(
props
:
Props
)
{
super
(
props
);
this
.
state
=
{
...
...
@@ -65,8 +64,8 @@ export class DataSourceSettingsPage extends PureComponent<Props, State> {
await
loadDataSource
(
pageId
);
}
onSubmit
=
async
event
=>
{
ev
en
t
.
preventDefault
();
onSubmit
=
async
(
evt
:
React
.
FormEvent
<
HTMLFormElement
>
)
=>
{
evt
.
preventDefault
();
await
this
.
props
.
updateDataSource
({
...
this
.
state
.
dataSource
,
name
:
this
.
props
.
dataSource
.
name
});
...
...
@@ -89,7 +88,7 @@ export class DataSourceSettingsPage extends PureComponent<Props, State> {
this
.
props
.
deleteDataSource
();
};
onModelChange
=
dataSource
=>
{
onModelChange
=
(
dataSource
:
DataSourceSettings
)
=>
{
this
.
setState
({
dataSource
:
dataSource
,
});
...
...
@@ -170,17 +169,18 @@ export class DataSourceSettingsPage extends PureComponent<Props, State> {
});
}
get
hasDataSource
()
{
return
Object
.
keys
(
this
.
props
.
dataSource
).
length
>
0
;
}
render
()
{
const
{
dataSource
,
dataSourceMeta
,
navModel
,
setDataSourceName
,
setIsDefault
}
=
this
.
props
;
const
{
testingMessage
,
testingStatus
}
=
this
.
state
;
return
(
<
div
>
<
PageHeader
model=
{
navModel
}
/>
{
Object
.
keys
(
dataSource
).
length
===
0
?
(
<
PageLoader
pageName=
"Data source settings"
/>
)
:
(
<
div
className=
"page-container page-body"
>
<
Page
navModel=
{
navModel
}
>
<
Page
.
Contents
isLoading=
{
!
this
.
hasDataSource
}
>
{
this
.
hasDataSource
&&
<
div
className=
"page-container page-body"
>
<
div
>
<
form
onSubmit=
{
this
.
onSubmit
}
>
{
this
.
isReadOnly
()
&&
this
.
renderIsReadOnlyMessage
()
}
...
...
@@ -225,9 +225,9 @@ export class DataSourceSettingsPage extends PureComponent<Props, State> {
/>
</
form
>
</
div
>
</
div
>
)
}
</
div
>
</
div
>
}
</
Page
.
Contents
>
</
Page
>
);
}
}
...
...
public/app/features/datasources/settings/__snapshots__/DataSourceSettingsPage.test.tsx.snap
View file @
98fa17f0
This diff is collapsed.
Click to expand it.
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