|
|
@@ -1,18 +1,17 @@
|
|
|
-import React, { useEffect, useState, useContext } from "react";
|
|
|
+import React, { useContext, useEffect, useState } from "react";
|
|
|
+import { createPortal } from "react-dom";
|
|
|
import styled from "styled-components";
|
|
|
|
|
|
+import ConfirmOverlay from "components/ConfirmOverlay";
|
|
|
+import ExpandableSection from "components/porter/ExpandableSection";
|
|
|
+import Spacer from "components/porter/Spacer";
|
|
|
+
|
|
|
import api from "shared/api";
|
|
|
+import { Context } from "shared/Context";
|
|
|
+import { readableDate } from "shared/string_utils";
|
|
|
import loading from "assets/loading.gif";
|
|
|
import warning from "assets/warning.png";
|
|
|
|
|
|
-import { readableDate } from "shared/string_utils";
|
|
|
-import { Context } from "shared/Context";
|
|
|
-import ExpandableSection from "components/porter/ExpandableSection";
|
|
|
-
|
|
|
-import Spacer from "components/porter/Spacer";
|
|
|
-import { createPortal } from "react-dom";
|
|
|
-import ConfirmOverlay from "components/ConfirmOverlay";
|
|
|
-
|
|
|
type Props = {
|
|
|
selectedClusterVersion: any;
|
|
|
setSelectedClusterVersion: any;
|
|
|
@@ -26,7 +25,7 @@ const ClusterRevisionSelector: React.FC<Props> = ({
|
|
|
setSelectedClusterVersion,
|
|
|
setShowProvisionerStatus,
|
|
|
setProvisionFailureReason,
|
|
|
- gpuModal
|
|
|
+ gpuModal,
|
|
|
}) => {
|
|
|
const [showConfirmOverlay, setShowConfirmOverlay] = useState(false);
|
|
|
const { currentProject, currentCluster } = useContext(Context);
|
|
|
@@ -43,7 +42,10 @@ const ClusterRevisionSelector: React.FC<Props> = ({
|
|
|
return Date.parse(a.created_at) > Date.parse(b.created_at) ? -1 : 1;
|
|
|
});
|
|
|
let activeCandidate;
|
|
|
- if (data[0].condition !== "SUCCESS") {
|
|
|
+ if (
|
|
|
+ data[0].condition !== "SUCCESS" &&
|
|
|
+ data[0].condition !== "COMPLIANCE_CHECK_FAILED"
|
|
|
+ ) {
|
|
|
activeCandidate = data[0];
|
|
|
setPendingContract(activeCandidate);
|
|
|
|
|
|
@@ -103,7 +105,7 @@ const ClusterRevisionSelector: React.FC<Props> = ({
|
|
|
.createContract("<token>", selectedClusterVersion, {
|
|
|
project_id: currentProject.id,
|
|
|
})
|
|
|
- .then(() => { })
|
|
|
+ .then(() => {})
|
|
|
.catch((err) => {
|
|
|
console.log(err);
|
|
|
});
|
|
|
@@ -183,7 +185,11 @@ const ClusterRevisionSelector: React.FC<Props> = ({
|
|
|
<Td>{readableDate(pendingContract.created_at)}</Td>
|
|
|
{failedContractId && (
|
|
|
<DeleteButton>
|
|
|
- <div onClick={() => { setShowConfirmOverlay(true); }}>
|
|
|
+ <div
|
|
|
+ onClick={() => {
|
|
|
+ setShowConfirmOverlay(true);
|
|
|
+ }}
|
|
|
+ >
|
|
|
Clear Revision
|
|
|
</div>
|
|
|
</DeleteButton>
|
|
|
@@ -204,8 +210,7 @@ const ClusterRevisionSelector: React.FC<Props> = ({
|
|
|
|
|
|
return (
|
|
|
<>
|
|
|
- {
|
|
|
- !gpuModal &&
|
|
|
+ {!gpuModal && (
|
|
|
<>
|
|
|
{hideSelector ? (
|
|
|
<></>
|
|
|
@@ -221,10 +226,10 @@ const ClusterRevisionSelector: React.FC<Props> = ({
|
|
|
{selectedId === 0
|
|
|
? "Current version -"
|
|
|
: selectedId === -1
|
|
|
- ? failedContractId
|
|
|
- ? ""
|
|
|
- : "In progress -"
|
|
|
- : "Previewing version (not deployed) -"}
|
|
|
+ ? failedContractId
|
|
|
+ ? ""
|
|
|
+ : "In progress -"
|
|
|
+ : "Previewing version (not deployed) -"}
|
|
|
</Label>
|
|
|
{selectedId === -1 ? (
|
|
|
failedContractId ? (
|
|
|
@@ -271,12 +276,14 @@ const ClusterRevisionSelector: React.FC<Props> = ({
|
|
|
deleteContract();
|
|
|
setShowConfirmOverlay(false);
|
|
|
}}
|
|
|
- onNo={() => { setShowConfirmOverlay(false); }}
|
|
|
+ onNo={() => {
|
|
|
+ setShowConfirmOverlay(false);
|
|
|
+ }}
|
|
|
/>,
|
|
|
document.body
|
|
|
)}
|
|
|
</>
|
|
|
- }
|
|
|
+ )}
|
|
|
</>
|
|
|
);
|
|
|
};
|
|
|
@@ -353,7 +360,7 @@ const RollbackButton = styled.div`
|
|
|
props.disabled ? "#aaaabbee" : "#616FEEcc"};
|
|
|
:hover {
|
|
|
background: ${(props: { disabled: boolean }) =>
|
|
|
- props.disabled ? "" : "#405eddbb"};
|
|
|
+ props.disabled ? "" : "#405eddbb"};
|
|
|
}
|
|
|
`;
|
|
|
|
|
|
@@ -367,7 +374,7 @@ const Tr = styled.tr`
|
|
|
props.selected ? "#ffffff11" : ""};
|
|
|
:hover {
|
|
|
background: ${(props: { disableHover?: boolean; selected?: boolean }) =>
|
|
|
- props.disableHover ? "" : "#ffffff22"};
|
|
|
+ props.disableHover ? "" : "#ffffff22"};
|
|
|
}
|
|
|
`;
|
|
|
|