Merge pull request #227 from EverythingMe/feature_celery_status

Show Celery Flower in an iframe.
This commit is contained in:
Arik Fraimovich 2014-06-20 15:32:49 +03:00
commit 2fff4f4036
9 changed files with 28 additions and 7 deletions

View File

@ -1,5 +1,5 @@
from playhouse.migrate import Migrator
from redash import db
from redash.models import db
from redash import models
@ -10,4 +10,4 @@ if __name__ == '__main__':
migrator.add_column(models.DataSource, models.DataSource.queue_name, 'queue_name')
migrator.add_column(models.DataSource, models.DataSource.scheduled_queue_name, 'scheduled_queue_name')
db.close_db(None)
db.close_db(None)

View File

@ -1,7 +1,7 @@
import peewee
from playhouse.migrate import Migrator
from redash import db
from redash import models
from redash.models import db
if __name__ == '__main__':

View File

@ -74,6 +74,11 @@ angular.module('redash', [
templateUrl: '/views/admin_status.html',
controller: 'AdminStatusCtrl'
});
$routeProvider.when('/admin/workers', {
templateUrl: '/views/admin_workers.html',
controller: 'AdminWorkersCtrl'
});
$routeProvider.when('/', {
templateUrl: '/views/index.html',
controller: 'IndexCtrl'

View File

@ -16,9 +16,16 @@
$timeout(refresh, 59 * 1000);
};
$scope.flowerUrl = featureFlags.flowerUrl;
refresh();
}
var AdminWorkersCtrl = function ($scope, $sce) {
$scope.flowerUrl = $sce.trustAsResourceUrl(featureFlags.flowerUrl);
};
angular.module('redash.admin_controllers', [])
.controller('AdminStatusCtrl', ['$scope', 'Events', '$http', '$timeout', AdminStatusCtrl])
.controller('AdminWorkersCtrl', ['$scope', '$sce', AdminWorkersCtrl])
})();

View File

@ -268,6 +268,10 @@ pivot-table-renderer > table, grid-renderer > div, visualization-renderer > div
overflow: auto;
}
.iframe-container {
height: 100%;
}
/*
bootstrap's hidden-xs class adds display:block when not hidden
use this class when you need to keep the original display value

View File

@ -20,9 +20,9 @@
<span class="badge" am-time-ago="manager.started_at*1000.0"></span>
Started
</li>
<li class="list-group-item">
<span class="badge">{{manager.queue_size}}</span>
Queue Size
<li class="list-group-item" ng-if="flowerUrl">
<a href="/admin/workers">Workers' Status</a>
</li>
</ul>
<ul class="list-group col-lg-4">

View File

@ -0,0 +1,3 @@
<div class="container-fluid iframe-container">
<iframe src="{{flowerUrl}}" style="width:100%; height:100%; background-color:transparent;"></iframe>
</div>

View File

@ -53,7 +53,8 @@ def index(**kwargs):
}
features = {
'clientSideMetrics': settings.CLIENT_SIDE_METRICS
'clientSideMetrics': settings.CLIENT_SIDE_METRICS,
'flowerUrl': settings.CELERY_FLOWER_URL
}
return render_template("index.html", user=json.dumps(user), name=settings.NAME,

View File

@ -54,6 +54,7 @@ DATABASE_CONFIG = parse_db_url(os.environ.get("REDASH_DATABASE_URL", "postgresql
# Celery related settings
CELERY_BROKER = os.environ.get("REDASH_CELERY_BROKER", REDIS_URL)
CELERY_BACKEND = os.environ.get("REDASH_CELERY_BACKEND", REDIS_URL)
CELERY_FLOWER_URL = os.environ.get("REDASH_CELERY_FLOWER_URL", "/flower")
# Google Apps domain to allow access from; any user with email in this Google Apps will be allowed
# access