This commit is contained in:
@@ -114,6 +114,8 @@ todo: after attachments - integration tests update
|
||||
todo: THIS! At this point, upload to dev server and thoroughly test with devices, it seems a bit slow at times
|
||||
- Might need to hide attachments until user clicks on something to reveal as it seems odd to fetch every open
|
||||
|
||||
todo: careful and thorough PERF tests remotely and local
|
||||
|
||||
todo: after attachments - DATADUMP - v7 wiki to RAVEN markdown
|
||||
- https://rockfish.ayanova.com/default.htm#!/rfcaseEdit/3468
|
||||
- Need to export images and attached docs as attachments
|
||||
|
||||
@@ -12,14 +12,18 @@
|
||||
<v-tab-item key="list">
|
||||
<div class="mt-4" :style="cardTextStyle()">
|
||||
<v-list color="grey lighten-5" three-line>
|
||||
<v-list-item v-for="item in displayList" :key="item.id">
|
||||
<!-- @click="download(item.id)" -->
|
||||
<v-list-item
|
||||
v-for="item in displayList"
|
||||
:key="item.id"
|
||||
:href="item.url"
|
||||
target="_blank"
|
||||
>
|
||||
<v-list-item-avatar>
|
||||
<v-icon v-text="item.icon"></v-icon>
|
||||
</v-list-item-avatar>
|
||||
|
||||
<v-list-item-content>
|
||||
<v-list-item-title v-html="item.title"></v-list-item-title>
|
||||
<v-list-item-title v-text="item.name"></v-list-item-title>
|
||||
|
||||
<v-list-item-subtitle
|
||||
v-text="item.date"
|
||||
@@ -31,12 +35,9 @@
|
||||
</v-list-item-content>
|
||||
|
||||
<v-list-item-action>
|
||||
<v-btn @click="openEditMenu(item, $event)" icon>
|
||||
<v-btn large @click="openEditMenu(item, $event)" icon>
|
||||
<v-icon>fa-edit</v-icon>
|
||||
</v-btn>
|
||||
<v-btn @click="remove(item)" icon>
|
||||
<v-icon>fa-trash</v-icon>
|
||||
</v-btn>
|
||||
</v-list-item-action>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
@@ -84,6 +85,9 @@
|
||||
></v-text-field>
|
||||
</div>
|
||||
<v-card-actions>
|
||||
<v-btn @click="remove()" icon>
|
||||
<v-icon>fa-trash</v-icon>
|
||||
</v-btn>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn text @click="editMenu = false">{{ $ay.t("Cancel") }}</v-btn>
|
||||
<v-btn color="primary" text @click="saveEdit">{{
|
||||
@@ -102,7 +106,6 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
height: 300,
|
||||
attachedFiles: [],
|
||||
displayList: [],
|
||||
notes: null,
|
||||
tab: null,
|
||||
@@ -144,24 +147,27 @@ export default {
|
||||
window.$gz.errorHandler.handleFormError(res.error);
|
||||
} else {
|
||||
vm.uploadFiles = [];
|
||||
vm.attachedFiles = res.data;
|
||||
vm.updateDisplayList();
|
||||
vm.updateDisplayList(res.data);
|
||||
}
|
||||
})
|
||||
.catch(function handleUploadError(error) {
|
||||
window.$gz.errorHandler.handleFormError(error);
|
||||
});
|
||||
},
|
||||
remove(item) {
|
||||
remove() {
|
||||
let vm = this;
|
||||
window.$gz.dialog.confirmDelete().then(dialogResult => {
|
||||
if (dialogResult == true) {
|
||||
window.$gz.api
|
||||
.remove("Attachment/" + item.id)
|
||||
.remove("Attachment/" + vm.editId)
|
||||
.then(res => {
|
||||
if (res.error) {
|
||||
window.$gz.errorHandler.handleFormError(res.error);
|
||||
} else {
|
||||
vm.editMenu = false;
|
||||
vm.editName = null;
|
||||
vm.editNotes = null;
|
||||
vm.editId = null;
|
||||
vm.getList();
|
||||
}
|
||||
})
|
||||
@@ -179,35 +185,30 @@ export default {
|
||||
if (res.error) {
|
||||
window.$gz.errorHandler.handleFormError(res.error);
|
||||
} else {
|
||||
vm.attachedFiles = res.data;
|
||||
vm.updateDisplayList();
|
||||
vm.updateDisplayList(res.data);
|
||||
}
|
||||
})
|
||||
.catch(function handleGetListError(error) {
|
||||
window.$gz.errorHandler.handleFormError(error);
|
||||
});
|
||||
},
|
||||
updateDisplayList() {
|
||||
updateDisplayList(data) {
|
||||
//{"data":[{"id":1,"concurrencyToken":7733332,"contentType":"image/png","displayFileName":"Screen Shot 2020-01-09 at 10.50.24.png","lastModified":"0001-01-01T00:00:00Z","notes":"Here are notes"},{"id":4,"concurrencyToken":7733354,"contentType":"text/plain","displayFileName":"TNT log file ayanova.txt","lastModified":"0001-01-01T00:00:00Z","notes":"Here are notes"},{"id":2,"concurrencyToken":7733342,"contentType":"text/plain","displayFileName":"stack.txt","lastModified":"0001-01-01T00:00:00Z","notes":"Here are notes"},{"id":3,"concurrencyToken":7733348,"contentType":"image/jpeg","displayFileName":"t2cx6sloffk41.jpg","lastModified":"0001-01-01T00:00:00Z","notes":"Here are notes"}]}
|
||||
if (!this.attachedFiles) {
|
||||
this.attachedFiles = [];
|
||||
if (!data) {
|
||||
data = [];
|
||||
}
|
||||
|
||||
let timeZoneName = window.$gz.locale.getBrowserTimeZoneName();
|
||||
let languageName = window.$gz.locale.getBrowserLanguages();
|
||||
let hour12 = window.$gz.store.state.locale.hour12;
|
||||
let ret = [];
|
||||
for (let i = 0; i < this.attachedFiles.length; i++) {
|
||||
let o = this.attachedFiles[i];
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
let o = data[i];
|
||||
//http://localhost:7575/api/v8/Attachment/download/100?t=sssss
|
||||
ret.push({
|
||||
id: o.id,
|
||||
title:
|
||||
"<a href='" +
|
||||
window.$gz.api.downloadUrl(o.id) +
|
||||
"' target='_blank'>" +
|
||||
o.displayFileName +
|
||||
"</a>",
|
||||
concurrencyToken: o.concurrencyToken,
|
||||
url: window.$gz.api.downloadUrl(o.id),
|
||||
name: o.displayFileName,
|
||||
date: window.$gz.locale.utcDateToShortDateAndTimeLocalized(
|
||||
o.lastModified,
|
||||
@@ -242,7 +243,8 @@ export default {
|
||||
}
|
||||
//check if they differ first
|
||||
let o = null;
|
||||
for (let i = 0; i < vm.displayList.length; i++) {
|
||||
let i = 0;
|
||||
for (i = 0; i < vm.displayList.length; i++) {
|
||||
if (vm.displayList[i].id == vm.editId) {
|
||||
o = vm.displayList[i];
|
||||
break;
|
||||
@@ -254,16 +256,36 @@ export default {
|
||||
}
|
||||
|
||||
//post to server
|
||||
//get concurrency token for PUT from master list?
|
||||
//or do away with master list and just have updateDisplayList become createDisplayList (and it adds concurrency token) and
|
||||
//get called from all routes that return a list? **BETTER IDEA!**
|
||||
//todo: MAKE A PUT ROUTE then POST THIS
|
||||
/*
|
||||
public uint ConcurrencyToken { get; set; }
|
||||
[Required]
|
||||
public string DisplayFileName { get; set; }
|
||||
public string Notes { get; set; }
|
||||
*/
|
||||
|
||||
//Update item in list
|
||||
//(attempting to cheat here, rather than refresh the whole list from server)
|
||||
//but I do like a clean refresh so if this doesn't work then just call get list
|
||||
o.name = vm.editName;
|
||||
o.notes = vm.editNotes;
|
||||
let p = {
|
||||
concurrencyToken: o.concurrencyToken,
|
||||
displayFileName: vm.editName,
|
||||
notes: vm.editNotes
|
||||
};
|
||||
|
||||
window.$gz.api
|
||||
.upsert("Attachment/" + vm.editId, p)
|
||||
.then(res => {
|
||||
if (res.error) {
|
||||
window.$gz.errorHandler.handleFormError(res.error);
|
||||
} else {
|
||||
vm.editMenu = false;
|
||||
vm.editName = null;
|
||||
vm.editNotes = null;
|
||||
vm.editId = null;
|
||||
//due to fucking reactivity issues which never seem to resolve no matter what I'm returning a fresh list on update
|
||||
vm.updateDisplayList(res.data);
|
||||
}
|
||||
})
|
||||
.catch(function handleUploadError(error) {
|
||||
window.$gz.errorHandler.handleFormError(error);
|
||||
});
|
||||
}
|
||||
//-----
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user