general
parent
a43248ac4b
commit
e391eb8eb3
|
@ -3,7 +3,7 @@ import { Constants } from "../utils";
|
||||||
|
|
||||||
// userId, username is stored in appContext
|
// userId, username is stored in appContext
|
||||||
const preview = {
|
const preview = {
|
||||||
email: Constants.LOADING,
|
email: "",
|
||||||
sessions: [],
|
sessions: [],
|
||||||
apiKeys: [],
|
apiKeys: [],
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
export default function Banner() {
|
export default function Banner() {
|
||||||
return <h1>Banner</h1>;
|
return (
|
||||||
|
<>
|
||||||
|
<h1>Banner</h1>
|
||||||
|
</>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import { lazy, useEffect, useState } from "react";
|
import { lazy, useEffect, useState } from "react";
|
||||||
import { myFetch } from "../../../utils";
|
import { isDevelopmentEnv, myFetch } from "../../../utils";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import MyCenteredContainer from "../../../Components/MyContainer";
|
import MyCenteredContainer from "../../../Components/MyContainer";
|
||||||
import { Button, Card, Result, Spin, Tabs } from "antd";
|
import { Button, Card, Result, Spin, Tabs } from "antd";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { MySupsenseFallback } from "../../../Components/MySupsenseFallback";
|
import { MySupsenseFallback } from "../../../Components/MySupsenseFallback";
|
||||||
|
import PageInDevelopment from "../../PageInDevelopment";
|
||||||
|
|
||||||
const General = lazy(() => import("./General"));
|
const General = lazy(() => import("./General"));
|
||||||
const Banner = lazy(() => import("./Banner"));
|
const Banner = lazy(() => import("./Banner"));
|
||||||
|
@ -49,8 +50,6 @@ export default function Website() {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
myFetch(`/website/${storeId}`, "GET")
|
myFetch(`/website/${storeId}`, "GET")
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res);
|
|
||||||
|
|
||||||
setIsRequesting(false);
|
setIsRequesting(false);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
@ -62,6 +61,8 @@ export default function Website() {
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
if (!isDevelopmentEnv()) return <PageInDevelopment />;
|
||||||
|
|
||||||
if (isRequesting) {
|
if (isRequesting) {
|
||||||
return (
|
return (
|
||||||
<MyCenteredContainer>
|
<MyCenteredContainer>
|
||||||
|
|
121
src/utils.js
121
src/utils.js
|
@ -1,4 +1,3 @@
|
||||||
import { Badge } from "antd";
|
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Buffer } from "buffer";
|
import { Buffer } from "buffer";
|
||||||
import { v4 as uuidv4 } from "uuid";
|
import { v4 as uuidv4 } from "uuid";
|
||||||
|
@ -6,7 +5,7 @@ import { v4 as uuidv4 } from "uuid";
|
||||||
/**
|
/**
|
||||||
* constants
|
* constants
|
||||||
*/
|
*/
|
||||||
const wssProtocol = window.location.protocol === "https:" ? "wss://" : "ws://";
|
//const wssProtocol = window.location.protocol === "https:" ? "wss://" : "ws://";
|
||||||
|
|
||||||
let apiAddress = "";
|
let apiAddress = "";
|
||||||
// let staticContentAddress = "";
|
// let staticContentAddress = "";
|
||||||
|
@ -30,11 +29,6 @@ if (window.location.hostname === "localhost" && window.location.port === "") {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Constants = {
|
export const Constants = {
|
||||||
COLORS: {
|
|
||||||
PRIMARY: "#e67e22",
|
|
||||||
SECONDARY: "#9b59b6",
|
|
||||||
ICON_INFO: "#08c",
|
|
||||||
},
|
|
||||||
TEXT_EMPTY_PLACEHOLDER: "-/-",
|
TEXT_EMPTY_PLACEHOLDER: "-/-",
|
||||||
API_ADDRESS: apiAddress,
|
API_ADDRESS: apiAddress,
|
||||||
//STATIC_CONTENT_ADDRESS: staticContentAddress,
|
//STATIC_CONTENT_ADDRESS: staticContentAddress,
|
||||||
|
@ -77,109 +71,11 @@ export const Constants = {
|
||||||
MAX_CALENDAR_EARLIEST_BOOKING_TIME: 60 * 24, // 24 hours in minutes
|
MAX_CALENDAR_EARLIEST_BOOKING_TIME: 60 * 24, // 24 hours in minutes
|
||||||
},
|
},
|
||||||
DELAY_ACCOUNT_NAME_CHECK: 250,
|
DELAY_ACCOUNT_NAME_CHECK: 250,
|
||||||
MAX_AVATAR_SIZE: 5 * 1024 * 1024,
|
|
||||||
ACCEPTED_AVATAR_FILE_TYPES: [
|
|
||||||
"image/png",
|
|
||||||
"image/jpeg",
|
|
||||||
"image/jpg",
|
|
||||||
"image/gif",
|
|
||||||
],
|
|
||||||
PERMISSIONS: {
|
|
||||||
EQUIPMENT_DOCUMENTATION: {
|
|
||||||
VIEW: "equipment_documentation.view",
|
|
||||||
CREATE: "equipment_documentation.create",
|
|
||||||
EDIT: "equipment_documentation.edit",
|
|
||||||
},
|
|
||||||
GROUP_TASKS: {
|
|
||||||
OVERVIEW: {
|
|
||||||
XYNewTask: "group_tasks.overview.XY.new_task",
|
|
||||||
XYReloadGroupConfig: "group_tasks.overview.XY.reload_group_config",
|
|
||||||
XYInstallPythonPackages:
|
|
||||||
"group_tasks.overview.XY.install_python_packages",
|
|
||||||
XYView: "group_tasks.overview.XY.view",
|
|
||||||
},
|
|
||||||
HISTORY: "group_tasks.history",
|
|
||||||
INSTALL_GLOBAL_PYTHON_PACKAGES:
|
|
||||||
"group_tasks.install_global_python_packages",
|
|
||||||
},
|
|
||||||
ALL_USERS: {
|
|
||||||
CREATE_NEW_USER: "all_users.create_new_user",
|
|
||||||
ACTION: {
|
|
||||||
CHANGE_ROLE: "all_users.action.change_role",
|
|
||||||
DELETE_USER: "all_users.action.delete_user",
|
|
||||||
USER_DEACTIVATION: "all_users.action.user_deactivation",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
ADMIN_AREA: {
|
|
||||||
ROLES: {
|
|
||||||
CREATE_NEW_ROLE: "admin_area.roles.create_new_role",
|
|
||||||
UPDATE_ROLE: "admin_area.roles.update_role",
|
|
||||||
DELETE_ROLE: "admin_area.roles.delete_role",
|
|
||||||
MOVE_ROLE_UP_DOWN: "admin_area.roles.move_role_up_down",
|
|
||||||
},
|
|
||||||
LOGS: "admin_area.logs",
|
|
||||||
MANAGE: {
|
|
||||||
CHECK_WHICH_CATEGORIES_ARE_AVAILABLE:
|
|
||||||
"admin_area.manage.check_which_categories_are_available",
|
|
||||||
ADD_LOG_MANAGER_SERVER_CONNECTION:
|
|
||||||
"admin_area.manage.add_log_manager_server_connection",
|
|
||||||
REMOVE_LOG_MANAGER_SERVER_CONNECTION:
|
|
||||||
"admin_area.manage.remove_log_manager_server_connection",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
USER_PROFILE: {
|
|
||||||
API_KEYS: "user_profile.api_keys",
|
|
||||||
},
|
|
||||||
CONSOLES: {
|
|
||||||
VIEW: "consoles.view",
|
|
||||||
},
|
|
||||||
ROBOTICS: {
|
|
||||||
ROBOTS: {
|
|
||||||
VIEW: "robotics.robots.view",
|
|
||||||
VIEW_ROBOTS_ADDRESSES: "robotics.robots.view_robots_addresses",
|
|
||||||
FREE_UP_JOB: "robotics.robots.free_up_job",
|
|
||||||
EDIT_ROBOT_NAME: "robotics.robots.edit_robot_name",
|
|
||||||
DISCONNECT_ROBOT: "robotics.robots.disconnect_robot",
|
|
||||||
ENABLE_PERMIT_JOIN: "robotics.robots.enable_permit_join",
|
|
||||||
AUTHORIZE_DENY_UNAUTHORIZED_ROBOTS:
|
|
||||||
"robotics.robots.authorize_deny_unauthorized_robots",
|
|
||||||
VIEW_SWAGGER_DOCUMENTATION:
|
|
||||||
"robotics.robots.view_swagger_documentation",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
CRM: {
|
|
||||||
CUSTOMERS: {
|
|
||||||
VIEW: "crm.customers.view",
|
|
||||||
},
|
|
||||||
DMC_PIPELINE: {
|
|
||||||
VIEW: "crm.dmc_pipeline.view",
|
|
||||||
},
|
|
||||||
SETTER_CLOSER: {
|
|
||||||
VIEW: "crm.setter_closer.view",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
SYSTEM_LOG_TYPE: {
|
|
||||||
INFO: 0,
|
|
||||||
ERROR: 1,
|
|
||||||
},
|
|
||||||
LOADING: "loading...",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const AppStyle = {
|
export const AppStyle = {
|
||||||
app: {
|
app: {
|
||||||
margin: 12,
|
margin: 12,
|
||||||
borderRadius: 12,
|
|
||||||
},
|
|
||||||
typography: {
|
|
||||||
text: {
|
|
||||||
marginBottom: 6,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
grid: {
|
|
||||||
row: {
|
|
||||||
gutter: [16, 16],
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1233,7 +1129,7 @@ export function FormatDatetime(datetime) {
|
||||||
|
|
||||||
return new Date(datetime).toLocaleString("de-DE");
|
return new Date(datetime).toLocaleString("de-DE");
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
export function GetDuration(startTime, endTime) {
|
export function GetDuration(startTime, endTime) {
|
||||||
if (endTime === "0001-01-01T00:00:00Z") {
|
if (endTime === "0001-01-01T00:00:00Z") {
|
||||||
return Constants.TEXT_EMPTY_PLACEHOLDER;
|
return Constants.TEXT_EMPTY_PLACEHOLDER;
|
||||||
|
@ -1274,20 +1170,20 @@ export function GetDuration(startTime, endTime) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return result.trim();
|
return result.trim();
|
||||||
}
|
} */
|
||||||
|
/*
|
||||||
export function getConnectionStatusItem(connectionStatus) {
|
export function getConnectionStatusItem(connectionStatus) {
|
||||||
return connectionStatus === 0 ? (
|
return connectionStatus === 0 ? (
|
||||||
<Badge status="error" text="Offline" />
|
<Badge status="error" text="Offline" />
|
||||||
) : (
|
) : (
|
||||||
<Badge status="success" text="Online" />
|
<Badge status="success" text="Online" />
|
||||||
);
|
);
|
||||||
}
|
} */
|
||||||
/*
|
/*
|
||||||
export function getUserId() {
|
export function getUserId() {
|
||||||
return localStorage.getItem("userId");
|
return localStorage.getItem("userId");
|
||||||
} */
|
} */
|
||||||
|
/*
|
||||||
const emailRegex =
|
const emailRegex =
|
||||||
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
||||||
|
|
||||||
|
@ -1336,6 +1232,7 @@ export function hasOneXYPermission(userPermissions, xyValue, ...permissions) {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
export function EncodeStringToBase64(value) {
|
export function EncodeStringToBase64(value) {
|
||||||
return Buffer.from(value).toString("base64");
|
return Buffer.from(value).toString("base64");
|
||||||
|
@ -1411,3 +1308,7 @@ export function myFetch(
|
||||||
throw error;
|
throw error;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isDevelopmentEnv() {
|
||||||
|
return process.env.NODE_ENV === "development";
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue