mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core&ui: cache uicontext.domain
This commit is contained in:
1 parent
43fb00e3c7
commit
e39a5fa87f
8 files changed
+71
-10
No files matched your search
@@ -17,7 +17,7 @@ const page = new NamedPage('domain_user', () => {
|
||||
<p>${i18n('Users will have to manually join the domain first before selected roles can be applied.')}</p>
|
||||
<p>${i18n('To join the domain, users can click the "Join Domain" button on "My Domain" page.')}</p>
|
||||
<p>${i18n('Or use the following link:')}</p>
|
||||
<p><a href="/domain/join?target=${UiContext.domain._id}">/domain/join?target=${UiContext.domain._id}</a></p>
|
||||
<p><a href="/domain/join?target=${UiContext.domainId}">/domain/join?target=${UiContext.domainId}</a></p>
|
||||
</div>`,
|
||||
}).open();
|
||||
});
|
||||
@@ -37,7 +37,7 @@ const page = new NamedPage('domain_user', () => {
|
||||
label: 'Role',
|
||||
options: UiContext.roles.filter((i) => !['default', 'guest'].includes(i)),
|
||||
},
|
||||
...((UiContext.canForceJoin && UiContext.domain._id !== 'system') ? {
|
||||
...((UiContext.canForceJoin && UiContext.domainId !== 'system') ? {
|
||||
join: {
|
||||
type: 'checkbox',
|
||||
label: i18n('Mark user as joined using admin privilege'),
|
||||
|
||||
@@ -3,7 +3,9 @@ import ProblemSelectAutoComplete from 'vj/components/autocomplete/ProblemSelectA
|
||||
import UserSelectAutoComplete from 'vj/components/autocomplete/UserSelectAutoComplete';
|
||||
import Notification from 'vj/components/notification';
|
||||
import { NamedPage } from 'vj/misc/Page';
|
||||
import { getAvailableLangs, request, tpl } from 'vj/utils';
|
||||
import {
|
||||
getAvailableLangs, getDomainInfo, request, tpl,
|
||||
} from 'vj/utils';
|
||||
|
||||
const page = new NamedPage('record_main', async () => {
|
||||
const [{ default: WebSocket }, { DiffDOM }] = await Promise.all([
|
||||
@@ -37,7 +39,8 @@ const page = new NamedPage('record_main', async () => {
|
||||
ProblemSelectAutoComplete.getOrConstruct($('[name="pid"]'), {
|
||||
clearDefaultValue: false,
|
||||
});
|
||||
const langs = UiContext.domain.langs?.split(',').map((i) => i.trim()).filter((i) => i);
|
||||
const domain = await getDomainInfo();
|
||||
const langs = domain.langs?.split(',').map((i) => i.trim()).filter((i) => i);
|
||||
const availableLangs = getAvailableLangs(langs?.length ? langs : undefined);
|
||||
Object.keys(availableLangs).map(
|
||||
(i) => ($('select[name="lang"]').append(tpl`<option value="${i}" key="${i}">${availableLangs[i].display}</option>`)));
|
||||
|
||||
Reference in new issue
Block a user