META-INF.resources.publish_process_message.jsp Maven / Gradle / Ivy
<%--
/**
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/
--%>
<%@ include file="/init.jsp" %>
<%
ResultRow row = (ResultRow)request.getAttribute(WebKeys.SEARCH_CONTAINER_RESULT_ROW);
BackgroundTask backgroundTask = (BackgroundTask)row.getObject();
%>
<%
BackgroundTaskStatus backgroundTaskStatus = BackgroundTaskStatusRegistryUtil.getBackgroundTaskStatus(backgroundTask.getBackgroundTaskId());
%>
<%
String cmd = ArrayUtil.toString(ExportImportConfigurationUtil.getExportImportConfigurationParameter(backgroundTask, Constants.CMD), StringPool.BLANK);
int percentage = 100;
long allModelAdditionCountersTotal = GetterUtil.getLong(backgroundTaskStatus.getAttribute("allModelAdditionCountersTotal"));
long allPortletAdditionCounter = GetterUtil.getLong(backgroundTaskStatus.getAttribute("allPortletAdditionCounter"));
long currentModelAdditionCountersTotal = GetterUtil.getLong(backgroundTaskStatus.getAttribute("currentModelAdditionCountersTotal"));
long currentPortletAdditionCounter = GetterUtil.getLong(backgroundTaskStatus.getAttribute("currentPortletAdditionCounter"));
long allProgressBarCountersTotal = allModelAdditionCountersTotal + allPortletAdditionCounter;
long currentProgressBarCountersTotal = currentModelAdditionCountersTotal + currentPortletAdditionCounter;
if (allProgressBarCountersTotal > 0) {
int base = 100;
String phase = GetterUtil.getString(backgroundTaskStatus.getAttribute("phase"));
if (phase.equals(Constants.EXPORT) && !Objects.equals(cmd, Constants.PUBLISH_TO_REMOTE)) {
base = 50;
}
percentage = Math.round((float)currentProgressBarCountersTotal / allProgressBarCountersTotal * base);
}
%>
<%
String stagedModelName = (String)backgroundTaskStatus.getAttribute("stagedModelName");
String stagedModelType = (String)backgroundTaskStatus.getAttribute("stagedModelType");
%>
<%
String messageKey = "exporting";
if (Objects.equals(cmd, Constants.IMPORT)) {
messageKey = "importing";
}
else if (Objects.equals(cmd, Constants.PUBLISH_TO_LIVE) || Objects.equals(cmd, Constants.PUBLISH_TO_REMOTE)) {
messageKey = "publishing";
}
%>
<%= StringPool.TRIPLE_PERIOD %> <%= ResourceActionsUtil.getModelResource(locale, stagedModelType) %> <%= HtmlUtil.escape(stagedModelName) %>