From 102599098774905545a0ebb641d9a22ff62620d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Cabrera?= Date: Thu, 24 Jun 2021 22:37:26 -0500 Subject: [PATCH 1/3] Fix: Save and update endpoint descriptions from collections --- src/renderer/layouts/shared/AsideView.vue | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/renderer/layouts/shared/AsideView.vue b/src/renderer/layouts/shared/AsideView.vue index 1fb8a7a..a65adcf 100644 --- a/src/renderer/layouts/shared/AsideView.vue +++ b/src/renderer/layouts/shared/AsideView.vue @@ -53,12 +53,29 @@ export default { }), methods: { ...mapMutations(['openEndpointFromCollection']), + searchTree(element, elementId) { + if (element.id === elementId) { + return element; + } else if (element.children != null) { + let result = null; + for (let i = 0; result == null && i < element.children.length; i++) { + result = this.searchTree(element.children[i], elementId); + } + return result; + } + return null; + }, activeItem(item) { const itemSelected = item[0]; if (itemSelected && itemSelected.type === 'endpoint') { + let endpointTemp = null; + for (const collection of this.connection.collections) { + endpointTemp = this.searchTree(collection, itemSelected.id); + if (endpointTemp) break; + } this.openEndpointFromCollection({ connectionName: this.connection.title, - endpoint: itemSelected + endpoint: endpointTemp }); this.$root.$emit('updateSelectedTab', { ...itemSelected }); } @@ -77,7 +94,8 @@ export default { .v-treeview-node__prepend { min-width: auto; } + .v-application--is-ltr .v-treeview-node__prepend { margin-right: 0; } - \ No newline at end of file + From 1bf0a2d776c93428f6ce2072c7e823f1260880d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Cabrera?= Date: Thu, 24 Jun 2021 23:48:49 -0500 Subject: [PATCH 2/3] Fix: Load content of description in SaveEndpoint Modal --- package.json | 2 +- src/renderer/components/DdpClient/DdpEndpoint.vue | 5 ++++- .../components/Utilities/Modals/ModalQuestion.vue | 2 +- src/renderer/store/modules/Connections/mutations.js | 2 +- yarn.lock | 8 ++++---- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 8121d79..c75be4c 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,7 @@ "vue-router": "^3.0.1", "vue-simplemde": "^2.0.0", "vue-split-panel": "^1.0.4", - "vuetify": "^2.4.6", + "vuetify": "^2.5.5", "vuex": "^3.0.1", "vuex-electron": "^1.0.3", "ws": "^7.3.1" diff --git a/src/renderer/components/DdpClient/DdpEndpoint.vue b/src/renderer/components/DdpClient/DdpEndpoint.vue index 5d857e6..386ffb0 100644 --- a/src/renderer/components/DdpClient/DdpEndpoint.vue +++ b/src/renderer/components/DdpClient/DdpEndpoint.vue @@ -252,8 +252,10 @@ export default { }, openSaveEndpoint() { this.$refs.saveEndpointRef.title = 'Save endpoint'; - this.$refs.folderSelectedRef.initializeCurrentLocation(this.endpoint.id); this.$refs.saveEndpointRef.dialog = true; + setTimeout(() => { + this.$refs.folderSelectedRef.initializeCurrentLocation(this.endpoint.id); + }, 100); }, validateEndpointToBeSaved() { let isValid = true; @@ -269,6 +271,7 @@ export default { }, saveEndpoint() { if (this.validateEndpointToBeSaved()) {//TODO: Implement vee-validate + this.saveDescription(); this.saveOpenEndpointInCollection({ connectionName: this.ddpConnection.title, openEndpoint: this.endpoint, diff --git a/src/renderer/components/Utilities/Modals/ModalQuestion.vue b/src/renderer/components/Utilities/Modals/ModalQuestion.vue index c898f6d..3957328 100644 --- a/src/renderer/components/Utilities/Modals/ModalQuestion.vue +++ b/src/renderer/components/Utilities/Modals/ModalQuestion.vue @@ -1,5 +1,5 @@ @@ -144,10 +146,11 @@ export default { }, exportCollection() { console.log('Export collection'); - let link = document.createElement('a'); - link.href = 'data:application/json;charset=UTF-8,' + escape(JSON.stringify(this.element)); - link.download = this.element.name + '.json'; - link.click(); + const dataStr = 'data:text/json;charset=utf-8,' + encodeURIComponent(JSON.stringify(this.element)); + const downloadElement = document.getElementById('downloadCollection'); + downloadElement.setAttribute('href', dataStr); + downloadElement.setAttribute('download', this.element.name + '.json'); + downloadElement.click(); }, removeCollection() { if (this.$parent.level === 0) { diff --git a/src/renderer/components/Collections/ImportCollections.vue b/src/renderer/components/Collections/ImportCollections.vue index ff690e2..ab1cecd 100644 --- a/src/renderer/components/Collections/ImportCollections.vue +++ b/src/renderer/components/Collections/ImportCollections.vue @@ -75,4 +75,4 @@ export default { \ No newline at end of file +