From 4c57ed2a69b6caf8e89558df309e0da8ad0c215a Mon Sep 17 00:00:00 2001 From: Lijiao Date: Tue, 13 Jul 2021 09:56:19 +0000 Subject: [PATCH 1/2] update --- .../components/trial-detail/search/Search.tsx | 130 ++++++++++-------- ts/webui/src/static/const.ts | 4 +- 2 files changed, 76 insertions(+), 58 deletions(-) diff --git a/ts/webui/src/components/trial-detail/search/Search.tsx b/ts/webui/src/components/trial-detail/search/Search.tsx index ab39ee919b..db82795382 100644 --- a/ts/webui/src/components/trial-detail/search/Search.tsx +++ b/ts/webui/src/components/trial-detail/search/Search.tsx @@ -143,6 +143,7 @@ function Search(props): any { } // according [input val] to change searchFilter list const allFilterConditions = searchInputVal.trim().split(';'); + console.info(allFilterConditions); // eslint-disable-line const newSearchFilter: any = []; // delete '' in filter list @@ -154,75 +155,90 @@ function Search(props): any { } allFilterConditions.forEach(eachFilterConditionStr => { - let eachFilterConditionArr: string[] = []; - - // EXPERIMENT.searchSpace[parameter]._type === 'choice' - if (eachFilterConditionStr.includes('>' || '<')) { - const operator = eachFilterConditionStr.includes('>') === true ? '>' : '<'; - eachFilterConditionArr = eachFilterConditionStr.trim().split(operator); - newSearchFilter.push({ - name: eachFilterConditionArr[0], - operator: operator, - value1: eachFilterConditionArr[1], - value2: '', - choice: [], - isChoice: false - }); - } else if (eachFilterConditionStr.includes('≠')) { - // drop_rate≠6; status≠[x,xx,xxx]; conv_size≠[3,7] - eachFilterConditionArr = eachFilterConditionStr.trim().split('≠'); - const filterName = eachFilterConditionArr[0] === 'Status' ? 'StatusNNI' : eachFilterConditionArr[0]; - const isChoicesType = isChoiceType(filterName); - newSearchFilter.push({ - name: filterName, - operator: '≠', - value1: isChoicesType ? '' : JSON.parse(eachFilterConditionArr[1]), - value2: '', - choice: isChoicesType ? convertStringArrToList(eachFilterConditionArr[1]) : [], - isChoice: isChoicesType ? true : false - }); + // input content looks like that: `Trial id:` + if ( + eachFilterConditionStr.endsWith(':') || + eachFilterConditionStr.endsWith('<') || + eachFilterConditionStr.endsWith('>') || + eachFilterConditionStr.endsWith('≠') + ) { + return; } else { - // = : conv_size:[1,2,3,4]; Trial id:3; hidden_size:[1,2], status:[val1,val2,val3] - eachFilterConditionArr = eachFilterConditionStr.trim().split(':'); - const filterName = eachFilterConditionArr[0] === 'Status' ? 'StatusNNI' : eachFilterConditionArr[0]; - const isChoicesType = isChoiceType(filterName); - const isArray = - eachFilterConditionArr.length > 1 && eachFilterConditionArr[1].includes('[' || ']') ? true : false; - if (isArray === true) { - if (isChoicesType === true) { - // status:[SUCCEEDED] - newSearchFilter.push({ - name: filterName, - operator: '=', - value1: '', - value2: '', - choice: convertStringArrToList(eachFilterConditionArr[1]), - isChoice: true - }); + let eachFilterConditionArr: string[] = []; + + // EXPERIMENT.searchSpace[parameter]._type === 'choice' + if (eachFilterConditionStr.includes('>' || '<')) { + const operator = eachFilterConditionStr.includes('>') === true ? '>' : '<'; + eachFilterConditionArr = eachFilterConditionStr.trim().split(operator); + newSearchFilter.push({ + name: eachFilterConditionArr[0], + operator: operator, + value1: eachFilterConditionArr[1], + value2: '', + choice: [], + isChoice: false + }); + } else if (eachFilterConditionStr.includes('≠')) { + // drop_rate≠6; status≠[x,xx,xxx]; conv_size≠[3,7] + eachFilterConditionArr = eachFilterConditionStr.trim().split('≠'); + const filterName = eachFilterConditionArr[0] === 'Status' ? 'StatusNNI' : eachFilterConditionArr[0]; + const isChoicesType = isChoiceType(filterName); + newSearchFilter.push({ + name: filterName, + operator: '≠', + value1: isChoicesType ? '' : JSON.parse(eachFilterConditionArr[1]), + value2: '', + choice: isChoicesType ? convertStringArrToList(eachFilterConditionArr[1]) : [], + isChoice: isChoicesType ? true : false + }); + } else if (eachFilterConditionStr.includes(':')) { + // = : conv_size:[1,2,3,4]; Trial id:3; hidden_size:[1,2], status:[val1,val2,val3] + eachFilterConditionArr = eachFilterConditionStr.trim().split(':'); + const filterName = eachFilterConditionArr[0] === 'Status' ? 'StatusNNI' : eachFilterConditionArr[0]; + const isChoicesType = isChoiceType(filterName); + const isArray = + eachFilterConditionArr.length > 1 && eachFilterConditionArr[1].includes('[' || ']') + ? true + : false; + if (isArray === true) { + if (isChoicesType === true) { + // status:[SUCCEEDED] + newSearchFilter.push({ + name: filterName, + operator: '=', + value1: '', + value2: '', + choice: convertStringArrToList(eachFilterConditionArr[1]), + isChoice: true + }); + } else { + // drop_rate:[1,10] + newSearchFilter.push({ + name: eachFilterConditionArr[0], + operator: 'between', + value1: JSON.parse(eachFilterConditionArr[1])[0], + value2: JSON.parse(eachFilterConditionArr[1])[1], + choice: [], + isChoice: false + }); + } } else { - // drop_rate:[1,10] newSearchFilter.push({ name: eachFilterConditionArr[0], - operator: 'between', - value1: JSON.parse(eachFilterConditionArr[1])[0], - value2: JSON.parse(eachFilterConditionArr[1])[1], + operator: '=', + value1: eachFilterConditionArr[1], + value2: '', choice: [], isChoice: false }); } } else { - newSearchFilter.push({ - name: eachFilterConditionArr[0], - operator: '=', - value1: eachFilterConditionArr[1], - value2: '', - choice: [], - isChoice: false - }); + // user input: Trial id + return; } } }); - + console.info(newSearchFilter); // eslint-disable-line changeTableListPage(newSearchFilter); } diff --git a/ts/webui/src/static/const.ts b/ts/webui/src/static/const.ts index 127b60f229..15919ac049 100644 --- a/ts/webui/src/static/const.ts +++ b/ts/webui/src/static/const.ts @@ -6,7 +6,9 @@ const METRIC_GROUP_UPDATE_SIZE = 20; const prefix = getPrefix(); const RESTAPI = '/api/v1/nni'; -const MANAGER_IP = prefix === undefined ? RESTAPI : `${prefix}${RESTAPI}`; +const MANAGER_IP = + prefix === undefined ? `http://40.84.50.44:8080${RESTAPI}` : `http://40.84.50.44:8080${prefix}${RESTAPI}`; +// const MANAGER_IP = prefix === undefined ? RESTAPI : `${prefix}${RESTAPI}`; const DOWNLOAD_IP = `/logs`; const WEBUIDOC = 'https://nni.readthedocs.io/en/latest/Tutorial/WebUI.html'; From 33d9e5b77eecd98c315f477c67b58be3591065f1 Mon Sep 17 00:00:00 2001 From: Lijiao Date: Tue, 13 Jul 2021 10:00:40 +0000 Subject: [PATCH 2/2] remove dev env --- ts/webui/src/components/trial-detail/search/Search.tsx | 2 -- ts/webui/src/static/const.ts | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/ts/webui/src/components/trial-detail/search/Search.tsx b/ts/webui/src/components/trial-detail/search/Search.tsx index db82795382..65389b616c 100644 --- a/ts/webui/src/components/trial-detail/search/Search.tsx +++ b/ts/webui/src/components/trial-detail/search/Search.tsx @@ -143,7 +143,6 @@ function Search(props): any { } // according [input val] to change searchFilter list const allFilterConditions = searchInputVal.trim().split(';'); - console.info(allFilterConditions); // eslint-disable-line const newSearchFilter: any = []; // delete '' in filter list @@ -238,7 +237,6 @@ function Search(props): any { } } }); - console.info(newSearchFilter); // eslint-disable-line changeTableListPage(newSearchFilter); } diff --git a/ts/webui/src/static/const.ts b/ts/webui/src/static/const.ts index 15919ac049..127b60f229 100644 --- a/ts/webui/src/static/const.ts +++ b/ts/webui/src/static/const.ts @@ -6,9 +6,7 @@ const METRIC_GROUP_UPDATE_SIZE = 20; const prefix = getPrefix(); const RESTAPI = '/api/v1/nni'; -const MANAGER_IP = - prefix === undefined ? `http://40.84.50.44:8080${RESTAPI}` : `http://40.84.50.44:8080${prefix}${RESTAPI}`; -// const MANAGER_IP = prefix === undefined ? RESTAPI : `${prefix}${RESTAPI}`; +const MANAGER_IP = prefix === undefined ? RESTAPI : `${prefix}${RESTAPI}`; const DOWNLOAD_IP = `/logs`; const WEBUIDOC = 'https://nni.readthedocs.io/en/latest/Tutorial/WebUI.html';