Merge pull request #8933 from aignatov-bio/ai-sci-12445-error-creating-new-tag

Fix render of users and fix error tag creation [SCI-12445][SCI-12442]
This commit is contained in:
aignatov-bio 2025-10-09 15:52:33 +02:00 committed by GitHub
commit 6d0264f243
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 10 deletions

View file

@ -168,6 +168,7 @@ import SelectDropdown from '../shared/select_dropdown.vue';
import TagsInput from '../shared/tags_input.vue'; import TagsInput from '../shared/tags_input.vue';
import axios from '../../packs/custom_axios.js'; import axios from '../../packs/custom_axios.js';
import escapeHtml from '../shared/escape_html.js'; import escapeHtml from '../shared/escape_html.js';
import usersRenderer from '../shared/select_dropdown_renderers/user.vue';
import { import {
my_module_path, my_module_path,
assigned_users_my_module_path, assigned_users_my_module_path,
@ -190,7 +191,8 @@ export default {
GeneralDropdown, GeneralDropdown,
DateTimePicker, DateTimePicker,
SelectDropdown, SelectDropdown,
TagsInput TagsInput,
usersRenderer,
}, },
data() { data() {
return { return {
@ -199,6 +201,7 @@ export default {
users: [], users: [],
startDate: null, startDate: null,
dueDate: null, dueDate: null,
usersRenderer: usersRenderer,
}; };
}, },
mixins: [escapeHtml], mixins: [escapeHtml],
@ -208,7 +211,7 @@ export default {
[ [
parseInt(user.id, 10), parseInt(user.id, 10),
user.attributes.name, user.attributes.name,
user.attributes.avatar_url { avatar_url: user.attributes.avatar_url }
] ]
)); ));
} }
@ -276,12 +279,6 @@ export default {
this.users = this.myModule.attributes.designated_user_ids || []; this.users = this.myModule.attributes.designated_user_ids || [];
}); });
}, },
usersRenderer(user) {
return `<div class="flex items-center gap-2 truncate">
<img class="w-6 h-6 rounded-full" src="${user[2]}">
<span title="${escapeHtml(user[1])}" class="truncate">${escapeHtml(user[1])}</span>
</div>`;
},
setDueDate(value) { setDueDate(value) {
const updateUrl = my_module_path(this.myModule.id); const updateUrl = my_module_path(this.myModule.id);
axios.put(updateUrl, { axios.put(updateUrl, {

View file

@ -98,11 +98,12 @@ export default {
}).then((response) => { }).then((response) => {
this.tags.push(response.data.tag); this.tags.push(response.data.tag);
this.subject.attributes.tags = this.tags; this.subject.attributes.tags = this.tags;
this.loadAllTags(); this.loadAllTagsWithPermissions();
this.linkingTag = false; this.linkingTag = false;
this.searchQuery = ''; this.searchQuery = '';
}).catch(() => { }).catch((e) => {
this.linkingTag = false; this.linkingTag = false;
console.error(e);
HelperModule.flashAlertMsg(I18n.t('errors.general'), 'danger'); HelperModule.flashAlertMsg(I18n.t('errors.general'), 'danger');
}); });
}, },