@@ -20,6 +20,7 @@ import { useDispatch, useSelector } from '../../hooks';
2020import {
2121 organizationSelectors ,
2222 pipelineSelectors ,
23+ projectSelectors ,
2324 stackSelectors ,
2425} from '../../../redux/selectors' ;
2526import {
@@ -50,7 +51,7 @@ export const getInitialFilterState = () => {
5051 } ,
5152 {
5253 value : 'user_id' ,
53- label : 'Owner ' ,
54+ label : 'Author ' ,
5455 type : 'string' ,
5556 } ,
5657 {
@@ -74,12 +75,12 @@ export const getInitialFilterState = () => {
7475 type : 'string' ,
7576 } ,
7677 {
77- value : 'start_with ' ,
78+ value : 'startswith ' ,
7879 label : 'Start With' ,
7980 type : 'string' ,
8081 } ,
8182 {
82- value : 'end_with ' ,
83+ value : 'endswith ' ,
8384 label : 'End With' ,
8485 type : 'string' ,
8586 } ,
@@ -343,12 +344,12 @@ export const getInitialFilterStateForRuns = () => {
343344 type : 'string' ,
344345 } ,
345346 {
346- value : 'start_with ' ,
347+ value : 'startswith ' ,
347348 label : 'Start With' ,
348349 type : 'string' ,
349350 } ,
350351 {
351- value : 'end_with ' ,
352+ value : 'endswith ' ,
352353 label : 'End With' ,
353354 type : 'string' ,
354355 } ,
@@ -432,10 +433,11 @@ const FilterComponent = ({
432433 const dispatch = useDispatch ( ) ;
433434 const [ applyFilter , setApplyFilter ] = useState ( false ) ;
434435 const [ searchText , setSearchText ] = useState ( false ) ;
435-
436+ const [ showInBar , setShowInbar ] = useState ( false ) ;
436437 const members = useSelector ( organizationSelectors . myMembers ) ;
437438 const pipelines = useSelector ( pipelineSelectors . myPipelines ) ;
438439 const stacks = useSelector ( stackSelectors . mystacks ) ;
440+ const selectedProject = useSelector ( projectSelectors . selectedProject ) ;
439441 console . log ( members , 'members' ) ;
440442 function handleChange ( filter : any , key : string , value : string ) {
441443 filter [ key ] . selectedValue = filter [ key ] . options . filter (
@@ -497,16 +499,26 @@ const FilterComponent = ({
497499
498500 function callActionForPipelines ( name : string ) {
499501 if ( name ) {
500- dispatch ( pipelinesActions . getMy ( { name : 'contains:' + name } ) ) ;
502+ dispatch (
503+ pipelinesActions . getMy ( {
504+ project : selectedProject ,
505+ name : 'contains:' + name ,
506+ } ) ,
507+ ) ;
501508 } else {
502- dispatch ( pipelinesActions . getMy ( { } ) ) ;
509+ dispatch ( pipelinesActions . getMy ( { project : selectedProject } ) ) ;
503510 }
504511 }
505512 function callActionForStacks ( name : string ) {
506513 if ( name ) {
507- stacksActions . getMy ( { name : 'contains:' + name } ) ;
514+ dispatch (
515+ stacksActions . getMy ( {
516+ project : selectedProject ,
517+ name : 'contains:' + name ,
518+ } ) ,
519+ ) ;
508520 } else {
509- stacksActions . getMy ( { } ) ;
521+ dispatch ( stacksActions . getMy ( { project : selectedProject } ) ) ;
510522 }
511523 }
512524
@@ -535,10 +547,56 @@ const FilterComponent = ({
535547 height : '40px' ,
536548 fontSize : '12px' ,
537549 display : 'flex' ,
550+ fontFamily : 'Rubik' ,
551+ // color: 'red',
552+
538553 // ...base,
539554 } ) ,
540555 } ;
541556
557+ function checkForName ( typeName : string , value : string ) {
558+ if ( typeName === 'Author' ) {
559+ const member = members . filter ( ( item ) => item . id === value ) ;
560+
561+ return member [ 0 ] . name ;
562+ }
563+ if ( typeName === 'Pipeline Name' ) {
564+ const pipeline = pipelines . filter ( ( item ) => item . id === value ) ;
565+ return pipeline [ 0 ] . name ;
566+ }
567+ if ( typeName === 'Stack Name' ) {
568+ const stack = stacks . filter ( ( item ) => item . id === value ) ;
569+ return stack [ 0 ] . name ;
570+ } else {
571+ return value ;
572+ }
573+ // switch (typeName) {
574+ // case 'Author':
575+ // members.filter((item) => {
576+ // if (item.id === value) {
577+ // return item.name;
578+ // }
579+ // });
580+ // break;
581+ // case 'Pipeline Name':
582+ // pipelines.filter((item) => {
583+ // if (item.id === value) {
584+ // return item.name;
585+ // }
586+ // });
587+ // break;
588+ // case 'Stack Name':
589+ // stacks.filter((item) => {
590+ // if (item.id === value) {
591+ // return item.name;
592+ // }
593+ // });
594+ // break;
595+
596+ // default:
597+ // break;
598+ // }
599+ }
542600 const valueField = ( filter : any ) => {
543601 switch ( filter ?. contains . selectedValue . type ) {
544602 case 'string' :
@@ -650,19 +708,17 @@ const FilterComponent = ({
650708 return (
651709 < FlexBox . Column fullWidth >
652710 < div className = { styles . inputRow } >
653- { ! window . location . href ?. includes ( 'components' ) && (
654- < Box marginRight = "md" marginTop = "md" >
655- < SearchInputField
656- placeholder = { 'Search' }
657- value = { searchText ? filters [ 0 ] ?. filterValue : '' }
658- disabled = { applyFilter }
659- onChange = { ( value : string ) => {
660- setSearchText ( value ? true : false ) ;
661- handleValueFieldChangeOnSearch ( value ) ;
662- } }
663- />
664- </ Box >
665- ) }
711+ < Box marginRight = "md" marginTop = "md" >
712+ < SearchInputField
713+ placeholder = { 'Search' }
714+ value = { searchText ? filters [ 0 ] ?. filterValue : '' }
715+ disabled = { applyFilter || showInBar }
716+ onChange = { ( value : string ) => {
717+ setSearchText ( value ? true : false ) ;
718+ handleValueFieldChangeOnSearch ( value ) ;
719+ } }
720+ />
721+ </ Box >
666722
667723 < FlexBox
668724 fullWidth
@@ -701,18 +757,34 @@ const FilterComponent = ({
701757 < FlexBox . Row key = { index } className = { styles . tile } >
702758 < Box onClick = { ( ) => hanldeDelete ( index ) } >
703759 { `${ filter . column . selectedValue . label } ${
704- filter . column . selectedValue . label !== 'Shared' &&
705- filter . column . selectedValue . label !== 'Status'
706- ? filter . contains . selectedValue . label
707- : ''
760+ filter . column . selectedValue . label === 'Shared' ||
761+ filter . column . selectedValue . label === 'Status'
762+ ? 'is'
763+ : filter . column . selectedValue . label ===
764+ 'Pipeline Name' ||
765+ filter . column . selectedValue . label ===
766+ 'Stack Name' ||
767+ filter . column . selectedValue . label === 'Author'
768+ ? 'Equals'
769+ : filter . contains . selectedValue . label
708770 } ${
709771 typeof filter . filterValue === 'string'
710- ? filter . filterValue
772+ ? checkForName (
773+ filter . column . selectedValue . label ,
774+ filter . filterValue ,
775+ )
711776 : formatDateToDisplay ( filter . filterValue )
712777 } `}
713778 </ Box >
714779
715- < Box onClick = { ( ) => hanldeDelete ( index ) } >
780+ < Box
781+ onClick = { ( ) => {
782+ if ( filters . length === 1 ) {
783+ setShowInbar ( false ) ;
784+ }
785+ hanldeDelete ( index ) ;
786+ } }
787+ >
716788 < icons . closeWithBorder
717789 style = { { paddingLeft : '7px' } }
718790 size = { iconSizes . sm }
@@ -734,6 +806,7 @@ const FilterComponent = ({
734806 < Box
735807 onClick = { ( ) => {
736808 setFilter ( [ getInitials ( ) ] ) ;
809+ setShowInbar ( false ) ;
737810 } }
738811 >
739812 < icons . closeWithBorder
@@ -775,9 +848,10 @@ const FilterComponent = ({
775848 < Box style = { { width : '146px' } } >
776849 < FormDropdownField
777850 label = { '' }
778- onChange = { ( value : string ) =>
779- handleChange ( filter , 'column' , value )
780- }
851+ onChange = { ( value : string ) => {
852+ setShowInbar ( true ) ;
853+ handleChange ( filter , 'column' , value ) ;
854+ } }
781855 placeholder = { 'Column Name' }
782856 value = { filter . column . selectedValue . value }
783857 options = { filter . column . options }
@@ -787,6 +861,7 @@ const FilterComponent = ({
787861 width : '146px' ,
788862 fontSize : '12px' ,
789863 color : '#424240' ,
864+ fontFamily : 'Rubik' ,
790865 } }
791866 />
792867 </ Box >
@@ -803,6 +878,7 @@ const FilterComponent = ({
803878 width : '146px' ,
804879 fontSize : '12px' ,
805880 color : '#424240' ,
881+ fontFamily : 'Rubik' ,
806882 } }
807883 onChange = { ( value : string ) =>
808884 // handleChange(filter, 'contains', value)
@@ -845,6 +921,7 @@ const FilterComponent = ({
845921 width : '146px' ,
846922 fontSize : '12px' ,
847923 color : '#424240' ,
924+ fontFamily : 'Rubik' ,
848925 } }
849926 onChange = {
850927 ( value : string ) =>
@@ -934,6 +1011,7 @@ const FilterComponent = ({
9341011 width : '146px' ,
9351012 fontSize : '12px' ,
9361013 color : '#424240' ,
1014+ fontFamily : 'Rubik' ,
9371015 } }
9381016 />
9391017 { valueField ( filter ) }
@@ -942,7 +1020,9 @@ const FilterComponent = ({
9421020 ) }
9431021
9441022 < Box
945- onClick = { ( ) => hanldeDelete ( index ) }
1023+ onClick = { ( ) => {
1024+ hanldeDelete ( index ) ;
1025+ } }
9461026 className = { styles . removeIcon }
9471027 >
9481028 < icons . delete
0 commit comments