admin -> src
This commit is contained in:
parent
63fcba9dd9
commit
f91567186e
8
js/admin.min.js
vendored
8
js/admin.min.js
vendored
File diff suppressed because one or more lines are too long
0
admin/.gitignore → src/.gitignore
vendored
0
admin/.gitignore → src/.gitignore
vendored
8
admin/dist/main.js → src/dist/main.js
vendored
8
admin/dist/main.js → src/dist/main.js
vendored
File diff suppressed because one or more lines are too long
0
admin/package-lock.json → src/package-lock.json
generated
0
admin/package-lock.json → src/package-lock.json
generated
@ -10,7 +10,7 @@ export default function Icon(props) {
|
||||
classes.push(type);
|
||||
classes.push("fa-" + icon);
|
||||
|
||||
if (icon === "spinner") {
|
||||
if (icon === "spinner" || icon === "circle-notch") {
|
||||
classes.push("fa-spin");
|
||||
}
|
||||
|
@ -21,7 +21,8 @@ export default class CreateUser extends React.Component {
|
||||
username: "",
|
||||
email: "",
|
||||
password: "",
|
||||
confirmPassword: ""
|
||||
confirmPassword: "",
|
||||
isSubmitting: false
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,7 +108,10 @@ export default class CreateUser extends React.Component {
|
||||
<Icon icon={"arrow-left"}/>
|
||||
Back
|
||||
</Link>
|
||||
<button type={"submit"} className={"btn btn-primary mt-2"}>Submit</button>
|
||||
{ this.state.isSubmitting
|
||||
? <button type={"submit"} className={"btn btn-primary mt-2"} disabled>Loading… <Icon icon={"circle-notch"} /></button>
|
||||
: <button type={"submit"} className={"btn btn-primary mt-2"}>Submit</button>
|
||||
}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@ -119,6 +123,10 @@ export default class CreateUser extends React.Component {
|
||||
submitForm(e) {
|
||||
e.preventDefault();
|
||||
|
||||
if (this.state.isSubmitting) {
|
||||
return;
|
||||
}
|
||||
|
||||
const requiredFields = (this.state.sendInvite ?
|
||||
["username", "email"] :
|
||||
["username", "password", "confirmPassword"]);
|
||||
@ -137,6 +145,7 @@ export default class CreateUser extends React.Component {
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({ ...this.state, isSubmitting: true });
|
||||
const username = this.state.username;
|
||||
const email = this.state.email || "";
|
||||
const password = this.state.password;
|
||||
@ -147,21 +156,29 @@ export default class CreateUser extends React.Component {
|
||||
let errors = this.state.errors.slice();
|
||||
if (!res.success) {
|
||||
errors.push({ title: "Error inviting User", message: res.msg, type: "danger" });
|
||||
this.setState({ ...this.state, errors: errors });
|
||||
this.setState({ ...this.state, errors: errors, isSubmitting: false });
|
||||
} else {
|
||||
errors.push({ title: "Success", message: "The invitation was successfully sent.", type: "success" });
|
||||
this.setState({ ...this.state, errors: errors, username: "", email: "" });
|
||||
this.setState({ ...this.state, errors: errors, username: "", email: "", isSubmitting: false });
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
if (this.state.password !== this.state.confirmPassword) {
|
||||
let errors = this.state.errors.slice();
|
||||
errors.push({ title: "Error creating User", message: "The given passwords do not match", type: "danger" });
|
||||
this.setState({ ...this.state, errors: errors, password: "", confirmPassword: "", isSubmitting: false });
|
||||
return;
|
||||
}
|
||||
|
||||
this.parent.api.createUser(username, email, password, confirmPassword).then((res) => {
|
||||
let errors = this.state.errors.slice();
|
||||
if (!res.success) {
|
||||
errors.push({ title: "Error creating User", message: res.msg, type: "danger" });
|
||||
this.setState({ ...this.state, errors: errors, password: "", confirmPassword: "" });
|
||||
this.setState({ ...this.state, errors: errors, password: "", confirmPassword: "", isSubmitting: false });
|
||||
} else {
|
||||
errors.push({ title: "Success", message: "The user was successfully created.", type: "success" });
|
||||
this.setState({ ...this.state, errors: errors, username: "", email: "", password: "", confirmPassword: "" });
|
||||
this.setState({ ...this.state, errors: errors, username: "", email: "", password: "", confirmPassword: "", isSubmitting: false });
|
||||
}
|
||||
});
|
||||
}
|
@ -63,8 +63,9 @@ export default class Overview extends React.Component {
|
||||
for (let date in this.state.visitors) {
|
||||
let month = parseInt(date) % 100 - 1;
|
||||
if (month >= 0 && month < 12) {
|
||||
data[month] = this.state.visitors[date];
|
||||
visitorCount += this.state.visitors[date];
|
||||
let count = parseInt(this.state.visitors[date]);
|
||||
data[month] = count;
|
||||
visitorCount += count;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user