Skip to content

Commit 9968975

Browse files
View all records from load screen
1 parent b141d8a commit 9968975

File tree

3 files changed

+124
-3
lines changed

3 files changed

+124
-3
lines changed

package-lock.json

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore"
1313
},
1414
"dependencies": {
15+
"@jobinsjp/vue3-datatable": "^1.0.15",
1516
"floating-vue": "^2.0.0-beta.20",
1617
"html-escaper": "^3.0.3",
1718
"javascript-time-ago": "^2.5.10",

src/views/Load.vue

+110-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,51 @@
99
<pane>
1010

1111
<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">
1357

1458

1559

@@ -89,9 +133,11 @@
89133
</div>
90134

91135
<div>
136+
92137
<h1>
93138
<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>
95141
<div>
96142

97143
<div class="saved-records-empty" v-if="continueRecords.length==0">
@@ -174,6 +220,11 @@
174220
import TimeAgo from 'javascript-time-ago'
175221
import en from 'javascript-time-ago/locale/en'
176222
223+
224+
import { DataTable } from "@jobinsjp/vue3-datatable"
225+
import "@jobinsjp/vue3-datatable/dist/style.css"
226+
227+
177228
TimeAgo.addDefaultLocale(en)
178229
const timeAgo = new TimeAgo('en-US')
179230
@@ -182,7 +233,7 @@
182233
183234
184235
export default {
185-
components: { Splitpanes, Pane, Nav },
236+
components: { Splitpanes, Pane, Nav, DataTable },
186237
data() {
187238
return {
188239
@@ -196,6 +247,15 @@
196247
lccnToSearchTimeout: null,
197248
198249
lccnLoadSelected:false,
250+
251+
252+
displayDashboard:true,
253+
displayAllRecords: false,
254+
isLoadingAllRecords:false,
255+
256+
allRecords: []
257+
258+
199259
}
200260
},
201261
computed: {
@@ -234,10 +294,52 @@
234294
235295
methods: {
236296
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+
237338
returnTimeAgo: function(timestamp){
238339
console.log(timestamp, timestamp*1000,Date.now())
239340
return timeAgo.format(timestamp*1000)
240341
},
342+
241343
242344
returnPixleAsPercent: function(pixles){
243345
return pixles/window.innerHeight*100
@@ -457,7 +559,12 @@
457559
width:100%;
458560
}
459561
562+
#all-records-table{
460563
564+
height: 90vh;
565+
overflow-y: auto;
566+
567+
}
461568
.test-data:nth-child(odd) {
462569
463570
background-color: whitesmoke;

0 commit comments

Comments
 (0)