Skip to content

Commit 8e3b638

Browse files
fixed author, pipeline and stack name display issue while filtering
1 parent da66bab commit 8e3b638

File tree

1 file changed

+45
-12
lines changed

1 file changed

+45
-12
lines changed

src/ui/components/Filters/index.tsx

Lines changed: 45 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,24 @@ const FilterComponent = ({
609609
// break;
610610
// }
611611
}
612+
const authorOptions = members.map((item: any) => {
613+
return {
614+
label: item.name as string,
615+
value: item.id as string,
616+
};
617+
}) as any;
618+
const pipelinesOptions = pipelines.map((item: any) => {
619+
return {
620+
label: item.name as string,
621+
value: item.id as string,
622+
};
623+
}) as any;
624+
const stacksOptions = stacks.map((item: any) => {
625+
return {
626+
label: item.name as string,
627+
value: item.id as string,
628+
};
629+
}) as any;
612630
const valueField = (filter: any) => {
613631
switch (filter?.contains.selectedValue.type) {
614632
case 'string':
@@ -958,14 +976,19 @@ const FilterComponent = ({
958976
) : // <></>
959977
filter?.column?.selectedValue?.value === 'pipeline_id' ? (
960978
<Select
961-
getOptionLabel={(option: any) => option.name}
962-
getOptionValue={(option: any) => option.id}
963-
options={pipelines as any}
979+
// getOptionLabel={(option: any) => option.name}
980+
// getOptionValue={(option: any) => option.id}
981+
options={pipelinesOptions}
982+
defaultValue={pipelinesOptions.filter((el: any) => {
983+
return filters.some((f: any) => {
984+
return f.filterValue === el.value;
985+
});
986+
})}
964987
styles={selectStyles}
965988
onInputChange={(e: any) => callActionForPipelines(e)}
966989
onChange={(value: any) => {
967990
if (value) {
968-
handleChangeForSearchable(filter, value.id);
991+
handleChangeForSearchable(filter, value.value);
969992
}
970993
}}
971994
isClearable={true}
@@ -976,14 +999,19 @@ const FilterComponent = ({
976999
) : filter?.column?.selectedValue?.value ===
9771000
'stack_id' ? (
9781001
<Select
979-
getOptionLabel={(option: any) => option.name}
980-
getOptionValue={(option: any) => option.id}
981-
options={stacks as any}
1002+
// getOptionLabel={(option: any) => option.name}
1003+
// getOptionValue={(option: any) => option.id}
1004+
options={stacksOptions}
1005+
defaultValue={stacksOptions.filter((el: any) => {
1006+
return filters.some((f: any) => {
1007+
return f.filterValue === el.value;
1008+
});
1009+
})}
9821010
styles={selectStyles}
9831011
onInputChange={(e: any) => callActionForStacks(e)}
9841012
onChange={(value: any) => {
9851013
if (value) {
986-
handleChangeForSearchable(filter, value.id);
1014+
handleChangeForSearchable(filter, value.value);
9871015
}
9881016
}}
9891017
isClearable={true}
@@ -993,14 +1021,19 @@ const FilterComponent = ({
9931021
/>
9941022
) : (
9951023
<Select
996-
getOptionLabel={(option: any) => option.name}
997-
getOptionValue={(option: any) => option.id}
998-
options={members as any}
1024+
// getOptionLabel={(option: any) => option.name}
1025+
// getOptionValue={(option: any) => option.id}
1026+
options={authorOptions}
1027+
defaultValue={authorOptions.filter((el: any) => {
1028+
return filters.some((f: any) => {
1029+
return f.filterValue === el.value;
1030+
});
1031+
})}
9991032
styles={selectStyles}
10001033
onInputChange={(e: any) => callActionForUsers(e)}
10011034
onChange={(value: any) => {
10021035
if (value) {
1003-
handleChangeForSearchable(filter, value.id);
1036+
handleChangeForSearchable(filter, value.value);
10041037
}
10051038
}}
10061039
isClearable={true}

0 commit comments

Comments
 (0)