Newer
Older
<template>
<b-modal id="rename-group-modal" title="Rename group" ok-title="Rename" @ok="renameGroup">
<b-form inline>
<label class="w-25" for="new-group-name-input">Group name:</label>
<b-form-input v-model="newGroupName" id="new-group-name-input" class="w-75" aria-describedby="new-group-name-input-feedback" :state="newGroupNameState" v-on:input="resetError">
</b-form-input>
<b-form-invalid-feedback id="new-group-name-input-feedback">{{newGroupNameError}}</b-form-invalid-feedback>
</b-form>
</b-modal>
</template>
<script>
import client from 'api-client';
export default {
name: 'RenameGroupModal',
computed: {
newGroupNameState() {
return 'invalid';
}
}
},
data: function() {
return {
groupId: null,
oldGroupName: null,
newGroupName: null,
newGroupNameError: null
};
},
methods: {
resetError: function() {
this.newGroupNameError = null;
},
openRenameGroupModal: function(group) {
this.newGroupName = group.groupName;
this.groupId = group.groupId;
this.$bvModal.show('rename-group-modal');
},
renameGroup: function(event) {
// Prevent modal from closing
event.preventDefault();
this.newGroupNameError = "Group name is required";
return;
}
if (this.oldGroupName === this.newGroupName) {
this.$bvModal.hide('rename-group-modal');
return;
}
let parent = this.$store.getters.selectedGroupId;
client.renameGroup(this.groupId, this.newGroupName, this.$store.state.input)
.then(res => {