Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebuild the pdf viewer #145

Merged
merged 27 commits into from
Nov 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6d3604d
park the old pdf viewer as /document_old
lfoppiano Nov 16, 2022
7ee73ae
add new empty page
lfoppiano Nov 16, 2022
5175e69
show a pdf and annotate colors
t29mato Nov 17, 2022
e47e168
show tabular information by table
t29mato Nov 17, 2022
aedeb74
add a transition which moves from the table to the pdf
t29mato Nov 17, 2022
50bea24
remove duplicate codes
t29mato Nov 18, 2022
6b35f9c
refactoring to improve readability
t29mato Nov 18, 2022
d4d1122
avoids side-by-side PDFs on wide screens
t29mato Nov 18, 2022
4700927
add goToPdf feature in the document page
t29mato Nov 18, 2022
fd32cc1
show the arrow-down icon to go to pdf in both the raw material column…
t29mato Nov 18, 2022
a8117c5
add URL to fetch records by hash
lfoppiano Nov 17, 2022
049f6b7
update the error types schema
lfoppiano Nov 16, 2022
8f5c0a0
Merge remote-tracking branch 'origin/develop' into feature/pdf-viewer
lfoppiano Nov 28, 2022
2b8555d
fix merge issues
lfoppiano Nov 28, 2022
120a528
update feedback correction
lfoppiano Nov 29, 2022
eff414d
add floating table feature
t29mato Nov 18, 2022
db26de0
show the span detail box when user click a span on the pdf viewer #69
t29mato Nov 29, 2022
6a37a57
adjust visible columns #142
lfoppiano Nov 30, 2022
3b99108
Merge branch 'develop' into feature/pdf-viewer
lfoppiano Nov 30, 2022
609da24
generate attributes html by the current code #69
t29mato Nov 30, 2022
97391e4
Merge branch 'develop' into feature/pdf-viewer
lfoppiano Nov 30, 2022
9cd10a4
Annotations are covering too much of the text #141
t29mato Nov 30, 2022
7280cec
improve usability of click on "arrow down" #140, it hides a floating …
t29mato Nov 30, 2022
d0636a4
Nicer message when the requested document does not exist in the datab…
t29mato Nov 30, 2022
26c4bc6
hide the document column in the initial display on the table in the d…
t29mato Nov 30, 2022
4b001da
fix text annotation alignment #147
t29mato Nov 30, 2022
edf05a0
floating table is not updated when a record is curated #148
t29mato Nov 30, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions supercon2/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,11 @@ def get_document(hash):
return render_template("document.html", hash=hash)


@bp.route('/document_old/<hash>', methods=['GET'])
def get_document_old(hash):
return render_template("document_old.html", hash=hash)


@bp.route('/annotation/<hash>', methods=['GET'])
def get_annotations(hash):
"""Get annotations (latest version)"""
Expand Down
15 changes: 15 additions & 0 deletions supercon2/static/grobid/colors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export const colors = {
"abbreviation": "#b92c28",
"me_method": "#0e90d2",
"material": "#2262d2",
"material-tc": "#50ced2",
"class": "#d22f09",
"tc": "#ffe294",
"sample": "#5bd2b2",
"temperature": "#356635",
"tcValue": "#356635",
"temperature-tc": "#83ff83",
"magnetisation": "#20bd4e",
"pressure": "#92d983",
"unit-cell-type": "#0776e1"
}
28 changes: 28 additions & 0 deletions supercon2/static/grobid/shortcut-keys.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
export const shortcutKeys = [{
name: 'n',
text: 'Add new record (in the same document of the selected record)'
}, {
name: 'e',
text: 'Edit the selected record'
}, {
name: '⌘ + Enter',
text: 'Save the record on the edit dialog (Mac)'
}, {
name: 'Ctrl + Enter',
text: 'Save the record on the edit dialog (Win)'
}, {
name: 'ArrowUp',
text: 'Move selection up one record'
}, {
name: 'ArrowDown',
text: 'Move selection down one record'
}, {
name: 'enter',
text: 'Flag/unflag the selected record'
}, {
name: '?',
text: 'Show the keyboard shortcuts dialog',
}, {
name: 'esc',
text: 'Close this dialog',
}]
155 changes: 47 additions & 108 deletions supercon2/templates/database.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ <h2>SuperCon<sup>2</sup> | Database</h2>
<v-select v-model="selectedHeaders" :items="headers" label="Select Columns" multiple outlined
return-object>
</v-select>
{# <v-btn @click="openCreateItemDialog" Depressed class="ma-2">New Item</v-btn>#}
</v-row>
<v-data-table v-model="selectedItems" :headers="showHeaders" :items="items" :dense="true" single-select
loading-text="loading ..." :loading="isLoading" :multi-sort="true" class="elevation-1" :item-class="getItemClass"
Expand Down Expand Up @@ -212,7 +211,9 @@ <h2>SuperCon<sup>2</sup> | Database</h2>
<script src="https://cdn.jsdelivr.net/npm/vuetify@2.6.3/dist/vuetify.js"></script>
<script src="https://cdn.jsdelivr.net/npm/axios@0.26.1/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/mathjs@11.3.1/lib/browser/math.min.js"></script>
<script>
<script type="module">
import { shortcutKeys } from "{{ url_for('static', filename='grobid/shortcut-keys.js')}}"

let itemClassStore = {
class: 'bg-white',
hashes: [],
Expand All @@ -229,36 +230,7 @@ <h2>SuperCon<sup>2</sup> | Database</h2>
shouldShow: false,
},
shouldShowShortcutKeysDialog: false,
shortcutKeys: [
{
name: 'n',
text: 'Add new record (in the same document of the selected record)'
}, {
name: 'e',
text: 'Edit the selected record'
}, {
name: '⌘ + Enter',
text: 'Save the record on the edit dialog (Mac)'
}, {
name: 'Ctrl + Enter',
text: 'Save the record on the edit dialog (Win)'
}, {
name: 'ArrowUp',
text: 'Move selection up one record'
}, {
name: 'ArrowDown',
text: 'Move selection down one record'
}, {
name: 'enter',
text: 'Flag/unflag the selected record'
}, {
name: '?',
text: 'Show the keyboard shortcuts dialog',
}, {
name: 'esc',
text: 'Close this dialog',
}
],
shortcutKeys,
isLoading: true,
version: 'unknown version',
editedItem: {},
Expand Down Expand Up @@ -298,8 +270,8 @@ <h2>SuperCon<sup>2</sup> | Database</h2>
{#{ text: 'Path', value: 'path', hidden: true, filter: this.pathFilter, filterKeyword: '', shouldHideEmpty: false },#}
{#{ text: 'Filename', value: 'filename', hidden: true, filter: this.filenameFilter, filterKeyword: '', shouldHideEmpty: false },#}
{ text: 'Document', value: 'hash', hidden: false, filter: this.hashFilter, filterKeyword: "{{hash}}", width: 120, shouldHideEmpty: false },
{ text: 'Entity ID', value: 'id', hidden: false, filter: this.idFilter, filterKeyword: '', shouldHideEmpty: false, width: 120, },
{ text: 'Timestamp', value: 'timestamp', hidden: true, filter: this.timestampFilter, filterKeyword: '', shouldHideEmpty: false, width: 120 },
{ text: 'Entity ID', value: 'id', hidden: true, filter: this.idFilter, filterKeyword: '', shouldHideEmpty: false, width: 120, },
{ text: 'Timestamp', value: 'timestamp', hidden: true, filter: this.timestampFilter, filterKeyword: '', shouldHideEmpty: false, width: 120 },
{ text: 'DOI', value: 'doi', hidden: false, filter: this.doiFilter, filterKeyword: '', shouldHideEmpty: false },
{ text: 'Authors', value: 'authors', width: 300, hidden: true, filter: this.authorsFilter, filterKeyword: '', shouldHideEmpty: false },
{ text: 'Title', value: 'title', width: 500, hidden: true, filter: this.titleFilter, filterKeyword: '', shouldHideEmpty: false },
Expand Down Expand Up @@ -357,82 +329,49 @@ <h2>SuperCon<sup>2</sup> | Database</h2>
// { text: 'Material ID', value: 'materialId', hidden: true},
],
rowsOnItemEditDialog: [{
config: {
cols: 4,
},
cols: [{
key: 'rawMaterial',
config: { cols: 4 },
cols: [
{ key: 'rawMaterial'},
{ key: 'id', disabled: true },
{
key: 'error_type', label: '*Error type', rules: [(value) => !!value || 'This field is required'],
errorMessages: [],
selectBoxItems: [] // set by the loadErrorTypes method
}
]
}, {
key: 'id',
disabled: true,
config: { cols: null },
cols: [
{ key: 'formula' },
{ key: 'variables' },
{ key: 'criticalTemperature' },
{ key: 'appliedPressure' },
{ key: 'criticalTemperatureMeasurementMethod' }
]
}, {
key: 'error_type',
label: '*Error type',
rules: [(value) => !!value || 'This field is required'],
errorMessages: [],
selectBoxItems: [] // set by the loadErrorTypes method
}]
}, {
config: {
cols: null,
},
cols: [{
key: 'formula',
},{
key: 'variables',
},{
key: 'criticalTemperature',
},{
key: 'appliedPressure',
},{
key: 'criticalTemperatureMeasurementMethod',
},]
}, {
config: {
cols: null,
},
cols: [{
key: 'spaceGroup',
},{
key: 'crystalStructure',
},{
key: 'unitCellType',
},{
key: 'doping',
},{
key: 'shape',
},{
key: 'fabrication',
},{
key: 'substrate',
},]
}, {
config: {
cols: null,
},
cols: [{
key: 'hash',
disabled: true,
},{
key: 'doi',
disabled: true,
},{
key: 'authors',
disabled: true,
},{
key: 'title',
disabled: true,
},{
key: 'publisher',
disabled: true,
},{
key: 'journal',
disabled: true,
},{
key: 'year',
disabled: true,
},]
}],
config: { cols: null },
cols: [
{ key: 'spaceGroup' },
{ key: 'crystalStructure' },
{ key: 'unitCellType' },
{ key: 'doping' },
{ key: 'shape' },
{ key: 'fabrication' },
{ key: 'substrate' },
]
}, {
config: { cols: null },
cols: [
{ key: 'hash', disabled: true },
{ key: 'doi', disabled: true },
{ key: 'authors', disabled: true },
{ key: 'title', disabled: true },
{ key: 'publisher', disabled: true },
{ key: 'journal', disabled: true },
{ key: 'year', disabled: true },
]
}
],
items: [],
rules: {
required: value => !!value || 'Required.',
Expand Down
Loading