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/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 ( { 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/app/index.html b/app/index.html index 98ebab8..3524b2a 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..e068c14 --- /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 <