You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
portainer/app/react/hooks/useIsDeploymentOptionHidden.ts

26 lines
846 B

import { useEnvironmentDeploymentOptions } from '@/react/portainer/environments/queries/useEnvironment';
import { useEnvironmentId } from './useEnvironmentId';
type HideDeploymentOption = 'form' | 'webEditor' | 'fileUpload';
export function useIsDeploymentOptionHidden(
hideDeploymentOption: HideDeploymentOption
) {
const environmentId = useEnvironmentId();
const { data: deploymentOptions } =
useEnvironmentDeploymentOptions(environmentId);
if (deploymentOptions) {
const isDeploymentOptionHidden =
(hideDeploymentOption === 'form' && deploymentOptions.hideAddWithForm) ||
(hideDeploymentOption === 'webEditor' &&
deploymentOptions.hideAddWithForm) ||
(hideDeploymentOption === 'fileUpload' &&
deploymentOptions.hideAddWithForm);
return isDeploymentOptionHidden;
}
return false;
}