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
c4117145
Commit
c4117145
authored
Mar 15, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ux(): added card layout selector and list view mode, #4364
parent
82eb32a7
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
157 additions
and
21 deletions
+157
-21
public/app/core/components/layout_selector/layout_selector.ts
+74
-0
public/app/core/core.ts
+2
-0
public/app/features/plugins/partials/plugin_list.html
+5
-3
public/sass/components/_cards.scss
+76
-18
No files found.
public/app/core/components/layout_selector/layout_selector.ts
0 → 100644
View file @
c4117145
///<reference path="../../../headers/common.d.ts" />
import
config
from
'app/core/config'
;
import
store
from
'app/core/store'
;
import
_
from
'lodash'
;
import
$
from
'jquery'
;
import
coreModule
from
'app/core/core_module'
;
var
template
=
`
<div class="layout-selector">
<button ng-click="ctrl.listView()" ng-class="{active: ctrl.mode === 'list'}">
<i class="fa fa-list"></i>
</button>
<button ng-click="ctrl.gridView()" ng-class="{active: ctrl.mode === 'grid'}">
<i class="fa fa-th"></i>
</button>
</div>
`
;
export
class
LayoutSelectorCtrl
{
mode
:
string
;
/** @ngInject **/
constructor
(
private
$rootScope
)
{
this
.
mode
=
store
.
get
(
'grafana.list.layout.mode'
)
||
'grid'
;
}
listView
()
{
this
.
mode
=
'list'
;
store
.
set
(
'grafana.list.layout.mode'
,
'list'
);
this
.
$rootScope
.
appEvent
(
'layout-mode-changed'
,
'list'
);
}
gridView
()
{
this
.
mode
=
'grid'
;
store
.
set
(
'grafana.list.layout.mode'
,
'grid'
);
this
.
$rootScope
.
appEvent
(
'layout-mode-changed'
,
'grid'
);
}
}
/** @ngInject **/
export
function
layoutSelector
()
{
return
{
restrict
:
'E'
,
controller
:
LayoutSelectorCtrl
,
bindToController
:
true
,
controllerAs
:
'ctrl'
,
scope
:
{},
template
:
template
,
};
}
/** @ngInject **/
export
function
layoutMode
(
$rootScope
)
{
return
{
restrict
:
'A'
,
scope
:
{},
link
:
function
(
scope
,
elem
)
{
var
layout
=
store
.
get
(
'grafana.list.layout.mode'
)
||
'grid'
;
var
className
=
'card-list-layout-'
+
layout
;
elem
.
addClass
(
className
);
$rootScope
.
onAppEvent
(
'layout-mode-changed'
,
(
evt
,
newLayout
)
=>
{
elem
.
removeClass
(
className
);
className
=
'card-list-layout-'
+
newLayout
;
elem
.
addClass
(
className
);
},
scope
);
}
};
}
coreModule
.
directive
(
'layoutSelector'
,
layoutSelector
);
coreModule
.
directive
(
'layoutMode'
,
layoutMode
);
public/app/core/core.ts
View file @
c4117145
...
...
@@ -28,6 +28,7 @@ import {infoPopover} from './components/info_popover';
import
{
colorPicker
}
from
'./components/colorpicker'
;
import
{
navbarDirective
}
from
'./components/navbar/navbar'
;
import
{
arrayJoin
}
from
'./directives/array_join'
;
import
{
layoutSelector
}
from
'./components/layout_selector/layout_selector'
;
import
'app/core/controllers/all'
;
import
'app/core/services/all'
;
import
'app/core/routes/routes'
;
...
...
@@ -42,5 +43,6 @@ export {
navbarDirective
,
searchDirective
,
colorPicker
,
layoutSelector
,
infoPopover
};
public/app/features/plugins/partials/plugin_list.html
View file @
c4117145
...
...
@@ -26,8 +26,10 @@
</div>
</div>
<section
class=
"card-section"
>
<ol
class=
"card-list"
>
<section
class=
"card-section"
layout-mode
>
<layout-selector></layout-selector>
<ol
class=
"card-list"
>
<li
class=
"card-item-wrapper"
ng-repeat=
"plugin in ctrl.plugins"
>
<a
class=
"card-item"
href=
"plugins/{{plugin.id}}/edit"
>
<div
class=
"card-item-header"
>
...
...
@@ -36,7 +38,7 @@
</div>
<div
class=
"card-item-body"
>
<figure
class=
"card-item-figure"
>
<img
src=
"{{plugin.info.logos.small}}"
>
<img
ng-
src=
"{{plugin.info.logos.small}}"
>
</figure>
<div
class=
"card-item-details"
>
<div
class=
"card-item-name"
href=
"plugins/{{plugin.id}}/edit"
>
{{plugin.name}}
</div>
...
...
public/sass/components/_cards.scss
View file @
c4117145
.layout-selector
{
text-align
:
right
;
margin
:
0
$spacer
*
1
.5
$spacer
;
position
:
relative
;
top
:
-0
.5rem
;
button
{
background
:
$input-label-bg
;
color
:
$text-color-weak
;
border
:
none
;
padding
:
0
.5rem
;
line-height
:
1
;
font-size
:
130%
;
&
:focus
{
outline
:
none
;
}
&
.active
{
background-color
:
lighten
(
$input-label-bg
,
5%
);
color
:
$link-color
;
}
}
}
.card-section
{
margin-bottom
:
$spacer
*
2
;
...
...
@@ -11,15 +34,9 @@
list-style-type
:
none
;
}
.card-item-wrapper
{
width
:
100%
;
padding
:
0
1
.5rem
1
.5rem
0rem
;
}
.card-item
{
display
:
block
;
height
:
100%
;
min-height
:
12rem
;
background
:
$card-background
;
box-shadow
:
$card-shadow
;
padding
:
1rem
;
...
...
@@ -30,13 +47,6 @@
}
}
.card-item-figure
{
margin
:
0
$spacer
$spacer
0
;
img
{
width
:
6rem
;
}
}
.card-item-body
{
display
:
flex
;
}
...
...
@@ -51,23 +61,71 @@
.card-item-name
{
color
:
$headings-color
;
font-size
:
$font-size-h3
;
}
.card-item-sub-name
{
color
:
$text-color-weak
;
}
@include
media-breakpoint-up
(
md
)
{
.card-list-layout-grid
{
.card-item-wrapper
{
width
:
100%
;
padding
:
0
1
.5rem
1
.5rem
0rem
;
}
.card-item-figure
{
margin
:
0
$spacer
$spacer
0
;
img
{
width
:
6rem
;
}
}
.card-item-name
{
font-size
:
$font-size-h3
;
}
@include
media-breakpoint-up
(
md
)
{
.card-item-wrapper
{
width
:
50%
;
}
}
}
@include
media-breakpoint-up
(
lg
)
{
@include
media-breakpoint-up
(
lg
)
{
.card-item-wrapper
{
width
:
33%
;
width
:
33
.333333%
;
}
}
}
.card-list-layout-list
{
.card-item-wrapper
{
width
:
100%
;
padding
:
0
0
1
.5rem
0rem
;
}
.card-item-header
{
float
:
right
;
}
.card-item-figure
{
margin
:
0
$spacer
0
0
;
img
{
width
:
3
.5rem
;
}
}
.card-item-name
{
font-size
:
$font-size-h4
;
}
.card-item-sub-name
{
font-size
:
$font-size-sm
;
}
.layout-selector
{
margin-right
:
0
;
}
}
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