Allow closing failed access reviews
Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Bryan FRIMIN <bryan@frimin.fr>
This commit is contained in:
committed by
Bryan Frimin
parent
bf255b198c
commit
5bf8727076
@@ -148,6 +148,7 @@ export const campaignDetailPageQuery = graphql`
|
|||||||
id
|
id
|
||||||
name
|
name
|
||||||
status
|
status
|
||||||
|
pendingEntryCount
|
||||||
canDelete: permission(action: "access-review:campaign:delete")
|
canDelete: permission(action: "access-review:campaign:delete")
|
||||||
sources {
|
sources {
|
||||||
id
|
id
|
||||||
@@ -248,13 +249,7 @@ export default function CampaignDetailPage({ queryRef }: Props) {
|
|||||||
const [deleteCampaign, isDeleting]
|
const [deleteCampaign, isDeleting]
|
||||||
= useMutation<CampaignDetailPageDeleteMutation>(deleteCampaignMutation);
|
= useMutation<CampaignDetailPageDeleteMutation>(deleteCampaignMutation);
|
||||||
|
|
||||||
const allDecided = campaign.sources.length > 0
|
const canComplete = campaign.pendingEntryCount === 0;
|
||||||
&& campaign.sources.every(source =>
|
|
||||||
source.entries
|
|
||||||
&& source.entries.edges.length > 0
|
|
||||||
&& source.entries.edges.every(edge => edge.node.decision !== "PENDING")
|
|
||||||
&& !source.entries.pageInfo.hasNextPage,
|
|
||||||
);
|
|
||||||
|
|
||||||
const handleStart = () => {
|
const handleStart = () => {
|
||||||
startCampaign({
|
startCampaign({
|
||||||
@@ -425,7 +420,7 @@ export default function CampaignDetailPage({ queryRef }: Props) {
|
|||||||
{isPendingActions && (
|
{isPendingActions && (
|
||||||
<Button
|
<Button
|
||||||
onClick={handleComplete}
|
onClick={handleComplete}
|
||||||
disabled={!allDecided || isClosing}
|
disabled={!canComplete || isClosing}
|
||||||
>
|
>
|
||||||
{isClosing ? __("Completing...") : __("Complete campaign")}
|
{isClosing ? __("Completing...") : __("Complete campaign")}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user