@bigbinary/neeto-filters-frontend 4.3.20 → 4.3.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +152 -93
- package/app/javascript/src/translations/en.json +17 -17
- package/dist/Bar.js +13 -9
- package/dist/Bar.js.map +1 -1
- package/dist/Segments.js +21 -31
- package/dist/Segments.js.map +1 -1
- package/dist/cjs/Bar.js +13 -9
- package/dist/cjs/Bar.js.map +1 -1
- package/dist/cjs/Segments.js +21 -31
- package/dist/cjs/Segments.js.map +1 -1
- package/dist/cjs/index.js +1 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/{index-DSviaOq-.js → index-CZTELJO_.js} +9 -9
- package/dist/index-CZTELJO_.js.map +1 -0
- package/dist/{index-WhbKwq6j.js → index-sWA5jMeL.js} +9 -9
- package/dist/index-sWA5jMeL.js.map +1 -0
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
- package/types.d.ts +1 -0
- package/dist/index-DSviaOq-.js.map +0 -1
- package/dist/index-WhbKwq6j.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,88 +1,116 @@
|
|
|
1
1
|
# neeto-filters-nano
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
The `neeto-filters-nano` manages filters across neeto products. The nano exports
|
|
4
|
+
the `@bigbinary/neeto-filters-frontend` NPM package and `neeto-filters-engine`
|
|
5
|
+
Rails engine for development.
|
|
3
6
|
|
|
4
7
|
# Contents
|
|
8
|
+
|
|
5
9
|
1. [Development with Host Application](#development-with-host-application)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
- [Engine](#engine)
|
|
11
|
+
- [Installation](#installation)
|
|
12
|
+
- [Usage](#usage)
|
|
13
|
+
- [Frontend package](#frontend-package)
|
|
14
|
+
- [Installation](#installation-1)
|
|
15
|
+
- [Components](#components)
|
|
12
16
|
2. [Instructions for Publishing](#instructions-for-publishing)
|
|
13
17
|
3. [Releasing beta versions](#releasing-beta-versions)
|
|
14
18
|
|
|
15
19
|
# Development with Host Application
|
|
20
|
+
|
|
16
21
|
## Engine
|
|
22
|
+
|
|
17
23
|
The engine is used to manage filters across neeto products.
|
|
18
24
|
|
|
19
25
|
### Installation
|
|
26
|
+
|
|
20
27
|
1. Add this line to your application's Gemfile:
|
|
21
|
-
```ruby
|
|
22
|
-
source "NEETO_GEM_SERVER_URL" do
|
|
23
|
-
# ..existing gems
|
|
24
28
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
```ruby
|
|
30
|
+
source "NEETO_GEM_SERVER_URL" do
|
|
31
|
+
# ..existing gems
|
|
32
|
+
|
|
33
|
+
gem 'neeto-filters-engine'
|
|
34
|
+
end
|
|
35
|
+
```
|
|
36
|
+
|
|
28
37
|
2. And then execute:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
```zsh
|
|
39
|
+
bundle install
|
|
40
|
+
```
|
|
32
41
|
3. Add this line to your application's `config/routes.rb` file:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
4. Execute the following command to generate the migration to generate the
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
```ruby
|
|
43
|
+
mount NeetoFiltersEngine::Engine, at: "/neeto_filters"
|
|
44
|
+
```
|
|
45
|
+
4. Execute the following command to generate the migration to generate the
|
|
46
|
+
`neeto_filters_engine_segments` table.
|
|
47
|
+
|
|
48
|
+
```zsh
|
|
49
|
+
bundle exec rails neeto_filters_engine:install:migrations
|
|
50
|
+
|
|
51
|
+
bundle exec rails db:migrate
|
|
52
|
+
```
|
|
53
|
+
|
|
42
54
|
5. Add the following line to `models/organization.rb` file.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
55
|
+
```ruby
|
|
56
|
+
has_many :segments, class_name: "NeetoFiltersEngine::Segment", dependent: :destroy
|
|
57
|
+
```
|
|
46
58
|
|
|
47
59
|
### Usage
|
|
60
|
+
|
|
48
61
|
You can learn more about setup and usage here:
|
|
49
|
-
|
|
50
|
-
|
|
62
|
+
|
|
63
|
+
1. [Models](/docs/engine/models.md)
|
|
64
|
+
2. [Verify Installation](/docs/engine/verify_installation.md)
|
|
51
65
|
|
|
52
66
|
## Frontend package
|
|
67
|
+
|
|
53
68
|
### Installation
|
|
69
|
+
|
|
54
70
|
1. Install the latest `neeto-filters-frontend` package using the below command:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
2. `neeto-filters-frontend` has a few peer dependencies that are required for
|
|
71
|
+
```zsh
|
|
72
|
+
yarn add @bigbinary/neeto-filters-frontend
|
|
73
|
+
```
|
|
74
|
+
2. `neeto-filters-frontend` has a few peer dependencies that are required for
|
|
75
|
+
the proper functioning of the package. Install all the peer dependencies
|
|
76
|
+
using the below command:
|
|
59
77
|
```zsh
|
|
60
78
|
yarn add @bigbinary/neetoui @bigbinary/neeto-icons axios@0.27.2 classnames@2.3.1 dayjs@1.11.1 formik@2.2.0 ramda@0.28.0 react-router-dom@5.3.0 react-router-nav-prompt@0.4.1 react-toastify@9.0.1 yup@0.32.11
|
|
61
79
|
```
|
|
62
80
|
|
|
63
81
|
### Components
|
|
82
|
+
|
|
64
83
|
#### 1. `Filters` ([source code](https://github.com/bigbinary/neeto-filters-nano/blob/472fc52c3358a822bdb7d1a9d6fe7eed6335247a/app/javascript/src/components/Filters.jsx))
|
|
65
84
|
|
|
66
85
|
**Props**
|
|
86
|
+
|
|
67
87
|
- `isOpen`: To specify whether the Pane component is open or not.
|
|
68
88
|
- `setIsOpen`: To trigger the isOpen state.
|
|
69
|
-
- `columns`: The list of columns/fields that needs to be represented in the
|
|
70
|
-
|
|
89
|
+
- `columns`: The list of columns/fields that needs to be represented in the
|
|
90
|
+
filters pane.
|
|
91
|
+
- `onChange`: To specify the callback function that is triggered whenever a
|
|
92
|
+
filter is applied or cleared. This function will get the updated filters as
|
|
93
|
+
argument.
|
|
71
94
|
- `onSelectorsChange`: To specify the callback function that is triggered
|
|
72
|
-
|
|
73
|
-
|
|
95
|
+
whenever a selector value is changed. This function will get the updated
|
|
96
|
+
selectors as argument.
|
|
74
97
|
- `buttonProps`: To specify the props to be passed to the button component.
|
|
75
98
|
- `paneProps`: To specify the props to be passed to the pane component.
|
|
76
|
-
- `isSearchable`: To specify whether you need a search bar in filters pane to
|
|
99
|
+
- `isSearchable`: To specify whether you need a search bar in filters pane to
|
|
100
|
+
search through filter fields.
|
|
77
101
|
- `className`: To specify classes to the Filters component.
|
|
78
102
|
- `keyword`: To specify the props related to searching.
|
|
79
|
-
- `childrenKeys`: The list of keys which has to be cleared from url during clear
|
|
103
|
+
- `childrenKeys`: The list of keys which has to be cleared from url during clear
|
|
104
|
+
filters operation.
|
|
80
105
|
- `children`: To specify the custom components specific to the host application.
|
|
81
106
|
|
|
82
107
|
**Configuration**
|
|
83
|
-
|
|
108
|
+
|
|
109
|
+
- Refer to the [Filters](/docs/frontend/filters.md) section for detailed
|
|
110
|
+
information on the available configurations for the `Filters` component.
|
|
84
111
|
|
|
85
112
|
**Usage**
|
|
113
|
+
|
|
86
114
|
```jsx
|
|
87
115
|
import React, { useMemo, useState } from "react";
|
|
88
116
|
|
|
@@ -96,18 +124,18 @@ const App = () => {
|
|
|
96
124
|
const { t } = useTranslation();
|
|
97
125
|
|
|
98
126
|
return (
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
127
|
+
<Container>
|
|
128
|
+
<SubHeader
|
|
129
|
+
rightActionBlock={
|
|
130
|
+
<Filters
|
|
131
|
+
{...{ isOpen, setIsOpen }}
|
|
132
|
+
isSearchable
|
|
133
|
+
columns={FILTER_COLUMNS}
|
|
134
|
+
keyword={SEARCH_TERM_PROPS}
|
|
135
|
+
/>
|
|
136
|
+
}
|
|
137
|
+
/>
|
|
138
|
+
</Container>
|
|
111
139
|
);
|
|
112
140
|
};
|
|
113
141
|
|
|
@@ -117,24 +145,41 @@ export default App;
|
|
|
117
145
|
#### 2. `Bar` ([source code](https://github.com/bigbinary/neeto-filters-nano/blob/472fc52c3358a822bdb7d1a9d6fe7eed6335247a/app/javascript/src/components/Bar/index.jsx))
|
|
118
146
|
|
|
119
147
|
**Props**
|
|
120
|
-
|
|
121
|
-
- `
|
|
148
|
+
|
|
149
|
+
- `columns`: The list of columns/fields that needs to be represented in the
|
|
150
|
+
filters pane.
|
|
151
|
+
- `onChange`: To specify the callback function that is triggered whenever a
|
|
152
|
+
filter is applied or cleared. This function will get the updated filters as
|
|
153
|
+
argument.
|
|
122
154
|
- `setIsPaneOpen`: To trigger the isOpen state.
|
|
123
155
|
- `className`: To specify classes to the Bar component.
|
|
124
156
|
- `keyword`: To specify the props related to searching.
|
|
125
|
-
- `onSelectorsChange`: To specify the callback function that is triggered
|
|
126
|
-
|
|
157
|
+
- `onSelectorsChange`: To specify the callback function that is triggered
|
|
158
|
+
whenever a selector value is changed. This function will get the updated
|
|
159
|
+
selectors as argument.
|
|
160
|
+
- `childrenKeys`: The list of keys which has to be cleared from url during clear
|
|
161
|
+
filters operation.
|
|
127
162
|
- `entity`: The entity associated with the filters.
|
|
128
|
-
- `defaultSegmentName`: The name of segment which results all entities without
|
|
129
|
-
|
|
130
|
-
- `
|
|
131
|
-
|
|
163
|
+
- `defaultSegmentName`: The name of segment which results all entities without
|
|
164
|
+
applying any filter. Default name is "All results".
|
|
165
|
+
- `customFilters`: To specify the custom components specific to the host
|
|
166
|
+
application. This should be same as `children` passed to the `Filters`
|
|
167
|
+
component.
|
|
168
|
+
- `showSegmentName`: To specify whether to show the segment name in the Bar
|
|
169
|
+
component.
|
|
170
|
+
- `segmentsBaseUrl`: The base url to which the segments will be appended after
|
|
171
|
+
creating the segment. by default the current path will be used.
|
|
172
|
+
- `segmentHelpPopoverProps`: Props to customize the help popover displayed next
|
|
173
|
+
to the segment form title in the Add new segment form in the form's
|
|
174
|
+
submission. This prop should have title, description and the help link with a
|
|
175
|
+
label.
|
|
132
176
|
|
|
133
177
|
All these props must be same as that passed to the `Filters` component. The
|
|
134
178
|
option to save filters as segments will be enabled only when the entity prop is
|
|
135
179
|
passed to the component.
|
|
136
180
|
|
|
137
181
|
**Usage**
|
|
182
|
+
|
|
138
183
|
```jsx
|
|
139
184
|
import React, { useMemo, useState } from "react";
|
|
140
185
|
|
|
@@ -186,22 +231,28 @@ const App = () => {
|
|
|
186
231
|
export default App;
|
|
187
232
|
```
|
|
188
233
|
|
|
189
|
-
|
|
190
234
|
#### 3. `Segments` ([source code](https://github.com/bigbinary/neeto-filters-nano/blob/472fc52c3358a822bdb7d1a9d6fe7eed6335247a/app/javascript/src/components/Segments/index.jsx))
|
|
191
235
|
|
|
192
236
|
**Props**
|
|
193
237
|
|
|
194
|
-
- `columns`: The list of columns/fields that needs to be represented in the
|
|
238
|
+
- `columns`: The list of columns/fields that needs to be represented in the
|
|
239
|
+
filters pane.
|
|
195
240
|
- `entity`: The entity associated with the segments.
|
|
196
241
|
- `setIsPaneOpen`: To trigger the isOpen state of the filters pane.
|
|
197
|
-
- `defaultSegmentName`: The name of segment which results all entities without
|
|
198
|
-
|
|
199
|
-
- `
|
|
200
|
-
|
|
242
|
+
- `defaultSegmentName`: The name of segment which results all entities without
|
|
243
|
+
applying any filter. Default name is "All results".
|
|
244
|
+
- `customFilters`: To specify the custom components specific to the host
|
|
245
|
+
application. This should be same as `children` passed to the `Filters`
|
|
246
|
+
component.
|
|
247
|
+
- `childrenKeys`: The list of keys which has to be cleared from url during clear
|
|
248
|
+
filters operation.
|
|
249
|
+
- `baseUrl`: The base url to which the segments will be appended. by default the
|
|
250
|
+
current path will be used.
|
|
201
251
|
|
|
202
252
|
The "columns" prop must be same as that passed to the `Filters` component.
|
|
203
253
|
|
|
204
254
|
**Usage**
|
|
255
|
+
|
|
205
256
|
```jsx
|
|
206
257
|
import React, { useMemo, useState } from "react";
|
|
207
258
|
|
|
@@ -228,14 +279,13 @@ const App = () => {
|
|
|
228
279
|
);
|
|
229
280
|
|
|
230
281
|
return (
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
282
|
+
<MenuBar showMenu={showMenuBar}>
|
|
283
|
+
<Segments
|
|
284
|
+
columns={filterColumns}
|
|
285
|
+
entity="User"
|
|
286
|
+
setIsFilterPaneOpen={setIsOpen}
|
|
287
|
+
/>
|
|
288
|
+
</MenuBar>
|
|
239
289
|
);
|
|
240
290
|
};
|
|
241
291
|
|
|
@@ -243,6 +293,7 @@ export default App;
|
|
|
243
293
|
```
|
|
244
294
|
|
|
245
295
|
### Funtions
|
|
296
|
+
|
|
246
297
|
#### 1. `buildFiltersFromURL` ([source code](https://github.com/bigbinary/neeto-filters-nano/blob/472fc52c3358a822bdb7d1a9d6fe7eed6335247a/app/javascript/src/components/utils.js#L403-#L406))
|
|
247
298
|
|
|
248
299
|
- This function takes a list as argument.
|
|
@@ -250,7 +301,8 @@ export default App;
|
|
|
250
301
|
to `keyword` prop of `Filters` and `Bar`.
|
|
251
302
|
- It builds the filter payload from the URL search params. This function should
|
|
252
303
|
be called for initializing the `filters` state.
|
|
253
|
-
- Usage in
|
|
304
|
+
- Usage in
|
|
305
|
+
[neetoTrail](https://github.com/bigbinary/neeto-trail-web/blob/91b58802bbb5f9520d2d2f9a621b6a31358d49aa/app/javascript/src/hooks/common/useFilter.js#L22).
|
|
254
306
|
|
|
255
307
|
```js
|
|
256
308
|
const [filters, setFilters] = useState(() =>
|
|
@@ -274,7 +326,8 @@ const [filters, setFilters] = useState(() =>
|
|
|
274
326
|
should be called for initializing the `selectors` state.
|
|
275
327
|
- `selectors` will be an object with keys same as provided in filter fields and
|
|
276
328
|
selected value as its value.
|
|
277
|
-
- Usage in
|
|
329
|
+
- Usage in
|
|
330
|
+
[neetoMonitor](https://github.com/bigbinary/neeto-monitor-web/blob/f892ccdb9c72db8ae4b9bba5fee135c45968a750/app/javascript/src/hooks/common/useFilter.js#L27-L29).
|
|
278
331
|
|
|
279
332
|
```js
|
|
280
333
|
const [selectors, setSelectors] = useState(() =>
|
|
@@ -297,7 +350,8 @@ and selected field names.
|
|
|
297
350
|
to show the rule selector for each filter or not. It is `false` by default.
|
|
298
351
|
- `groupName` (string, optional): A name to be given to the group of filters
|
|
299
352
|
built from fields.
|
|
300
|
-
- Usage in
|
|
353
|
+
- Usage in
|
|
354
|
+
[neetoTestify](https://github.com/bigbinary/neeto-testify-web/blob/1de65b93c9455a88511c5c261b474bd23d9af8e2/app/javascript/src/utils/index.js#L131).
|
|
301
355
|
|
|
302
356
|
```js
|
|
303
357
|
const fields = [
|
|
@@ -317,26 +371,27 @@ const fields = [
|
|
|
317
371
|
const selectedFields = ["name", "age"];
|
|
318
372
|
|
|
319
373
|
const filterColumns = buildFilterColumnsFromFields({ fields, selectedFields });
|
|
320
|
-
|
|
321
374
|
```
|
|
322
375
|
|
|
323
376
|
#### 4. `useFetchSegments`([source code](https://github.com/bigbinary/neeto-filters-nano/blob/b6421775adb20ba859609e71610fad944492147e/app/javascript/src/hooks/reactQuery/useSegmentsApi.js#L10-L18))
|
|
324
377
|
|
|
325
|
-
The `useFetchSegments` hook is used to fetch the array of segments based on the
|
|
378
|
+
The `useFetchSegments` hook is used to fetch the array of segments based on the
|
|
379
|
+
provided `entity`.
|
|
326
380
|
|
|
327
381
|
#### Parameters
|
|
328
382
|
|
|
329
383
|
- `entity`: The entity associated with the segments to be fetched.
|
|
330
|
-
- `searchTerm`: The search term for fetching the segments filtered by names
|
|
384
|
+
- `searchTerm`: The search term for fetching the segments filtered by names
|
|
385
|
+
containing the search term.
|
|
331
386
|
|
|
332
387
|
```js
|
|
333
|
-
|
|
388
|
+
const { data: segments = [], isLoading } = useFetchSegments({ entity: "User" });
|
|
334
389
|
```
|
|
335
390
|
|
|
336
391
|
## Basic Usage
|
|
337
392
|
|
|
338
|
-
Here is an example of how to use the `neeto-filters-engine` gem assuming that
|
|
339
|
-
`users` table has been created.
|
|
393
|
+
Here is an example of how to use the `neeto-filters-engine` gem assuming that
|
|
394
|
+
the `users` table has been created.
|
|
340
395
|
|
|
341
396
|
```rb
|
|
342
397
|
class HomeController < ApplicationController
|
|
@@ -355,7 +410,9 @@ class HomeController < ApplicationController
|
|
|
355
410
|
end
|
|
356
411
|
```
|
|
357
412
|
|
|
358
|
-
Note: If you wish to use `select()` method after calling
|
|
413
|
+
Note: If you wish to use `select()` method after calling
|
|
414
|
+
`apply_neeto_filters()`, please note to use `reselect()` since neeto-filters
|
|
415
|
+
itself performs a 'select' operation internally.
|
|
359
416
|
|
|
360
417
|
Here, the param `filters` is a hash with the following structure, where each
|
|
361
418
|
`node` corresponds to a column in the `users` table.
|
|
@@ -416,14 +473,14 @@ this case, all the users whose email address contains `bigbinary` in the
|
|
|
416
473
|
### Custom Types
|
|
417
474
|
|
|
418
475
|
- Some projects will have custom attributes to the tables that will be added or
|
|
419
|
-
updated dynamically. `NeetoFiltersEngine` can handle these attributes by
|
|
420
|
-
proper filters to the `apply_neeto_filters` method.
|
|
476
|
+
updated dynamically. `NeetoFiltersEngine` can handle these attributes by
|
|
477
|
+
passing the proper filters to the `apply_neeto_filters` method.
|
|
421
478
|
- The implementation of custom attributes is different for different projects.
|
|
422
479
|
`NeetoFiltersEngine` is built in the same way as `neetoCRM`. If the custom
|
|
423
480
|
attributes feature needs to be added to a project where the custom attributes
|
|
424
481
|
implementation is different, you need to override the
|
|
425
|
-
`NeetoFiltersEngine::Custom::BaseSearchService` class specifiying the proper
|
|
426
|
-
operations.
|
|
482
|
+
`NeetoFiltersEngine::Custom::BaseSearchService` class specifiying the proper
|
|
483
|
+
join operations.
|
|
427
484
|
- Refer to the below video for an overview of the same.
|
|
428
485
|
|
|
429
486
|
https://vimeo.com/724489868/94dfc6cd43
|
|
@@ -434,8 +491,8 @@ this case, all the users whose email address contains `bigbinary` in the
|
|
|
434
491
|
table on which the `apply_neeto_filters` method is applied. Instead these will
|
|
435
492
|
be present in another table to which the first table has a foreign key to. For
|
|
436
493
|
instance, the `deals` table can have an association with the `companies` table
|
|
437
|
-
and the company name can be displayed in the UI. `NeetoFiltersEngine` can be
|
|
438
|
-
filter these columns by properly specifying the filters.
|
|
494
|
+
and the company name can be displayed in the UI. `NeetoFiltersEngine` can be
|
|
495
|
+
used to filter these columns by properly specifying the filters.
|
|
439
496
|
- Refer to te below video for an overview of the same.
|
|
440
497
|
|
|
441
498
|
https://vimeo.com/724484259/f305257f37
|
|
@@ -462,9 +519,11 @@ this case, all the users whose email address contains `bigbinary` in the
|
|
|
462
519
|
|
|
463
520
|
https://vimeo.com/724495909/034668f738
|
|
464
521
|
|
|
465
|
-
|
|
466
522
|
# Instructions for Publishing
|
|
467
|
-
|
|
523
|
+
|
|
524
|
+
Consult the
|
|
525
|
+
[building and releasing packages](https://neeto-engineering.neetokb.com/articles/building-and-releasing-packages)
|
|
526
|
+
guide for details on how to publish.
|
|
468
527
|
|
|
469
528
|
# Releasing beta versions
|
|
470
529
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"no": "No",
|
|
12
12
|
"proceed": "Proceed",
|
|
13
13
|
"rename": "Rename",
|
|
14
|
-
"
|
|
14
|
+
"views": "Views",
|
|
15
15
|
"userCount": "{{count}} Users",
|
|
16
16
|
"yes": "Yes",
|
|
17
17
|
"update": "Update",
|
|
@@ -50,28 +50,28 @@
|
|
|
50
50
|
"openFilterPane": "Open filter pane",
|
|
51
51
|
"closePane": "Close pane"
|
|
52
52
|
},
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"deleteAlertMessage": "You are permanently deleting the
|
|
58
|
-
"deleteAlertTitle": "Delete
|
|
59
|
-
"
|
|
60
|
-
"name": "
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
53
|
+
"views": {
|
|
54
|
+
"addNewView": "Add new view",
|
|
55
|
+
"saveAsNewView": "Save as new view",
|
|
56
|
+
"editView": "Edit view",
|
|
57
|
+
"deleteAlertMessage": "You are permanently deleting the view <strong>{{entity,anyCase}}</strong>. This can't be undone.",
|
|
58
|
+
"deleteAlertTitle": "Delete view?",
|
|
59
|
+
"manageViews": "Manage views",
|
|
60
|
+
"name": "View name",
|
|
61
|
+
"noViewsFound": "No views found",
|
|
62
|
+
"saveView": "Save view",
|
|
63
|
+
"updateView": "Update view",
|
|
64
|
+
"searchViews": "Search views",
|
|
65
|
+
"viewName": "View name",
|
|
66
66
|
"showLess": "See less",
|
|
67
67
|
"showMoreNumbers": "See {{entity}} more",
|
|
68
|
-
"nameIsRequired": "
|
|
68
|
+
"nameIsRequired": "View name is required",
|
|
69
69
|
"reservedNameErrorMessage": "This name is reserved. Please choose another name.",
|
|
70
70
|
"addFilter": "Add filter",
|
|
71
71
|
"newFilter": "New filter",
|
|
72
72
|
"selectFilter": "Select filter",
|
|
73
|
-
"
|
|
74
|
-
"
|
|
73
|
+
"view_one": "view",
|
|
74
|
+
"view_other": "views"
|
|
75
75
|
},
|
|
76
76
|
"labels": {
|
|
77
77
|
"keyword": "Keyword"
|
package/dist/Bar.js
CHANGED
|
@@ -6,7 +6,7 @@ import { t } from 'i18next';
|
|
|
6
6
|
import { findBy, humanize, removeBy, hyphenate, isPresent, isNotEmpty, noop, findById, isNotPresent } from '@bigbinary/neeto-cist';
|
|
7
7
|
import { useQueryParams } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
8
8
|
import { reject, modify, sortBy, prop, project, has, omit, isEmpty, assoc, identity } from 'ramda';
|
|
9
|
-
import { S as SegmentForm } from './index-
|
|
9
|
+
import { S as SegmentForm } from './index-CZTELJO_.js';
|
|
10
10
|
import { c as useCreateSegment, b as useUpdateSegment, Q as QUERY_KEYS } from './useSegmentsApi-wYy0UPCH.js';
|
|
11
11
|
import { dateFormat, dayjs, buildUrl, showThumbsUpToastr } from '@bigbinary/neeto-commons-frontend/utils';
|
|
12
12
|
import Button from '@bigbinary/neetoui/Button';
|
|
@@ -343,7 +343,7 @@ var FilterBar = function FilterBar(_ref) {
|
|
|
343
343
|
className: "flex items-center gap-x-2",
|
|
344
344
|
children: [isPresent(entity) && !hasOnlyKeywordFilter(filters) && /*#__PURE__*/jsx(Button, {
|
|
345
345
|
"data-cy": "save-segment-button",
|
|
346
|
-
label: t("neetoFilters.
|
|
346
|
+
label: t("neetoFilters.views.saveAsNewView"),
|
|
347
347
|
style: "secondary",
|
|
348
348
|
onClick: function onClick() {
|
|
349
349
|
setIsPaneOpen(false);
|
|
@@ -510,7 +510,8 @@ var SegmentBar = function SegmentBar(_ref) {
|
|
|
510
510
|
setIsSavePaneOpen = _ref.setIsSavePaneOpen,
|
|
511
511
|
setIsPaneOpen = _ref.setIsPaneOpen,
|
|
512
512
|
handleApplyFilters = _ref.handleApplyFilters,
|
|
513
|
-
childrenKeys = _ref.childrenKeys
|
|
513
|
+
childrenKeys = _ref.childrenKeys,
|
|
514
|
+
showSegmentName = _ref.showSegmentName;
|
|
514
515
|
var _useTranslation = useTranslation(),
|
|
515
516
|
t = _useTranslation.t;
|
|
516
517
|
var history = useHistory();
|
|
@@ -539,7 +540,7 @@ var SegmentBar = function SegmentBar(_ref) {
|
|
|
539
540
|
};
|
|
540
541
|
var changedFilters = deepCompare(segment.filters[0].conditions, filters);
|
|
541
542
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
542
|
-
children: [/*#__PURE__*/jsx(Typography, {
|
|
543
|
+
children: [showSegmentName && /*#__PURE__*/jsx(Typography, {
|
|
543
544
|
className: "neeto-ui-text-gray-600 mr-4 px-2",
|
|
544
545
|
"data-cy": "neeto-filters-segment-name",
|
|
545
546
|
style: "h4",
|
|
@@ -550,7 +551,7 @@ var SegmentBar = function SegmentBar(_ref) {
|
|
|
550
551
|
className: "mr-2"
|
|
551
552
|
},
|
|
552
553
|
buttonStyle: "secondary",
|
|
553
|
-
label: t("neetoFilters.
|
|
554
|
+
label: t("neetoFilters.views.updateView"),
|
|
554
555
|
children: /*#__PURE__*/jsxs(Menu, {
|
|
555
556
|
children: [/*#__PURE__*/jsx(MenuItem.Button, {
|
|
556
557
|
onClick: function onClick() {
|
|
@@ -558,7 +559,7 @@ var SegmentBar = function SegmentBar(_ref) {
|
|
|
558
559
|
action: SEGMENT_ACTIONS.EDIT
|
|
559
560
|
});
|
|
560
561
|
},
|
|
561
|
-
children: t("neetoFilters.
|
|
562
|
+
children: t("neetoFilters.views.updateView")
|
|
562
563
|
}), /*#__PURE__*/jsx(MenuItem.Button, {
|
|
563
564
|
onClick: function onClick() {
|
|
564
565
|
setIsPaneOpen(false);
|
|
@@ -566,7 +567,7 @@ var SegmentBar = function SegmentBar(_ref) {
|
|
|
566
567
|
action: SEGMENT_ACTIONS.CREATE
|
|
567
568
|
});
|
|
568
569
|
},
|
|
569
|
-
children: t("neetoFilters.
|
|
570
|
+
children: t("neetoFilters.views.saveAsNewView")
|
|
570
571
|
})]
|
|
571
572
|
})
|
|
572
573
|
}), changedFilters.map(function (filter) {
|
|
@@ -605,7 +606,9 @@ var Bar = function Bar(_ref) {
|
|
|
605
606
|
defaultSegmentName = _ref$defaultSegmentNa === void 0 ? t("neetoFilters.common.allResults") : _ref$defaultSegmentNa,
|
|
606
607
|
_ref$segmentsBaseUrl = _ref.segmentsBaseUrl,
|
|
607
608
|
segmentsBaseUrl = _ref$segmentsBaseUrl === void 0 ? window.location.pathname : _ref$segmentsBaseUrl,
|
|
608
|
-
customFilters = _ref.customFilters
|
|
609
|
+
customFilters = _ref.customFilters,
|
|
610
|
+
_ref$showSegmentName = _ref.showSegmentName,
|
|
611
|
+
showSegmentName = _ref$showSegmentName === void 0 ? true : _ref$showSegmentName;
|
|
609
612
|
var queryClient = useQueryClient();
|
|
610
613
|
var _useQueryParams = useQueryParams(),
|
|
611
614
|
segmentId = _useQueryParams.segmentId;
|
|
@@ -643,7 +646,8 @@ var Bar = function Bar(_ref) {
|
|
|
643
646
|
keywordFilter: keywordFilter,
|
|
644
647
|
nonHiddenFilters: nonHiddenFilters,
|
|
645
648
|
setIsPaneOpen: setIsPaneOpen,
|
|
646
|
-
setIsSavePaneOpen: setIsSavePaneOpen
|
|
649
|
+
setIsSavePaneOpen: setIsSavePaneOpen,
|
|
650
|
+
showSegmentName: showSegmentName
|
|
647
651
|
})
|
|
648
652
|
}), /*#__PURE__*/jsx(SegmentForm, {
|
|
649
653
|
childrenKeys: childrenKeys,
|