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
0f791c9f
Commit
0f791c9f
authored
Mar 29, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring of share modal
parent
ceb079a7
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
85 additions
and
105 deletions
+85
-105
public/app/features/dashboard/all.js
+1
-1
public/app/features/dashboard/dashboardNavCtrl.js
+1
-1
public/app/features/dashboard/partials/shareModal.html
+52
-33
public/app/features/dashboard/partials/sharePanel.html
+0
-65
public/app/features/dashboard/partials/snapshotTopNav.html
+6
-0
public/app/features/dashboard/shareModalCtrl.js
+13
-1
public/app/features/dashboard/shareSnapshotCtrl.js
+1
-0
public/app/features/dashboard/snapshotTopNavCtrl.js
+7
-0
public/app/features/panel/panelSrv.js
+1
-1
public/test/specs/shareModalCtrl-specs.js
+2
-2
public/test/test-main.js
+1
-1
No files found.
public/app/features/dashboard/all.js
View file @
0f791c9f
...
...
@@ -5,7 +5,7 @@ define([
'./saveDashboardAsCtrl'
,
'./playlistCtrl'
,
'./rowCtrl'
,
'./share
Pane
lCtrl'
,
'./share
Moda
lCtrl'
,
'./shareSnapshotCtrl'
,
'./submenuCtrl'
,
'./dashboardSrv'
,
...
...
public/app/features/dashboard/dashboardNavCtrl.js
View file @
0f791c9f
...
...
@@ -37,7 +37,7 @@ function (angular, _) {
$scope
.
shareDashboard
=
function
()
{
$scope
.
appEvent
(
'show-modal'
,
{
src
:
'./app/features/dashboard/partials/share
Dashboard
.html'
,
src
:
'./app/features/dashboard/partials/share
Modal
.html'
,
scope
:
$scope
.
$new
(),
});
};
...
...
public/app/features/dashboard/partials/share
Dashboard
.html
→
public/app/features/dashboard/partials/share
Modal
.html
View file @
0f791c9f
<div
class=
"modal-body gf-box gf-box-no-margin"
ng-controller=
"Share
Pane
lCtrl"
>
<div
class=
"modal-body gf-box gf-box-no-margin"
ng-controller=
"Share
Moda
lCtrl"
>
<div
class=
"gf-box-header"
>
<div
class=
"gf-box-title"
>
<i
class=
"fa fa-share
-square-o
"
></i>
Share Dashboard
<i
class=
"fa fa-share"
></i>
{{modalTitle}}
</div>
<div
ng-model=
"editor.index"
bs-tabs
style=
"text-transform:capitalize;"
>
<div
ng-repeat=
"tab in
['Link', 'Snapshot sharing']"
data-title=
"{{tab
}}"
>
<div
ng-model=
"editor.index"
bs-tabs
>
<div
ng-repeat=
"tab in
tabs"
data-title=
"{{tab.title
}}"
>
</div>
</div>
...
...
@@ -15,38 +15,58 @@
</button>
</div>
<div
class=
"gf-box-body"
ng-if=
"editor.index === 0"
>
<br>
<div
class=
"gf-form"
>
<div
class=
"gf-form-row"
>
<editor-checkbox
text=
"Current time range"
model=
"options.forCurrent"
change=
"buildUrl()"
></editor-checkbox>
</div>
</div>
<div
class=
"gf-form"
>
<div
class=
"gf-form-row"
>
<editor-checkbox
text=
"Include template variables"
model=
"options.includeTemplateVars"
change=
"buildUrl()"
></editor-checkbox>
</div>
</div>
<div
class=
"gf-box-body"
ng-repeat=
"tab in tabs"
ng-if=
"editor.index == $index"
>
<ng-include
src=
"tab.src"
></ng-include>
</div>
<br>
<div
class=
"gf-form"
>
<div
class=
"gf-form-row"
>
<button
class=
"btn btn-inverse pull-right"
data-clipboard-text=
"{{shareUrl}}"
clipboard-button
><i
class=
"fa fa-clipboard"
></i>
Copy
</button>
<span
class=
"gf-fluid-input"
>
<input
type=
"text"
data-share-panel-url
class=
"input"
ng-model=
'shareUrl'
></input>
</span>
</div>
<div>
</div>
<div
class=
"editor-row"
style=
"margin-top: 5px;"
ng-if=
"options.toPanel"
>
<a
href=
"{{imageUrl}}"
target=
"_blank"
><i
class=
"fa fa-camera"
></i>
Direct link rendered image
</a>
</div>
</div>
<script
type=
"text/ng-template"
id=
"shareEmbed.html"
>
<
h5
>
IFrame
embedding
<
/h5
>
<
p
>
<
em
>
The
html
code
below
can
be
pasted
and
included
in
another
web
page
.
Unless
anonymous
access
is
enabled
the
user
viewing
that
page
need
to
be
signed
into
grafana
for
the
graph
to
load
.
<
/em
>
<
/p
>
<
div
class
=
"gf-form"
>
<
div
class
=
"gf-form-row"
>
<
span
class
=
"gf-fluid-input"
>
<
textarea
rows
=
"5"
data
-
share
-
panel
-
url
class
=
"input"
ng
-
model
=
'iframeHtml'
><
/textarea
>
<
/span
>
<
/div
>
<
button
class
=
"btn btn-inverse"
data
-
clipboard
-
text
=
"{{iframeHtml}}"
clipboard
-
button
><
i
class
=
"fa fa-clipboard"
><
/i> Copy</
button
>
<
/div
>
</script>
<div
class=
"gf-box-body share-snapshot ng-cloak"
ng-cloak
ng-if=
"editor.index === 1"
ng-controller=
"ShareSnapshotCtrl"
>
<script
type=
"text/ng-template"
id=
"shareLink.html"
>
<
h5
>
Link
options
<
/h5
>
<
div
class
=
"gf-form"
>
<
div
class
=
"gf-form-row"
>
<
editor
-
checkbox
text
=
"Current time range"
model
=
"options.forCurrent"
change
=
"buildUrl()"
><
/editor-checkbox
>
<
/div
>
<
/div
>
<
div
class
=
"gf-form"
>
<
div
class
=
"gf-form-row"
>
<
editor
-
checkbox
text
=
"Include template variables"
model
=
"options.includeTemplateVars"
change
=
"buildUrl()"
><
/editor-checkbox
>
<
/div
>
<
/div
>
<
br
>
<
div
class
=
"gf-form"
>
<
div
class
=
"gf-form-row"
>
<
button
class
=
"btn btn-inverse pull-right"
data
-
clipboard
-
text
=
"{{shareUrl}}"
clipboard
-
button
><
i
class
=
"fa fa-clipboard"
><
/i> Copy</
button
>
<
span
class
=
"gf-fluid-input"
>
<
input
type
=
"text"
data
-
share
-
panel
-
url
class
=
"input"
ng
-
model
=
'shareUrl'
><
/input
>
<
/span
>
<
/div
>
<
div
class
=
"editor-row"
style
=
"margin-top: 5px;"
ng
-
show
=
"options.toPanel"
>
<
a
href
=
"{{imageUrl}}"
target
=
"_blank"
><
i
class
=
"fa fa-camera"
><
/i> Direct link rendered image</
a
>
<
/div
>
<
/div
>
</script>
<script
type=
"text/ng-template"
id=
"shareSnapshot.html"
>
<
div
class
=
"share-snapshot ng-cloak"
ng
-
cloak
ng
-
controller
=
"ShareSnapshotCtrl"
>
<
div
style
=
"margin: 10px 0"
>
<
i
ng
-
if
=
"loading"
class
=
"fa fa-spinner fa-spin"
><
/i
>
<
i
ng
-
if
=
"!loading"
class
=
"gf-icon gf-icon-snap-multi"
><
/i
>
...
...
@@ -118,5 +138,4 @@
Did
you
make
a
mistake
?
<
a
href
=
"{{deleteUrl}}"
target
=
"_blank"
>
delete
snapshot
.
<
/a
>
<
/div
>
<
/div
>
</div>
</script>
public/app/features/dashboard/partials/sharePanel.html
deleted
100644 → 0
View file @
ceb079a7
<div
class=
"modal-body gf-box gf-box-no-margin"
ng-controller=
"SharePanelCtrl"
>
<div
class=
"gf-box-header"
>
<div
class=
"gf-box-title"
>
<i
class=
"fa fa-share"
></i>
Share Panel
</div>
<div
ng-model=
"editor.index"
bs-tabs
style=
"text-transform:capitalize;"
>
<div
ng-repeat=
"tab in ['Link', 'Embed']"
data-title=
"{{tab}}"
>
</div>
</div>
<button
class=
"gf-box-header-close-btn"
ng-click=
"dismiss();"
>
<i
class=
"fa fa-remove"
></i>
</button>
</div>
<div
class=
"gf-box-body"
ng-if=
"editor.index === 0"
>
<br>
<div
class=
"gf-form"
>
<div
class=
"gf-form-row"
>
<editor-checkbox
text=
"Current time range"
model=
"options.forCurrent"
change=
"buildUrl()"
></editor-checkbox>
</div>
</div>
<div
class=
"gf-form"
>
<div
class=
"gf-form-row"
>
<editor-checkbox
text=
"Include template variables"
model=
"options.includeTemplateVars"
change=
"buildUrl()"
></editor-checkbox>
</div>
</div>
<br>
<div
class=
"gf-form"
>
<div
class=
"gf-form-row"
>
<button
class=
"btn btn-inverse pull-right"
data-clipboard-text=
"{{shareUrl}}"
clipboard-button
><i
class=
"fa fa-clipboard"
></i>
Copy
</button>
<span
class=
"gf-fluid-input"
>
<input
type=
"text"
data-share-panel-url
class=
"input"
ng-model=
'shareUrl'
></input>
</span>
</div>
<div>
<div
class=
"editor-row"
style=
"margin-top: 5px;"
ng-if=
"options.toPanel"
>
<a
href=
"{{imageUrl}}"
target=
"_blank"
><i
class=
"fa fa-camera"
></i>
Direct link rendered image
</a>
</div>
</div>
</div>
</div>
<div
class=
"gf-box-body"
ng-if=
"editor.index === 1"
>
<h5>
IFrame embedding
</h5>
<p><em>
The html code below can be pasted and included in another web page. Unless anonymous access
is enabled the user viewing that page need to be signed into grafana for the graph to load.
</em>
</p>
<div
class=
"gf-form"
>
<div
class=
"gf-form-row"
>
<span
class=
"gf-fluid-input"
>
<textarea
rows=
"5"
data-share-panel-url
class=
"input"
ng-model=
'iframeHtml'
></textarea>
</span>
</div>
<button
class=
"btn btn-inverse"
data-clipboard-text=
"{{iframeHtml}}"
clipboard-button
><i
class=
"fa fa-clipboard"
></i>
Copy
</button>
<br>
<br>
</div>
</div>
</div>
public/app/features/dashboard/partials/snapshotTopNav.html
View file @
0f791c9f
...
...
@@ -19,6 +19,12 @@
</div>
</div>
<ul
class=
"nav pull-left top-nav-dash-actions"
>
<li>
<a
class=
"pointer"
ng-click=
"shareDashboard()"
bs-tooltip=
"'Share dashboard'"
data-placement=
"bottom"
><i
class=
"fa fa-share-square-o"
></i></a>
</li>
</ul>
<ul
class=
"nav pull-right"
>
<li
ng-repeat=
"pulldown in dashboard.nav"
ng-controller=
"PulldownCtrl"
ng-show=
"pulldown.enable"
>
<grafana-simple-panel
type=
"pulldown.type"
ng-cloak
>
...
...
public/app/features/dashboard/share
Pane
lCtrl.js
→
public/app/features/dashboard/share
Moda
lCtrl.js
View file @
0f791c9f
...
...
@@ -9,7 +9,7 @@ function (angular, _, require, config) {
var
module
=
angular
.
module
(
'grafana.controllers'
);
module
.
controller
(
'Share
Pane
lCtrl'
,
function
(
$scope
,
$rootScope
,
$location
,
$timeout
,
timeSrv
,
$element
,
templateSrv
)
{
module
.
controller
(
'Share
Moda
lCtrl'
,
function
(
$scope
,
$rootScope
,
$location
,
$timeout
,
timeSrv
,
$element
,
templateSrv
)
{
$scope
.
init
=
function
()
{
$scope
.
editor
=
{
index
:
0
};
...
...
@@ -19,6 +19,18 @@ function (angular, _, require, config) {
includeTemplateVars
:
true
};
$scope
.
tabs
=
[{
title
:
'Link'
,
src
:
'shareLink.html'
}];
if
(
$scope
.
options
.
toPanel
)
{
$scope
.
modalTitle
=
'Share Panel'
;
$scope
.
tabs
.
push
({
title
:
'Embed'
,
src
:
'shareEmbed.html'
});
}
else
{
$scope
.
modalTitle
=
'Share Dashboard'
;
if
(
!
$scope
.
dashboardMeta
.
isSnapshot
)
{
$scope
.
tabs
.
push
({
title
:
'Snapshot sharing'
,
src
:
'shareSnapshot.html'
});
}
}
$scope
.
buildUrl
();
};
...
...
public/app/features/dashboard/shareSnapshotCtrl.js
View file @
0f791c9f
...
...
@@ -63,6 +63,7 @@ function (angular, _) {
// remove template queries
_
.
each
(
dash
.
templating
.
list
,
function
(
variable
)
{
variable
.
query
=
""
;
variable
.
options
=
[];
variable
.
refresh
=
false
;
});
...
...
public/app/features/dashboard/snapshotTopNavCtrl.js
View file @
0f791c9f
...
...
@@ -17,6 +17,13 @@ function (angular, moment) {
}
};
$scope
.
shareDashboard
=
function
()
{
$scope
.
appEvent
(
'show-modal'
,
{
src
:
'./app/features/dashboard/partials/shareModal.html'
,
scope
:
$scope
.
$new
(),
});
};
});
});
public/app/features/panel/panelSrv.js
View file @
0f791c9f
...
...
@@ -26,7 +26,7 @@ function (angular, _, config) {
$scope
.
sharePanel
=
function
()
{
$scope
.
appEvent
(
'show-modal'
,
{
src
:
'./app/features/dashboard/partials/share
Pane
l.html'
,
src
:
'./app/features/dashboard/partials/share
Moda
l.html'
,
scope
:
$scope
.
$new
()
});
};
...
...
public/test/specs/share
Pane
lCtrl-specs.js
→
public/test/specs/share
Moda
lCtrl-specs.js
View file @
0f791c9f
define
([
'helpers'
,
'features/dashboard/share
Pane
lCtrl'
'features/dashboard/share
Moda
lCtrl'
],
function
(
helpers
)
{
'use strict'
;
...
...
@@ -16,7 +16,7 @@ define([
beforeEach
(
module
(
'grafana.controllers'
));
beforeEach
(
ctx
.
providePhase
());
beforeEach
(
ctx
.
createControllerPhase
(
'Share
Pane
lCtrl'
));
beforeEach
(
ctx
.
createControllerPhase
(
'Share
Moda
lCtrl'
));
describe
(
'shareUrl with current time range and panel'
,
function
()
{
...
...
public/test/test-main.js
View file @
0f791c9f
...
...
@@ -132,7 +132,7 @@ require([
'specs/graph-specs'
,
'specs/graph-tooltip-specs'
,
'specs/seriesOverridesCtrl-specs'
,
'specs/share
Pane
lCtrl-specs'
,
'specs/share
Moda
lCtrl-specs'
,
'specs/timeSrv-specs'
,
'specs/templateSrv-specs'
,
'specs/templateValuesSrv-specs'
,
...
...
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