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

Issue openam#205 Upgrade jQuery to new version #14

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
5 changes: 5 additions & 0 deletions forgerock-ui-commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,11 @@
<type>js</type>
<classifier>min</classifier>
</dependency>
<dependency>
<groupId>jp.openam.commons.ui.libs</groupId>
<artifactId>jquery-migrate</artifactId>
<type>js</type>
</dependency>
<dependency>
<groupId>jp.openam.commons.ui.libs</groupId>
<artifactId>lodash</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

define([
"jquery",
"jquery-migrate",
"lodash",
"org/forgerock/commons/ui/common/util/Constants",
"org/forgerock/commons/ui/common/main/EventManager"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

define([
"jquery"
"jquery-migrate"
], function($) {
var obj = {
"required": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

define([
"jquery",
"jquery-migrate",
"underscore",
"org/forgerock/commons/ui/common/components/BootstrapDialog",
"org/forgerock/commons/ui/common/util/UIUtils",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2011-2016 ForgeRock AS.
* Portions Copyrighted 2020 Open Source Solution Technology Corporation
*/

define([
Expand Down Expand Up @@ -60,9 +61,9 @@ define([
this.$el.find("input[name=login]").val(login).prop('autofocus', false);
this.$el.find("[name=loginRemember]").prop("checked",true);
validatorsManager.validateAllFields(this.$el);
this.$el.find("[name=password]").focus();
this.$el.find("[name=password]").trigger("focus");
} else {
this.$el.find("input[name=login]").focus();
this.$el.find("input[name=login]").trigger("focus");
}

if (callback) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

define([
"jquery",
"jquery-migrate",
"underscore",
"org/forgerock/commons/ui/common/main/AbstractConfigurationAware",
"org/forgerock/commons/ui/common/util/Constants",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

define([
"jquery",
"jquery-migrate",
"backgrid"
], function ($, Backgrid) {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* new Backgrid.Extension.ThemeablePaginator({ ... });
*/
define([
"jquery",
"jquery-migrate",
"backgrid.paginator",
"org/forgerock/commons/ui/common/backgrid/Backgrid"
], function ($, BackgridPaginator, Backgrid) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* new Backgrid.Extension.ThemeableServerSideFilter({ ... });
*/
define([
"jquery",
"jquery-migrate",
"underscore",
"backgrid-filter",
"org/forgerock/commons/ui/common/backgrid/Backgrid"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2015-2016 ForgeRock AS.
* Portions Copyrighted 2020 Open Source Solution Technology Corporation
*/

define([
"underscore",
"jquery",
"jquery-migrate",
"bootstrap-dialog"
], function (_, $, BootstrapDialog) {

function forceFocus (dialog) {
dialog.$modalContent.find("[autofocus]").focus();
dialog.$modalContent.find("[autofocus]").trigger("focus");
}

function setButtonStates (dialog) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

define([
"jquery",
"jquery-migrate",
"underscore",
"org/forgerock/commons/ui/common/main/AbstractView",
"org/forgerock/commons/ui/common/util/ModuleLoader",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

define([
"jquery",
"jquery-migrate",
"underscore",
"backbone"
], function($, _, Backbone) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

define([
"jquery",
"jquery-migrate",
"underscore",
"org/forgerock/commons/ui/common/main/AbstractView"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

define([
"jquery",
"jquery-migrate",
"org/forgerock/commons/ui/common/components/Dialog",
"org/forgerock/commons/ui/common/components/BootstrapDialogView"
], function($, Dialog, BootstrapDialogView) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

define([
"jquery",
"jquery-migrate",
"underscore",
"org/forgerock/commons/ui/common/main/AbstractView",
"org/forgerock/commons/ui/common/util/UIUtils",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

define([
"jquery",
"jquery-migrate",
"underscore",
"backbone",
"org/forgerock/commons/ui/common/main/AbstractConfigurationAware"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

define([
"jquery",
"jquery-migrate",
"underscore",
"backbone",
"org/forgerock/commons/ui/common/main/AbstractConfigurationAware",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

define([
"jquery"
"jquery-migrate"
], function($) {

var obj = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

define([
"jquery",
"jquery-migrate",
"underscore",
"backbone",
"backbone.paginator",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

define([
"jquery",
"jquery-migrate",
"lodash",
"org/forgerock/commons/ui/common/util/ModuleLoader"
], function($, _, ModuleLoader) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

define([
"jquery",
"jquery-migrate",
"underscore",
"backbone",
"org/forgerock/commons/ui/common/util/ObjectUtil",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2011-2016 ForgeRock AS.
* Portions Copyrighted 2020 Open Source Solution Technology Corporation
*/

define([
"jquery",
"jquery-migrate",
"underscore",
"backbone",
"org/forgerock/commons/ui/common/main/Configuration",
Expand Down Expand Up @@ -139,7 +140,7 @@ define([
};

this.setElement($(this.element));
this.$el.unbind();
this.$el.off();
this.delegateEvents();

if (Configuration.baseTemplate !== this.baseTemplate && !this.noBaseTemplate) {
Expand All @@ -161,7 +162,7 @@ define([

rebind: function() {
this.setElement($(this.element));
this.$el.unbind();
this.$el.off();
this.delegateEvents();
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2012-2016 ForgeRock AS.
* Portions Copyrighted 2020 Open Source Solution Technology Corporation
*/

define([
"underscore",
"jquery",
"jquery-migrate",
"org/forgerock/commons/ui/common/main/AbstractConfigurationAware",
"org/forgerock/commons/ui/common/main/EventManager",
"org/forgerock/commons/ui/common/util/Constants"
Expand All @@ -32,7 +33,7 @@ define([

if (error.hasOwnProperty('responseText')) {
try {
error.responseObj = $.parseJSON(error.responseText);
error.responseObj = JSON.parse(error.responseText);
} catch (parseErr) { /* Must not be JSON */ }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

define([
"jquery",
"jquery-migrate",
"underscore"
], function($, _) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

define([
"jquery",
"jquery-migrate",
"underscore",
"org/forgerock/commons/ui/common/util/Constants",
"org/forgerock/commons/ui/common/main/EventManager",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2011-2016 ForgeRock AS.
* Portions copyright 2020 Open Source Solution Technology Corporation
*/

define([
"jquery",
"jquery-migrate",
"underscore",
"org/forgerock/commons/ui/common/main/AbstractConfigurationAware",
"org/forgerock/commons/ui/common/util/Constants",
Expand Down Expand Up @@ -55,7 +56,7 @@ define([
rejectHandler;

resolveHandler = function () {
promise.resolve.apply(promise, arguments);
return promise.resolve.apply(promise, arguments);
};

rejectHandler = function (jqXHR, textStatus, errorThrown) {
Expand All @@ -66,7 +67,7 @@ define([
// logged-in, resubmit their original request. Only do this if there
// isn't an errorsHandler for 401 included in the request.
if (jqXHR.status === 401 && !ErrorsHandler.matchError({status:401},options.errorsHandlers)) {
EventManager.sendEvent(Constants.EVENT_SHOW_LOGIN_DIALOG, {
return EventManager.sendEvent(Constants.EVENT_SHOW_LOGIN_DIALOG, {
authenticatedCallback : function () {
$.ajax(options).then(resolveHandler,rejectHandler);
}
Expand All @@ -79,11 +80,11 @@ define([
errorsHandlers: options.errorsHandlers
});
if(errorCallback) { errorCallback(jqXHR); }
promise.reject.apply(promise, arguments);
return promise.reject.apply(promise, arguments);
}
} else {
if(errorCallback) { errorCallback(jqXHR); }
promise.reject.apply(promise, arguments);
return promise.reject.apply(promise, arguments);
}

};
Expand All @@ -100,12 +101,6 @@ define([

obj.applyDefaultHeadersIfNecessary(options, obj.configuration.defaultHeaders);

if (!options.suppressEvents) {
EventManager.sendEvent(Constants.EVENT_START_REST_CALL, {
suppressSpinner: options.suppressSpinner
});
}

options.success = function (data, textStatus, jqXHR) {
if(data && data.error) {
if (!options.suppressEvents) {
Expand Down Expand Up @@ -159,9 +154,15 @@ define([
options.headers["Cache-Control"] = "no-cache";
}

$.ajax(options).then(resolveHandler,rejectHandler);

return promise;
if (!options.suppressEvents) {
return EventManager.sendEvent(Constants.EVENT_START_REST_CALL, {
suppressSpinner: options.suppressSpinner
}).then(function () {
return $.ajax(options).then(resolveHandler,rejectHandler);
});
} else {
return $.ajax(options).then(resolveHandler,rejectHandler);
}
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

define([
"jquery",
"jquery-migrate",
"underscore",
"org/forgerock/commons/ui/common/util/CookieHelper",
"org/forgerock/commons/ui/common/main/AbstractConfigurationAware",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2011-2016 ForgeRock AS.
* Portions copyright 2020 Open Source Solution Technology Corporation
*/

define([
"jquery",
"jquery-migrate",
"spin"
], function($, Spinner) {

Expand All @@ -27,11 +28,6 @@ define([
}

obj.spinner = new Spinner().spin(document.getElementById('wrapper'));
$(".spinner").position({
of: $(window),
my: "center center",
at: "center center"
});

if (priority && (!obj.priority || priority > obj.priority)) {
obj.priority = priority;
Expand Down
Loading