fix(ui): replace alert with alertMsg
This commit is contained in:
parent
99607c66bc
commit
600c1e6a9e
5 changed files with 18 additions and 14 deletions
|
@ -240,7 +240,7 @@ export class Browser extends React.Component<Props, State, {}> {
|
|||
.addSharing()
|
||||
.then((ok) => {
|
||||
if (!ok) {
|
||||
alert("failed to enable sharing");
|
||||
alertMsg("failed to enable sharing");
|
||||
} else {
|
||||
updater().setSharing(true);
|
||||
return this.listSharings();
|
||||
|
@ -256,7 +256,7 @@ export class Browser extends React.Component<Props, State, {}> {
|
|||
.deleteSharing(dirPath)
|
||||
.then((ok) => {
|
||||
if (!ok) {
|
||||
alert("failed to disable sharing");
|
||||
alertMsg("failed to disable sharing");
|
||||
} else {
|
||||
updater().setSharing(false);
|
||||
return this.listSharings();
|
||||
|
|
|
@ -3,6 +3,7 @@ import { List } from "immutable";
|
|||
|
||||
import { ICoreState } from "./core_state";
|
||||
import { updater } from "./state_updater";
|
||||
import { alertMsg } from "../common/env";
|
||||
|
||||
export interface Props {
|
||||
userRole: string;
|
||||
|
@ -67,7 +68,7 @@ export class AuthPane extends React.Component<Props, State, {}> {
|
|||
]);
|
||||
} else {
|
||||
this.setState({ user: "", pwd: "", captchaInput: "" });
|
||||
alert("Failed to login.");
|
||||
alertMsg("Failed to login.");
|
||||
|
||||
return updater().getCaptchaID();
|
||||
}
|
||||
|
@ -84,7 +85,7 @@ export class AuthPane extends React.Component<Props, State, {}> {
|
|||
if (ok) {
|
||||
this.update(updater().updateLogin);
|
||||
} else {
|
||||
alert("Failed to logout.");
|
||||
alertMsg("Failed to logout.");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
@ -3,6 +3,7 @@ import * as React from "react";
|
|||
import { ICoreState } from "./core_state";
|
||||
import { AuthPane, Props as LoginProps } from "./pane_login";
|
||||
import { updater } from "./state_updater";
|
||||
import { alertMsg } from "../common/env";
|
||||
|
||||
export interface Props {
|
||||
login: LoginProps;
|
||||
|
@ -39,19 +40,19 @@ export class PaneSettings extends React.Component<Props, State, {}> {
|
|||
|
||||
setPwd = () => {
|
||||
if (this.state.newPwd1 !== this.state.newPwd2) {
|
||||
alert("new passwords are not same");
|
||||
alertMsg("new passwords are not same");
|
||||
} else if (this.state.newPwd1 == "") {
|
||||
alert("new passwords can not be empty");
|
||||
alertMsg("new passwords can not be empty");
|
||||
} else if (this.state.oldPwd == this.state.newPwd1) {
|
||||
alert("old and new passwords are same");
|
||||
alertMsg("old and new passwords are same");
|
||||
} else {
|
||||
updater()
|
||||
.setPwd(this.state.oldPwd, this.state.newPwd1)
|
||||
.then((ok: boolean) => {
|
||||
if (ok) {
|
||||
alert("Password is updated");
|
||||
alertMsg("Password is updated");
|
||||
} else {
|
||||
alert("Failed to update password");
|
||||
alertMsg("Failed to update password");
|
||||
}
|
||||
this.setState({
|
||||
oldPwd: "",
|
||||
|
|
|
@ -7,6 +7,7 @@ import { RootFrame } from "./root_frame";
|
|||
import { FilesClient } from "../client/files";
|
||||
import { UsersClient } from "../client/users";
|
||||
import { IUsersClient, IFilesClient } from "../client";
|
||||
import { alertMsg } from "../common/env";
|
||||
|
||||
export interface Props {}
|
||||
export interface State extends ICoreState {}
|
||||
|
@ -55,7 +56,7 @@ export class StateMgr extends React.Component<Props, State, {}> {
|
|||
})
|
||||
.then((ok: boolean) => {
|
||||
if (!ok) {
|
||||
alert("failed to get captcha id");
|
||||
alertMsg("failed to get captcha id");
|
||||
} else {
|
||||
this.update(updater().updateLogin);
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import { FilesClient } from "../client/files";
|
|||
import { UsersClient } from "../client/users";
|
||||
import { UploadEntry } from "../worker/interface";
|
||||
import { Up } from "../worker/upload_mgr";
|
||||
import { alertMsg } from "../common/env";
|
||||
|
||||
export class Updater {
|
||||
props: ICoreState;
|
||||
|
@ -112,7 +113,7 @@ export class Updater {
|
|||
mkDir = async (dirPath: string): Promise<void> => {
|
||||
const resp = await this.filesClient.mkdir(dirPath);
|
||||
if (resp.status !== 200) {
|
||||
alert(`failed to make dir ${dirPath}`);
|
||||
alertMsg(`failed to make dir ${dirPath}`);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -134,7 +135,7 @@ export class Updater {
|
|||
const failedFiles = await Promise.all(delRequests);
|
||||
failedFiles.forEach((failedFile) => {
|
||||
if (failedFile !== "") {
|
||||
alert(`failed to delete ${failedFile}`);
|
||||
alertMsg(`failed to delete ${failedFile}`);
|
||||
}
|
||||
});
|
||||
return this.setItems(dirParts);
|
||||
|
@ -178,7 +179,7 @@ export class Updater {
|
|||
const failedFiles = await Promise.all(moveRequests);
|
||||
failedFiles.forEach((failedItem) => {
|
||||
if (failedItem !== "") {
|
||||
alert(`failed to move ${failedItem}`);
|
||||
alertMsg(`failed to move ${failedItem}`);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -194,7 +195,7 @@ export class Updater {
|
|||
if (pane != null) {
|
||||
this.props.panes.displaying = paneName;
|
||||
} else {
|
||||
alert(`dialgos: pane (${paneName}) not found`);
|
||||
alertMsg(`dialgos: pane (${paneName}) not found`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue