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
7161b2dc
Commit
7161b2dc
authored
Dec 12, 2018
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip
parent
8497c854
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
109 additions
and
18 deletions
+109
-18
public/app/core/components/Picker/Select.tsx
+60
-0
public/app/features/dashboard/dashgrid/VisualizationTab.tsx
+47
-11
public/app/features/dashboard/dashgrid/VizTypePicker.tsx
+0
-3
public/sass/components/_form_select_box.scss
+2
-4
No files found.
public/app/core/components/Picker/Select.tsx
0 → 100644
View file @
7161b2dc
// import React, { PureComponent } from 'react';
// import Select as ReactSelect from 'react-select';
// import DescriptionOption from './DescriptionOption';
// import IndicatorsContainer from './IndicatorsContainer';
// import ResetStyles from './ResetStyles';
//
// export interface OptionType {
// label: string;
// value: string;
// }
//
// interface Props {
// defaultValue?: any;
// getOptionLabel: (item: T) => string;
// getOptionValue: (item: T) => string;
// onChange: (item: T) => {} | void;
// options: T[];
// placeholder?: string;
// width?: number;
// value: T;
// className?: string;
// }
//
// export class Select<T> extends PureComponent<Props<T>> {
// static defaultProps = {
// width: null,
// className: '',
// }
//
// render() {
// const { defaultValue, getOptionLabel, getOptionValue, onSelected, options, placeholder, width, value, className } = this.props;
// let widthClass = '';
// if (width) {
// widthClass = 'width-'+width;
// }
//
// return (
// <ReactSelect
// classNamePrefix="gf-form-select-box"
// className={`gf-form-input gf-form-input--form-dropdown ${widthClass} ${className}`}
// components={{
// Option: DescriptionOption,
// IndicatorsContainer,
// }}
// defaultValue={defaultValue}
// value={value}
// getOptionLabel={getOptionLabel}
// getOptionValue={getOptionValue}
// menuShouldScrollIntoView={false}
// isSearchable={false}
// onChange={onSelected}
// options={options}
// placeholder={placeholder || 'Choose'}
// styles={ResetStyles}
// />
// );
// }
// }
//
// export default Select;
public/app/features/dashboard/dashgrid/VisualizationTab.tsx
View file @
7161b2dc
...
...
@@ -21,9 +21,23 @@ interface Props {
onTypeChanged
:
(
newType
:
PanelPlugin
)
=>
void
;
}
export
class
VisualizationTab
extends
PureComponent
<
Props
>
{
interface
State
{
isVizPickerOpen
:
boolean
;
searchQuery
:
string
;
}
export
class
VisualizationTab
extends
PureComponent
<
Props
,
State
>
{
element
:
HTMLElement
;
angularOptions
:
AngularComponent
;
searchInput
:
HTMLElement
;
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
isVizPickerOpen
:
false
,
};
}
getPanelDefaultOptions
=
()
=>
{
const
{
panel
,
plugin
}
=
this
.
props
;
...
...
@@ -120,19 +134,40 @@ export class VisualizationTab extends PureComponent<Props> {
this
.
forceUpdate
();
};
render
()
{
onOpenVizPicker
=
()
=>
{
this
.
setState
({
isVizPickerOpen
:
true
});
};
renderToolbar
=
()
=>
{
const
{
plugin
}
=
this
.
props
;
const
panelSelection
=
{
title
:
plugin
.
name
,
imgSrc
:
plugin
.
info
.
logos
.
small
,
render
:
()
=>
{
// the needs to be scoped inside this closure
const
{
plugin
,
onTypeChanged
}
=
this
.
props
;
return
<
VizTypePicker
current=
{
plugin
}
onTypeChanged=
{
onTypeChanged
}
/>;
},
if
(
this
.
state
.
isVizPickerOpen
)
{
return
(
<
label
className=
"gf-form--has-input-icon"
>
<
input
type=
"text"
className=
"gf-form-input width-13"
placeholder=
""
ref=
{
elem
=>
(
this
.
searchInput
=
elem
)
}
/>
<
i
className=
"gf-form-input-icon fa fa-search"
/>
</
label
>
);
}
else
{
return
(
<
div
className=
"toolbar__main"
onClick=
{
this
.
onOpenVizPicker
}
>
<
img
className=
"toolbar__main-image"
src=
{
plugin
.
info
.
logos
.
small
}
/>
<
div
className=
"toolbar__main-name"
>
{
plugin
.
name
}
</
div
>
<
i
className=
"fa fa-caret-down"
/>
</
div
>
);
}
};
render
()
{
const
{
plugin
,
onTypeChanged
}
=
this
.
props
;
const
{
isVizPickerOpen
}
=
this
.
state
;
const
panelHelp
=
{
title
:
''
,
icon
:
'fa fa-question'
,
...
...
@@ -140,7 +175,8 @@ export class VisualizationTab extends PureComponent<Props> {
};
return
(
<
EditorTabBody
heading=
"Visualization"
main=
{
panelSelection
}
toolbarItems=
{
[
panelHelp
]
}
>
<
EditorTabBody
heading=
"Visualization"
renderToolbar=
{
this
.
renderToolbar
}
toolbarItems=
{
[
panelHelp
]
}
>
{
isVizPickerOpen
&&
<
VizTypePicker
current=
{
plugin
}
onTypeChanged=
{
onTypeChanged
}
/>
}
{
this
.
renderPanelOptions
()
}
</
EditorTabBody
>
);
...
...
public/app/features/dashboard/dashgrid/VizTypePicker.tsx
View file @
7161b2dc
...
...
@@ -9,9 +9,6 @@ import KeyboardNavigation, { KeyboardNavigationProps } from './KeyboardNavigatio
export
interface
Props
{
current
:
PanelPlugin
;
onTypeChanged
:
(
newType
:
PanelPlugin
)
=>
void
;
}
interface
State
{
searchQuery
:
string
;
}
...
...
public/sass/components/_form_select_box.scss
View file @
7161b2dc
...
...
@@ -54,6 +54,7 @@ $select-input-bg-disabled: $input-bg-disabled;
.gf-form-select-box__menu
{
background
:
$input-bg
;
box-shadow
:
$menu-dropdown-shadow
;
position
:
absolute
;
z-index
:
2
;
min-width
:
100%
;
...
...
@@ -81,7 +82,7 @@ $select-input-bg-disabled: $input-bg-disabled;
&
.gf-form-select-box__option--is-focused
{
color
:
$dropdownLinkColorHover
;
background
-color
:
$dropdownLinkBackgroundHover
;
background
:
$menu-dropdown-hover-bg
;
@include
left-brand-border-gradient
();
}
...
...
@@ -96,9 +97,6 @@ $select-input-bg-disabled: $input-bg-disabled;
display
:
none
;
}
.gf-form-select-box__option
{
}
.gf-form-select-box__value-container
{
display
:
table-cell
;
padding
:
8px
10px
;
...
...
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