diff --git a/.eslintrc.yml b/.eslintrc.yml index 53e1a3f02..5cc4ad07b 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -140,9 +140,11 @@ overrides: 'react/jsx-no-constructed-context-values': off '@typescript-eslint/no-restricted-imports': off no-restricted-imports: off + 'react/jsx-props-no-spreading': off - files: - app/**/*.stories.* rules: 'no-alert': off '@typescript-eslint/no-restricted-imports': off no-restricted-imports: off + 'react/jsx-props-no-spreading': off diff --git a/app/assets/css/vendor-override.css b/app/assets/css/vendor-override.css index 92f4bac6a..d927ce52d 100644 --- a/app/assets/css/vendor-override.css +++ b/app/assets/css/vendor-override.css @@ -42,6 +42,10 @@ z-index: unset; } +.input-group-sm > .input-group-addon { + line-height: 1; +} + .text-danger { color: var(--ui-error-9); } diff --git a/app/docker/react/components/services.ts b/app/docker/react/components/services.ts index ebac9b128..76eeeb63b 100644 --- a/app/docker/react/components/services.ts +++ b/app/docker/react/components/services.ts @@ -1,12 +1,19 @@ import angular from 'angular'; +import { SchemaOf } from 'yup'; import { r2a } from '@/react-tools/react2angular'; import { withUIRouter } from '@/react-tools/withUIRouter'; import { withCurrentUser } from '@/react-tools/withCurrentUser'; import { ServicesDatatable } from '@/react/docker/services/ListView/ServicesDatatable'; import { TasksDatatable } from '@/react/docker/services/ItemView/TasksDatatable'; +import { + PortsMappingField, + portsMappingUtils, + PortsMappingValues, +} from '@/react/docker/services/ItemView/PortMappingField'; +import { withFormValidation } from '@/react-tools/withFormValidation'; -export const servicesModule = angular +const ngModule = angular .module('portainer.docker.react.components.services', []) .component( 'dockerServiceTasksDatatable', @@ -25,4 +32,14 @@ export const servicesModule = angular 'onRefresh', 'titleIcon', ]) - ).name; + ); + +export const servicesModule = ngModule.name; + +withFormValidation( + ngModule, + withUIRouter(withCurrentUser(PortsMappingField)), + 'dockerServicePortsMappingField', + ['disabled', 'readOnly', 'hasChanges', 'onReset', 'onSubmit'], + portsMappingUtils.validation as unknown as () => SchemaOf +); diff --git a/app/docker/views/services/edit/includes/configs.html b/app/docker/views/services/edit/includes/configs.html index b246c9937..d3c242110 100644 --- a/app/docker/views/services/edit/includes/configs.html +++ b/app/docker/views/services/edit/includes/configs.html @@ -57,7 +57,7 @@