|
|
@@ -76,7 +76,6 @@ const ExpandedChart: React.FC<Props> = (props) => {
|
|
|
Record<string, Record<string, any>>
|
|
|
>({});
|
|
|
const [url, setUrl] = useState<string>(null);
|
|
|
- const [showDeleteOverlay, setShowDeleteOverlay] = useState<boolean>(false);
|
|
|
const [deleting, setDeleting] = useState<boolean>(false);
|
|
|
const [imageIsPlaceholder, setImageIsPlaceholer] = useState<boolean>(false);
|
|
|
const [newestImage, setNewestImage] = useState<string>(null);
|
|
|
@@ -91,9 +90,13 @@ const ExpandedChart: React.FC<Props> = (props) => {
|
|
|
closeWebsocket,
|
|
|
} = useWebsockets();
|
|
|
|
|
|
- const { currentCluster, currentProject, setCurrentError } = useContext(
|
|
|
- Context
|
|
|
- );
|
|
|
+ const {
|
|
|
+ currentCluster,
|
|
|
+ currentProject,
|
|
|
+ setCurrentError,
|
|
|
+ currentOverlay,
|
|
|
+ setCurrentOverlay,
|
|
|
+ } = useContext(Context);
|
|
|
|
|
|
// Retrieve full chart data (includes form and values)
|
|
|
const getChartData = async (chart: ChartType) => {
|
|
|
@@ -389,7 +392,17 @@ const ExpandedChart: React.FC<Props> = (props) => {
|
|
|
<SettingsSection
|
|
|
currentChart={chart}
|
|
|
refreshChart={() => getChartData(currentChart)}
|
|
|
- setShowDeleteOverlay={(x: boolean) => setShowDeleteOverlay(x)}
|
|
|
+ setShowDeleteOverlay={(x: boolean) => {
|
|
|
+ if (x) {
|
|
|
+ setCurrentOverlay({
|
|
|
+ message: `Are you sure you want to delete ${currentChart.name}?`,
|
|
|
+ onYes: handleUninstallChart,
|
|
|
+ onNo: () => setCurrentOverlay(null),
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ setCurrentOverlay(null);
|
|
|
+ }
|
|
|
+ }}
|
|
|
/>
|
|
|
);
|
|
|
case "graph":
|
|
|
@@ -560,7 +573,7 @@ const ExpandedChart: React.FC<Props> = (props) => {
|
|
|
};
|
|
|
|
|
|
const handleUninstallChart = async () => {
|
|
|
- setDeleting(true);
|
|
|
+ setCurrentOverlay(null);
|
|
|
try {
|
|
|
await api.uninstallTemplate(
|
|
|
"<token>",
|
|
|
@@ -573,7 +586,6 @@ const ExpandedChart: React.FC<Props> = (props) => {
|
|
|
cluster_id: currentCluster.id,
|
|
|
}
|
|
|
);
|
|
|
- setShowDeleteOverlay(false);
|
|
|
props.closeChart();
|
|
|
} catch (error) {
|
|
|
console.log(error);
|
|
|
@@ -653,17 +665,11 @@ const ExpandedChart: React.FC<Props> = (props) => {
|
|
|
return (
|
|
|
<>
|
|
|
<StyledExpandedChart>
|
|
|
- <ConfirmOverlay
|
|
|
- show={showDeleteOverlay}
|
|
|
- message={`Are you sure you want to delete ${currentChart.name}?`}
|
|
|
- onYes={handleUninstallChart}
|
|
|
- onNo={() => setShowDeleteOverlay(false)}
|
|
|
- />
|
|
|
- {deleting && (
|
|
|
- <DeleteOverlay>
|
|
|
- <Loading />
|
|
|
- </DeleteOverlay>
|
|
|
- )}
|
|
|
+ {deleting && (
|
|
|
+ <DeleteOverlay>
|
|
|
+ <Loading />
|
|
|
+ </DeleteOverlay>
|
|
|
+ )}
|
|
|
<HeaderWrapper>
|
|
|
<BackButton onClick={props.closeChart}>
|
|
|
<BackButtonImg src={backArrow} />
|
|
|
@@ -747,6 +753,7 @@ const TextWrap = styled.div``;
|
|
|
const BodyWrapper = styled.div`
|
|
|
position: relative;
|
|
|
overflow: hidden;
|
|
|
+ margin-bottom: 120px;
|
|
|
`;
|
|
|
|
|
|
const BackButton = styled.div`
|
|
|
@@ -965,15 +972,13 @@ const IconWrapper = styled.div`
|
|
|
|
|
|
const StyledExpandedChart = styled.div`
|
|
|
width: 100%;
|
|
|
+ overflow: hidden;
|
|
|
z-index: 0;
|
|
|
animation: fadeIn 0.3s;
|
|
|
animation-timing-function: ease-out;
|
|
|
animation-fill-mode: forwards;
|
|
|
display: flex;
|
|
|
- overflow-y: auto;
|
|
|
- padding-bottom: 120px;
|
|
|
flex-direction: column;
|
|
|
- overflow: visible;
|
|
|
|
|
|
@keyframes fadeIn {
|
|
|
from {
|