@byu-oit/vue-decision-processing-components 8.29.6 → 8.30.0
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 +9 -0
- package/Report.vue +113 -89
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [8.30.0](https://github.com/byu-oit/vue-decision-processing-components/compare/v8.29.6...v8.30.0) (2022-11-09)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* paginate reports ([d047f2f](https://github.com/byu-oit/vue-decision-processing-components/commit/d047f2fd314b19ed72a2ec0d2e20e628dd22dd23))
|
|
11
|
+
* paginate reports ([851f9b5](https://github.com/byu-oit/vue-decision-processing-components/commit/851f9b503e094fa16368e3a624b8cd19bd69e582))
|
|
12
|
+
* paginate reports ([2b15c5c](https://github.com/byu-oit/vue-decision-processing-components/commit/2b15c5c875f74024ee3d206eef81d746b6fdd656))
|
|
13
|
+
|
|
5
14
|
### [8.29.6](https://github.com/byu-oit/vue-decision-processing-components/compare/v8.29.5...v8.29.6) (2022-11-02)
|
|
6
15
|
|
|
7
16
|
|
package/Report.vue
CHANGED
|
@@ -14,67 +14,67 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
-->
|
|
16
16
|
<template>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
17
|
+
<div class="report" v-if="metadata">
|
|
18
|
+
<ReportSvg
|
|
19
|
+
v-if="chart"
|
|
20
|
+
v-bind="$attrs"
|
|
21
|
+
v-on="$listeners"
|
|
22
|
+
:svgContent="svgContent"
|
|
23
|
+
:loaded="loaded"
|
|
24
|
+
:error="error"/>
|
|
25
|
+
<template v-if="!hideDescription">
|
|
26
|
+
<h1 v-if="metadata.description">{{metadata.description}}</h1>
|
|
27
|
+
<h4 v-if="metadata.long_description" class="no-uppercase">{{metadata.long_description}}</h4>
|
|
28
|
+
<byu-control-date-selector
|
|
29
|
+
v-if="metadata.parameters.includes('admitPeriod')"
|
|
30
|
+
:value="selectedAdmitPeriod"
|
|
31
|
+
@change="selectedAdmitPeriod = $event.target.value"
|
|
32
|
+
date-type="CURRENT_YYT"
|
|
33
|
+
prior-terms="3"
|
|
34
|
+
subsequent-terms="4"
|
|
35
|
+
></byu-control-date-selector>
|
|
36
|
+
<date-picker
|
|
37
|
+
v-if="metadata.parameters.includes('date_start') && metadata.parameters.includes('date_end')"
|
|
38
|
+
v-model="dateRange"
|
|
39
|
+
range
|
|
40
|
+
:not-after="new Date()"
|
|
41
|
+
lang="en"
|
|
42
|
+
/>
|
|
43
|
+
</template>
|
|
44
|
+
<template v-if="detail && photoLink">
|
|
45
|
+
<div>
|
|
46
|
+
<input type="checkbox" v-model="showPhotos" id="components-Report-showPhotos">
|
|
47
|
+
<label for="components-Report-showPhotos">Show Photos</label>
|
|
48
|
+
</div>
|
|
49
|
+
<ReportPhotos
|
|
50
|
+
v-if="showPhotos"
|
|
51
|
+
:rows="rows"
|
|
52
|
+
:column-metadata="metadata.columns"
|
|
53
|
+
:loading="loading"
|
|
54
|
+
:error="error"/>
|
|
55
|
+
<ReportDetail
|
|
56
|
+
v-else
|
|
57
|
+
:csv="csvContent"
|
|
58
|
+
:column-metadata="metadata.columns"
|
|
59
|
+
:rows="rows"
|
|
60
|
+
:loading="loading"
|
|
61
|
+
:error="error"
|
|
62
|
+
:detailPath="detailPath"
|
|
63
|
+
:newTab="newTab"/>
|
|
64
|
+
</template>
|
|
65
|
+
<template v-else>
|
|
66
|
+
<ReportDetail
|
|
67
|
+
v-if="detail"
|
|
68
|
+
:csv="csvContent"
|
|
69
|
+
:column-metadata="metadata.columns"
|
|
70
|
+
:rows="rows"
|
|
71
|
+
:loading="loading"
|
|
72
|
+
:error="error"
|
|
73
|
+
:detailPath="detailPath"
|
|
74
|
+
:newTab="newTab" />
|
|
75
|
+
</template>
|
|
76
|
+
<router-link v-else-if="to" :to="to">View Details</router-link>
|
|
77
|
+
</div>
|
|
78
78
|
</template>
|
|
79
79
|
|
|
80
80
|
<script>
|
|
@@ -110,6 +110,12 @@ export default {
|
|
|
110
110
|
admitPeriod: {
|
|
111
111
|
type: String
|
|
112
112
|
},
|
|
113
|
+
paginationParameter: {
|
|
114
|
+
type: String
|
|
115
|
+
},
|
|
116
|
+
limit: {
|
|
117
|
+
type: String
|
|
118
|
+
},
|
|
113
119
|
hideDescription: Boolean,
|
|
114
120
|
newTab: Boolean,
|
|
115
121
|
autoRefresh: Boolean,
|
|
@@ -128,7 +134,9 @@ export default {
|
|
|
128
134
|
rows: null,
|
|
129
135
|
selectedAdmitPeriod: this.admitPeriod,
|
|
130
136
|
dateRange: null,
|
|
131
|
-
showPhotos: false
|
|
137
|
+
showPhotos: false,
|
|
138
|
+
paginateReport: this.paginationParameter,
|
|
139
|
+
newCursor: 'null'
|
|
132
140
|
}
|
|
133
141
|
},
|
|
134
142
|
computed: {
|
|
@@ -151,30 +159,7 @@ export default {
|
|
|
151
159
|
this.loading = true
|
|
152
160
|
this.$emit('loading')
|
|
153
161
|
window.scrollTo(0, 0)
|
|
154
|
-
const q =
|
|
155
|
-
q.append('name', this.reportName)
|
|
156
|
-
if (this.selectedAdmitPeriod) {
|
|
157
|
-
q.append('admit_period', this.selectedAdmitPeriod)
|
|
158
|
-
} else if(this.metadata.parameters.includes('admitPeriod')) {
|
|
159
|
-
// Don't attempt to load report if we're missing the admit period
|
|
160
|
-
return
|
|
161
|
-
}
|
|
162
|
-
if (this.dateRange) {
|
|
163
|
-
const toYYYYMMDD = dt => dt.toISOString().substr(0, 10)
|
|
164
|
-
const startDate = toYYYYMMDD(this.dateRange[0])
|
|
165
|
-
const endDate = toYYYYMMDD(this.dateRange[1])
|
|
166
|
-
q.append('date_start', startDate)
|
|
167
|
-
q.append('date_end', endDate)
|
|
168
|
-
}
|
|
169
|
-
if (this.metadata.parameters.includes('setById')) {
|
|
170
|
-
q.append('set_by_id', this.setById)
|
|
171
|
-
}
|
|
172
|
-
// appends institution if available to url search params
|
|
173
|
-
if(this.metadata.parameters.includes('institutions')) {
|
|
174
|
-
if(this.metadata.parameters.institutions.includes(state.institution))
|
|
175
|
-
q.append('institution', state.institution)
|
|
176
|
-
}
|
|
177
|
-
|
|
162
|
+
const q = this.getQuery()
|
|
178
163
|
const url = this.baseUrl + '?' + q.toString()
|
|
179
164
|
const loadRequested = () => {
|
|
180
165
|
let promises = []
|
|
@@ -202,7 +187,15 @@ export default {
|
|
|
202
187
|
this.svgContent = svg
|
|
203
188
|
},
|
|
204
189
|
async loadCsv (url) {
|
|
205
|
-
|
|
190
|
+
let csv = ''
|
|
191
|
+
do {
|
|
192
|
+
const reportResponse = await this.loadReport(url, 'text/csv')
|
|
193
|
+
csv = csv + reportResponse.body
|
|
194
|
+
this.newCursor = reportResponse.cursor
|
|
195
|
+
const q = this.getQuery()
|
|
196
|
+
url = this.baseUrl + '?' + q.toString()
|
|
197
|
+
} while (this.newCursor !== 'null')
|
|
198
|
+
|
|
206
199
|
if (csv && csv.length > 0 && /\n/.test(csv)) {
|
|
207
200
|
this.csvContent = csv
|
|
208
201
|
const [headData, ...data] = parse(csv)
|
|
@@ -233,7 +226,7 @@ export default {
|
|
|
233
226
|
console.error(err.stack)
|
|
234
227
|
return null
|
|
235
228
|
}
|
|
236
|
-
return await response.text()
|
|
229
|
+
return JSON.parse(await response.text())
|
|
237
230
|
} catch (err) {
|
|
238
231
|
this.error = true
|
|
239
232
|
console.error(err)
|
|
@@ -247,6 +240,37 @@ export default {
|
|
|
247
240
|
}
|
|
248
241
|
}
|
|
249
242
|
tabHiddenState = document.hidden
|
|
243
|
+
},
|
|
244
|
+
getQuery() {
|
|
245
|
+
const q = new URLSearchParams()
|
|
246
|
+
q.append('name', this.reportName)
|
|
247
|
+
if (this.selectedAdmitPeriod) {
|
|
248
|
+
q.append('admit_period', this.selectedAdmitPeriod)
|
|
249
|
+
} else if(this.metadata.parameters.includes('admitPeriod')) {
|
|
250
|
+
// Don't attempt to load report if we're missing the admit period
|
|
251
|
+
return
|
|
252
|
+
}
|
|
253
|
+
if (this.paginateReport !== 'null') {
|
|
254
|
+
q.append('pagination_parameter', this.paginateReport)
|
|
255
|
+
q.append('limit', this.limit)
|
|
256
|
+
q.append('cursor', this.newCursor)
|
|
257
|
+
}
|
|
258
|
+
if (this.dateRange) {
|
|
259
|
+
const toYYYYMMDD = dt => dt.toISOString().substr(0, 10)
|
|
260
|
+
const startDate = toYYYYMMDD(this.dateRange[0])
|
|
261
|
+
const endDate = toYYYYMMDD(this.dateRange[1])
|
|
262
|
+
q.append('date_start', startDate)
|
|
263
|
+
q.append('date_end', endDate)
|
|
264
|
+
}
|
|
265
|
+
if (this.metadata.parameters.includes('setById') && this.setById) {
|
|
266
|
+
q.append('set_by_id', this.setById)
|
|
267
|
+
}
|
|
268
|
+
// appends institution if available to url search params
|
|
269
|
+
if(this.metadata.parameters.includes('institutions')) {
|
|
270
|
+
if(this.metadata.parameters.institutions.includes(state.institution))
|
|
271
|
+
q.append('institution', state.institution)
|
|
272
|
+
}
|
|
273
|
+
return q
|
|
250
274
|
}
|
|
251
275
|
},
|
|
252
276
|
watch: {
|
|
@@ -280,7 +304,7 @@ export default {
|
|
|
280
304
|
</script>
|
|
281
305
|
<style scoped>
|
|
282
306
|
.no-uppercase {
|
|
283
|
-
text-transform: none;
|
|
307
|
+
text-transform: none;
|
|
284
308
|
color: var(--gray, gray);
|
|
285
309
|
font-size: 1rem;
|
|
286
310
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@byu-oit/vue-decision-processing-components",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.30.0",
|
|
4
4
|
"description": "Vue components shared between decision processing systems for the CES schools.",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@fortawesome/fontawesome-free": "^5.15.4",
|