Skip to content

Commit 501a287

Browse files
committed
ACP2E-3862: Partial update of copyrights for CE for file types 'php', 'phtml', 'html', 'js'
1 parent 419868d commit 501a287

File tree

1 file changed

+154
-155
lines changed
  • app/code/Magento/AdminAnalytics/view/adminhtml/web/js/modal

1 file changed

+154
-155
lines changed

app/code/Magento/AdminAnalytics/view/adminhtml/web/js/modal/component.js

Lines changed: 154 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -10,178 +10,177 @@ define([
1010
'uiRegistry',
1111
'analyticsPopupConfig'
1212
],
13-
function (_, $, Modal, registry, analyticsPopupConfig) {
14-
'use strict';
15-
16-
return Modal.extend(
17-
{
18-
defaults: {
19-
imports: {
20-
enableLogAction: '${ $.provider }:data.enableLogAction',
21-
disableLogAction: '${ $.provider }:data.disableLogAction'
22-
},
23-
options: {},
24-
notificationWindow: null
13+
function (_, $, Modal, registry, analyticsPopupConfig) {
14+
'use strict'; // eslint-disable-line strict
15+
16+
return Modal.extend(
17+
{
18+
defaults: {
19+
imports: {
20+
enableLogAction: '${ $.provider }:data.enableLogAction',
21+
disableLogAction: '${ $.provider }:data.disableLogAction'
2522
},
26-
27-
/**
28-
* Initializes modal on opened function
29-
*/
30-
initModal: function () {
31-
this.options.opened = this.onOpened.bind(this);
32-
this._super();
33-
},
34-
35-
/**
36-
* Configure ESC and TAB so user can't leave modal
37-
* without selecting an option
38-
*
39-
* @returns {Object} Chainable.
40-
*/
41-
initModalEvents: function () {
42-
this._super();
43-
//Don't allow ESC key to close modal
44-
this.options.keyEventHandlers.escapeKey = this.handleEscKey.bind(this);
45-
//Restrict tab action to the modal
46-
this.options.keyEventHandlers.tabKey = this.handleTabKey.bind(this);
47-
48-
return this;
49-
},
50-
51-
/**
52-
* Once the modal is opened it hides the X
53-
*/
54-
onOpened: function () {
55-
$('.modal-header button.action-close').attr('disabled', true).hide();
56-
57-
this.focusableElements = $(this.rootSelector).find('a[href], button:enabled');
58-
this.firstFocusableElement = this.focusableElements[0];
59-
this.lastFocusableElement = this.focusableElements[this.focusableElements.length - 1];
60-
this.firstFocusableElement.focus();
61-
},
62-
63-
/**
64-
* Changes admin usage setting to yes
65-
*/
66-
enableAdminUsage: function () {
67-
var data = {
68-
'form_key': window.FORM_KEY
69-
};
70-
71-
$.ajax(
72-
{
73-
type: 'POST',
74-
url: this.enableLogAction,
75-
data: data,
76-
showLoader: true
77-
}
78-
).done(
79-
function (xhr) {
80-
if (xhr.error) {
81-
self.onError(xhr);
82-
}
83-
}
84-
).fail(this.onError);
85-
this.openReleasePopup();
86-
this.closeModal();
87-
},
88-
89-
/**
90-
* Changes admin usage setting to no
91-
*/
92-
disableAdminUsage: function () {
93-
var data = {
94-
'form_key': window.FORM_KEY
95-
};
96-
97-
$.ajax(
98-
{
99-
type: 'POST',
100-
url: this.disableLogAction,
101-
data: data,
102-
showLoader: true
23+
options: {},
24+
notificationWindow: null
25+
},
26+
27+
/**
28+
* Initializes modal on opened function
29+
*/
30+
initModal: function () {
31+
this.options.opened = this.onOpened.bind(this);
32+
this._super();
33+
},
34+
35+
/**
36+
* Configure ESC and TAB so user can't leave modal
37+
* without selecting an option
38+
*
39+
* @returns {Object} Chainable.
40+
*/
41+
initModalEvents: function () {
42+
this._super();
43+
//Don't allow ESC key to close modal
44+
this.options.keyEventHandlers.escapeKey = this.handleEscKey.bind(this);
45+
//Restrict tab action to the modal
46+
this.options.keyEventHandlers.tabKey = this.handleTabKey.bind(this);
47+
48+
return this;
49+
},
50+
51+
/**
52+
* Once the modal is opened it hides the X
53+
*/
54+
onOpened: function () {
55+
$('.modal-header button.action-close').attr('disabled', true).hide();
56+
57+
this.focusableElements = $(this.rootSelector).find('a[href], button:enabled');
58+
this.firstFocusableElement = this.focusableElements[0];
59+
this.lastFocusableElement = this.focusableElements[this.focusableElements.length - 1];
60+
this.firstFocusableElement.focus();
61+
},
62+
63+
/**
64+
* Changes admin usage setting to yes
65+
*/
66+
enableAdminUsage: function () {
67+
var data = {
68+
'form_key': window.FORM_KEY
69+
};
70+
71+
$.ajax(
72+
{
73+
type: 'POST',
74+
url: this.enableLogAction,
75+
data: data,
76+
showLoader: true
77+
}
78+
).done(
79+
function (xhr) {
80+
if (xhr.error) {
81+
self.onError(xhr);
10382
}
104-
).done(
105-
function (xhr) {
106-
if (xhr.error) {
107-
self.onError(xhr);
108-
}
83+
}
84+
).fail(this.onError);
85+
this.openReleasePopup();
86+
this.closeModal();
87+
},
88+
89+
/**
90+
* Changes admin usage setting to no
91+
*/
92+
disableAdminUsage: function () {
93+
var data = {
94+
'form_key': window.FORM_KEY
95+
};
96+
97+
$.ajax(
98+
{
99+
type: 'POST',
100+
url: this.disableLogAction,
101+
data: data,
102+
showLoader: true
103+
}
104+
).done(
105+
function (xhr) {
106+
if (xhr.error) {
107+
self.onError(xhr);
109108
}
110-
).fail(this.onError);
111-
this.openReleasePopup();
112-
this.closeModal();
113-
},
109+
}
110+
).fail(this.onError);
111+
this.openReleasePopup();
112+
this.closeModal();
113+
},
114+
115+
/**
116+
* Allows admin usage popup to be shown first and then new release notification
117+
*/
118+
openReleasePopup: function () {
119+
var notificationModalSelector = 'release_notification.release_notification.notification_modal_1';
120+
121+
if (analyticsPopupConfig.releaseVisible) {
122+
registry.get(notificationModalSelector).initializeContentAfterAnalytics();
123+
}
124+
},
125+
126+
/**
127+
* Handle Tab and Shift+Tab key event
128+
*
129+
* Keep the tab actions restricted to the popup modal
130+
* so the user must select an option to dismiss the modal
131+
*/
132+
handleTabKey: function (event) {
133+
var modal = this,
134+
KEY_TAB = 9;
114135

115136
/**
116-
* Allows admin usage popup to be shown first and then new release notification
137+
* Handle Shift+Tab to tab backwards
117138
*/
118-
openReleasePopup: function () {
119-
var notificationModalSelector = 'release_notification.release_notification.notification_modal_1';
120-
121-
if (analyticsPopupConfig.releaseVisible) {
122-
registry.get(notificationModalSelector).initializeContentAfterAnalytics();
139+
function handleBackwardTab() {
140+
if (document.activeElement === modal.firstFocusableElement ||
141+
document.activeElement === $(modal.rootSelector)[0]
142+
) {
143+
event.preventDefault();
144+
modal.lastFocusableElement.focus();
123145
}
124-
},
146+
}
125147

126148
/**
127-
* Handle Tab and Shift+Tab key event
128-
*
129-
* Keep the tab actions restricted to the popup modal
130-
* so the user must select an option to dismiss the modal
149+
* Handle Tab forward
131150
*/
132-
handleTabKey: function (event) {
133-
var modal = this,
134-
KEY_TAB = 9;
135-
136-
/**
137-
* Handle Shift+Tab to tab backwards
138-
*/
139-
function handleBackwardTab() {
140-
if (document.activeElement === modal.firstFocusableElement ||
141-
document.activeElement === $(modal.rootSelector)[0]
142-
) {
143-
event.preventDefault();
144-
modal.lastFocusableElement.focus();
145-
}
151+
function handleForwardTab() {
152+
if (document.activeElement === modal.lastFocusableElement) {
153+
event.preventDefault();
154+
modal.firstFocusableElement.focus();
146155
}
156+
}
147157

148-
/**
149-
* Handle Tab forward
150-
*/
151-
function handleForwardTab() {
152-
if (document.activeElement === modal.lastFocusableElement) {
158+
switch (event.keyCode) {
159+
case KEY_TAB:
160+
if (modal.focusableElements.length === 1) {
153161
event.preventDefault();
154-
modal.firstFocusableElement.focus();
162+
break;
155163
}
156-
}
157164

158-
switch (event.keyCode) {
159-
case KEY_TAB:
160-
if (modal.focusableElements.length === 1) {
161-
event.preventDefault();
162-
break;
163-
}
164-
165-
if (event.shiftKey) {
166-
handleBackwardTab();
167-
break;
168-
}
169-
handleForwardTab();
165+
if (event.shiftKey) {
166+
handleBackwardTab();
170167
break;
171-
default:
172-
break;
173-
}
174-
},
175-
176-
/**
177-
* Handle Esc key
178-
*
179-
* Esc key should not close modal
180-
*/
181-
handleEscKey: function (event) {
182-
event.preventDefault();
168+
}
169+
handleForwardTab();
170+
break;
171+
default:
172+
break;
183173
}
174+
},
175+
176+
/**
177+
* Handle Esc key
178+
*
179+
* Esc key should not close modal
180+
*/
181+
handleEscKey: function (event) {
182+
event.preventDefault();
184183
}
185-
);
184+
});
186185
}
187186
);

0 commit comments

Comments
 (0)