Skip to content

Commit 7519b7a

Browse files
Merge branch 'dev' into table-expand/collapse-flow
2 parents 5ec2309 + 8df3605 commit 7519b7a

File tree

19 files changed

+263
-86
lines changed

19 files changed

+263
-86
lines changed

src/api/organizations/getMembersApi.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,21 @@ import { httpMethods } from '../constants';
44
import { apiUrl } from '../apiUrl';
55

66
const getMembersApi = ({
7+
sort_by,
8+
page,
9+
size,
710
name,
811
authenticationToken,
912
}: {
13+
sort_by?: string;
14+
page?: number;
15+
size?: number;
1016
name?: string;
1117
authenticationToken: string;
1218
}): Promise<TMember[]> =>
1319
fetchApiWithAuthRequest({
1420
url: apiUrl(endpoints.organizations.members),
15-
params: { name, size: 5 },
21+
params: { name, size, page, sort_by },
1622
method: httpMethods.get,
1723
authenticationToken,
1824
});

src/redux/actions/organizations/getMembersAction.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@ import { organizationActionTypes } from '../../actionTypes';
22
import getMembersApi from '../../../api/organizations/getMembersApi';
33

44
export const getMembersAction = ({
5+
sort_by,
6+
page,
7+
size,
58
name,
69
onSuccess,
710
onFailure,
811
}: {
12+
sort_by?: string;
13+
page?: number;
14+
size?: number;
915
name?: string;
1016
onSuccess?: () => void;
1117
onFailure?: (err: any) => void;
@@ -16,7 +22,7 @@ export const getMembersAction = ({
1622
isAuthenticated: true,
1723
failureActionType: organizationActionTypes.getMembers.failure,
1824
successActionType: organizationActionTypes.getMembers.success,
19-
params: { name },
25+
params: { name, size, page, sort_by },
2026
onSuccess,
2127
onFailure,
2228
},

src/redux/reducers/organizationsReducer.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export interface State {
1313
roles: string[];
1414
invoices: TInvoice[];
1515
invite: { id: null; activationToken: null; email: null };
16+
paginated: any;
1617
}
1718

1819
export type Action = {
@@ -39,12 +40,23 @@ export const initialState: State = {
3940
invoices: [],
4041
myOrganizationId: null,
4142
invite: { id: null, activationToken: null, email: null },
43+
paginated: {},
4244
};
4345

44-
const newState = (state: State, organizations: TOrganization[]): State => ({
46+
const newState = (
47+
state: State,
48+
organizations: TOrganization[],
49+
pagination?: any,
50+
): State => ({
4551
...state,
4652
ids: idsInsert(state.ids, organizations),
4753
byId: byKeyInsert(state.byId, organizations),
54+
paginated: {
55+
page: pagination.page,
56+
size: pagination.size,
57+
totalPages: pagination.total_pages,
58+
totalitem: pagination.total,
59+
},
4860
});
4961

5062
const organizationsReducer = (
@@ -83,9 +95,21 @@ const organizationsReducer = (
8395
action.payload.items as TMember[],
8496
);
8597

86-
return { ...newState(state, []), members: members || [] };
98+
return { ...newState(state, [], action.payload), members: members || [] };
8799
}
88100

101+
// case pipelineActionTypes.getMyPipelines.success: {
102+
// const pipelines: TPipeline[] = camelCaseArray(
103+
// action.payload.items as PipelinesPayload,
104+
// );
105+
106+
// const myPipelineIds: TId[] = pipelines.map(
107+
// (pipeline: TPipeline) => pipeline.id,
108+
// );
109+
110+
// return { ...newState(state, pipelines, action.payload), myPipelineIds };
111+
// }
112+
89113
case organizationActionTypes.invite.success: {
90114
const inviteUser = camelCaseObject(action.payload);
91115
return { ...newState(state, []), invite: inviteUser };

src/redux/selectors/organizations.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ const getById = (state: State): Record<TId, TOrganization> =>
1010
const getMyOrganizationId = (state: State): TId | null =>
1111
_.get(stateKey(state), 'myOrganizationId');
1212

13+
const getMyMembersPaginated = (state: State): any =>
14+
_.get(stateKey(state), 'paginated');
15+
1316
export const myOrganization = (state: State): TOrganization | null => {
1417
const myOrganizationId = getMyOrganizationId(state);
1518
const byId = getById(state);
@@ -18,7 +21,12 @@ export const myOrganization = (state: State): TOrganization | null => {
1821

1922
return byId[myOrganizationId];
2023
};
24+
export const myMembersPaginated = (state?: State | null): any => {
25+
if (!state) return {};
26+
const paginated = getMyMembersPaginated(state);
2127

28+
return paginated;
29+
};
2230
const inviteForCode = (state: State): any[] =>
2331
_.get(stateKey(state), 'inviteCode');
2432

@@ -34,6 +42,7 @@ const invite = (
3442
_.get(stateKey(state), 'invite');
3543

3644
const organizationSelectors = {
45+
myMembersPaginated: myMembersPaginated,
3746
myOrganization: myOrganization,
3847
myMembers: myMembers,
3948
inviteForCode: inviteForCode,

src/ui/components/Filters/filter.module.scss

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,20 @@
2424
}
2525

2626
.tile {
27+
align-items: center;
28+
font-size: 12px;
29+
font-weight: 400;
30+
font-family: Rubik;
31+
color: $primaryColor;
2732
height: 28px;
28-
background-color: #EDE4FF;
33+
background-color:#FBFBFB;
2934
margin-top: -5px !important;
3035
margin-left: 7px !important;
3136
border-radius: 4px;
3237
padding: 5px 11px !important
3338
}
3439

40+
3541
.removeIcon {
3642
margin-top: 23px !important;
3743
padding-top: 4px !important;
@@ -44,7 +50,7 @@
4450

4551

4652
.searchableInput {
47-
border-radius: 0;
53+
border-radius: 0 !important;
4854
width: 146;
4955
height: 40px;
5056
font-size: 12px;

src/ui/components/Filters/index.tsx

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
Box,
44
FlexBox,
55
FormDropdownField,
6+
SearchInputField,
67
FormTextField,
78
icons,
89
Paragraph,
@@ -529,7 +530,12 @@ const FilterComponent = ({
529530
const selectStyles = {
530531
control: (base: any) => ({
531532
width: '146px',
532-
...base,
533+
borderRadius: 0,
534+
border: '1px solid grey',
535+
height: '40px',
536+
fontSize: '12px',
537+
display: 'flex',
538+
// ...base,
533539
}),
534540
};
535541

@@ -644,27 +650,23 @@ const FilterComponent = ({
644650
return (
645651
<FlexBox.Column fullWidth>
646652
<div className={styles.inputRow}>
647-
<Box marginBottom="lg" marginRight="md">
648-
<FormTextField
649-
label={''}
650-
placeholder={'Search'}
651-
value={searchText ? filters[0]?.filterValue : ''}
652-
disabled={applyFilter}
653-
onChange={(value: string) => {
654-
setSearchText(value ? true : false);
655-
handleValueFieldChangeOnSearch(value);
656-
}}
657-
style={{
658-
borderRadius: '4px',
659-
width: '205px',
660-
fontSize: '12px',
661-
color: '#424240',
662-
}}
663-
/>
664-
</Box>
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+
)}
666+
665667
<FlexBox
666668
fullWidth
667-
className="border border-primary rounded rounded-4 p-2 align-item-center"
669+
className="border rounded rounded-4 p-2 align-item-center"
668670
>
669671
<Box
670672
onClick={() => {
@@ -673,28 +675,27 @@ const FilterComponent = ({
673675
style={{
674676
width: '33px',
675677
height: '28px',
676-
background: '#431D93',
678+
background: '#fff',
677679
borderRadius: '4px',
678680
}}
679681
>
680682
<icons.funnelFill
681683
style={{ padding: '5px 0px 0px 7px' }}
682684
size={iconSizes.sm}
683-
color={iconColors.white}
685+
color={iconColors.primary}
684686
/>
685687
</Box>
686688
<Box
687689
style={{ padding: '5px 0px 0px 7px', display: 'flex' }}
688690
className="text-muted h5"
689691
>
690692
{/* Filter your stack */}
691-
{!applyFilter && !filters[0]?.column?.selectedValue?.label ? (
693+
{!applyFilter && !filters[0]?.filterValue ? (
692694
<Paragraph className={styles.filterplaceholder}>
693695
Filter list
696+
{console.log(filters, 'filters1')}
694697
</Paragraph>
695-
) : filters[0]?.column?.selectedValue.label &&
696-
!applyFilter &&
697-
!searchText ? (
698+
) : filters[0]?.filterValue && !applyFilter && !searchText ? (
698699
filters.map((filter: any, index: number) => {
699700
return (
700701
<FlexBox.Row key={index} className={styles.tile}>
@@ -726,8 +727,7 @@ const FilterComponent = ({
726727
Filter list
727728
</Paragraph>
728729
)}
729-
{!applyFilter &&
730-
!filters[0]?.column?.selectedValue?.label ? null : filters[0]
730+
{!applyFilter && !filters[0]?.filterValue ? null : filters[0]
731731
?.column?.selectedValue.label &&
732732
!applyFilter &&
733733
!searchText ? (
Lines changed: 6 additions & 0 deletions
Loading

src/ui/components/icons/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import { ReactComponent as LockKey } from './assets/LockKey.svg';
5757
import { ReactComponent as Graph } from './assets/Graph.svg';
5858
import { ReactComponent as GitCommit } from './assets/GitCommit.svg';
5959
import { ReactComponent as ChatDots } from './assets/ChatDots.svg';
60+
import { ReactComponent as Run } from './assets/Run.svg';
6061
// import { ReactComponent as Inprogress } from './assets/InProgress.svg';
6162
// import { ReactComponent as Cached } from './assets/Cached.svg';
6263
// import { ReactComponent as RightArrow } from './assets/RightArrow.svg';
@@ -169,6 +170,7 @@ const icons = {
169170
delete: createIcon({ Component: Delete }),
170171
edit: createIcon({ Component: Edit }),
171172
search: createIcon({ Component: Search }),
173+
run: createIcon({ Component: Run, useStroke: true }),
172174

173175
//icons for stackComponents
174176
artifact_store: createIcon({ Component: Folders, useStroke: true }),

src/ui/components/typographies/index.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
.baseParagraph {
3333
font-family: $fontFamilyNormal;
34-
color: #828282;
34+
color: #424240;
3535
word-wrap: break-word;
3636
margin: 0;
3737
}

src/ui/layouts/common/Pagination/index.tsx

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import {
1212
import { callActionForPipelineRunsForPagination } from '../../pipelines/PipelineDetail/useService';
1313
import { callActionForStackRunsForPagination } from '../../stacks/StackDetail/useService';
1414
import { callActionForStackComponentRunsForPagination } from '../../stackComponents/StackDetail/useService';
15-
import { usePagination, DOTS } from '../../../hooks';
15+
import { usePagination, DOTS, useDispatch } from '../../../hooks';
16+
import { organizationActions } from '../../../../redux/actions';
1617
// const PaginationItem = (props: {
1718
// isActive: boolean;
1819
// index: string;
@@ -73,7 +74,7 @@ export const Pagination: React.FC<Props> = forwardRef((props, ref) => {
7374
const {
7475
dispatchStackComponentsData,
7576
} = callActionForStackComponentsForPagination();
76-
77+
const dispatch = useDispatch();
7778
const { dispatchPipelineData } = callActionForPipelinesForPagination();
7879
const { dispatchAllrunsData } = callActionForAllrunsForPagination();
7980
const { dispatchPipelineRunsData } = callActionForPipelineRunsForPagination();
@@ -92,7 +93,7 @@ export const Pagination: React.FC<Props> = forwardRef((props, ref) => {
9293
? locationPath.pathname.split('/')[5]
9394
: locationPath.pathname.split('/')[4];
9495
// const isValidFilter = props.filters?.map((f) => f.value).join('');
95-
96+
// const [fetchingMembers, setFetchingMembers] = useState(true);
9697
useImperativeHandle(ref, () => ({
9798
callOnChange(page: number, size: number, filters: any, activeSorting: any) {
9899
props.setPageIndex(page - 1);
@@ -101,6 +102,9 @@ export const Pagination: React.FC<Props> = forwardRef((props, ref) => {
101102
},
102103
}));
103104

105+
// eslint-disable-next-line react-hooks/exhaustive-deps
106+
// }, [fetchingMembers]);
107+
104108
const paginationRange = usePagination({
105109
currentPage: props.pageIndex + 1,
106110
totalCount: props.totalCount,
@@ -166,6 +170,20 @@ export const Pagination: React.FC<Props> = forwardRef((props, ref) => {
166170
default:
167171
break;
168172
}
173+
174+
if (locationPath.pathname.split('/')[2] === 'organization') {
175+
// debugger;
176+
// setFetchingMembers(true);
177+
dispatch(
178+
organizationActions.getMembers({
179+
page: page,
180+
size: size,
181+
sort_by: activeSorting,
182+
// onSuccess: () => setFetchingMembers(false),
183+
// onFailure: () => setFetchingMembers(false),
184+
}),
185+
);
186+
}
169187
};
170188
// console.log(itemPerPage, 'itemPerPage');
171189
const pageNumbers = [];
@@ -323,16 +341,7 @@ export const Pagination: React.FC<Props> = forwardRef((props, ref) => {
323341
}}
324342
icon={icons.paginationLast}
325343
/>
326-
327344
</FlexBox>
328-
329-
330-
331-
332-
333-
334-
335-
336345
</FlexBox.Column>
337346
);
338347
});

0 commit comments

Comments
 (0)