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
7559982b
Commit
7559982b
authored
Oct 25, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
grid: minor changes
parent
a299118c
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
229 additions
and
24 deletions
+229
-24
public/app/features/dashboard/dashgrid/DashboardRow.tsx
+2
-1
public/app/features/dashboard/dashnav/dashnav.html
+6
-5
public/app/features/dashboard/partials/row_options.html
+4
-2
public/app/features/dashboard/specs/dashboard_model.jest.ts
+0
-0
public/app/features/dashboard/specs/repeat.jest.ts
+206
-0
public/app/features/panel/metrics_panel_ctrl.ts
+1
-1
public/app/features/panel/panel_directive.ts
+0
-1
public/sass/components/_navbar.scss
+10
-14
No files found.
public/app/features/dashboard/dashgrid/DashboardRow.tsx
View file @
7559982b
...
...
@@ -48,7 +48,7 @@ export class DashboardRow extends React.Component<DashboardRowProps, any> {
let
text2
=
''
;
if
(
this
.
props
.
panel
.
panels
.
length
)
{
text2
=
`This will also remove
row's
${
this
.
props
.
panel
.
panels
.
length
}
hidden
panels`
;
text2
=
`This will also remove
the row's
${
this
.
props
.
panel
.
panels
.
length
}
panels`
;
}
appEvents
.
emit
(
'confirm-modal'
,
{
...
...
@@ -71,6 +71,7 @@ export class DashboardRow extends React.Component<DashboardRowProps, any> {
'fa-chevron-down'
:
!
this
.
state
.
collapsed
,
'fa-chevron-right'
:
this
.
state
.
collapsed
,
});
const
hiddenPanels
=
this
.
props
.
panel
.
panels
?
this
.
props
.
panel
.
panels
.
length
:
0
;
return
(
...
...
public/app/features/dashboard/dashnav/dashnav.html
View file @
7559982b
<div
class=
"navbar"
>
<div
class=
"navbar-inner"
>
<a
class=
"navbar-page-icon"
ng-click=
"ctrl.starDashboard()"
bs-tooltip=
"'Mark as favorite'"
data-placement=
"bottom"
>
<i
class=
"fa"
ng-class=
"{'fa-star-o': !ctrl.dashboard.meta.isStarred, 'fa-star': ctrl.dashboard.meta.isStarred}"
></i>
<!-- <i class="gicon gicon-dashboard-starred"></i> -->
</a>
<a
class=
"navbar-page-btn"
ng-click=
"ctrl.showSearch()"
>
<i
class=
"gicon gicon-dashboard"
></i>
{{ctrl.dashboard.title}}
<i
class=
"fa fa-caret-down"
></i>
</a>
...
...
@@ -23,6 +19,11 @@
</ul>
<ul
class=
"nav dashnav-action-icons"
>
<li
ng-show=
"::ctrl.dashboard.meta.canStar"
>
<a
class=
"pointer"
ng-click=
"ctrl.starDashboard()"
>
<i
class=
"fa"
ng-class=
"{'fa-star-o': !ctrl.dashboard.meta.isStarred, 'fa-star': ctrl.dashboard.meta.isStarred}"
></i>
</a>
</li>
<li
ng-show=
"::ctrl.dashboard.meta.canShare"
class=
"dropdown"
>
<a
class=
"pointer"
ng-click=
"ctrl.hideTooltip($event)"
bs-tooltip=
"'Share dashboard'"
data-placement=
"bottom"
data-toggle=
"dropdown"
><i
class=
"fa fa-share-square-o"
></i></a>
<ul
class=
"dropdown-menu"
>
...
...
public/app/features/dashboard/partials/row_options.html
View file @
7559982b
...
...
@@ -10,7 +10,8 @@
</a>
</div>
<form
name=
"ctrl.saveForm"
ng-submit=
"ctrl.save()"
class=
"modal-content"
novalidate
>
<form
name=
"ctrl.saveForm"
ng-submit=
"ctrl.save()"
class=
"modal-content text-center"
novalidate
>
<div
class=
"section"
>
<div
class=
"gf-form"
>
<span
class=
"gf-form-label width-7"
>
Title
</span>
<input
type=
"text"
class=
"gf-form-input max-width-13"
ng-model=
'ctrl.row.title'
></input>
...
...
@@ -21,9 +22,10 @@
</div>
<div
class=
"gf-form-button-row"
>
<button
type=
"button
"
class=
"btn btn-success"
ng-click=
"ctrl.update()"
>
Update
</button>
<button
type=
"submit
"
class=
"btn btn-success"
ng-click=
"ctrl.update()"
>
Update
</button>
<button
type=
"button"
class=
"btn btn-danger"
ng-click=
"ctrl.delete()"
>
Remove
</button>
<button
type=
"button"
class=
"btn btn-inverse"
ng-click=
"ctrl.dismiss()"
>
Cancel
</button>
</div>
</div>
</form>
</div>
public/app/features/dashboard/specs/dashboard_model.jest.ts
View file @
7559982b
This diff is collapsed.
Click to expand it.
public/app/features/dashboard/specs/repeat.jest.ts
0 → 100644
View file @
7559982b
import
{
DashboardModel
}
from
'../dashboard_model'
;
jest
.
mock
(
'app/core/services/context_srv'
,
()
=>
({
}));
describe
(
'given dashboard with panel repeat in horizontal direction'
,
function
()
{
var
dashboard
;
beforeEach
(
function
()
{
dashboard
=
new
DashboardModel
({
panels
:
[{
id
:
2
,
repeat
:
'apps'
,
repeatDirection
:
'h'
,
gridPos
:
{
x
:
0
,
y
:
0
,
h
:
2
,
w
:
24
}}],
templating
:
{
list
:
[{
name
:
'apps'
,
current
:
{
text
:
'se1, se2, se3'
,
value
:
[
'se1'
,
'se2'
,
'se3'
]
},
options
:
[
{
text
:
'se1'
,
value
:
'se1'
,
selected
:
true
},
{
text
:
'se2'
,
value
:
'se2'
,
selected
:
true
},
{
text
:
'se3'
,
value
:
'se3'
,
selected
:
true
},
{
text
:
'se4'
,
value
:
'se4'
,
selected
:
false
}
]
}]
}
});
dashboard
.
processRepeats
();
});
it
(
'should repeat panel 3 times'
,
function
()
{
expect
(
dashboard
.
panels
.
length
).
toBe
(
3
);
});
it
(
'should mark panel repeated'
,
function
()
{
expect
(
dashboard
.
panels
[
0
].
repeat
).
toBe
(
'apps'
);
expect
(
dashboard
.
panels
[
1
].
repeatPanelId
).
toBe
(
2
);
});
it
(
'should set scopedVars on panels'
,
function
()
{
expect
(
dashboard
.
panels
[
0
].
scopedVars
.
apps
.
value
).
toBe
(
'se1'
);
expect
(
dashboard
.
panels
[
1
].
scopedVars
.
apps
.
value
).
toBe
(
'se2'
);
expect
(
dashboard
.
panels
[
2
].
scopedVars
.
apps
.
value
).
toBe
(
'se3'
);
});
it
(
'should place on first row and adjust width so all fit'
,
function
()
{
expect
(
dashboard
.
panels
[
0
].
gridPos
).
toMatchObject
({
x
:
0
,
y
:
0
,
h
:
2
,
w
:
8
});
expect
(
dashboard
.
panels
[
1
].
gridPos
).
toMatchObject
({
x
:
8
,
y
:
0
,
h
:
2
,
w
:
8
});
expect
(
dashboard
.
panels
[
2
].
gridPos
).
toMatchObject
({
x
:
16
,
y
:
0
,
h
:
2
,
w
:
8
});
});
describe
(
'After a second iteration'
,
function
()
{
var
repeatedPanelAfterIteration1
;
beforeEach
(
function
()
{
repeatedPanelAfterIteration1
=
dashboard
.
panels
[
1
];
dashboard
.
panels
[
0
].
fill
=
10
;
dashboard
.
processRepeats
();
});
it
(
'reused panel should copy properties from source'
,
function
()
{
expect
(
dashboard
.
panels
[
1
].
fill
).
toBe
(
10
);
});
it
(
'should have same panel count'
,
function
()
{
expect
(
dashboard
.
panels
.
length
).
toBe
(
3
);
});
});
describe
(
'After a second iteration with different variable'
,
function
()
{
beforeEach
(
function
()
{
dashboard
.
templating
.
list
.
push
({
name
:
'server'
,
current
:
{
text
:
'se1, se2, se3'
,
value
:
[
'se1'
]},
options
:
[{
text
:
'se1'
,
value
:
'se1'
,
selected
:
true
}]
});
dashboard
.
panels
[
0
].
repeat
=
"server"
;
dashboard
.
processRepeats
();
});
it
(
'should remove scopedVars value for last variable'
,
function
()
{
expect
(
dashboard
.
panels
[
0
].
scopedVars
.
apps
).
toBe
(
undefined
);
});
it
(
'should have new variable value in scopedVars'
,
function
()
{
expect
(
dashboard
.
panels
[
0
].
scopedVars
.
server
.
value
).
toBe
(
"se1"
);
});
});
describe
(
'After a second iteration and selected values reduced'
,
function
()
{
beforeEach
(
function
()
{
dashboard
.
templating
.
list
[
0
].
options
[
1
].
selected
=
false
;
dashboard
.
processRepeats
();
});
it
(
'should clean up repeated panel'
,
function
()
{
expect
(
dashboard
.
panels
.
length
).
toBe
(
2
);
});
});
describe
(
'After a second iteration and panel repeat is turned off'
,
function
()
{
beforeEach
(
function
()
{
dashboard
.
panels
[
0
].
repeat
=
null
;
dashboard
.
processRepeats
();
});
it
(
'should clean up repeated panel'
,
function
()
{
expect
(
dashboard
.
panels
.
length
).
toBe
(
1
);
});
it
(
'should remove scoped vars from reused panel'
,
function
()
{
expect
(
dashboard
.
panels
[
0
].
scopedVars
).
toBe
(
undefined
);
});
});
});
describe
(
'given dashboard with panel repeat in vertical direction'
,
function
()
{
var
dashboard
;
beforeEach
(
function
()
{
dashboard
=
new
DashboardModel
({
panels
:
[{
id
:
2
,
repeat
:
'apps'
,
repeatDirection
:
'v'
,
gridPos
:
{
x
:
5
,
y
:
0
,
h
:
2
,
w
:
8
}}],
templating
:
{
list
:
[{
name
:
'apps'
,
current
:
{
text
:
'se1, se2, se3'
,
value
:
[
'se1'
,
'se2'
,
'se3'
]
},
options
:
[
{
text
:
'se1'
,
value
:
'se1'
,
selected
:
true
},
{
text
:
'se2'
,
value
:
'se2'
,
selected
:
true
},
{
text
:
'se3'
,
value
:
'se3'
,
selected
:
true
},
{
text
:
'se4'
,
value
:
'se4'
,
selected
:
false
}
]
}]
}
});
dashboard
.
processRepeats
();
});
it
(
'should place on items on top of each other and keep witdh'
,
function
()
{
expect
(
dashboard
.
panels
[
0
].
gridPos
).
toMatchObject
({
x
:
5
,
y
:
0
,
h
:
2
,
w
:
8
});
expect
(
dashboard
.
panels
[
1
].
gridPos
).
toMatchObject
({
x
:
5
,
y
:
2
,
h
:
2
,
w
:
8
});
expect
(
dashboard
.
panels
[
2
].
gridPos
).
toMatchObject
({
x
:
5
,
y
:
4
,
h
:
2
,
w
:
8
});
});
});
describe
(
'given dashboard with row repeat'
,
function
()
{
var
dashboard
;
beforeEach
(
function
()
{
dashboard
=
new
DashboardModel
({
panels
:
[
{
id
:
1
,
type
:
'row'
,
repeat
:
'apps'
,
gridPos
:
{
x
:
0
,
y
:
0
,
h
:
1
,
w
:
24
}},
{
id
:
2
,
type
:
'graph'
,
gridPos
:
{
x
:
0
,
y
:
1
,
h
:
1
,
w
:
6
}},
{
id
:
3
,
type
:
'graph'
,
gridPos
:
{
x
:
6
,
y
:
1
,
h
:
1
,
w
:
6
}},
{
id
:
4
,
type
:
'row'
,
gridPos
:
{
x
:
0
,
y
:
2
,
h
:
1
,
w
:
24
}},
{
id
:
5
,
type
:
'graph'
,
gridPos
:
{
x
:
0
,
y
:
3
,
h
:
1
,
w
:
12
}},
],
templating
:
{
list
:
[{
name
:
'apps'
,
current
:
{
text
:
'se1, se2'
,
value
:
[
'se1'
,
'se2'
]
},
options
:
[
{
text
:
'se1'
,
value
:
'se1'
,
selected
:
true
},
{
text
:
'se2'
,
value
:
'se2'
,
selected
:
true
},
{
text
:
'se3'
,
value
:
'se3'
,
selected
:
false
}
]
}]
}
});
dashboard
.
processRepeats
();
});
// it('should not repeat only row', function() {
// expect(dashboard.panels[1].type).toBe('graph')
// });
//
// it('should set scopedVars on panels', function() {
// expect(dashboard.panels[1].scopedVars).toMatchObject({apps: {text: 'se1', value: 'se1'}})
// });
//
// it.skip('should repeat row and panels below two times', function() {
// expect(dashboard.panels).toMatchObject([
// // first (original row)
// {id: 1, type: 'row', repeat: 'apps', gridPos: {x: 0, y: 0, h: 1 , w: 24}},
// {id: 2, type: 'graph', gridPos: {x: 0, y: 1, h: 1 , w: 6}},
// {id: 3, type: 'graph', gridPos: {x: 6, y: 1, h: 1 , w: 6}},
// // repeated row
// {id: 1, type: 'row', repeatPanelId: 1, gridPos: {x: 0, y: 0, h: 1 , w: 24}},
// {id: 2, type: 'graph', repeatPanelId: 1, gridPos: {x: 0, y: 1, h: 1 , w: 6}},
// {id: 3, type: 'graph', repeatPanelId: 1, gridPos: {x: 6, y: 1, h: 1 , w: 6}},
// // row below dont touch
// {id: 4, type: 'row', gridPos: {x: 0, y: 2, h: 1 , w: 24}},
// {id: 5, type: 'graph', gridPos: {x: 0, y: 3, h: 1 , w: 12}},
// ]);
// });
});
public/app/features/panel/metrics_panel_ctrl.ts
View file @
7559982b
...
...
@@ -139,7 +139,7 @@ class MetricsPanelCtrl extends PanelCtrl {
if
(
this
.
panel
.
maxDataPoints
)
{
this
.
resolution
=
this
.
panel
.
maxDataPoints
;
}
else
{
this
.
resolution
=
Math
.
ceil
(
$
(
window
).
width
()
*
(
this
.
panel
.
span
/
12
));
this
.
resolution
=
Math
.
ceil
(
$
(
window
).
width
()
*
(
this
.
panel
.
gridPos
.
w
/
24
));
}
this
.
calculateInterval
();
...
...
public/app/features/panel/panel_directive.ts
View file @
7559982b
...
...
@@ -98,7 +98,6 @@ module.directive('grafanaPanel', function($rootScope, $document) {
}
ctrl
.
events
.
on
(
'render'
,
()
=>
{
console
.
log
(
'panelDirective::render!'
);
if
(
lastHeight
!==
ctrl
.
containerHeight
)
{
panelContainer
.
css
({
minHeight
:
ctrl
.
containerHeight
});
lastHeight
=
ctrl
.
containerHeight
;
...
...
public/sass/components/_navbar.scss
View file @
7559982b
...
...
@@ -18,7 +18,7 @@
.sidemenu-open
{
.navbar
{
padding-left
:
$panel-margin
;
padding-left
:
15px
;
}
}
...
...
@@ -63,19 +63,6 @@
background-color
:
$navbarLinkBackgroundActive
;
}
.navbar-page-icon
{
font-size
:
$font-size-lg
;
padding
:
1rem
0rem
0
.75rem
1rem
;
min-height
:
$navbarHeight
;
.gicon
{
position
:
relative
;
top
:
-1px
;
font-size
:
20px
;
line-height
:
8px
;
}
}
.navbar-page-btn
{
text-overflow
:
ellipsis
;
overflow
:
hidden
;
...
...
@@ -95,6 +82,15 @@
&
--search
{
padding
:
1rem
1
.5rem
0
.75rem
1
.5rem
;
}
.gicon
{
position
:
relative
;
top
:
-1px
;
font-size
:
19px
;
line-height
:
8px
;
opacity
:
0
.75
;
margin-right
:
8px
;
}
}
.navbar-page-btn-wrapper
{
...
...
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