chore(ui): remove unused code
This commit is contained in:
parent
ee056aa193
commit
19a635a4b5
3 changed files with 3 additions and 118 deletions
|
@ -125,8 +125,6 @@ export class UserForm extends React.Component<
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// setRole = () => {};
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -2,8 +2,6 @@ import * as React from "react";
|
||||||
import { Set, Map } from "immutable";
|
import { Set, Map } from "immutable";
|
||||||
|
|
||||||
import { updater } from "./state_updater";
|
import { updater } from "./state_updater";
|
||||||
// import { IUsersClient, User, ListUsersResp, ListRolesResp } from "../client";
|
|
||||||
// import { UsersClient } from "../client/users";
|
|
||||||
import { ICoreState } from "./core_state";
|
import { ICoreState } from "./core_state";
|
||||||
import { PaneSettings } from "./pane_settings";
|
import { PaneSettings } from "./pane_settings";
|
||||||
import { AdminPane, Props as AdminPaneProps } from "./pane_admin";
|
import { AdminPane, Props as AdminPaneProps } from "./pane_admin";
|
||||||
|
@ -18,116 +16,6 @@ export interface Props {
|
||||||
update?: (updater: (prevState: ICoreState) => ICoreState) => void;
|
update?: (updater: (prevState: ICoreState) => 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<boolean> => {
|
|
||||||
// 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<boolean> => {
|
|
||||||
// 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<boolean> => {
|
|
||||||
// const resp = await Updater.client.delUser(userID);
|
|
||||||
// return resp.status === 200;
|
|
||||||
// };
|
|
||||||
|
|
||||||
// static setRole = async (userID: string, role: string): Promise<boolean> => {
|
|
||||||
// const resp = await Updater.client.delUser(userID);
|
|
||||||
// return resp.status === 200;
|
|
||||||
// };
|
|
||||||
|
|
||||||
// static forceSetPwd = async (
|
|
||||||
// userID: string,
|
|
||||||
// pwd: string
|
|
||||||
// ): Promise<boolean> => {
|
|
||||||
// const resp = await Updater.client.forceSetPwd(userID, pwd);
|
|
||||||
// return resp.status === 200;
|
|
||||||
// };
|
|
||||||
|
|
||||||
// static listUsers = async (): Promise<boolean> => {
|
|
||||||
// const resp = await Updater.client.listUsers();
|
|
||||||
// if (resp.status !== 200) {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const lsRes = resp.data as ListUsersResp;
|
|
||||||
// let users = Map<User>({});
|
|
||||||
// lsRes.users.forEach((user: User) => {
|
|
||||||
// users = users.set(user.name, user);
|
|
||||||
// });
|
|
||||||
// Updater.props.admin.users = users;
|
|
||||||
|
|
||||||
// return true;
|
|
||||||
// };
|
|
||||||
|
|
||||||
// static addRole = async (role: string): Promise<boolean> => {
|
|
||||||
// const resp = await Updater.client.addRole(role);
|
|
||||||
// // TODO: should return uid instead
|
|
||||||
// return resp.status === 200;
|
|
||||||
// };
|
|
||||||
|
|
||||||
// static delRole = async (role: string): Promise<boolean> => {
|
|
||||||
// const resp = await Updater.client.delRole(role);
|
|
||||||
// return resp.status === 200;
|
|
||||||
// };
|
|
||||||
|
|
||||||
// static listRoles = async (): Promise<boolean> => {
|
|
||||||
// const resp = await Updater.client.listRoles();
|
|
||||||
// if (resp.status !== 200) {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const lsRes = resp.data as ListRolesResp;
|
|
||||||
// let roles = Set<string>();
|
|
||||||
// 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 interface State {}
|
||||||
export class Panes extends React.Component<Props, State, {}> {
|
export class Panes extends React.Component<Props, State, {}> {
|
||||||
constructor(p: Props) {
|
constructor(p: Props) {
|
||||||
|
@ -189,6 +77,7 @@ export class Panes extends React.Component<Props, State, {}> {
|
||||||
<div className="container">
|
<div className="container">
|
||||||
<div className="flex-list-container padding-l">
|
<div className="flex-list-container padding-l">
|
||||||
<h3 className="flex-list-item-l txt-cap">{displaying}</h3>
|
<h3 className="flex-list-item-l txt-cap">{displaying}</h3>
|
||||||
|
|
||||||
<div className="flex-list-item-r">
|
<div className="flex-list-item-r">
|
||||||
<button
|
<button
|
||||||
onClick={this.closePane}
|
onClick={this.closePane}
|
||||||
|
@ -202,8 +91,6 @@ export class Panes extends React.Component<Props, State, {}> {
|
||||||
|
|
||||||
{panes}
|
{panes}
|
||||||
</div>
|
</div>
|
||||||
{/* <div className="hr white0-bg margin-b-m margin-l-m margin-r-m"></div> */}
|
|
||||||
{/* <div className="padding-l"></div> */}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,10 +15,10 @@ export class StateMgr extends React.Component<Props, State, {}> {
|
||||||
constructor(p: Props) {
|
constructor(p: Props) {
|
||||||
super(p);
|
super(p);
|
||||||
this.state = newState();
|
this.state = newState();
|
||||||
this.initUpdaters(this.state);
|
this.initUpdater(this.state);
|
||||||
}
|
}
|
||||||
|
|
||||||
initUpdaters = (state: ICoreState) => {
|
initUpdater = (state: ICoreState) => {
|
||||||
updater().init(state);
|
updater().init(state);
|
||||||
updater().setClients(new UsersClient(""), new FilesClient(""));
|
updater().setClients(new UsersClient(""), new FilesClient(""));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue