Skip to content

Commit

Permalink
Fix Dropdown
Browse files Browse the repository at this point in the history
Signed-off-by: Lan Xia <Lan_Xia@ca.ibm.com>
  • Loading branch information
llxia committed Sep 28, 2023
1 parent 19a77db commit 909d436
Showing 1 changed file with 78 additions and 87 deletions.
165 changes: 78 additions & 87 deletions test-result-summary-client/src/Settings/Settings.jsx
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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);
}
};
Expand All @@ -234,33 +226,30 @@ export default class Settings extends Component {
title: 'Build Type',
dataIndex: 'type',
render: (text, record) => {
const menu = (
<Menu
onClick={this.handleTypeClick.bind(
null,
record
)}
items={[
{
key: 'FVT',
label: 'FVT',
value: 'FVT',
},
{
key: 'JCK',
label: 'JCK',
value: 'JCK',
},
{
key: 'Perf',
label: 'Perf',
value: 'Perf',
},
]}
/>
);
return (
<Dropdown menu={menu}>
<Dropdown
menu={{
onClick: (e) =>
this.handleTypeClick(record, e, 'type'),
items: [
{
key: 'FVT',
label: 'FVT',
value: 'FVT',
},
{
key: 'JCK',
label: 'JCK',
value: 'JCK',
},
{
key: 'Perf',
label: 'Perf',
value: 'Perf',
},
],
}}
>
<Button style={{ marginLeft: 8 }}>
{text ? text : 'Type'} <DownOutlined />
</Button>
Expand All @@ -272,28 +261,29 @@ export default class Settings extends Component {
title: 'Streaming',
dataIndex: 'streaming',
render: (text, record) => {
const menu = (
<Menu
onClick={this.handleStreamingClick.bind(
null,
record
)}
items={[
{
key: 'No',
label: 'No',
value: 'No',
},
{
key: 'Yes',
label: 'Yes',
value: 'Yes',
},
]}
/>
);
return (
<Dropdown menu={menu}>
<Dropdown
menu={{
onClick: (e) =>
this.handleTypeClick(
record,
e,
'streaming'
),
items: [
{
key: 'No',
label: 'No',
value: 'No',
},
{
key: 'Yes',
label: 'Yes',
value: 'Yes',
},
],
}}
>
<Button style={{ marginLeft: 8 }}>
{text ? text : 'No'} <DownOutlined />
</Button>
Expand All @@ -305,28 +295,29 @@ export default class Settings extends Component {
title: 'Monitoring',
dataIndex: 'monitoring',
render: (text, record) => {
const menu = (
<Menu
onClick={this.handleMonitoringClick.bind(
null,
record
)}
items={[
{
key: 'No',
label: 'No',
value: 'No',
},
{
key: 'Yes',
label: 'Yes',
value: 'Yes',
},
]}
/>
);
return (
<Dropdown menu={menu}>
<Dropdown
menu={{
onClick: (e) =>
this.handleTypeClick(
record,
e,
'monitoring'
),
items: [
{
key: 'No',
label: 'No',
value: 'No',
},
{
key: 'Yes',
label: 'Yes',
value: 'Yes',
},
],
}}
>
<Button style={{ marginLeft: 8 }}>
{text ? text : 'Yes'} <DownOutlined />
</Button>
Expand Down

0 comments on commit 909d436

Please sign in to comment.