Skip to content

Commit

Permalink
ui/solutions: Disable the cursor when the env is under terminating
Browse files Browse the repository at this point in the history
Refs: #2949
  • Loading branch information
ChengYanJin committed Dec 1, 2020
1 parent eb6b2c0 commit 8190bca
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion ui/src/containers/SolutionList.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
prepareEnvironmentAction,
deleteEnvironmentAction,
} from '../ducks/app/solutions';
import { STATUS_TERMINATING } from '../constants';

const PageSubtitle = styled.h3`
color: ${(props) => props.theme.brand.textPrimary};
Expand Down Expand Up @@ -73,16 +74,26 @@ const LoaderContainer = styled.div`
flex-wrap: nowrap;
padding: 0 0 0 ${padding.smaller};
`;

const TrashButtonContainer = styled(Button)`
.sc-button-text {
cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};
// To make the graphic element become the target of the pointer events.
pointer-events: all;
}
${(props) => {
if (props.disabled) return { opacity: 0.2 };
if (props.disabled) {
return { opacity: 0.2 };
}
}};
}
`;

const SolutionsList = (props) => {
const theme = useSelector((state) => state.config.theme);
const solutions = useSelector((state) => state.app.solutions.solutions);
const environments = useSelector((state) => state.app.solutions.environments);
console.log('environments', environments);
const history = useHistory();
const dispatch = useDispatch();
useRefreshEffect(refreshSolutionsAction, stopRefreshSolutionsAction);
Expand Down Expand Up @@ -193,6 +204,9 @@ const SolutionsList = (props) => {
dispatch(deleteEnvironmentAction(environment.name));
}}
inverted={true}
disabled={
environment.namespaces[0].status.phase === STATUS_TERMINATING
}
icon={<i className="fas fa-lg fa-trash" />}
data-cy={`delete_${environment.name}_button`}
></TrashButtonContainer>
Expand Down

0 comments on commit 8190bca

Please sign in to comment.