|
@@ -3,6 +3,7 @@ import Placeholder from "components/Placeholder";
|
|
|
import TabSelector from "components/TabSelector";
|
|
import TabSelector from "components/TabSelector";
|
|
|
import TitleSection from "components/TitleSection";
|
|
import TitleSection from "components/TitleSection";
|
|
|
import React, { useContext, useEffect, useState } from "react";
|
|
import React, { useContext, useEffect, useState } from "react";
|
|
|
|
|
+import backArrow from "assets/back_arrow.png";
|
|
|
import { useParams } from "react-router";
|
|
import { useParams } from "react-router";
|
|
|
import api from "shared/api";
|
|
import api from "shared/api";
|
|
|
import { Context } from "shared/Context";
|
|
import { Context } from "shared/Context";
|
|
@@ -26,6 +27,8 @@ import { FullStackRevision, Stack, StackRevision } from "../types";
|
|
|
import EnvGroups from "./components/EnvGroups";
|
|
import EnvGroups from "./components/EnvGroups";
|
|
|
import RevisionList from "./_RevisionList";
|
|
import RevisionList from "./_RevisionList";
|
|
|
import SourceConfig from "./_SourceConfig";
|
|
import SourceConfig from "./_SourceConfig";
|
|
|
|
|
+import { NavLink } from "react-router-dom";
|
|
|
|
|
+import Settings from "./components/Settings";
|
|
|
|
|
|
|
|
const ExpandedStack = () => {
|
|
const ExpandedStack = () => {
|
|
|
const { namespace, stack_id } = useParams<{
|
|
const { namespace, stack_id } = useParams<{
|
|
@@ -40,8 +43,8 @@ const ExpandedStack = () => {
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
const [stack, setStack] = useState<Stack>();
|
|
const [stack, setStack] = useState<Stack>();
|
|
|
- const [sortType, setSortType] = useState("Alphabetical");
|
|
|
|
|
const [isLoading, setIsLoading] = useState(true);
|
|
const [isLoading, setIsLoading] = useState(true);
|
|
|
|
|
+ const [isDeleting, setIsDeleting] = useState(false);
|
|
|
const [currentTab, setCurrentTab] = useState("apps");
|
|
const [currentTab, setCurrentTab] = useState("apps");
|
|
|
|
|
|
|
|
const [currentRevision, setCurrentRevision] = useState<FullStackRevision>();
|
|
const [currentRevision, setCurrentRevision] = useState<FullStackRevision>();
|
|
@@ -71,6 +74,28 @@ const ExpandedStack = () => {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ const handleDelete = () => {
|
|
|
|
|
+ setIsDeleting(true);
|
|
|
|
|
+ api
|
|
|
|
|
+ .deleteStack(
|
|
|
|
|
+ "<token>",
|
|
|
|
|
+ {},
|
|
|
|
|
+ {
|
|
|
|
|
+ namespace,
|
|
|
|
|
+ project_id: currentProject.id,
|
|
|
|
|
+ cluster_id: currentCluster.id,
|
|
|
|
|
+ stack_id: stack.id,
|
|
|
|
|
+ }
|
|
|
|
|
+ )
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ pushFiltered("/stacks", []);
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch((err) => {
|
|
|
|
|
+ setCurrentError(err);
|
|
|
|
|
+ setIsDeleting(false);
|
|
|
|
|
+ });
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
getStack();
|
|
getStack();
|
|
|
}, [stack_id]);
|
|
}, [stack_id]);
|
|
@@ -79,14 +104,25 @@ const ExpandedStack = () => {
|
|
|
return <Loading />;
|
|
return <Loading />;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if (isDeleting) {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <Placeholder height="400px">
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <h1>Deleting Stack</h1>
|
|
|
|
|
+ <p>This may take some time...</p>
|
|
|
|
|
+ <Loading />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </Placeholder>
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<div>
|
|
<div>
|
|
|
<StackTitleWrapper>
|
|
<StackTitleWrapper>
|
|
|
- <TitleSection
|
|
|
|
|
- materialIconClass="material-icons-outlined"
|
|
|
|
|
- icon={"lan"}
|
|
|
|
|
- capitalize
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <BackButton to="/stacks">
|
|
|
|
|
+ <BackButtonImg src={backArrow} />
|
|
|
|
|
+ </BackButton>
|
|
|
|
|
+ <TitleSection materialIconClass="material-icons-outlined" icon={"lan"}>
|
|
|
{stack.name}
|
|
{stack.name}
|
|
|
</TitleSection>
|
|
</TitleSection>
|
|
|
<NamespaceTag.Wrapper>
|
|
<NamespaceTag.Wrapper>
|
|
@@ -94,41 +130,13 @@ const ExpandedStack = () => {
|
|
|
<NamespaceTag.Tag>{stack.namespace}</NamespaceTag.Tag>
|
|
<NamespaceTag.Tag>{stack.namespace}</NamespaceTag.Tag>
|
|
|
</NamespaceTag.Wrapper>
|
|
</NamespaceTag.Wrapper>
|
|
|
</StackTitleWrapper>
|
|
</StackTitleWrapper>
|
|
|
- <RevisionList
|
|
|
|
|
- revisions={stack.revisions}
|
|
|
|
|
- currentRevision={currentRevision}
|
|
|
|
|
- latestRevision={stack.latest_revision}
|
|
|
|
|
- stackId={stack.id}
|
|
|
|
|
- stackNamespace={namespace}
|
|
|
|
|
- onRevisionClick={(revision) => setCurrentRevision(revision)}
|
|
|
|
|
- onRollback={() => getStack()}
|
|
|
|
|
- ></RevisionList>
|
|
|
|
|
- <Br />
|
|
|
|
|
- <InfoWrapper>
|
|
|
|
|
- <LastDeployed>
|
|
|
|
|
- <Status
|
|
|
|
|
- status={getStackStatus(stack)}
|
|
|
|
|
- message={getStackStatusMessage(stack)}
|
|
|
|
|
- />
|
|
|
|
|
- <SepDot>•</SepDot>
|
|
|
|
|
- <Text color="#aaaabb">
|
|
|
|
|
- {!stack.latest_revision?.id
|
|
|
|
|
- ? `No version found`
|
|
|
|
|
- : `v${stack.latest_revision.id}`}
|
|
|
|
|
- </Text>
|
|
|
|
|
- <SepDot>•</SepDot>
|
|
|
|
|
- Last updated {readableDate(stack.updated_at)}
|
|
|
|
|
- </LastDeployed>
|
|
|
|
|
- </InfoWrapper>
|
|
|
|
|
|
|
|
|
|
{/* Stack error message */}
|
|
{/* Stack error message */}
|
|
|
{currentRevision &&
|
|
{currentRevision &&
|
|
|
currentRevision?.reason &&
|
|
currentRevision?.reason &&
|
|
|
currentRevision?.message?.length > 0 ? (
|
|
currentRevision?.message?.length > 0 ? (
|
|
|
<StackErrorMessageStyles.Wrapper>
|
|
<StackErrorMessageStyles.Wrapper>
|
|
|
- <StackErrorMessageStyles.Title color="#b7b7c9">
|
|
|
|
|
- Revision message:
|
|
|
|
|
- </StackErrorMessageStyles.Title>
|
|
|
|
|
|
|
+ <i className="material-icons">history</i>
|
|
|
<StackErrorMessageStyles.Text color="#aaaabb">
|
|
<StackErrorMessageStyles.Text color="#aaaabb">
|
|
|
{currentRevision?.status === "failed" ? "Error: " : ""}
|
|
{currentRevision?.status === "failed" ? "Error: " : ""}
|
|
|
{currentRevision?.message}
|
|
{currentRevision?.message}
|
|
@@ -136,6 +144,28 @@ const ExpandedStack = () => {
|
|
|
</StackErrorMessageStyles.Wrapper>
|
|
</StackErrorMessageStyles.Wrapper>
|
|
|
) : null}
|
|
) : null}
|
|
|
|
|
|
|
|
|
|
+ <Break />
|
|
|
|
|
+ <InfoWrapper>
|
|
|
|
|
+ <LastDeployed>
|
|
|
|
|
+ <Status
|
|
|
|
|
+ status={getStackStatus(stack)}
|
|
|
|
|
+ message={getStackStatusMessage(stack)}
|
|
|
|
|
+ />
|
|
|
|
|
+ <SepDot>•</SepDot>
|
|
|
|
|
+ Last updated {readableDate(stack.updated_at)}
|
|
|
|
|
+ </LastDeployed>
|
|
|
|
|
+ </InfoWrapper>
|
|
|
|
|
+
|
|
|
|
|
+ <RevisionList
|
|
|
|
|
+ revisions={stack.revisions}
|
|
|
|
|
+ currentRevision={currentRevision}
|
|
|
|
|
+ latestRevision={stack.latest_revision}
|
|
|
|
|
+ stackId={stack.id}
|
|
|
|
|
+ stackNamespace={namespace}
|
|
|
|
|
+ onRevisionClick={(revision) => setCurrentRevision(revision)}
|
|
|
|
|
+ onRollback={() => getStack()}
|
|
|
|
|
+ ></RevisionList>
|
|
|
|
|
+ <Br />
|
|
|
<TabSelector
|
|
<TabSelector
|
|
|
currentTab={currentTab}
|
|
currentTab={currentTab}
|
|
|
options={[
|
|
options={[
|
|
@@ -148,32 +178,24 @@ const ExpandedStack = () => {
|
|
|
{currentRevision.id !== stack.latest_revision.id ? (
|
|
{currentRevision.id !== stack.latest_revision.id ? (
|
|
|
<ChartListWrapper>
|
|
<ChartListWrapper>
|
|
|
<Placeholder>
|
|
<Placeholder>
|
|
|
- Not available when previewing versions
|
|
|
|
|
|
|
+ Not available when previewing revisions
|
|
|
</Placeholder>
|
|
</Placeholder>
|
|
|
</ChartListWrapper>
|
|
</ChartListWrapper>
|
|
|
) : (
|
|
) : (
|
|
|
- <>
|
|
|
|
|
- <SortSelector
|
|
|
|
|
- setSortType={setSortType}
|
|
|
|
|
- sortType={sortType}
|
|
|
|
|
|
|
+ <ChartListWrapper>
|
|
|
|
|
+ <ChartList
|
|
|
|
|
+ currentCluster={currentCluster}
|
|
|
currentView="stacks"
|
|
currentView="stacks"
|
|
|
|
|
+ namespace={namespace}
|
|
|
|
|
+ sortType="Alphabetical"
|
|
|
|
|
+ appFilters={
|
|
|
|
|
+ stack?.latest_revision?.resources?.map(
|
|
|
|
|
+ (res) => res.name
|
|
|
|
|
+ ) || []
|
|
|
|
|
+ }
|
|
|
|
|
+ closeChartRedirectUrl={`${window.location.pathname}${window.location.search}`}
|
|
|
/>
|
|
/>
|
|
|
-
|
|
|
|
|
- <ChartListWrapper>
|
|
|
|
|
- <ChartList
|
|
|
|
|
- currentCluster={currentCluster}
|
|
|
|
|
- currentView="stacks"
|
|
|
|
|
- namespace={namespace}
|
|
|
|
|
- sortType="Alphabetical"
|
|
|
|
|
- appFilters={
|
|
|
|
|
- stack?.latest_revision?.resources?.map(
|
|
|
|
|
- (res) => res.name
|
|
|
|
|
- ) || []
|
|
|
|
|
- }
|
|
|
|
|
- closeChartRedirectUrl={`${window.location.pathname}${window.location.search}`}
|
|
|
|
|
- />
|
|
|
|
|
- </ChartListWrapper>
|
|
|
|
|
- </>
|
|
|
|
|
|
|
+ </ChartListWrapper>
|
|
|
)}
|
|
)}
|
|
|
</>
|
|
</>
|
|
|
),
|
|
),
|
|
@@ -193,7 +215,7 @@ const ExpandedStack = () => {
|
|
|
),
|
|
),
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- label: "Env groups",
|
|
|
|
|
|
|
+ label: "Env Groups",
|
|
|
value: "env_groups",
|
|
value: "env_groups",
|
|
|
component: (
|
|
component: (
|
|
|
<>
|
|
<>
|
|
@@ -202,21 +224,68 @@ const ExpandedStack = () => {
|
|
|
</>
|
|
</>
|
|
|
),
|
|
),
|
|
|
},
|
|
},
|
|
|
|
|
+ {
|
|
|
|
|
+ label: "Settings",
|
|
|
|
|
+ value: "settings",
|
|
|
|
|
+ component: (
|
|
|
|
|
+ <>
|
|
|
|
|
+ <Gap></Gap>
|
|
|
|
|
+ <Settings stackName={stack.name} onDelete={handleDelete} />
|
|
|
|
|
+ </>
|
|
|
|
|
+ ),
|
|
|
|
|
+ },
|
|
|
]}
|
|
]}
|
|
|
setCurrentTab={(tab) => {
|
|
setCurrentTab={(tab) => {
|
|
|
setCurrentTab(tab);
|
|
setCurrentTab(tab);
|
|
|
}}
|
|
}}
|
|
|
></TabSelector>
|
|
></TabSelector>
|
|
|
|
|
+ <PaddingBottom />
|
|
|
</div>
|
|
</div>
|
|
|
);
|
|
);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
export default ExpandedStack;
|
|
export default ExpandedStack;
|
|
|
|
|
|
|
|
|
|
+const PaddingBottom = styled.div`
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ height: 150px;
|
|
|
|
|
+`;
|
|
|
|
|
+
|
|
|
|
|
+const Break = styled.div`
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ height: 20px;
|
|
|
|
|
+`;
|
|
|
|
|
+
|
|
|
|
|
+const BackButton = styled(NavLink)`
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ top: 0px;
|
|
|
|
|
+ right: 0px;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ width: 36px;
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ height: 36px;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ border: 1px solid #ffffff55;
|
|
|
|
|
+ border-radius: 100px;
|
|
|
|
|
+ background: #ffffff11;
|
|
|
|
|
+
|
|
|
|
|
+ :hover {
|
|
|
|
|
+ background: #ffffff22;
|
|
|
|
|
+ > img {
|
|
|
|
|
+ opacity: 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+`;
|
|
|
|
|
+
|
|
|
|
|
+const BackButtonImg = styled.img`
|
|
|
|
|
+ width: 16px;
|
|
|
|
|
+ opacity: 0.75;
|
|
|
|
|
+`;
|
|
|
|
|
+
|
|
|
const ChartListWrapper = styled.div`
|
|
const ChartListWrapper = styled.div`
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
margin: auto;
|
|
margin: auto;
|
|
|
- margin-top: 20px;
|
|
|
|
|
padding-bottom: 125px;
|
|
padding-bottom: 125px;
|
|
|
`;
|
|
`;
|
|
|
|
|
|
|
@@ -228,13 +297,18 @@ const Gap = styled.div`
|
|
|
|
|
|
|
|
const StackErrorMessageStyles = {
|
|
const StackErrorMessageStyles = {
|
|
|
Text: styled(Text)`
|
|
Text: styled(Text)`
|
|
|
- font-size: 14px;
|
|
|
|
|
- margin-bottom: 10px;
|
|
|
|
|
|
|
+ font-size: 13px;
|
|
|
`,
|
|
`,
|
|
|
Wrapper: styled.div`
|
|
Wrapper: styled.div`
|
|
|
display: flex;
|
|
display: flex;
|
|
|
- flex-direction: column;
|
|
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+
|
|
|
margin-top: 5px;
|
|
margin-top: 5px;
|
|
|
|
|
+ > i {
|
|
|
|
|
+ color: #ffffff44;
|
|
|
|
|
+ margin-right: 8px;
|
|
|
|
|
+ font-size: 20px;
|
|
|
|
|
+ }
|
|
|
`,
|
|
`,
|
|
|
Title: styled(Text)`
|
|
Title: styled(Text)`
|
|
|
font-size: 16px;
|
|
font-size: 16px;
|
|
@@ -245,11 +319,12 @@ const StackErrorMessageStyles = {
|
|
|
const StackTitleWrapper = styled.div`
|
|
const StackTitleWrapper = styled.div`
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
display: flex;
|
|
display: flex;
|
|
|
- justify-content: space-between;
|
|
|
|
|
|
|
+ position: relative;
|
|
|
align-items: center;
|
|
align-items: center;
|
|
|
|
|
|
|
|
// Hotfix to make sure the title section and the namespace tag are aligned
|
|
// Hotfix to make sure the title section and the namespace tag are aligned
|
|
|
${NamespaceTag.Wrapper} {
|
|
${NamespaceTag.Wrapper} {
|
|
|
- margin-bottom: 15px;
|
|
|
|
|
|
|
+ margin-left: 17px;
|
|
|
|
|
+ margin-bottom: 13px;
|
|
|
}
|
|
}
|
|
|
`;
|
|
`;
|