From c001ce21ba10462eb2b4a3ee7a09eeb29c8397bd Mon Sep 17 00:00:00 2001 From: Sean Macfarlane Date: Sun, 2 Aug 2020 13:20:03 -0400 Subject: [PATCH 1/8] update version --- package-lock.json | 8 ++++---- package.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index cf8a2b7..449a5e0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "wlan-cloud-ui", - "version": "0.2.4", + "version": "0.2.5", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1874,9 +1874,9 @@ } }, "@tip-wlan/wlan-cloud-ui-library": { - "version": "0.2.4", - "resolved": "https://tip.jfrog.io/artifactory/api/npm/tip-wlan-cloud-npm-repo/@tip-wlan/wlan-cloud-ui-library/-/@tip-wlan/wlan-cloud-ui-library-0.2.4.tgz", - "integrity": "sha1-TjgY8Jog3I95kD1OKmOXljGzXg8=" + "version": "0.2.5", + "resolved": "https://tip.jfrog.io/artifactory/api/npm/tip-wlan-cloud-npm-repo/@tip-wlan/wlan-cloud-ui-library/-/@tip-wlan/wlan-cloud-ui-library-0.2.5.tgz", + "integrity": "sha1-ApMzm7dU/bsMX89ft5d8+rkgfsE=" }, "@types/anymatch": { "version": "1.3.1", diff --git a/package.json b/package.json index 62f2525..39ba825 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wlan-cloud-ui", - "version": "0.2.4", + "version": "0.2.5", "author": "ConnectUs", "description": "React Portal", "engines": { @@ -20,7 +20,7 @@ "@ant-design/icons": "^4.2.1", "@apollo/react-hoc": "^3.1.4", "@apollo/react-hooks": "^3.1.3", - "@tip-wlan/wlan-cloud-ui-library": "^0.2.4", + "@tip-wlan/wlan-cloud-ui-library": "^0.2.5", "antd": "^4.3.1", "apollo-cache-inmemory": "^1.6.6", "apollo-client": "^2.6.10", From dc8374300ef2c12d978e84ad7360cccb146e1081 Mon Sep 17 00:00:00 2001 From: Sean Macfarlane Date: Mon, 3 Aug 2020 12:03:56 -0400 Subject: [PATCH 2/8] make API url dynamic --- Dockerfile | 6 +++++- app/config.js | 1 + app/index.html | 1 + app/index.js | 4 +--- docker_entrypoint.sh | 3 +++ generate_config_js.sh | 10 ++++++++++ 6 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 app/config.js create mode 100644 docker_entrypoint.sh create mode 100644 generate_config_js.sh diff --git a/Dockerfile b/Dockerfile index 161510c..fa4dcd0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,7 +24,11 @@ RUN npm run build # production environment FROM nginx:stable-alpine +RUN apk add --no-cache jq COPY --from=build /app/dist /usr/share/nginx/html COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf +COPY docker_entrypoint.sh generate_config_js.sh / +RUN chmod +x docker_entrypoint.sh generate_config_js.sh + EXPOSE 80 -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file +ENTRYPOINT ["/docker_entrypoint.sh"] \ No newline at end of file diff --git a/app/config.js b/app/config.js new file mode 100644 index 0000000..368bd2a --- /dev/null +++ b/app/config.js @@ -0,0 +1 @@ +window.REACT_APP_API = undefined; diff --git a/app/index.html b/app/index.html index 98ebab8..d08ff93 100644 --- a/app/index.html +++ b/app/index.html @@ -9,6 +9,7 @@ + diff --git a/app/index.js b/app/index.js index facf5c3..7e9a7fa 100644 --- a/app/index.js +++ b/app/index.js @@ -18,9 +18,7 @@ import { getItem, setItem, removeItem } from 'utils/localStorage'; import history from 'utils/history'; const API_URI = - process.env.NODE_ENV === 'development' - ? 'http://localhost:4000/' - : 'https://wlan-graphql.zone3.lab.connectus.ai/'; + process.env.NODE_ENV === 'development' ? 'http://localhost:4000/' : window.REACT_APP_API; const MOUNT_NODE = document.getElementById('root'); const cache = new InMemoryCache(); diff --git a/docker_entrypoint.sh b/docker_entrypoint.sh new file mode 100644 index 0000000..a935982 --- /dev/null +++ b/docker_entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/sh -eu +./generate_config_js.sh >/usr/share/nginx/html/config.js +nginx -g "daemon off;" \ No newline at end of file diff --git a/generate_config_js.sh b/generate_config_js.sh new file mode 100644 index 0000000..0726061 --- /dev/null +++ b/generate_config_js.sh @@ -0,0 +1,10 @@ +#!/bin/sh -eu +if [ -z "${API:-}" ]; then + API_URL_JSON=undefined +else + API_URL_JSON=$(jq -n --arg api '$API' '$api') +fi + +cat < Date: Mon, 3 Aug 2020 12:08:08 -0400 Subject: [PATCH 3/8] fixed Alarms error handling --- app/containers/Alarms/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/containers/Alarms/index.js b/app/containers/Alarms/index.js index 5218731..90ab355 100644 --- a/app/containers/Alarms/index.js +++ b/app/containers/Alarms/index.js @@ -31,6 +31,7 @@ const Alarms = () => { const { customerId } = useContext(UserContext); const { loading, error, data, refetch, fetchMore } = useQuery(GET_ALL_ALARMS, { variables: { customerId }, + errorPolicy: 'all', }); const handleOnReload = () => { @@ -73,9 +74,10 @@ const Alarms = () => { return ; } - if (error) { + if (error && !data?.getAllAlarms?.items) { return ; } + return ( Date: Mon, 3 Aug 2020 13:21:13 -0400 Subject: [PATCH 4/8] fixed client history --- .../Network/containers/ClientDeviceDetails/index.js | 6 +++--- app/graphql/queries.js | 1 + package.json | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/containers/Network/containers/ClientDeviceDetails/index.js b/app/containers/Network/containers/ClientDeviceDetails/index.js index 4ac72e4..e60ecd6 100644 --- a/app/containers/Network/containers/ClientDeviceDetails/index.js +++ b/app/containers/Network/containers/ClientDeviceDetails/index.js @@ -12,7 +12,7 @@ import UserContext from 'contexts/UserContext'; import { GET_CLIENT_SESSION, FILTER_SERVICE_METRICS } from 'graphql/queries'; const toTime = moment(); -const fromTime = moment().subtract(1, 'hour'); +const fromTime = moment().subtract(4, 'hours'); const ClientDeviceDetails = () => { const { id } = useParams(); @@ -33,7 +33,7 @@ const ClientDeviceDetails = () => { toTime: toTime.valueOf().toString(), clientMacs: [id], dataTypes: ['Client'], - limit: 100, + limit: 1000, }, }); @@ -73,7 +73,7 @@ const ClientDeviceDetails = () => { metricsData={ metricsData && metricsData.filterServiceMetrics && metricsData.filterServiceMetrics.items } - historyDate={toTime} + historyDate={{ toTime, fromTime }} /> ); }; diff --git a/app/graphql/queries.js b/app/graphql/queries.js index e10553a..f3784f0 100644 --- a/app/graphql/queries.js +++ b/app/graphql/queries.js @@ -181,6 +181,7 @@ export const FILTER_SERVICE_METRICS = gql` rssi rxBytes txBytes + detailsJSON } context { lastPage diff --git a/package.json b/package.json index 39ba825..dd2238f 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "@ant-design/icons": "^4.2.1", "@apollo/react-hoc": "^3.1.4", "@apollo/react-hooks": "^3.1.3", - "@tip-wlan/wlan-cloud-ui-library": "^0.2.5", + "@tip-wlan/wlan-cloud-ui-library": "^0.2.6", "antd": "^4.3.1", "apollo-cache-inmemory": "^1.6.6", "apollo-client": "^2.6.10", From 06cb3feac3b0990e318bef7835c3c64e3a724742 Mon Sep 17 00:00:00 2001 From: Sean Macfarlane Date: Mon, 3 Aug 2020 14:32:56 -0400 Subject: [PATCH 5/8] fixed jq --- generate_config_js.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generate_config_js.sh b/generate_config_js.sh index 0726061..e068c14 100644 --- a/generate_config_js.sh +++ b/generate_config_js.sh @@ -2,9 +2,9 @@ if [ -z "${API:-}" ]; then API_URL_JSON=undefined else - API_URL_JSON=$(jq -n --arg api '$API' '$api') + API_URL_JSON=$(jq -n --arg api "$API" '$api') fi cat < Date: Mon, 3 Aug 2020 14:51:02 -0400 Subject: [PATCH 6/8] update versiom --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 449a5e0..d2ee921 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1874,9 +1874,9 @@ } }, "@tip-wlan/wlan-cloud-ui-library": { - "version": "0.2.5", - "resolved": "https://tip.jfrog.io/artifactory/api/npm/tip-wlan-cloud-npm-repo/@tip-wlan/wlan-cloud-ui-library/-/@tip-wlan/wlan-cloud-ui-library-0.2.5.tgz", - "integrity": "sha1-ApMzm7dU/bsMX89ft5d8+rkgfsE=" + "version": "0.2.6", + "resolved": "https://tip.jfrog.io/artifactory/api/npm/tip-wlan-cloud-npm-repo/@tip-wlan/wlan-cloud-ui-library/-/@tip-wlan/wlan-cloud-ui-library-0.2.6.tgz", + "integrity": "sha1-3wqsp6QOcfvfSbnM41UVI4ZN5Hg=" }, "@types/anymatch": { "version": "1.3.1", From c59542426918362dbcb6d75c8473f75bb3ed76e5 Mon Sep 17 00:00:00 2001 From: Sean Macfarlane Date: Mon, 3 Aug 2020 17:17:25 -0400 Subject: [PATCH 7/8] update version --- package-lock.json | 8 ++++---- package.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index d2ee921..fc12255 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "wlan-cloud-ui", - "version": "0.2.5", + "version": "0.2.7", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1874,9 +1874,9 @@ } }, "@tip-wlan/wlan-cloud-ui-library": { - "version": "0.2.6", - "resolved": "https://tip.jfrog.io/artifactory/api/npm/tip-wlan-cloud-npm-repo/@tip-wlan/wlan-cloud-ui-library/-/@tip-wlan/wlan-cloud-ui-library-0.2.6.tgz", - "integrity": "sha1-3wqsp6QOcfvfSbnM41UVI4ZN5Hg=" + "version": "0.2.7", + "resolved": "https://tip.jfrog.io/artifactory/api/npm/tip-wlan-cloud-npm-repo/@tip-wlan/wlan-cloud-ui-library/-/@tip-wlan/wlan-cloud-ui-library-0.2.7.tgz", + "integrity": "sha1-GGCapOJxcgD36ml6ZU2j1AlzXio=" }, "@types/anymatch": { "version": "1.3.1", diff --git a/package.json b/package.json index dd2238f..dcb651a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wlan-cloud-ui", - "version": "0.2.5", + "version": "0.2.7", "author": "ConnectUs", "description": "React Portal", "engines": { @@ -20,7 +20,7 @@ "@ant-design/icons": "^4.2.1", "@apollo/react-hoc": "^3.1.4", "@apollo/react-hooks": "^3.1.3", - "@tip-wlan/wlan-cloud-ui-library": "^0.2.6", + "@tip-wlan/wlan-cloud-ui-library": "^0.2.7", "antd": "^4.3.1", "apollo-cache-inmemory": "^1.6.6", "apollo-client": "^2.6.10", From afc222bb4a4c21e0edf3cd63e2a4294f0074439a Mon Sep 17 00:00:00 2001 From: Sean Macfarlane Date: Tue, 4 Aug 2020 01:46:25 -0400 Subject: [PATCH 8/8] fixed root path bug --- app/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/index.html b/app/index.html index d08ff93..3524b2a 100644 --- a/app/index.html +++ b/app/index.html @@ -9,7 +9,7 @@ - +