Unverified Commit f8327ba0 authored by Lijiaoa's avatar Lijiaoa Committed by GitHub
Browse files

[webui] fix little bugs (#4541)

parent 31fbcf41
...@@ -14,6 +14,6 @@ WebUI is built by using [React](https://reactjs.org/docs/getting-started.html) a ...@@ -14,6 +14,6 @@ WebUI is built by using [React](https://reactjs.org/docs/getting-started.html) a
## PR ## PR
* WebUI uses [eslint](https://eslint.org/docs/user-guide/getting-started) and [prettier](https://prettier.io/docs/en/index.html) to format code. Before you send PR, you could use the command `yarn sanity-check` to format code style. * WebUI uses [eslint](https://eslint.org/docs/user-guide/getting-started) and [prettier](https://prettier.io/docs/en/index.html) to format code. You could use the command `yarn sanity-check` to check the code error status. And use `yarn sanity-check --fix` could modifiy the most code style error before you send PR.
* You could send the PR if `yarn release` gets successful build after formatting code. * You could send the PR if `yarn release` gets successful build after formatting code.
\ No newline at end of file
...@@ -285,7 +285,8 @@ class Experiment extends React.Component<{}, ExpListState> { ...@@ -285,7 +285,8 @@ class Experiment extends React.Component<{}, ExpListState> {
const searchInput = newValue.trim(); const searchInput = newValue.trim();
let result = originExperimentList.filter( let result = originExperimentList.filter(
item => item =>
item.experimentName.toLowerCase().includes(searchInput.toLowerCase()) || (item.experimentName !== null &&
item.experimentName.toLowerCase().includes(searchInput.toLowerCase())) ||
item.id.toLowerCase().includes(searchInput.toLowerCase()) item.id.toLowerCase().includes(searchInput.toLowerCase())
); );
result = this.commonSelectString(result, ''); result = this.commonSelectString(result, '');
...@@ -400,13 +401,18 @@ class Experiment extends React.Component<{}, ExpListState> { ...@@ -400,13 +401,18 @@ class Experiment extends React.Component<{}, ExpListState> {
private setSearchSource(): void { private setSearchSource(): void {
const { sortInfo, originExperimentList } = this.state; const { sortInfo, originExperimentList } = this.state;
let { searchInputVal } = this.state; let { searchInputVal } = this.state;
let result = JSON.parse(JSON.stringify(originExperimentList));
searchInputVal = searchInputVal.trim(); searchInputVal = searchInputVal.trim();
// hert re-search data for fix this status: filter first -> searchBox search result null -> close filter // user input some value to filter trial [name, id] first...
const result = originExperimentList.filter( if (searchInputVal !== '') {
item => // reset experiments list to first filter result
item.experimentName.toLowerCase().includes(searchInputVal.toLowerCase()) || result = originExperimentList.filter(
item.id.toLowerCase().includes(searchInputVal.toLowerCase()) item =>
); item.id.toLowerCase().includes(searchInputVal.toLowerCase()) ||
(item.experimentName !== null &&
item.experimentName.toLowerCase().includes(searchInputVal.toLowerCase()))
);
}
this.setState(() => ({ this.setState(() => ({
source: getSortedSource(result, sortInfo), source: getSortedSource(result, sortInfo),
selectedStatus: [], selectedStatus: [],
......
...@@ -90,6 +90,7 @@ class LogDrawer extends React.Component<LogDrawerProps, LogDrawerState> { ...@@ -90,6 +90,7 @@ class LogDrawer extends React.Component<LogDrawerProps, LogDrawerState> {
isFooterAtBottom={true} isFooterAtBottom={true}
isLightDismiss={true} isLightDismiss={true}
onLightDismissClick={closeDrawer} onLightDismissClick={closeDrawer}
className='logPanel'
> >
<Pivot selectedKey={activeTab} style={{ minHeight: 190 }}> <Pivot selectedKey={activeTab} style={{ minHeight: 190 }}>
<PivotItem headerText='Dispatcher log' key='dispatcher'> <PivotItem headerText='Dispatcher log' key='dispatcher'>
......
...@@ -179,17 +179,21 @@ class TableList extends React.Component<TableListProps, TableListState> { ...@@ -179,17 +179,21 @@ class TableList extends React.Component<TableListProps, TableListState> {
checked?: boolean checked?: boolean
): void => { ): void => {
const { displayedItems, selectedRowIds } = this.state; const { displayedItems, selectedRowIds } = this.state;
const items = JSON.parse(JSON.stringify(displayedItems)); const latestDisplayedItems = JSON.parse(JSON.stringify(displayedItems));
const temp = selectedRowIds; let latestSelectedRowIds = selectedRowIds;
if (checked === true) {
temp.push(id); if (checked === false) {
latestSelectedRowIds = latestSelectedRowIds.filter(item => item !== id);
} else {
latestSelectedRowIds.push(id);
} }
items.forEach(item => {
latestDisplayedItems.forEach(item => {
if (item.id === id) { if (item.id === id) {
item._checked = !!checked; item._checked = !!checked;
} }
}); });
this.setState(() => ({ displayedItems: items, selectedRowIds: temp })); this.setState(() => ({ displayedItems: latestDisplayedItems, selectedRowIds: latestSelectedRowIds }));
}; };
private changeSelectTrialIds = (): void => { private changeSelectTrialIds = (): void => {
......
...@@ -38,6 +38,12 @@ $navBarMarginBottom: 18px; ...@@ -38,6 +38,12 @@ $navBarMarginBottom: 18px;
} }
} }
.logPanel {
.ms-Panel-main {
width: 80%;
}
}
.panel { .panel {
padding: 0 38px; padding: 0 38px;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment