summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Vomacka <pvomacka@redhat.com>2016-04-29 15:02:18 +0200
committerPetr Vobornik <pvoborni@redhat.com>2016-06-03 16:18:26 +0200
commitb16e59bdaa4acba7b8a190a4ca32b7a113b32cd1 (patch)
treecd5c5d27b8b4134c3d393b06561601da5c02263e
parent46e3245fdedbf88050fffa6039d176914c242418 (diff)
downloadfreeipa-b16e59bdaa4acba7b8a190a4ca32b7a113b32cd1.tar.gz
freeipa-b16e59bdaa4acba7b8a190a4ca32b7a113b32cd1.tar.xz
freeipa-b16e59bdaa4acba7b8a190a4ca32b7a113b32cd1.zip
Change lang.hitch to javascript bind method
Also remove the dojo/_base/lang module in cases it is not needed any more. https://fedorahosted.org/freeipa/ticket/5702 Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
-rw-r--r--install/ui/src/freeipa/Application_controller.js33
-rw-r--r--install/ui/src/freeipa/FormMixin.js7
-rw-r--r--install/ui/src/freeipa/_base/Phase_controller.js13
-rw-r--r--install/ui/src/freeipa/app_container.js42
-rw-r--r--install/ui/src/freeipa/dialog.js14
-rw-r--r--install/ui/src/freeipa/facets/Facet.js4
-rw-r--r--install/ui/src/freeipa/navigation/Router.js5
-rw-r--r--install/ui/src/freeipa/plugin_loader.js10
-rw-r--r--install/ui/src/freeipa/plugins/api_browser.js13
-rw-r--r--install/ui/src/freeipa/topology.js32
-rw-r--r--install/ui/src/freeipa/topology_graph.js2
-rw-r--r--install/ui/src/freeipa/widgets/APIBrowserWidget.js10
-rw-r--r--install/ui/src/freeipa/widgets/ActionDropdownWidget.js11
-rw-r--r--install/ui/src/freeipa/widgets/App.js9
-rw-r--r--install/ui/src/freeipa/widgets/DropdownWidget.js4
-rw-r--r--install/ui/src/freeipa/widgets/LoginScreen.js27
-rw-r--r--install/ui/src/freeipa/widgets/LoginScreenBase.js9
-rw-r--r--install/ui/src/freeipa/widgets/Menu.js15
-rw-r--r--install/ui/src/freeipa/widgets/SyncOTPScreen.js13
-rw-r--r--install/ui/src/freeipa/widgets/browser_widgets.js6
20 files changed, 134 insertions, 145 deletions
diff --git a/install/ui/src/freeipa/Application_controller.js b/install/ui/src/freeipa/Application_controller.js
index 5c040e4a0..43d5409ce 100644
--- a/install/ui/src/freeipa/Application_controller.js
+++ b/install/ui/src/freeipa/Application_controller.js
@@ -20,7 +20,6 @@
define([
'dojo/_base/declare',
- 'dojo/_base/lang',
'dojo/_base/array',
'dojo/Deferred',
'dojo/on',
@@ -39,7 +38,7 @@ define([
'./navigation/menu_spec',
'./plugins/load_page'
],
- function(declare, lang, array, Deferred, on, topic, query, dom_class, auth,
+ function(declare, array, Deferred, on, topic, query, dom_class, auth,
JSON, App_widget, FacetContainer, IPA, reg, Menu, Router, routing, menu_spec) {
/**
@@ -107,18 +106,18 @@ define([
}
};
- on(this.app_widget.menu_widget, 'item-select', lang.hitch(this, this.on_menu_click));
- on(this.app_widget, 'profile-click', lang.hitch(this, this.on_profile));
- on(this.app_widget, 'logout-click', lang.hitch(this, this.on_logout));
- on(this.app_widget, 'password-reset-click', lang.hitch(this, this.on_password_reset));
- on(this.app_widget, 'about-click', lang.hitch(this, this.on_about));
+ on(this.app_widget.menu_widget, 'item-select', this.on_menu_click.bind(this));
+ on(this.app_widget, 'profile-click', this.on_profile.bind(this));
+ on(this.app_widget, 'logout-click', this.on_logout.bind(this));
+ on(this.app_widget, 'password-reset-click', this.on_password_reset.bind(this));
+ on(this.app_widget, 'about-click', this.on_about.bind(this));
- on(this.router, 'facet-show', lang.hitch(this, this.on_facet_show));
- on(this.router, 'facet-change', lang.hitch(this, this.on_facet_change));
- on(this.router, 'facet-change-canceled', lang.hitch(this, this.on_facet_canceled));
- on(this.router, 'error', lang.hitch(this, this.on_router_error));
- topic.subscribe('phase-error', lang.hitch(this, this.on_phase_error));
- topic.subscribe('authenticate', lang.hitch(this, this.on_authenticate));
+ on(this.router, 'facet-show', this.on_facet_show.bind(this));
+ on(this.router, 'facet-change', this.on_facet_change.bind(this));
+ on(this.router, 'facet-change-canceled', this.on_facet_canceled.bind(this));
+ on(this.router, 'error', this.on_router_error.bind(this));
+ topic.subscribe('phase-error', this.on_phase_error.bind(this));
+ topic.subscribe('authenticate', this.on_authenticate.bind(this));
this.app_widget.render();
this.app_widget.hide();
@@ -282,13 +281,13 @@ define([
if (current_facet === new_facet) return;
if (current_facet && !current_facet.can_leave()) {
- var permit_clb = lang.hitch(this, function() {
+ var permit_clb = function() {
// Some facet's might not call reset before this call but after
// so they are still dirty. Calling reset prevent's opening of
// dirty dialog again.
if (current_facet.is_dirty()) current_facet.reset(); //TODO change
this.router.navigate_to_hash(event.hash, event.facet);
- });
+ }.bind(this);
var dialog = current_facet.show_leave_dialog(permit_clb);
this.router.canceled = true;
@@ -338,7 +337,7 @@ define([
// show facet
if (!facet.container_node) {
facet.container_node = container.widget.content_node;
- on(facet, 'facet-state-change', lang.hitch(this, this.on_facet_state_changed));
+ on(facet, 'facet-state-change', this.on_facet_state_changed.bind(this));
}
if (this.current_facet !== facet) {
@@ -503,4 +502,4 @@ define([
});
return App;
-}); \ No newline at end of file
+});
diff --git a/install/ui/src/freeipa/FormMixin.js b/install/ui/src/freeipa/FormMixin.js
index ef594733a..a10691243 100644
--- a/install/ui/src/freeipa/FormMixin.js
+++ b/install/ui/src/freeipa/FormMixin.js
@@ -19,13 +19,12 @@
*/
define(['dojo/_base/declare',
- 'dojo/_base/lang',
'dojo/on',
'./builder',
'./field',
'./ordered-map'
],
- function(declare, lang, on, builder, field_mod, ordered_map) {
+ function(declare, on, builder, field_mod, ordered_map) {
/**
* Form mixin
@@ -120,7 +119,7 @@ define(['dojo/_base/declare',
*/
register_field_listeners: function(field) {
- on(field, 'dirty-change', lang.hitch(this, this.on_field_dirty_change));
+ on(field, 'dirty-change', this.on_field_dirty_change.bind(this));
},
/**
@@ -201,4 +200,4 @@ define(['dojo/_base/declare',
});
return FormMixin;
-}); \ No newline at end of file
+});
diff --git a/install/ui/src/freeipa/_base/Phase_controller.js b/install/ui/src/freeipa/_base/Phase_controller.js
index 9147f201a..faf385fc1 100644
--- a/install/ui/src/freeipa/_base/Phase_controller.js
+++ b/install/ui/src/freeipa/_base/Phase_controller.js
@@ -19,14 +19,13 @@
*/
define([
- 'dojo/_base/lang',
'dojo/_base/array',
'dojo/_base/declare',
'dojo/Deferred',
'dojo/promise/all',
'dojo/topic',
'../ordered-map'
-], function(lang, array, declare, Deferred, all, topic, ordered_map) {
+], function(array, declare, Deferred, all, topic, ordered_map) {
/**
@@ -138,13 +137,13 @@ define([
promises.push(promise);
});
- all(promises).then(lang.hitch(this, function(results) {
+ all(promises).then(function(results) {
topic.publish('phase-finished',
{ phase: phase.name, results: results });
if (next_phase) {
this.next_phase(next_phase);
}
- }), function(results) {
+ }.bind(this), function(results) {
topic.publish('phase-error',
{ phase: phase.name, results: results });
// don't go for next phase on error, let app decide what to do
@@ -248,12 +247,12 @@ define([
this.phases = ordered_map();
var phases = spec.phases || [];
- array.forEach(phases, lang.hitch(this, function(phase) {
+ array.forEach(phases, function(phase) {
this.add_phase(phase);
- }));
+ }.bind(this));
}
});
return Phase_controller;
-}); \ No newline at end of file
+});
diff --git a/install/ui/src/freeipa/app_container.js b/install/ui/src/freeipa/app_container.js
index bbe57ac97..9717dd76e 100644
--- a/install/ui/src/freeipa/app_container.js
+++ b/install/ui/src/freeipa/app_container.js
@@ -55,13 +55,13 @@ define([
*/
register_phases: function() {
- phases.on('init', lang.hitch(this, function() {
+ phases.on('init', function() {
var app = this.app = new this.App_class();
app.init();
return app;
- }));
+ }.bind(this));
- phases.on('init', lang.hitch(this, function() {
+ phases.on('init', function() {
var deferred = new Deferred();
function reject(item) {
@@ -96,9 +96,9 @@ define([
deferred.resolve();
}
return deferred.promise;
- }));
+ }.bind(this));
- phases.on('metadata', lang.hitch(this, function() {
+ phases.on('metadata', function() {
var deferred = new Deferred();
this.app.get_configuration(function(success) {
@@ -108,30 +108,30 @@ define([
});
return deferred.promise;
- }));
+ }.bind(this));
- phases.on('profile', lang.hitch(this, function() {
+ phases.on('profile', function() {
this.app.choose_profile();
- }));
+ }.bind(this));
- phases.on('runtime', lang.hitch(this, function() {
+ phases.on('runtime', function() {
return this.app.start_runtime();
- }));
+ }.bind(this));
- phases.on('shutdown', lang.hitch(this, function() {
+ phases.on('shutdown', function() {
return this.app.start_logout();
- }));
+ }.bind(this));
},
simple_mode_phases: function() {
- phases.on('init', lang.hitch(this, function() {
+ phases.on('init', function() {
var app = this.app = new this.App_class();
app.init();
return app;
- }));
+ }.bind(this));
- phases.on('runtime', lang.hitch(this, function() {
+ phases.on('runtime', function() {
var d = new Deferred();
var facet = reg.facet.get(this.target_facet);
if (!facet) {
@@ -140,24 +140,24 @@ define([
this.app.show_facet(facet);
}
return d.promise;
- }));
+ }.bind(this));
},
run: function() {
- when(plugin_loader.load_plugins(), lang.hitch(this, function() {
+ when(plugin_loader.load_plugins(), function() {
this.register_phases();
phases.controller.run();
- }));
+ }.bind(this));
},
run_simple: function(facet) {
this.target_facet = facet;
- when(plugin_loader.load_plugins(), lang.hitch(this, function() {
+ when(plugin_loader.load_plugins(), function() {
this.simple_mode_phases();
phases.controller.run();
- }));
+ }.bind(this));
}
});
return app;
-}); \ No newline at end of file
+});
diff --git a/install/ui/src/freeipa/dialog.js b/install/ui/src/freeipa/dialog.js
index 2a2fe0284..3d156ce10 100644
--- a/install/ui/src/freeipa/dialog.js
+++ b/install/ui/src/freeipa/dialog.js
@@ -155,13 +155,13 @@ IPA.opened_dialogs = {
this.app = app;
this.handlers.push(topic.subscribe('dialog.open',
- lang.hitch(this, this.on_dialog_open)));
+ this.on_dialog_open.bind(this)));
this.handlers.push(topic.subscribe('dialog.opened',
- lang.hitch(this, this.on_dialog_opened)));
+ this.on_dialog_opened.bind(this)));
this.handlers.push(topic.subscribe('dialog.closed',
- lang.hitch(this, this.on_dialog_closed)));
+ this.on_dialog_closed.bind(this)));
}
};
@@ -573,11 +573,11 @@ IPA.dialog = function(spec) {
this.emit('open', { source: that });
topic.publish('dialog.open', { source: that });
- this.show(lang.hitch(this, function() {
+ this.show(function() {
that.focus_first_element();
that.emit('opened', { source: that });
topic.publish('dialog.opened', { source: that });
- }));
+ }.bind(this));
};
/**
@@ -673,12 +673,12 @@ IPA.dialog = function(spec) {
if (!that.dom_node) return;
var dom_node = that.dom_node;
- this.hide(lang.hitch(this, function() {
+ this.hide(function() {
dom_node.remove();
that.dom_node = null;
that.emit('closed', { source: that });
topic.publish('dialog.closed', { source: that });
- }));
+ }.bind(this));
};
/**
diff --git a/install/ui/src/freeipa/facets/Facet.js b/install/ui/src/freeipa/facets/Facet.js
index fb4b8a78c..2451041f7 100644
--- a/install/ui/src/freeipa/facets/Facet.js
+++ b/install/ui/src/freeipa/facets/Facet.js
@@ -349,9 +349,9 @@ define(['dojo/_base/declare',
this.requires_auth = spec.requires_auth;
}
this.state = new mod_facet.FacetState();
- on(this.state, 'set', lang.hitch(this, this.on_state_set));
+ on(this.state, 'set', this.on_state_set.bind(this));
}
});
return Facet;
-}); \ No newline at end of file
+});
diff --git a/install/ui/src/freeipa/navigation/Router.js b/install/ui/src/freeipa/navigation/Router.js
index 5523993f4..169fa6478 100644
--- a/install/ui/src/freeipa/navigation/Router.js
+++ b/install/ui/src/freeipa/navigation/Router.js
@@ -19,11 +19,10 @@
*/
define(['dojo/_base/declare',
- 'dojo/_base/lang',
'dojo/Evented',
'dojo/router'
],
- function(declare, lang, Evented, router) {
+ function(declare, Evented, router) {
/**
* Router
@@ -81,7 +80,7 @@ define(['dojo/_base/declare',
}
} else {
var r = this.route_prefix + route;
- this.route_handlers.push(router.register(r, lang.hitch(this, handler)));
+ this.route_handlers.push(router.register(r, handler.bind(this)));
}
},
diff --git a/install/ui/src/freeipa/plugin_loader.js b/install/ui/src/freeipa/plugin_loader.js
index de3bc4357..43eca9b72 100644
--- a/install/ui/src/freeipa/plugin_loader.js
+++ b/install/ui/src/freeipa/plugin_loader.js
@@ -77,23 +77,23 @@ define([
var plugins_loaded = new Deferred();
- require(['freeipa/plugins'], lang.hitch(this, function(plugins) {
+ require(['freeipa/plugins'], function(plugins) {
var loading = [];
this.register_plugins(plugins);
- array.forEach(plugins, lang.hitch(this, function(plugin) {
+ array.forEach(plugins, function(plugin) {
loading.push(this.load_plugin(plugin));
- }));
+ }.bind(this));
all(loading).then(function(results) {
plugins_loaded.resolve(results);
});
- }));
+ }.bind(this));
return plugins_loaded.promise;
}
};
return plugin_loader;
-}); \ No newline at end of file
+});
diff --git a/install/ui/src/freeipa/plugins/api_browser.js b/install/ui/src/freeipa/plugins/api_browser.js
index 88dbe59c7..6fe2ee539 100644
--- a/install/ui/src/freeipa/plugins/api_browser.js
+++ b/install/ui/src/freeipa/plugins/api_browser.js
@@ -3,7 +3,6 @@
//
define(['dojo/_base/declare',
- 'dojo/_base/lang',
'dojo/on',
'../facets/Facet',
'../phases',
@@ -13,7 +12,7 @@ define(['dojo/_base/declare',
'../builder'
],
- function(declare, lang, on, Facet, phases, reg, widget,
+ function(declare, on, Facet, phases, reg, widget,
APIBrowserWidget, builder) {
@@ -54,7 +53,7 @@ plugins.api_browser.APIBrowserFacet = declare([Facet], {
this.inherited(arguments);
var browser = this.get_widget('apibrowser');
- on(this, 'show', lang.hitch(this, function(args) {
+ on(this, 'show', function(args) {
var state = this.get_state();
var t = state.type;
@@ -74,16 +73,16 @@ plugins.api_browser.APIBrowserFacet = declare([Facet], {
}
browser.show_default();
return;
- }));
+ }.bind(this));
// Reflect item change in facet state and therefore URL hash
- browser.watch('current', lang.hitch(this, function(name, old, value) {
+ browser.watch('current', function(name, old, value) {
var state = {};
if (value.type && value.name) {
state = { type: value.type, name: value.name };
}
this.set_state(state);
- }));
+ }.bind(this));
}
});
@@ -103,4 +102,4 @@ phases.on('registration', function() {
return plugins.api_browser;
-}); \ No newline at end of file
+});
diff --git a/install/ui/src/freeipa/topology.js b/install/ui/src/freeipa/topology.js
index c534ec5ca..c26dc6853 100644
--- a/install/ui/src/freeipa/topology.js
+++ b/install/ui/src/freeipa/topology.js
@@ -433,16 +433,16 @@ topology.TopologyGraphFacet = declare([Facet, ActionMixin, HeaderMixin], {
var graph = this.get_widget('topology-graph');
var listener = this.resize_listener.bind(this, graph);
- on(this, 'show', lang.hitch(this, function(args) {
+ on(this, 'show', function(args) {
var size = this.calculate_canvas_size();
graph.update(size);
$(window).on('resize', null, listener);
- }));
+ }.bind(this));
- on(graph, 'link-selected', lang.hitch(this, function(data) {
+ on(graph, 'link-selected', function(data) {
this.set_selected_link(data.link);
- }));
+ }.bind(this));
on(this, 'hide', function () {
$(window).off('resize', null, listener);
@@ -662,11 +662,11 @@ topology.TopologyGraphWidget = declare([Stateful, Evented], {
sizelimit: 0
}
}).execute();
- when(s_promise, lang.hitch(this, function(results) {
+ when(s_promise, function(results) {
// suffixes load success
var servers = results.data.result.result;
deferred.resolve(servers);
- }), function(results) {
+ }.bind(this), function(results) {
deferred.reject({
message: 'unable to load servers',
results: results
@@ -701,7 +701,7 @@ topology.TopologyGraphWidget = declare([Stateful, Evented], {
var suff_promise = get_suffixes();
- when(suff_promise, lang.hitch(this, function(results) {
+ when(suff_promise, function(results) {
// suffixes load success
var suffixes = results.data.result.result;
var segment_promises = [];
@@ -710,26 +710,26 @@ topology.TopologyGraphWidget = declare([Stateful, Evented], {
var promise = get_segments(suffix['cn'][0]);
segment_promises.push(promise);
}
- all(segment_promises).then(lang.hitch(this, function(results) {
+ all(segment_promises).then(function(results) {
// segments load success
for (var j=0,l=results.length; j<l; j++) {
suffixes[j].segments = results[j].data.result.result;
}
deferred.resolve(suffixes);
- }), lang.hitch(this, function(results) {
+ }.bind(this), function(results) {
// segments load failed
deferred.reject({
message: 'unable to load segments',
results: results
});
- }));
- }), lang.hitch(this, function(results) {
+ }.bind(this));
+ }.bind(this), function(results) {
// suffix load failed
deferred.reject({
message: 'unable to load suffixes',
results: results
});
- }));
+ }.bind(this));
return deferred.promise;
},
@@ -818,10 +818,10 @@ topology.TopologyGraphWidget = declare([Stateful, Evented], {
var segments = this._get_suffixes();
var masters = this._get_servers();
- all([masters, segments]).then(lang.hitch(this, function(raw) {
+ all([masters, segments]).then(function(raw) {
var data = this._transform_data(raw[0], raw[1]);
deferred.resolve(data);
- }), function(error) {
+ }.bind(this), function(error) {
deferred.reject(error);
});
@@ -836,7 +836,7 @@ topology.TopologyGraphWidget = declare([Stateful, Evented], {
if (IPA.domain_level < topology.required_domain_level) return;
- when(this._get_data()).then(lang.hitch(this, function(data) {
+ when(this._get_data()).then(function(data) {
if (!this.graph) {
this.graph = new topology_graph.TopoGraph({
nodes: data.nodes,
@@ -854,7 +854,7 @@ topology.TopologyGraphWidget = declare([Stateful, Evented], {
}
this.graph.update(data.nodes, data.links, data.suffixes);
}
- }), function(error) {
+ }.bind(this), function(error) {
IPA.notify(error.message, 'error');
});
},
diff --git a/install/ui/src/freeipa/topology_graph.js b/install/ui/src/freeipa/topology_graph.js
index 1c0a92eea..332411f94 100644
--- a/install/ui/src/freeipa/topology_graph.js
+++ b/install/ui/src/freeipa/topology_graph.js
@@ -149,7 +149,7 @@ topology_graph.TopoGraph = declare([Evented], {
l.size([this.width, this.height]);
l.linkDistance(150);
l.charge(-1000);
- l.on('tick', lang.hitch(this, this._tick));
+ l.on('tick', this._tick.bind(this));
var that = this;
diff --git a/install/ui/src/freeipa/widgets/APIBrowserWidget.js b/install/ui/src/freeipa/widgets/APIBrowserWidget.js
index 149a22fff..1a3726190 100644
--- a/install/ui/src/freeipa/widgets/APIBrowserWidget.js
+++ b/install/ui/src/freeipa/widgets/APIBrowserWidget.js
@@ -359,18 +359,18 @@ widgets.APIBrowserWidget = declare([Stateful, Evented], {
_init_widgets: function() {
this.filter_w = new browser_widgets.FilterWidget();
- this.filter_w.watch('filter', lang.hitch(this, function(name, old, value) {
+ this.filter_w.watch('filter', function(name, old, value) {
this._apply_filter(value);
- }));
+ }.bind(this));
this.list_w = new ListViewWidget();
this.object_detail_w = new browser_widgets.ObjectDetailWidget();
this.command_detail_w = new browser_widgets.CommandDetailWidget();
this.param_detail_w = new browser_widgets.ParamDetailWidget();
- on(this.list_w, 'item-click', lang.hitch(this, function(args) {
+ on(this.list_w, 'item-click', function(args) {
this._item_selected(args.context);
- }));
+ }.bind(this));
},
constructor: function(spec) {
@@ -380,4 +380,4 @@ widgets.APIBrowserWidget = declare([Stateful, Evented], {
});
return widgets.APIBrowserWidget;
-}); \ No newline at end of file
+});
diff --git a/install/ui/src/freeipa/widgets/ActionDropdownWidget.js b/install/ui/src/freeipa/widgets/ActionDropdownWidget.js
index 2ddcff64b..d4c52f475 100644
--- a/install/ui/src/freeipa/widgets/ActionDropdownWidget.js
+++ b/install/ui/src/freeipa/widgets/ActionDropdownWidget.js
@@ -18,10 +18,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
define(['dojo/_base/declare',
- 'dojo/_base/lang',
'dojo/on',
'../jquery',
- './DropdownWidget'], function(declare, lang, on, $, DropdownWidget) {
+ './DropdownWidget'], function(declare, on, $, DropdownWidget) {
return declare([DropdownWidget], {
/**
@@ -95,8 +94,8 @@ define(['dojo/_base/declare',
*/
add_action: function(action, batch) {
this.actions.put(action.name, action);
- action.enabled_changed.attach(lang.hitch(this, this.action_enabled_changed));
- action.visible_changed.attach(lang.hitch(this, this.action_visible_changed));
+ action.enabled_changed.attach(this.action_enabled_changed.bind(this));
+ action.visible_changed.attach(this.action_visible_changed.bind(this));
if (!batch) {
this.recreate_options();
@@ -146,8 +145,8 @@ define(['dojo/_base/declare',
if (action.enabled) {
action.execute(this.facet,
- lang.hitch(this, this.on_action_success),
- lang.hitch(this, this.on_action_error));
+ this.on_action_success.bind(this),
+ this.on_action_error.bind(this));
}
},
diff --git a/install/ui/src/freeipa/widgets/App.js b/install/ui/src/freeipa/widgets/App.js
index b70b14a94..21e51a705 100644
--- a/install/ui/src/freeipa/widgets/App.js
+++ b/install/ui/src/freeipa/widgets/App.js
@@ -19,7 +19,6 @@
*/
define(['dojo/_base/declare',
- 'dojo/_base/lang',
'dojo/_base/array',
'dojo/dom',
'dojo/dom-construct',
@@ -35,7 +34,7 @@ define(['dojo/_base/declare',
'../widget',
'dojo/NodeList-dom'
],
- function(declare, lang, array, dom, construct, prop, dom_class,
+ function(declare, array, dom, construct, prop, dom_class,
dom_style, query, on, Menu, DropdownWidget,
FacetContainer, text, widgets) {
@@ -280,11 +279,11 @@ define(['dojo/_base/declare',
}
]
});
- on(this.user_menu, 'item-click', lang.hitch(this, this.on_user_menu_click));
- on(this.menu_widget, 'item-select', lang.hitch(this, this.on_menu_item_click));
+ on(this.user_menu, 'item-click', this.on_user_menu_click.bind(this));
+ on(this.menu_widget, 'item-select', this.on_menu_item_click.bind(this));
}
});
return app;
-}); \ No newline at end of file
+});
diff --git a/install/ui/src/freeipa/widgets/DropdownWidget.js b/install/ui/src/freeipa/widgets/DropdownWidget.js
index 1f925a80a..a81960545 100644
--- a/install/ui/src/freeipa/widgets/DropdownWidget.js
+++ b/install/ui/src/freeipa/widgets/DropdownWidget.js
@@ -261,10 +261,10 @@ define(['dojo/_base/declare',
var ul = this._render_list(li, true);
this._render_items(item.items, ul);
} else {
- on(a, 'click', lang.hitch(this, function(event) {
+ on(a, 'click', function(event) {
this.on_item_click(event, item);
event.preventDefault();
- }));
+ }.bind(this));
}
if (container) {
diff --git a/install/ui/src/freeipa/widgets/LoginScreen.js b/install/ui/src/freeipa/widgets/LoginScreen.js
index 56b388894..29a5efc18 100644
--- a/install/ui/src/freeipa/widgets/LoginScreen.js
+++ b/install/ui/src/freeipa/widgets/LoginScreen.js
@@ -19,7 +19,6 @@
*/
define(['dojo/_base/declare',
- 'dojo/_base/lang',
'dojo/dom-construct',
'dojo/dom-style',
'dojo/query',
@@ -32,7 +31,7 @@ define(['dojo/_base/declare',
'../util',
'./LoginScreenBase'
],
- function(declare, lang, construct, dom_style, query, on,
+ function(declare, construct, dom_style, query, on,
IPA, auth, reg, FieldBinder, text, util, LoginScreenBase) {
@@ -91,7 +90,7 @@ define(['dojo/_base/declare',
name: 'sync',
label: text.get('@i18n:login.sync_otp_token', "Sync OTP Token"),
button_class: 'btn btn-link',
- click: lang.hitch(this, this.on_sync)
+ click: this.on_sync.bind(this)
})[0];
construct.place(this.sync_btn_node, container);
construct.place(document.createTextNode(" "), container);
@@ -100,7 +99,7 @@ define(['dojo/_base/declare',
name: 'login',
label: text.get('@i18n:login.login', "Login"),
'class': 'btn-primary btn-lg',
- click: lang.hitch(this, this.on_confirm)
+ click: this.on_confirm.bind(this)
})[0];
construct.place(this.login_btn_node, container);
construct.place(document.createTextNode(" "), container);
@@ -109,7 +108,7 @@ define(['dojo/_base/declare',
name: 'cancel',
label: text.get('@i18n:buttons.cancel', "Cancel"),
'class': 'btn-default',
- click: lang.hitch(this, this.on_cancel)
+ click: this.on_cancel.bind(this)
})[0];
construct.place(this.cancel_btn_node, container);
construct.place(document.createTextNode(" "), container);
@@ -118,7 +117,7 @@ define(['dojo/_base/declare',
name: 'reset',
label: text.get('@i18n:buttons.reset_password', "Reset Password"),
'class': 'btn-primary btn-lg',
- click: lang.hitch(this, this.on_confirm)
+ click: this.on_confirm.bind(this)
})[0];
construct.place(this.reset_btn_node, container);
construct.place(document.createTextNode(" "), container);
@@ -127,7 +126,7 @@ define(['dojo/_base/declare',
name: 'reset_and_login',
label: text.get('@i18n:buttons.reset_password_and_login', "Reset Password and Login"),
'class': 'btn-primary btn-lg',
- click: lang.hitch(this, this.on_confirm)
+ click: this.on_confirm.bind(this)
})[0];
construct.place(this.reset_and_login_btn_node, container);
},
@@ -148,9 +147,9 @@ define(['dojo/_base/declare',
var p_f = this.get_field('password');
var otp_f = this.get_field('otp');
- u_f.on('value-change', lang.hitch(this, this.on_form_change));
- p_f.on('value-change', lang.hitch(this, this.on_form_change));
- otp_f.on('value-change', lang.hitch(this, this.on_otp_change));
+ u_f.on('value-change', this.on_form_change.bind(this));
+ p_f.on('value-change', this.on_form_change.bind(this));
+ otp_f.on('value-change', this.on_otp_change.bind(this));
this.on_form_change();
},
@@ -208,14 +207,14 @@ define(['dojo/_base/declare',
login_with_kerberos: function() {
- IPA.get_credentials().then(lang.hitch(this, function(status) {
+ IPA.get_credentials().then(function(status) {
if (status === 200) {
this.emit('logged_in');
} else {
var val_summary = this.get_widget('validation');
val_summary.add_error('login', this.krb_auth_failed);
}
- }));
+ }.bind(this));
},
login_with_password: function() {
@@ -228,7 +227,7 @@ define(['dojo/_base/declare',
var password = password_f.get_value()[0];
IPA.login_password(login, password).then(
- lang.hitch(this, function(result) {
+ function(result) {
if (result === 'success') {
this.emit('logged_in');
@@ -249,7 +248,7 @@ define(['dojo/_base/declare',
password_f.set_value('');
val_summary.add_error('login', this.form_auth_failed);
}
- }));
+ }.bind(this));
},
login_and_reset: function() {
diff --git a/install/ui/src/freeipa/widgets/LoginScreenBase.js b/install/ui/src/freeipa/widgets/LoginScreenBase.js
index a5de44bd4..a1c986ee8 100644
--- a/install/ui/src/freeipa/widgets/LoginScreenBase.js
+++ b/install/ui/src/freeipa/widgets/LoginScreenBase.js
@@ -19,7 +19,6 @@
*/
define(['dojo/_base/declare',
- 'dojo/_base/lang',
'dojo/dom-construct',
'dojo/dom-style',
'dojo/query',
@@ -35,7 +34,7 @@ define(['dojo/_base/declare',
'../util',
'./ContainerMixin'
],
- function(declare, lang, construct, dom_style, query, on,
+ function(declare, construct, dom_style, query, on,
Evented, Stateful, IPA, auth, reg, FieldBinder, FormMixin, text,
util, ContainerMixin) {
@@ -239,8 +238,8 @@ define(['dojo/_base/declare',
// input field, but we need to listen to keydown events which are
// not exposed
var nodes = query("input[type=text],input[type=password]", this.dom_node);
- nodes.on('keypress', lang.hitch(this, this.check_caps_lock));
- nodes.on('keydown', lang.hitch(this, this.check_caps_lock_press));
+ nodes.on('keypress', this.check_caps_lock.bind(this));
+ nodes.on('keydown', this.check_caps_lock_press.bind(this));
},
/**
@@ -342,4 +341,4 @@ define(['dojo/_base/declare',
}
});
return LoginScreenBase;
-}); \ No newline at end of file
+});
diff --git a/install/ui/src/freeipa/widgets/Menu.js b/install/ui/src/freeipa/widgets/Menu.js
index df53a2aeb..131be4104 100644
--- a/install/ui/src/freeipa/widgets/Menu.js
+++ b/install/ui/src/freeipa/widgets/Menu.js
@@ -20,7 +20,6 @@
define(['dojo/_base/declare',
'dojo/_base/array',
- 'dojo/_base/lang',
'dojo/dom',
'dojo/dom-construct',
'dojo/dom-prop',
@@ -31,7 +30,7 @@ define(['dojo/_base/declare',
'dojo/Evented',
'dojo/on',
'../jquery',
- '../ipa'], function(declare, array, lang, dom, construct, prop, dom_class,
+ '../ipa'], function(declare, array, dom, construct, prop, dom_class,
dom_style, attr, query, Evented, on, $, IPA) {
return declare([Evented], {
@@ -176,9 +175,9 @@ define(['dojo/_base/declare',
if (container) {
construct.place(item_container, container);
// use jQuery resize to make use of window.resize throttling
- $(window).bind('resize', lang.hitch(this, function() {
+ $(window).bind('resize', function() {
this._adjust_size(container, item_container, level);
- }));
+ }.bind(this));
}
return item_container;
},
@@ -284,10 +283,10 @@ define(['dojo/_base/declare',
this.menu = menu;
//get all items
var q = menu.items.query();
- q.observe(lang.hitch(this, this._items_changed), true);
- on(this.menu, 'selected', lang.hitch(this, function(event) {
+ q.observe(this._items_changed.bind(this), true);
+ on(this.menu, 'selected', function(event) {
this.select(event.new_selection);
- }));
+ }.bind(this));
},
/**
@@ -329,4 +328,4 @@ define(['dojo/_base/declare',
}
}
});
-}); \ No newline at end of file
+});
diff --git a/install/ui/src/freeipa/widgets/SyncOTPScreen.js b/install/ui/src/freeipa/widgets/SyncOTPScreen.js
index f7e4fedab..09d125441 100644
--- a/install/ui/src/freeipa/widgets/SyncOTPScreen.js
+++ b/install/ui/src/freeipa/widgets/SyncOTPScreen.js
@@ -19,7 +19,6 @@
*/
define(['dojo/_base/declare',
- 'dojo/_base/lang',
'dojo/Deferred',
'dojo/dom-construct',
'dojo/dom-style',
@@ -33,7 +32,7 @@ define(['dojo/_base/declare',
'../util',
'./LoginScreenBase'
],
- function(declare, lang, Deferred, construct, dom_style, query, on,
+ function(declare, Deferred, construct, dom_style, query, on,
IPA, auth, reg, FieldBinder, text, util, LoginScreenBase) {
@@ -63,7 +62,7 @@ define(['dojo/_base/declare',
name: 'cancel',
label: 'Cancel',
'class': 'btn-default btn-lg',
- click: lang.hitch(this, this.on_cancel)
+ click: this.on_cancel.bind(this)
})[0];
if (this.allow_cancel) {
construct.place(this.cancel_btn_node, container);
@@ -71,7 +70,7 @@ define(['dojo/_base/declare',
this.sync_btn_node = IPA.button({
label: text.get('@i18n:password.sync_otp_token', "Sync OTP Token"),
'class': 'btn-primary btn-lg',
- click: lang.hitch(this, this.on_confirm)
+ click: this.on_confirm.bind(this)
})[0];
construct.place(this.sync_btn_node, container);
},
@@ -118,7 +117,7 @@ define(['dojo/_base/declare',
var token = this.get_field('token').get_value()[0];
var p = this.sync_core(user, password, otp1, otp2, token);
- p.then(lang.hitch(this, function(result) {
+ p.then( function(result) {
var msg = this.sync_fail;
var evt = 'sync-fail';
var type = 'error';
@@ -134,7 +133,7 @@ define(['dojo/_base/declare',
val_summary.add_error('sync', msg);
}
this.emit(evt, { source: this, message: msg, status: result });
- }));
+ }.bind(this));
},
sync_core: function(user, password, otp1, otp2, token) {
@@ -237,4 +236,4 @@ define(['dojo/_base/declare',
];
return SyncOTPScreen;
-}); \ No newline at end of file
+});
diff --git a/install/ui/src/freeipa/widgets/browser_widgets.js b/install/ui/src/freeipa/widgets/browser_widgets.js
index b40a183a3..57ad2bd98 100644
--- a/install/ui/src/freeipa/widgets/browser_widgets.js
+++ b/install/ui/src/freeipa/widgets/browser_widgets.js
@@ -490,14 +490,14 @@ widgets.browser_widgets.FilterWidget = declare([widgets.browser_widgets.Base], {
placeholder: 'type to filter...',
title: 'accepts case insensitive regular expression'
});
- this._filter_el.bind('input', lang.hitch(this, function() {
+ this._filter_el.bind('input', function() {
var filter = this._filter_el.val();
this.set('filter', filter);
- }));
+ }.bind(this));
this._filter_el.appendTo(this.el);
}
});
return widgets.browser_widgets;
-}); \ No newline at end of file
+});