Merge branch 'master' of https://github.com/Telecominfraproject/wlan-cloud-ui into feature/network-page-reload-function

This commit is contained in:
Alidev123
2020-08-04 11:45:06 -04:00
11 changed files with 34 additions and 14 deletions

View File

@@ -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;"]
ENTRYPOINT ["/docker_entrypoint.sh"]

1
app/config.js Normal file
View File

@@ -0,0 +1 @@
window.REACT_APP_API = undefined;

View File

@@ -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 <Loading />;
}
if (error) {
if (error && !data?.getAllAlarms?.items) {
return <Alert message="Error" description="Failed to load alarms." type="error" showIcon />;
}
return (
<AlarmsPage
data={data.getAllAlarms.items}

View File

@@ -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 }}
/>
);
};

View File

@@ -181,6 +181,7 @@ export const FILTER_SERVICE_METRICS = gql`
rssi
rxBytes
txBytes
detailsJSON
}
context {
lastPage

View File

@@ -9,6 +9,7 @@
<!-- Allow installing the app to the homescreen -->
<meta name="mobile-web-app-capable" content="yes" />
<script type="text/javascript" src="/config.js"></script>
</head>
<body>

View File

@@ -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();

3
docker_entrypoint.sh Normal file
View File

@@ -0,0 +1,3 @@
#!/bin/sh -eu
./generate_config_js.sh >/usr/share/nginx/html/config.js
nginx -g "daemon off;"

10
generate_config_js.sh Normal file
View File

@@ -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 <<EOF
window.REACT_APP_API = $API_URL_JSON;
EOF

8
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "wlan-cloud-ui",
"version": "0.2.4",
"version": "0.2.7",
"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.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",

View File

@@ -1,6 +1,6 @@
{
"name": "wlan-cloud-ui",
"version": "0.2.4",
"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.4",
"@tip-wlan/wlan-cloud-ui-library": "^0.2.7",
"antd": "^4.3.1",
"apollo-cache-inmemory": "^1.6.6",
"apollo-client": "^2.6.10",