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