Show description in dashboard.

This commit is contained in:
Arik Fraimovich 2014-01-15 11:38:38 +02:00
parent e028dfe2f9
commit b8fb6200f0
2 changed files with 18 additions and 12 deletions

View File

@ -5,7 +5,7 @@
});
};
var WidgetCtrl = function ($scope, $http, Query) {
var WidgetCtrl = function ($scope, $http, $location, Query) {
$scope.deleteWidget = function() {
if (!confirm('Are you sure you want to remove "' + $scope.widget.query.name + '" from the dashboard?')) {
return;
@ -18,6 +18,10 @@
})
});
});
};
$scope.open = function(query) {
$location.path('/queries/' + query.id);
}
$scope.query = new Query($scope.widget.query);
@ -363,7 +367,7 @@
angular.module('redash.controllers', [])
.controller('DashboardCtrl', ['$scope', '$routeParams', '$http', 'Dashboard', DashboardCtrl])
.controller('WidgetCtrl', ['$scope', '$http', 'Query', WidgetCtrl])
.controller('WidgetCtrl', ['$scope', '$http', '$location', 'Query', WidgetCtrl])
.controller('QueriesCtrl', ['$scope', '$http', '$location', '$filter', 'Query', QueriesCtrl])
.controller('QueryFiddleCtrl', ['$scope', '$window', '$routeParams', '$http', '$location', 'growl', 'notifications', 'Query', QueryFiddleCtrl])
.controller('IndexCtrl', ['$scope', 'Dashboard', IndexCtrl])

View File

@ -21,16 +21,11 @@
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title" ng-mouseenter="inFocus = true"
ng-mouseleave="inFocus = false">
<button type="button" class="close delete-button" aria-hidden="true" ng-show="dashboard.canEdit()" ng-click="deleteWidget()" tooltip="Remove Widget">&times;</button>
<a ng-href="/queries/{{query.id}}">{{query.name}}</a>
<span class="glyphicon glyphicon-pencil" ng-show="inFocus"></span>
<span class="label label-default pull-right"
am-time-ago="queryResult.getUpdatedAt()"
tooltip="next update {{nextUpdateTime}} (query runtime: {{queryResult.getRuntime() | durationHumanize}})"
tooltip-placement="bottom"></span>
<h3 class="panel-title" style="cursor: pointer;" ng-click="open(query)">
<p>
<span ng-bind="query.name"></span>
</p>
<div class="text-muted" ng-bind="query.description"></div>
</h3>
</div>
@ -39,6 +34,13 @@
<grid-renderer ng-switch-when="grid" query-result="queryResult"></grid-renderer>
<cohort-renderer ng-switch-when="cohort" query-result="queryResult"></cohort-renderer>
</div>
<div class="panel-footer">
<span class="label label-default"
tooltip="next update {{nextUpdateTime}} (query runtime: {{queryResult.getRuntime() | durationHumanize}})"
tooltip-placement="bottom">Updated: <span am-time-ago="queryResult.getUpdatedAt()"></span></span>
<button type="button" class="btn btn-default btn-xs pull-right" ng-show="dashboard.canEdit()" ng-click="deleteWidget()" title="Remove Widget"><span class="glyphicon glyphicon-trash"></span></button>
</div>
</div>
</div>
</div>