Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jkmarx/tool control panel #1667

Merged
merged 24 commits into from
Apr 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
60 changes: 2 additions & 58 deletions refinery/ui/source/js/tool-launch/ctrls/input-control-ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,55 +6,15 @@
.controller('InputControlCtrl', InputControlCtrl);

InputControlCtrl.$inject = [
'$scope',
'fileBrowserFactory',
'resetGridService',
'selectedNodesService'
'$scope'
];


function InputControlCtrl (
$scope,
fileBrowserFactory,
resetGridService,
selectedNodesService
$scope
) {
var vm = this;
vm.groups = [];
vm.groupIndex = 0;
vm.navRight = navRight;
vm.navLeft = navLeft;
vm.removeGroup = removeGroup;
vm.removeAllGroups = removeAllGroups;
vm.tool = {};
vm.attributes = {};

/*
* ---------------------------------------------------------
* Methods Definitions
* ---------------------------------------------------------
*/
function navLeft () {
if (vm.groupIndex > 0) {
vm.groupIndex--;
}
}

function navRight () {
if (vm.groupIndex < vm.groups.length) {
vm.groupIndex++;
}
}

function removeGroup (groupInd) {
vm.groups[groupInd].isSelected = false;
selectedNodesService.setSelectedNodes(vm.groups[groupInd]);
}

function removeAllGroups () {
selectedNodesService.setSelectedAllFlags(false);
resetGridService.setRefreshGridFlag(true);
}

/*
* ---------------------------------------------------------
Expand All @@ -71,22 +31,6 @@
angular.copy(vm.displayCtrl.selectedTool, vm.tool);
}
);

$scope.$watchCollection(
function () {
return selectedNodesService.selectedNodes;
},
function () {
vm.groups = selectedNodesService.selectedNodes;
if (vm.groups.length > 0) {
var attributesArray = vm.groups[0].grid.appScope.assayAttributes;
for (var ind = 0; ind < attributesArray.length; ind ++) {
vm.attributes[attributesArray[ind].display_name] = attributesArray[ind].internal_name;
}
vm.groupIndex = vm.groups.length - 1;
}
}
);
};
}
})();
28 changes: 28 additions & 0 deletions refinery/ui/source/js/tool-launch/ctrls/input-control-ctrl.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
(function () {
'use strict';

describe('Controller: Input Control Ctrl', function () {
var ctrl;
var scope;

beforeEach(module('refineryApp'));
beforeEach(module('refineryToolLaunch'));
beforeEach(inject(function (
$rootScope,
$controller
) {
scope = $rootScope.$new();
ctrl = $controller('InputControlCtrl', {
$scope: scope
});
}));

it('Input Group ctrl should exist', function () {
expect(ctrl).toBeDefined();
});

it('Data & UI displays variables should exist for views', function () {
expect(ctrl.tool).toEqual({});
});
});
})();
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
(function () {
'use strict';

angular
.module('refineryToolLaunch')
.controller('InputControlNavTreeCtrl', InputControlNavTreeCtrl);

InputControlNavTreeCtrl.$inject = [
'$scope',
'resetGridService',
'selectedNodesService',
'fileRelationshipService'
];


function InputControlNavTreeCtrl (
$scope,
resetGridService,
selectedNodesService,
fileRelationshipService
) {
var vm = this;
vm.attributes = fileRelationshipService.attributesObj;
vm.currentPosition = fileRelationshipService.currentPosition; // maintains nav position
vm.groups = []; // stores all the selected nodes for vm
vm.navRight = navRight;
vm.navLeft = navLeft;
vm.removeAllGroups = removeAllGroups;
vm.removeGroup = removeGroup; // Refreshes all selection
/*
* ---------------------------------------------------------
* Methods Definitions
* ---------------------------------------------------------
*/
function navLeft (depth) {
vm.currentPosition[depth]--;
}

function navRight (depth) {
vm.currentPosition[depth]++;
}

// PROBABLY SHOULD move 'remove groups' to input group ctrl
function removeGroup (groupInd) {
vm.groups[groupInd].isSelected = false;
selectedNodesService.setSelectedNodes(vm.groups[groupInd]);
}

function removeAllGroups () {
selectedNodesService.setSelectedAllFlags(false);
resetGridService.setRefreshGridFlag(true);
}

/*
* ---------------------------------------------------------
* Watchers
* ---------------------------------------------------------
*/
vm.$onInit = function () {
// copies all selected nodes to the generic group
$scope.$watchCollection(
function () {
return selectedNodesService.selectedNodes;
},
function () {
vm.groups = selectedNodesService.selectedNodes;
}
);
};
}
})();
26 changes: 23 additions & 3 deletions refinery/ui/source/js/tool-launch/ctrls/input-group-ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,25 @@
.module('refineryToolLaunch')
.controller('InputGroupCtrl', InputGroupCtrl);

InputGroupCtrl.$inject = ['$scope'];
InputGroupCtrl.$inject = [
'$scope',
'fileRelationshipService',
'selectedNodesService'
];


function InputGroupCtrl ($scope) {
function InputGroupCtrl (
$scope,
fileRelationshipService,
selectedNodesService
) {
var vm = this;
vm.attributes = fileRelationshipService.attributesObj;
vm.currentFileInput = [];
vm.isNavCollapsed = false;
vm.tool = {}; // selected tool displayed in panel
vm.toolType = ''; // workflow vs visualization
vm.isNavCollapsed = false;


/*
* ---------------------------------------------------------
Expand All @@ -31,6 +42,15 @@
}
}
);

$scope.$watchCollection(
function () {
return selectedNodesService.selectedNodes;
},
function () {
vm.currentFileInput = selectedNodesService.selectedNodes;
}
);
};
}
})();
17 changes: 15 additions & 2 deletions refinery/ui/source/js/tool-launch/ctrls/tool-display-ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,18 @@
.module('refineryToolLaunch')
.controller('ToolDisplayCtrl', ToolDisplayCtrl);

ToolDisplayCtrl.$inject = ['$scope', '_', 'toolsService'];
ToolDisplayCtrl.$inject = [
'$scope',
'_',
'fileRelationshipService',
'toolsService'];

function ToolDisplayCtrl ($scope, _, toolsService) {
function ToolDisplayCtrl (
$scope,
_,
fileRelationshipService,
toolsService
) {
var vm = this;
vm.selectedTool = {};
vm.isToolSelected = false;
Expand All @@ -24,6 +33,10 @@
function () {
angular.copy(toolsService.selectedTool, vm.selectedTool);
vm.isToolSelected = !(_.isEmpty(vm.selectedTool));
if (vm.isToolSelected) {
fileRelationshipService.resetCurrents();
fileRelationshipService.refreshFileMap();
}
}
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
(function () {
'use strict';

angular
.module('refineryToolLaunch')
.directive('rpInputControlNavTree', rpInputControlNavTree);

function rpInputControlNavTree () {
return {
restrict: 'E',
controller: 'InputControlNavTreeCtrl',
controllerAs: 'treeCtrl',
scope: {
member: '=',
depth: '='
},
templateUrl: ['$window', function ($window) {
return $window.getStaticUrl('partials/tool-launch/partials/input-control-nav-tree.html');
}]
};
}
})();
20 changes: 20 additions & 0 deletions refinery/ui/source/js/tool-launch/directives/input-control-nav.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
(function () {
'use strict';

angular
.module('refineryToolLaunch')
.directive('rpInputControlNav', rpInputControlNav);

function rpInputControlNav () {
return {
restrict: 'E',
scope: {
collection: '=',
counter: '='
},
templateUrl: ['$window', function ($window) {
return $window.getStaticUrl('partials/tool-launch/partials/input-control-nav.html');
}]
};
}
})();
20 changes: 11 additions & 9 deletions refinery/ui/source/js/tool-launch/directives/input-control.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
(function () {
'use strict';
angular.module('refineryToolLaunch').component('rpInputControl', {
controller: 'InputControlCtrl',
require: {
displayCtrl: '^rpToolDisplay'
},
templateUrl: ['$window', function ($window) {
return $window.getStaticUrl('partials/tool-launch/partials/input-control.html');
}]
});
angular
.module('refineryToolLaunch')
.component('rpInputControl', {
controller: 'InputControlCtrl',
require: {
displayCtrl: '^rpToolDisplay'
},
templateUrl: ['$window', function ($window) {
return $window.getStaticUrl('partials/tool-launch/partials/input-control.html');
}]
});
})();