|
9 | 9 | <pane>
|
10 | 10 |
|
11 | 11 | <splitpanes>
|
12 |
| - <pane class="load"> |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + <pane class="load" v-if="displayAllRecords"> |
| 16 | + <button @click="displayAllRecords=false;displayDashboard=true">Close</button> |
| 17 | + <div id="all-records-table"> |
| 18 | + <DataTable :loading="isLoadingAllRecords" :rows="allRecords" striped hoverable> |
| 19 | + |
| 20 | + <!-- { "Id": "e1078432", "RTs": [ "lc:RT:bf2:Monograph:Work" ], "Type": "Monograph", "Status": "unposted", "Urls": [ "http://id.loc.gov/resources/works/e1078432", "http://id.loc.gov/resources/instances/e1078432" ], "Time": "2024-07-10:17:11:53", "User": "asdf (asdf)" } --> |
| 21 | + |
| 22 | + <template #tbody="{row}"> |
| 23 | + |
| 24 | + |
| 25 | + <td> |
| 26 | + <router-link :to="{ name: 'Edit', params: { recordId: row.Id }}"> |
| 27 | + {{ row.Id }} |
| 28 | + </router-link> |
| 29 | + </td> |
| 30 | + |
| 31 | + <td v-text="row.RTs.join(', ')"/> |
| 32 | + <td v-text="row.Type"/> |
| 33 | + <td v-text="row.Status"/> |
| 34 | + <td> |
| 35 | + <div v-for="u in row.Urls"> |
| 36 | + <a v-if="u.indexOf('/works/') >-1" :href="u" target="_blank">Work</a> |
| 37 | + <a v-else-if="u.indexOf('/instances/') >-1" :href="u" target="_blank">Instance</a> |
| 38 | + <a v-else :href="u" target="_blank">{{ u }}</a> |
| 39 | + |
| 40 | + </div> |
| 41 | + |
| 42 | + </td> |
| 43 | + <td v-text="row.Time"/> |
| 44 | + <td v-text="row.User"/> |
| 45 | + |
| 46 | + </template> |
| 47 | + |
| 48 | + </DataTable> |
| 49 | + |
| 50 | + </div> |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + </pane> |
| 55 | + |
| 56 | + <pane class="load" v-if="displayDashboard"> |
13 | 57 |
|
14 | 58 |
|
15 | 59 |
|
|
89 | 133 | </div>
|
90 | 134 |
|
91 | 135 | <div>
|
| 136 | + |
92 | 137 | <h1>
|
93 | 138 | <span style="font-size: 1.25em; vertical-align: bottom; margin-right: 3px;" class="material-icons">edit_note</span>
|
94 |
| - <span>Your Records</span></h1> |
| 139 | + <span>Your Records</span></h1> |
| 140 | + <a href="#" @click="loadAllRecords" style="color: inherit;">Show All Records</a> |
95 | 141 | <div>
|
96 | 142 |
|
97 | 143 | <div class="saved-records-empty" v-if="continueRecords.length==0">
|
|
174 | 220 | import TimeAgo from 'javascript-time-ago'
|
175 | 221 | import en from 'javascript-time-ago/locale/en'
|
176 | 222 |
|
| 223 | +
|
| 224 | + import { DataTable } from "@jobinsjp/vue3-datatable" |
| 225 | + import "@jobinsjp/vue3-datatable/dist/style.css" |
| 226 | +
|
| 227 | +
|
177 | 228 | TimeAgo.addDefaultLocale(en)
|
178 | 229 | const timeAgo = new TimeAgo('en-US')
|
179 | 230 |
|
|
182 | 233 |
|
183 | 234 |
|
184 | 235 | export default {
|
185 |
| - components: { Splitpanes, Pane, Nav }, |
| 236 | + components: { Splitpanes, Pane, Nav, DataTable }, |
186 | 237 | data() {
|
187 | 238 | return {
|
188 | 239 |
|
|
196 | 247 | lccnToSearchTimeout: null,
|
197 | 248 |
|
198 | 249 | lccnLoadSelected:false,
|
| 250 | +
|
| 251 | +
|
| 252 | + displayDashboard:true, |
| 253 | + displayAllRecords: false, |
| 254 | + isLoadingAllRecords:false, |
| 255 | +
|
| 256 | + allRecords: [] |
| 257 | +
|
| 258 | +
|
199 | 259 | }
|
200 | 260 | },
|
201 | 261 | computed: {
|
|
234 | 294 |
|
235 | 295 | methods: {
|
236 | 296 |
|
| 297 | + allRecordsRowClick: function(row){ |
| 298 | +
|
| 299 | + console.log(row) |
| 300 | +
|
| 301 | + }, |
| 302 | +
|
| 303 | + loadAllRecords: async function(event){ |
| 304 | + event.preventDefault() |
| 305 | +
|
| 306 | + this.displayDashboard = false |
| 307 | + this.displayAllRecords = true |
| 308 | + this.isLoadingAllRecords=true |
| 309 | +
|
| 310 | + let allRecordsRaw = await utilsNetwork.searchSavedRecords() |
| 311 | + console.log(allRecordsRaw) |
| 312 | + this.allRecords = [] |
| 313 | + for (let r of allRecordsRaw){ |
| 314 | +
|
| 315 | + let obj = { |
| 316 | + 'Id': r.eid, |
| 317 | +
|
| 318 | + 'RTs': r.rstused, |
| 319 | + 'Type': r.typeid, |
| 320 | + 'Status': r.status, |
| 321 | + 'Urls': r.externalid, |
| 322 | + 'Time': r.time, |
| 323 | + 'User': r.user, |
| 324 | +
|
| 325 | +
|
| 326 | +
|
| 327 | + } |
| 328 | + this.allRecords.push(obj) |
| 329 | +
|
| 330 | +
|
| 331 | + } |
| 332 | + // let lccnLookup = {} |
| 333 | +
|
| 334 | +
|
| 335 | + this.isLoadingAllRecords=false |
| 336 | + }, |
| 337 | +
|
237 | 338 | returnTimeAgo: function(timestamp){
|
238 | 339 | console.log(timestamp, timestamp*1000,Date.now())
|
239 | 340 | return timeAgo.format(timestamp*1000)
|
240 | 341 | },
|
| 342 | + |
241 | 343 |
|
242 | 344 | returnPixleAsPercent: function(pixles){
|
243 | 345 | return pixles/window.innerHeight*100
|
|
457 | 559 | width:100%;
|
458 | 560 | }
|
459 | 561 |
|
| 562 | +#all-records-table{ |
460 | 563 |
|
| 564 | + height: 90vh; |
| 565 | + overflow-y: auto; |
| 566 | +
|
| 567 | +} |
461 | 568 | .test-data:nth-child(odd) {
|
462 | 569 |
|
463 | 570 | background-color: whitesmoke;
|
|
0 commit comments