diff --git a/src/containers/apps/AppDefinition.ts b/src/containers/apps/AppDefinition.ts index 1b960e00..a0c5d873 100644 --- a/src/containers/apps/AppDefinition.ts +++ b/src/containers/apps/AppDefinition.ts @@ -77,6 +77,7 @@ interface IAppDefinitionBase { preDeployFunction?: string serviceUpdateOverride?: string customNginxConfig?: string + redirectDomain?: string networks: string[] customDomain: IAppCustomDomain[] tags?: IAppTag[] diff --git a/src/containers/apps/appDetails/HttpSettings.tsx b/src/containers/apps/appDetails/HttpSettings.tsx index 51623eab..035bcb0d 100644 --- a/src/containers/apps/appDetails/HttpSettings.tsx +++ b/src/containers/apps/appDetails/HttpSettings.tsx @@ -1,4 +1,5 @@ import { InfoCircleOutlined } from '@ant-design/icons' +import type { SelectProps } from 'antd' import { Button, Checkbox, @@ -7,12 +8,14 @@ import { message, Modal, Row, + Select, Tooltip, } from 'antd' -import React, { Component, Fragment } from 'react' +import { Component, Fragment } from 'react' import Toaster from '../../../utils/Toaster' import Utils from '../../../utils/Utils' import NewTabLink from '../../global/NewTabLink' +import { IAppDef } from '../AppDefinition' import { AppDetailsTabProps } from './AppDetails' const Search = Input.Search @@ -139,6 +142,58 @@ export default class HttpSettings extends Component< ) } + createRedirectDropdownIfNeeded(app: IAppDef, rootDomain: string) { + const self = this + const customDomains = ( + this.props.apiData!.appDefinition.customDomain || [] + ).map((it) => it.publicDomain) + + if (customDomains.length === 0) { + return undefined + } else { + customDomains.push(`${app.appName}.${rootDomain}`) + + const options: SelectProps['options'] = [] + options.push({ + value: '', + label: 'No redirects', + }) + customDomains.forEach((it) => { + options.push({ + value: it, + label: it, + }) + }) + + const widthOfSelect = self.props.isMobile ? 200 : 350 + + return ( + + + + Redirect all domains to: + + +