fix: Fix flavor show for which ram < 1 GB

fix flavor show for which ram < 1GB

Change-Id: I6cbf151e4b17241a71864fb3736e9276113aa895
This commit is contained in:
zhuyue 2021-09-29 16:40:21 +08:00 committed by zhu yue
parent 1b9c23e5c2
commit 3ff55fda22
2 changed files with 5 additions and 2 deletions

View File

@ -18,6 +18,7 @@ import Base from 'containers/TabDetail';
import { flavorCategoryList, flavorArchitectures } from 'resources/flavor'; import { flavorCategoryList, flavorArchitectures } from 'resources/flavor';
import Members from 'pages/compute/containers/Instance'; import Members from 'pages/compute/containers/Instance';
import { emptyActionConfig } from 'utils/constants'; import { emptyActionConfig } from 'utils/constants';
import { formatSize } from 'utils';
import actionConfigs from '../actions'; import actionConfigs from '../actions';
import BaseDetail from './BaseDetail'; import BaseDetail from './BaseDetail';
@ -63,7 +64,7 @@ export class Detail extends Base {
title: t('Memory'), title: t('Memory'),
dataIndex: 'ram', dataIndex: 'ram',
isHideable: true, isHideable: true,
render: (ram) => `${Number.parseInt(ram / 1024, 10)}G`, render: (ram) => formatSize(ram, 2),
}, },
{ {
title: t('Public'), title: t('Public'),

View File

@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { formatSize } from 'utils';
export const cpuPolicyList = { export const cpuPolicyList = {
dedicated: t('Dedicated'), dedicated: t('Dedicated'),
shared: t('Shared'), shared: t('Shared'),
@ -151,7 +153,7 @@ export const getBaseColumns = (self) => [
title: t('Memory'), title: t('Memory'),
dataIndex: 'ram', dataIndex: 'ram',
isHideable: true, isHideable: true,
render: (ram) => `${Number.parseInt(ram / 1024, 10)}G`, render: (ram) => formatSize(ram, 2),
}, },
{ {
title: t('Internal Network Bandwidth(Gbps)'), title: t('Internal Network Bandwidth(Gbps)'),