mirror of
https://github.com/labring/sealos.git
synced 2026-09-24 15:46:19 +08:00
fix:launchpad checkNetworkPorts (#4724)
Signed-off-by: jingyang <3161362058@qq.com>
This commit is contained in:
@@ -109,9 +109,9 @@ const AppMainInfo = ({ app = MOCK_APP_DETAIL }: { app: AppDetailType }) => {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{networks.map((network) => {
|
||||
{networks.map((network, index) => {
|
||||
return (
|
||||
<tr key={network.inline}>
|
||||
<tr key={network.inline + index}>
|
||||
<th>
|
||||
<Flex>
|
||||
<MyTooltip label={t('Copy')} placement={'bottom-start'}>
|
||||
|
||||
@@ -265,6 +265,7 @@ const EditApp = ({ appName, tabType }: { appName?: string; tabType: string }) =>
|
||||
setDefaultGpuSource(res.gpu);
|
||||
formHook.reset(adaptEditAppData(res));
|
||||
setAlready(true);
|
||||
setYamlList(formData2Yamls(realTimeForm.current));
|
||||
},
|
||||
onError(err) {
|
||||
toast({
|
||||
@@ -388,10 +389,16 @@ export async function getServerSideProps(content: any) {
|
||||
export default EditApp;
|
||||
|
||||
function checkNetworkPorts(networks: AppEditType['networks']) {
|
||||
const ports = networks.map((item) => item.port);
|
||||
const portSet = new Set(ports);
|
||||
if (portSet.size !== ports.length) {
|
||||
return false;
|
||||
const portProtocolSet = new Set<string>();
|
||||
|
||||
for (const network of networks) {
|
||||
const { port, protocol } = network;
|
||||
const key = `${port}-${protocol}`;
|
||||
if (portProtocolSet.has(key)) {
|
||||
return false;
|
||||
}
|
||||
portProtocolSet.add(key);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -271,7 +271,9 @@ export const adaptAppDetail = (configs: DeployKindsType[]): AppDetailType => {
|
||||
protocol:
|
||||
(ingress?.metadata?.annotations?.[
|
||||
'nginx.ingress.kubernetes.io/backend-protocol'
|
||||
] as AppEditType['networks'][0]['protocol']) || 'HTTP',
|
||||
] as AppEditType['networks'][0]['protocol']) ||
|
||||
item?.protocol ||
|
||||
'HTTP',
|
||||
openPublicDomain: !!ingress,
|
||||
...(domain.endsWith(SEALOS_DOMAIN)
|
||||
? {
|
||||
|
||||
Reference in New Issue
Block a user