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
61112d93
Commit
61112d93
authored
Sep 11, 2018
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip: folder to redux
parent
679ffbfd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
34 deletions
+34
-34
public/app/features/manage-dashboards/FolderSettingsPage.tsx
+27
-33
public/app/features/manage-dashboards/state/reducers.ts
+7
-1
No files found.
public/app/features/manage-dashboards/FolderSettingsPage.tsx
View file @
61112d93
...
...
@@ -120,48 +120,41 @@ export class FolderSettingsPage extends PureComponent<Props> {
render
()
{
const
{
navModel
}
=
this
.
props
;
// if (!folder.folder || !nav.main) {
// return <h2>Loading</h2>;
// }
return
(
<
div
>
<
PageHeader
model=
{
navModel
}
/>
<
div
className=
"page-container page-body"
>
<
h2
className=
"page-sub-heading"
>
Folder Settings
</
h2
>
<
div
className=
"section gf-form-group"
>
<
form
name=
"folderSettingsForm"
onSubmit=
{
this
.
save
.
bind
(
this
)
}
>
<
div
className=
"gf-form"
>
<
label
className=
"gf-form-label width-7"
>
Name
</
label
>
<
input
type=
"text"
className=
"gf-form-input width-30"
value=
{
folder
.
folder
.
title
}
onChange=
{
this
.
onTitleChange
.
bind
(
this
)
}
/>
</
div
>
<
div
className=
"gf-form-button-row"
>
<
button
type=
"submit"
className=
"btn btn-success"
disabled=
{
!
folder
.
folder
.
canSave
||
!
folder
.
folder
.
hasChanged
}
>
<
i
className=
"fa fa-save"
/>
Save
</
button
>
<
button
className=
"btn btn-danger"
onClick=
{
this
.
delete
.
bind
(
this
)
}
disabled=
{
!
folder
.
folder
.
canSave
}
>
<
i
className=
"fa fa-trash"
/>
Delete
</
button
>
</
div
>
</
form
>
</
div
>
</
div
>
</
div
>
);
}
// asd() {
// <div className="section gf-form-group">
// <form name="folderSettingsForm" onSubmit={this.save.bind(this)}>
// <div className="gf-form">
// <label className="gf-form-label width-7">Name</label>
// <input
// type="text"
// className="gf-form-input width-30"
// value={folder.folder.title}
// onChange={this.onTitleChange.bind(this)}
// />
// </div>
// <div className="gf-form-button-row">
// <button
// type="submit"
// className="btn btn-success"
// disabled={!folder.folder.canSave || !folder.folder.hasChanged}
// >
// <i className="fa fa-save" /> Save
// </button>
// <button className="btn btn-danger" onClick={this.delete.bind(this)} disabled={!folder.folder.canSave}>
// <i className="fa fa-trash" /> Delete
// </button>
// </div>
// </form>
// </div>
//
// }
}
const
mapStateToProps
=
(
state
:
StoreState
)
=>
{
...
...
@@ -170,6 +163,7 @@ const mapStateToProps = (state: StoreState) => {
return
{
navModel
:
getNavModel
(
state
.
navIndex
,
`folder-settings-
${
uid
}
`
),
folderUid
:
uid
,
folder
:
state
.
folder
,
};
};
...
...
public/app/features/manage-dashboards/state/reducers.ts
View file @
61112d93
import
{
FolderState
}
from
'app/types'
;
import
{
Action
,
ActionTypes
}
from
'./actions'
;
export
const
inititalState
:
FolderState
=
null
;
export
const
inititalState
:
FolderState
=
{
uid
:
'loading'
,
id
:
-
1
,
title
:
'loading'
,
canSave
:
false
,
hasChanged
:
false
,
};
export
const
folderReducer
=
(
state
=
inititalState
,
action
:
Action
):
FolderState
=>
{
switch
(
action
.
type
)
{
...
...
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