mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 12:47:08 +00:00
Show sequence comments in log page
This commit is contained in:
@@ -59,7 +59,7 @@
|
||||
<v-icon right small>mdi-cloud-download</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
|
||||
|
||||
<v-list>
|
||||
<v-list-item
|
||||
:href="`/api/project/${$route.params.project}/event/-/${$route.params.sequence}?mime=application%2Fvnd.seis%2Bjson`"
|
||||
@@ -187,6 +187,116 @@
|
||||
</v-menu>
|
||||
<!-- END Context menu for log entries -->
|
||||
|
||||
<v-container fluid class="pa-0 pb-2" v-if="sequenceData">
|
||||
<v-row no-gutters class="d-flex flex-column flex-sm-row">
|
||||
<v-col cols="6" class="d-flex flex-column">
|
||||
<v-card outlined tile class="flex-grow-1">
|
||||
<v-card-subtitle>
|
||||
Acquisition remarks
|
||||
<template v-if="writeaccess">
|
||||
<template v-if="edit && edit.sequence == sequenceData.sequence && edit.key == 'remarks'">
|
||||
<v-btn
|
||||
class="ml-3"
|
||||
icon
|
||||
small
|
||||
title="Cancel edit"
|
||||
:disabled="loading"
|
||||
@click="edit.value = sequenceData.remarks; edit = null"
|
||||
>
|
||||
<v-icon small>mdi-close</v-icon>
|
||||
</v-btn>
|
||||
<v-btn v-if="edit.value != sequenceData.remarks"
|
||||
icon
|
||||
small
|
||||
title="Save edits"
|
||||
:disabled="loading"
|
||||
@click="edit = null"
|
||||
>
|
||||
<v-icon small>mdi-content-save-edit-outline</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-btn v-else-if="edit === null"
|
||||
class="ml-3"
|
||||
icon
|
||||
small
|
||||
title="Edit"
|
||||
:disabled="loading"
|
||||
@click="editItem(sequenceData, 'remarks')"
|
||||
>
|
||||
<v-icon small>mdi-square-edit-outline</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
</v-card-subtitle>
|
||||
<v-card-text v-if="edit && edit.sequence == sequenceData.sequence && edit.key == 'remarks'">
|
||||
<v-textarea
|
||||
class="markdown"
|
||||
autofocus
|
||||
placeholder="Enter your text here"
|
||||
:disabled="loading"
|
||||
v-model="edit.value"
|
||||
>
|
||||
</v-textarea>
|
||||
</v-card-text>
|
||||
<v-card-text v-else v-html="$options.filters.markdown(sequenceData.remarks || '')">
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="6" class="d-flex flex-column">
|
||||
<v-card outlined tile class="flex-grow-1">
|
||||
<v-card-subtitle>
|
||||
Processing remarks
|
||||
<template v-if="writeaccess">
|
||||
<template v-if="edit && edit.sequence == sequenceData.sequence && edit.key == 'remarks_final'">
|
||||
<v-btn
|
||||
class="ml-3"
|
||||
icon
|
||||
small
|
||||
title="Cancel edit"
|
||||
:disabled="loading"
|
||||
@click="edit.value = sequenceData.remarks_final; edit = null"
|
||||
>
|
||||
<v-icon small>mdi-close</v-icon>
|
||||
</v-btn>
|
||||
<v-btn v-if="edit.value != sequenceData.remarks_final"
|
||||
icon
|
||||
small
|
||||
title="Save edits"
|
||||
:disabled="loading"
|
||||
@click="edit = null"
|
||||
>
|
||||
<v-icon small>mdi-content-save-edit-outline</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-btn v-else-if="edit === null"
|
||||
class="ml-3"
|
||||
icon
|
||||
small
|
||||
title="Edit"
|
||||
:disabled="loading"
|
||||
@click="editItem(sequenceData, 'remarks_final')"
|
||||
>
|
||||
<v-icon small>mdi-square-edit-outline</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
</v-card-subtitle>
|
||||
<v-card-text v-if="edit && edit.sequence == sequenceData.sequence && edit.key == 'remarks_final'">
|
||||
<v-textarea
|
||||
class="markdown"
|
||||
autofocus
|
||||
placeholder="Enter your text here"
|
||||
:disabled="loading"
|
||||
v-model="edit.value"
|
||||
>
|
||||
</v-textarea>
|
||||
</v-card-text>
|
||||
<v-card-text v-else v-html="$options.filters.markdown(sequenceData.remarks_final || '')">
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
|
||||
<v-data-table
|
||||
dense
|
||||
:headers="headers"
|
||||
@@ -201,6 +311,7 @@
|
||||
:loading="loading"
|
||||
fixed-header
|
||||
:footer-props='{itemsPerPageOptions: [ 10, 25, 50, 100, 500, -1 ]}'
|
||||
:show-first-last-page="true"
|
||||
@click:row="setActiveItem"
|
||||
@contextmenu:row="contextMenu"
|
||||
>
|
||||
@@ -352,6 +463,9 @@ export default {
|
||||
queuedReload: false,
|
||||
itemsPerPage: 25,
|
||||
|
||||
sequenceData: null,
|
||||
edit: null, // { sequence, key, value }
|
||||
|
||||
// Row highlighter
|
||||
activeItem: null,
|
||||
|
||||
@@ -362,7 +476,7 @@ export default {
|
||||
contextMenuItem: null
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
computed: {
|
||||
rows () {
|
||||
const rows = {};
|
||||
@@ -421,6 +535,26 @@ export default {
|
||||
},
|
||||
|
||||
watch: {
|
||||
|
||||
async edit (newVal, oldVal) {
|
||||
if (newVal === null && oldVal !== null) {
|
||||
const item = oldVal.sequence == this.sequenceData.sequence
|
||||
? this.sequenceData
|
||||
: null;
|
||||
if (item && item[oldVal.key] != oldVal.value) {
|
||||
if (await this.saveItem(oldVal)) {
|
||||
item[oldVal.key] = oldVal.value;
|
||||
} else {
|
||||
this.edit = oldVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
defaultSequence (sequenceNumber) {
|
||||
this.getSequenceData();
|
||||
},
|
||||
|
||||
options: {
|
||||
handler () {
|
||||
//this.getEvents();
|
||||
@@ -446,25 +580,31 @@ export default {
|
||||
} else {
|
||||
this.queuedReload = true;
|
||||
}
|
||||
} else if ((event.channel == "final_lines" || event.channel == "raw_lines") &&
|
||||
event.payload.schema == this.projectSchema &&
|
||||
this.sequenceData?.sequence &&
|
||||
(this.sequenceData.sequence == event.payload.old.sequence ||
|
||||
this.sequenceData.sequence == event.payload.new.sequence)) {
|
||||
this.getSequenceData();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
queuedReload (newVal, oldVal) {
|
||||
if (newVal && !oldVal && !this.loading) {
|
||||
this.getEvents();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
loading (newVal, oldVal) {
|
||||
if (!newVal && oldVal && this.queuedReload) {
|
||||
this.getEvents();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
itemsPerPage (newVal, oldVal) {
|
||||
localStorage.setItem(`dougal/prefs/${this.user?.name}/${this.$route.params.project}/${this.$options.name}/items-per-page`, newVal);
|
||||
},
|
||||
|
||||
|
||||
user (newVal, oldVal) {
|
||||
this.itemsPerPage = Number(localStorage.getItem(`dougal/prefs/${this.user?.name}/${this.$route.params.project}/${this.$options.name}/items-per-page`)) || 25;
|
||||
}
|
||||
@@ -549,6 +689,44 @@ export default {
|
||||
this.presetRemarks = await this.api([url]);
|
||||
},
|
||||
|
||||
async getSequenceData () {
|
||||
if (this.defaultSequence) {
|
||||
const url = `/project/${this.$route.params.project}/sequence?sequence=${this.defaultSequence}`;
|
||||
const res = await this.api([url]);
|
||||
this.sequenceData = res[0];
|
||||
} else {
|
||||
this.sequenceData = null;
|
||||
}
|
||||
},
|
||||
|
||||
editItem (item, key) {
|
||||
this.edit = {
|
||||
sequence: item.sequence,
|
||||
key,
|
||||
value: item[key]
|
||||
}
|
||||
},
|
||||
|
||||
async saveItem (edit) {
|
||||
if (!edit) return;
|
||||
|
||||
try {
|
||||
const url = `/project/${this.$route.params.project}/sequence/${edit.sequence}`;
|
||||
const init = {
|
||||
method: "PATCH",
|
||||
body: {
|
||||
[edit.key]: edit.value
|
||||
}
|
||||
};
|
||||
|
||||
let res;
|
||||
await this.api([url, init, (e, r) => res = r]);
|
||||
return res && res.ok;
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
newItem (from = {}) {
|
||||
const type = (from.sequence && from.point) ? "sequence" : "timed";
|
||||
const tstamp = from.tstamp || (new Date).toISOString();
|
||||
@@ -777,6 +955,7 @@ export default {
|
||||
this.getEventCount();
|
||||
this.getEvents();
|
||||
this.getPresetRemarks();
|
||||
this.getSequenceData();
|
||||
|
||||
window.addEventListener('keyup', this.handleKeyboardEvent);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user