diff --git a/src/renderer/src/components/steps/configure-services/ConfigureEnvVarsTemplateAndPlugins.jsx b/src/renderer/src/components/steps/configure-services/ConfigureEnvVarsTemplateAndPlugins.jsx index 5e9d5709..006b2bbf 100644 --- a/src/renderer/src/components/steps/configure-services/ConfigureEnvVarsTemplateAndPlugins.jsx +++ b/src/renderer/src/components/steps/configure-services/ConfigureEnvVarsTemplateAndPlugins.jsx @@ -57,6 +57,7 @@ function ConfigureEnvVarsTemplateAndPlugins ({ return (
{ tmpObj.validations = { ...tmpTemplateValidations } tmpObj.validForm = tmpTemplateValidForm tmpObj.updatedAt = new Date().toISOString() + tmpObj.plugins = [] }) setConfiguredServices([...configuredServices, tmpObj]) } diff --git a/src/renderer/src/components/template-and-plugins/TemplateAndPluginTreeSelector.jsx b/src/renderer/src/components/template-and-plugins/TemplateAndPluginTreeSelector.jsx index 4988ad54..47520f97 100644 --- a/src/renderer/src/components/template-and-plugins/TemplateAndPluginTreeSelector.jsx +++ b/src/renderer/src/components/template-and-plugins/TemplateAndPluginTreeSelector.jsx @@ -1,23 +1,27 @@ 'use strict' import React, { useState } from 'react' import PropTypes from 'prop-types' -import { MEDIUM, SMALL, TRANSPARENT, WHITE } from '@platformatic/ui-components/src/components/constants' +import { ERROR_RED, MAIN_GREEN, MEDIUM, SMALL, TRANSPARENT, WHITE } from '@platformatic/ui-components/src/components/constants' import Icons from '@platformatic/ui-components/src/components/icons' import typographyStyles from '~/styles/Typography.module.css' import styles from './TemplateAndPluginTreeSelector.module.css' import commonStyles from '~/styles/CommonStyles.module.css' import { BorderedBox, PlatformaticIcon } from '@platformatic/ui-components' -import useStackablesStore from '~/useStackablesStore' function TemplateSelector ({ onTemplateSelected, service, serviceSelected }) { let className = `${typographyStyles.desktopHeadline5} ${typographyStyles.textWhite} ${styles.ellipsisTemplate}` - if (serviceSelected?.template !== service.template.name) { + if (serviceSelected?.template !== service.template) { className += ` ${typographyStyles.opacity70}` } return ( -
onTemplateSelected(service)}> +
onTemplateSelected(service)} + data-cy='template-selector' + >
{service.name}
+ {service.validForm ? : }
) } @@ -58,17 +62,17 @@ function PluginSelector ({ onPluginSelected, service, plugin, pluginSelected })
onPluginSelected(service, plugin)} + data-cy='plugin-selector' > {plugin.name} + {plugin.validForm ? : } +
) } -function TemplateAndPluginTreeSelector ({ onTemplateSelected, onPluginSelected, serviceSelected, pluginSelected }) { - const globalState = useStackablesStore() - const { services } = globalState - +function TemplateAndPluginTreeSelector ({ configuredServices, onTemplateSelected, onPluginSelected, serviceSelected, pluginSelected }) { function handlePluginSelected (service, plugin) { onPluginSelected(service, plugin) } @@ -76,10 +80,10 @@ function TemplateAndPluginTreeSelector ({ onTemplateSelected, onPluginSelected, return (
- {services.map(service => ( -
- - {service.plugins.length > 0 && } + {configuredServices.map(configuredService => ( +
+ + {configuredService.plugins.length > 0 && }
))}
@@ -88,6 +92,11 @@ function TemplateAndPluginTreeSelector ({ onTemplateSelected, onPluginSelected, } TemplateAndPluginTreeSelector.propTypes = { + /** + * configuredServices + */ + configuredServices: PropTypes.array.isRequired, + /** /** * onTemplateSelected */ diff --git a/src/renderer/src/components/template-and-plugins/TemplateAndPluginTreeSelector.module.css b/src/renderer/src/components/template-and-plugins/TemplateAndPluginTreeSelector.module.css index 82ad7bf6..031f222b 100644 --- a/src/renderer/src/components/template-and-plugins/TemplateAndPluginTreeSelector.module.css +++ b/src/renderer/src/components/template-and-plugins/TemplateAndPluginTreeSelector.module.css @@ -10,7 +10,7 @@ } .ellipsisTemplate { @apply truncate; - width: 12rem; + max-width: 10rem; } .ellipsisPlugin { @apply truncate;