Skip to content

Commit

Permalink
Fix rendering bug and remove Resources from sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
vascoalramos committed Sep 1, 2020
1 parent 8fde455 commit 7667789
Show file tree
Hide file tree
Showing 25 changed files with 131 additions and 404 deletions.
50 changes: 20 additions & 30 deletions app/assets/javascripts/application/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ define('Application', ['jquery', 'Router', 'Module', 'jsRoutes', 'Svg', 'Institu
institutionId: institutionId,
graphId: graphId,
stepId: stepId,
before: true,
tab: "resources"
before: true
};

self.loadController('MainModule', 'FieldsController', opts);
Expand All @@ -41,25 +40,23 @@ define('Application', ['jquery', 'Router', 'Module', 'jsRoutes', 'Svg', 'Institu
institutionId: institutionId,
graphId: graphId,
stepId: stepId,
before: false,
tab: "resources"
before: false
};

self.loadController('MainModule', 'FieldsController', opts);
self.loadControllers('SidebarModule', ['SidebarController', 'TaskController', 'ServerController', 'DataSourceController'], opts);
self.loadControllers('SidebarModule', ['SidebarController'], opts);
})
.add(new RegExp(jsRoutes.controllers.TransGraphController.history('(.*)', '(.*)').url.substr(1), 'i'), function (institutionId, graphId) {
console.log("History of Graph " + graphId);

var opts = {
institutionId: institutionId,
graphId: graphId,
section: 'history',
tab: "resources"
section: 'history'
}

self.loadController('MainModule', 'HistoryController', opts);
self.loadControllers('SidebarModule', ['SidebarController', 'TaskController', 'ServerController', 'DataSourceController'], opts);
self.loadControllers('SidebarModule', ['SidebarController'], opts);
self.loadController('BreadcrumbModule', 'BreadcrumbController', opts);
})
.add(new RegExp(jsRoutes.controllers.StepController.configure('(.*)', '(.*)', '(.*)').url.substr(1), 'i'), function (institutionId, graphId, stepId) {
Expand All @@ -69,11 +66,10 @@ define('Application', ['jquery', 'Router', 'Module', 'jsRoutes', 'Svg', 'Institu
institutionId: institutionId,
graphId: graphId,
stepId: stepId,
section: 'configure',
tab: "resources"
section: 'configure'
};
self.loadControllers('MainModule', ['StepController', 'StepModalController'], opts);
self.loadControllers('SidebarModule', ['SidebarController', 'TaskController', 'ServerController', 'DataSourceController'], opts);
self.loadControllers('SidebarModule', ['SidebarController'], opts);
self.loadController('BreadcrumbModule', 'BreadcrumbController', opts);
})
.add(new RegExp(jsRoutes.controllers.ExecutionController.logs('(.*)', '(.*)', '(.*)').url.substr(1), 'i'), function (institutionId, graphId, executionId) {
Expand All @@ -83,11 +79,10 @@ define('Application', ['jquery', 'Router', 'Module', 'jsRoutes', 'Svg', 'Institu
institutionId: institutionId,
graphId: graphId,
executionId: executionId,
section: 'logs',
tab: "resources"
section: 'logs'
};
self.loadController('MainModule', 'LogsController', opts);
self.loadControllers('SidebarModule', ['SidebarController', 'TaskController', 'ServerController', 'DataSourceController'], opts);
self.loadControllers('SidebarModule', ['SidebarController'], opts);
self.loadController('BreadcrumbModule', 'BreadcrumbController', opts);
})
.add(new RegExp(jsRoutes.controllers.ExecutionController.metrics('(.*)', '(.*)', '(.*)').url.substr(1), 'i'), function (institutionId, graphId, executionId) {
Expand All @@ -97,11 +92,10 @@ define('Application', ['jquery', 'Router', 'Module', 'jsRoutes', 'Svg', 'Institu
institutionId: institutionId,
graphId: graphId,
executionId: executionId,
section: 'metrics',
tab: "resources"
section: 'metrics'
};
self.loadController('MainModule', 'StepMetricsController', opts);
self.loadControllers('SidebarModule', ['SidebarController', 'TaskController', 'ServerController', 'DataSourceController'], opts);
self.loadControllers('SidebarModule', ['SidebarController'], opts);
self.loadController('BreadcrumbModule', 'BreadcrumbController', opts);
})
.add(new RegExp(jsRoutes.controllers.ExecutionController.previewStep('(.*)', '(.*)', '(.*)', '(.*)').url.substr(1), 'i'), function (institutionId, graphId, executionId, stepId) {
Expand All @@ -112,11 +106,10 @@ define('Application', ['jquery', 'Router', 'Module', 'jsRoutes', 'Svg', 'Institu
graphId: graphId,
executionId: executionId,
stepId: stepId,
section: 'previewStep',
tab: "resources"
section: 'previewStep'
};
self.loadController('MainModule', 'PreviewStepController', opts);
self.loadControllers('SidebarModule', ['SidebarController', 'TaskController', 'ServerController', 'DataSourceController'], opts);
self.loadControllers('SidebarModule', ['SidebarController'], opts);
self.loadController('BreadcrumbModule', 'BreadcrumbController', opts);
})
.add(new RegExp(jsRoutes.controllers.ExecutionController.previewData('(.*)', '(.*)', '(.*)').url.substr(1), 'i'), function (institutionId, graphId, executionId) {
Expand All @@ -126,11 +119,10 @@ define('Application', ['jquery', 'Router', 'Module', 'jsRoutes', 'Svg', 'Institu
institutionId: institutionId,
graphId: graphId,
executionId: executionId,
section: 'previewData',
tab: "resources"
section: 'previewData'
};
self.loadController('MainModule', 'PreviewDataController', opts);
self.loadControllers('SidebarModule', ['SidebarController', 'TaskController', 'ServerController', 'DataSourceController'], opts);
self.loadControllers('SidebarModule', ['SidebarController'], opts);
self.loadController('BreadcrumbModule', 'BreadcrumbController', opts);
})
.add(new RegExp(jsRoutes.controllers.TransGraphController.selectTask('(.*)', '(.*)').url.substr(1), 'i'), function (institutionId, graphId) {
Expand All @@ -139,22 +131,20 @@ define('Application', ['jquery', 'Router', 'Module', 'jsRoutes', 'Svg', 'Institu
var opts = {
institutionId: institutionId,
graphId: graphId,
section: 'selectTask',
tab: "components"
section: 'selectTask'
}
self.loadControllers('MainModule', ['GraphController', 'RemoteExecutionController'], opts);
self.loadControllers('SidebarModule', ['SidebarController', 'TaskController', 'ServerController', 'DataSourceController'], opts);
self.loadControllers('SidebarModule', ['SidebarController'], opts);
self.loadController('BreadcrumbModule', 'BreadcrumbController', opts);
})
.add(new RegExp(jsRoutes.controllers.InstitutionController.scheduler('(.*)').url.substr(1), 'i'), function (institutionId) {
console.log("Institution " + institutionId + " Scheduler");

var opts = {
institutionId: institutionId,
tab: "resources"
const opts = {
institutionId: institutionId
}
self.loadControllers('MainModule', ['SchedulerController'], opts);
self.loadControllers('SidebarModule', ['SidebarController', 'TaskController', 'ServerController', 'DataSourceController'], opts);
self.loadControllers('SidebarModule', ['SidebarController'], opts);
})
.add(function () {
console.log("homepage");
Expand Down
6 changes: 5 additions & 1 deletion app/assets/javascripts/breadcrumb/breadcrumbController.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,9 @@ define('BreadcrumbController', ['Controller', 'BreadcrumbView'], function (Contr
_super_.initialize.call(this, $container);
};

BreadcrumbController.prototype.goHome = function () {
document.location.href = jsRoutes.controllers.HomeController.index().url;
};

return BreadcrumbController;
});
});
14 changes: 8 additions & 6 deletions app/assets/javascripts/breadcrumb/breadcrumbView.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,14 @@ define('BreadcrumbView', ['View', 'async', 'Task', 'jsRoutes', 'Router', 'Execut
callback();
}
]);


};

BreadcrumbView.prototype.setBreadcrumbs = function (breadcrumbs) {
var context = this;
_.each(breadcrumbs, function (bc) {
_.each(breadcrumbs, function (bc, idx) {
var $elem;
if (bc.url) {
$elem = $('<li><a view-router href="' + bc.url + '">' + bc.name + '</a></li>');
$elem = $('<li style="float: left"><a view-router href="' + bc.url + '">' + bc.name + '</a></li>');
} else {
$elem = $('<li>' + bc.name + '</li>');
}
Expand All @@ -154,10 +152,14 @@ define('BreadcrumbView', ['View', 'async', 'Task', 'jsRoutes', 'Router', 'Execut
$elem.prepend('<i class="' + bc.icon + '"></i> ')
}

context.$elements.breadcrumb.append($elem);
if (idx === 0) {
context.$elements.breadcrumb.prepend($elem);
} else {
context.$elements.breadcrumb.append($elem);
}
});
Router.updatePageLinks();
};

return BreadcrumbView;
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,8 @@ define('HomeController', ['Controller', 'HomeView', 'Router', 'Institution', 'Ta
};

// TASKS //
// TODO: check the faulty render of the task page
HomeController.prototype.selectTask = function (institutionId, taskId) {
const configStepUrl = jsRoutes.controllers.TransGraphController.selectTask(institutionId, taskId).url;
Router.navigate(configStepUrl);
document.location.href = jsRoutes.controllers.TransGraphController.selectTask(institutionId, taskId).url;
};

HomeController.prototype.createTask = function (institution, event) {
Expand All @@ -75,17 +73,15 @@ define('HomeController', ['Controller', 'HomeView', 'Router', 'Institution', 'Ta

Task.getTask(institution, taskName, task => {
if (task === "not found") {
Task.newTask(context.institution, taskName, () => {
Task.newTask(context.institution, taskName, (newTask) => {
// Open new task.
const configStepUrl = jsRoutes.controllers.TransGraphController.selectTask(context.institution, task.id).url;
Router.navigate(configStepUrl);
document.location.href = jsRoutes.controllers.TransGraphController.selectTask(context.institution, newTask.id).url;

Alert.flash(ALERT_TYPE.SUCCESS, 'Task', 'Task \'' + taskName + '\' was successfully created!');
});
} else {
// Open already existent task.
const configStepUrl = jsRoutes.controllers.TransGraphController.selectTask(context.institution, task.id).url;
Router.navigate(configStepUrl);
document.location.href = jsRoutes.controllers.TransGraphController.selectTask(context.institution, task.id).url;

Alert.flash(ALERT_TYPE.DANGER, 'Task', 'Task \'' + taskName + '\' already exists!');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ define('ServerController', ['Controller', 'ServerView', 'async', 'Router', 'Inst
);
}

DataSourceController.prototype.reloadInstitutionInfo = function () {
ServerController.prototype.reloadInstitutionInfo = function () {
let institutionDisplayController;

const sidebarController = this.module.controllers['SidebarController'];
Expand Down
File renamed without changes.
24 changes: 12 additions & 12 deletions app/assets/javascripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ requirejs.config({
'LoginView': 'login/views/loginView',

// Home
'HomeController': 'home/homeController',
'HomeView': 'home/homeView',
'HomeController': 'home/controllers/homeController',
'HomeView': 'home/views/homeView',

// Header
'HeaderController': 'header/headerController',
Expand Down Expand Up @@ -121,24 +121,24 @@ requirejs.config({
'ResultView': 'result/resultView',

// Sidebar
'SidebarController': 'sidebar/controllers/sidebarController',
'SidebarView': 'sidebar/views/sidebarView',
'SidebarController': 'sidebar/sidebarController',
'SidebarView': 'sidebar/sidebarView',

// Task Page
'TaskController': 'sidebar/controllers/taskController',
'TaskView': 'sidebar/views/taskView',
'TaskController': 'home/controllers/taskController',
'TaskView': 'home/views/taskView',

// Server Settings Page
'ServerController': 'sidebar/controllers/serverController',
'ServerView': 'sidebar/views/serverView',
'ServerController': 'home/controllers/serverController',
'ServerView': 'home/views/serverView',

// Data Source Page
'DataSourceController': 'sidebar/controllers/dataSourceController',
'DataSourceView': 'sidebar/views/dataSourceView',
'DataSourceController': 'home/controllers/dataSourceController',
'DataSourceView': 'home/views/dataSourceView',

// Execution Scheduler Page
'SchedulerController': 'sidebar/controllers/scheduleController',
'SchedulerView': 'sidebar/views/scheduleView',
'SchedulerController': 'home/controllers/scheduleController',
'SchedulerView': 'home/views/scheduleView',
},
shim: {
'messages': {
Expand Down
Loading

0 comments on commit 7667789

Please sign in to comment.