Skip to content

Commit dc25df3

Browse files
filter is fixed
1 parent dcef3a3 commit dc25df3

File tree

4 files changed

+18
-15
lines changed

4 files changed

+18
-15
lines changed

src/ui/components/Filters/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const getInitialFilterState = () => {
2626
options: [
2727
{
2828
value: 'name',
29-
label: 'Stack Name',
29+
label: 'Name',
3030
type: 'string',
3131
},
3232
{
@@ -116,7 +116,7 @@ export const getInitialFilterStateForPipeline = () => {
116116
options: [
117117
{
118118
value: 'name',
119-
label: 'Pipeline Name',
119+
label: 'Name',
120120
type: 'string',
121121
},
122122
{

src/ui/components/inputs/index.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ export const InputWithLabel = ({
1818
}): JSX.Element => (
1919
<FlexBox.Column fullWidth>
2020
<Box paddingBottom="xs">
21-
<Paragraph size="body" style={{ color: labelColor ? labelColor : 'black'}}>
21+
<Paragraph
22+
size="body"
23+
style={{ color: labelColor ? labelColor : 'black' }}
24+
>
2225
<label htmlFor={name}>{label}</label>
2326
</Paragraph>
2427
</Box>
@@ -121,7 +124,7 @@ export const TextInput = ({
121124
type?: string;
122125
}): JSX.Element => (
123126
<BaseInput
124-
{...props}
127+
{...props}
125128
hasError={hasError}
126129
onChange={(e: any): void => {
127130
onChangeText(e.target.value);

src/ui/layouts/session/Login/Form.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
Box,
44
FormEmailField,
55
FormPasswordField,
6+
FormTextField,
67
PrimaryButton,
78
} from '../../../components';
89
import { translate } from './translate';
@@ -33,7 +34,7 @@ export const Form: React.FC = () => {
3334
return (
3435
<Box marginTop="xxl">
3536
<Box marginBottom="lg">
36-
<FormEmailField
37+
<FormTextField
3738
label={translate('form.username.label')}
3839
labelColor="#ffffff"
3940
placeholder={translate('form.username.placeholder')}

src/utils/tableFilters.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { formatDateToDisplay } from './date';
22

33
export const getFilteredDataForTable = (data: any, filter: any) => {
4-
debugger;
54
filter.forEach((f: any) => {
65
// temporary because api format changed after filter implementation this need to be refactor
76
if (f.column.label === 'Owner' || f.column.label === 'Author') {
@@ -17,7 +16,7 @@ export const getFilteredDataForTable = (data: any, filter: any) => {
1716
if (f.type.value === 'start_with') {
1817
data = data.filter((os: any) => {
1918
if (f.column.value && f.value) {
20-
return os.user.name.toLowerCase().includes(f.value.toLowerCase());
19+
return os.user.name.toLowerCase().startsWith(f.value.toLowerCase());
2120
}
2221
return true;
2322
});
@@ -26,7 +25,7 @@ export const getFilteredDataForTable = (data: any, filter: any) => {
2625
if (f.type.value === 'end_with') {
2726
data = data.filter((os: any) => {
2827
if (f.column.value && f.value) {
29-
return os.user.name.toLowerCase().includes(f.value.toLowerCase());
28+
return os.user.name.toLowerCase().endsWith(f.value.toLowerCase());
3029
}
3130
return true;
3231
});
@@ -35,15 +34,15 @@ export const getFilteredDataForTable = (data: any, filter: any) => {
3534
if (f.type.value === 'equal') {
3635
data = data.filter((os: any) => {
3736
if (f.column.value && f.value) {
38-
return os.user.name.toLowerCase().includes(f.value.toLowerCase());
37+
return os.user.name.toLowerCase() === f.value.toLowerCase();
3938
}
4039
return true;
4140
});
4241
}
4342
if (f.type.value === 'not_equal') {
4443
data = data.filter((os: any) => {
4544
if (f.column.value && f.value) {
46-
return os.user.name.toLowerCase().includes(!f.value.toLowerCase());
45+
return os.user.name.toLowerCase() !== f.value.toLowerCase();
4746
}
4847
return true;
4948
});
@@ -52,7 +51,7 @@ export const getFilteredDataForTable = (data: any, filter: any) => {
5251

5352
if (
5453
(f.column.type === 'string' && f.column.label !== 'Owner') ||
55-
f.column.label === 'Author'
54+
f.column.label !== 'Author'
5655
) {
5756
if (f.type.value === 'contains') {
5857
data = data.filter((os: any) => {
@@ -66,7 +65,7 @@ export const getFilteredDataForTable = (data: any, filter: any) => {
6665
if (f.type.value === 'start_with') {
6766
data = data.filter((os: any) => {
6867
if (f.column.value && f.value) {
69-
return os.user.name.toLowerCase().includes(f.value.toLowerCase());
68+
return os.user.name.toLowerCase().startsWith(f.value.toLowerCase());
7069
}
7170
return true;
7271
});
@@ -75,7 +74,7 @@ export const getFilteredDataForTable = (data: any, filter: any) => {
7574
if (f.type.value === 'end_with') {
7675
data = data.filter((os: any) => {
7776
if (f.column.value && f.value) {
78-
return os.user.name.toLowerCase().includes(f.value.toLowerCase());
77+
return os.user.name.toLowerCase().endsWith(f.value.toLowerCase());
7978
}
8079
return true;
8180
});
@@ -84,15 +83,15 @@ export const getFilteredDataForTable = (data: any, filter: any) => {
8483
if (f.type.value === 'equal') {
8584
data = data.filter((os: any) => {
8685
if (f.column.value && f.value) {
87-
return os.user.name.toLowerCase().includes(f.value.toLowerCase());
86+
return os.user.name.toLowerCase() === f.value.toLowerCase();
8887
}
8988
return true;
9089
});
9190
}
9291
if (f.type.value === 'not_equal') {
9392
data = data.filter((os: any) => {
9493
if (f.column.value && f.value) {
95-
return os.user.name.toLowerCase().includes(!f.value.toLowerCase());
94+
return os.user.name.toLowerCase() !== f.value.toLowerCase();
9695
}
9796
return true;
9897
});

0 commit comments

Comments
 (0)