@outliant/sunrise-utils 1.1.18 → 1.1.20

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/CHANGELOG.md CHANGED
@@ -4,9 +4,23 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### [1.1.20](https://github.com/outliant/sunrise-utils/compare/1.1.19...1.1.20)
8
+
9
+ - chore: add default project and tasks sticky filter setting #866a4ga0a [`#26`](https://github.com/outliant/sunrise-utils/pull/26)
10
+
11
+ #### [1.1.19](https://github.com/outliant/sunrise-utils/compare/1.1.18...1.1.19)
12
+
13
+ > 17 January 2024
14
+
15
+ - chore: update is_paused filter #863hbxjkt [`#25`](https://github.com/outliant/sunrise-utils/pull/25)
16
+ - chore(release): 1.1.19 [`af592bd`](https://github.com/outliant/sunrise-utils/commit/af592bd6b762171e9b43a9adc800ba86ce970556)
17
+
7
18
  #### [1.1.18](https://github.com/outliant/sunrise-utils/compare/1.1.17...1.1.18)
8
19
 
20
+ > 16 January 2024
21
+
9
22
  - chore: update is_paused query filters #863hbxjkt [`#24`](https://github.com/outliant/sunrise-utils/pull/24)
23
+ - chore(release): 1.1.18 [`8e3f921`](https://github.com/outliant/sunrise-utils/commit/8e3f92138c9e82a04b2ab81f39332b5cf1aca4c9)
10
24
 
11
25
  #### [1.1.17](https://github.com/outliant/sunrise-utils/compare/1.1.16...1.1.17)
12
26
 
@@ -101,6 +101,26 @@ module.exports.defaultCustomColumns = [
101
101
  }
102
102
  ];
103
103
 
104
+ module.exports.defaultFilterSetting = {
105
+ search: '',
106
+ filters: [],
107
+ queries: {},
108
+ columns: [
109
+ 'project_id',
110
+ 'created_at',
111
+ 'criticalPathStage',
112
+ 'region',
113
+ 'lastPulseComment'
114
+ ],
115
+ sorts: [
116
+ {
117
+ field: 'created_at',
118
+ direction: 'desc',
119
+ text: 'Create At'
120
+ }
121
+ ]
122
+ };
123
+
104
124
  module.exports.buildProjectPipelineFilter = (filter) => {
105
125
  switch (filter.type) {
106
126
  case 'tags':
@@ -246,6 +246,36 @@ module.exports.defaultTaskFilter = {
246
246
  }
247
247
  };
248
248
 
249
+ module.exports.defaultFilterSetting = {
250
+ search: '',
251
+ queries: {},
252
+ filters: [
253
+ {
254
+ condition: 'is_equal',
255
+ field_type: 'select',
256
+ field_id: '',
257
+ type: 'status',
258
+ value: 'pending'
259
+ }
260
+ ],
261
+ columns: [
262
+ 'project_id',
263
+ '981bf602-f636-49c6-8da2-d980064c88d7',
264
+ 'owner',
265
+ 'ready_at',
266
+ 'region',
267
+ 'last_comment',
268
+ 'last_comment_date'
269
+ ],
270
+ sorts: [
271
+ {
272
+ field: 'ready_at',
273
+ direction: 'asc',
274
+ text: 'Age'
275
+ }
276
+ ]
277
+ };
278
+
249
279
  module.exports.buildTaskPipelineFilter = (filter) => {
250
280
  switch (filter.type) {
251
281
  case 'status':
package/index.d.ts CHANGED
@@ -28,6 +28,25 @@ declare namespace Utils {
28
28
  sortBy?: string;
29
29
  }
30
30
 
31
+ export interface FilterSetting {
32
+ search: string | null;
33
+ queries: Record<string, never>;
34
+ filters: {
35
+ field_id: string | null;
36
+ condition: string;
37
+ second_value: string | null;
38
+ type: string;
39
+ field_type: string;
40
+ value: string;
41
+ }[];
42
+ sorts?: {
43
+ field: string;
44
+ direction: 'asc' | 'desc';
45
+ text: string;
46
+ }[],
47
+ columns?: string[];
48
+ }
49
+
31
50
  namespace log {
32
51
  export function info(msg: any): void;
33
52
  export function warn(msg: any): void;
@@ -43,6 +62,7 @@ declare namespace Utils {
43
62
  export const taskStatusOptions: FilterConditionOption[];
44
63
  export const taskAgeColorOptions: FilterConditionOption[];
45
64
  export const defaultCustomColumns: Column[];
65
+ export const defaultFilterSetting: FilterSetting;
46
66
  export function buildFilter(filter: Filter): any;
47
67
  export function buildFiltersQuery(
48
68
  orgId: string,
@@ -59,6 +79,7 @@ declare namespace Utils {
59
79
 
60
80
  namespace projectPipeline {
61
81
  export const defaultCustomColumns: Column[];
82
+ export const defaultFilterSetting: FilterSetting;
62
83
  export function buildFilter(filter: Filter): any;
63
84
  export function buildFiltersQuery(
64
85
  orgId: string,
@@ -1,7 +1,8 @@
1
1
  const { validate: isUuid } = require('uuid');
2
2
  const {
3
3
  defaultCustomColumns,
4
- buildProjectPipelineFilter
4
+ buildProjectPipelineFilter,
5
+ defaultFilterSetting
5
6
  } = require('../helpers/projectFilter');
6
7
  const searchFilter = require('../helpers/searchFilter');
7
8
  const sortScript = require('../helpers/sortScript');
@@ -9,6 +10,7 @@ const sortScript = require('../helpers/sortScript');
9
10
  class ProjectPipeline {
10
11
  defaultCustomColumns = defaultCustomColumns;
11
12
  buildFilter = buildProjectPipelineFilter;
13
+ defaultFilterSetting = defaultFilterSetting;
12
14
  buildFiltersQuery(
13
15
  orgId,
14
16
  departmentId,
package/lib/queries.js CHANGED
@@ -27,19 +27,8 @@ module.exports.getNotIsPausedQuery = () => {
27
27
  bool: {
28
28
  should: [
29
29
  {
30
- bool: {
31
- must: [
32
- {
33
- exists: {
34
- field: 'is_paused'
35
- }
36
- },
37
- {
38
- match: {
39
- is_paused: false
40
- }
41
- }
42
- ]
30
+ match: {
31
+ is_paused: false
43
32
  }
44
33
  },
45
34
  {
@@ -6,7 +6,8 @@ const {
6
6
  taskAgeColorOptions,
7
7
  defaultCustomColumns,
8
8
  defaultTaskFilter,
9
- buildTaskPipelineFilter
9
+ buildTaskPipelineFilter,
10
+ defaultFilterSetting
10
11
  } = require('../helpers/taskFilter');
11
12
  const searchFilter = require('../helpers/searchFilter');
12
13
  const sortScript = require('../helpers/sortScript');
@@ -15,6 +16,7 @@ const taskHelper = require('../helpers/task');
15
16
  class TaskPipeline {
16
17
  taskStatusOptions = taskStatusOptions;
17
18
  defaultCustomColumns = defaultCustomColumns;
19
+ defaultFilterSetting = defaultFilterSetting;
18
20
  taskAgeColorOptions = taskAgeColorOptions;
19
21
  buildFilter = buildTaskPipelineFilter;
20
22
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@outliant/sunrise-utils",
3
3
  "description": "Helper functions for project Sunrise",
4
- "version": "1.1.18",
4
+ "version": "1.1.20",
5
5
  "license": "ISC",
6
6
  "author": "Outliant",
7
7
  "main": "index.js",
@@ -191,4 +191,28 @@ describe('projectPipeline', function () {
191
191
  });
192
192
  });
193
193
  });
194
+
195
+ describe('defaultFilterSetting', () => {
196
+ it('should be equal to default project filter setting', () => {
197
+ expect(projectPipeline.defaultFilterSetting).to.be.deep.equal({
198
+ search: '',
199
+ filters: [],
200
+ queries: {},
201
+ columns: [
202
+ 'project_id',
203
+ 'created_at',
204
+ 'criticalPathStage',
205
+ 'region',
206
+ 'lastPulseComment'
207
+ ],
208
+ sorts: [
209
+ {
210
+ field: 'created_at',
211
+ direction: 'desc',
212
+ text: 'Create At'
213
+ }
214
+ ]
215
+ });
216
+ });
217
+ });
194
218
  });
@@ -33,19 +33,8 @@ describe('queries', function () {
33
33
  bool: {
34
34
  should: [
35
35
  {
36
- bool: {
37
- must: [
38
- {
39
- exists: {
40
- field: 'is_paused'
41
- }
42
- },
43
- {
44
- match: {
45
- is_paused: false
46
- }
47
- }
48
- ]
36
+ match: {
37
+ is_paused: false
49
38
  }
50
39
  },
51
40
  {
@@ -581,4 +581,38 @@ describe('taskPipeline', function () {
581
581
  done();
582
582
  });
583
583
  });
584
+
585
+ describe('defaultFilterSetting', () => {
586
+ it('should be equal to default task filter setting', () => {
587
+ expect(taskPipeline.defaultFilterSetting).to.be.deep.equal({
588
+ search: '',
589
+ queries: {},
590
+ filters: [
591
+ {
592
+ condition: 'is_equal',
593
+ field_type: 'select',
594
+ field_id: '',
595
+ type: 'status',
596
+ value: 'pending'
597
+ }
598
+ ],
599
+ columns: [
600
+ 'project_id',
601
+ '981bf602-f636-49c6-8da2-d980064c88d7',
602
+ 'owner',
603
+ 'ready_at',
604
+ 'region',
605
+ 'last_comment',
606
+ 'last_comment_date'
607
+ ],
608
+ sorts: [
609
+ {
610
+ field: 'ready_at',
611
+ direction: 'asc',
612
+ text: 'Age'
613
+ }
614
+ ]
615
+ });
616
+ });
617
+ });
584
618
  });