mirror of
https://github.com/valitydev/redash.git
synced 2024-11-08 01:48:54 +00:00
Unpaginated results
This commit is contained in:
parent
b249b9a444
commit
0b6d2b4486
@ -4,19 +4,23 @@ import {_} from 'underscore';
|
||||
function DashboardListCtrl($scope, Dashboard, $location, currentUser, clientConfig, NgTableParams) {
|
||||
const self = this;
|
||||
|
||||
self.logoUrl = clientConfig.logoUrl;
|
||||
this.logoUrl = clientConfig.logoUrl;
|
||||
const page = parseInt($location.search().page || 1, 10);
|
||||
const count = 25;
|
||||
|
||||
this.defaultOptions = {};
|
||||
self.dashboards = Dashboard.query({}); // shared promise
|
||||
this.dashboards = Dashboard.query({}); // shared promise
|
||||
|
||||
$scope.selectedTags = []; // in scope because it needs to be accessed inside a table refresh
|
||||
$scope.searchText = "";
|
||||
|
||||
$scope.$watch(function(){
|
||||
return $scope.searchText;
|
||||
}, function(){this.defaultOptions.reload()})
|
||||
}, function(){
|
||||
if(this){
|
||||
this.defaultOptions.reload()
|
||||
}
|
||||
});
|
||||
|
||||
this.tagIsSelected = (tag) => {
|
||||
return $scope.selectedTags.indexOf(tag) > -1;
|
||||
@ -33,7 +37,7 @@ function DashboardListCtrl($scope, Dashboard, $location, currentUser, clientConf
|
||||
|
||||
this.allTags = [];
|
||||
self.dashboards.$promise.then((data) => {
|
||||
const out = data.results.map((dashboard) => {
|
||||
const out = data.map((dashboard) => {
|
||||
return dashboard.name.match(/(^\w+):|(#\w+)/ig);
|
||||
});
|
||||
this.allTags = _.unique(_.flatten(out)).filter((e) => e);
|
||||
@ -48,7 +52,7 @@ function DashboardListCtrl($scope, Dashboard, $location, currentUser, clientConf
|
||||
|
||||
return self.dashboards.$promise.then((data) => {
|
||||
params.total(data.count);
|
||||
return data.results.map((dashboard) => {
|
||||
return data.map((dashboard) => {
|
||||
dashboard.tags = dashboard.name.match(/(^\w+):|(#\w+)/ig);
|
||||
dashboard.untagged_name = dashboard.name.replace(/(\w+):|(#\w+)/ig, '').trim();
|
||||
return dashboard;
|
||||
|
@ -18,15 +18,12 @@ function Dashboard($resource, $http, currentUser, Widget) {
|
||||
const resource = $resource('api/dashboards/:slug', { slug: '@slug' }, {
|
||||
get: { method: 'GET', transformResponse: transform },
|
||||
save: { method: 'POST', transformResponse: transform },
|
||||
query: { method: 'GET', isArray: false, transformResponse: transform },
|
||||
query: { method: 'GET', isArray: true, transformResponse: transform },
|
||||
recent: {
|
||||
method: 'get',
|
||||
isArray: true,
|
||||
url: 'api/dashboards/recent',
|
||||
transformResponse: transform,
|
||||
},
|
||||
dashboards: {
|
||||
isArray: false,
|
||||
}
|
||||
});
|
||||
resource.prototype.canEdit = () => currentUser.canEdit(this) || this.can_edit;
|
||||
|
@ -26,10 +26,7 @@ class DashboardListResource(BaseResource):
|
||||
@require_permission('list_dashboards')
|
||||
def get(self):
|
||||
results = models.Dashboard.all(self.current_org, self.current_user.groups, self.current_user)
|
||||
page = request.args.get('page', 1, type=int)
|
||||
page_size = request.args.get('page_size', 25, type=int)
|
||||
dashboards = models.Dashboard.all(self.current_org, self.current_user.groups, self.current_user)
|
||||
return paginate(results, page, page_size, lambda q: q.to_dict())
|
||||
return [q.to_dict() for q in results]
|
||||
|
||||
@require_permission('create_dashboard')
|
||||
def post(self):
|
||||
|
Loading…
Reference in New Issue
Block a user