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
9f1f5805
Commit
9f1f5805
authored
Oct 28, 2018
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added switch form component
parent
7863d2d8
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
1 deletions
+52
-1
public/app/core/components/Label/Label.tsx
+1
-0
public/app/core/components/Switch/Switch.tsx
+46
-0
public/app/features/teams/TeamSettings.tsx
+1
-1
public/app/plugins/panel/graph2/module.tsx
+4
-0
No files found.
public/app/core/components/
Forms/Forms
.tsx
→
public/app/core/components/
Label/Label
.tsx
View file @
9f1f5805
...
...
@@ -19,3 +19,4 @@ export const Label: SFC<Props> = props => {
</
span
>
);
};
public/app/core/components/Switch/Switch.tsx
0 → 100644
View file @
9f1f5805
import
React
,
{
PureComponent
}
from
'react'
;
import
_
from
'lodash'
;
export
interface
Props
{
label
:
string
;
checked
:
boolean
;
labelClass
?:
string
;
switchClass
?:
string
;
onChange
:
(
event
)
=>
any
;
}
export
interface
State
{
id
:
any
;
}
export
class
Switch
extends
PureComponent
<
Props
,
State
>
{
state
=
{
id
:
_
.
uniqueId
(),
};
internalOnChange
=
event
=>
{
event
.
stopPropagation
();
this
.
props
.
onChange
(
event
);
};
render
()
{
const
{
labelClass
,
switchClass
,
label
,
checked
}
=
this
.
props
;
const
labelId
=
`check-
${
this
.
state
.
id
}
`
;
const
labelClassName
=
`gf-form-label
${
labelClass
}
pointer`
;
const
switchClassName
=
`gf-form-switch
${
switchClass
}
`
;
return
(
<
div
className=
"gf-form"
>
{
label
&&
(
<
label
htmlFor=
{
labelId
}
className=
{
labelClassName
}
>
{
label
}
</
label
>
)
}
<
div
className=
{
switchClassName
}
>
<
input
id=
{
labelId
}
type=
"checkbox"
checked=
{
checked
}
onChange=
{
this
.
internalOnChange
}
/>
<
label
htmlFor=
{
labelId
}
/>
</
div
>
</
div
>
);
}
}
public/app/features/teams/TeamSettings.tsx
View file @
9f1f5805
import
React
from
'react'
;
import
{
connect
}
from
'react-redux'
;
import
{
Label
}
from
'app/core/components/
Forms/Forms
'
;
import
{
Label
}
from
'app/core/components/
Label/Label
'
;
import
{
Team
}
from
'../../types'
;
import
{
updateTeam
}
from
'./state/actions'
;
import
{
getRouteParamsId
}
from
'../../core/selectors/location'
;
...
...
public/app/plugins/panel/graph2/module.tsx
View file @
9f1f5805
...
...
@@ -5,6 +5,7 @@ import React, { PureComponent } from 'react';
// Components
import
Graph
from
'app/viz/Graph'
;
import
{
getTimeSeriesVMs
}
from
'app/viz/state/timeSeries'
;
import
{
Switch
}
from
'app/core/components/Switch/Switch'
;
// Types
import
{
PanelProps
,
NullValueMode
}
from
'app/types'
;
...
...
@@ -35,10 +36,13 @@ export class Graph2 extends PureComponent<Props> {
}
export
class
TextOptions
extends
PureComponent
<
any
>
{
onChange
=
()
=>
{};
render
()
{
return
(
<
div
className=
"section gf-form-group"
>
<
h5
className=
"section-heading"
>
Draw Modes
</
h5
>
<
Switch
label=
"Lines"
checked=
{
true
}
onChange=
{
this
.
onChange
}
/>
</
div
>
);
}
...
...
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