-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from osstotalsoft/metadata-history
Metadata history
- Loading branch information
Showing
13 changed files
with
224 additions
and
13 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
48 changes: 48 additions & 0 deletions
48
react-ui/src/features/workflow/history/components/ExecutionHistoryContainer.js
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,48 @@ | ||
import React from 'react' | ||
import { useQueryWithErrorHandling } from 'hooks/errorHandling' | ||
import { EXECUTION_HISTORY_QUERY } from '../queries/HistoryQuery' | ||
import { FakeText } from '@totalsoft/rocket-ui' | ||
import Table from '@mui/material/Table' | ||
import TableBody from '@mui/material/TableBody' | ||
import TableCell from '@mui/material/TableCell' | ||
import TableContainer from '@mui/material/TableContainer' | ||
import TableHead from '@mui/material/TableHead' | ||
import TableRow from '@mui/material/TableRow' | ||
import Paper from '@mui/material/Paper' | ||
import { useTranslation } from 'react-i18next' | ||
|
||
const ExecutionHistoryContainer = () => { | ||
const { t } = useTranslation() | ||
const { loading, data } = useQueryWithErrorHandling(EXECUTION_HISTORY_QUERY, { variables: {} }) | ||
|
||
const flows = data?.allExecutionHistory | ||
? Object.keys(data?.allExecutionHistory).map(a => ({ name: a, value: data?.allExecutionHistory[a] })) | ||
: [] | ||
|
||
if (loading) return <FakeText lines={8} /> | ||
|
||
return ( | ||
<TableContainer component={Paper}> | ||
<Table sx={{ minWidth: 650 }} size='small' aria-label='simple table'> | ||
<TableHead> | ||
<TableRow> | ||
<TableCell>{t("History.Flow")}</TableCell> | ||
<TableCell align='right'>{t("History.ExecutionCount")}</TableCell> | ||
</TableRow> | ||
</TableHead> | ||
<TableBody> | ||
{flows.map((flow, index) => ( | ||
<TableRow key={index} sx={{ '&:last-child td, &:last-child th': { border: 0 } }}> | ||
<TableCell component='th' scope='row'> | ||
{flow.name} | ||
</TableCell> | ||
<TableCell align='right'>{flow.value}</TableCell> | ||
</TableRow> | ||
))} | ||
</TableBody> | ||
</Table> | ||
</TableContainer> | ||
) | ||
} | ||
|
||
export default ExecutionHistoryContainer |
50 changes: 50 additions & 0 deletions
50
react-ui/src/features/workflow/history/components/HistoryContainer.js
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,50 @@ | ||
import React, { useCallback, useState } from 'react' | ||
import { useQueryWithErrorHandling } from 'hooks/errorHandling' | ||
import { HISTORY_QUERY } from '../queries/HistoryQuery' | ||
import List from '@mui/material/List' | ||
import ListItem from '@mui/material/ListItem' | ||
import ListItemText from '@mui/material/ListItemText' | ||
import ListItemButton from '@mui/material/ListItemButton' | ||
import Grid from '@mui/material/Grid' | ||
import { FakeText } from '@totalsoft/rocket-ui' | ||
import CompareDefinition from 'features/workflow/edit/components/workflowHistory/modals/CompareDefinition' | ||
|
||
const HistoryContainer = () => { | ||
const [flow, setFlow] = useState(null) | ||
const { loading, data } = useQueryWithErrorHandling(HISTORY_QUERY, { variables: {} }) | ||
|
||
const flows = data?.allWorkflowHistory || [] | ||
|
||
const onViewClick = useCallback( | ||
event => { | ||
const name = event.currentTarget.id | ||
setFlow(data?.allWorkflowHistory[name]) | ||
}, | ||
[setFlow, data?.allWorkflowHistory] | ||
) | ||
|
||
if (loading) return <FakeText lines={8} /> | ||
|
||
return ( | ||
<> | ||
<Grid container> | ||
<Grid item xs={2} style={{ overflowY: 'scroll', maxHeight: 'calc(100vh - 150px)' }}> | ||
<List> | ||
{Object.keys(flows).map((flow, index) => ( | ||
<ListItem key={index} disablePadding> | ||
<ListItemButton id={flow} name={flow} onClick={onViewClick}> | ||
<ListItemText style={{ wordBreak: 'break-all' }} primary={flows[flow].current.name} /> | ||
</ListItemButton> | ||
</ListItem> | ||
))} | ||
</List> | ||
</Grid> | ||
<Grid item xs={10} style={{ overflowY: 'scroll', maxHeight: 'calc(100vh - 150px)' }}> | ||
{flow && <CompareDefinition definition={flow?.latest?.definition} currentDefinition={flow?.current} showDates={true} />} | ||
</Grid> | ||
</Grid> | ||
</> | ||
) | ||
} | ||
|
||
export default HistoryContainer |
13 changes: 13 additions & 0 deletions
13
react-ui/src/features/workflow/history/queries/HistoryQuery.js
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,13 @@ | ||
import { gql } from '@apollo/client' | ||
|
||
export const HISTORY_QUERY = gql` | ||
query allWorkflowHistory { | ||
allWorkflowHistory | ||
} | ||
` | ||
|
||
export const EXECUTION_HISTORY_QUERY = gql` | ||
query allExecutionHistory { | ||
allExecutionHistory | ||
} | ||
` |
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