-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
97 additions
and
2 deletions.
There are no files selected for viewing
96 changes: 96 additions & 0 deletions
96
packages/zapp/console/src/components/Entities/EntityVersionDetails.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,96 @@ | ||
import * as React from 'react'; | ||
import { withRouteParams } from 'components/common/withRouteParams'; | ||
import { ResourceIdentifier, ResourceType } from 'models/Common/types'; | ||
import { makeStyles, Theme } from '@material-ui/core/styles'; | ||
import { WaitForData } from 'components/common/WaitForData'; | ||
import { useProject } from 'components/hooks/useProjects'; | ||
import { StaticGraphContainer } from 'components/Workflow/StaticGraphContainer'; | ||
import { WorkflowId } from 'models/Workflow/types'; | ||
import { entitySections } from 'components/Entities/constants'; | ||
import { EntityDetailsHeader } from 'components/Entities/EntityDetailsHeader'; | ||
import { EntityVersions } from 'components/Entities/EntityVersions'; | ||
import { typeNameToEntityResource } from './constants'; | ||
|
||
const useStyles = makeStyles((theme: Theme) => ({ | ||
verionDetailsContatiner: { | ||
display: 'flex', | ||
flexDirection: 'column', | ||
flexWrap: 'nowrap', | ||
overflow: 'hidden', | ||
height: `calc(100vh - ${theme.spacing(1)}rem)`, | ||
}, | ||
staticGraphContainer: { | ||
display: 'flex', | ||
height: '60%', | ||
width: '100%', | ||
flex: '1', | ||
}, | ||
versionsContainer: { | ||
display: 'flex', | ||
flex: '0 1 auto', | ||
height: '40%', | ||
flexDirection: 'column', | ||
overflowY: 'scroll', | ||
}, | ||
})); | ||
|
||
interface WorkflowVersionDetailsRouteParams { | ||
projectId: string; | ||
domainId: string; | ||
entityType: string; | ||
entityName: string; | ||
entityVersion: string; | ||
} | ||
|
||
/** | ||
* The view component for the Workflow Versions page | ||
* @param projectId | ||
* @param domainId | ||
* @param workflowName | ||
*/ | ||
const WorkflowVersionDetailsContainer: React.FC<WorkflowVersionDetailsRouteParams> = ({ | ||
projectId, | ||
domainId, | ||
entityType, | ||
entityName, | ||
entityVersion, | ||
}) => { | ||
const workflowId = React.useMemo<WorkflowId>( | ||
() => ({ | ||
resourceType: typeNameToEntityResource[entityType], | ||
project: projectId, | ||
domain: domainId, | ||
name: entityName, | ||
version: entityVersion, | ||
}), | ||
[entityType, projectId, domainId, entityName, entityVersion], | ||
); | ||
|
||
const id = workflowId as ResourceIdentifier; | ||
const sections = entitySections[ResourceType.WORKFLOW]; | ||
const project = useProject(workflowId.project); | ||
const styles = useStyles(); | ||
|
||
return ( | ||
<WaitForData {...project}> | ||
<EntityDetailsHeader | ||
project={project.value} | ||
id={id} | ||
launchable={sections.launch} | ||
backToWorkflow | ||
/> | ||
<div className={styles.verionDetailsContatiner}> | ||
<div className={styles.staticGraphContainer}> | ||
<StaticGraphContainer workflowId={workflowId} /> | ||
</div> | ||
<div className={styles.versionsContainer}> | ||
<EntityVersions id={id} showAll /> | ||
</div> | ||
</div> | ||
</WaitForData> | ||
); | ||
}; | ||
|
||
export const EntityVersionDetails = withRouteParams<WorkflowVersionDetailsRouteParams>( | ||
WorkflowVersionDetailsContainer, | ||
); |
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