Skip to content

Commit

Permalink
Move mpve function to be on ManageIQ instead of global
Browse files Browse the repository at this point in the history
  • Loading branch information
ZitaNemeckova committed Aug 1, 2019
1 parent 0f8c328 commit 03d6c5f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
16 changes: 6 additions & 10 deletions app/assets/javascripts/components/generic_object/assign-buttons.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* globals move */

ManageIQ.angular.app.component('assignButtons', {
bindings: {
assignedButtons: '<',
Expand All @@ -14,8 +12,6 @@ ManageIQ.angular.app.component('assignButtons', {
templateUrl: '/static/generic_object/assign-buttons.html.haml',
});


// move comes from app/javascript/helpers/move.js
function assignButtonsController() {
var vm = this;

Expand All @@ -25,7 +21,7 @@ function assignButtonsController() {
};

vm.leftButtonClicked = function() {
var ret = move.between({
var ret = ManageIQ.move.between({
from: [].concat(vm.assignedButtons),
to: [].concat(vm.unassignedButtons),
selected: vm.model.selectedAssignedButtons,
Expand All @@ -35,7 +31,7 @@ function assignButtonsController() {
};

vm.rightButtonClicked = function() {
var ret = move.between({
var ret = ManageIQ.move.between({
from: [].concat(vm.unassignedButtons),
to: [].concat(vm.assignedButtons),
selected: vm.model.selectedUnassignedButtons,
Expand All @@ -55,9 +51,9 @@ function assignButtonsController() {
};
}

vm.topButtonClicked = wrap(move.top);
vm.bottomButtonClicked = wrap(move.bottom);
vm.topButtonClicked = wrap(ManageIQ.move.top);
vm.bottomButtonClicked = wrap(ManageIQ.move.bottom);

vm.upButtonClicked = wrap(move.up);
vm.downButtonClicked = wrap(move.down);
vm.upButtonClicked = wrap(ManageIQ.move.up);
vm.downButtonClicked = wrap(ManageIQ.move.down);
}
2 changes: 2 additions & 0 deletions app/assets/javascripts/miq_global.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ if (!window.ManageIQ) {
x: null, // mouse X coordinate for popup menu
y: null, // mouse Y coordinate for popup menu
},
move: { //methods to move elements between Arrays or in an Array
},
noCollapseEvent: false, // enable/disable events fired after collapsing an accordion
observe: { // keeping track of data-miq_observe requests
processing: false, // is a request currently being processed?
Expand Down
3 changes: 3 additions & 0 deletions app/javascript/packs/application-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,6 @@ window.Spinner = Spinner;

// Overview > Optimization
miqOptimizationInit();

import * as move from '../helpers/move.js';
ManageIQ.move = move;
2 changes: 0 additions & 2 deletions app/javascript/packs/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,3 @@ require('codemirror/mode/xml/xml.js');
require('codemirror/mode/yaml/yaml.js');
require('codemirror/lib/codemirror.css');
require('codemirror/theme/eclipse.css');
import * as move from '../helpers/move.js';
window.move = move;

0 comments on commit 03d6c5f

Please sign in to comment.