responsive SystemVersionComponent; eslint-plugin-react-hooks; @flare/react-hooks; hooks warnings fix

master
Tudor Stanciu 2022-09-27 10:13:38 +03:00
parent 79565b2c00
commit aab834bc10
18 changed files with 275 additions and 250 deletions

1
.npmrc Normal file
View File

@ -0,0 +1 @@
@flare:registry=https://toodle.ddns.net/public-node-registry

View File

@ -2,8 +2,11 @@
FROM node:14-slim as builder FROM node:14-slim as builder
WORKDIR /app WORKDIR /app
ARG OWN_NPM_TOKEN
COPY .npmrc .npmrc
COPY package*.json ./ COPY package*.json ./
RUN npm install RUN npm install
RUN rm -f .npmrc
COPY . ./ COPY . ./
#RUN ls #RUN ls
@ -11,9 +14,9 @@ RUN npm run build
# production environment # production environment
FROM node:14-slim FROM node:14-slim
ARG APP_SUBFOLDER=reverse-proxy ARG APP_SUBFOLDER=""
COPY --from=builder /app/build ./application/${APP_SUBFOLDER} COPY --from=builder /app/build ./application${APP_SUBFOLDER}
COPY --from=builder /app/build/index.html ./application/ COPY --from=builder /app/build/index.html ./application/
#install static server #install static server
@ -22,9 +25,7 @@ RUN npm install -g serve
# environment variables # environment variables
ENV Author="Tudor Stanciu" ENV Author="Tudor Stanciu"
ARG APP_VERSION=0.0.0 ARG APP_VERSION=0.0.0
ARG APP_DATE=1900-01-01
ENV APP_VERSION=${APP_VERSION} ENV APP_VERSION=${APP_VERSION}
ENV APP_DATE=${REACT_APP_DATE}
#set workdir to root #set workdir to root
WORKDIR / WORKDIR /

View File

@ -3,16 +3,18 @@ echo "Welcome!"
version="1.4.1" version="1.4.1"
platform="linux/amd64,linux/arm64,linux/arm/v7" platform="linux/amd64,linux/arm64,linux/arm/v7"
#version="1.3.2-arm64" appSubfolder="/reverse-proxy"
#platform="linux/arm64"
localRegistryPass="***REMOVED***" localRegistryPass="***REMOVED***"
npmToken="***REMOVED***"
echo "Login to alpine-nexus registry." echo "Login to alpine-nexus registry."
docker login --username=admin --password=$localRegistryPass alpine-nexus:8500 docker login --username=admin --password=$localRegistryPass alpine-nexus:8500
echo "Create docker image with version $version for platform $platform" echo "Create docker image with version $version for platform $platform"
docker buildx build \ docker buildx build \
--build-arg APP_SUBFOLDER=$appSubfolder \
--build-arg APP_VERSION=$version \ --build-arg APP_VERSION=$version \
--build-arg OWN_NPM_TOKEN=$npmToken \
--platform $platform \ --platform $platform \
--output=type=image,push=true,registry.insecure=true \ --output=type=image,push=true,registry.insecure=true \
--push \ --push \

460
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -16,11 +16,13 @@
"build": "webpack --config webpack.config.prod.js" "build": "webpack --config webpack.config.prod.js"
}, },
"dependencies": { "dependencies": {
"@flare/react-hooks": "^1.0.0",
"@material-ui/core": "^4.9.13", "@material-ui/core": "^4.9.13",
"@material-ui/icons": "^4.9.1", "@material-ui/icons": "^4.9.1",
"@material-ui/lab": "^4.0.0-alpha.53", "@material-ui/lab": "^4.0.0-alpha.53",
"axios": "^0.27.2", "axios": "^0.27.2",
"bootstrap": "4.3.1", "bootstrap": "4.3.1",
"eslint-plugin-react-hooks": "^4.6.0",
"i18next": "^19.4.4", "i18next": "^19.4.4",
"i18next-browser-languagedetector": "^4.1.1", "i18next-browser-languagedetector": "^4.1.1",
"i18next-http-backend": "^1.0.10", "i18next-http-backend": "^1.0.10",
@ -84,7 +86,8 @@
"eslint:recommended", "eslint:recommended",
"plugin:react/recommended", "plugin:react/recommended",
"plugin:import/errors", "plugin:import/errors",
"plugin:import/warnings" "plugin:import/warnings",
"plugin:react-hooks/recommended"
], ],
"parser": "babel-eslint", "parser": "babel-eslint",
"parserOptions": { "parserOptions": {

View File

@ -17,7 +17,7 @@ import ForwardContainer from "../features/forwards/core/components/ForwardContai
function App({ actions }) { function App({ actions }) {
useEffect(() => { useEffect(() => {
actions.loadFrontendSession(); actions.loadFrontendSession();
}, []); }, [actions]);
const contentStyle = { const contentStyle = {
paddingLeft: "30px", paddingLeft: "30px",

View File

@ -75,10 +75,7 @@ const ApplicationBar = () => {
setAnchorEl(null); setAnchorEl(null);
}; };
const routePrefix = useMemo(() => process.env.PUBLIC_URL ?? "", [ const routePrefix = process.env.PUBLIC_URL ?? "";
process.env.PUBLIC_URL
]);
const flagsPath = useMemo(() => `${routePrefix}/public/flags`, [routePrefix]); const flagsPath = useMemo(() => `${routePrefix}/public/flags`, [routePrefix]);
return ( return (

View File

@ -8,7 +8,7 @@ import { loadSessionsRunningTime } from "../actionCreators";
const ServerChartsContainer = ({ actions, sessionRunningTime }) => { const ServerChartsContainer = ({ actions, sessionRunningTime }) => {
useEffect(() => { useEffect(() => {
actions.loadSessionsRunningTime(); actions.loadSessionsRunningTime();
}, []); }, [actions]);
return ( return (
<> <>

View File

@ -34,7 +34,7 @@ const BotsManager = ({ bot, actions }) => {
if (bot.type == botType.none) return; if (bot.type == botType.none) return;
actions.loadBotSession(bots.Zirhan, userKey.unknown, bot.type); actions.loadBotSession(bots.Zirhan, userKey.unknown, bot.type);
}, [bot.type]); }, [actions, bot.type]);
const dismissBot = () => { const dismissBot = () => {
actions.closeChat(); actions.closeChat();

View File

@ -8,7 +8,7 @@ import ForwardOptionsComponent from "./ForwardOptionsComponent";
const ForwardOptionsContainer = ({ actions, forward, options }) => { const ForwardOptionsContainer = ({ actions, forward, options }) => {
useEffect(() => { useEffect(() => {
actions.loadForwardOptions(forward.optionId); actions.loadForwardOptions(forward.optionId);
}, []); }, [actions, forward.optionId]);
const forwardOptions = options[forward.optionId]; const forwardOptions = options[forward.optionId];

View File

@ -17,7 +17,7 @@ const ForwardOptionsDialog = ({ open, forward, handleClose }) => {
const handleAdvancedClick = useCallback( const handleAdvancedClick = useCallback(
() => history.push(`/forwards/${forward.sessionId}/${forward.forwardId}`), () => history.push(`/forwards/${forward.sessionId}/${forward.forwardId}`),
[forward] [forward, history]
); );
return ( return (

View File

@ -10,9 +10,9 @@ const ReleaseNotesContainer = ({ actions, releaseNotes }) => {
useEffect(() => { useEffect(() => {
actions.loadReleaseNotes(); actions.loadReleaseNotes();
}, []); }, [actions]);
const handleToggle = (version) => (_, expanded) => { const handleToggle = version => (_, expanded) => {
setNotesFlags({ setNotesFlags({
...notesFlags, ...notesFlags,
[version]: expanded [version]: expanded

View File

@ -15,7 +15,7 @@ const ActiveSessionContainer = ({ actions, session, forwards, domain }) => {
useEffect(() => { useEffect(() => {
actions.loadActiveSession(); actions.loadActiveSession();
}, []); }, [actions]);
const handleExpandClick = () => { const handleExpandClick = () => {
const expand = !expanded; const expand = !expanded;

View File

@ -10,7 +10,7 @@ import { summonWizard } from "../../chatbot/actionCreators";
const ServerContainer = ({ actions, data, serverHost, history }) => { const ServerContainer = ({ actions, data, serverHost, history }) => {
useEffect(() => { useEffect(() => {
actions.loadServerData(); actions.loadServerData();
}, []); }, [actions]);
const openAbout = event => { const openAbout = event => {
history.push("/about"); history.push("/about");

View File

@ -12,7 +12,7 @@ const SessionContainer = ({ actions, sessions, forwards }) => {
useEffect(() => { useEffect(() => {
actions.loadServerSessions(); actions.loadServerSessions();
}, []); }, [actions]);
const handleToggle = sessionId => (_, expanded) => { const handleToggle = sessionId => (_, expanded) => {
if (expanded) actions.loadSessionForwards(sessionId); if (expanded) actions.loadSessionForwards(sessionId);

View File

@ -9,7 +9,7 @@ import { withRouter } from "react-router-dom";
const SystemContainer = ({ actions, data, history }) => { const SystemContainer = ({ actions, data, history }) => {
useEffect(() => { useEffect(() => {
actions.loadSystemData(); actions.loadSystemData();
}, []); }, [actions]);
const handleRedirect = (route, callback) => event => { const handleRedirect = (route, callback) => event => {
history.push(route); history.push(route);

View File

@ -13,14 +13,19 @@ import WebAssetIcon from "@material-ui/icons/WebAsset";
import DnsRoundedIcon from "@material-ui/icons/DnsRounded"; import DnsRoundedIcon from "@material-ui/icons/DnsRounded";
import SettingsInputSvideoIcon from "@material-ui/icons/SettingsInputSvideo"; import SettingsInputSvideoIcon from "@material-ui/icons/SettingsInputSvideo";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useWindowSize } from "@flare/react-hooks";
const useStyles = makeStyles(theme => { const useStyles = makeStyles(theme => {
return { return {
root: { horizontally: {
display: "flex", display: "flex",
flexDirection: "row", flexDirection: "row",
padding: 0 padding: 0
}, },
vertical: {
width: "100%",
maxWidth: 360
},
value: { value: {
fontSize: "0.9rem", fontSize: "0.9rem",
fontWeight: theme.typography.fontWeightMedium fontWeight: theme.typography.fontWeightMedium
@ -31,6 +36,12 @@ const useStyles = makeStyles(theme => {
const SystemVersionComponent = ({ data }) => { const SystemVersionComponent = ({ data }) => {
const classes = useStyles(); const classes = useStyles();
const { t } = useTranslation(); const { t } = useTranslation();
const { isMobile } = useWindowSize();
const listClassName = useMemo(
() => (isMobile ? classes.vertical : classes.horizontally),
[isMobile, classes.vertical, classes.horizontally]
);
const lastUpdateDate = useMemo(() => { const lastUpdateDate = useMemo(() => {
const format = "DD-MM-YYYY HH:mm:ss"; const format = "DD-MM-YYYY HH:mm:ss";
@ -63,7 +74,7 @@ const SystemVersionComponent = ({ data }) => {
<Typography variant="subtitle1" color="textSecondary"> <Typography variant="subtitle1" color="textSecondary">
{t("System.Versions.Title")} {t("System.Versions.Title")}
</Typography> </Typography>
<List className={classes.root}> <List className={listClassName}>
<ListItem> <ListItem>
<ListItemAvatar> <ListItemAvatar>
<Avatar> <Avatar>

View File

@ -8,7 +8,7 @@ import SystemVersionComponent from "./SystemVersionComponent";
const SystemVersionContainer = ({ actions, data }) => { const SystemVersionContainer = ({ actions, data }) => {
useEffect(() => { useEffect(() => {
actions.loadSystemVersion(); actions.loadSystemVersion();
}, []); }, [actions]);
return <>{data.loaded && <SystemVersionComponent data={data} />}</>; return <>{data.loaded && <SystemVersionComponent data={data} />}</>;
}; };