From 909d43645aa92d8645a38fcb85375264f59f5a4d Mon Sep 17 00:00:00 2001 From: Lan Xia Date: Thu, 28 Sep 2023 16:12:57 -0400 Subject: [PATCH] Fix Dropdown Signed-off-by: Lan Xia --- .../src/Settings/Settings.jsx | 165 +++++++++--------- 1 file changed, 78 insertions(+), 87 deletions(-) diff --git a/test-result-summary-client/src/Settings/Settings.jsx b/test-result-summary-client/src/Settings/Settings.jsx index 2e2e05c7..b387e924 100644 --- a/test-result-summary-client/src/Settings/Settings.jsx +++ b/test-result-summary-client/src/Settings/Settings.jsx @@ -1,6 +1,14 @@ import React, { Component } from 'react'; import { CheckOutlined, DownOutlined, EditOutlined } from '@ant-design/icons'; -import { Button, Table, Input, Popconfirm, Dropdown, Menu, message, Spin } from 'antd'; +import { + Button, + Table, + Input, + Popconfirm, + Dropdown, + message, + Spin, +} from 'antd'; import { fetchData } from '../utils/Utils'; import './settings.css'; @@ -191,26 +199,10 @@ export default class Settings extends Component { } }; - handleTypeClick = (record, e) => { + handleTypeClick = (record, e, type) => { const { data } = this.state; if (data && data.length > record.key) { - data[record.key].type = e.key; - this.setState(data); - } - }; - - handleStreamingClick = (record, e) => { - const { data } = this.state; - if (data && data.length > record.key) { - data[record.key].streaming = e.key; - this.setState(data); - } - }; - - handleMonitoringClick = (record, e) => { - const { data } = this.state; - if (data && data.length > record.key) { - data[record.key].monitoring = e.key; + data[record.key][type] = e.key; this.setState(data); } }; @@ -234,33 +226,30 @@ export default class Settings extends Component { title: 'Build Type', dataIndex: 'type', render: (text, record) => { - const menu = ( - - ); return ( - + + this.handleTypeClick(record, e, 'type'), + items: [ + { + key: 'FVT', + label: 'FVT', + value: 'FVT', + }, + { + key: 'JCK', + label: 'JCK', + value: 'JCK', + }, + { + key: 'Perf', + label: 'Perf', + value: 'Perf', + }, + ], + }} + > @@ -272,28 +261,29 @@ export default class Settings extends Component { title: 'Streaming', dataIndex: 'streaming', render: (text, record) => { - const menu = ( - - ); return ( - + + this.handleTypeClick( + record, + e, + 'streaming' + ), + items: [ + { + key: 'No', + label: 'No', + value: 'No', + }, + { + key: 'Yes', + label: 'Yes', + value: 'Yes', + }, + ], + }} + > @@ -305,28 +295,29 @@ export default class Settings extends Component { title: 'Monitoring', dataIndex: 'monitoring', render: (text, record) => { - const menu = ( - - ); return ( - + + this.handleTypeClick( + record, + e, + 'monitoring' + ), + items: [ + { + key: 'No', + label: 'No', + value: 'No', + }, + { + key: 'Yes', + label: 'Yes', + value: 'Yes', + }, + ], + }} + >