mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
because of 4ab9056700 pinned property can't be deleted (will get overwritten by the original value) so work around that with boolean values that are later removed if false
This commit is contained in:
@@ -86,6 +86,12 @@ export default {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (payload[k].place) {
|
||||
Object.values(payload[k].place).forEach(place => {
|
||||
if (place.pinned === false)
|
||||
delete place.pinned;
|
||||
});
|
||||
}
|
||||
payload[k].widgetid = k;
|
||||
}
|
||||
this.$api
|
||||
|
||||
@@ -74,6 +74,12 @@ export default {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (payload[k].place) {
|
||||
Object.values(payload[k].place).forEach(place => {
|
||||
if (place.pinned === false)
|
||||
delete place.pinned;
|
||||
});
|
||||
}
|
||||
payload[k].widgetid = k;
|
||||
}
|
||||
this.$api
|
||||
|
||||
@@ -118,11 +118,11 @@ export default {
|
||||
// Unpinning is only possible in edit mode
|
||||
if (!this.editMode)
|
||||
return;
|
||||
let result = { item: this.item_data, x: this.item_data.x, y: this.item_data.y };
|
||||
let result = { item: this.item_data, pinned: false };
|
||||
this.$emit('unPinItem', [result]);
|
||||
},
|
||||
pinItem() {
|
||||
let result = { item: this.item_data, x: this.item_data.x, y: this.item_data.y };
|
||||
let result = { item: this.item_data, pinned: true };
|
||||
this.$emit('pinItem', [result]);
|
||||
},
|
||||
getWidgetC4Link(widget) {
|
||||
|
||||
@@ -155,20 +155,22 @@ export default {
|
||||
payload[item.id] = { config };
|
||||
this.updatePreset(payload);
|
||||
},
|
||||
updatePositions(updated, pinned=false) {
|
||||
updatePositions(updated) {
|
||||
let result = {};
|
||||
updated.forEach(update => {
|
||||
|
||||
let item = structuredClone(ObjectUtils.deepToRaw(update.item));
|
||||
|
||||
if (!item.placeholder) {
|
||||
if (!item.place[this.gridWidth])
|
||||
item.place[this.gridWidth] = {x: 0, y: 0, w: 1, h: 1};
|
||||
item.place[this.gridWidth] = { x: 0, y: 0, w: 1, h: 1 };
|
||||
|
||||
delete item.x;
|
||||
delete item.y;
|
||||
delete item.w;
|
||||
delete item.h;
|
||||
delete item.place[this.gridWidth].pinned;
|
||||
delete item.pinned;
|
||||
delete item.weight;
|
||||
|
||||
if (update.x !== undefined)
|
||||
item.place[this.gridWidth].x = update.x;
|
||||
if (update.y !== undefined)
|
||||
@@ -177,9 +179,8 @@ export default {
|
||||
item.place[this.gridWidth].w = update.w;
|
||||
if (update.h !== undefined)
|
||||
item.place[this.gridWidth].h = update.h;
|
||||
if (pinned) {
|
||||
item.place[this.gridWidth].pinned = true;
|
||||
}
|
||||
if (update.pinned !== undefined)
|
||||
item.place[this.gridWidth].pinned = update.pinned;
|
||||
|
||||
result[item.id] = item;
|
||||
}
|
||||
@@ -250,8 +251,8 @@ export default {
|
||||
@remove="removeWidget(item, $event)"
|
||||
@config-opened="handleConfigOpened"
|
||||
@config-closed="handleConfigClosed"
|
||||
@pinItem="updatePositions($event,true)"
|
||||
@unPinItem="updatePositions"
|
||||
@pin-item="updatePositions"
|
||||
@un-pin-item="updatePositions"
|
||||
></dashboard-item>
|
||||
</template>
|
||||
</drop-grid>
|
||||
|
||||
Reference in New Issue
Block a user