All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.js.components.ObjectRelationship.ModalDisableInheritance.tsx Maven / Gradle / Ivy

The newest version!
/**
 * SPDX-FileCopyrightText: (c) 2024 Liferay, Inc. https://liferay.com
 * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
 */

import ClayButton from '@clayui/button';
import {Text} from '@clayui/core';
import ClayModal, {ClayModalProvider, useModal} from '@clayui/modal';
import React, {useEffect, useState} from 'react';

function ModalDisableInheritance() {
	const [handleDisable, setHandleDisable] = useState<() => Promise>();
	const [visible, setVisible] = useState(false);

	const {observer, onClose} = useModal({
		onClose: () => {
			setVisible(false);
		},
	});

	const warningMessages = [
		Liferay.Language.get('permissions-are-copied-from-the-previous-parent'),
		Liferay.Language.get(
			'rest-endpoints-are-created-for-the-new-parent-with-child-endpoints-grouped-under-them'
		),
		Liferay.Language.get(
			'an-action-trigger-is-created-for-updating-child-objects'
		),
	];

	useEffect(() => {
		const openModal = ({
			handleDisable,
		}: {
			handleDisable: () => Promise;
		}) => {
			setHandleDisable(() => handleDisable);
			setVisible(true);
		};

		Liferay.on('openModalDisableInheritance', openModal);

		return () =>
			Liferay.detach(
				'openModalDisableInheritance',
				openModal as () => void
			);
	}, []);

	return (
		<>
			{visible && (
				
					
						
							{Liferay.Language.get(
								'disable-inheritance-confirmation'
							)}
						

						
							
								{Liferay.Language.get(
									'when-you-disable-inheritance,-the-first-child-object-is-updated-with-options-for-showing-the-widget-in-the-page-builder-and-for-configuring-the-panel-link'
								)}
							

							
    {warningMessages.map((warningMessage) => (
  1. {warningMessage}
  2. ))}
{Liferay.Language.get('cancel')} { if (handleDisable) { await handleDisable(); } onClose(); }} > {Liferay.Language.get('disable')} } >
)} ); } export default ModalDisableInheritance;




© 2015 - 2025 Weber Informatics LLC | Privacy Policy