-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #945 from nextcloud/feat/898
feat: Transfer context ownership
- Loading branch information
Showing
11 changed files
with
310 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<template> | ||
<NcModal v-if="showModal" | ||
size="normal" | ||
@close="actionCancel"> | ||
<div class="modal__content" data-cy="transferContextModal"> | ||
<div class="row"> | ||
<div class="col-4"> | ||
<h2>{{ t('tables', 'Transfer application') }}</h2> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<h3>{{ t('tables', 'Transfer this application to another user') }}</h3> | ||
<NcUserAndGroupPicker :select-users="true" :select-groups="false" :new-owner-user-id.sync="newOwnerId" /> | ||
</div> | ||
<div class="row"> | ||
<div class="fix-col-4 space-T end"> | ||
<NcButton type="warning" :disabled="newOwnerId === ''" data-cy="transferTableButton" @click="transferContext"> | ||
{{ t('tables', 'Transfer') }} | ||
</NcButton> | ||
</div> | ||
</div> | ||
</div> | ||
</NcModal> | ||
</template> | ||
|
||
<script> | ||
import { NcModal, NcButton } from '@nextcloud/vue' | ||
import { showSuccess } from '@nextcloud/dialogs' | ||
import '@nextcloud/dialogs/dist/index.css' | ||
import permissionsMixin from '../../shared/components/ncTable/mixins/permissionsMixin.js' | ||
import NcUserAndGroupPicker from '../../shared/components/ncUserAndGroupPicker/NcUserAndGroupPicker.vue' | ||
import { mapGetters, mapState } from 'vuex' | ||
import { getCurrentUser } from '@nextcloud/auth' | ||
export default { | ||
name: 'TransferContext', | ||
components: { | ||
NcModal, | ||
NcButton, | ||
NcUserAndGroupPicker, | ||
}, | ||
mixins: [permissionsMixin], | ||
props: { | ||
showModal: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
context: { | ||
type: Object, | ||
default: null, | ||
}, | ||
}, | ||
data() { | ||
return { | ||
loading: false, | ||
newOwnerId: '', | ||
} | ||
}, | ||
computed: { | ||
...mapGetters(['getContext']), | ||
...mapState(['activeContextId']), | ||
localContext() { | ||
return this.getContext(this.context.id) | ||
}, | ||
userId() { | ||
return getCurrentUser().uid | ||
}, | ||
}, | ||
methods: { | ||
actionCancel() { | ||
this.$emit('close') | ||
}, | ||
async transferContext() { | ||
const transferId = this.context.id | ||
const res = await this.$store.dispatch('transferContext', { id: this.context.id, data: { newOwnerId: this.newOwnerId } }) | ||
if (res) { | ||
showSuccess(t('tables', 'Context "{name}" transfered to {user}', { name: this.context?.name, user: this.newOwnerId })) | ||
if (transferId === this.activeContextId) { | ||
await this.$router.push('/').catch(err => err) | ||
} | ||
this.actionCancel() | ||
} | ||
}, | ||
}, | ||
} | ||
</script> |
Oops, something went wrong.