Frontend: Fix album events and clipboard

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
Michael Mayer 2020-06-02 16:34:45 +02:00
parent bf7bb5006b
commit c2adaa5752
4 changed files with 17 additions and 6 deletions

View file

@ -120,8 +120,10 @@ class Clipboard {
return;
}
const id = model.getId();
this.removeId(model.getId());
}
removeId(id) {
if (!this.hasId(id)) return;
const index = this.selection.indexOf(id);

View file

@ -372,9 +372,12 @@
for (let i = 0; i < data.entities.length; i++) {
const uid = data.entities[i];
const index = this.results.findIndex((m) => m.UID === uid);
if (index >= 0) {
this.results.splice(index, 1);
}
this.$clipboard.removeId(uid);
}
break;

View file

@ -38,7 +38,7 @@
<v-icon>cloud_upload</v-icon>
</v-btn>
<v-btn icon @click.prevent="create" class="action-add">
<v-btn icon @click.prevent="create" class="action-add" v-if="staticFilter.type === 'album'">
<v-icon>add</v-icon>
</v-btn>
</v-toolbar>
@ -487,9 +487,11 @@
const values = data.entities[i];
const model = this.results.find((m) => m.UID === values.UID);
for (let key in values) {
if (values.hasOwnProperty(key)) {
model[key] = values[key];
if (model) {
for (let key in values) {
if (values.hasOwnProperty(key) && values[key] != null && typeof values[key] !== "object") {
model[key] = values[key];
}
}
}
}
@ -515,7 +517,8 @@
for (let i = 0; i < data.entities.length; i++) {
const values = data.entities[i];
const index = this.results.findIndex((m) => m.UID === values.UID);
if (index === -1) {
if (index === -1 && this.staticFilter.type === values.Type) {
this.results.unshift(new Album(values));
}
}

View file

@ -377,9 +377,12 @@
for (let i = 0; i < data.entities.length; i++) {
const uid = data.entities[i];
const index = this.results.findIndex((m) => m.UID === uid);
if (index >= 0) {
this.results.splice(index, 1);
}
this.$clipboard.removeId(uid);
}
break;