mirror of
				https://github.com/Fabio286/antares.git
				synced 2025-06-05 21:59:22 +02:00 
			
		
		
		
	refactor: improvements to edit connection modal
This commit is contained in:
		| @@ -58,7 +58,6 @@ | |||||||
|     "pg": "^8.3.3", |     "pg": "^8.3.3", | ||||||
|     "source-map-support": "^0.5.16", |     "source-map-support": "^0.5.16", | ||||||
|     "spectre.css": "^0.5.9", |     "spectre.css": "^0.5.9", | ||||||
|     "vue-click-outside": "^1.1.0", |  | ||||||
|     "vue-i18n": "^8.21.0", |     "vue-i18n": "^8.21.0", | ||||||
|     "vue-the-mask": "^0.11.1", |     "vue-the-mask": "^0.11.1", | ||||||
|     "vuedraggable": "^2.24.1", |     "vuedraggable": "^2.24.1", | ||||||
|   | |||||||
| @@ -16,7 +16,6 @@ | |||||||
|          <TheFooter /> |          <TheFooter /> | ||||||
|          <TheNotificationsBoard /> |          <TheNotificationsBoard /> | ||||||
|          <ModalNewConnection v-if="isNewConnModal" /> |          <ModalNewConnection v-if="isNewConnModal" /> | ||||||
|          <ModalEditConnection v-if="isEditModal" /> |  | ||||||
|          <ModalSettings v-if="isSettingModal" /> |          <ModalSettings v-if="isSettingModal" /> | ||||||
|       </div> |       </div> | ||||||
|    </div> |    </div> | ||||||
| @@ -36,7 +35,6 @@ export default { | |||||||
|       TheAppWelcome: () => import(/* webpackChunkName: "TheAppWelcome" */'@/components/TheAppWelcome'), |       TheAppWelcome: () => import(/* webpackChunkName: "TheAppWelcome" */'@/components/TheAppWelcome'), | ||||||
|       Workspace: () => import(/* webpackChunkName: "Workspace" */'@/components/Workspace'), |       Workspace: () => import(/* webpackChunkName: "Workspace" */'@/components/Workspace'), | ||||||
|       ModalNewConnection: () => import(/* webpackChunkName: "ModalNewConnection" */'@/components/ModalNewConnection'), |       ModalNewConnection: () => import(/* webpackChunkName: "ModalNewConnection" */'@/components/ModalNewConnection'), | ||||||
|       ModalEditConnection: () => import(/* webpackChunkName: "ModalEditConnection" */'@/components/ModalEditConnection'), |  | ||||||
|       ModalSettings: () => import(/* webpackChunkName: "ModalSettings" */'@/components/ModalSettings') |       ModalSettings: () => import(/* webpackChunkName: "ModalSettings" */'@/components/ModalSettings') | ||||||
|    }, |    }, | ||||||
|    data () { |    data () { | ||||||
|   | |||||||
| @@ -15,13 +15,8 @@ | |||||||
| </template> | </template> | ||||||
|  |  | ||||||
| <script> | <script> | ||||||
| import ClickOutside from 'vue-click-outside'; |  | ||||||
|  |  | ||||||
| export default { | export default { | ||||||
|    name: 'BaseContextMenu', |    name: 'BaseContextMenu', | ||||||
|    directives: { |  | ||||||
|       ClickOutside |  | ||||||
|    }, |  | ||||||
|    props: { |    props: { | ||||||
|       contextEvent: MouseEvent |       contextEvent: MouseEvent | ||||||
|    }, |    }, | ||||||
|   | |||||||
| @@ -180,7 +180,6 @@ export default { | |||||||
|    }, |    }, | ||||||
|    methods: { |    methods: { | ||||||
|       ...mapActions({ |       ...mapActions({ | ||||||
|          closeModal: 'application/hideEditConnModal', |  | ||||||
|          editConnection: 'connections/editConnection' |          editConnection: 'connections/editConnection' | ||||||
|       }), |       }), | ||||||
|       async startTest () { |       async startTest () { | ||||||
| @@ -231,6 +230,9 @@ export default { | |||||||
|          this.isTesting = false; |          this.isTesting = false; | ||||||
|          this.isAsking = false; |          this.isAsking = false; | ||||||
|       }, |       }, | ||||||
|  |       closeModal () { | ||||||
|  |          this.$emit('close'); | ||||||
|  |       }, | ||||||
|       onKey (e) { |       onKey (e) { | ||||||
|          e.stopPropagation(); |          e.stopPropagation(); | ||||||
|          if (e.key === 'Escape') |          if (e.key === 'Escape') | ||||||
|   | |||||||
| @@ -10,9 +10,10 @@ | |||||||
|          <span class="d-flex"><i class="mdi mdi-18px mdi-delete text-light pr-1" /> {{ $t('word.delete') }}</span> |          <span class="d-flex"><i class="mdi mdi-18px mdi-delete text-light pr-1" /> {{ $t('word.delete') }}</span> | ||||||
|       </div> |       </div> | ||||||
|  |  | ||||||
|  |       <ModalEditConnection v-if="isEditModal" @close="hideEditModal" /> | ||||||
|       <ConfirmModal |       <ConfirmModal | ||||||
|          v-if="isConfirmModal" |          v-if="isConfirmModal" | ||||||
|          @confirm="deleteConnection(contextConnection)" |          @confirm="confirmDeleteConnection" | ||||||
|          @hide="hideConfirmModal" |          @hide="hideConfirmModal" | ||||||
|       > |       > | ||||||
|          <template :slot="'header'"> |          <template :slot="'header'"> | ||||||
| @@ -33,11 +34,13 @@ | |||||||
| import { mapActions, mapGetters } from 'vuex'; | import { mapActions, mapGetters } from 'vuex'; | ||||||
| import BaseContextMenu from '@/components/BaseContextMenu'; | import BaseContextMenu from '@/components/BaseContextMenu'; | ||||||
| import ConfirmModal from '@/components/BaseConfirmModal'; | import ConfirmModal from '@/components/BaseConfirmModal'; | ||||||
|  | import ModalEditConnection from '@/components/ModalEditConnection'; | ||||||
|  |  | ||||||
| export default { | export default { | ||||||
|    name: 'SettingBarContext', |    name: 'SettingBarContext', | ||||||
|    components: { |    components: { | ||||||
|       BaseContextMenu, |       BaseContextMenu, | ||||||
|  |       ModalEditConnection, | ||||||
|       ConfirmModal |       ConfirmModal | ||||||
|    }, |    }, | ||||||
|    props: { |    props: { | ||||||
| @@ -46,7 +49,8 @@ export default { | |||||||
|    }, |    }, | ||||||
|    data () { |    data () { | ||||||
|       return { |       return { | ||||||
|          isConfirmModal: false |          isConfirmModal: false, | ||||||
|  |          isEditModal: false | ||||||
|       }; |       }; | ||||||
|    }, |    }, | ||||||
|    computed: { |    computed: { | ||||||
| @@ -59,14 +63,27 @@ export default { | |||||||
|    }, |    }, | ||||||
|    methods: { |    methods: { | ||||||
|       ...mapActions({ |       ...mapActions({ | ||||||
|          deleteConnection: 'connections/deleteConnection', |          deleteConnection: 'connections/deleteConnection' | ||||||
|          showEditModal: 'application/showEditConnModal' |  | ||||||
|       }), |       }), | ||||||
|  |       confirmDeleteConnection () { | ||||||
|  |          this.deleteConnection(this.contextConnection); | ||||||
|  |          this.$emit('close-context'); | ||||||
|  |       }, | ||||||
|  |       showEditModal () { | ||||||
|  |          this.isEditModal = true; | ||||||
|  |       }, | ||||||
|  |       hideEditModal () { | ||||||
|  |          this.isEditModal = false; | ||||||
|  |          this.closeContext(); | ||||||
|  |       }, | ||||||
|       showConfirmModal () { |       showConfirmModal () { | ||||||
|          this.isConfirmModal = true; |          this.isConfirmModal = true; | ||||||
|       }, |       }, | ||||||
|       hideConfirmModal () { |       hideConfirmModal () { | ||||||
|          this.isConfirmModal = false; |          this.isConfirmModal = false; | ||||||
|  |       }, | ||||||
|  |       closeContext () { | ||||||
|  |          this.$emit('close-context'); | ||||||
|       } |       } | ||||||
|    } |    } | ||||||
| }; | }; | ||||||
|   | |||||||
| @@ -7,7 +7,6 @@ export default { | |||||||
|       app_version: process.env.PACKAGE_VERSION || 0, |       app_version: process.env.PACKAGE_VERSION || 0, | ||||||
|       is_loading: false, |       is_loading: false, | ||||||
|       is_new_modal: false, |       is_new_modal: false, | ||||||
|       is_edit_modal: false, |  | ||||||
|       is_setting_modal: false, |       is_setting_modal: false, | ||||||
|       selected_setting_tab: 'general', |       selected_setting_tab: 'general', | ||||||
|       selected_conection: {}, |       selected_conection: {}, | ||||||
| @@ -20,7 +19,6 @@ export default { | |||||||
|       appVersion: state => state.app_version, |       appVersion: state => state.app_version, | ||||||
|       getSelectedConnection: state => state.selected_conection, |       getSelectedConnection: state => state.selected_conection, | ||||||
|       isNewModal: state => state.is_new_modal, |       isNewModal: state => state.is_new_modal, | ||||||
|       isEditModal: state => state.is_edit_modal, |  | ||||||
|       isSettingModal: state => state.is_setting_modal, |       isSettingModal: state => state.is_setting_modal, | ||||||
|       selectedSettingTab: state => state.selected_setting_tab, |       selectedSettingTab: state => state.selected_setting_tab, | ||||||
|       getUpdateStatus: state => state.update_status, |       getUpdateStatus: state => state.update_status, | ||||||
| @@ -36,13 +34,6 @@ export default { | |||||||
|       HIDE_NEW_CONNECTION_MODAL (state) { |       HIDE_NEW_CONNECTION_MODAL (state) { | ||||||
|          state.is_new_modal = false; |          state.is_new_modal = false; | ||||||
|       }, |       }, | ||||||
|       SHOW_EDIT_CONNECTION_MODAL (state, connection) { |  | ||||||
|          state.is_edit_modal = true; |  | ||||||
|          state.selected_conection = connection; |  | ||||||
|       }, |  | ||||||
|       HIDE_EDIT_CONNECTION_MODAL (state) { |  | ||||||
|          state.is_edit_modal = false; |  | ||||||
|       }, |  | ||||||
|       SHOW_SETTING_MODAL (state, tab) { |       SHOW_SETTING_MODAL (state, tab) { | ||||||
|          state.selected_setting_tab = tab; |          state.selected_setting_tab = tab; | ||||||
|          state.is_setting_modal = true; |          state.is_setting_modal = true; | ||||||
| @@ -68,12 +59,6 @@ export default { | |||||||
|       hideNewConnModal ({ commit }) { |       hideNewConnModal ({ commit }) { | ||||||
|          commit('HIDE_NEW_CONNECTION_MODAL'); |          commit('HIDE_NEW_CONNECTION_MODAL'); | ||||||
|       }, |       }, | ||||||
|       showEditConnModal ({ commit }, connection) { |  | ||||||
|          commit('SHOW_EDIT_CONNECTION_MODAL', connection); |  | ||||||
|       }, |  | ||||||
|       hideEditConnModal ({ commit }) { |  | ||||||
|          commit('HIDE_EDIT_CONNECTION_MODAL'); |  | ||||||
|       }, |  | ||||||
|       showSettingModal ({ commit }, tab) { |       showSettingModal ({ commit }, tab) { | ||||||
|          commit('SHOW_SETTING_MODAL', tab); |          commit('SHOW_SETTING_MODAL', tab); | ||||||
|       }, |       }, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user