Updated the fetch policy for getting experiment and engine yaml from MyHub (#2562)
* Updated the fetch policy for getting experiment and engine yaml Signed-off-by: Amit Kumar Das <amitkumar.das@mayadata.io> * Added a check to disable viewers to update MyHub Signed-off-by: Amit Kumar Das <amitkumar.das@mayadata.io> * Minor change Signed-off-by: Amit Kumar Das <amitkumar.das@mayadata.io>
This commit is contained in:
parent
5f35b3b7e7
commit
8258414935
|
|
@ -10,10 +10,12 @@ import MoreVertIcon from '@material-ui/icons/MoreVert';
|
|||
import moment from 'moment';
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useSelector } from 'react-redux';
|
||||
import ButtonFilled from '../../components/Button/ButtonFilled';
|
||||
import Loader from '../../components/Loader';
|
||||
import { HubDetails } from '../../models/redux/myhub';
|
||||
import { history } from '../../redux/configureStore';
|
||||
import { RootState } from '../../redux/reducers';
|
||||
import useStyles from './styles';
|
||||
|
||||
interface customMyHubCardProp {
|
||||
|
|
@ -37,6 +39,9 @@ const CustomMyHubCard: React.FC<customMyHubCardProp> = ({
|
|||
}) => {
|
||||
const classes = useStyles();
|
||||
|
||||
// UserData from Redux
|
||||
const userData = useSelector((state: RootState) => state.userData);
|
||||
|
||||
// States for PopOver to display Experiment Weights
|
||||
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
|
||||
const open = Boolean(anchorEl);
|
||||
|
|
@ -68,74 +73,81 @@ const CustomMyHubCard: React.FC<customMyHubCardProp> = ({
|
|||
>
|
||||
{hub.IsAvailable ? 'Connected' : 'Error'}
|
||||
</Typography>
|
||||
<IconButton
|
||||
aria-label="more"
|
||||
aria-controls="long-menu"
|
||||
aria-haspopup="true"
|
||||
onClick={handleClick}
|
||||
data-cy="browseScheduleOptions"
|
||||
className={classes.iconButton}
|
||||
>
|
||||
<MoreVertIcon className={classes.cardOption} />
|
||||
</IconButton>
|
||||
<Menu
|
||||
id="long-menu"
|
||||
anchorEl={anchorEl}
|
||||
keepMounted
|
||||
open={open}
|
||||
onClose={handleClose}
|
||||
>
|
||||
<MenuItem
|
||||
value="Refresh"
|
||||
onClick={() => {
|
||||
handleRefresh(hub.id);
|
||||
}}
|
||||
>
|
||||
<div className={classes.cardMenu}>
|
||||
<img
|
||||
src="./icons/refresh.svg"
|
||||
alt="Refresh"
|
||||
className={classes.refreshImg}
|
||||
/>
|
||||
<Typography data-cy="viewHub">{t('myhub.refresh')}</Typography>
|
||||
</div>
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
value="View"
|
||||
onClick={() => {
|
||||
history.push(`/myhub/edit/${hub.HubName}`);
|
||||
}}
|
||||
>
|
||||
<div className={classes.cardMenu}>
|
||||
<img
|
||||
src="./icons/Edit.svg"
|
||||
alt="Edit"
|
||||
className={classes.editImg}
|
||||
/>
|
||||
<Typography data-cy="viewHub">{t('myhub.edit')}</Typography>
|
||||
</div>
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
value="Delete"
|
||||
onClick={() => {
|
||||
handleDelete(hub.id);
|
||||
}}
|
||||
>
|
||||
<div className={classes.cardMenu}>
|
||||
<img
|
||||
src="./icons/bin-red.svg"
|
||||
alt="disconnect"
|
||||
className={classes.disconnectImg}
|
||||
/>
|
||||
<Typography
|
||||
className={classes.disconnectText}
|
||||
data-cy="viewHub"
|
||||
{userData.userRole !== 'Viewer' && (
|
||||
<>
|
||||
<IconButton
|
||||
aria-label="more"
|
||||
aria-controls="long-menu"
|
||||
aria-haspopup="true"
|
||||
onClick={handleClick}
|
||||
data-cy="browseScheduleOptions"
|
||||
className={classes.iconButton}
|
||||
>
|
||||
<MoreVertIcon className={classes.cardOption} />
|
||||
</IconButton>
|
||||
<Menu
|
||||
id="long-menu"
|
||||
anchorEl={anchorEl}
|
||||
keepMounted
|
||||
open={open}
|
||||
onClose={handleClose}
|
||||
>
|
||||
<MenuItem
|
||||
value="Refresh"
|
||||
onClick={() => {
|
||||
handleRefresh(hub.id);
|
||||
}}
|
||||
>
|
||||
{t('myhub.disconnect')}
|
||||
</Typography>
|
||||
</div>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
<div className={classes.cardMenu}>
|
||||
<img
|
||||
src="./icons/refresh.svg"
|
||||
alt="Refresh"
|
||||
className={classes.refreshImg}
|
||||
/>
|
||||
<Typography data-cy="viewHub">
|
||||
{t('myhub.refresh')}
|
||||
</Typography>
|
||||
</div>
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
value="View"
|
||||
onClick={() => {
|
||||
history.push(`/myhub/edit/${hub.HubName}`);
|
||||
}}
|
||||
>
|
||||
<div className={classes.cardMenu}>
|
||||
<img
|
||||
src="./icons/Edit.svg"
|
||||
alt="Edit"
|
||||
className={classes.editImg}
|
||||
/>
|
||||
<Typography data-cy="viewHub">{t('myhub.edit')}</Typography>
|
||||
</div>
|
||||
</MenuItem>
|
||||
|
||||
<MenuItem
|
||||
value="Delete"
|
||||
onClick={() => {
|
||||
handleDelete(hub.id);
|
||||
}}
|
||||
>
|
||||
<div className={classes.cardMenu}>
|
||||
<img
|
||||
src="./icons/bin-red.svg"
|
||||
alt="disconnect"
|
||||
className={classes.disconnectImg}
|
||||
/>
|
||||
<Typography
|
||||
className={classes.disconnectText}
|
||||
data-cy="viewHub"
|
||||
>
|
||||
{t('myhub.disconnect')}
|
||||
</Typography>
|
||||
</div>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<img
|
||||
src={`./icons/${
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ const CreateWorkflow: React.FC<VerifyCommitProps> = ({ gotoStep }) => {
|
|||
FileType: 'experiment',
|
||||
},
|
||||
},
|
||||
fetchPolicy: 'no-cache',
|
||||
onCompleted: (data) => {
|
||||
const parsedYaml = YAML.parse(data.getYAMLData);
|
||||
workflowAction.setWorkflowDetails({
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ const TuneCustomWorkflow: React.FC<VerifyCommitProps> = ({ gotoStep }) => {
|
|||
const { t } = useTranslation();
|
||||
const userData = useSelector((state: RootState) => state.userData);
|
||||
const [getEngineYaml] = useLazyQuery(GET_ENGINE_YAML, {
|
||||
fetchPolicy: 'no-cache',
|
||||
onCompleted: (data) => {
|
||||
const parsedYaml = YAML.parse(data.getYAMLData);
|
||||
setEnv([...parsedYaml.spec.experiments[0].spec.components.env]);
|
||||
|
|
|
|||
Loading…
Reference in New Issue