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
8fd1d8a0
Commit
8fd1d8a0
authored
Oct 02, 2018
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed from RFC to PureComponent
parent
7ae4076d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
42 deletions
+45
-42
public/app/features/datasources/DataSourcesList.tsx
+20
-18
public/app/features/datasources/DataSourcesListItem.tsx
+25
-24
No files found.
public/app/features/datasources/DataSourcesList.tsx
View file @
8fd1d8a0
import
React
,
{
SFC
}
from
'react'
;
import
React
,
{
PureComponent
}
from
'react'
;
import
classNames
from
'classnames/bind'
;
import
classNames
from
'classnames/bind'
;
import
DataSourcesListItem
from
'./DataSourcesListItem'
;
import
DataSourcesListItem
from
'./DataSourcesListItem'
;
import
{
DataSource
}
from
'app/types'
;
import
{
DataSource
}
from
'app/types'
;
...
@@ -9,24 +9,26 @@ export interface Props {
...
@@ -9,24 +9,26 @@ export interface Props {
layoutMode
:
LayoutMode
;
layoutMode
:
LayoutMode
;
}
}
const
DataSourcesList
:
SFC
<
Props
>
=
props
=>
{
export
class
DataSourcesList
extends
PureComponent
<
Props
>
{
const
{
dataSources
,
layoutMode
}
=
props
;
render
()
{
const
{
dataSources
,
layoutMode
}
=
this
.
props
;
const
listStyle
=
classNames
({
const
listStyle
=
classNames
({
'card-section'
:
true
,
'card-section'
:
true
,
'card-list-layout-grid'
:
layoutMode
===
LayoutModes
.
Grid
,
'card-list-layout-grid'
:
layoutMode
===
LayoutModes
.
Grid
,
'card-list-layout-list'
:
layoutMode
===
LayoutModes
.
List
,
'card-list-layout-list'
:
layoutMode
===
LayoutModes
.
List
,
});
});
return
(
return
(
<
section
className=
{
listStyle
}
>
<
section
className=
{
listStyle
}
>
<
ol
className=
"card-list"
>
<
ol
className=
"card-list"
>
{
dataSources
.
map
((
dataSource
,
index
)
=>
{
{
dataSources
.
map
((
dataSource
,
index
)
=>
{
return
<
DataSourcesListItem
dataSource=
{
dataSource
}
key=
{
`${dataSource.id}-${index}`
}
/>;
return
<
DataSourcesListItem
dataSource=
{
dataSource
}
key=
{
`${dataSource.id}-${index}`
}
/>;
})
}
})
}
</
ol
>
</
ol
>
</
section
>
</
section
>
);
);
};
}
}
export
default
DataSourcesList
;
export
default
DataSourcesList
;
public/app/features/datasources/DataSourcesListItem.tsx
View file @
8fd1d8a0
import
React
,
{
SFC
}
from
'react'
;
import
React
,
{
PureComponent
}
from
'react'
;
import
{
DataSource
}
from
'app/types'
;
import
{
DataSource
}
from
'app/types'
;
export
interface
Props
{
export
interface
Props
{
dataSource
:
DataSource
;
dataSource
:
DataSource
;
}
}
const
DataSourcesListItem
:
SFC
<
Props
>
=
props
=>
{
export
class
DataSourcesListItem
extends
PureComponent
<
Props
>
{
const
{
dataSource
}
=
props
;
render
()
{
const
{
dataSource
}
=
this
.
props
;
return
(
return
(
<
li
className=
"card-item-wrapper"
>
<
li
className=
"card-item-wrapper"
>
<
a
className=
"card-item"
href=
{
`datasources/edit/${dataSource.id}`
}
>
<
a
className=
"card-item"
href=
{
`datasources/edit/${dataSource.id}`
}
>
<
div
className=
"card-item-header"
>
<
div
className=
"card-item-header"
>
<
div
className=
"card-item-type"
>
{
dataSource
.
type
}
</
div
>
<
div
className=
"card-item-type"
>
{
dataSource
.
type
}
</
div
>
</
div
>
</
div
>
<
div
className=
"card-item-body"
>
<
div
className=
"card-item-body"
>
<
figure
className=
"card-item-figure"
>
<
figure
className=
"card-item-figure"
>
<
img
src=
{
dataSource
.
typeLogoUrl
}
/>
<
img
src=
{
dataSource
.
typeLogoUrl
}
/>
</
figure
>
</
figure
>
<
div
className=
"card-item-details"
>
<
div
className=
"card-item-details"
>
<
div
className=
"card-item-name"
>
<
div
className=
"card-item-name"
>
{
dataSource
.
name
}
{
dataSource
.
name
}
{
dataSource
.
isDefault
&&
<
span
className=
"btn btn-secondary btn-mini"
>
default
</
span
>
}
{
dataSource
.
isDefault
&&
<
span
className=
"btn btn-secondary btn-mini"
>
default
</
span
>
}
</
div
>
<
div
className=
"card-item-sub-name"
>
{
dataSource
.
url
}
</
div
>
</
div
>
</
div
>
<
div
className=
"card-item-sub-name"
>
{
dataSource
.
url
}
</
div
>
</
div
>
</
div
>
</
div
>
</
a
>
</
a
>
</
li
>
</
li
>
);
);
}
}
;
}
export
default
DataSourcesListItem
;
export
default
DataSourcesListItem
;
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