Commit 66d9c4f1 by Torkel Ödegaard

Fixed share dashboard feature, sharing temp feature is currently removed

parent f424abf8
...@@ -39,17 +39,11 @@ function (angular, _, moment, config, store) { ...@@ -39,17 +39,11 @@ function (angular, _, moment, config, store) {
$location.search(search); $location.search(search);
}; };
$scope.saveForSharing = function() { $scope.shareDashboard = function() {
var clone = angular.copy($scope.dashboard); $scope.appEvent('show-modal', {
clone.temp = true; src: './app/features/dashboard/partials/shareModal.html',
$scope.db.saveDashboard(clone) scope: $scope.$new(),
.then(function(result) { });
$scope.share = { url: result.url, title: result.title };
}, function(err) {
alertSrv.set('Save for sharing failed', err, 'error',5000);
});
}; };
$scope.passwordCache = function(pwd) { $scope.passwordCache = function(pwd) {
......
...@@ -24,7 +24,7 @@ function (angular, _) { ...@@ -24,7 +24,7 @@ function (angular, _) {
$scope.sharePanel = function() { $scope.sharePanel = function() {
$scope.appEvent('show-modal', { $scope.appEvent('show-modal', {
src: './app/partials/share-panel.html', src: './app/features/dashboard/partials/shareModal.html',
scope: $scope.$new() scope: $scope.$new()
}); });
}; };
......
<div ng-controller="SharePanelCtrl"> <div class="modal-body gf-box gf-box-no-margin" ng-controller="SharePanelCtrl">
<div class="modal-header"> <div class="gf-box-header">
<div class="dashboard-editor-header"> <div class="gf-box-title">
<div class="dashboard-editor-title"> <i class="fa fa-share"></i>
<i class="fa fa-share"></i> Share
Share </div>
</div>
<div ng-model="editor.index" bs-tabs style="text-transform:capitalize;"> <div ng-model="editor.index" bs-tabs style="text-transform:capitalize;">
<div ng-repeat="tab in ['Link']" data-title="{{tab}}"> <div ng-repeat="tab in ['Link']" data-title="{{tab}}">
</div>
</div> </div>
</div> </div>
</div>
<div class="modal-body"> <button class="gf-box-header-close-btn" ng-click="dismiss();">
<i class="fa fa-remove"></i>
</button>
</div>
<div class="gf-box-body">
<div class="editor-row"> <div class="editor-row">
<editor-opt-bool text="Current time range" model="forCurrent" change="buildUrl()"></editor-opt-bool> <editor-opt-bool text="Current time range" model="forCurrent" change="buildUrl()"></editor-opt-bool>
<editor-opt-bool text="To this panel only" model="toPanel" change="buildUrl()"></editor-opt-bool> <editor-opt-bool text="To this panel only" model="toPanel" change="buildUrl()"></editor-opt-bool>
...@@ -29,10 +29,7 @@ ...@@ -29,10 +29,7 @@
<div class="editor-row" style="margin-top: 20px;"> <div class="editor-row" style="margin-top: 20px;">
<a href="{{imageUrl}}" target="_blank">Link to rendered image</a> <a href="{{imageUrl}}" target="_blank">Link to rendered image</a>
</div> </div>
</div> </div>
<div class="modal-footer">
<button class="btn btn-success pull-right" ng-click="dismiss();">close</button>
</div>
</div> </div>
...@@ -12,9 +12,12 @@ function (angular, _) { ...@@ -12,9 +12,12 @@ function (angular, _) {
$scope.init = function() { $scope.init = function() {
$scope.editor = { index: 0 }; $scope.editor = { index: 0 };
$scope.forCurrent = true; $scope.forCurrent = true;
$scope.toPanel = true;
$scope.includeTemplateVars = true;
if ($scope.panel) {
$scope.toPanel = true;
}
$scope.includeTemplateVars = true;
$scope.buildUrl(); $scope.buildUrl();
}; };
...@@ -26,7 +29,6 @@ function (angular, _) { ...@@ -26,7 +29,6 @@ function (angular, _) {
baseUrl = baseUrl.substring(0, queryStart); baseUrl = baseUrl.substring(0, queryStart);
} }
var panelId = $scope.panel.id;
var params = angular.copy($location.search()); var params = angular.copy($location.search());
var range = timeSrv.timeRangeForUrl(); var range = timeSrv.timeRangeForUrl();
...@@ -50,7 +52,7 @@ function (angular, _) { ...@@ -50,7 +52,7 @@ function (angular, _) {
} }
if ($scope.toPanel) { if ($scope.toPanel) {
params.panelId = panelId; params.panelId = $scope.panel.id;
params.fullscreen = true; params.fullscreen = true;
} else { } else {
delete params.panelId; delete params.panelId;
......
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>{{share.title}} <small>shareable link</small></h3>
</div>
<div class="modal-body">
<label>Share this dashboard with this URL</label>
<input ng-model='share.url' type="text" style="width:90%" onclick="this.select()" onfocus="this.select()">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success" ng-click="dismiss();$broadcast('render')">Close</button>
</div>
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<a class="pointer" ng-click="starDashboard()"><i class="fa fa-star-o" style="color: orange;"></i></a> <a class="pointer" ng-click="starDashboard()"><i class="fa fa-star-o" style="color: orange;"></i></a>
</li> </li>
<li> <li>
<a class="pointer" ng-click="asd()"><i class="fa fa-share-square-o"></i></a> <a class="pointer" ng-click="shareDashboard()"><i class="fa fa-share-square-o"></i></a>
</li> </li>
<li> <li>
<a ng-click="saveDashboard()"><i class="fa fa-save"></i></a> <a ng-click="saveDashboard()"><i class="fa fa-save"></i></a>
...@@ -52,12 +52,6 @@ ...@@ -52,12 +52,6 @@
</grafana-simple-panel> </grafana-simple-panel>
</li> </li>
<!-- <li class="dropdown grafana&#45;menu&#45;save"> -->
<!-- <a bs&#45;tooltip="'Save'" data&#45;placement="bottom" class="dropdown&#45;toggle" data&#45;toggle="dropdown" ng&#45;click="saveDashboard()"> -->
<!-- <i class='fa fa&#45;save'></i> -->
<!-- </a> -->
<!-- </li> -->
<!-- -->
<li class="grafana-menu-stop-playlist hide"> <li class="grafana-menu-stop-playlist hide">
<a class='small' ng-click='stopPlaylist(2)'> <a class='small' ng-click='stopPlaylist(2)'>
Stop playlist Stop playlist
......
<div class="modal-body gf-box gf-box-no-margin">
<div class="gf-box-header">
<div class="gf-box-title">
<i class="fa fa-share-alt"></i>
Share dashboard
</div>
<button class="gf-box-header-close-btn" ng-click="dismiss();">
<i class="fa fa-remove"></i>
</button>
</div>
<div class="gf-box-body">
<label>Share this dashboard with this URL</label>
<input ng-model='share.url' type="text" style="width:90%" onclick="this.select()" onfocus="this.select()">
</div>
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment