Merge pull request #168 from jerrybai2009/master

fix the flow routing and set active tab page issue
This commit is contained in:
jerrybai2009 2016-07-12 17:04:46 -07:00 committed by GitHub
commit f110d190f3
2 changed files with 48 additions and 6 deletions

View File

@ -42,6 +42,43 @@ App.FlowsRoute = Ember.Route.extend({
}
});
App.FlowspageRoute = Ember.Route.extend({
setupController: function(controller) {
currentTab = 'Flows';
var listUrl = 'api/v1/list/flows';
$.get(listUrl, function(data) {
if (data && data.status == "ok"){
renderFlowListView(data.nodes);
}
});
updateActiveTab();
var url = 'api/v1/flows?size=10&page=1';
var breadcrumbs = [{"title": 'FLOWS_ROOT', "urn": "page/1"}];
$.get(url, function(data) {
if (data && data.status == "ok"){
flowsController.set('model', data);
flowsController.set('projectView', true);
flowsController.set('flowView', false);
flowsController.set('breadcrumbs', breadcrumbs);
flowsController.set('urn', 'FLOWS_ROOT');
flowsController.set('projectView', true);
flowsController.set('flowView', false);
flowsController.set('jobView', false);
}
});
var watcherEndpoint = "/api/v1/urn/watch?urn=FLOWS_ROOT";
$.get(watcherEndpoint, function(data){
if(data.id && data.id !== 0) {
flowsController.set('urnWatched', true)
flowsController.set('urnWatchedId', data.id)
} else {
flowsController.set('urnWatched', false)
flowsController.set('urnWatchedId', 0)
}
});
}
});
App.PagedapplicationRoute = Ember.Route.extend({
setupController: function(controller, params, transition) {
currentTab = 'Flows';

View File

@ -219,7 +219,7 @@ function updateActiveTab()
obj.removeClass("active");
}
if (currentTab == 'Metric')
if (currentTab == 'Metrics')
{
$('#menutabs a:eq(1)').tab("show");
$('#metriclink').addClass("active");
@ -421,11 +421,16 @@ var scrollToTreeNode = function() {
}
$('.category-header a').click(function (e) {
if (currentTab == this.text)
var text = 'Datasets';
if (this && this.children && this.children.length > 0 && this.children[0] && this.children[0].textContent)
{
text = this.children[0].textContent;
}
if (currentTab == text)
return;
currentTab = this.text;
currentTab = text;
updateActiveTab();
if (this.text == 'Datasets')
if (text == 'Datasets')
{
var node = $("#tree2").fancytree("getActiveNode");
if (node)
@ -435,7 +440,7 @@ $('.category-header a').click(function (e) {
}
window.location = "#/datasets/page/1";
}
else if (this.text == 'Metric')
else if (text == 'Metrics')
{
var node = $("#tree1").fancytree("getActiveNode");
if (node)
@ -445,7 +450,7 @@ $('.category-header a').click(function (e) {
}
window.location = "#/metrics/page/1";
}
else if (this.text == 'Flows')
else if (text == 'Flows')
{
var node = $("#tree3").fancytree("getActiveNode");
if (node)