diff --git a/src/client/web/src/components/pane_admin.tsx b/src/client/web/src/components/pane_admin.tsx index ea41d9e..7c91400 100644 --- a/src/client/web/src/components/pane_admin.tsx +++ b/src/client/web/src/components/pane_admin.tsx @@ -125,8 +125,6 @@ export class UserForm extends React.Component< }); }; - // setRole = () => {}; - render() { return (
ICoreState) => void; } -// export class Updater { -// static props: Props; -// private static client: IUsersClient; - -// static init = (props: Props) => (Updater.props = { ...props }); -// static setClient = (client: IUsersClient): void => { -// Updater.client = client; -// }; - -// static displayPane = (paneName: string) => { -// if (paneName === "") { -// // hide all panes -// Updater.props.displaying = ""; -// } else { -// const pane = Updater.props.paneNames.get(paneName); -// if (pane != null) { -// Updater.props.displaying = paneName; -// } else { -// alert(`dialgos: pane (${paneName}) not found`); -// } -// } -// }; - -// static self = async (): Promise => { -// const resp = await Updater.client.self(); -// if (resp.status === 200) { -// Updater.props.userRole = resp.data.role; -// return true; -// } -// return false; -// }; - -// static addUser = async (user: User): Promise => { -// const resp = await Updater.client.addUser(user.name, user.pwd, user.role); -// // TODO: should return uid instead -// return resp.status === 200; -// }; - -// static delUser = async (userID: string): Promise => { -// const resp = await Updater.client.delUser(userID); -// return resp.status === 200; -// }; - -// static setRole = async (userID: string, role: string): Promise => { -// const resp = await Updater.client.delUser(userID); -// return resp.status === 200; -// }; - -// static forceSetPwd = async ( -// userID: string, -// pwd: string -// ): Promise => { -// const resp = await Updater.client.forceSetPwd(userID, pwd); -// return resp.status === 200; -// }; - -// static listUsers = async (): Promise => { -// const resp = await Updater.client.listUsers(); -// if (resp.status !== 200) { -// return false; -// } - -// const lsRes = resp.data as ListUsersResp; -// let users = Map({}); -// lsRes.users.forEach((user: User) => { -// users = users.set(user.name, user); -// }); -// Updater.props.admin.users = users; - -// return true; -// }; - -// static addRole = async (role: string): Promise => { -// const resp = await Updater.client.addRole(role); -// // TODO: should return uid instead -// return resp.status === 200; -// }; - -// static delRole = async (role: string): Promise => { -// const resp = await Updater.client.delRole(role); -// return resp.status === 200; -// }; - -// static listRoles = async (): Promise => { -// const resp = await Updater.client.listRoles(); -// if (resp.status !== 200) { -// return false; -// } - -// const lsRes = resp.data as ListRolesResp; -// let roles = Set(); -// Object.keys(lsRes.roles).forEach((role: string) => { -// roles = roles.add(role); -// }); -// Updater.props.admin.roles = roles; - -// return true; -// }; - -// static updateState = (prevState: ICoreState): ICoreState => { -// return { -// ...prevState, -// panel: { -// ...prevState.panel, -// panes: { ...prevState.panel.panes, ...Updater.props }, -// }, -// }; -// }; -// } - export interface State {} export class Panes extends React.Component { constructor(p: Props) { @@ -189,6 +77,7 @@ export class Panes extends React.Component {

{displaying}

+
- {/*
*/} - {/*
*/}
); } diff --git a/src/client/web/src/components/state_mgr.tsx b/src/client/web/src/components/state_mgr.tsx index a7c4147..9ed3221 100644 --- a/src/client/web/src/components/state_mgr.tsx +++ b/src/client/web/src/components/state_mgr.tsx @@ -15,10 +15,10 @@ export class StateMgr extends React.Component { constructor(p: Props) { super(p); this.state = newState(); - this.initUpdaters(this.state); + this.initUpdater(this.state); } - initUpdaters = (state: ICoreState) => { + initUpdater = (state: ICoreState) => { updater().init(state); updater().setClients(new UsersClient(""), new FilesClient(""));