aboutsummaryrefslogtreecommitdiffstats
path: root/webui/src/pages
diff options
context:
space:
mode:
authorAien Saidi <aien.saidi@gmail.com>2021-03-24 18:12:05 +0100
committerSascha <GlancingMind@outlook.com>2021-04-07 13:08:26 +0200
commitbff9fa673a4b481511fcc81bfd50ee74487788ab (patch)
treec14cd86474f8feb19069f9d7a51a67fd295ae361 /webui/src/pages
parent248201bcbdcd0415870a5f75211bf3a3108777c1 (diff)
downloadgit-bug-bff9fa673a4b481511fcc81bfd50ee74487788ab.tar.gz
fix: issue with regex
Diffstat (limited to 'webui/src/pages')
-rw-r--r--webui/src/pages/list/Filter.tsx6
-rw-r--r--webui/src/pages/list/FilterToolbar.tsx7
2 files changed, 9 insertions, 4 deletions
diff --git a/webui/src/pages/list/Filter.tsx b/webui/src/pages/list/Filter.tsx
index 54b2262b..2ba6ffaf 100644
--- a/webui/src/pages/list/Filter.tsx
+++ b/webui/src/pages/list/Filter.tsx
@@ -28,7 +28,7 @@ function parse(query: string): Query {
const params: Query = {};
// TODO: support escaping without quotes
- const re = /(\w+):([A-Za-z0-9-]+|(["'])(([^\3]|\\.)*)\3)+/g;
+ const re = /(\w+):([A-Za-z0-9-]+|"([^"]*)")/g;
let matches;
while ((matches = re.exec(query)) !== null) {
if (!params[matches[1]]) {
@@ -36,8 +36,8 @@ function parse(query: string): Query {
}
let value;
- if (matches[4]) {
- value = matches[4];
+ if (matches[3]) {
+ value = matches[3];
} else {
value = matches[2];
}
diff --git a/webui/src/pages/list/FilterToolbar.tsx b/webui/src/pages/list/FilterToolbar.tsx
index 59a09226..cf5994ab 100644
--- a/webui/src/pages/list/FilterToolbar.tsx
+++ b/webui/src/pages/list/FilterToolbar.tsx
@@ -96,6 +96,8 @@ function FilterToolbar({ query, queryLocation }: Props) {
params[key] && params[key].length > 0;
const hasValue = (key: string, value: string): boolean =>
hasKey(key) && params[key].includes(value);
+ const containsValue = (key: string, value: string): boolean =>
+ hasKey(key) && params[key].indexOf(value) !== -1;
const loc = pipe(stringify, queryLocation);
const replaceParam = (key: string, value: string) => (
params: Query
@@ -170,7 +172,10 @@ function FilterToolbar({ query, queryLocation }: Props) {
</FilterDropdown>
<FilterDropdown
dropdown={labels}
- itemActive={(key) => hasValue('label', key)}
+ itemActive={(key) => {
+ console.log(params, params[key], key);
+ return containsValue('label', key);
+ }}
to={(key) => pipe(toggleOrAddParam('label', key), loc)(params)}
hasFilter
>