diff --git a/src/modules/modals/Modals.vue b/src/modules/modals/Modals.vue index 718097eca..14ca45c32 100644 --- a/src/modules/modals/Modals.vue +++ b/src/modules/modals/Modals.vue @@ -39,6 +39,7 @@ + @@ -60,6 +61,7 @@ import EditTable from './EditTable.vue' import EditContext from './EditContext.vue' import TransferTable from './TransferTable.vue' import CreateContext from './CreateContext.vue' +import TransferContext from './TransferContext.vue' export default { components: { @@ -78,6 +80,7 @@ export default { TransferTable, CreateContext, EditContext, + TransferContext, }, data() { @@ -98,6 +101,7 @@ export default { editTable: null, editContext: null, tableToTransfer: null, + contextToTransfer: null, } }, @@ -138,6 +142,7 @@ export default { // context subscribe('tables:context:create', () => { this.showModalCreateContext = true }) subscribe('tables:context:edit', contextId => { this.editContext = contextId }) + subscribe('tables:context:transfer', context => { this.contextToTransfer = context }) }, unmounted() { @@ -165,6 +170,7 @@ export default { unsubscribe('tables:table:transfer', table => { this.tableToTransfer = table }) unsubscribe('tables:context:create', () => { this.showModalCreateContext = true }) unsubscribe('tables:context:edit', contextId => { this.editContext = contextId }) + unsubscribe('tables:context:transfer', context => { this.contextToTransfer = context }) }, } diff --git a/src/modules/modals/TransferContext.vue b/src/modules/modals/TransferContext.vue new file mode 100644 index 000000000..a3028aadb --- /dev/null +++ b/src/modules/modals/TransferContext.vue @@ -0,0 +1,89 @@ + + + diff --git a/src/modules/navigation/partials/NavigationContextItem.vue b/src/modules/navigation/partials/NavigationContextItem.vue index 6170351c2..13ddd86a3 100644 --- a/src/modules/navigation/partials/NavigationContextItem.vue +++ b/src/modules/navigation/partials/NavigationContextItem.vue @@ -17,6 +17,12 @@ {{ t('tables', 'Edit application') }} + + + {{ t('tables', 'Transfer application') }} + @@ -27,6 +33,7 @@ import { mapGetters } from 'vuex' import TableIcon from 'vue-material-design-icons/Table.vue' import { emit } from '@nextcloud/event-bus' import PlaylistEdit from 'vue-material-design-icons/PlaylistEdit.vue' +import FileSwap from 'vue-material-design-icons/FileSwap.vue' import permissionsMixin from '../../../shared/components/ncTable/mixins/permissionsMixin.js' import svgHelper from '../../../shared/components/ncIconPicker/mixins/svgHelper.js' @@ -35,6 +42,7 @@ export default { components: { PlaylistEdit, + FileSwap, TableIcon, NcIconSvgWrapper, NcAppNavigationItem, @@ -73,6 +81,9 @@ export default { async editContext() { emit('tables:context:edit', this.context.id) }, + async transferContext() { + emit('tables:context:transfer', this.context) + }, }, } diff --git a/src/shared/components/ncUserAndGroupPicker/NcUserAndGroupPicker.vue b/src/shared/components/ncUserAndGroupPicker/NcUserAndGroupPicker.vue index 151452ad6..7289af1a2 100644 --- a/src/shared/components/ncUserAndGroupPicker/NcUserAndGroupPicker.vue +++ b/src/shared/components/ncUserAndGroupPicker/NcUserAndGroupPicker.vue @@ -64,7 +64,6 @@ export default { return this.newOwnerUserId }, set(v) { - console.info('newOwnerUserId set to ', v) this.$emit('update:newOwnerUserId', v) }, }, diff --git a/src/store/store.js b/src/store/store.js index 0095000dc..520a9a9d4 100644 --- a/src/store/store.js +++ b/src/store/store.js @@ -396,6 +396,21 @@ export default new Vuex.Store({ return true }, + async transferContext({ state, commit, dispatch }, { id, data }) { + try { + await axios.put(generateOcsUrl('/apps/tables/api/2/contexts/' + id + '/transfer'), data) + } catch (e) { + displayError(e, t('tables', 'Could not transfer application.')) + return false + } + + const contexts = state.contexts + const index = contexts.findIndex(t => t.id === id) + contexts.splice(index, 1) + commit('setContexts', [...contexts]) + return true + }, + async removeTable({ state, commit }, { tableId }) { try { await axios.delete(generateUrl('/apps/tables/table/' + tableId))