-
-
Notifications
You must be signed in to change notification settings - Fork 736
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
608 additions
and
3 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
44 changes: 44 additions & 0 deletions
44
.../Project/ProjectSettings/ProjectActions/ProjectActionsTable/ProjectActionsActionsCell.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,44 @@ | ||
import { styled, Typography } from '@mui/material'; | ||
import { TextCell } from 'component/common/Table/cells/TextCell/TextCell'; | ||
import { IActionSet } from 'interfaces/action'; | ||
import { LinkCell } from 'component/common/Table/cells/LinkCell/LinkCell'; | ||
import { TooltipLink } from 'component/common/TooltipLink/TooltipLink'; | ||
|
||
const StyledItem = styled(Typography)(({ theme }) => ({ | ||
fontSize: theme.fontSizes.smallerBody, | ||
})); | ||
|
||
interface IProjectActionsActionsCellProps { | ||
action: IActionSet; | ||
onCreateAction?: () => void; | ||
} | ||
|
||
export const ProjectActionsActionsCell = ({ | ||
action, | ||
onCreateAction, | ||
}: IProjectActionsActionsCellProps) => { | ||
const { actions } = action; | ||
|
||
if (actions.length === 0) { | ||
if (!onCreateAction) return <TextCell>0 actions</TextCell>; | ||
else return <LinkCell title='Create action' onClick={onCreateAction} />; | ||
} | ||
|
||
return ( | ||
<TextCell> | ||
<TooltipLink | ||
tooltip={ | ||
<> | ||
{actions.map(({ id, action, executionParams }) => ( | ||
<StyledItem key={id}> | ||
{action}: {JSON.stringify(executionParams)} | ||
</StyledItem> | ||
))} | ||
</> | ||
} | ||
> | ||
{actions.length === 1 ? '1 action' : `${actions.length} tokens`} | ||
</TooltipLink> | ||
</TextCell> | ||
); | ||
}; |
22 changes: 22 additions & 0 deletions
22
...ct/Project/ProjectSettings/ProjectActions/ProjectActionsTable/ProjectActionsActorCell.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,22 @@ | ||
import { TextCell } from 'component/common/Table/cells/TextCell/TextCell'; | ||
import { IActionSet } from 'interfaces/action'; | ||
import { IServiceAccount } from 'interfaces/service-account'; | ||
|
||
interface IProjectActionsActorCellProps { | ||
action: IActionSet; | ||
serviceAccounts: IServiceAccount[]; | ||
} | ||
|
||
export const ProjectActionsActorCell = ({ | ||
action, | ||
serviceAccounts, | ||
}: IProjectActionsActorCellProps) => { | ||
const { sourceId } = action.match; | ||
const actor = serviceAccounts.find(({ id }) => id === sourceId); | ||
|
||
if (!actor) { | ||
return <TextCell>No service account</TextCell>; | ||
} | ||
|
||
return <TextCell>{actor.name}</TextCell>; | ||
}; |
31 changes: 31 additions & 0 deletions
31
...Project/ProjectSettings/ProjectActions/ProjectActionsTable/ProjectActionsDeleteDialog.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,31 @@ | ||
import { Dialogue } from 'component/common/Dialogue/Dialogue'; | ||
import { IActionSet } from 'interfaces/action'; | ||
|
||
interface IProjectActionsDeleteDialogProps { | ||
action?: IActionSet; | ||
open: boolean; | ||
setOpen: React.Dispatch<React.SetStateAction<boolean>>; | ||
onConfirm: (action: IActionSet) => void; | ||
} | ||
|
||
export const ProjectActionsDeleteDialog = ({ | ||
action, | ||
open, | ||
setOpen, | ||
onConfirm, | ||
}: IProjectActionsDeleteDialogProps) => ( | ||
<Dialogue | ||
title='Delete action?' | ||
open={open} | ||
primaryButtonText='Delete action' | ||
secondaryButtonText='Cancel' | ||
onClick={() => onConfirm(action!)} | ||
onClose={() => { | ||
setOpen(false); | ||
}} | ||
> | ||
<p> | ||
You are about to delete action: <strong>{action?.name}</strong> | ||
</p> | ||
</Dialogue> | ||
); |
43 changes: 43 additions & 0 deletions
43
.../Project/ProjectSettings/ProjectActions/ProjectActionsTable/ProjectActionsFiltersCell.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,43 @@ | ||
import { styled, Typography } from '@mui/material'; | ||
import { TextCell } from 'component/common/Table/cells/TextCell/TextCell'; | ||
import { IActionSet } from 'interfaces/action'; | ||
import { TooltipLink } from 'component/common/TooltipLink/TooltipLink'; | ||
|
||
const StyledItem = styled(Typography)(({ theme }) => ({ | ||
fontSize: theme.fontSizes.smallerBody, | ||
})); | ||
|
||
interface IProjectActionsFiltersCellProps { | ||
action: IActionSet; | ||
} | ||
|
||
export const ProjectActionsFiltersCell = ({ | ||
action, | ||
}: IProjectActionsFiltersCellProps) => { | ||
const { payload } = action.match; | ||
const filters = Object.keys(payload); | ||
|
||
if (filters.length === 0) { | ||
return <TextCell>0 filters</TextCell>; | ||
} | ||
|
||
return ( | ||
<TextCell> | ||
<TooltipLink | ||
tooltip={ | ||
<> | ||
{filters.map((filter) => ( | ||
<StyledItem key={filter}> | ||
{filter} = {payload[filter]} | ||
</StyledItem> | ||
))} | ||
</> | ||
} | ||
> | ||
{filters.length === 1 | ||
? '1 filter' | ||
: `${filters.length} filters`} | ||
</TooltipLink> | ||
</TextCell> | ||
); | ||
}; |
Oops, something went wrong.