Merge "fix: fix listener info in certificate"

This commit is contained in:
Zuul 2022-06-10 10:52:25 +00:00 committed by Gerrit Code Review
commit e15dc5f0d6
4 changed files with 57 additions and 32 deletions

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import React from 'react';
import { observer, inject } from 'mobx-react';
import Base from 'containers/List';
import globalContainersStore, {
@ -104,15 +105,19 @@ export class Certificate extends Base {
dataIndex: 'listener',
render: (value) => {
return value
? this.getLinkRender(
'lbListenerDetail',
value.name,
{
loadBalancerId: value.lb,
id: value.id,
},
null
)
? value.map((it) => (
<div>
{this.getLinkRender(
'lbListenerDetail',
it.name,
{
loadBalancerId: it.lb,
id: it.id,
},
null
)}
</div>
))
: '-';
},
isHideable: true,

View File

@ -1,3 +1,19 @@
// Copyright 2022 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import React from 'react';
export const operatingStatusCodes = {
ONLINE: t('Online'),
DRAINING: t('Draining'),
@ -51,15 +67,19 @@ export const getCertificateColumns = (self) => [
dataIndex: 'listener',
render: (value) => {
return value
? self.getLinkRender(
'lbListenerDetail',
value.name,
{
loadBalancerId: value.lb,
id: value.id,
},
null
)
? value.map((it) => (
<div>
{self.getLinkRender(
'lbListenerDetail',
it.name,
{
loadBalancerId: it.lb,
id: it.id,
},
null
)}
</div>
))
: '-';
},
},

View File

@ -73,7 +73,7 @@ export class ContainersStore extends Base {
updateItem(item, listeners) {
const { container_ref } = item;
const enabledLs = listeners.find((ls) => {
const enabledLs = listeners.filter((ls) => {
const refs = [
ls.default_tls_container_ref,
ls.client_ca_tls_container_ref,
@ -81,12 +81,12 @@ export class ContainersStore extends Base {
];
return refs.includes(container_ref);
});
if (enabledLs) {
item.listener = {
id: enabledLs.id,
name: enabledLs.name,
lb: enabledLs.lbIds[0],
};
if (enabledLs.length) {
item.listener = enabledLs.map((ls) => ({
id: ls.id,
name: ls.name,
lb: ls.lbIds[0],
}));
}
return item;
}

View File

@ -73,7 +73,7 @@ export class SecretsStore extends Base {
updateItem(item, listeners) {
const { secret_ref } = item;
const enabledLs = listeners.find((ls) => {
const enabledLs = listeners.filter((ls) => {
const refs = [
ls.default_tls_container_ref,
ls.client_ca_tls_container_ref,
@ -81,12 +81,12 @@ export class SecretsStore extends Base {
];
return refs.includes(secret_ref);
});
if (enabledLs) {
item.listener = {
id: enabledLs.id,
name: enabledLs.name,
lb: enabledLs.lbIds[0],
};
if (enabledLs.length) {
item.listener = enabledLs.map((ls) => ({
id: ls.id,
name: ls.name,
lb: ls.lbIds[0],
}));
}
return item;
}