|
@@ -9,7 +9,7 @@ import { PorterTemplate, ChoiceType, ClusterType, StorageType } from '../../../.
|
|
|
import Selector from '../../../../components/Selector';
|
|
import Selector from '../../../../components/Selector';
|
|
|
import ImageSelector from '../../../../components/image-selector/ImageSelector';
|
|
import ImageSelector from '../../../../components/image-selector/ImageSelector';
|
|
|
import TabRegion from '../../../../components/TabRegion';
|
|
import TabRegion from '../../../../components/TabRegion';
|
|
|
-import Heading from '../../../../components/values-form/Heading';
|
|
|
|
|
|
|
+import InputRow from '../../../../components/values-form/InputRow';
|
|
|
import SaveButton from '../../../../components/SaveButton';
|
|
import SaveButton from '../../../../components/SaveButton';
|
|
|
import ValuesWrapper from '../../../../components/values-form/ValuesWrapper';
|
|
import ValuesWrapper from '../../../../components/values-form/ValuesWrapper';
|
|
|
import ValuesForm from '../../../../components/values-form/ValuesForm';
|
|
import ValuesForm from '../../../../components/values-form/ValuesForm';
|
|
@@ -31,6 +31,7 @@ type StateType = {
|
|
|
selectedCluster: string,
|
|
selectedCluster: string,
|
|
|
selectedImageUrl: string | null,
|
|
selectedImageUrl: string | null,
|
|
|
selectedTag: string | null,
|
|
selectedTag: string | null,
|
|
|
|
|
+ templateName: string,
|
|
|
tabOptions: ChoiceType[],
|
|
tabOptions: ChoiceType[],
|
|
|
currentTab: string | null,
|
|
currentTab: string | null,
|
|
|
tabContents: any
|
|
tabContents: any
|
|
@@ -45,6 +46,7 @@ export default class LaunchTemplate extends Component<PropsType, StateType> {
|
|
|
selectedCluster: this.context.currentCluster.name,
|
|
selectedCluster: this.context.currentCluster.name,
|
|
|
selectedNamespace: "default",
|
|
selectedNamespace: "default",
|
|
|
selectedImageUrl: '' as string | null,
|
|
selectedImageUrl: '' as string | null,
|
|
|
|
|
+ templateName: '',
|
|
|
selectedTag: '' as string | null,
|
|
selectedTag: '' as string | null,
|
|
|
tabOptions: [] as ChoiceType[],
|
|
tabOptions: [] as ChoiceType[],
|
|
|
currentTab: null as string | null,
|
|
currentTab: null as string | null,
|
|
@@ -54,7 +56,7 @@ export default class LaunchTemplate extends Component<PropsType, StateType> {
|
|
|
|
|
|
|
|
onSubmitAddon = (wildcard?: any) => {
|
|
onSubmitAddon = (wildcard?: any) => {
|
|
|
let { currentCluster, currentProject } = this.context;
|
|
let { currentCluster, currentProject } = this.context;
|
|
|
- let name = randomWords({ exactly: 3, join: '-' });
|
|
|
|
|
|
|
+ let name = this.state.templateName || randomWords({ exactly: 3, join: '-' });
|
|
|
this.setState({ saveValuesStatus: 'loading' });
|
|
this.setState({ saveValuesStatus: 'loading' });
|
|
|
|
|
|
|
|
let values = {};
|
|
let values = {};
|
|
@@ -85,7 +87,7 @@ export default class LaunchTemplate extends Component<PropsType, StateType> {
|
|
|
|
|
|
|
|
onSubmit = (rawValues: any) => {
|
|
onSubmit = (rawValues: any) => {
|
|
|
let { currentCluster, currentProject } = this.context;
|
|
let { currentCluster, currentProject } = this.context;
|
|
|
- let name = randomWords({ exactly: 3, join: '-' });
|
|
|
|
|
|
|
+ let name = this.state.templateName || randomWords({ exactly: 3, join: '-' });
|
|
|
this.setState({ saveValuesStatus: 'loading' });
|
|
this.setState({ saveValuesStatus: 'loading' });
|
|
|
|
|
|
|
|
// Convert dotted keys to nested objects
|
|
// Convert dotted keys to nested objects
|
|
@@ -262,7 +264,10 @@ export default class LaunchTemplate extends Component<PropsType, StateType> {
|
|
|
if (this.props.form?.hasSource) {
|
|
if (this.props.form?.hasSource) {
|
|
|
return (
|
|
return (
|
|
|
<>
|
|
<>
|
|
|
- <Subtitle>Select the container image you would like to connect to this template.</Subtitle>
|
|
|
|
|
|
|
+ <Subtitle>
|
|
|
|
|
+ Select the container image you would like to connect to this template.
|
|
|
|
|
+ <Required>*</Required>
|
|
|
|
|
+ </Subtitle>
|
|
|
<DarkMatter />
|
|
<DarkMatter />
|
|
|
<ImageSelector
|
|
<ImageSelector
|
|
|
selectedTag={this.state.selectedTag}
|
|
selectedTag={this.state.selectedTag}
|
|
@@ -322,6 +327,15 @@ export default class LaunchTemplate extends Component<PropsType, StateType> {
|
|
|
closeOverlay={true}
|
|
closeOverlay={true}
|
|
|
/>
|
|
/>
|
|
|
</ClusterSection>
|
|
</ClusterSection>
|
|
|
|
|
+ <Subtitle>Give a unique name to this template (optional).</Subtitle>
|
|
|
|
|
+ <DarkMatter antiHeight='-27px' />
|
|
|
|
|
+ <InputRow
|
|
|
|
|
+ type='text'
|
|
|
|
|
+ value={this.state.templateName}
|
|
|
|
|
+ setValue={(x: string) => this.setState({ templateName: x })}
|
|
|
|
|
+ placeholder='ex: doctor-scientist'
|
|
|
|
|
+ width='100%'
|
|
|
|
|
+ />
|
|
|
{this.renderSourceSelector()}
|
|
{this.renderSourceSelector()}
|
|
|
{this.renderTabRegion()}
|
|
{this.renderTabRegion()}
|
|
|
</StyledLaunchTemplate>
|
|
</StyledLaunchTemplate>
|
|
@@ -331,6 +345,11 @@ export default class LaunchTemplate extends Component<PropsType, StateType> {
|
|
|
|
|
|
|
|
LaunchTemplate.contextType = Context;
|
|
LaunchTemplate.contextType = Context;
|
|
|
|
|
|
|
|
|
|
+const Required = styled.div`
|
|
|
|
|
+ margin-left: 8px;
|
|
|
|
|
+ color: #fc4976;
|
|
|
|
|
+`;
|
|
|
|
|
+
|
|
|
const Link = styled.a`
|
|
const Link = styled.a`
|
|
|
margin-left: 5px;
|
|
margin-left: 5px;
|
|
|
`;
|
|
`;
|
|
@@ -362,9 +381,9 @@ const Placeholder = styled.div`
|
|
|
justify-content: center;
|
|
justify-content: center;
|
|
|
`;
|
|
`;
|
|
|
|
|
|
|
|
-const DarkMatter = styled.div`
|
|
|
|
|
|
|
+const DarkMatter = styled.div<{ antiHeight?: string }>`
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
- margin-top: -15px;
|
|
|
|
|
|
|
+ margin-top: ${props => props.antiHeight || '-15px'};
|
|
|
`;
|
|
`;
|
|
|
|
|
|
|
|
const Subtitle = styled.div`
|
|
const Subtitle = styled.div`
|
|
@@ -373,6 +392,8 @@ const Subtitle = styled.div`
|
|
|
font-size: 13px;
|
|
font-size: 13px;
|
|
|
color: #aaaabb;
|
|
color: #aaaabb;
|
|
|
line-height: 1.6em;
|
|
line-height: 1.6em;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
`;
|
|
`;
|
|
|
|
|
|
|
|
const ClusterLabel = styled.div`
|
|
const ClusterLabel = styled.div`
|