mirror of
https://github.com/grafana/grafana.git
synced 2025-01-16 11:42:35 -06:00
Fixed share dashboard feature, sharing temp feature is currently removed
This commit is contained in:
parent
f424abf87c
commit
66d9c4f1af
@ -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()
|
||||
});
|
||||
};
|
||||
|
@ -1,21 +1,21 @@
|
||||
<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 ng-model="editor.index" bs-tabs style="text-transform:capitalize;">
|
||||
<div ng-repeat="tab in ['Link']" data-title="{{tab}}">
|
||||
</div>
|
||||
</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>
|
||||
|
||||
<button class="gf-box-header-close-btn" ng-click="dismiss();">
|
||||
<i class="fa fa-remove"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
|
||||
<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;
|
||||
|
@ -1,11 +0,0 @@
|
||||
<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-menu-save"> -->
|
||||
<!-- <a bs-tooltip="'Save'" data-placement="bottom" class="dropdown-toggle" data-toggle="dropdown" ng-click="saveDashboard()"> -->
|
||||
<!-- <i class='fa fa-save'></i> -->
|
||||
<!-- </a> -->
|
||||
<!-- </li> -->
|
||||
<!-- -->
|
||||
<li class="grafana-menu-stop-playlist hide">
|
||||
<a class='small' ng-click='stopPlaylist(2)'>
|
||||
Stop playlist
|
||||
|
18
src/app/partials/shareDashboard.html
Normal file
18
src/app/partials/shareDashboard.html
Normal file
@ -0,0 +1,18 @@
|
||||
<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>
|
Loading…
Reference in New Issue
Block a user