Updated graphql schema and added filter in browse workflow section (#2062)
- Updated graphql schema with cluster_name and cluster_type in frontend - Added filter functionality in the browse workflow section Signed-off-by: Amit Kumar Das <amitkumar.das@mayadata.io>
This commit is contained in:
parent
7c1dd4365f
commit
51ac9bd8ee
|
@ -10,6 +10,7 @@ export const WORKFLOW_DETAILS = gql`
|
||||||
project_id
|
project_id
|
||||||
cluster_name
|
cluster_name
|
||||||
last_updated
|
last_updated
|
||||||
|
cluster_type
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
@ -31,6 +32,8 @@ export const SCHEDULE_DETAILS = gql`
|
||||||
created_at
|
created_at
|
||||||
project_id
|
project_id
|
||||||
cluster_id
|
cluster_id
|
||||||
|
cluster_type
|
||||||
|
cluster_name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -15,6 +15,8 @@ export interface ScheduleWorkflow {
|
||||||
workflow_id: string;
|
workflow_id: string;
|
||||||
workflow_manifest: string;
|
workflow_manifest: string;
|
||||||
workflow_name: string;
|
workflow_name: string;
|
||||||
|
cluster_name: string;
|
||||||
|
cluster_type: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Schedules {
|
export interface Schedules {
|
||||||
|
|
|
@ -46,6 +46,7 @@ export interface WorkflowRun {
|
||||||
workflow_id: string;
|
workflow_id: string;
|
||||||
workflow_name: string;
|
workflow_name: string;
|
||||||
workflow_run_id: string;
|
workflow_run_id: string;
|
||||||
|
cluster_type: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Workflow {
|
export interface Workflow {
|
||||||
|
|
|
@ -48,8 +48,8 @@ const TableData: React.FC<TableDataProps> = ({ data, deleteRow }) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Function to convert UNIX time in format of DD MMM YYY
|
// Function to convert UNIX time in format of DD MMM YYY
|
||||||
const formatDate = (date: any) => {
|
const formatDate = (date: string) => {
|
||||||
const updated = new Date(date * 1000).toString();
|
const updated = new Date(parseInt(date, 10) * 1000).toString();
|
||||||
const resDate = moment(updated).format('DD MMM YYYY');
|
const resDate = moment(updated).format('DD MMM YYYY');
|
||||||
if (date) return resDate;
|
if (date) return resDate;
|
||||||
return 'Date not available';
|
return 'Date not available';
|
||||||
|
@ -76,7 +76,7 @@ const TableData: React.FC<TableDataProps> = ({ data, deleteRow }) => {
|
||||||
</div>
|
</div>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<Typography>Internal</Typography>
|
<Typography>{data.cluster_name}</Typography>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<Button onClick={handlePopOverClick} style={{ textTransform: 'none' }}>
|
<Button onClick={handlePopOverClick} style={{ textTransform: 'none' }}>
|
||||||
|
|
|
@ -96,11 +96,13 @@ const BrowseSchedule = () => {
|
||||||
.filter((dataRow) =>
|
.filter((dataRow) =>
|
||||||
dataRow.workflow_name.toLowerCase().includes(filter.search.toLowerCase())
|
dataRow.workflow_name.toLowerCase().includes(filter.search.toLowerCase())
|
||||||
)
|
)
|
||||||
// .filter((dataRow) =>
|
.filter((dataRow) =>
|
||||||
// filter.cluster === 'All'
|
filter.cluster === 'All'
|
||||||
// ? true
|
? true
|
||||||
// : dataRow.cluster_name.toLowerCase().includes(filter.cluster)
|
: dataRow.cluster_type
|
||||||
// )
|
.toLowerCase()
|
||||||
|
.includes(filter.cluster.toLowerCase())
|
||||||
|
)
|
||||||
.sort((a: ScheduleWorkflow, b: ScheduleWorkflow) => {
|
.sort((a: ScheduleWorkflow, b: ScheduleWorkflow) => {
|
||||||
// Sorting based on unique fields
|
// Sorting based on unique fields
|
||||||
if (sortData.name.sort) {
|
if (sortData.name.sort) {
|
||||||
|
|
|
@ -35,6 +35,13 @@ const TableData: React.FC<TableDataProps> = ({ data, exeData }) => {
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
setAnchorEl(null);
|
setAnchorEl(null);
|
||||||
};
|
};
|
||||||
|
// Function to capitalize the first letter of the word
|
||||||
|
// eg: internal to Internal
|
||||||
|
const nameCapitalized = (clusterType: string) => {
|
||||||
|
if (clusterType)
|
||||||
|
return clusterType.charAt(0).toUpperCase() + clusterType.slice(1);
|
||||||
|
return 'Not Available';
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -48,7 +55,7 @@ const TableData: React.FC<TableDataProps> = ({ data, exeData }) => {
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<Typography className={classes.clusterName}>
|
<Typography className={classes.clusterName}>
|
||||||
{data.cluster_name}
|
{nameCapitalized(data.cluster_type)}
|
||||||
</Typography>
|
</Typography>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
|
|
|
@ -157,7 +157,9 @@ const BrowseWorkflow = () => {
|
||||||
.filter((dataRow) =>
|
.filter((dataRow) =>
|
||||||
filters.cluster === 'All'
|
filters.cluster === 'All'
|
||||||
? true
|
? true
|
||||||
: dataRow.cluster_name.includes(filters.cluster)
|
: dataRow.cluster_type
|
||||||
|
.toLowerCase()
|
||||||
|
.includes(filters.cluster.toLowerCase())
|
||||||
)
|
)
|
||||||
.filter((dataRow) => {
|
.filter((dataRow) => {
|
||||||
return dateRange.fromDate && dateRange.toDate === undefined
|
return dateRange.fromDate && dateRange.toDate === undefined
|
||||||
|
|
|
@ -95,7 +95,7 @@ const useStyles = makeStyles((theme) => ({
|
||||||
color: theme.palette.customColors.black(0.4),
|
color: theme.palette.customColors.black(0.4),
|
||||||
},
|
},
|
||||||
clusterName: {
|
clusterName: {
|
||||||
marginLeft: theme.spacing(3.75),
|
marginLeft: theme.spacing(4),
|
||||||
},
|
},
|
||||||
reliabiltyData: {
|
reliabiltyData: {
|
||||||
width: '8.125rem',
|
width: '8.125rem',
|
||||||
|
|
Loading…
Reference in New Issue