Skip to content

Commit 6c1dda3

Browse files
committed
[ERM-4] - Implement the "Rollout and activate" action
1 parent a0b45b0 commit 6c1dda3

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

ui.apps/src/main/content/jcr_root/apps/etoolbox-rollout-manager/clientlibs/rollout-manager-ui/js/console-ui.actions.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* EToolbox Rollout Manager clientlib.
1717
* 'Rollout' button and dialog actions definition.
1818
*/
19-
(function (window, document, $, ERM, Granite) {
19+
(function (window, document, $, ns, Granite) {
2020
'use strict';
2121

2222
const COLLECT_LIVE_COPIES_COMMAND = '/content/etoolbox-rollout-manager/servlet/collect-live-copies';
@@ -73,7 +73,7 @@
7373
* @returns {*}
7474
*/
7575
function doItemsRollout(data, rolloutRequest) {
76-
const logger = ERM.createLoggerDialog(PROCESSING_LABEL, ROLLOUT_IN_PROGRESS_LABEL, data.path);
76+
const logger = ns.createLoggerDialog(PROCESSING_LABEL, ROLLOUT_IN_PROGRESS_LABEL, data.path);
7777
return $.Deferred()
7878
.resolve()
7979
.then(rolloutRequest(data, logger))
@@ -129,7 +129,7 @@
129129
.then((liveCopiesJsonArray) => {
130130
// Clears the wait mask once the dialog is loaded
131131
foundationUi.clearWait();
132-
ERM.showRolloutDialog(liveCopiesJsonArray, selectedPath)
132+
ns.showRolloutDialog(liveCopiesJsonArray, selectedPath)
133133
.then((data) => {
134134
doItemsRollout(data, buildRolloutRequest);
135135
});
@@ -154,4 +154,4 @@
154154
name: 'etoolbox.rollout-manager.rollout-active-condition',
155155
handler: onRolloutActiveCondition
156156
});
157-
})(window, document, Granite.$, Granite.ERM, Granite);
157+
})(window, document, Granite.$, window.erm = (window.erm || {}), Granite);

ui.apps/src/main/content/jcr_root/apps/etoolbox-rollout-manager/clientlibs/rollout-manager-ui/js/console-ui.dialog.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@
1616
* EToolbox Rollout Manager clientlib.
1717
* Contains helper functions to showing the rollout process dialogs.
1818
*/
19-
(function (window, document, $, Granite) {
19+
(function (document, $, Granite, ns) {
2020
'use strict';
2121

22-
const Utils = Granite.ERM = (Granite.ERM || {});
23-
2422
const LOGGER_DIALOG_CLASS = 'rollout-manager-logger-dialog';
2523
const BASE_DIALOG_CLASS = 'rollout-manager-dialog';
2624

@@ -103,7 +101,7 @@
103101
}
104102
};
105103
}
106-
Utils.createLoggerDialog = createLoggerDialog;
104+
ns.createLoggerDialog = createLoggerDialog;
107105

108106
// Rollout dialog related constants
109107
const CANCEL_LABEL = Granite.I18n.get('Cancel');
@@ -185,9 +183,9 @@
185183
).text(liveCopyJson.path).attr('disabled', !!liveCopyJson.disabled);
186184
const lastRolledOutTimeAgo =
187185
$(`<i
188-
title="${TimeUtil.displayLastRolledOut(liveCopyJson.lastRolledOut)}"
186+
title="${ns.TimeUtil.displayLastRolledOut(liveCopyJson.lastRolledOut)}"
189187
class="rollout-manager-last-rollout-date">`
190-
).text(TimeUtil.timeSince(liveCopyJson.lastRolledOut));
188+
).text(ns.TimeUtil.timeSince(liveCopyJson.lastRolledOut));
191189
liveCopyCheckbox.append(lastRolledOutTimeAgo);
192190
if (liveCopyJson.liveCopies && liveCopyJson.liveCopies.length > 0) {
193191
const accordion = initNestedAccordion(liveCopyCheckbox, liveCopyJson.liveCopies);
@@ -318,5 +316,5 @@
318316

319317
return deferred.promise();
320318
}
321-
Utils.showRolloutDialog = showRolloutDialog;
322-
})(window, document, Granite.$, Granite);
319+
ns.showRolloutDialog = showRolloutDialog;
320+
})(document, Granite.$, Granite, (window.erm = (window.erm || {})));

ui.apps/src/main/content/jcr_root/apps/etoolbox-rollout-manager/clientlibs/rollout-manager-ui/js/time-util.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
* EToolbox Rollout Manager Time Utility.
1717
* Contains utilities for time data processing
1818
*/
19-
(function ($, ns, TimeUtil) {
19+
(function ($, ns) {
2020
'use strict';
21+
ns.TimeUtil = {};
2122

2223
const NOT_ROLLED_OUT_LABEL = Granite.I18n.get('Not Rolled Out');
2324
const TIME_AGO_LABEL = Granite.I18n.get('ago');
@@ -53,7 +54,7 @@
5354
* @param {string} date - The date to calculate the time difference from (ISO 8601 format).
5455
* @returns {string} A formatted string indicating the time difference.
5556
*/
56-
TimeUtil.timeSince = function (date) {
57+
ns.TimeUtil.timeSince = function (date) {
5758
if (!date) {
5859
return NOT_ROLLED_OUT_LABEL;
5960
}
@@ -80,11 +81,11 @@
8081
* @param {string} date - The date to format (ISO 8601 format).
8182
* @returns {string} A formatted timestamp string.
8283
*/
83-
TimeUtil.displayLastRolledOut = function (date) {
84+
ns.TimeUtil.displayLastRolledOut = function (date) {
8485
if (!date) {
8586
return '';
8687
}
8788
return new Date(date).toLocaleString(undefined, TIME_FORMATTER_OPTIONS);
8889
};
8990

90-
})(Granite.$, Granite.author, (window.TimeUtil = (window.TimeUtil || {})));
91+
})(Granite.$, window.erm = (window.erm || {}));

0 commit comments

Comments
 (0)