[SILO-417] Allow to uncheck states in PR mapping #3748

This commit is contained in:
Saurabh Kumar
2025-07-25 18:23:17 +05:30
committed by GitHub
parent a1d558623c
commit 9663fcb172
5 changed files with 51 additions and 13 deletions

View File

@@ -2,6 +2,7 @@
import { FC } from "react";
import { observer } from "mobx-react";
import { EMPTY_PLANE_STATE } from "@plane/etl/core";
import { useTranslation } from "@plane/i18n";
import { IState } from "@plane/types";
// plane web components
@@ -68,7 +69,7 @@ export const StateForm: FC<TStateForm> = observer((props) => {
key={gitState.key}
value={value?.[gitState.key]?.id || undefined}
handleValue={(value: IState | undefined) => handleChange(gitState.key, value)}
planeStates={planeProjectStates}
planeStates={[EMPTY_PLANE_STATE, ...planeProjectStates]}
/>
))}
</div>

View File

@@ -2,10 +2,12 @@
import { FC } from "react";
import { observer } from "mobx-react";
import { useTranslation } from "@plane/i18n";
import { IState } from "@plane/types";
import { StateGroupIcon } from "@plane/ui";
// plane web components
import { Dropdown } from "@/plane-web/components/importers/ui";
import { Ban } from "lucide-react";
type TStateFormSelection = {
title: string;
@@ -16,6 +18,7 @@ type TStateFormSelection = {
export const StateFormSelection: FC<TStateFormSelection> = observer((props) => {
const { title, value, handleValue, planeStates } = props;
const { t } = useTranslation();
return (
<div className="relative grid grid-cols-2 items-center space-y-1.5 text-sm">
@@ -29,18 +32,27 @@ export const StateFormSelection: FC<TStateFormSelection> = observer((props) => {
data: state,
}))}
value={value}
placeHolder="Select state"
placeHolder={t("integrations.select_state")}
onChange={(value: string | undefined) => {
if (value) {
const state = planeStates.find((state) => state.id === value);
handleValue(state || undefined);
} else handleValue(undefined);
}}
iconExtractor={(option) => (
<div className="w-4.5 h-4.5 flex-shrink-0 overflow-hidden relative flex justify-center items-center">
<StateGroupIcon stateGroup={option?.group || "backlog"} />
</div>
)}
iconExtractor={(option) => {
if (!option.id) {
return (
<div className="w-2.5 h-2.5 flex-shrink-0 overflow-hidden relative flex justify-center items-center">
<Ban />
</div>
);
}
return (
<div className="w-4.5 h-4.5 flex-shrink-0 overflow-hidden relative flex justify-center items-center">
<StateGroupIcon stateGroup={option?.group || "backlog"} />
</div>
);
}}
queryExtractor={(option) => option.name}
/>
</div>

View File

@@ -2,6 +2,7 @@
import { FC } from "react";
import { observer } from "mobx-react";
import { EMPTY_PLANE_STATE } from "@plane/etl/core";
import { useTranslation } from "@plane/i18n";
import { IState } from "@plane/types";
// plane web components
@@ -67,7 +68,7 @@ export const StateForm: FC<TStateForm> = observer((props) => {
key={gitState.key}
value={value?.[gitState.key]?.id || undefined}
handleValue={(value: IState | undefined) => handleChange(gitState.key, value)}
planeStates={planeProjectStates}
planeStates={[EMPTY_PLANE_STATE, ...planeProjectStates]}
/>
))}
</div>

View File

@@ -2,6 +2,7 @@
import { FC } from "react";
import { observer } from "mobx-react";
import { Ban } from "lucide-react";
import { IState } from "@plane/types";
import { StateGroupIcon } from "@plane/ui";
// plane web components
@@ -38,11 +39,20 @@ export const StateFormSelection: FC<TStateFormSelection> = observer((props) => {
handleValue(state || undefined);
} else handleValue(undefined);
}}
iconExtractor={(option) => (
<div className="w-4.5 h-4.5 flex-shrink-0 overflow-hidden relative flex justify-center items-center">
<StateGroupIcon stateGroup={option?.group || "backlog"} />
</div>
)}
iconExtractor={(option) => {
if (!option.id) {
return (
<div className="w-2.5 h-2.5 flex-shrink-0 overflow-hidden relative flex justify-center items-center">
<Ban />
</div>
);
}
return (
<div className="w-4.5 h-4.5 flex-shrink-0 overflow-hidden relative flex justify-center items-center">
<StateGroupIcon stateGroup={option?.group || "backlog"} />
</div>
);
}}
queryExtractor={(option) => option.name}
/>
</div>

View File

@@ -1,3 +1,4 @@
import { IState } from "@plane/types";
import { E_SILO_ERROR_CODES } from "../types/error";
const entries = Object.entries(E_SILO_ERROR_CODES);
@@ -8,3 +9,16 @@ export const SILO_ERROR_CODES = (
code: key[1],
description: key[0].toLowerCase(),
}));
export const EMPTY_PLANE_STATE: IState = {
id: "",
name: "No transition",
group: "backlog",
color: "#000000",
default: false,
description: "",
project_id: "",
sequence: 0,
workspace_id: "",
order: 0,
};