Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

advanced module section #588

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 55 additions & 28 deletions cyclops-ui/src/components/pages/NewModule/NewModule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
} from "../../errors/FormValidationErrors";
import { mapResponseError } from "../../../utils/api/errors";
import TemplateFormFields from "../../form/TemplateFormFields";
import { DownOutlined, UpOutlined } from "@ant-design/icons";

const { Title } = Typography;
const layout = {
Expand Down Expand Up @@ -101,6 +102,8 @@ const NewModule = () => {
});
};

const [advancedOptionsExpanded, setAdvancedOptionsExpanded] = useState(false);

const [form] = Form.useForm();

useEffect(() => {
Expand Down Expand Up @@ -474,6 +477,10 @@ const NewModule = () => {
openNotification(errorMessages);
};

const toggleExpand = () => {
setAdvancedOptionsExpanded(!advancedOptionsExpanded);
};

return (
<div>
{error.message.length !== 0 && (
Expand Down Expand Up @@ -572,7 +579,7 @@ const NewModule = () => {
style={{
border: "solid 1.5px #c3c3c3",
borderRadius: "7px",
padding: "12px",
padding: "0px",
width: "100%",
backgroundColor: "#fafafa",
}}
Expand All @@ -588,6 +595,7 @@ const NewModule = () => {
</p>
</div>
}
style={{ padding: "12px 12px 0px 12px" }}
rules={[
{
required: true,
Expand All @@ -609,35 +617,54 @@ const NewModule = () => {
>
<Input />
</Form.Item>
<Form.Item
name="cyclops_module_namespace"
id="cyclops_module_namespace"
label={
<div style={{ display: advancedOptionsExpanded ? "" : "none" }}>
<Divider
style={{ marginTop: "12px", marginBottom: "12px" }}
/>
<Form.Item
name="cyclops_module_namespace"
id="cyclops_module_namespace"
label={
<div>
Target namespace
<p style={{ color: "#8b8e91", marginBottom: "0px" }}>
Namespace used to deploy resources to
</p>
</div>
}
style={{ padding: "0px 12px 0px 12px" }}
hasFeedback={true}
validateDebounce={1000}
>
<Select
showSearch={true}
onChange={onTemplateStoreSelected}
style={{ width: "100%" }}
placeholder="default"
value="default"
defaultValue="default"
>
{namespaces.map((namespace: string) => (
<Option key={namespace} value={namespace}>
{namespace}
</Option>
))}
</Select>
</Form.Item>
</div>
<div className={"expandadvanced"} onClick={toggleExpand}>
{advancedOptionsExpanded ? (
<div>
Target namespace
<p style={{ color: "#8b8e91", marginBottom: "0px" }}>
Namespace used to deploy resources to
</p>
Advanced
<UpOutlined style={{ paddingLeft: "5px" }} />
</div>
}
hasFeedback={true}
validateDebounce={1000}
>
<Select
showSearch={true}
onChange={onTemplateStoreSelected}
style={{ width: "100%" }}
placeholder="default"
value="default"
defaultValue="default"
>
{namespaces.map((namespace: string) => (
<Option key={namespace} value={namespace}>
{namespace}
</Option>
))}
</Select>
</Form.Item>
) : (
<div>
Advanced
<DownOutlined style={{ paddingLeft: "5px" }} />
</div>
)}
</div>
</div>
</Col>
<Divider
Expand Down
17 changes: 17 additions & 0 deletions cyclops-ui/src/components/pages/NewModule/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,20 @@ code {
padding: 0;
}
}

.expandadvanced {
width: 100%;
height: 32px;
background-color: #eee;
border-radius: 0 0 7px 7px;
transition: background-color 0.2s ease;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
cursor: pointer;
}

.expandadvanced:hover {
background-color: #e0e0e0;
}
Loading