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) {
$location.search(search);
};
$scope.saveForSharing = function() {
var clone = angular.copy($scope.dashboard);
clone.temp = true;
$scope.db.saveDashboard(clone)
.then(function(result) {
$scope.share = { url: result.url, title: result.title };
}, function(err) {
alertSrv.set('Save for sharing failed', err, 'error',5000);
});
$scope.shareDashboard = function() {
$scope.appEvent('show-modal', {
src: './app/features/dashboard/partials/shareModal.html',
scope: $scope.$new(),
});
};
$scope.passwordCache = function(pwd) {
......
......@@ -24,7 +24,7 @@ function (angular, _) {
$scope.sharePanel = function() {
$scope.appEvent('show-modal', {
src: './app/partials/share-panel.html',
src: './app/features/dashboard/partials/shareModal.html',
scope: $scope.$new()
});
};
......
<div ng-controller="SharePanelCtrl">
<div class="modal-header">
<div class="dashboard-editor-header">
<div class="dashboard-editor-title">
<i class="fa fa-share"></i>
Share
</div>
<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
</div>
<div ng-model="editor.index" bs-tabs style="text-transform:capitalize;">
<div ng-repeat="tab in ['Link']" data-title="{{tab}}">
</div>
<div ng-model="editor.index" bs-tabs style="text-transform:capitalize;">
<div ng-repeat="tab in ['Link']" data-title="{{tab}}">
</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">
<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>
......@@ -29,10 +29,7 @@
<div class="editor-row" style="margin-top: 20px;">
<a href="{{imageUrl}}" target="_blank">Link to rendered image</a>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-success pull-right" ng-click="dismiss();">close</button>
</div>
</div>
......@@ -12,9 +12,12 @@ function (angular, _) {
$scope.init = function() {
$scope.editor = { index: 0 };
$scope.forCurrent = true;
$scope.toPanel = true;
$scope.includeTemplateVars = true;
if ($scope.panel) {
$scope.toPanel = true;
}
$scope.includeTemplateVars = true;
$scope.buildUrl();
};
......@@ -26,7 +29,6 @@ function (angular, _) {
baseUrl = baseUrl.substring(0, queryStart);
}
var panelId = $scope.panel.id;
var params = angular.copy($location.search());
var range = timeSrv.timeRangeForUrl();
......@@ -50,7 +52,7 @@ function (angular, _) {
}
if ($scope.toPanel) {
params.panelId = panelId;
params.panelId = $scope.panel.id;
params.fullscreen = true;
} else {
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 @@
<a class="pointer" ng-click="starDashboard()"><i class="fa fa-star-o" style="color: orange;"></i></a>
</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>
<a ng-click="saveDashboard()"><i class="fa fa-save"></i></a>
......@@ -52,12 +52,6 @@
</grafana-simple-panel>
</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">
<a class='small' ng-click='stopPlaylist(2)'>
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