Added endpoint for yaml fetch and refactoring of targets (#2232)

Signed-off-by: Oum Nivrathi Kale <oum.kale@mayadata.io>
This commit is contained in:
OUM NIVRATHI KALE 2020-10-11 15:17:49 +05:30 committed by GitHub
parent ea97407487
commit 7b56f6fac3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 65 additions and 79 deletions

View File

@ -226,7 +226,7 @@ workflowCluster:
menu2: Not active menu2: Not active
menu4: Internal menu4: Internal
menu5: External menu5: External
menu6: pending menu6: Pending
# For Table # For Table
tableStatus: Status tableStatus: Status
tableCluster: Target agent tableCluster: Target agent
@ -234,8 +234,8 @@ workflowCluster:
time: Time time: Time
run: Last Run run: Last Run
connectionDate: Connection Date connectionDate: Connection Date
noWorkflows: Nom of workflows noWorkflows: No. of workflows
noSchedules: Nom of schedules noSchedules: No. of schedules
fetchingError: Unable to fetch data fetchingError: Unable to fetch data
recordAvailable: No records available recordAvailable: No records available
delete: Delete delete: Delete

View File

@ -54,13 +54,23 @@ const ClusterInfo: React.FC<ClusterVarsProps> = ({ location }) => {
</div> </div>
<div> <div>
{data.is_active ? ( {data.is_active ? (
<div className={classes.active}> <Typography
className={`${classes.check} ${classes.active}`}
>
{t('workflowCluster.header.formControl.menu1')} {t('workflowCluster.header.formControl.menu1')}
</div> </Typography>
) : data.is_cluster_confirmed === false ? (
<Typography
className={`${classes.check} ${classes.pending}`}
>
{t('workflowCluster.header.formControl.menu6')}
</Typography>
) : ( ) : (
<div className={classes.notactive}> <Typography
className={`${classes.check} ${classes.notactive}`}
>
{t('workflowCluster.header.formControl.menu2')} {t('workflowCluster.header.formControl.menu2')}
</div> </Typography>
)} )}
</div> </div>
</div> </div>

View File

@ -26,15 +26,6 @@ const useStyles = makeStyles((theme) => ({
marginLeft: theme.spacing(5), marginLeft: theme.spacing(5),
marginTop: theme.spacing(5), marginTop: theme.spacing(5),
}, },
active: {
width: '5.9125rem',
textAlign: 'center',
borderRadius: 3,
paddingTop: theme.spacing(0.375),
paddingBottom: theme.spacing(0.375),
color: theme.palette.primary.dark,
background: theme.palette.customColors.menuOption.active,
},
firstCol: { firstCol: {
display: 'flex', display: 'flex',
alignItems: 'center', alignItems: 'center',
@ -51,15 +42,6 @@ const useStyles = makeStyles((theme) => ({
version: { version: {
marginTop: theme.spacing(2), marginTop: theme.spacing(2),
}, },
notactive: {
width: '5.9125rem',
textAlign: 'center',
borderRadius: 3,
paddingTop: theme.spacing(0.375),
paddingBottom: theme.spacing(0.375),
color: theme.palette.error.dark,
backgroundColor: theme.palette.error.light,
},
aboutDiv: { aboutDiv: {
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
@ -100,6 +82,26 @@ const useStyles = makeStyles((theme) => ({
flexDirection: 'column', flexDirection: 'column',
flexGrow: 1, flexGrow: 1,
}, },
check: {
width: '5.9125rem',
textAlign: 'center',
borderRadius: 3,
paddingTop: theme.spacing(0.375),
paddingBottom: theme.spacing(0.375),
color: theme.palette.primary.dark,
},
active: {
color: theme.palette.primary.dark,
background: theme.palette.customColors.menuOption.active,
},
notactive: {
color: theme.palette.error.dark,
backgroundColor: theme.palette.error.light,
},
pending: {
background: theme.palette.customColors.menuOption.pending,
color: theme.palette.warning.main,
},
})); }));
export default useStyles; export default useStyles;

View File

@ -23,9 +23,13 @@ const TargetCopy: React.FC<InstallProps> = ({ yamlLink }) => {
.writeText(text) .writeText(text)
.catch((err) => console.error('Async: Could not copy text: ', err)); .catch((err) => console.error('Async: Could not copy text: ', err));
setTimeout(() => setCopying(false), 3000); setTimeout(() => setCopying(false), 6000);
} }
const engineUrl: string = `kubectl apply -f http://localhost:8080/file/${yamlLink}.yaml`;
const x = window.location.hostname;
const y = window.location.port;
const engineUrl: string = `kubectl apply -f http://${x}:${y}/file/${yamlLink}.yaml`;
const { t } = useTranslation(); const { t } = useTranslation();

View File

@ -24,7 +24,11 @@ const TableData: React.FC<TableDataProps> = ({ data }) => {
return ( return (
<> <>
<TableCell className={classes.tableDataStatus}> <TableCell className={classes.tableDataStatus}>
{data.is_active ? ( {data.is_cluster_confirmed === false ? (
<Typography className={`${classes.check} ${classes.pending}`}>
{t('workflowCluster.header.formControl.menu6')}
</Typography>
) : data.is_cluster_confirmed === true && data.is_active ? (
<Typography className={`${classes.check} ${classes.active}`}> <Typography className={`${classes.check} ${classes.active}`}>
{t('workflowCluster.header.formControl.menu1')} {t('workflowCluster.header.formControl.menu1')}
</Typography> </Typography>
@ -45,10 +49,8 @@ const TableData: React.FC<TableDataProps> = ({ data }) => {
<Typography>{data.cluster_name}</Typography> <Typography>{data.cluster_name}</Typography>
</IconButton> </IconButton>
</TableCell> </TableCell>
<TableCell> <TableCell className={classes.stepsData}>
<Typography className={classes.clusterName}> {formatDate(data.updated_at)}
{formatDate(data.created_at)}
</Typography>
</TableCell> </TableCell>
<TableCell> <TableCell>
<Typography className={classes.stepsData}> <Typography className={classes.stepsData}>
@ -59,23 +61,6 @@ const TableData: React.FC<TableDataProps> = ({ data }) => {
<Typography>{data.no_of_schedules}</Typography> <Typography>{data.no_of_schedules}</Typography>
</TableCell> </TableCell>
<TableCell>{formatDate(data.updated_at)}</TableCell> <TableCell>{formatDate(data.updated_at)}</TableCell>
<TableCell>
<Typography>{/* reconnect */}</Typography>
</TableCell>
<TableCell>
<div className={classes.deleteCluster}>
<div>
<IconButton>
<img alt="delete" src="/icons/bin-red.svg" />
</IconButton>
</div>
<div>
<Typography>
{t('workflowCluster.header.formControl.delete')}
</Typography>
</div>
</div>
</TableCell>
</> </>
); );
}; };

View File

@ -105,15 +105,10 @@ const BrowseCluster = () => {
const p = 'pending'; const p = 'pending';
return p.includes(filters.status.toLowerCase()); return p.includes(filters.status.toLowerCase());
} }
if ((dataRow.is_active as boolean).toString().toLowerCase() === 'false') { return (dataRow.is_active as boolean)
const p = 'false'; .toString()
return p.includes(filters.status.toLowerCase()); .toLowerCase()
} .includes(filters.status.toLowerCase());
if ((dataRow.is_active as boolean).toString().toLowerCase() === 'true') {
const p = 'true';
return p.includes(filters.status.toLowerCase());
}
return true;
}) })
.filter((dataRow) => .filter((dataRow) =>
filters.cluster === 'All' filters.cluster === 'All'
@ -242,7 +237,7 @@ const BrowseCluster = () => {
{t('workflowCluster.header.formControl.tableStatus')} {t('workflowCluster.header.formControl.tableStatus')}
</Typography> </Typography>
<IconButton <IconButton
aria-label="sort last run descending" aria-label="sort in descending order"
size="small" size="small"
onClick={() => onClick={() =>
setSortData({ setSortData({
@ -267,7 +262,7 @@ const BrowseCluster = () => {
{t('workflowCluster.header.formControl.tableCluster')} {t('workflowCluster.header.formControl.tableCluster')}
</Typography> </Typography>
<IconButton <IconButton
aria-label="sort last run descending" aria-label="sort in descending"
size="small" size="small"
onClick={() => onClick={() =>
setSortData({ setSortData({
@ -314,11 +309,6 @@ const BrowseCluster = () => {
</Typography> </Typography>
</div> </div>
</TableCell> </TableCell>
{/* Re-connect */}
<TableCell />
<TableCell />
<TableCell />
</TableRow> </TableRow>
</TableHead> </TableHead>
@ -326,13 +316,13 @@ const BrowseCluster = () => {
<TableBody> <TableBody>
{loading ? ( {loading ? (
<TableRow> <TableRow>
<TableCell colSpan={8}> <TableCell colSpan={6}>
<Loader /> <Loader />
</TableCell> </TableCell>
</TableRow> </TableRow>
) : error ? ( ) : error ? (
<TableRow> <TableRow>
<TableCell data-cy="browseScheduleError" colSpan={8}> <TableCell data-cy="browseClusterError" colSpan={6}>
<Typography align="center"> <Typography align="center">
{t('workflowCluster.header.formControl.fetchingError')} {t('workflowCluster.header.formControl.fetchingError')}
</Typography> </Typography>
@ -346,16 +336,13 @@ const BrowseCluster = () => {
paginationData.rowsPerPage paginationData.rowsPerPage
) )
.map((data: Cluster) => ( .map((data: Cluster) => (
<TableRow <TableRow data-cy="browseClusterData" key={data.cluster_id}>
data-cy="browseScheduleData"
key={data.cluster_id}
>
<TableData data={data} /> <TableData data={data} />
</TableRow> </TableRow>
)) ))
) : ( ) : (
<TableRow> <TableRow>
<TableCell data-cy="browseScheduleNoData" colSpan={0}> <TableCell data-cy="browseClusterNoData" colSpan={0}>
<Typography align="center"> <Typography align="center">
{t('workflowCluster.header.formControl.recordAvailable')} {t('workflowCluster.header.formControl.recordAvailable')}
</Typography> </Typography>

View File

@ -23,7 +23,6 @@ const useStyles = makeStyles((theme) => ({
borderBottom: `1px solid ${theme.palette.customColors.black(0.1)}`, borderBottom: `1px solid ${theme.palette.customColors.black(0.1)}`,
marginLeft: theme.spacing(6.25), marginLeft: theme.spacing(6.25),
}, },
// Form Select Properties // Form Select Properties
formControl: { formControl: {
margin: theme.spacing(0.5), margin: theme.spacing(0.5),
@ -31,12 +30,10 @@ const useStyles = makeStyles((theme) => ({
height: '2.5rem', height: '2.5rem',
minWidth: '9rem', minWidth: '9rem',
}, },
selectText: { selectText: {
height: '2.5rem', height: '2.5rem',
padding: theme.spacing(0.5), padding: theme.spacing(0.5),
}, },
selectDate: { selectDate: {
display: 'flex', display: 'flex',
flexDirection: 'row', flexDirection: 'row',
@ -52,7 +49,6 @@ const useStyles = makeStyles((theme) => ({
marginLeft: theme.spacing(1), marginLeft: theme.spacing(1),
width: '100%', width: '100%',
}, },
// Table and Table Data Properties // Table and Table Data Properties
tableMain: { tableMain: {
marginTop: theme.spacing(4.25), marginTop: theme.spacing(4.25),
@ -73,7 +69,6 @@ const useStyles = makeStyles((theme) => ({
color: theme.palette.customColors.black(0.4), color: theme.palette.customColors.black(0.4),
}, },
sortDiv: { sortDiv: {
paddingTop: theme.spacing(0.5),
paddingLeft: theme.spacing(1.5), paddingLeft: theme.spacing(1.5),
}, },
headData: { headData: {
@ -161,10 +156,13 @@ const useStyles = makeStyles((theme) => ({
color: theme.palette.error.dark, color: theme.palette.error.dark,
backgroundColor: theme.palette.error.light, backgroundColor: theme.palette.error.light,
}, },
pending: {
background: theme.palette.customColors.menuOption.pending,
color: theme.palette.warning.main,
},
statusFont: { statusFont: {
fontSize: '0.725rem', fontSize: '0.725rem',
}, },
// Delete Cluster Modal // Delete Cluster Modal
body: { body: {
display: 'flex', display: 'flex',

View File

@ -51,11 +51,11 @@ const useStyles = makeStyles((theme: Theme) => ({
}, },
text1: { text1: {
width: '27.5rem', width: '27.5rem',
height: '1.6875rem',
marginBottom: theme.spacing(3.75), marginBottom: theme.spacing(3.75),
}, },
typo1: { typo1: {
fontSize: '1rem', fontSize: '1rem',
marginBottom: theme.spacing(2),
}, },
buttonModal: { buttonModal: {
marginTop: theme.spacing(3.75), marginTop: theme.spacing(3.75),