add user_dropdown

This commit is contained in:
undefined committed 2020-10-02 20:13:51 +08:00
1 parent 5dc87c599c
commit 7ceb8fc028
9 files changed
+23 -12

No files matched your search

+3 -1
View File
@@ -1,6 +1,6 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Readable, Writable } from 'stream';
import { ObjectID, GridFSBucket } from 'mongodb';
import { ObjectID } from 'mongodb';
import fs from 'fs';
import { Dictionary, NumericDictionary } from 'lodash';
@@ -532,9 +532,11 @@ export interface UI {
nodes: {
nav: any[],
problem_add: any[],
user_dropdown: any[],
},
Nav: typeof import('./lib/ui').Nav,
ProblemAdd: typeof import('./lib/ui').ProblemAdd,
UserDropdown: typeof import('./lib/ui').UserDropdown,
}
declare global {
+9
View File
@@ -56,6 +56,14 @@ export const ProblemAdd = (
});
};
export const UserDropdown = (
name: string, args: Dictionary<any> = {}, ...permPrivChecker: Array<number | bigint | Function>
) => {
global.Hydro.ui.nodes.user_dropdown.push({
name, args: args || {}, checker: buildChecker(...permPrivChecker),
});
};
Nav('homepage', {}, 'homepage');
Nav('problem_main', {}, 'problem', PERM.PERM_VIEW_PROBLEM);
Nav('training_main', {}, 'training', PERM.PERM_VIEW_TRAINING);
@@ -71,3 +79,4 @@ ProblemAdd('problem_import_syzoj', {}, 'copy', 'Import From SYZOJ');
global.Hydro.ui.Nav = Nav;
global.Hydro.ui.ProblemAdd = ProblemAdd;
global.Hydro.ui.UserDropdown = UserDropdown;
+1
View File
@@ -30,6 +30,7 @@ if (!global.Hydro) {
nodes: {
nav: [],
problem_add: [],
user_dropdown: [],
},
template: {},
},