Skip to content

Commit

Permalink
Apply minor linting fixes to role form.
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Oct 13, 2024
1 parent 72c7676 commit ee90496
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions frontend/src/views/RoleForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@
</option>
</template>
</b-select>

</div>
<div class="column">
<b-button @click="onAddListPerm" :disabled="!form.curList" class="is-primary" expanded>{{
$t('globals.buttons.add')
}}</b-button>
<b-button @click="onAddListPerm" :disabled="!form.curList" class="is-primary" expanded>
{{ $t('globals.buttons.add') }}
</b-button>
</div>
</div>
<span
Expand Down Expand Up @@ -77,7 +76,9 @@
<div class="box">
<div class="columns">
<div class="column is-7">
<h5 class="mb-0">{{ $t('users.perms') }}</h5>
<h5 class="mb-0">
{{ $t('users.perms') }}
</h5>
</div>
<div class="column has-text-right" v-if="!disabled">
<a href="#" @click.prevent="onToggleSelect">{{ $t('globals.buttons.toggleSelect') }}</a>
Expand Down Expand Up @@ -149,7 +150,7 @@ export default Vue.extend({
methods: {
onAddListPerm() {
const list = this.lists.results.find((l) => l.id === this.form.curList);
this.form.lists.push({ id: list.id, name: list.name, permissions: ["list:get", "list:manage"] });
this.form.lists.push({ id: list.id, name: list.name, permissions: ['list:get', 'list:manage'] });
this.form.curList = (this.filteredLists.length > 0) ? this.filteredLists[0].id : null;
},
Expand Down Expand Up @@ -185,11 +186,11 @@ export default Vue.extend({
createRole() {
const lists = this.form.lists.reduce((acc, item) => {
acc.push({ id: item.id, permissions: item.permissions })
acc.push({ id: item.id, permissions: item.permissions });
return acc;
}, []);
const form = { name: this.form.name, permissions: this.form.permissions, lists: lists };
const form = { name: this.form.name, permissions: this.form.permissions, lists };
this.$api.createRole(form).then((data) => {
this.$emit('finished');
this.$utils.toast(this.$t('globals.messages.created', { name: data.name }));
Expand All @@ -199,11 +200,13 @@ export default Vue.extend({
updateRole() {
const lists = this.form.lists.reduce((acc, item) => {
acc.push({ id: item.id, permissions: item.permissions })
acc.push({ id: item.id, permissions: item.permissions });
return acc;
}, []);
const form = { id: this.$props.data.id, name: this.form.name, permissions: this.form.permissions, lists: lists };
const form = {
id: this.$props.data.id, name: this.form.name, permissions: this.form.permissions, lists,
};
this.$api.updateRole(form).then((data) => {
this.$emit('finished');
this.$parent.close();
Expand Down

0 comments on commit ee90496

Please sign in to comment.