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
|
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
|
- 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
|
todo: after attachments - DATADUMP - v7 wiki to RAVEN markdown
|
||||||
- https://rockfish.ayanova.com/default.htm#!/rfcaseEdit/3468
|
- https://rockfish.ayanova.com/default.htm#!/rfcaseEdit/3468
|
||||||
- Need to export images and attached docs as attachments
|
- Need to export images and attached docs as attachments
|
||||||
|
|||||||
@@ -12,14 +12,18 @@
|
|||||||
<v-tab-item key="list">
|
<v-tab-item key="list">
|
||||||
<div class="mt-4" :style="cardTextStyle()">
|
<div class="mt-4" :style="cardTextStyle()">
|
||||||
<v-list color="grey lighten-5" three-line>
|
<v-list color="grey lighten-5" three-line>
|
||||||
<v-list-item v-for="item in displayList" :key="item.id">
|
<v-list-item
|
||||||
<!-- @click="download(item.id)" -->
|
v-for="item in displayList"
|
||||||
|
:key="item.id"
|
||||||
|
:href="item.url"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
<v-list-item-avatar>
|
<v-list-item-avatar>
|
||||||
<v-icon v-text="item.icon"></v-icon>
|
<v-icon v-text="item.icon"></v-icon>
|
||||||
</v-list-item-avatar>
|
</v-list-item-avatar>
|
||||||
|
|
||||||
<v-list-item-content>
|
<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-list-item-subtitle
|
||||||
v-text="item.date"
|
v-text="item.date"
|
||||||
@@ -31,12 +35,9 @@
|
|||||||
</v-list-item-content>
|
</v-list-item-content>
|
||||||
|
|
||||||
<v-list-item-action>
|
<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-icon>fa-edit</v-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<v-btn @click="remove(item)" icon>
|
|
||||||
<v-icon>fa-trash</v-icon>
|
|
||||||
</v-btn>
|
|
||||||
</v-list-item-action>
|
</v-list-item-action>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
</v-list>
|
</v-list>
|
||||||
@@ -84,6 +85,9 @@
|
|||||||
></v-text-field>
|
></v-text-field>
|
||||||
</div>
|
</div>
|
||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
|
<v-btn @click="remove()" icon>
|
||||||
|
<v-icon>fa-trash</v-icon>
|
||||||
|
</v-btn>
|
||||||
<v-spacer></v-spacer>
|
<v-spacer></v-spacer>
|
||||||
<v-btn text @click="editMenu = false">{{ $ay.t("Cancel") }}</v-btn>
|
<v-btn text @click="editMenu = false">{{ $ay.t("Cancel") }}</v-btn>
|
||||||
<v-btn color="primary" text @click="saveEdit">{{
|
<v-btn color="primary" text @click="saveEdit">{{
|
||||||
@@ -102,7 +106,6 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
height: 300,
|
height: 300,
|
||||||
attachedFiles: [],
|
|
||||||
displayList: [],
|
displayList: [],
|
||||||
notes: null,
|
notes: null,
|
||||||
tab: null,
|
tab: null,
|
||||||
@@ -144,24 +147,27 @@ export default {
|
|||||||
window.$gz.errorHandler.handleFormError(res.error);
|
window.$gz.errorHandler.handleFormError(res.error);
|
||||||
} else {
|
} else {
|
||||||
vm.uploadFiles = [];
|
vm.uploadFiles = [];
|
||||||
vm.attachedFiles = res.data;
|
vm.updateDisplayList(res.data);
|
||||||
vm.updateDisplayList();
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(function handleUploadError(error) {
|
.catch(function handleUploadError(error) {
|
||||||
window.$gz.errorHandler.handleFormError(error);
|
window.$gz.errorHandler.handleFormError(error);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
remove(item) {
|
remove() {
|
||||||
let vm = this;
|
let vm = this;
|
||||||
window.$gz.dialog.confirmDelete().then(dialogResult => {
|
window.$gz.dialog.confirmDelete().then(dialogResult => {
|
||||||
if (dialogResult == true) {
|
if (dialogResult == true) {
|
||||||
window.$gz.api
|
window.$gz.api
|
||||||
.remove("Attachment/" + item.id)
|
.remove("Attachment/" + vm.editId)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.error) {
|
if (res.error) {
|
||||||
window.$gz.errorHandler.handleFormError(res.error);
|
window.$gz.errorHandler.handleFormError(res.error);
|
||||||
} else {
|
} else {
|
||||||
|
vm.editMenu = false;
|
||||||
|
vm.editName = null;
|
||||||
|
vm.editNotes = null;
|
||||||
|
vm.editId = null;
|
||||||
vm.getList();
|
vm.getList();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -179,35 +185,30 @@ export default {
|
|||||||
if (res.error) {
|
if (res.error) {
|
||||||
window.$gz.errorHandler.handleFormError(res.error);
|
window.$gz.errorHandler.handleFormError(res.error);
|
||||||
} else {
|
} else {
|
||||||
vm.attachedFiles = res.data;
|
vm.updateDisplayList(res.data);
|
||||||
vm.updateDisplayList();
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(function handleGetListError(error) {
|
.catch(function handleGetListError(error) {
|
||||||
window.$gz.errorHandler.handleFormError(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"}]}
|
//{"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) {
|
if (!data) {
|
||||||
this.attachedFiles = [];
|
data = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
let timeZoneName = window.$gz.locale.getBrowserTimeZoneName();
|
let timeZoneName = window.$gz.locale.getBrowserTimeZoneName();
|
||||||
let languageName = window.$gz.locale.getBrowserLanguages();
|
let languageName = window.$gz.locale.getBrowserLanguages();
|
||||||
let hour12 = window.$gz.store.state.locale.hour12;
|
let hour12 = window.$gz.store.state.locale.hour12;
|
||||||
let ret = [];
|
let ret = [];
|
||||||
for (let i = 0; i < this.attachedFiles.length; i++) {
|
for (let i = 0; i < data.length; i++) {
|
||||||
let o = this.attachedFiles[i];
|
let o = data[i];
|
||||||
//http://localhost:7575/api/v8/Attachment/download/100?t=sssss
|
//http://localhost:7575/api/v8/Attachment/download/100?t=sssss
|
||||||
ret.push({
|
ret.push({
|
||||||
id: o.id,
|
id: o.id,
|
||||||
title:
|
concurrencyToken: o.concurrencyToken,
|
||||||
"<a href='" +
|
url: window.$gz.api.downloadUrl(o.id),
|
||||||
window.$gz.api.downloadUrl(o.id) +
|
|
||||||
"' target='_blank'>" +
|
|
||||||
o.displayFileName +
|
|
||||||
"</a>",
|
|
||||||
name: o.displayFileName,
|
name: o.displayFileName,
|
||||||
date: window.$gz.locale.utcDateToShortDateAndTimeLocalized(
|
date: window.$gz.locale.utcDateToShortDateAndTimeLocalized(
|
||||||
o.lastModified,
|
o.lastModified,
|
||||||
@@ -242,7 +243,8 @@ export default {
|
|||||||
}
|
}
|
||||||
//check if they differ first
|
//check if they differ first
|
||||||
let o = null;
|
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) {
|
if (vm.displayList[i].id == vm.editId) {
|
||||||
o = vm.displayList[i];
|
o = vm.displayList[i];
|
||||||
break;
|
break;
|
||||||
@@ -254,16 +256,36 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//post to server
|
//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
|
public uint ConcurrencyToken { get; set; }
|
||||||
//get called from all routes that return a list? **BETTER IDEA!**
|
[Required]
|
||||||
//todo: MAKE A PUT ROUTE then POST THIS
|
public string DisplayFileName { get; set; }
|
||||||
|
public string Notes { get; set; }
|
||||||
|
*/
|
||||||
|
|
||||||
//Update item in list
|
let p = {
|
||||||
//(attempting to cheat here, rather than refresh the whole list from server)
|
concurrencyToken: o.concurrencyToken,
|
||||||
//but I do like a clean refresh so if this doesn't work then just call get list
|
displayFileName: vm.editName,
|
||||||
o.name = vm.editName;
|
notes: vm.editNotes
|
||||||
o.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