mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: monaco: better auto-resize
This commit is contained in:
1 parent
6419215d91
commit
6b5b3e68d0
4 files changed
+62
-16
No files matched your search
@@ -50,9 +50,11 @@ const page = new NamedPage('domain_group', () => {
|
||||
createGroupDialogContent.find('[name="create_group_users"]'),
|
||||
{ multi: true, height: 'auto' },
|
||||
);
|
||||
const targets = {};
|
||||
$('input[data-gid]').get().forEach((ele) => {
|
||||
const input = UserSelectAutoComplete.getOrConstruct<UserSelectAutoComplete<true>>($(ele), { multi: true, height: 'auto' });
|
||||
const gid = ele.getAttribute('data-gid');
|
||||
targets[gid] = input;
|
||||
let loaded = false;
|
||||
input.onChange(() => {
|
||||
if (input.value().length && !loaded) {
|
||||
@@ -123,8 +125,21 @@ const page = new NamedPage('domain_group', () => {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleClickSaveAll() {
|
||||
for (const gid of Object.keys(targets)) {
|
||||
const uids = targets[gid].value();
|
||||
try {
|
||||
await update(gid, uids);
|
||||
} catch (error) {
|
||||
Notification.error(error.message);
|
||||
}
|
||||
}
|
||||
Notification.success(i18n('Saved.'));
|
||||
}
|
||||
|
||||
$('[name="create_group"]').click(() => handleClickCreateGroup());
|
||||
$('[name="delete_selected"]').click(() => handleClickDeleteSelected());
|
||||
$('[name="save_all"]').on('click', () => handleClickSaveAll());
|
||||
});
|
||||
|
||||
export default page;
|
||||
Reference in new issue
Block a user