50 Commits

Author SHA1 Message Date
Sean Macfarlane
a952a40eb5 v1.1.18 2021-06-25 17:37:53 -04:00
Sean Macfarlane
6c0e5f959d Merge pull request #104 from Telecominfraproject/hotfix/AutofillCss
hotfix/AutofillCss: Fixed autofill styling
2021-06-25 13:48:09 -04:00
Sean Macfarlane
4450a01397 Merge pull request #105 from Telecominfraproject/hotfix/ApRadiosOrder
hotfix/ApRadiosOrder: Changed USER_FRIENDLY_RADIOS order
2021-06-25 13:46:37 -04:00
irtiza-h30
5d3192e314 changed USER_FRIENDLY_RADIOS order 2021-06-25 13:01:01 -04:00
irtiza-h30
7ccebb107a added all fonts 2021-06-24 14:28:40 -04:00
irtiza-h30
42eaa86893 fixed autofill css 2021-06-24 14:19:26 -04:00
Sean Macfarlane
48f6a64790 Merge pull request #103 from Telecominfraproject/hotfix/ScrollToTopComponent
hotfix/ScrollToTop: Added ScrollToTop  component
2021-06-23 12:16:15 -04:00
irtiza-h30
879c97f44d fixed ScrollToTop import 2021-06-22 18:59:42 -04:00
irtiza-h30
01599ca670 Added ScrollToTop component 2021-06-22 15:30:46 -04:00
Sean Macfarlane
1be788925e v1.1.17 2021-06-21 14:08:57 -04:00
Sean Macfarlane
3697d0b4a9 v1.1.16 2021-06-11 15:23:43 -04:00
Sean Macfarlane
a9655e25aa v1.1.15 2021-06-09 13:10:13 -04:00
Sean Macfarlane
6bd8beb436 v1.1.14 2021-06-07 12:52:10 -04:00
Sean Macfarlane
e023ef0569 v1.1.13 2021-06-02 15:28:40 -04:00
Sean Macfarlane
8d93cf4f73 updated library 2021-06-01 13:53:33 -04:00
Sean Macfarlane
87b056967f v1.1.12 2021-05-31 18:06:04 -04:00
norm-traxler
d6d207c058 Merge pull request #102 from Telecominfraproject/WIFI-2434
WIFI-2434: Update SDK master to use image tag 1.2.0-SNAPSHOT
2021-05-26 23:04:17 -04:00
Akshay Jagadish
0017541d82 WIFI-2434: Update SDK master to use image tag 1.2.0-SNAPSHOT 2021-05-26 19:03:40 -04:00
Sean Macfarlane
eab3476dbe v1.1.11 2021-05-26 15:36:10 -04:00
Sean Macfarlane
ff5b6dc1fc install library 2021-05-21 14:07:36 -04:00
Sean Macfarlane
40033efb61 v1.1.10 2021-05-21 13:43:54 -04:00
Sean Macfarlane
516fb50817 Merge pull request #101 from Telecominfraproject/hotfix/AddProfileFileUpload
hotfix/AddProfileFileUpload: Added file uploading to Add Profile
2021-05-19 13:35:42 -04:00
irtiza-h30
4449465edc Added file uploading to Add Profile 2021-05-18 18:27:11 -04:00
Sean Macfarlane
57f91633c2 v1.1.9 2021-05-13 10:57:50 -04:00
Sean Macfarlane
aa559971d8 WIFI-2013 2021-05-13 10:57:11 -04:00
Sean Macfarlane
84c8dc19ce updated dev API 2021-05-03 16:32:08 -04:00
Sean Macfarlane
77dd63ea43 Merge pull request #97 from Telecominfraproject/NOJIRA-replace-highcharts
WIFI-1917: Make compatible with recharts
2021-05-03 15:45:13 -04:00
Sean Macfarlane
adcffb5b73 v1.1.8 2021-05-03 15:30:24 -04:00
Sean Macfarlane
2c0171fe7a Merge branch 'master' into NOJIRA-replace-highcharts 2021-05-03 14:46:43 -04:00
Sean Macfarlane
debd0712b3 v.1.1.7 2021-04-26 15:03:59 -04:00
Sean Macfarlane
0c39ad4d52 v1.1.6 2021-04-21 20:22:05 -04:00
Sean Macfarlane
23574b0970 Merge pull request #100 from Telecominfraproject/bugfix/WIFI-1846
bugfix/WIFI-1846: Fixed fetchPolicy for AP details profile dropdown
2021-04-21 16:12:37 -04:00
Sean Macfarlane
177b41dc8d v1.1.5 2021-04-21 16:10:54 -04:00
irtiza-h30
9b5340dfcd fixed fetchPolicy for AP details profile dropdown 2021-04-21 14:55:08 -04:00
Sean Macfarlane
d3be117c5b Merge pull request #99 from Telecominfraproject/WIFI-2026
WIFI-2026 Change docker tags from 0.0.1-SNAPSHOT to 1.1.0-SNAPSHOT
2021-04-16 17:03:05 -04:00
Akshay Jagadish
f317b2869a WIFI-2026 Change docker tags from 0.0.1-SNAPSHOT to 1.1.0-SNAPSHOT 2021-04-16 15:59:16 -04:00
Sean Macfarlane
3cf5c9e732 v1.1.4 2021-04-16 14:41:48 -04:00
Sean Macfarlane
170d62aee8 v1.1.3 2021-04-09 14:33:57 -04:00
Sean Macfarlane
ca7acd6e80 update version 2021-04-08 14:43:17 -04:00
Sean Macfarlane
2bd5601443 Merge pull request #98 from Telecominfraproject/bugfix/NETEXP-1399
bugfix/NETEXP-1399: Added Pagination for AP select in Auto-Provision page
2021-04-07 15:19:01 -04:00
irtiza-h30
eecae86de6 pagination for AP select in Auto-Provision page 2021-04-07 14:40:51 -04:00
Hassan Azmi
90c4e5bedc add recharts and remove highcharts 2021-04-01 14:19:40 -04:00
Sean Macfarlane
f6fbe3a52a fixed graphql API 2021-04-01 12:32:13 -04:00
Hassan Azmi
a526b70fc2 make compatible with recharts 2021-04-01 11:11:56 -04:00
Sean Macfarlane
8ed817256f fixed webpack 2021-03-29 16:46:36 -04:00
Sean Macfarlane
eab121730c fixed webpack 2021-03-28 16:04:36 -04:00
Sean Macfarlane
b73d547223 temp webpack fix 2021-03-26 18:07:06 -04:00
Sean Macfarlane
08b8038c60 fixed webpack 2021-03-25 16:50:39 -04:00
Sean Macfarlane
9d9938fb4a Merge pull request #96 from Telecominfraproject/bugfix/NETEXP-1296
bugfix/NETEXP-1296: Fixed refetching of service metrics data
2021-03-24 11:15:33 -04:00
irtiza-h30
e7cb25a398 fixed refetching of service metrics data 2021-03-23 20:00:06 -04:00
17 changed files with 5587 additions and 5512 deletions

View File

@@ -61,7 +61,7 @@ jobs:
[[ "${{ github.ref }}" == "refs/heads/release/"* ]] && VERSION=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\/release\/[v]//' | awk '{print $1"-SNAPSHOT"}') [[ "${{ github.ref }}" == "refs/heads/release/"* ]] && VERSION=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\/release\/[v]//' | awk '{print $1"-SNAPSHOT"}')
# Use Docker `latest` tag convention # Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=0.0.1-SNAPSHOT [ "$VERSION" == "master" ] && VERSION=1.2.0-SNAPSHOT
TIMESTAMP=$(date +'%Y-%m-%d') TIMESTAMP=$(date +'%Y-%m-%d')
@@ -96,7 +96,7 @@ jobs:
[[ "${{ github.ref }}" == "refs/heads/release/"* ]] && VERSION=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\/release\/[v]//' | awk '{print $1"-SNAPSHOT"}') [[ "${{ github.ref }}" == "refs/heads/release/"* ]] && VERSION=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\/release\/[v]//' | awk '{print $1"-SNAPSHOT"}')
# Use Docker `latest` tag convention # Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=0.0.1-SNAPSHOT [ "$VERSION" == "master" ] && VERSION=1.2.0-SNAPSHOT
echo IMAGE_ID=$IMAGE_ID echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION echo VERSION=$VERSION

View File

@@ -3,9 +3,9 @@ export const COMPANY = 'Telecom Infra Project';
export const USER_FRIENDLY_RADIOS = { export const USER_FRIENDLY_RADIOS = {
is2dot4GHz: '2.4GHz', is2dot4GHz: '2.4GHz',
is5GHz: '5GHz',
is5GHzL: '5GHz (L)', is5GHzL: '5GHz (L)',
is5GHzU: '5GHz (U)', is5GHzU: '5GHz (U)',
is5GHz: '5GHz',
}; };
export const ROUTES = { export const ROUTES = {

View File

@@ -95,7 +95,7 @@ const Accounts = () => {
} }
}; };
const handleCreateUser = (email, password, roles) => { const handleCreateUser = ({ email, password, roles }) => {
createUser({ createUser({
variables: { variables: {
username: email, username: email,
@@ -119,7 +119,7 @@ const Accounts = () => {
); );
}; };
const handleEditUser = (id, email, password, roles, lastModifiedTimestamp) => { const handleEditUser = ({ id, email, password, roles, lastModifiedTimestamp }) => {
updateUser({ updateUser({
variables: { variables: {
id, id,

View File

@@ -4,10 +4,11 @@ import { useMutation, useQuery, gql } from '@apollo/client';
import { notification } from 'antd'; import { notification } from 'antd';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import { ROUTES } from 'constants/index'; import { ROUTES, AUTH_TOKEN } from 'constants/index';
import UserContext from 'contexts/UserContext'; import UserContext from 'contexts/UserContext';
import { GET_ALL_PROFILES } from 'graphql/queries'; import { GET_ALL_PROFILES, GET_API_URL } from 'graphql/queries';
import { fetchMoreProfiles } from 'graphql/functions'; import { fetchMoreProfiles } from 'graphql/functions';
import { getItem } from 'utils/localStorage';
const CREATE_PROFILE = gql` const CREATE_PROFILE = gql`
mutation CreateProfile( mutation CreateProfile(
@@ -35,6 +36,9 @@ const CREATE_PROFILE = gql`
const AddProfile = () => { const AddProfile = () => {
const { customerId } = useContext(UserContext); const { customerId } = useContext(UserContext);
const { data: apiUrl } = useQuery(GET_API_URL);
const { data: ssidProfiles, fetchMore } = useQuery(GET_ALL_PROFILES(), { const { data: ssidProfiles, fetchMore } = useQuery(GET_ALL_PROFILES(), {
variables: { customerId, type: 'ssid' }, variables: { customerId, type: 'ssid' },
fetchPolicy: 'network-only', fetchPolicy: 'network-only',
@@ -116,6 +120,46 @@ const AddProfile = () => {
else fetchMoreProfiles(e, ssidProfiles, fetchMore); else fetchMoreProfiles(e, ssidProfiles, fetchMore);
}; };
const handleFileUpload = async (fileName, file) => {
const token = getItem(AUTH_TOKEN);
if (apiUrl?.getApiUrl) {
fetch(`${apiUrl?.getApiUrl}filestore/${fileName}`, {
method: 'POST',
headers: {
Authorization: token ? `Bearer ${token.access_token}` : '',
'Content-Type': 'application/octet-stream',
},
body: file,
})
.then(response => response.json())
.then(resp => {
if (resp?.success) {
notification.success({
message: 'Success',
description: 'File successfully uploaded.',
});
} else {
notification.error({
message: 'Error',
description: 'File could not be uploaded.',
});
}
})
.catch(() => {
notification.error({
message: 'Error',
description: 'File could not be uploaded.',
});
});
} else {
notification.error({
message: 'Error',
description: 'File could not be uploaded.',
});
}
};
return ( return (
<AddProfilePage <AddProfilePage
onCreateProfile={handleAddProfile} onCreateProfile={handleAddProfile}
@@ -127,6 +171,7 @@ const AddProfile = () => {
idProviderProfiles={idProviderProfiles?.getAllProfiles?.items} idProviderProfiles={idProviderProfiles?.getAllProfiles?.items}
rfProfiles={rfProfiles?.getAllProfiles?.items} rfProfiles={rfProfiles?.getAllProfiles?.items}
onFetchMoreProfiles={handleFetchMoreProfiles} onFetchMoreProfiles={handleFetchMoreProfiles}
fileUpload={handleFileUpload}
/> />
); );
}; };

View File

@@ -75,7 +75,6 @@ const App = () => {
<Helmet titleTemplate={`%s - ${COMPANY}`} defaultTitle={COMPANY}> <Helmet titleTemplate={`%s - ${COMPANY}`} defaultTitle={COMPANY}>
<meta name="description" content={COMPANY} /> <meta name="description" content={COMPANY} />
</Helmet> </Helmet>
<Switch> <Switch>
<UnauthenticatedRoute exact path={ROUTES.login} component={Login} /> <UnauthenticatedRoute exact path={ROUTES.login} component={Login} />
<ProtectedRouteWithLayout exact path={ROUTES.root} component={RedirectToDashboard} /> <ProtectedRouteWithLayout exact path={ROUTES.root} component={RedirectToDashboard} />

View File

@@ -20,8 +20,11 @@ function formatBytes(bytes, decimals = 2) {
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i] || ''}`; return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i] || ''}`;
} }
function trafficLabelFormatter() { function trafficLabelFormatter(bytes) {
return formatBytes(this.value); if (this?.value) {
return formatBytes(this.value);
}
return formatBytes(bytes);
} }
function trafficTooltipFormatter() { function trafficTooltipFormatter() {
@@ -31,7 +34,7 @@ function trafficTooltipFormatter() {
} }
const lineChartConfig = [ const lineChartConfig = [
{ key: 'inservicesAPs', title: 'Inservice APs (24 hours)' }, { key: 'service', title: 'Inservice APs (24 hours)' },
{ key: 'clientDevices', title: 'Client Devices (24 hours)' }, { key: 'clientDevices', title: 'Client Devices (24 hours)' },
{ {
key: 'traffic', key: 'traffic',
@@ -56,9 +59,11 @@ const Dashboard = () => {
}); });
const [lineChartData, setLineChartData] = useState({ const [lineChartData, setLineChartData] = useState({
inservicesAPs: { service: {
key: 'Inservice APs', inservicesAPs: {
value: [], key: 'Inservice APs',
value: [],
},
}, },
clientDevices: { clientDevices: {
is2dot4GHz: { is2dot4GHz: {
@@ -121,22 +126,23 @@ const Dashboard = () => {
}, },
}, },
}) => { }) => {
inservicesAPs.push([eventTimestamp, equipmentInServiceCount]); const timestamp = parseInt(eventTimestamp, 10);
inservicesAPs.push({ timestamp, value: equipmentInServiceCount });
let total5GHz = 0; let total5GHz = 0;
total5GHz += (radios?.is5GHz || 0) + (radios?.is5GHzL || 0) + (radios?.is5GHzU || 0); // combine all 5GHz radios total5GHz += (radios?.is5GHz || 0) + (radios?.is5GHzL || 0) + (radios?.is5GHzU || 0); // combine all 5GHz radios
clientDevices2dot4GHz.push([eventTimestamp, radios.is2dot4GHz || 0]); clientDevices2dot4GHz.push({ timestamp, value: radios.is2dot4GHz || 0 });
clientDevices5GHz.push([eventTimestamp, total5GHz || 0]); clientDevices5GHz.push({ timestamp, value: total5GHz || 0 });
trafficBytesDownstreamData.push([ trafficBytesDownstreamData.push({
eventTimestamp, timestamp,
(trafficBytesDownstream > 0 && trafficBytesDownstream) || 0, value: (trafficBytesDownstream > 0 && trafficBytesDownstream) || 0,
]); });
trafficBytesUpstreamData.push([ trafficBytesUpstreamData.push({
eventTimestamp, timestamp,
(trafficBytesUpstream > 0 && trafficBytesUpstream) || 0, value: (trafficBytesUpstream > 0 && trafficBytesUpstream) || 0,
]); });
totalDown += (trafficBytesDownstream > 0 && trafficBytesDownstream) || 0; totalDown += (trafficBytesDownstream > 0 && trafficBytesDownstream) || 0;
totalUp += (trafficBytesUpstream > 0 && trafficBytesUpstream) || 0; totalUp += (trafficBytesUpstream > 0 && trafficBytesUpstream) || 0;
@@ -144,9 +150,11 @@ const Dashboard = () => {
); );
return { return {
inservicesAPs: { service: {
...prev.inservicesAPs, inservicesAPs: {
value: [...prev.inservicesAPs.value, ...inservicesAPs], ...prev.service.inservicesAPs,
value: [...prev.service.inservicesAPs.value, ...inservicesAPs],
},
}, },
clientDevices: { clientDevices: {
is2dot4GHz: { is2dot4GHz: {

View File

@@ -63,6 +63,7 @@ const AccessPointDetails = ({ locations }) => {
}`), }`),
{ {
variables: { customerId, type: 'equipment_ap' }, variables: { customerId, type: 'equipment_ap' },
fetchPolicy: 'network-only',
} }
); );
@@ -70,7 +71,7 @@ const AccessPointDetails = ({ locations }) => {
loading: metricsLoading, loading: metricsLoading,
error: metricsError, error: metricsError,
data: metricsData, data: metricsData,
refetch: metricsRefetch, fetchMore: fetchMoreServiceMetrics,
} = useQuery(FILTER_SERVICE_METRICS, { } = useQuery(FILTER_SERVICE_METRICS, {
variables: { variables: {
customerId, customerId,
@@ -90,7 +91,29 @@ const AccessPointDetails = ({ locations }) => {
const refetchData = () => { const refetchData = () => {
refetch(); refetch();
metricsRefetch(); fetchMoreServiceMetrics({
variables: {
fromTime: moment()
.subtract(2, 'minutes')
.valueOf()
.toString(),
toTime: moment()
.valueOf()
.toString(),
},
updateQuery: (previousResult, { fetchMoreResult }) => {
const previousEntry = previousResult.filterServiceMetrics;
const newItems = fetchMoreResult.filterServiceMetrics.items;
return {
filterServiceMetrics: {
context: fetchMoreResult.filterServiceMetrics.context,
items: [...previousEntry.items, ...newItems],
__typename: previousEntry.__typename,
},
};
},
});
}; };
const handleUpdateEquipment = ({ const handleUpdateEquipment = ({

View File

@@ -6,6 +6,7 @@ import { AutoProvision as AutoProvisionPage, Loading } from '@tip-wlan/wlan-clou
import UserContext from 'contexts/UserContext'; import UserContext from 'contexts/UserContext';
import { GET_CUSTOMER, GET_ALL_LOCATIONS, GET_ALL_PROFILES } from 'graphql/queries'; import { GET_CUSTOMER, GET_ALL_LOCATIONS, GET_ALL_PROFILES } from 'graphql/queries';
import { UPDATE_CUSTOMER } from 'graphql/mutations'; import { UPDATE_CUSTOMER } from 'graphql/mutations';
import { fetchMoreProfiles } from 'graphql/functions';
const AutoProvision = () => { const AutoProvision = () => {
const { customerId } = useContext(UserContext); const { customerId } = useContext(UserContext);
@@ -14,13 +15,13 @@ const AutoProvision = () => {
}); });
const [updateCustomer] = useMutation(UPDATE_CUSTOMER); const [updateCustomer] = useMutation(UPDATE_CUSTOMER);
const { data: dataLocation, loading: loadingLoaction, error: errorLocation } = useQuery( const { data: dataLocation, loading: loadingLocation, error: errorLocation } = useQuery(
GET_ALL_LOCATIONS, GET_ALL_LOCATIONS,
{ {
variables: { customerId }, variables: { customerId },
} }
); );
const { data: dataProfile, loading: loadingProfile, error: errorProfile } = useQuery( const { data: dataProfile, loading: loadingProfile, error: errorProfile, fetchMore } = useQuery(
GET_ALL_PROFILES(), GET_ALL_PROFILES(),
{ {
variables: { customerId, type: 'equipment_ap', limit: 100 }, variables: { customerId, type: 'equipment_ap', limit: 100 },
@@ -60,6 +61,10 @@ const AutoProvision = () => {
); );
}; };
const handleFetchMoreProfiles = e => {
fetchMoreProfiles(e, dataProfile, fetchMore);
};
if (loading) { if (loading) {
return <Loading />; return <Loading />;
} }
@@ -75,11 +80,12 @@ const AutoProvision = () => {
data={data && data.getCustomer} data={data && data.getCustomer}
dataLocation={dataLocation && dataLocation.getAllLocations} dataLocation={dataLocation && dataLocation.getAllLocations}
dataProfile={dataProfile && dataProfile.getAllProfiles.items} dataProfile={dataProfile && dataProfile.getAllProfiles.items}
loadingLoaction={loadingLoaction} loadingLocation={loadingLocation}
loadingProfile={loadingProfile} loadingProfile={loadingProfile}
errorLocation={errorLocation} errorLocation={errorLocation}
errorProfile={errorProfile} errorProfile={errorProfile}
onUpdateCustomer={handleUpdateCustomer} onUpdateCustomer={handleUpdateCustomer}
onFetchMoreProfiles={handleFetchMoreProfiles}
/> />
); );
}; };

View File

@@ -1,11 +1,12 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { RolesProvider } from '@tip-wlan/wlan-cloud-ui-library';
import UserContext from 'contexts/UserContext'; import UserContext from 'contexts/UserContext';
const UserProvider = ({ children, id, email, roles, customerId, updateUser, updateToken }) => ( const UserProvider = ({ children, id, email, roles, customerId, updateUser, updateToken }) => (
<UserContext.Provider value={{ id, email, roles, customerId, updateUser, updateToken }}> <UserContext.Provider value={{ id, email, roles, customerId, updateUser, updateToken }}>
{children} <RolesProvider role={roles}>{children}</RolesProvider>
</UserContext.Provider> </UserContext.Provider>
); );

View File

@@ -14,6 +14,7 @@ import { AUTH_TOKEN } from 'constants/index';
import { REFRESH_TOKEN } from 'graphql/mutations'; import { REFRESH_TOKEN } from 'graphql/mutations';
import { getItem, setItem, removeItem } from 'utils/localStorage'; import { getItem, setItem, removeItem } from 'utils/localStorage';
import history from 'utils/history'; import history from 'utils/history';
import { ScrollToTop } from '@tip-wlan/wlan-cloud-ui-library';
const API_URI = process.env.NODE_ENV === 'production' ? window.REACT_APP_API : process.env.API; const API_URI = process.env.NODE_ENV === 'production' ? window.REACT_APP_API : process.env.API;
const MOUNT_NODE = document.getElementById('root'); const MOUNT_NODE = document.getElementById('root');
@@ -102,6 +103,7 @@ const render = () => {
ReactDOM.render( ReactDOM.render(
<Router history={history}> <Router history={history}>
<ApolloProvider client={client}> <ApolloProvider client={client}>
<ScrollToTop />
<App /> <App />
</ApolloProvider> </ApolloProvider>
</Router>, </Router>,

View File

@@ -1,3 +1,14 @@
body { body {
font-family: 'Lato', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-family: 'Lato', 'Helvetica Neue', Helvetica, Arial, sans-serif;
} }
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
input:-webkit-autofill::first-line {
-webkit-transition: color 9999s ease-out, background-color 9999s ease-out;
transition: color 9999s ease-out, background-color 9999s ease-out;
font-size: 14px !important;
font-family: 'Lato', 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
}

10781
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "wlan-cloud-ui", "name": "wlan-cloud-ui",
"version": "1.0.6", "version": "1.1.18",
"author": "ConnectUs", "author": "ConnectUs",
"description": "React Portal", "description": "React Portal",
"engines": { "engines": {
@@ -9,9 +9,9 @@
}, },
"scripts": { "scripts": {
"test": "jest --passWithNoTests --coverage", "test": "jest --passWithNoTests --coverage",
"start": "cross-env NODE_ENV=development webpack-dev-server", "start": "cross-env NODE_ENV=development webpack serve --mode development",
"start:bare": "cross-env API=ttps://portal.rtl.lab.netexperience.com NODE_ENV=bare webpack-dev-server", "start:bare": "cross-env API=https://wlan-ui.tip-sdk.lab.netexperience.com NODE_ENV=bare webpack serve --mode development",
"start:dev": "cross-env API=https://portal.rtl.lab.netexperience.com NODE_ENV=development webpack-dev-server", "start:dev": "cross-env API=https://wlan-ui.tip-sdk.lab.netexperience.com NODE_ENV=development webpack serve --mode development",
"build": "webpack --mode=production", "build": "webpack --mode=production",
"format": "prettier --write 'app/**/*{.js,.scss}'", "format": "prettier --write 'app/**/*{.js,.scss}'",
"eslint-fix": "eslint --fix 'app/**/*.js'", "eslint-fix": "eslint --fix 'app/**/*.js'",
@@ -21,33 +21,26 @@
"dependencies": { "dependencies": {
"@ant-design/icons": "^4.2.1", "@ant-design/icons": "^4.2.1",
"@apollo/client": "^3.1.3", "@apollo/client": "^3.1.3",
"@tip-wlan/wlan-cloud-ui-library": "^1.0.9", "@tip-wlan/wlan-cloud-ui-library": "^1.1.27",
"antd": "^4.5.2", "antd": "^4.5.2",
"apollo-upload-client": "^13.0.0", "apollo-upload-client": "^13.0.0",
"clean-webpack-plugin": "^3.0.0", "graphql": "^15.5.0",
"graphql": "^14.6.0",
"highcharts": "^8.1.0",
"highcharts-react-official": "^3.0.0",
"history": "^4.10.1", "history": "^4.10.1",
"html-webpack-plugin": "^3.2.0",
"lodash": "^4.17.15", "lodash": "^4.17.15",
"mini-css-extract-plugin": "^0.9.0",
"moment": "^2.26.0", "moment": "^2.26.0",
"optimize-css-assets-webpack-plugin": "^5.0.3",
"prop-types": "^15.7.2", "prop-types": "^15.7.2",
"react": "^16.13.0", "react": "^16.13.0",
"react-dom": "^16.13.0", "react-dom": "^16.13.0",
"react-helmet": "^5.2.1", "react-helmet": "^5.2.1",
"react-jsx-highcharts": "^4.1.0",
"react-jsx-highstock": "^4.1.0",
"react-router-dom": "^5.1.2", "react-router-dom": "^5.1.2",
"terser-webpack-plugin": "^2.3.5" "recharts": "^2.0.9"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.8.7", "@babel/core": "^7.8.7",
"@babel/plugin-proposal-class-properties": "^7.8.3", "@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/preset-env": "^7.8.7", "@babel/preset-env": "^7.8.7",
"@babel/preset-react": "^7.8.3", "@babel/preset-react": "^7.8.3",
"@babel/runtime": "^7.13.10",
"@testing-library/react": "^10.0.3", "@testing-library/react": "^10.0.3",
"babel-core": "^6.26.3", "babel-core": "^6.26.3",
"babel-eslint": "^10.1.0", "babel-eslint": "^10.1.0",
@@ -55,8 +48,10 @@
"babel-loader": "^8.0.6", "babel-loader": "^8.0.6",
"babel-plugin-root-import": "^6.4.1", "babel-plugin-root-import": "^6.4.1",
"babel-polyfill": "^6.26.0", "babel-polyfill": "^6.26.0",
"clean-webpack-plugin": "^3.0.0",
"cross-env": "^7.0.2", "cross-env": "^7.0.2",
"css-loader": "^3.4.2", "css-loader": "^3.4.2",
"css-minimizer-webpack-plugin": "^1.3.0",
"eslint": "^6.8.0", "eslint": "^6.8.0",
"eslint-config-airbnb": "^18.0.1", "eslint-config-airbnb": "^18.0.1",
"eslint-config-prettier": "^6.10.0", "eslint-config-prettier": "^6.10.0",
@@ -68,20 +63,23 @@
"eslint-plugin-react": "^7.19.0", "eslint-plugin-react": "^7.19.0",
"eslint-plugin-react-hooks": "^2.5.0", "eslint-plugin-react-hooks": "^2.5.0",
"file-loader": "^5.1.0", "file-loader": "^5.1.0",
"html-webpack-plugin": "^5.3.1",
"husky": "^4.2.3", "husky": "^4.2.3",
"jest": "^25.4.0", "jest": "^25.4.0",
"less": "^3.11.1", "less": "^3.11.1",
"less-loader": "^5.0.0", "less-loader": "^6.2.0",
"lint-staged": "^10.0.8", "lint-staged": "^10.0.8",
"mini-css-extract-plugin": "^1.3.9",
"node-sass": "^4.13.1", "node-sass": "^4.13.1",
"prettier": "^1.19.1", "prettier": "^1.19.1",
"react-test-renderer": "^16.13.1", "react-test-renderer": "^16.13.1",
"sass-loader": "^8.0.2", "sass-loader": "^8.0.2",
"style-loader": "^1.1.3", "style-loader": "^1.1.3",
"webpack": "^4.42.0", "terser-webpack-plugin": "^5.1.1",
"webpack-cli": "^3.3.11", "webpack": "^5.28.0",
"webpack-dev-server": "^3.11.0", "webpack-cli": "^4.5.0",
"webpack-merge": "^4.2.2" "webpack-dev-server": "^3.11.2",
"webpack-merge": "^5.7.3"
}, },
"browserslist": [ "browserslist": [
"last 2 versions", "last 2 versions",

View File

@@ -1,4 +1,5 @@
const webpackMerge = require('webpack-merge'); /* eslint-disable import/no-extraneous-dependencies */
const { merge } = require('webpack-merge');
const common = require('./webpack/webpack.common'); const common = require('./webpack/webpack.common');
const envs = { const envs = {
@@ -9,4 +10,4 @@ const envs = {
/* eslint-disable global-require,import/no-dynamic-require */ /* eslint-disable global-require,import/no-dynamic-require */
const env = envs[process.env.NODE_ENV || 'production']; const env = envs[process.env.NODE_ENV || 'production'];
const envConfig = require(`./webpack/webpack.${env}.js`); const envConfig = require(`./webpack/webpack.${env}.js`);
module.exports = webpackMerge(common, envConfig); module.exports = merge(common, envConfig);

View File

@@ -1,4 +1,3 @@
const HtmlWebPackPlugin = require('html-webpack-plugin');
/* eslint-disable import/no-extraneous-dependencies */ /* eslint-disable import/no-extraneous-dependencies */
const webpack = require('webpack'); const webpack = require('webpack');
@@ -25,10 +24,6 @@ module.exports = {
], ],
}, },
plugins: [ plugins: [
new HtmlWebPackPlugin({
template: commonPaths.templatePath,
favicon: './app/images/favicon.ico',
}),
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env.API': JSON.stringify(process.env.API || 'http://localhost:4000'), 'process.env.API': JSON.stringify(process.env.API || 'http://localhost:4000'),
}), }),

View File

@@ -1,4 +1,6 @@
/* eslint-disable import/no-extraneous-dependencies */
const path = require('path'); const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const commonPaths = require('./paths'); const commonPaths = require('./paths');
@@ -52,7 +54,9 @@ module.exports = {
{ {
loader: 'less-loader', // compiles Less to CSS loader: 'less-loader', // compiles Less to CSS
options: { options: {
javascriptEnabled: true, lessOptions: {
javascriptEnabled: true,
},
}, },
}, },
], ],
@@ -79,4 +83,11 @@ module.exports = {
), ),
}, },
}, },
plugins: [
new HtmlWebpackPlugin({
template: commonPaths.templatePath,
favicon: './app/images/favicon.ico',
}),
],
}; };

View File

@@ -1,6 +1,8 @@
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); /* eslint-disable import/no-extraneous-dependencies */
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin'); const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin'); const TerserPlugin = require('terser-webpack-plugin');
const path = require('path'); const path = require('path');
@@ -8,45 +10,50 @@ const commonPaths = require('./paths');
module.exports = { module.exports = {
output: { output: {
filename: `${commonPaths.jsFolder}/[name].[hash].js`,
path: commonPaths.outputPath, path: commonPaths.outputPath,
publicPath: '/', publicPath: '/',
chunkFilename: `${commonPaths.jsFolder}/[name].[chunkhash].js`, filename: `${commonPaths.jsFolder}/[name].[chunkhash].js`,
chunkFilename: `${commonPaths.jsFolder}/[id].[chunkhash].js`,
}, },
optimization: { optimization: {
minimize: true, minimize: true,
minimizer: [ minimizer: [
new TerserPlugin({ new TerserPlugin({
// Use multi-process parallel running to improve the build speed terserOptions: {
// Default number of concurrent runs: os.cpus().length - 1 warnings: false,
parallel: true, compress: {
// Enable file caching comparisons: false,
cache: true, },
sourceMap: true, parse: {},
}), mangle: true,
new OptimizeCSSAssetsPlugin(), output: {
], comments: false,
// Automatically split vendor and commons ascii_only: true,
// https://twitter.com/wSokra/status/969633336732905474 },
// https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366
splitChunks: {
cacheGroups: {
vendors: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'initial',
}, },
async: { parallel: true,
}),
new CssMinimizerPlugin(),
],
nodeEnv: 'production',
sideEffects: true,
concatenateModules: true,
runtimeChunk: 'single',
splitChunks: {
chunks: 'all',
maxInitialRequests: 10,
minSize: 0,
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/, test: /[\\/]node_modules[\\/]/,
name: 'async', name(module) {
chunks: 'async', const packageName = module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1];
minChunks: 4, return `npm.${packageName.replace('@', '')}`;
},
}, },
}, },
}, },
// Keep the runtime chunk seperated to enable long term caching
// https://twitter.com/wSokra/status/969679223278505985
runtimeChunk: true,
}, },
module: { module: {
@@ -78,25 +85,48 @@ module.exports = {
{ {
loader: 'less-loader', // compiles Less to CSS loader: 'less-loader', // compiles Less to CSS
options: { options: {
javascriptEnabled: true, lessOptions: {
javascriptEnabled: true,
},
}, },
}, },
], ],
}, },
], ],
}, },
resolve: { resolve: {
modules: ['node_modules', 'app'], modules: ['node_modules', 'app'],
alias: { alias: {
app: path.resolve(__dirname, '../', 'app'), app: path.resolve(__dirname, '../', 'app'),
}, },
}, },
plugins: [ plugins: [
new CleanWebpackPlugin(), new CleanWebpackPlugin(),
// Minify and optimize the index.html
new HtmlWebpackPlugin({
template: commonPaths.templatePath,
favicon: './app/images/favicon.ico',
minify: {
removeComments: true,
collapseWhitespace: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
removeStyleLinkTypeAttributes: true,
keepClosingSlash: true,
minifyJS: true,
minifyCSS: true,
minifyURLs: true,
},
inject: true,
}),
new MiniCssExtractPlugin({ new MiniCssExtractPlugin({
filename: `${commonPaths.cssFolder}/[name].css`, filename: `${commonPaths.cssFolder}/[name].css`,
chunkFilename: `${commonPaths.cssFolder}/[name].css`, chunkFilename: `${commonPaths.cssFolder}/[id].css`,
}), }),
], ],
devtool: 'source-map',
}; };