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
50f24c98
Commit
50f24c98
authored
Jul 08, 2018
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip: minor progres on react panels edit mode
parent
dbe191fd
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
121 additions
and
57 deletions
+121
-57
public/app/core/config.ts
+12
-1
public/app/features/dashboard/dashgrid/PanelChrome.tsx
+2
-2
public/app/features/dashboard/dashgrid/PanelEditor.tsx
+13
-6
public/app/features/dashboard/dashgrid/VizTypePicker.tsx
+28
-13
public/app/features/dashboard/specs/AddPanelPanel.jest.tsx
+15
-0
public/app/features/panel/panel_directive.ts
+1
-1
public/app/features/plugins/plugin_component.ts
+1
-1
public/sass/components/_panel_add_panel.scss
+0
-4
public/sass/components/_tabbed_view.scss
+6
-17
public/sass/components/_viz_editor.scss
+34
-9
public/sass/pages/_dashboard.scss
+9
-3
No files found.
public/app/core/config.ts
View file @
50f24c98
...
...
@@ -7,9 +7,20 @@ export interface BuildInfo {
env
:
string
;
}
export
interface
PanelPlugin
{
id
:
string
;
name
:
string
;
meta
:
any
;
hideFromList
:
boolean
;
module
:
string
;
baseUrl
:
string
;
info
:
any
;
sort
:
number
;
}
export
class
Settings
{
datasources
:
any
;
panels
:
any
;
panels
:
PanelPlugin
[]
;
appSubUrl
:
string
;
window_title_prefix
:
string
;
buildInfo
:
BuildInfo
;
...
...
public/app/features/dashboard/dashgrid/PanelChrome.tsx
View file @
50f24c98
...
...
@@ -48,7 +48,7 @@ export class PanelChrome extends React.Component<Props, State> {
let
PanelComponent
=
this
.
panelComponent
;
return
(
<
div
className=
"panel-
height-help
er"
>
<
div
className=
"panel-
editor-contain
er"
>
<
div
className=
"panel-container"
>
<
PanelHeader
panel=
{
this
.
props
.
panel
}
dashboard=
{
this
.
props
.
dashboard
}
/>
<
div
className=
"panel-content"
style=
{
{
height
:
this
.
state
.
height
}
}
>
...
...
@@ -73,6 +73,6 @@ export class PanelChrome extends React.Component<Props, State> {
height
=
panel
.
gridPos
.
h
*
GRID_CELL_HEIGHT
+
(
panel
.
gridPos
.
h
-
1
)
*
GRID_CELL_VMARGIN
;
}
return
height
-
PANEL_BORDER
+
TITLE_HEIGHT
;
return
height
-
(
PANEL_BORDER
+
TITLE_HEIGHT
)
;
}
}
public/app/features/dashboard/dashgrid/PanelEditor.tsx
View file @
50f24c98
import
React
from
'react'
;
import
classNames
from
'classnames'
;
import
{
PanelModel
}
from
'../panel_model'
;
import
{
DashboardModel
}
from
'../dashboard_model'
;
import
{
store
}
from
'app/stores/store'
;
import
{
observer
}
from
'mobx-react'
;
import
{
QueriesTab
}
from
'./QueriesTab'
;
import
classNames
from
'classnames
'
;
import
{
Viz
Picker
}
from
'./Viz
Picker'
;
import
{
PanelPlugin
}
from
'app/core/config
'
;
import
{
Viz
TypePicker
}
from
'./VizType
Picker'
;
interface
PanelEditorProps
{
panel
:
PanelModel
;
...
...
@@ -39,16 +40,22 @@ export class PanelEditor extends React.Component<PanelEditorProps, any> {
return
(
<
div
className=
"viz-editor"
>
<
div
className=
"viz-editor-col1"
>
<
h5
className=
"section-heading"
>
Visualization Type
</
h5
>
<
VizPicker
/>
<
VizTypePicker
currentType=
{
this
.
props
.
panel
.
type
}
onTypeChanged=
{
this
.
onVizTypeChanged
}
/>
</
div
>
<
div
className=
"viz-editor-col2"
>
<
h5
className=
"
section
-heading"
>
Options
</
h5
>
<
h5
className=
"
page
-heading"
>
Options
</
h5
>
</
div
>
</
div
>
);
}
onVizTypeChanged
=
(
plugin
:
PanelPlugin
)
=>
{
this
.
props
.
panel
.
type
=
plugin
.
id
;
this
.
forceUpdate
();
console
.
log
(
'panel type changed'
,
plugin
);
};
onChangeTab
=
(
tab
:
PanelEditorTab
)
=>
{
store
.
view
.
updateQuery
({
tab
:
tab
.
id
},
false
);
};
...
...
@@ -57,7 +64,7 @@ export class PanelEditor extends React.Component<PanelEditorProps, any> {
const
activeTab
:
string
=
store
.
view
.
query
.
get
(
'tab'
)
||
'queries'
;
return
(
<
div
className=
"tabbed-view tabbed-view--
panel-edit-
new"
>
<
div
className=
"tabbed-view tabbed-view--new"
>
<
div
className=
"tabbed-view-header"
>
<
ul
className=
"gf-tabs"
>
{
this
.
tabs
.
map
(
tab
=>
{
...
...
public/app/features/dashboard/dashgrid/VizPicker.tsx
→
public/app/features/dashboard/dashgrid/Viz
Type
Picker.tsx
View file @
50f24c98
import
React
,
{
PureComponent
}
from
'react'
;
import
config
from
'app/core/config'
;
import
classNames
from
'classnames'
;
import
config
,
{
PanelPlugin
}
from
'app/core/config'
;
import
_
from
'lodash'
;
interface
Props
{}
interface
Props
{
currentType
:
string
;
onTypeChanged
:
(
newType
:
PanelPlugin
)
=>
void
;
}
interface
State
{
pluginList
:
any
[];
pluginList
:
PanelPlugin
[];
}
export
class
VizPicker
extends
PureComponent
<
Props
,
State
>
{
export
class
Viz
Type
Picker
extends
PureComponent
<
Props
,
State
>
{
constructor
(
props
)
{
super
(
props
);
...
...
@@ -27,20 +31,31 @@ export class VizPicker extends PureComponent<Props, State> {
return
_
.
sortBy
(
panels
,
'sort'
);
}
onChangeVizPlugin
=
plugin
=>
{
console
.
log
(
'set viz'
);
};
renderVizPlugin
=
(
plugin
,
index
)
=>
{
const
cssClass
=
classNames
({
'viz-picker__item'
:
true
,
'viz-picker__item--selected'
:
plugin
.
id
===
this
.
props
.
currentType
,
});
renderVizPlugin
(
plugin
,
index
)
{
return
(
<
div
key=
{
index
}
className=
"viz-picker__item"
onClick=
{
()
=>
this
.
onChangeVizPlugin
(
plugin
)
}
title=
{
plugin
.
name
}
>
<
img
className=
"viz-picker__item
__
img"
src=
{
plugin
.
info
.
logos
.
small
}
/>
<
div
className=
"viz-pi
kcer__item__
name"
>
{
plugin
.
name
}
</
div
>
<
div
key=
{
index
}
className=
{
cssClass
}
onClick=
{
()
=>
this
.
props
.
onTypeChanged
(
plugin
)
}
title=
{
plugin
.
name
}
>
<
img
className=
"viz-picker__item
-
img"
src=
{
plugin
.
info
.
logos
.
small
}
/>
<
div
className=
"viz-pi
cker__item-
name"
>
{
plugin
.
name
}
</
div
>
</
div
>
);
}
}
;
render
()
{
return
<
div
className=
"viz-picker"
>
{
this
.
state
.
pluginList
.
map
(
this
.
renderVizPlugin
)
}
</
div
>;
return
(
<
div
className=
"viz-picker"
>
<
div
className=
"gf-form gf-form--grow"
>
<
label
className=
"gf-form--has-input-icon gf-form--grow"
>
<
input
type=
"text"
className=
"gf-form-input"
placeholder=
"Search type"
/>
<
i
className=
"gf-form-input-icon fa fa-search"
/>
</
label
>
</
div
>
<
div
className=
"viz-picker-list"
>
{
this
.
state
.
pluginList
.
map
(
this
.
renderVizPlugin
)
}
</
div
>
</
div
>
);
}
}
public/app/features/dashboard/specs/AddPanelPanel.jest.tsx
View file @
50f24c98
...
...
@@ -23,6 +23,9 @@ describe('AddPanelPanel', () => {
hideFromList
:
false
,
name
:
'Singlestat'
,
sort
:
2
,
module
:
''
,
baseUrl
:
''
,
meta
:
{},
info
:
{
logos
:
{
small
:
''
,
...
...
@@ -34,6 +37,9 @@ describe('AddPanelPanel', () => {
hideFromList
:
true
,
name
:
'Hidden'
,
sort
:
100
,
meta
:
{},
module
:
''
,
baseUrl
:
''
,
info
:
{
logos
:
{
small
:
''
,
...
...
@@ -45,6 +51,9 @@ describe('AddPanelPanel', () => {
hideFromList
:
false
,
name
:
'Graph'
,
sort
:
1
,
meta
:
{},
module
:
''
,
baseUrl
:
''
,
info
:
{
logos
:
{
small
:
''
,
...
...
@@ -56,6 +65,9 @@ describe('AddPanelPanel', () => {
hideFromList
:
false
,
name
:
'Zabbix'
,
sort
:
100
,
meta
:
{},
module
:
''
,
baseUrl
:
''
,
info
:
{
logos
:
{
small
:
''
,
...
...
@@ -67,6 +79,9 @@ describe('AddPanelPanel', () => {
hideFromList
:
false
,
name
:
'Piechart'
,
sort
:
100
,
meta
:
{},
module
:
''
,
baseUrl
:
''
,
info
:
{
logos
:
{
small
:
''
,
...
...
public/app/features/panel/panel_directive.ts
View file @
50f24c98
...
...
@@ -26,7 +26,7 @@ var panelTemplate = `
</div>
<div class="panel-full-edit" ng-if="ctrl.panel.isEditing">
<div class="tabbed-view
tabbed-view--panel-edit
">
<div class="tabbed-view">
<div class="tabbed-view-header">
<h3 class="tabbed-view-panel-title">
{{ctrl.pluginName}}
...
...
public/app/features/plugins/plugin_component.ts
View file @
50f24c98
...
...
@@ -95,7 +95,7 @@ function pluginDirectiveLoader($compile, datasourceSrv, $rootScope, $q, $http, $
PanelCtrl
.
templatePromise
=
getTemplate
(
PanelCtrl
).
then
(
template
=>
{
PanelCtrl
.
templateUrl
=
null
;
PanelCtrl
.
template
=
`<grafana-panel ctrl="ctrl" class="panel-
height-help
er">
${
template
}
</grafana-panel>`
;
PanelCtrl
.
template
=
`<grafana-panel ctrl="ctrl" class="panel-
editor-contain
er">
${
template
}
</grafana-panel>`
;
return
componentInfo
;
});
...
...
public/sass/components/_panel_add_panel.scss
View file @
50f24c98
...
...
@@ -85,10 +85,6 @@
height
:
calc
(
100%
-
15px
);
}
.add-panel__item-icon
{
padding
:
2px
;
}
.add-panel__searchbar
{
width
:
100%
;
margin-bottom
:
10px
;
...
...
public/sass/components/_tabbed_view.scss
View file @
50f24c98
.tabbed-view
{
padding
:
$spacer
*
3
;
margin-bottom
:
$dashboard-padding
;
display
:
flex
;
flex-direction
:
column
;
height
:
100%
;
&
.tabbed-view--panel-edit
{
padding
:
0
;
.tabbed-view-header
{
padding
:
0px
25px
;
background
:
none
;
}
}
&
.tabbed-view--panel-edit-new
{
&
.tabbed-view--new
{
padding
:
10px
0
0
0
;
.tabbed-view-header
{
padding
:
0px
;
background
:
none
;
}
height
:
100%
;
}
}
.tabbed-view-header
{
background
:
$page-header-bg
;
box-shadow
:
$page-header-shadow
;
border-bottom
:
1px
solid
$page-header-border-color
;
@include
clearfix
();
...
...
@@ -58,6 +46,7 @@
.tabbed-view-body
{
padding
:
$spacer
*
2
$spacer
;
height
:
100%
;
&
--small
{
min-height
:
0px
;
...
...
public/sass/components/_viz_editor.scss
View file @
50f24c98
.viz-editor
{
display
:
flex
;
height
:
100%
;
}
.viz-editor-col1
{
width
:
150px
;
background
:
$panel-bg
;
width
:
240px
;
height
:
100%
;
margin-right
:
40px
;
}
.viz-editor-col2
{
...
...
@@ -12,11 +14,15 @@
}
.viz-picker
{
display
:
flex
;
flex-direction
:
column
;
}
.viz-picker-list
{
padding
:
3px
8px
;
display
:
flex
;
flex-direction
:
row
;
flex-wrap
:
wrap
;
overflow
:
auto
;
flex-direction
:
column
;
overflow
:
hidden
;
height
:
100%
;
}
...
...
@@ -25,17 +31,29 @@
box-shadow
:
$card-shadow
;
border-radius
:
3px
;
padding
:
$spacer
/
3
$spacer
;
width
:
31
%
;
padding
:
$spacer
;
width
:
100
%
;
height
:
60px
;
text-align
:
center
;
margin
:
$gf-form-margin
;
cursor
:
pointer
;
display
:
flex
;
&
.active
,
&
:hover
{
background
:
$card-background-hover
;
}
&
--selected
{
border
:
1px
solid
$orange
;
.viz-picker__item-name
{
color
:
$text-color
;
}
.viz-picker__item-img
{
filter
:
saturate
(
100%
);
}
}
}
.viz-picker__item-name
{
...
...
@@ -43,8 +61,15 @@
overflow
:
hidden
;
white-space
:
nowrap
;
font-size
:
$font-size-sm
;
display
:
flex
;
flex-direction
:
column
;
align-self
:
center
;
padding-left
:
$spacer
;
font-size
:
$font-size-md
;
color
:
$text-muted
;
}
.viz-picker__item-img
{
height
:
calc
(
100%
-
15px
);
height
:
100%
;
filter
:
saturate
(
30%
);
}
public/sass/pages/_dashboard.scss
View file @
50f24c98
.dashboard-container
{
padding
:
$dashboard-padding
;
width
:
100%
;
min-height
:
100%
;
height
:
100%
;
box-sizing
:
border-box
;
}
.template-variable
{
...
...
@@ -28,12 +29,17 @@ div.flot-text {
height
:
100%
;
}
.panel-editor-container
{
display
:
flex
;
flex-direction
:
column
;
height
:
100%
;
}
.panel-container
{
background-color
:
$panel-bg
;
border
:
$panel-border
;
position
:
relative
;
border-radius
:
3px
;
height
:
100%
;
&
.panel-transparent
{
background-color
:
transparent
;
...
...
@@ -233,5 +239,5 @@ div.flot-text {
}
.panel-full-edit
{
margin
:
$dashboard-padding
(
-
$dashboard-padding
)
0
(
-
$dashboard-padding
)
;
padding-top
:
$dashboard-padding
;
}
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