Skip to content

Commit

Permalink
Merge pull request #328 from shuhaib-aot/Feature/added-disabledData-p…
Browse files Browse the repository at this point in the history
…rop-to-history-modal

Added disabledData prop to disable revert button
  • Loading branch information
arun-s-aot authored Nov 8, 2024
2 parents 2501a64 + 7beb6bc commit 3cf5a35
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ interface HistoryModalProps {
categoryType: string;
historyCount: number;
currentVersionId?:number|string;
disabledData:{key:string,value:any}
}

interface AllHistory {
Expand Down Expand Up @@ -110,6 +111,7 @@ export const HistoryModal: React.FC<HistoryModalProps> = React.memo(
categoryType,
historyCount,
currentVersionId,
disabledData = {key:"", value:""} // we can pass the key and its value based on that we can disable revert button eg: key:"processKey",value:"bpmn" if the data[key] == value it will disable
}) => {
const { t } = useTranslation();
const [showConfirmModal, setShowConfirmModal] = useState(false);
Expand Down Expand Up @@ -246,7 +248,7 @@ export const HistoryModal: React.FC<HistoryModalProps> = React.memo(
<RevertField
variant="secondary"
size="sm"
disabled={currentVersionId == entry.id}
disabled={currentVersionId == entry.id || entry[disabledData.key] == disabledData.value}
label={revertBtnText}
onClick={() =>
handleRevertClick(version, cloned_form_id, process_id)
Expand All @@ -269,7 +271,7 @@ export const HistoryModal: React.FC<HistoryModalProps> = React.memo(
variant="secondary"
size="sm"
label={revertBtnText}
disabled={currentVersionId == entry.id}
disabled={currentVersionId == entry.id || entry[disabledData.key] == disabledData.value}
onClick={() =>
handleRevertClick(version, cloned_form_id, process_id)
}
Expand Down

0 comments on commit 3cf5a35

Please sign in to comment.