fix: display port_range in security group rule in instacne detail

display port_range in security group rule in instacne detail

Change-Id: Ie0f8da751c513640b209c8f84ec6a925b643ebea
This commit is contained in:
yangao 2022-05-12 09:40:59 +08:00
parent 38403a2280
commit bdd5a98ece

View File

@ -16,6 +16,7 @@ import { action, observable } from 'mobx';
import { get } from 'lodash';
import client from 'client';
import Base from 'stores/base';
import { mapperRule } from 'resources/security-group-rule';
import { RecycleBinStore } from '../skyline/recycle-server';
export class ServerStore extends Base {
@ -61,6 +62,16 @@ export class ServerStore extends Base {
};
}
get mapperSecurityGroupRule() {
return (data) => {
const { security_group_rules = [] } = data;
return {
...data,
security_group_rules: security_group_rules.map(mapperRule),
};
};
}
listFetchByClient(params) {
return this.skylineClient.extension.servers(params);
}
@ -209,7 +220,9 @@ export class ServerStore extends Base {
const result = await Promise.all(
sgIds.map((it) => this.sgClient.show(it))
);
sgItems = result.map((it) => it.security_group);
sgItems = result.map((it) =>
this.mapperSecurityGroupRule(it.security_group)
);
} catch (e) {}
this.securityGroups = {
data: sgItems || [],