-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(OY2-26203): Add OS Action Column
- Loading branch information
1 parent
113db94
commit 2bdb7e5
Showing
11 changed files
with
364 additions
and
261 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { Action, CognitoUserAttributes, OsMainSourceItem, SEATOOL_STATUS } from "../shared-types"; | ||
import { getLatestRai } from './rai-helper' | ||
import { isCmsWriteUser } from './user-helper' | ||
import { isStateUser } from "./user-helper"; | ||
|
||
export const packageActionsForResult = ( | ||
user: CognitoUserAttributes, | ||
result: OsMainSourceItem | ||
): Action[] => { | ||
const actions = [] as any[]; | ||
const latestRai = getLatestRai(result?.rais || {}); | ||
if (isCmsWriteUser(user)) { | ||
switch (result.seatoolStatus) { | ||
case SEATOOL_STATUS.PENDING: | ||
case SEATOOL_STATUS.PENDING_OFF_THE_CLOCK: | ||
case SEATOOL_STATUS.PENDING_APPROVAL: | ||
case SEATOOL_STATUS.PENDING_CONCURRENCE: | ||
if (!latestRai || latestRai.status != "requested") { | ||
// If there is no RAIs, or the latest RAI is in a state other than requested | ||
actions.push(Action.ISSUE_RAI); | ||
} | ||
break; | ||
} | ||
if (latestRai?.status == "received") { | ||
// There's an RAI and its been responded to | ||
if (!result.raiWithdrawEnabled) { | ||
actions.push(Action.ENABLE_RAI_WITHDRAW); | ||
} | ||
if (result.raiWithdrawEnabled) { | ||
actions.push(Action.DISABLE_RAI_WITHDRAW); | ||
} | ||
} | ||
} else if (isStateUser(user)) { | ||
switch (result.seatoolStatus) { | ||
case SEATOOL_STATUS.PENDING_RAI: | ||
if (latestRai?.status == "requested") { | ||
// If there is an active RAI | ||
actions.push(Action.RESPOND_TO_RAI); | ||
} | ||
break; | ||
case SEATOOL_STATUS.PENDING: | ||
case SEATOOL_STATUS.PENDING_OFF_THE_CLOCK: | ||
case SEATOOL_STATUS.PENDING_APPROVAL: | ||
case SEATOOL_STATUS.PENDING_CONCURRENCE: | ||
if ( | ||
latestRai?.status == "received" && | ||
result.raiWithdrawEnabled | ||
) { | ||
// There is an rai that's been responded to, but not withdrawn | ||
actions.push(Action.WITHDRAW_RAI); | ||
} | ||
break; | ||
} | ||
} | ||
return actions; | ||
}; |
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
Oops, something went wrong.