<%--
/**
 * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
 *
 * The contents of this file are subject to the terms of the Liferay Enterprise
 * Subscription License ("License"). You may not use this file except in
 * compliance with the License. You can obtain a copy of the License by
 * contacting Liferay, Inc. See the License for the specific language governing
 * permissions and limitations under the License, including but not limited to
 * distribution rights of the Software.
 *
 *
 *
 */
--%>

<%@ include file="/init.jsp" %>

<%
RedirectDisplayContext redirectDisplayContext = (RedirectDisplayContext)request.getAttribute(RedirectDisplayContext.class.getName());
%>

<clay:navigation-bar
	inverted="<%= true %>"
	navigationItems="<%= redirectDisplayContext.getNavigationItems() %>"
/>

<c:choose>
	<c:when test="<%= redirectDisplayContext.isShowRedirectEntries() %>">
		<liferay-util:include page="/view_redirect_entries.jsp" servletContext="<%= application %>" />
	</c:when>
	<c:when test="<%= redirectDisplayContext.isShowRedirectNotFoundEntries() %>">
		<liferay-util:include page="/view_redirect_not_found_entries.jsp" servletContext="<%= application %>" />
	</c:when>
	<c:otherwise>

		<%
		RedirectPatternConfigurationDisplayContext redirectPatternConfigurationDisplayContext = (RedirectPatternConfigurationDisplayContext)request.getAttribute(RedirectPatternConfigurationDisplayContext.class.getName());
		%>

		<div>
			<react:component
				module="js/RedirectPatterns"
				props="<%= redirectPatternConfigurationDisplayContext.getRedirectPatterns() %>"
			/>
		</div>

		<c:if test="<%= SessionErrors.contains(renderRequest, ConfigurationModelListenerException.class) %>">
			<aui:script>
				Liferay.Util.openToast({
					message:
						'<liferay-ui:message key="patterns-must-be-valid-regular-expressions" />',
					title: '<liferay-ui:message key="error" />',
					toastProps: {
						autoClose: 5000,
					},
					type: 'danger',
				});
			</aui:script>
		</c:if>
	</c:otherwise>
</c:choose>