Skip to content

Commit 01de1d4

Browse files
authored
JBDS-4486 Add Select All and Deselect All actions in context menu (#817)
1 parent 86ba3d7 commit 01de1d4

5 files changed

Lines changed: 61 additions & 3 deletions

File tree

browser/bootstrap.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const { Menu, MenuItem } = remote;
1212

1313
let rightClickPosition = null;
1414

15-
const menu = new Menu();
15+
var menu;
1616
const toggleDevToolsItem = new MenuItem({
1717
label: 'Toggle Development Tools',
1818
accelerator: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I',
@@ -26,11 +26,17 @@ const inspectElementItem = new MenuItem({
2626
remote.getCurrentWindow().inspectElement(rightClickPosition.x, rightClickPosition.y);
2727
}
2828
});
29-
menu.append(toggleDevToolsItem);
30-
menu.append(inspectElementItem);
29+
30+
restoreMenu();
3131

3232
window.addEventListener('contextmenu', (e) => {
3333
e.preventDefault();
3434
rightClickPosition = {x: e.x, y: e.y};
3535
menu.popup(remote.getCurrentWindow());
3636
}, false);
37+
38+
function restoreMenu() {
39+
menu = new Menu();
40+
menu.append(toggleDevToolsItem);
41+
menu.append(inspectElementItem);
42+
}

browser/pages/confirm/confirm.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<p class="installation-note has-spinner" ng-show="confCtrl.numberOfExistingInstallations>0">
1010
<span class="pficon-info"></span>{{confCtrl.installedSearchNote}}
1111
</p>
12+
1213
<p id="instructions" class="installation-note">Select the components to install</p>
1314

1415
<div ng-repeat="item in checkboxModel">

browser/pages/confirm/controller.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,34 @@ class ConfirmController {
3131
});
3232
}
3333

34+
const selectAllLabel = 'Select All Components';
35+
36+
menu.insert(0, new MenuItem({
37+
label: selectAllLabel,
38+
click: ()=> {
39+
this.sc.$apply(this.selectAll.bind(this));
40+
}
41+
}));
42+
43+
const deselectAllLabel = 'Deselect All Components';
44+
45+
46+
menu.insert(1, new MenuItem({
47+
label: deselectAllLabel,
48+
click: ()=> {
49+
this.sc.$apply(this.deselectAll.bind(this));
50+
}
51+
}));
52+
53+
menu.insert(2, new MenuItem({
54+
label: deselectAllLabel,
55+
type: 'separator'
56+
}));
57+
58+
$scope.$on('$destroy', ()=>{
59+
restoreMenu();
60+
})
61+
3462
$scope.isConfigurationValid = this.isConfigurationValid;
3563

3664
$scope.$watch('$viewContentLoaded', ()=>{
@@ -45,6 +73,23 @@ class ConfirmController {
4573
});
4674
}
4775

76+
selectAll() {
77+
let checkboxModel = this.sc.checkboxModel;
78+
for (let key in checkboxModel) {
79+
let node = checkboxModel[key];
80+
if (node.isInstallable && node.isNotDetected()) {
81+
node.selectedOption = 'install';
82+
}
83+
}
84+
}
85+
86+
deselectAll() {
87+
let checkboxModel = this.sc.checkboxModel;
88+
for (let key in checkboxModel) {
89+
checkboxModel[key].selectedOption = 'detected';
90+
}
91+
}
92+
4893
initPage() {
4994
return this.detectInstalledComponents().then(()=> {
5095
this.graph = ComponentLoader.loadGraph(this.installerDataSvc);

requirements.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@
165165
"description": "An agile, lightweight and modern integration platform (installed on JBoss EAP)",
166166
"vendor": "Red Hat, Inc.",
167167
"modulePath": "model/jbossfuse",
168+
"installable": true,
168169
"bundle": "no",
169170
"targetFolderName": "jboss-fuse-eap",
170171
"installAfter": "jdk",
@@ -194,6 +195,7 @@
194195
"description": "An agile, lightweight and modern integration platform (installed on Apache Karaf package)",
195196
"vendor": "Red Hat, Inc.",
196197
"modulePath": "model/jbossfusekaraf",
198+
"installable": true,
197199
"bundle": "no",
198200
"targetFolderName": "jboss-fuse-karaf",
199201
"installAfter": "jdk",

test/unit/pages/confirm/controller-test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ require('browser/main');
1515

1616
chai.use(sinonChai);
1717

18+
global.menu = {insert(){}};
19+
global.MenuItem = function () {};
20+
global.restoreMenu = function() {};
21+
1822
describe('ConfirmController', function() {
1923

2024
beforeEach(function() {

0 commit comments

Comments
 (0)