To display the applicationInfos array in a table, you can use the Table component from the antd library. Here's an example of how you can achieve this:

  1. Import the necessary components and libraries:
import { Table } from 'antd';
  1. Define the columns for the table:
const columns = [
  {
    title: 'Deploy Order',
    dataIndex: 'deployOrder',
    key: 'deployOrder',
  },
  {
    title: 'Image ID',
    dataIndex: 'imageId',
    key: 'imageId',
  },
  {
    title: 'App ID',
    dataIndex: 'appId',
    key: 'appId',
  },
  {
    title: 'Deploy Status',
    dataIndex: 'deployStatus',
    key: 'deployStatus',
  },
];
  1. Extract the applicationInfos array from the provided data:
const data = [{"largeVersionId":"id001","env":"test","projectId":"INTELLIGENTMAINTENANCE","largeVersionDeployConfigVO":{"env":"test","largeVersionId":"id001","projectId":"INTELLIGENTMAINTENANCE","projectName":"测试项目001","applicationInfos":[{"deployOrder":null,"imageId":"ceshi-web:vcccb0d4-20230531175455","appId":"ceshi-web-002","deployStatus":0}],"dbConfigInfos":[{"id":"64ae4d31b6e725707a669184","instanceName":"instance-001","dbName":"ai-develop","sql":"insert into dataset values(1,1,'testname','http://www.baidu.com','123456','master','Y')","execStatus":0,"execOrder":"1"},{"id":null,"instanceName":"ali-leiniao-hangzhou-basic-test-mysql","dbName":null,"sql":"-- 请在此输入SQL,以分号结尾,仅支持DML和DDL语句,查询语句请使用SQL查询功能。\r\ninsert into\r\n  dataset\r\nvalues(\r\n    1,\r\n    1,\r\n    'testname',\r\n    \"type\",\r\n    'http://www.baidu.com',\r\n    '123456',\r\n    'master',\r\n    'Y'\r\n  );","execStatus":0,"execOrder":"1"}],"nacosConfigInfos":null,"deployOrder":2}}];

const applicationInfos = data[0]?.largeVersionDeployConfigVO?.applicationInfos || [];
  1. Render the table component with the extracted applicationInfos data:
<Table
  rowKey={'id'}
  columns={columns}
  dataSource={applicationInfos}
  pagination={false}
  rowSelection={{
    selectedRowKeys,
    onChange: handleSelect,
  }}
/>

This will display the applicationInfos array in a table with the specified columns

datalargeVersionIdid001envtestprojectIdINTELLIGENTMAINTENANCElargeVersionDeployConfigVOenvtestlargeVersionIdid001projectIdINTELLIGENTMAINTENANCEprojectName测试项目001applicationInfosdeployOrdernullimageId

原文地址: http://www.cveoy.top/t/topic/h1kV 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录