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

fix #878 #879

Merged
merged 3 commits into from
Nov 21, 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
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ describe(symToStr({ computeRootForm }), () => {
type: "group",
helmValuesPath: ["services"],
description: undefined,
title: undefined,
nodes: [
{
type: "field",
Expand Down Expand Up @@ -208,6 +209,7 @@ describe(symToStr({ computeRootForm }), () => {
type: "group",
helmValuesPath: ["services"],
description: undefined,
title: undefined,
nodes: [
{
type: "field",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ describe(symToStr({ computeRootFormFieldGroup }), () => {
type: "group",
helmValuesPath: [],
description: undefined,
title: undefined,
nodes: [
{
type: "field",
Expand Down Expand Up @@ -87,6 +88,7 @@ describe(symToStr({ computeRootFormFieldGroup }), () => {
type: "group",
helmValuesPath: [],
description: undefined,
title: undefined,
nodes: [
{
type: "field",
Expand Down Expand Up @@ -117,6 +119,7 @@ describe(symToStr({ computeRootFormFieldGroup }), () => {
properties: {
persistence: {
description: "Configuration for persistence",
title: "Persistence",
type: "object",
properties: {
enabled: {
Expand Down Expand Up @@ -155,11 +158,13 @@ describe(symToStr({ computeRootFormFieldGroup }), () => {
type: "group",
helmValuesPath: [],
description: undefined,
title: undefined,
nodes: [
{
type: "group",
helmValuesPath: ["persistence"],
description: "Configuration for persistence",
title: "Persistence",
nodes: [
{
type: "field",
Expand Down Expand Up @@ -191,6 +196,7 @@ describe(symToStr({ computeRootFormFieldGroup }), () => {
properties: {
persistence: {
description: "Configuration for persistence",
title: "Persistence",
type: "object",
properties: {
enabled: {
Expand Down Expand Up @@ -228,11 +234,13 @@ describe(symToStr({ computeRootFormFieldGroup }), () => {
type: "group",
helmValuesPath: [],
description: undefined,
title: undefined,
nodes: [
{
type: "group",
helmValuesPath: ["persistence"],
description: "Configuration for persistence",
title: "Persistence",
nodes: [
{
type: "field",
Expand Down Expand Up @@ -289,6 +297,7 @@ describe(symToStr({ computeRootFormFieldGroup }), () => {
type: "group",
helmValuesPath: [],
description: undefined,
title: undefined,
nodes: [
{
type: "field",
Expand All @@ -306,11 +315,13 @@ describe(symToStr({ computeRootFormFieldGroup }), () => {
type: "group",
helmValuesPath: ["b"],
description: undefined,
title: undefined,
nodes: [
{
type: "group",
helmValuesPath: ["b", 0],
description: undefined,
title: undefined,
nodes: [
{
type: "field",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ function computeRootFormFieldGroup_rec(params: {
type: "group",
helmValuesPath,
description: helmValuesSchema.description,
title: helmValuesSchema.title ?? undefined,
nodes: Object.entries(helmValuesSchema.properties)
.map(([segment, helmValuesSchema_child]) =>
computeRootFormFieldGroup_rec({
Expand Down Expand Up @@ -388,6 +389,7 @@ function computeRootFormFieldGroup_rec(params: {
type: "group",
helmValuesPath,
description: helmValuesSchema.description,
title: undefined,
nodes: values
.map((...[, index]) =>
computeRootFormFieldGroup_rec({
Expand Down
2 changes: 1 addition & 1 deletion web/src/core/usecases/launcher/decoupledLogic/formTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type FormFieldGroup = {
type: "group";
helmValuesPath: (string | number)[];
description: string | undefined;

title: string | undefined;
nodes: (FormField | FormFieldGroup)[];
canAdd: boolean;
canRemove: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const rootForm: RootForm = {
type: "group",
helmValuesPath: ["services"],
description: undefined,
title: undefined,
nodes: [
{
type: "field",
Expand All @@ -30,6 +31,7 @@ const rootForm: RootForm = {
type: "group",
helmValuesPath: ["resources"],
description: undefined,
title: undefined,
nodes: [
{
type: "field",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ describe(symToStr({ mutateHelmValues_update }), () => {
type: "group",
helmValuesPath: ["resources"],
description: THROW_IF_ACCESSED,
title: THROW_IF_ACCESSED,
canAdd: THROW_IF_ACCESSED,
canRemove: THROW_IF_ACCESSED,
nodes: [
Expand Down
6 changes: 6 additions & 0 deletions web/src/ui/pages/launcher/RootFormComponent/Accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type Props = {
className?: string;
helmValuesPath: (string | number)[];
description: string | undefined;
title: string | undefined;
nodes: (FormFieldGroup | FormField)[];
canAdd: boolean;
canRemove: boolean;
Expand All @@ -33,6 +34,7 @@ export function Accordion(props: Props) {
className,
helmValuesPath,
description,
title,
nodes,
canAdd,
canRemove,
Expand Down Expand Up @@ -134,6 +136,10 @@ export function Accordion(props: Props) {
>
<Text typo="label 1" componentProps={{ lang: "und" }}>
{(() => {
if (title !== undefined) {
return title;
}

const lastSegment = helmValuesPath[helmValuesPath.length - 1];

assert(typeof lastSegment === "string");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export function ConfigurationTopLevelGroup(props: Props) {
{
helmValuesPath: ["Global"],
description: "configuration that applies to all charts",
title: undefined,
canAdd: false,
canRemove: false,
nodes: global
Expand All @@ -61,6 +62,7 @@ export function ConfigurationTopLevelGroup(props: Props) {
{
helmValuesPath: ["Miscellaneous"],
// TODO: i18n
title: undefined,
description: "Top level configuration values",
canAdd: false,
canRemove: false,
Expand All @@ -72,6 +74,7 @@ export function ConfigurationTopLevelGroup(props: Props) {
return {
helmValuesPath: [node.title],
description: node.description,
title: node.title,
canAdd: false,
canRemove: false,
nodes: [
Expand All @@ -92,6 +95,7 @@ export function ConfigurationTopLevelGroup(props: Props) {
return {
helmValuesPath: node.helmValuesPath,
description: node.description,
title: node.title,
canAdd: node.canAdd,
canRemove: node.canRemove,
nodes: node.nodes
Expand All @@ -105,11 +109,12 @@ export function ConfigurationTopLevelGroup(props: Props) {
return (
<div className={cx(classes.root, className)}>
{accordionEntries.map(
({ helmValuesPath, description, canAdd, canRemove, nodes }) => (
({ helmValuesPath, description, title, canAdd, canRemove, nodes }) => (
<Accordion
key={JSON.stringify(helmValuesPath)}
helmValuesPath={helmValuesPath}
description={description}
title={title}
canAdd={canAdd}
canRemove={canRemove}
nodes={nodes}
Expand Down