@truedat/dd 8.9.1 → 8.10.1
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/package.json +3 -3
- package/src/api.js +2 -0
- package/src/components/GrantRequestBulkActions.js +68 -33
- package/src/components/GrantRequestBulkApprovalPopup.js +25 -14
- package/src/components/GrantRequestRow.js +1 -5
- package/src/components/GrantRequestsDownloadButton.js +81 -0
- package/src/components/GrantRequestsLabelResults.js +17 -11
- package/src/components/GrantRequestsSearchResults.js +72 -62
- package/src/components/GrantRequestsTable.js +61 -57
- package/src/components/__tests__/GrantRequestBulkActions.spec.js +4 -0
- package/src/components/__tests__/GrantRequestRow.spec.js +8 -4
- package/src/components/__tests__/GrantRequestsDownloadButton.spec.js +198 -0
- package/src/components/__tests__/__snapshots__/GrantRequestBulkActions.spec.js.snap +17 -3
- package/src/components/__tests__/__snapshots__/GrantRequestBulkApprovalPopup.spec.js.snap +1 -1
- package/src/components/__tests__/__snapshots__/GrantRequestsDownloadButton.spec.js.snap +16 -0
- package/src/components/__tests__/__snapshots__/GrantRequestsLabelResults.spec.js.snap +6 -1
- package/src/components/__tests__/__snapshots__/GrantRequestsSearchResults.spec.js.snap +128 -100
- package/src/hooks/useGrantRequest.js +20 -1
|
@@ -5,31 +5,54 @@ exports[`<GrantRequestsSearchResults /> matches the latest snapshot 1`] = `
|
|
|
5
5
|
<div
|
|
6
6
|
class="ui segment"
|
|
7
7
|
>
|
|
8
|
-
<
|
|
9
|
-
class="
|
|
8
|
+
<div
|
|
9
|
+
class="grant-requests-header"
|
|
10
10
|
>
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
class="key circular icon"
|
|
14
|
-
/>
|
|
15
|
-
<div
|
|
16
|
-
class="content"
|
|
11
|
+
<h2
|
|
12
|
+
class="ui header"
|
|
17
13
|
>
|
|
18
|
-
|
|
14
|
+
<i
|
|
15
|
+
aria-hidden="true"
|
|
16
|
+
class="key circular icon"
|
|
17
|
+
/>
|
|
19
18
|
<div
|
|
20
|
-
class="
|
|
19
|
+
class="content"
|
|
21
20
|
>
|
|
22
|
-
grantRequests.
|
|
21
|
+
grantRequests.header.approve
|
|
22
|
+
<div
|
|
23
|
+
class="sub header"
|
|
24
|
+
>
|
|
25
|
+
grantRequests.subheader.approve
|
|
26
|
+
</div>
|
|
23
27
|
</div>
|
|
28
|
+
</h2>
|
|
29
|
+
<div
|
|
30
|
+
class="grant-requests-view-actions grant-requests-view-actions-approve"
|
|
31
|
+
>
|
|
32
|
+
<button
|
|
33
|
+
class="ui active button grant-requests-view-button"
|
|
34
|
+
>
|
|
35
|
+
Approve view
|
|
36
|
+
</button>
|
|
37
|
+
<button
|
|
38
|
+
class="ui button grant-requests-view-button"
|
|
39
|
+
>
|
|
40
|
+
List view
|
|
41
|
+
</button>
|
|
24
42
|
</div>
|
|
25
|
-
</
|
|
43
|
+
</div>
|
|
44
|
+
<div
|
|
45
|
+
class="ui hidden divider"
|
|
46
|
+
/>
|
|
26
47
|
<div
|
|
27
48
|
class="ui bottom attached segment"
|
|
28
49
|
>
|
|
29
50
|
<div
|
|
30
|
-
class="grant-requests-
|
|
51
|
+
class="grant-requests-toolbar"
|
|
31
52
|
>
|
|
32
|
-
<div
|
|
53
|
+
<div
|
|
54
|
+
class="grant-requests-search"
|
|
55
|
+
>
|
|
33
56
|
<div
|
|
34
57
|
class="ui action left icon input"
|
|
35
58
|
>
|
|
@@ -77,115 +100,120 @@ exports[`<GrantRequestsSearchResults /> matches the latest snapshot 1`] = `
|
|
|
77
100
|
class="selectedFilters"
|
|
78
101
|
/>
|
|
79
102
|
</div>
|
|
80
|
-
<div
|
|
103
|
+
<div
|
|
104
|
+
class="grant-requests-approve-actions"
|
|
105
|
+
>
|
|
81
106
|
<div
|
|
82
|
-
|
|
107
|
+
aria-expanded="false"
|
|
108
|
+
class="ui selection dropdown grant-requests-bulk-role-selector "
|
|
109
|
+
role="listbox"
|
|
110
|
+
tabindex="0"
|
|
83
111
|
>
|
|
84
112
|
<div
|
|
85
|
-
|
|
113
|
+
aria-atomic="true"
|
|
114
|
+
aria-live="polite"
|
|
115
|
+
class="divider text"
|
|
116
|
+
role="alert"
|
|
117
|
+
>
|
|
118
|
+
foo
|
|
119
|
+
</div>
|
|
120
|
+
<i
|
|
121
|
+
aria-hidden="true"
|
|
122
|
+
class="dropdown icon"
|
|
123
|
+
/>
|
|
124
|
+
<div
|
|
125
|
+
class="menu transition"
|
|
86
126
|
>
|
|
87
127
|
<div
|
|
88
|
-
|
|
128
|
+
aria-checked="false"
|
|
129
|
+
aria-disabled="true"
|
|
130
|
+
aria-selected="false"
|
|
131
|
+
class="disabled item header"
|
|
132
|
+
role="option"
|
|
133
|
+
style="pointer-events: all;"
|
|
89
134
|
>
|
|
90
|
-
<
|
|
91
|
-
class="
|
|
135
|
+
<span
|
|
136
|
+
class="text"
|
|
92
137
|
>
|
|
93
|
-
|
|
94
|
-
</
|
|
95
|
-
|
|
96
|
-
|
|
138
|
+
Seleccione un rol
|
|
139
|
+
</span>
|
|
140
|
+
</div>
|
|
141
|
+
<div
|
|
142
|
+
aria-checked="false"
|
|
143
|
+
aria-selected="false"
|
|
144
|
+
class="item"
|
|
145
|
+
role="option"
|
|
146
|
+
style="pointer-events: all;"
|
|
147
|
+
>
|
|
148
|
+
<span
|
|
149
|
+
class="text"
|
|
97
150
|
>
|
|
98
|
-
|
|
99
|
-
</
|
|
151
|
+
bar
|
|
152
|
+
</span>
|
|
100
153
|
</div>
|
|
101
|
-
</div>
|
|
102
|
-
</div>
|
|
103
|
-
<div
|
|
104
|
-
class="row"
|
|
105
|
-
>
|
|
106
|
-
<div
|
|
107
|
-
class="right aligned five wide column"
|
|
108
|
-
>
|
|
109
154
|
<div
|
|
110
|
-
aria-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
155
|
+
aria-checked="true"
|
|
156
|
+
aria-selected="true"
|
|
157
|
+
class="active selected item"
|
|
158
|
+
role="option"
|
|
159
|
+
style="pointer-events: all;"
|
|
114
160
|
>
|
|
115
|
-
<
|
|
116
|
-
|
|
117
|
-
aria-live="polite"
|
|
118
|
-
class="divider text"
|
|
119
|
-
role="alert"
|
|
161
|
+
<span
|
|
162
|
+
class="text"
|
|
120
163
|
>
|
|
121
164
|
foo
|
|
122
|
-
</
|
|
123
|
-
<i
|
|
124
|
-
aria-hidden="true"
|
|
125
|
-
class="dropdown icon"
|
|
126
|
-
/>
|
|
127
|
-
<div
|
|
128
|
-
class="menu transition"
|
|
129
|
-
>
|
|
130
|
-
<div
|
|
131
|
-
aria-checked="false"
|
|
132
|
-
aria-selected="false"
|
|
133
|
-
class="item"
|
|
134
|
-
role="option"
|
|
135
|
-
style="pointer-events: all;"
|
|
136
|
-
>
|
|
137
|
-
<span
|
|
138
|
-
class="text"
|
|
139
|
-
>
|
|
140
|
-
bar
|
|
141
|
-
</span>
|
|
142
|
-
</div>
|
|
143
|
-
<div
|
|
144
|
-
aria-checked="true"
|
|
145
|
-
aria-selected="true"
|
|
146
|
-
class="active selected item"
|
|
147
|
-
role="option"
|
|
148
|
-
style="pointer-events: all;"
|
|
149
|
-
>
|
|
150
|
-
<span
|
|
151
|
-
class="text"
|
|
152
|
-
>
|
|
153
|
-
foo
|
|
154
|
-
</span>
|
|
155
|
-
</div>
|
|
156
|
-
</div>
|
|
165
|
+
</span>
|
|
157
166
|
</div>
|
|
158
|
-
<button
|
|
159
|
-
class="ui primary button button icon group-actions"
|
|
160
|
-
>
|
|
161
|
-
grantRequest.actions.approve
|
|
162
|
-
</button>
|
|
163
|
-
<button
|
|
164
|
-
class="ui secondary button button icon group-actions"
|
|
165
|
-
>
|
|
166
|
-
grantRequest.actions.reject
|
|
167
|
-
</button>
|
|
168
167
|
</div>
|
|
169
168
|
</div>
|
|
169
|
+
<button
|
|
170
|
+
class="ui primary button button icon group-actions grant-requests-approval-button"
|
|
171
|
+
>
|
|
172
|
+
grantRequest.actions.approve
|
|
173
|
+
</button>
|
|
174
|
+
<button
|
|
175
|
+
class="ui secondary button button icon group-actions grant-requests-approval-button"
|
|
176
|
+
>
|
|
177
|
+
grantRequest.actions.reject
|
|
178
|
+
</button>
|
|
179
|
+
</div>
|
|
180
|
+
<div
|
|
181
|
+
class="grant-requests-download-actions"
|
|
182
|
+
>
|
|
183
|
+
<button
|
|
184
|
+
class="ui icon secondary disabled button"
|
|
185
|
+
data-position="top right"
|
|
186
|
+
data-tooltip="grantRequest.actions.download.tooltip"
|
|
187
|
+
disabled=""
|
|
188
|
+
tabindex="-1"
|
|
189
|
+
>
|
|
190
|
+
<i
|
|
191
|
+
aria-hidden="true"
|
|
192
|
+
class="download icon"
|
|
193
|
+
/>
|
|
194
|
+
</button>
|
|
170
195
|
</div>
|
|
171
196
|
</div>
|
|
172
197
|
<div
|
|
173
|
-
class="
|
|
198
|
+
class="grant-requests-bulk-label-results"
|
|
174
199
|
>
|
|
175
200
|
<div
|
|
176
|
-
class="
|
|
201
|
+
class="ui label"
|
|
177
202
|
>
|
|
178
|
-
|
|
179
|
-
class="ui label"
|
|
180
|
-
>
|
|
181
|
-
grantRequests.retrieved.results
|
|
182
|
-
</div>
|
|
183
|
-
<div
|
|
184
|
-
class="ui label"
|
|
185
|
-
>
|
|
186
|
-
grantRequests.bulk.selected
|
|
187
|
-
</div>
|
|
203
|
+
grantRequests.retrieved.results
|
|
188
204
|
</div>
|
|
205
|
+
<div
|
|
206
|
+
class="ui label"
|
|
207
|
+
>
|
|
208
|
+
grantRequests.bulk.selected
|
|
209
|
+
</div>
|
|
210
|
+
</div>
|
|
211
|
+
<div
|
|
212
|
+
class="dimmable"
|
|
213
|
+
>
|
|
214
|
+
<div
|
|
215
|
+
class="ui inverted dimmer"
|
|
216
|
+
/>
|
|
189
217
|
<table
|
|
190
218
|
class="ui selectable sortable table"
|
|
191
219
|
>
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import FileSaver from "file-saver";
|
|
1
2
|
import useSWRMutations from "swr/mutation";
|
|
2
|
-
import { apiJsonPost } from "@truedat/core/services/api";
|
|
3
|
+
import { apiJsonPost, JSON_OPTS } from "@truedat/core/services/api";
|
|
3
4
|
import {
|
|
4
5
|
API_GRANT_REQUEST_BULK_APPROVAL,
|
|
5
6
|
API_GRANT_REQUEST_GROUP,
|
|
7
|
+
API_GRANT_REQUESTS_DOWNLOAD,
|
|
6
8
|
API_GRANT_REQUESTS_SEARCH,
|
|
7
9
|
API_GRANT_REQUESTS_FILTERS_SEARCH,
|
|
8
10
|
} from "../api";
|
|
@@ -29,3 +31,20 @@ export const useGrantRequestsFilters = () => {
|
|
|
29
31
|
apiJsonPost(url, arg),
|
|
30
32
|
);
|
|
31
33
|
};
|
|
34
|
+
|
|
35
|
+
const saveGrantRequestFile = ({ data, headers }) => {
|
|
36
|
+
const contentDisposition = headers["content-disposition"];
|
|
37
|
+
const regex = /filename=(.+)$/;
|
|
38
|
+
const match = regex.exec(contentDisposition);
|
|
39
|
+
const fileName = match ? match[1] : "grant_requests.xlsx";
|
|
40
|
+
FileSaver.saveAs(data, fileName);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const useGrantRequestsDownload = () => {
|
|
44
|
+
return useSWRMutations(API_GRANT_REQUESTS_DOWNLOAD, (url, { arg }) =>
|
|
45
|
+
apiJsonPost(url, arg, {
|
|
46
|
+
...JSON_OPTS,
|
|
47
|
+
responseType: "blob",
|
|
48
|
+
}).then(({ data, headers }) => saveGrantRequestFile({ data, headers })),
|
|
49
|
+
);
|
|
50
|
+
};
|