2022-05-31 13:00:47 +03:00
|
|
|
import angular from 'angular';
|
|
|
|
|
|
|
|
import { r2a } from '@/react-tools/react2angular';
|
|
|
|
import { CustomTemplatesVariablesDefinitionField } from '@/react/portainer/custom-templates/components/CustomTemplatesVariablesDefinitionField';
|
|
|
|
import { CustomTemplatesVariablesField } from '@/react/portainer/custom-templates/components/CustomTemplatesVariablesField';
|
2022-12-15 17:49:36 +01:00
|
|
|
import { withControlledInput } from '@/react-tools/withControlledInput';
|
2023-10-19 21:09:15 +02:00
|
|
|
import { CustomTemplatesListItem } from '@/react/portainer/templates/custom-templates/ListView/CustomTemplatesListItem';
|
|
|
|
import { withCurrentUser } from '@/react-tools/withCurrentUser';
|
|
|
|
import { withUIRouter } from '@/react-tools/withUIRouter';
|
|
|
|
import { AppTemplatesListItem } from '@/react/portainer/templates/app-templates/AppTemplatesListItem';
|
2023-10-22 11:19:19 +02:00
|
|
|
import {
|
|
|
|
CommonFields,
|
|
|
|
validation as commonFieldsValidation,
|
|
|
|
} from '@/react/portainer/custom-templates/components/CommonFields';
|
|
|
|
import { PlatformField } from '@/react/portainer/custom-templates/components/PlatformSelector';
|
|
|
|
import { TemplateTypeSelector } from '@/react/portainer/custom-templates/components/TemplateTypeSelector';
|
|
|
|
import { withFormValidation } from '@/react-tools/withFormValidation';
|
2022-05-31 13:00:47 +03:00
|
|
|
|
|
|
|
import { VariablesFieldAngular } from './variables-field';
|
|
|
|
|
2023-10-22 11:19:19 +02:00
|
|
|
export const ngModule = angular
|
2022-05-31 13:00:47 +03:00
|
|
|
.module('portainer.app.react.components.custom-templates', [])
|
|
|
|
.component(
|
|
|
|
'customTemplatesVariablesFieldReact',
|
2022-12-15 17:49:36 +01:00
|
|
|
r2a(withControlledInput(CustomTemplatesVariablesField), [
|
|
|
|
'value',
|
|
|
|
'onChange',
|
|
|
|
'definitions',
|
|
|
|
])
|
2022-05-31 13:00:47 +03:00
|
|
|
)
|
|
|
|
.component('customTemplatesVariablesField', VariablesFieldAngular)
|
|
|
|
.component(
|
|
|
|
'customTemplatesVariablesDefinitionField',
|
2022-12-15 17:49:36 +01:00
|
|
|
r2a(withControlledInput(CustomTemplatesVariablesDefinitionField), [
|
2022-05-31 13:00:47 +03:00
|
|
|
'onChange',
|
|
|
|
'value',
|
|
|
|
'errors',
|
|
|
|
'isVariablesNamesFromParent',
|
|
|
|
])
|
2023-10-19 21:09:15 +02:00
|
|
|
)
|
|
|
|
.component(
|
|
|
|
'customTemplatesListItem',
|
|
|
|
r2a(withUIRouter(withCurrentUser(CustomTemplatesListItem)), [
|
|
|
|
'onDelete',
|
|
|
|
'onSelect',
|
|
|
|
'template',
|
|
|
|
'isSelected',
|
|
|
|
])
|
|
|
|
)
|
|
|
|
.component(
|
|
|
|
'appTemplatesListItem',
|
|
|
|
r2a(withUIRouter(withCurrentUser(AppTemplatesListItem)), [
|
|
|
|
'onSelect',
|
|
|
|
'template',
|
|
|
|
'isSelected',
|
|
|
|
'onDuplicate',
|
|
|
|
])
|
2023-10-22 11:19:19 +02:00
|
|
|
)
|
|
|
|
.component(
|
|
|
|
'customTemplatesPlatformSelector',
|
|
|
|
r2a(PlatformField, ['onChange', 'value'])
|
|
|
|
)
|
|
|
|
.component(
|
|
|
|
'customTemplatesTypeSelector',
|
|
|
|
r2a(TemplateTypeSelector, ['onChange', 'value'])
|
|
|
|
);
|
|
|
|
|
|
|
|
withFormValidation(
|
|
|
|
ngModule,
|
|
|
|
withControlledInput(CommonFields, { values: 'onChange' }),
|
|
|
|
'customTemplatesCommonFields',
|
|
|
|
[],
|
|
|
|
commonFieldsValidation
|
|
|
|
);
|
|
|
|
|
|
|
|
export const customTemplatesModule = ngModule.name;
|