[WEB-1955] fix: Advanced bulk ops feature flagging (#730)

* fix: Advanced bulk ops feature flagging

* fix: Refactoring

* fix: Refactoring
This commit is contained in:
Akshita Goyal
2024-08-01 13:16:08 +05:30
committed by GitHub
parent 0cec03ad1c
commit 67d197d060
2 changed files with 65 additions and 57 deletions

View File

@@ -29,6 +29,7 @@ import { getDate, renderFormattedPayloadDate } from "@/helpers/date-time.helper"
import { useProjectEstimates } from "@/hooks/store";
import { useIssuesStore } from "@/hooks/use-issue-layout-store";
import { TSelectionHelper, TSelectionSnapshot } from "@/hooks/use-multiple-select";
import { useFlag } from "@/plane-web/hooks/store/use-flag";
type Props = {
selectionHelpers: TSelectionHelper;
@@ -59,6 +60,8 @@ export const IssueBulkOperationsProperties: React.FC<Props> = observer((props) =
issues: { bulkUpdateProperties },
} = useIssuesStore();
const { currentActiveEstimateId } = useProjectEstimates();
const isAdvancedBulkOpsEnabled = useFlag("BULK_OPS_ADVANCED");
// form info
const {
control,
@@ -234,66 +237,70 @@ export const IssueBulkOperationsProperties: React.FC<Props> = observer((props) =
)}
/>
)}
{projectId && (
<Controller
name="cycle_id"
control={control}
render={({ field: { onChange, value } }) => (
<>
<CycleDropdown
value={value as string | null}
onChange={onChange}
projectId={projectId.toString()}
buttonVariant="border-with-text"
buttonClassName="text-custom-text-300 py-1 rounded"
disabled={isUpdateDisabled}
placement="top-start"
placeholder="Cycle"
/>
</>
)}
/>
)}
{projectId && currentActiveEstimateId && (
<Controller
name="estimate_point"
control={control}
render={({ field: { onChange, value } }) => (
<EstimateDropdown
value={value as string | null}
onChange={onChange}
projectId={projectId.toString()}
buttonVariant="border-with-text"
buttonClassName="text-custom-text-300 py-1"
disabled={isUpdateDisabled}
placement="top-start"
placeholder="Estimates"
{!isAdvancedBulkOpsEnabled && (
<>
{projectId && (
<Controller
name="cycle_id"
control={control}
render={({ field: { onChange, value } }) => (
<>
<CycleDropdown
value={value as string | null}
onChange={onChange}
projectId={projectId.toString()}
buttonVariant="border-with-text"
buttonClassName="text-custom-text-300 py-1 rounded"
disabled={isUpdateDisabled}
placement="top-start"
placeholder="Cycle"
/>
</>
)}
/>
)}
/>
)}
{projectId && (
<Controller
name="module_ids"
control={control}
render={({ field: { onChange, value } }) => (
<>
<ModuleDropdown
value={value}
onChange={onChange}
projectId={projectId.toString()}
buttonVariant="border-with-text"
buttonClassName="text-custom-text-300 border-none px-2 py-1"
buttonContainerClassName="border-[0.5px] border-custom-border-300 rounded"
disabled={isUpdateDisabled}
placement="top-start"
placeholder="Module"
showCount
multiple
/>
</>
{projectId && currentActiveEstimateId && (
<Controller
name="estimate_point"
control={control}
render={({ field: { onChange, value } }) => (
<EstimateDropdown
value={value as string | null}
onChange={onChange}
projectId={projectId.toString()}
buttonVariant="border-with-text"
buttonClassName="text-custom-text-300 py-1"
disabled={isUpdateDisabled}
placement="top-start"
placeholder="Estimates"
/>
)}
/>
)}
/>
{projectId && (
<Controller
name="module_ids"
control={control}
render={({ field: { onChange, value } }) => (
<>
<ModuleDropdown
value={value}
onChange={onChange}
projectId={projectId.toString()}
buttonVariant="border-with-text"
buttonClassName="text-custom-text-300 border-none px-2 py-1"
buttonContainerClassName="border-[0.5px] border-custom-border-300 rounded"
disabled={isUpdateDisabled}
placement="top-start"
placeholder="Module"
showCount
multiple
/>
</>
)}
/>
)}
</>
)}
</div>
{isDirty && (

View File

@@ -4,6 +4,7 @@ import { StoreContext } from "@/lib/store-context";
export enum E_FEATURE_FLAGS {
BULK_OPS = "BULK_OPS",
BULK_OPS_ADVANCED = "BULK_OPS_ADVANCED",
ESTIMATE_WITH_TIME = "ESTIMATE_WITH_TIME",
ISSUE_TYPE_DISPLAY = "ISSUE_TYPE_DISPLAY",
ISSUE_TYPE_SETTINGS = "ISSUE_TYPE_SETTINGS",