mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Share modal: Override UI theme via URL param for Share link, rendered panel, or embedded panel, Closes #1701
This commit is contained in:
@@ -16,19 +16,25 @@
|
||||
</div>
|
||||
|
||||
<div class="gf-box-body" ng-repeat="tab in tabs" ng-if="editor.index == $index">
|
||||
<ng-include src="tab.src"></ng-include>
|
||||
<div ng-include src="tab.src" class="share-modal-body"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/ng-template" id="shareEmbed.html">
|
||||
<h5>IFrame embedding</h5>
|
||||
<p>
|
||||
<em>
|
||||
<div class="share-modal-big-icon">
|
||||
<i class="fa fa-code"></i>
|
||||
</div>
|
||||
|
||||
<div class="share-snapshot-header">
|
||||
<p class="share-snapshot-info-text">
|
||||
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>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div ng-include src="'shareLinkOptions.html'"></div>
|
||||
|
||||
<div class="gf-form">
|
||||
<div class="gf-form-row">
|
||||
<span class="gf-fluid-input">
|
||||
@@ -39,19 +45,54 @@
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/ng-template" id="shareLinkOptions.html">
|
||||
<div class="editor-row" style="margin: 11px 20px 33px 20px">
|
||||
<div class="section">
|
||||
<div class="tight-form">
|
||||
<ul class="tight-form-list">
|
||||
<li class="tight-form-item" style="width: 170px;">
|
||||
<label class="checkbox-label" for="options.forCurrent">Current time range</label>
|
||||
</li>
|
||||
<li class="tight-form-item last">
|
||||
<input class="cr1" id="options.forCurrent" type="checkbox" ng-model="options.forCurrent" ng-checked="options.forCurrent" ng-change="buildUrl()">
|
||||
<label for="options.forCurrent" class="cr1"></label>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="tight-form">
|
||||
<ul class="tight-form-list">
|
||||
<li class="tight-form-item" style="width: 170px">
|
||||
<label class="checkbox-label" for="options.includeTemplateVars">Include template variables</label>
|
||||
</li>
|
||||
<li class="tight-form-item last">
|
||||
<input class="cr1" id="options.includeTemplateVars" type="checkbox" ng-model="options.includeTemplateVars" ng-checked="options.includeTemplateVars" ng-change="buildUrl()">
|
||||
<label for="options.includeTemplateVars" class="cr1"></label>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="tight-form">
|
||||
<ul class="tight-form-list">
|
||||
<li class="tight-form-item" style="width: 170px">
|
||||
Theme
|
||||
</li>
|
||||
<li>
|
||||
<select class="input-small tight-form-input last" style="width: 211px" ng-model="options.theme" ng-options="f as f for f in ['current', 'dark', 'light']" ng-change="buildUrl()"></select>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<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 class="share-modal-big-icon">
|
||||
<i class="fa fa-external-link"></i>
|
||||
</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 ng-include src="'shareLinkOptions.html'"></div>
|
||||
<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>
|
||||
@@ -66,8 +107,8 @@
|
||||
</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">
|
||||
<div class="ng-cloak" ng-cloak ng-controller="ShareSnapshotCtrl">
|
||||
<div class="share-modal-big-icon">
|
||||
<i ng-if="loading" class="fa fa-spinner fa-spin"></i>
|
||||
<i ng-if="!loading" class="gf-icon gf-icon-snap-multi"></i>
|
||||
</div>
|
||||
@@ -91,7 +132,7 @@
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="editor-row" style="margin: 11px 20px 33px 20px">
|
||||
<div class="editor-row share-modal-options" style="">
|
||||
<div class="section" ng-if="step === 1">
|
||||
<div class="tight-form">
|
||||
<ul class="tight-form-list">
|
||||
|
||||
@@ -10,10 +10,10 @@ function (angular, _, require, config) {
|
||||
var module = angular.module('grafana.controllers');
|
||||
|
||||
module.controller('ShareModalCtrl', function($scope, $rootScope, $location, $timeout, timeSrv, $element, templateSrv) {
|
||||
$scope.options = { forCurrent: true, includeTemplateVars: true, theme: 'current' };
|
||||
$scope.editor = { index: 0 };
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.editor = { index: 0 };
|
||||
$scope.options = { forCurrent: true, includeTemplateVars: true };
|
||||
$scope.modeSharePanel = $scope.panel ? true : false;
|
||||
|
||||
$scope.tabs = [{title: 'Link', src: 'shareLink.html'}];
|
||||
@@ -62,6 +62,10 @@ function (angular, _, require, config) {
|
||||
delete params.to;
|
||||
}
|
||||
|
||||
if ($scope.options.theme !== 'current') {
|
||||
params.theme = $scope.options.theme;
|
||||
}
|
||||
|
||||
if ($scope.modeSharePanel) {
|
||||
params.panelId = $scope.panel.id;
|
||||
params.fullscreen = true;
|
||||
|
||||
Reference in New Issue
Block a user