Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Because: * we want to add UI to enable manual enrollment end This commit: * add isEnrollmentPaused to GQL experiment input for consistency with serialized experiment type, mapped to is_paused in Django model * add support for isEnrollmentPausePending to indicate when the review is in progress * rework useChangeOperationMutation to indicate loading while awaiting experiment refetch * update "rejecting this review" copy to "rejecting the request to {actionDescription}" * refactors handling of strings describing lifecycle review flows, moves all the strings into shared constants * refactors the Settings page and ChangeApprovalOperations components * adds more exhaustive stories for launch, end enrollment, and end cases on PageSummary * reworks rejection reason display to more properly use old_status and old_status_next to determine what kind of review was rejected * adds more status-based logic to make the correct GQL queries on approval / rejection of review Co-authored-by: Lauren Zugai <lauren@zugai.com>
- Loading branch information
Showing
40 changed files
with
1,084 additions
and
313 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
app/experimenter/nimbus-ui/src/components/ChangeApprovalOperations/RejectionReason.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
import React, { useMemo } from "react"; | ||
import Alert from "react-bootstrap/Alert"; | ||
import { LIFECYCLE_REVIEW_FLOWS } from "../../lib/constants"; | ||
import { humanDate } from "../../lib/dateUtils"; | ||
import { getExperiment_experimentBySlug } from "../../types/getExperiment"; | ||
import { | ||
NimbusChangeLogOldStatus, | ||
NimbusChangeLogOldStatusNext, | ||
} from "../../types/globalTypes"; | ||
|
||
export const RejectionReason = ({ | ||
rejectionEvent, | ||
}: { | ||
rejectionEvent: getExperiment_experimentBySlug["rejection"]; | ||
}) => { | ||
const { message, changedOn, changedBy, oldStatus, oldStatusNext } = | ||
rejectionEvent!; | ||
|
||
const rejectionActionDescription = useMemo(() => { | ||
if (oldStatus === NimbusChangeLogOldStatus.LIVE) { | ||
if (oldStatusNext === NimbusChangeLogOldStatusNext.LIVE) { | ||
return LIFECYCLE_REVIEW_FLOWS.PAUSE.description; | ||
} | ||
return LIFECYCLE_REVIEW_FLOWS.END.description; | ||
} | ||
if (oldStatus === NimbusChangeLogOldStatus.DRAFT) { | ||
return LIFECYCLE_REVIEW_FLOWS.LAUNCH.description; | ||
} | ||
}, [oldStatus, oldStatusNext]); | ||
|
||
return ( | ||
<Alert variant="warning" data-testid="rejection-notice"> | ||
<div className="text-body"> | ||
<p className="mb-2"> | ||
The request to {rejectionActionDescription} was{" "} | ||
<strong>Rejected</strong> due to: | ||
</p> | ||
<p className="mb-2"> | ||
{changedBy!.email} on {humanDate(changedOn!)}: | ||
</p> | ||
<p className="bg-white rounded border p-2 mb-0">{message}</p> | ||
</div> | ||
</Alert> | ||
); | ||
}; | ||
|
||
export default RejectionReason; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.