w: upgrade deps

This commit is contained in:
undefined committed 2021-12-16 00:16:27 +08:00
1 parent 47499bdcd6
commit 0824487342
19 files changed
+132 -88

No files matched your search

+8 -3
View File
@@ -94,9 +94,14 @@ bus.on('app/started', () => {
});
class ApiHandler extends Handler {
async query(q: string, variables: any) {
// FIXME validation for fields like ObjectID doesn't work.
return graphql(schema, q, root, this, variables);
query(q: string, variables: any) {
return graphql({
schema,
source: q,
rootValue: root,
contextValue: this,
variableValues: variables,
});
}
async get() {
+4 -16
View File
@@ -105,14 +105,9 @@ class DomainUserHandler extends ManageHandler {
rudocs[ud.role || 'default'].push(ud);
}
const rolesSelect = roles.map((role) => [role._id, role._id]);
const path = [
['Hydro', 'homepage'],
['domain', null],
['domain_user', null],
];
this.response.template = 'domain_user.html';
this.response.body = {
roles, rolesSelect, rudocs, udict, path, domain: this.domain,
roles, rolesSelect, rudocs, udict, domain: this.domain,
};
}
@@ -134,14 +129,9 @@ class DomainUserHandler extends ManageHandler {
class DomainPermissionHandler extends ManageHandler {
async get({ domainId }) {
const roles = await domain.getRoles(domainId);
const path = [
['Hydro', 'homepage'],
['domain', null],
['domain_permission', null],
];
this.response.template = 'domain_permission.html';
this.response.body = {
roles, PERMS_BY_FAMILY, domain: this.domain, path, log2,
roles, PERMS_BY_FAMILY, domain: this.domain, log2,
};
}
@@ -179,10 +169,8 @@ class DomainRoleHandler extends ManageHandler {
@param('roles', Types.Array)
async postDelete(domainId: string, roles: string[]) {
for (const role of roles) {
if (['root', 'default', 'guest'].includes(role)) {
throw new ValidationError('role');
}
if (Set.intersection(new Set(roles), new Set(['root', 'default', 'guest'])).size > 0) {
throw new ValidationError('role', null, 'You cannot delete root, default or guest roles');
}
await domain.deleteRoles(domainId, roles);
this.back();
+1 -5
View File
@@ -24,16 +24,12 @@ async function getStatus() {
class StatusHandler extends Handler {
async get() {
const path = [
['Hydro', 'homepage'],
['status', null],
];
const stats = await getStatus();
for (const stat of stats) {
if (!stat.battery.hasBattery) stat.battery = 'No battery';
else stat.battery = `${stat.battery.type} ${stat.battery.model} ${stat.battery.percent}%${stat.battery.isCharging ? ' Charging' : ''}`;
}
this.response.body = { stats, path };
this.response.body = { stats };
this.response.template = 'status.html';
}
}