mirror of
https://github.com/Telecominfraproject/wlan-cloud-ui.git
synced 2025-11-01 11:17:59 +00:00
Compare commits
57 Commits
feature/NE
...
NOJIRA/rep
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a526b70fc2 | ||
|
|
8ed817256f | ||
|
|
eab121730c | ||
|
|
b73d547223 | ||
|
|
08b8038c60 | ||
|
|
9d9938fb4a | ||
|
|
e7cb25a398 | ||
|
|
7810f51baf | ||
|
|
300f00cc85 | ||
|
|
0b83cce523 | ||
|
|
5de121330e | ||
|
|
252047aad4 | ||
|
|
a7c7b0f295 | ||
|
|
8d14212702 | ||
|
|
70d609643c | ||
|
|
a6e2f9b5c7 | ||
|
|
569ce9d5f9 | ||
|
|
a0506eaf07 | ||
|
|
31074ac42e | ||
|
|
2eebd4ac3d | ||
|
|
153e4f7dcf | ||
|
|
325f86ff42 | ||
|
|
5bff3379d5 | ||
|
|
a2cf42e90c | ||
|
|
0fd5803584 | ||
|
|
af98ac522a | ||
|
|
6baf3785da | ||
|
|
36682cd207 | ||
|
|
63ac433ad8 | ||
|
|
2ed09f903c | ||
|
|
2c0fa53896 | ||
|
|
9bf737c1eb | ||
|
|
cf5be15402 | ||
|
|
f3ee2f5a7c | ||
|
|
6ddd9b30f3 | ||
|
|
8acdd0ca4a | ||
|
|
8670e74b77 | ||
|
|
c8798dd6b3 | ||
|
|
82b5688503 | ||
|
|
fadb618c6a | ||
|
|
dbf54d26b6 | ||
|
|
11e7b92902 | ||
|
|
cb8364b1ab | ||
|
|
796bf24ef9 | ||
|
|
444a9a929d | ||
|
|
efea725ce9 | ||
|
|
7a3bcbb2cb | ||
|
|
a3e304323d | ||
|
|
af182c93c6 | ||
|
|
78fde75678 | ||
|
|
7eda2074b2 | ||
|
|
ded1b2d088 | ||
|
|
e1f0357c1f | ||
|
|
b84e156f74 | ||
|
|
cae23638ee | ||
|
|
569154ff95 | ||
|
|
78146969f3 |
21
.github/workflows/dockerpublish.yml
vendored
21
.github/workflows/dockerpublish.yml
vendored
@@ -5,6 +5,7 @@ on:
|
||||
# Publish `master` as Docker `latest` image.
|
||||
branches:
|
||||
- master
|
||||
- 'release/**'
|
||||
|
||||
# Publish `v1.2.3` tags as releases.
|
||||
tags:
|
||||
@@ -14,8 +15,8 @@ on:
|
||||
pull_request:
|
||||
|
||||
schedule:
|
||||
# runs nightly build at 5AM
|
||||
- cron: '00 09 * * *'
|
||||
# runs nightly build at 5AM
|
||||
- cron: '00 09 * * *'
|
||||
|
||||
env:
|
||||
IMAGE_NAME: wlan-cloud-ui
|
||||
@@ -48,7 +49,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Adding property file with component version and commit hash
|
||||
- name: Adding property file with component version and commit hash
|
||||
run: |
|
||||
# Strip git ref prefix from version
|
||||
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
|
||||
@@ -56,8 +57,11 @@ jobs:
|
||||
# Strip "v" prefix from tag name
|
||||
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
|
||||
|
||||
# Create a release snapshot if we are on release branch
|
||||
[[ "${{ 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
|
||||
[ "$VERSION" == "master" ] && VERSION=latest
|
||||
[ "$VERSION" == "master" ] && VERSION=0.0.1-SNAPSHOT
|
||||
|
||||
TIMESTAMP=$(date +'%Y-%m-%d')
|
||||
|
||||
@@ -88,8 +92,11 @@ jobs:
|
||||
# Strip "v" prefix from tag name
|
||||
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
|
||||
|
||||
# Create a release snapshot if we are on release branch
|
||||
[[ "${{ 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
|
||||
[ "$VERSION" == "master" ] && VERSION=latest
|
||||
[ "$VERSION" == "master" ] && VERSION=0.0.1-SNAPSHOT
|
||||
|
||||
echo IMAGE_ID=$IMAGE_ID
|
||||
echo VERSION=$VERSION
|
||||
@@ -97,6 +104,6 @@ jobs:
|
||||
|
||||
docker tag image $IMAGE_ID:$VERSION
|
||||
docker push $IMAGE_ID:$VERSION
|
||||
|
||||
|
||||
docker tag image $IMAGE_ID:$VERSION-$TIMESTAMP
|
||||
docker push $IMAGE_ID:$VERSION-$TIMESTAMP
|
||||
docker push $IMAGE_ID:$VERSION-$TIMESTAMP
|
||||
|
||||
@@ -7,7 +7,7 @@ import { useHistory } from 'react-router-dom';
|
||||
import { ROUTES } from 'constants/index';
|
||||
import UserContext from 'contexts/UserContext';
|
||||
import { GET_ALL_PROFILES } from 'graphql/queries';
|
||||
import { updateQueryGetAllProfiles } from 'graphql/functions';
|
||||
import { fetchMoreProfiles } from 'graphql/functions';
|
||||
|
||||
const CREATE_PROFILE = gql`
|
||||
mutation CreateProfile(
|
||||
@@ -37,24 +37,43 @@ const AddProfile = () => {
|
||||
const { customerId } = useContext(UserContext);
|
||||
const { data: ssidProfiles, fetchMore } = useQuery(GET_ALL_PROFILES(), {
|
||||
variables: { customerId, type: 'ssid' },
|
||||
fetchPolicy: 'network-only',
|
||||
});
|
||||
const { data: radiusProfiles, fetchMore: fetchMoreRadiusProfiles } = useQuery(
|
||||
GET_ALL_PROFILES(),
|
||||
{
|
||||
variables: { customerId, type: 'radius' },
|
||||
fetchPolicy: 'network-only',
|
||||
}
|
||||
);
|
||||
const { data: captiveProfiles, fetchMore: fetchMoreCaptiveProfiles } = useQuery(
|
||||
GET_ALL_PROFILES(),
|
||||
{
|
||||
variables: { customerId, type: 'captive_portal' },
|
||||
fetchPolicy: 'network-only',
|
||||
}
|
||||
);
|
||||
const { data: venueProfiles, fetchMore: fetchMoreVenueProfiles } = useQuery(GET_ALL_PROFILES(), {
|
||||
variables: { customerId, type: 'passpoint_venue' },
|
||||
fetchPolicy: 'network-only',
|
||||
});
|
||||
const { data: operatorProfiles, fetchMore: fetchMoreOperatorProfiles } = useQuery(
|
||||
GET_ALL_PROFILES(),
|
||||
{
|
||||
variables: { customerId, type: 'passpoint_operator' },
|
||||
fetchPolicy: 'network-only',
|
||||
}
|
||||
);
|
||||
const { data: idProviderProfiles, fetchMore: fetchMoreIdProviderProfiles } = useQuery(
|
||||
GET_ALL_PROFILES(),
|
||||
{
|
||||
variables: { customerId, type: 'passpoint_osu_id_provider' },
|
||||
fetchPolicy: 'network-only',
|
||||
}
|
||||
);
|
||||
const { data: rfProfiles, fetchMore: fetchMoreRfProfiles } = useQuery(GET_ALL_PROFILES(), {
|
||||
variables: { customerId, type: 'rf' },
|
||||
fetchPolicy: 'network-only',
|
||||
});
|
||||
const [createProfile] = useMutation(CREATE_PROFILE);
|
||||
const history = useHistory();
|
||||
@@ -84,111 +103,30 @@ const AddProfile = () => {
|
||||
);
|
||||
};
|
||||
|
||||
const handleFetchProfiles = e => {
|
||||
if (ssidProfiles.getAllProfiles.context.lastPage) {
|
||||
return false;
|
||||
}
|
||||
|
||||
e.persist();
|
||||
const { target } = e;
|
||||
|
||||
if (target.scrollTop + target.offsetHeight === target.scrollHeight) {
|
||||
fetchMore({
|
||||
variables: { context: { ...ssidProfiles.getAllProfiles.context } },
|
||||
updateQuery: updateQueryGetAllProfiles,
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
const handleFetchVenueProfiles = e => {
|
||||
if (venueProfiles.getAllProfiles.context.lastPage) {
|
||||
return false;
|
||||
}
|
||||
|
||||
e.persist();
|
||||
const { target } = e;
|
||||
|
||||
if (target.scrollTop + target.offsetHeight === target.scrollHeight) {
|
||||
fetchMoreVenueProfiles({
|
||||
variables: { context: { ...venueProfiles.getAllProfiles.context } },
|
||||
updateQuery: updateQueryGetAllProfiles,
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
const handleFetchRfProfiles = e => {
|
||||
if (rfProfiles.getAllProfiles.context.lastPage) {
|
||||
return false;
|
||||
}
|
||||
|
||||
e.persist();
|
||||
const { target } = e;
|
||||
|
||||
if (target.scrollTop + target.offsetHeight === target.scrollHeight) {
|
||||
fetchMoreRfProfiles({
|
||||
variables: { context: { ...rfProfiles.getAllProfiles.context } },
|
||||
updateQuery: updateQueryGetAllProfiles,
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
const handleFetchOperatorProfiles = e => {
|
||||
if (operatorProfiles.getAllProfiles.context.lastPage) {
|
||||
return false;
|
||||
}
|
||||
|
||||
e.persist();
|
||||
const { target } = e;
|
||||
|
||||
if (target.scrollTop + target.offsetHeight === target.scrollHeight) {
|
||||
fetchMoreOperatorProfiles({
|
||||
variables: { context: { ...operatorProfiles.getAllProfiles.context } },
|
||||
updateQuery: updateQueryGetAllProfiles,
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
const handleFetchIdProviderProfiles = e => {
|
||||
if (idProviderProfiles.getAllProfiles.context.lastPage) {
|
||||
return false;
|
||||
}
|
||||
|
||||
e.persist();
|
||||
const { target } = e;
|
||||
|
||||
if (target.scrollTop + target.offsetHeight === target.scrollHeight) {
|
||||
fetchMoreIdProviderProfiles({
|
||||
variables: { context: { ...idProviderProfiles.getAllProfiles.context } },
|
||||
updateQuery: updateQueryGetAllProfiles,
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
const handleFetchMoreProfiles = (e, key) => {
|
||||
if (key === 'radius') fetchMoreProfiles(e, radiusProfiles, fetchMoreRadiusProfiles);
|
||||
else if (key === 'captive_portal')
|
||||
fetchMoreProfiles(e, captiveProfiles, fetchMoreCaptiveProfiles);
|
||||
else if (key === 'rf') fetchMoreProfiles(e, rfProfiles, fetchMoreRfProfiles);
|
||||
else if (key === 'passpoint_venue') fetchMoreProfiles(e, venueProfiles, fetchMoreVenueProfiles);
|
||||
else if (key === 'passpoint_operator')
|
||||
fetchMoreProfiles(e, operatorProfiles, fetchMoreOperatorProfiles);
|
||||
else if (key === 'passpoint_osu_id_provider')
|
||||
fetchMoreProfiles(e, idProviderProfiles, fetchMoreIdProviderProfiles);
|
||||
else fetchMoreProfiles(e, ssidProfiles, fetchMore);
|
||||
};
|
||||
|
||||
return (
|
||||
<AddProfilePage
|
||||
onCreateProfile={handleAddProfile}
|
||||
ssidProfiles={
|
||||
(ssidProfiles && ssidProfiles.getAllProfiles && ssidProfiles.getAllProfiles.items) || []
|
||||
}
|
||||
ssidProfiles={ssidProfiles?.getAllProfiles?.items}
|
||||
radiusProfiles={radiusProfiles?.getAllProfiles?.items}
|
||||
captiveProfiles={captiveProfiles?.getAllProfiles?.items}
|
||||
venueProfiles={venueProfiles?.getAllProfiles?.items}
|
||||
operatorProfiles={operatorProfiles?.getAllProfiles?.items}
|
||||
idProviderProfiles={idProviderProfiles?.getAllProfiles?.items}
|
||||
rfProfiles={rfProfiles?.getAllProfiles?.items}
|
||||
onFetchMoreProfiles={handleFetchProfiles}
|
||||
onFetchMoreVenueProfiles={handleFetchVenueProfiles}
|
||||
onFetchMoreOperatorProfiles={handleFetchOperatorProfiles}
|
||||
onFetchMoreIdProviderProfiles={handleFetchIdProviderProfiles}
|
||||
onFetchMoreRfProfiles={handleFetchRfProfiles}
|
||||
onFetchMoreProfiles={handleFetchMoreProfiles}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -92,7 +92,9 @@ const App = () => {
|
||||
<ProtectedRouteWithLayout exact path={ROUTES.addprofile} component={AddProfile} />
|
||||
|
||||
<ProtectedRouteWithLayout exact path={ROUTES.alarms} component={Alarms} />
|
||||
<ProtectedRouteWithLayout exact path={ROUTES.account} component={EditAccount} />
|
||||
{user?.id !== 0 && (
|
||||
<ProtectedRouteWithLayout exact path={ROUTES.account} component={EditAccount} />
|
||||
)}
|
||||
{user?.roles?.[0] === 'SuperUser' && (
|
||||
<ProtectedRouteWithLayout exact path={ROUTES.users} component={Accounts} />
|
||||
)}
|
||||
|
||||
@@ -20,8 +20,11 @@ function formatBytes(bytes, decimals = 2) {
|
||||
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i] || ''}`;
|
||||
}
|
||||
|
||||
function trafficLabelFormatter() {
|
||||
return formatBytes(this.value);
|
||||
function trafficLabelFormatter(bytes) {
|
||||
if (this?.value) {
|
||||
return formatBytes(this.value);
|
||||
}
|
||||
return formatBytes(bytes);
|
||||
}
|
||||
|
||||
function trafficTooltipFormatter() {
|
||||
@@ -31,7 +34,7 @@ function trafficTooltipFormatter() {
|
||||
}
|
||||
|
||||
const lineChartConfig = [
|
||||
{ key: 'inservicesAPs', title: 'Inservice APs (24 hours)' },
|
||||
{ key: 'service', title: 'Inservice APs (24 hours)' },
|
||||
{ key: 'clientDevices', title: 'Client Devices (24 hours)' },
|
||||
{
|
||||
key: 'traffic',
|
||||
@@ -56,9 +59,11 @@ const Dashboard = () => {
|
||||
});
|
||||
|
||||
const [lineChartData, setLineChartData] = useState({
|
||||
inservicesAPs: {
|
||||
key: 'Inservice APs',
|
||||
value: [],
|
||||
service: {
|
||||
inservicesAPs: {
|
||||
key: 'Inservice APs',
|
||||
value: [],
|
||||
},
|
||||
},
|
||||
clientDevices: {
|
||||
is2dot4GHz: {
|
||||
@@ -121,26 +126,35 @@ const Dashboard = () => {
|
||||
},
|
||||
},
|
||||
}) => {
|
||||
inservicesAPs.push([eventTimestamp, equipmentInServiceCount]);
|
||||
const timestamp = parseInt(eventTimestamp, 10);
|
||||
inservicesAPs.push({ timestamp, value: equipmentInServiceCount });
|
||||
|
||||
let total5GHz = 0;
|
||||
total5GHz += (radios?.is5GHz || 0) + (radios?.is5GHzL || 0) + (radios?.is5GHzU || 0); // combine all 5GHz radios
|
||||
|
||||
clientDevices2dot4GHz.push([eventTimestamp, radios.is2dot4GHz || 0]);
|
||||
clientDevices5GHz.push([eventTimestamp, total5GHz || 0]);
|
||||
clientDevices2dot4GHz.push({ timestamp, value: radios.is2dot4GHz || 0 });
|
||||
clientDevices5GHz.push({ timestamp, value: total5GHz || 0 });
|
||||
|
||||
trafficBytesDownstreamData.push([eventTimestamp, trafficBytesDownstream || 0]);
|
||||
trafficBytesUpstreamData.push([eventTimestamp, trafficBytesUpstream || 0]);
|
||||
trafficBytesDownstreamData.push({
|
||||
timestamp,
|
||||
value: (trafficBytesDownstream > 0 && trafficBytesDownstream) || 0,
|
||||
});
|
||||
trafficBytesUpstreamData.push({
|
||||
timestamp,
|
||||
value: (trafficBytesUpstream > 0 && trafficBytesUpstream) || 0,
|
||||
});
|
||||
|
||||
totalDown += trafficBytesDownstream || 0;
|
||||
totalUp += trafficBytesUpstream || 0;
|
||||
totalDown += (trafficBytesDownstream > 0 && trafficBytesDownstream) || 0;
|
||||
totalUp += (trafficBytesUpstream > 0 && trafficBytesUpstream) || 0;
|
||||
}
|
||||
);
|
||||
|
||||
return {
|
||||
inservicesAPs: {
|
||||
...prev.inservicesAPs,
|
||||
value: [...prev.inservicesAPs.value, ...inservicesAPs],
|
||||
service: {
|
||||
inservicesAPs: {
|
||||
...prev.service.inservicesAPs,
|
||||
value: [...prev.service.inservicesAPs.value, ...inservicesAPs],
|
||||
},
|
||||
},
|
||||
clientDevices: {
|
||||
is2dot4GHz: {
|
||||
|
||||
@@ -13,7 +13,7 @@ import { removeItem } from 'utils/localStorage';
|
||||
import UserContext from 'contexts/UserContext';
|
||||
|
||||
const MasterLayout = ({ children }) => {
|
||||
const { roles, customerId } = useContext(UserContext);
|
||||
const { roles, customerId, id: currentUserId } = useContext(UserContext);
|
||||
|
||||
const client = useApolloClient();
|
||||
const location = useLocation();
|
||||
@@ -56,11 +56,15 @@ const MasterLayout = ({ children }) => {
|
||||
key: 'settings',
|
||||
text: 'Settings',
|
||||
children: [
|
||||
{
|
||||
key: 'editAccount',
|
||||
path: ROUTES.account,
|
||||
text: 'Edit Account',
|
||||
},
|
||||
...(currentUserId !== 0
|
||||
? [
|
||||
{
|
||||
key: 'editAccount',
|
||||
path: ROUTES.account,
|
||||
text: 'Edit Account',
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
key: 'logout',
|
||||
path: ROUTES.root,
|
||||
@@ -90,6 +94,7 @@ const MasterLayout = ({ children }) => {
|
||||
menuItems={menuItems}
|
||||
mobileMenuItems={mobileMenuItems}
|
||||
totalAlarms={data && data.getAlarmCount}
|
||||
currentUserId={currentUserId}
|
||||
>
|
||||
{children}
|
||||
</Layout>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useContext } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { useParams, useHistory } from 'react-router-dom';
|
||||
import { useQuery, useMutation, gql } from '@apollo/client';
|
||||
import { useQuery, useMutation } from '@apollo/client';
|
||||
import { Alert, notification } from 'antd';
|
||||
import moment from 'moment';
|
||||
import {
|
||||
@@ -9,126 +9,22 @@ import {
|
||||
Loading,
|
||||
} from '@tip-wlan/wlan-cloud-ui-library';
|
||||
|
||||
import { FILTER_SERVICE_METRICS, GET_ALL_FIRMWARE, GET_ALL_PROFILES } from 'graphql/queries';
|
||||
import {
|
||||
GET_EQUIPMENT,
|
||||
FILTER_SERVICE_METRICS,
|
||||
GET_ALL_FIRMWARE,
|
||||
GET_ALL_PROFILES,
|
||||
} from 'graphql/queries';
|
||||
import {
|
||||
UPDATE_EQUIPMENT,
|
||||
DELETE_EQUIPMENT,
|
||||
UPDATE_EQUIPMENT_FIRMWARE,
|
||||
REQUEST_EQUIPMENT_SWITCH_BANK,
|
||||
REQUEST_EQUIPMENT_REBOOT,
|
||||
} from 'graphql/mutations';
|
||||
import { updateQueryGetAllProfiles } from 'graphql/functions';
|
||||
import { fetchMoreProfiles } from 'graphql/functions';
|
||||
import UserContext from 'contexts/UserContext';
|
||||
|
||||
const GET_EQUIPMENT = gql`
|
||||
query GetEquipment($id: ID!) {
|
||||
getEquipment(id: $id) {
|
||||
id
|
||||
equipmentType
|
||||
inventoryId
|
||||
customerId
|
||||
profileId
|
||||
locationId
|
||||
name
|
||||
latitude
|
||||
longitude
|
||||
serial
|
||||
lastModifiedTimestamp
|
||||
details
|
||||
profile {
|
||||
id
|
||||
name
|
||||
childProfiles {
|
||||
id
|
||||
name
|
||||
details
|
||||
}
|
||||
}
|
||||
baseMacAddress
|
||||
manufacturer
|
||||
status {
|
||||
firmware {
|
||||
detailsJSON
|
||||
}
|
||||
protocol {
|
||||
detailsJSON
|
||||
}
|
||||
radioUtilization {
|
||||
detailsJSON
|
||||
}
|
||||
clientDetails {
|
||||
detailsJSON
|
||||
details {
|
||||
numClientsPerRadio
|
||||
}
|
||||
}
|
||||
osPerformance {
|
||||
detailsJSON
|
||||
}
|
||||
}
|
||||
model
|
||||
alarmsCount
|
||||
alarms {
|
||||
severity
|
||||
alarmCode
|
||||
details
|
||||
createdTimestamp
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const UPDATE_EQUIPMENT = gql`
|
||||
mutation UpdateEquipment(
|
||||
$id: ID!
|
||||
$equipmentType: String!
|
||||
$inventoryId: String!
|
||||
$customerId: ID!
|
||||
$profileId: ID!
|
||||
$locationId: ID!
|
||||
$name: String!
|
||||
$latitude: String
|
||||
$longitude: String
|
||||
$serial: String
|
||||
$lastModifiedTimestamp: String
|
||||
$details: JSONObject
|
||||
) {
|
||||
updateEquipment(
|
||||
id: $id
|
||||
equipmentType: $equipmentType
|
||||
inventoryId: $inventoryId
|
||||
customerId: $customerId
|
||||
profileId: $profileId
|
||||
locationId: $locationId
|
||||
name: $name
|
||||
latitude: $latitude
|
||||
longitude: $longitude
|
||||
serial: $serial
|
||||
lastModifiedTimestamp: $lastModifiedTimestamp
|
||||
details: $details
|
||||
) {
|
||||
id
|
||||
equipmentType
|
||||
inventoryId
|
||||
customerId
|
||||
profileId
|
||||
locationId
|
||||
name
|
||||
latitude
|
||||
longitude
|
||||
serial
|
||||
lastModifiedTimestamp
|
||||
details
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const DELETE_EQUIPMENT = gql`
|
||||
mutation DeleteEquipment($id: ID!) {
|
||||
deleteEquipment(id: $id) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const toTime = moment();
|
||||
const fromTime = moment().subtract(1, 'hour');
|
||||
|
||||
@@ -142,6 +38,7 @@ const AccessPointDetails = ({ locations }) => {
|
||||
id,
|
||||
},
|
||||
fetchPolicy: 'network-only',
|
||||
errorPolicy: 'all',
|
||||
});
|
||||
|
||||
const { data: dataFirmware, error: errorFirmware, loading: loadingFirmware } = useQuery(
|
||||
@@ -149,9 +46,9 @@ const AccessPointDetails = ({ locations }) => {
|
||||
{
|
||||
skip: !data?.getEquipment?.model,
|
||||
variables: { modelId: data?.getEquipment?.model },
|
||||
errorPolicy: 'all',
|
||||
}
|
||||
);
|
||||
|
||||
const {
|
||||
data: dataProfiles,
|
||||
error: errorProfiles,
|
||||
@@ -173,7 +70,7 @@ const AccessPointDetails = ({ locations }) => {
|
||||
loading: metricsLoading,
|
||||
error: metricsError,
|
||||
data: metricsData,
|
||||
refetch: metricsRefetch,
|
||||
fetchMore: fetchMoreServiceMetrics,
|
||||
} = useQuery(FILTER_SERVICE_METRICS, {
|
||||
variables: {
|
||||
customerId,
|
||||
@@ -193,23 +90,46 @@ const AccessPointDetails = ({ locations }) => {
|
||||
|
||||
const refetchData = () => {
|
||||
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 = (
|
||||
equipmentId,
|
||||
const handleUpdateEquipment = ({
|
||||
id: equipmentId,
|
||||
equipmentType,
|
||||
inventoryId,
|
||||
custId,
|
||||
customerId: custId,
|
||||
profileId,
|
||||
locationId,
|
||||
name,
|
||||
baseMacAddress,
|
||||
latitude,
|
||||
longitude,
|
||||
serial,
|
||||
lastModifiedTimestamp,
|
||||
details
|
||||
) => {
|
||||
formattedData,
|
||||
}) => {
|
||||
updateEquipment({
|
||||
variables: {
|
||||
id: equipmentId,
|
||||
@@ -219,11 +139,12 @@ const AccessPointDetails = ({ locations }) => {
|
||||
profileId,
|
||||
locationId,
|
||||
name,
|
||||
baseMacAddress,
|
||||
latitude,
|
||||
longitude,
|
||||
serial,
|
||||
lastModifiedTimestamp,
|
||||
details,
|
||||
details: formattedData,
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
@@ -327,28 +248,14 @@ const AccessPointDetails = ({ locations }) => {
|
||||
);
|
||||
|
||||
const handleFetchProfiles = e => {
|
||||
if (dataProfiles.getAllProfiles.context.lastPage) {
|
||||
return false;
|
||||
}
|
||||
|
||||
e.persist();
|
||||
const { target } = e;
|
||||
|
||||
if (target.scrollTop + target.offsetHeight === target.scrollHeight) {
|
||||
fetchMore({
|
||||
variables: { context: { ...dataProfiles.getAllProfiles.context } },
|
||||
updateQuery: updateQueryGetAllProfiles,
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
fetchMoreProfiles(e, dataProfiles, fetchMore);
|
||||
};
|
||||
|
||||
if (loading) {
|
||||
return <Loading />;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
if (error && !data?.getEquipment) {
|
||||
return (
|
||||
<Alert
|
||||
message="Error"
|
||||
|
||||
@@ -89,8 +89,8 @@ const accessPointsTableColumns = [
|
||||
},
|
||||
{
|
||||
title: 'CHANNEL',
|
||||
dataIndex: 'channel',
|
||||
render: renderTableCell,
|
||||
dataIndex: ['status', 'channel', 'detailsJSON', 'channelNumberStatusDataMap'],
|
||||
render: text => renderTableCell(Object.values(text ?? [])),
|
||||
},
|
||||
{
|
||||
title: 'OCCUPANCY',
|
||||
|
||||
@@ -11,6 +11,8 @@ import { UPDATE_EQUIPMENT_BULK } from 'graphql/mutations';
|
||||
import UserContext from 'contexts/UserContext';
|
||||
import styles from './index.module.scss';
|
||||
|
||||
const defaultAppliedRadios = { is5GHzL: 'is5GHzL', is2dot4GHz: 'is2dot4GHz', is5GHzU: 'is5GHzU' };
|
||||
|
||||
const renderTableCell = tabCell => {
|
||||
if (Array.isArray(tabCell)) {
|
||||
return (
|
||||
@@ -25,47 +27,63 @@ const renderTableCell = tabCell => {
|
||||
return <span>{tabCell}</span>;
|
||||
};
|
||||
const accessPointsChannelTableColumns = [
|
||||
{ title: 'NAME', dataIndex: 'name', key: 'name', render: renderTableCell },
|
||||
{ title: 'Name', dataIndex: 'name', key: 'name', width: 250, render: renderTableCell },
|
||||
{
|
||||
title: 'CHANNEL',
|
||||
dataIndex: 'channel',
|
||||
key: 'channel',
|
||||
title: 'Manual Active Channel',
|
||||
dataIndex: 'manualChannelNumber',
|
||||
key: 'manualChannelNumber',
|
||||
editable: true,
|
||||
width: 200,
|
||||
render: renderTableCell,
|
||||
},
|
||||
|
||||
{
|
||||
title: 'Manual Backup Channel',
|
||||
dataIndex: 'manualBackupChannelNumber',
|
||||
key: 'manualBackupChannelNumber',
|
||||
editable: true,
|
||||
width: 210,
|
||||
render: renderTableCell,
|
||||
},
|
||||
{
|
||||
title: 'CELL SIZE',
|
||||
title: 'Cell Size',
|
||||
dataIndex: 'cellSize',
|
||||
key: 'cellSize',
|
||||
editable: true,
|
||||
width: 150,
|
||||
render: renderTableCell,
|
||||
},
|
||||
{
|
||||
title: 'PROB RESPONSE THRESHOLD',
|
||||
title: 'Probe Response Threshold',
|
||||
dataIndex: 'probeResponseThreshold',
|
||||
key: 'probeResponseThreshold',
|
||||
editable: true,
|
||||
width: 210,
|
||||
render: renderTableCell,
|
||||
},
|
||||
{
|
||||
title: 'CLIENT DISCONNECT THRESHOLD',
|
||||
title: 'Client Disconnect Threshold',
|
||||
dataIndex: 'clientDisconnectThreshold',
|
||||
key: 'clientDisconnectThreshold',
|
||||
editable: true,
|
||||
width: 210,
|
||||
|
||||
render: renderTableCell,
|
||||
},
|
||||
{
|
||||
title: 'SNR (% DROP)',
|
||||
title: 'SNR (% Drop)',
|
||||
dataIndex: 'snrDrop',
|
||||
key: 'snrDrop',
|
||||
editable: true,
|
||||
width: 150,
|
||||
render: renderTableCell,
|
||||
},
|
||||
{
|
||||
title: 'MIN LOAD',
|
||||
title: 'Min Load',
|
||||
dataIndex: 'minLoad',
|
||||
key: 'minLoad',
|
||||
editable: true,
|
||||
width: 150,
|
||||
render: renderTableCell,
|
||||
},
|
||||
];
|
||||
@@ -160,68 +178,84 @@ const BulkEditAPs = ({ locations, checkedLocations }) => {
|
||||
const [updateEquipmentBulk] = useMutation(UPDATE_EQUIPMENT_BULK);
|
||||
|
||||
const getRadioDetails = (radioDetails, type) => {
|
||||
if (type === 'manualChannelNumber') {
|
||||
const manualChannelNumbers = [];
|
||||
Object.keys(radioDetails?.radioMap || {}).map(i => {
|
||||
return manualChannelNumbers.push(radioDetails.radioMap[i]?.manualChannelNumber);
|
||||
});
|
||||
return manualChannelNumbers;
|
||||
}
|
||||
|
||||
if (type === 'manualBackupChannelNumber') {
|
||||
const manualBackupChannelNumbers = [];
|
||||
Object.keys(radioDetails?.radioMap || {}).map(i => {
|
||||
return manualBackupChannelNumbers.push(radioDetails.radioMap[i]?.manualBackupChannelNumber);
|
||||
});
|
||||
return manualBackupChannelNumbers;
|
||||
}
|
||||
if (type === 'cellSize') {
|
||||
const cellSizeValues = [];
|
||||
Object.keys(radioDetails.radioMap).map(i => {
|
||||
return cellSizeValues.push(radioDetails.radioMap[i].rxCellSizeDb.value);
|
||||
Object.keys(radioDetails?.radioMap || {}).map(i => {
|
||||
return cellSizeValues.push(radioDetails.radioMap[i]?.rxCellSizeDb?.value);
|
||||
});
|
||||
return cellSizeValues;
|
||||
}
|
||||
if (type === 'probeResponseThreshold') {
|
||||
const probeResponseThresholdValues = [];
|
||||
Object.keys(radioDetails.radioMap).map(i => {
|
||||
Object.keys(radioDetails?.radioMap || {}).map(i => {
|
||||
return probeResponseThresholdValues.push(
|
||||
radioDetails.radioMap[i].probeResponseThresholdDb.value
|
||||
radioDetails.radioMap[i]?.probeResponseThresholdDb?.value
|
||||
);
|
||||
});
|
||||
return probeResponseThresholdValues;
|
||||
}
|
||||
if (type === 'clientDisconnectThreshold') {
|
||||
const clientDisconnectThresholdValues = [];
|
||||
Object.keys(radioDetails.radioMap).map(i => {
|
||||
Object.keys(radioDetails?.radioMap || {}).map(i => {
|
||||
return clientDisconnectThresholdValues.push(
|
||||
radioDetails.radioMap[i].clientDisconnectThresholdDb.value
|
||||
radioDetails.radioMap[i]?.clientDisconnectThresholdDb?.value
|
||||
);
|
||||
});
|
||||
return clientDisconnectThresholdValues;
|
||||
}
|
||||
if (type === 'snrDrop') {
|
||||
const snrDropValues = [];
|
||||
Object.keys(radioDetails.advancedRadioMap).map(i => {
|
||||
Object.keys(radioDetails?.radioMap || {}).map(i => {
|
||||
return snrDropValues.push(
|
||||
radioDetails.advancedRadioMap[i].bestApSettings.dropInSnrPercentage
|
||||
radioDetails.advancedRadioMap[i]?.bestApSettings?.value?.dropInSnrPercentage
|
||||
);
|
||||
});
|
||||
return snrDropValues;
|
||||
}
|
||||
|
||||
const minLoadValue = [];
|
||||
Object.keys(radioDetails.advancedRadioMap).map(i => {
|
||||
return minLoadValue.push(radioDetails.advancedRadioMap[i].bestApSettings.minLoadFactor);
|
||||
Object.keys(radioDetails?.radioMap || {}).map(i => {
|
||||
return minLoadValue.push(
|
||||
radioDetails.advancedRadioMap[i]?.bestApSettings?.value?.minLoadFactor
|
||||
);
|
||||
});
|
||||
return minLoadValue;
|
||||
};
|
||||
|
||||
const setAccessPointsBulkEditTableData = (dataSource = []) => {
|
||||
const tableData = dataSource.items.map(({ id: key, name, channel, details }) => {
|
||||
return {
|
||||
key,
|
||||
id: key,
|
||||
name,
|
||||
channel,
|
||||
cellSize: getRadioDetails(details, 'cellSize'),
|
||||
probeResponseThreshold: getRadioDetails(details, 'probeResponseThreshold'),
|
||||
clientDisconnectThreshold: getRadioDetails(details, 'clientDisconnectThreshold'),
|
||||
snrDrop: getRadioDetails(details, 'snrDrop'),
|
||||
minLoad: getRadioDetails(details, 'minLoad'),
|
||||
};
|
||||
});
|
||||
return tableData;
|
||||
};
|
||||
const setAccessPointsBulkEditTableData = (dataSource = []) =>
|
||||
dataSource.items.map(({ id: key, name, details }) => ({
|
||||
key,
|
||||
id: key,
|
||||
name,
|
||||
manualChannelNumber: getRadioDetails(details, 'manualChannelNumber'),
|
||||
manualBackupChannelNumber: getRadioDetails(details, 'manualBackupChannelNumber'),
|
||||
cellSize: getRadioDetails(details, 'cellSize'),
|
||||
probeResponseThreshold: getRadioDetails(details, 'probeResponseThreshold'),
|
||||
clientDisconnectThreshold: getRadioDetails(details, 'clientDisconnectThreshold'),
|
||||
snrDrop: getRadioDetails(details, 'snrDrop'),
|
||||
minLoad: getRadioDetails(details, 'minLoad'),
|
||||
radioMap: Object.keys(details?.radioMap || {}),
|
||||
}));
|
||||
|
||||
const setUpdatedBulkEditTableData = (
|
||||
equipmentId,
|
||||
channel,
|
||||
manualChannelNumber,
|
||||
manualBackupChannelNumber,
|
||||
cellSize,
|
||||
probeResponseThreshold,
|
||||
clientDisconnectThreshold,
|
||||
@@ -234,13 +268,14 @@ const BulkEditAPs = ({ locations, checkedLocations }) => {
|
||||
let minLoadFactor;
|
||||
dataSource.items.forEach(({ id: itemId, details }) => {
|
||||
if (equipmentId === itemId) {
|
||||
Object.keys(details.radioMap).forEach((i, dataIndex) => {
|
||||
Object.keys(details?.radioMap || defaultAppliedRadios).forEach((i, dataIndex) => {
|
||||
const frequencies = {};
|
||||
dropInSnrPercentage = snrDrop[dataIndex];
|
||||
minLoadFactor = minLoad[dataIndex];
|
||||
|
||||
frequencies[`${i}`] = {
|
||||
channelNumber: channel[dataIndex],
|
||||
channelNumber: manualChannelNumber[dataIndex],
|
||||
backupChannelNumber: manualBackupChannelNumber[dataIndex],
|
||||
rxCellSizeDb: {
|
||||
auto: true,
|
||||
value: cellSize[dataIndex],
|
||||
@@ -286,42 +321,41 @@ const BulkEditAPs = ({ locations, checkedLocations }) => {
|
||||
|
||||
const handleSaveChanges = updatedRows => {
|
||||
const editedRowsArr = [];
|
||||
if (updatedRows.length > 0) {
|
||||
updatedRows.map(
|
||||
({
|
||||
id: equipmentId,
|
||||
channel,
|
||||
cellSize,
|
||||
probeResponseThreshold,
|
||||
clientDisconnectThreshold,
|
||||
snrDrop,
|
||||
minLoad,
|
||||
}) => {
|
||||
const updatedEuips = setUpdatedBulkEditTableData(
|
||||
equipmentId,
|
||||
channel,
|
||||
cellSize,
|
||||
probeResponseThreshold,
|
||||
clientDisconnectThreshold,
|
||||
snrDrop,
|
||||
minLoad,
|
||||
equipData && equipData.filterEquipment
|
||||
);
|
||||
const tempObj = {
|
||||
equipmentId,
|
||||
perRadioDetails: {},
|
||||
};
|
||||
updatedEuips.map(item => {
|
||||
Object.keys(item).forEach(i => {
|
||||
tempObj.perRadioDetails[i] = item[i];
|
||||
});
|
||||
return tempObj;
|
||||
});
|
||||
return editedRowsArr.push(tempObj);
|
||||
}
|
||||
Object.keys(updatedRows).forEach(key => {
|
||||
const {
|
||||
id: equipmentId,
|
||||
manualChannelNumber,
|
||||
manualBackupChannelNumber,
|
||||
cellSize,
|
||||
probeResponseThreshold,
|
||||
clientDisconnectThreshold,
|
||||
snrDrop,
|
||||
minLoad,
|
||||
} = updatedRows[key];
|
||||
const updatedEuips = setUpdatedBulkEditTableData(
|
||||
equipmentId,
|
||||
manualChannelNumber,
|
||||
manualBackupChannelNumber,
|
||||
cellSize,
|
||||
probeResponseThreshold,
|
||||
clientDisconnectThreshold,
|
||||
snrDrop,
|
||||
minLoad,
|
||||
equipData && equipData.filterEquipment
|
||||
);
|
||||
updateEquipments(editedRowsArr);
|
||||
}
|
||||
const tempObj = {
|
||||
equipmentId,
|
||||
perRadioDetails: {},
|
||||
};
|
||||
updatedEuips.map(item => {
|
||||
Object.keys(item).forEach(i => {
|
||||
tempObj.perRadioDetails[i] = item[i];
|
||||
});
|
||||
return tempObj;
|
||||
});
|
||||
return editedRowsArr.push(tempObj);
|
||||
});
|
||||
updateEquipments(editedRowsArr);
|
||||
};
|
||||
|
||||
const handleLoadMore = () => {
|
||||
@@ -356,18 +390,9 @@ const BulkEditAPs = ({ locations, checkedLocations }) => {
|
||||
return (
|
||||
<BulkEditAccessPoints
|
||||
tableColumns={accessPointsChannelTableColumns}
|
||||
tableData={
|
||||
equipData &&
|
||||
equipData.filterEquipment &&
|
||||
setAccessPointsBulkEditTableData(equipData && equipData.filterEquipment)
|
||||
}
|
||||
tableData={setAccessPointsBulkEditTableData(equipData?.filterEquipment)}
|
||||
onLoadMore={handleLoadMore}
|
||||
isLastPage={
|
||||
equipData &&
|
||||
equipData.filterEquipment &&
|
||||
equipData.filterEquipment.context &&
|
||||
equipData.filterEquipment.context.lastPage
|
||||
}
|
||||
isLastPage={equipData?.filterEquipment?.context?.lastPage}
|
||||
onSaveChanges={handleSaveChanges}
|
||||
breadcrumbPath={getBreadcrumbPath(id, locations)}
|
||||
/>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
.tabColumn {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 0 30px;
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@ import { useQuery, useMutation, gql } from '@apollo/client';
|
||||
import { Alert, notification } from 'antd';
|
||||
import { ProfileDetails as ProfileDetailsPage, Loading } from '@tip-wlan/wlan-cloud-ui-library';
|
||||
|
||||
import { ROUTES } from 'constants/index';
|
||||
import { ROUTES, AUTH_TOKEN } from 'constants/index';
|
||||
import UserContext from 'contexts/UserContext';
|
||||
import { GET_ALL_PROFILES } from 'graphql/queries';
|
||||
import { FILE_UPLOAD } from 'graphql/mutations';
|
||||
import { updateQueryGetAllProfiles } from 'graphql/functions';
|
||||
import { GET_ALL_PROFILES, GET_API_URL } from 'graphql/queries';
|
||||
import { fetchMoreProfiles } from 'graphql/functions';
|
||||
import { getItem } from 'utils/localStorage';
|
||||
|
||||
const GET_PROFILE = gql`
|
||||
query GetProfile($id: ID!) {
|
||||
@@ -23,6 +23,16 @@ const GET_PROFILE = gql`
|
||||
profileType
|
||||
details
|
||||
}
|
||||
associatedSsidProfiles {
|
||||
id
|
||||
name
|
||||
profileType
|
||||
details
|
||||
}
|
||||
osuSsidProfile {
|
||||
id
|
||||
name
|
||||
}
|
||||
childProfileIds
|
||||
createdTimestamp
|
||||
lastModifiedTimestamp
|
||||
@@ -75,6 +85,8 @@ const ProfileDetails = () => {
|
||||
|
||||
const [redirect, setRedirect] = useState(false);
|
||||
|
||||
const { data: apiUrl } = useQuery(GET_API_URL);
|
||||
|
||||
const { loading, error, data } = useQuery(GET_PROFILE, {
|
||||
variables: { id },
|
||||
fetchPolicy: 'network-only',
|
||||
@@ -82,12 +94,14 @@ const ProfileDetails = () => {
|
||||
|
||||
const { data: ssidProfiles, fetchMore } = useQuery(GET_ALL_PROFILES(), {
|
||||
variables: { customerId, type: 'ssid' },
|
||||
fetchPolicy: 'network-only',
|
||||
});
|
||||
|
||||
const { data: radiusProfiles, fetchMore: fetchMoreRadiusProfiles } = useQuery(
|
||||
GET_ALL_PROFILES(),
|
||||
{
|
||||
variables: { customerId, type: 'radius' },
|
||||
fetchPolicy: 'network-only',
|
||||
}
|
||||
);
|
||||
|
||||
@@ -95,17 +109,20 @@ const ProfileDetails = () => {
|
||||
GET_ALL_PROFILES(),
|
||||
{
|
||||
variables: { customerId, type: 'captive_portal' },
|
||||
fetchPolicy: 'network-only',
|
||||
}
|
||||
);
|
||||
|
||||
const { data: venueProfiles, fetchMore: fetchMoreVenueProfiles } = useQuery(GET_ALL_PROFILES(), {
|
||||
variables: { customerId, type: 'passpoint_venue' },
|
||||
fetchPolicy: 'network-only',
|
||||
});
|
||||
|
||||
const { data: operatorProfiles, fetchMore: fetchMoreOperatorProfiles } = useQuery(
|
||||
GET_ALL_PROFILES(),
|
||||
{
|
||||
variables: { customerId, type: 'passpoint_operator' },
|
||||
fetchPolicy: 'network-only',
|
||||
}
|
||||
);
|
||||
|
||||
@@ -113,18 +130,18 @@ const ProfileDetails = () => {
|
||||
GET_ALL_PROFILES(),
|
||||
{
|
||||
variables: { customerId, type: 'passpoint_osu_id_provider' },
|
||||
fetchPolicy: 'network-only',
|
||||
}
|
||||
);
|
||||
|
||||
const { data: rfProfiles, fetchMore: fetchMoreRfProfiles } = useQuery(GET_ALL_PROFILES(), {
|
||||
variables: { customerId, type: 'rf' },
|
||||
fetchPolicy: 'network-only',
|
||||
});
|
||||
|
||||
const [updateProfile] = useMutation(UPDATE_PROFILE);
|
||||
const [deleteProfile] = useMutation(DELETE_PROFILE);
|
||||
|
||||
const [fileUpload] = useMutation(FILE_UPLOAD);
|
||||
|
||||
const handleDeleteProfile = () => {
|
||||
deleteProfile({ variables: { id } })
|
||||
.then(() => {
|
||||
@@ -170,145 +187,89 @@ const ProfileDetails = () => {
|
||||
);
|
||||
};
|
||||
|
||||
const handleFileUpload = (fileName, file) =>
|
||||
fileUpload({ variables: { fileName, file } })
|
||||
.then(() => {
|
||||
notification.success({
|
||||
message: 'Success',
|
||||
description: 'File successfully uploaded.',
|
||||
});
|
||||
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,
|
||||
})
|
||||
.catch(() =>
|
||||
notification.error({
|
||||
message: 'Error',
|
||||
description: 'File could not be uploaded.',
|
||||
.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.',
|
||||
});
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
const handleFetchProfiles = e => {
|
||||
if (ssidProfiles.getAllProfiles.context.lastPage) {
|
||||
return false;
|
||||
}
|
||||
|
||||
e.persist();
|
||||
const { target } = e;
|
||||
|
||||
if (target.scrollTop + target.offsetHeight === target.scrollHeight) {
|
||||
fetchMore({
|
||||
variables: { context: { ...ssidProfiles.getAllProfiles.context } },
|
||||
updateQuery: updateQueryGetAllProfiles,
|
||||
.catch(() => {
|
||||
notification.error({
|
||||
message: 'Error',
|
||||
description: 'File could not be uploaded.',
|
||||
});
|
||||
});
|
||||
} else {
|
||||
notification.error({
|
||||
message: 'Error',
|
||||
description: 'File could not be uploaded.',
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
const handleFetchRadiusProfiles = e => {
|
||||
if (radiusProfiles.getAllProfiles.context.lastPage) {
|
||||
return false;
|
||||
const handleDownloadFile = async name => {
|
||||
const token = getItem(AUTH_TOKEN);
|
||||
if (apiUrl?.getApiUrl) {
|
||||
return fetch(`${apiUrl?.getApiUrl}filestore/${encodeURIComponent(name)}`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/octet-stream',
|
||||
Authorization: token ? `Bearer ${token.access_token}` : '',
|
||||
},
|
||||
})
|
||||
.then(response => response.blob())
|
||||
.then(blob => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
reader.onloadend = () => resolve(reader.result);
|
||||
reader.onerror = reject;
|
||||
reader.readAsDataURL(blob);
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
notification.error({
|
||||
message: 'Error',
|
||||
description: 'File could not be retrieved.',
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
e.persist();
|
||||
const { target } = e;
|
||||
|
||||
if (target.scrollTop + target.offsetHeight === target.scrollHeight) {
|
||||
fetchMoreRadiusProfiles({
|
||||
variables: { context: { ...radiusProfiles.getAllProfiles.context } },
|
||||
updateQuery: updateQueryGetAllProfiles,
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
return notification.error({
|
||||
message: 'Error',
|
||||
description: 'File could not be retrieved.',
|
||||
});
|
||||
};
|
||||
|
||||
const handleFetchCaptiveProfiles = e => {
|
||||
if (captiveProfiles.getAllProfiles.context.lastPage) {
|
||||
return false;
|
||||
}
|
||||
|
||||
e.persist();
|
||||
const { target } = e;
|
||||
|
||||
if (target.scrollTop + target.offsetHeight === target.scrollHeight) {
|
||||
fetchMoreCaptiveProfiles({
|
||||
variables: { context: { ...captiveProfiles.getAllProfiles.context } },
|
||||
updateQuery: updateQueryGetAllProfiles,
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
const handleFetchVenueProfiles = e => {
|
||||
if (venueProfiles.getAllProfiles.context.lastPage) {
|
||||
return false;
|
||||
}
|
||||
|
||||
e.persist();
|
||||
const { target } = e;
|
||||
|
||||
if (target.scrollTop + target.offsetHeight === target.scrollHeight) {
|
||||
fetchMoreVenueProfiles({
|
||||
variables: { context: { ...venueProfiles.getAllProfiles.context } },
|
||||
updateQuery: updateQueryGetAllProfiles,
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
const handleFetchRfProfiles = e => {
|
||||
if (rfProfiles.getAllProfiles.context.lastPage) {
|
||||
return false;
|
||||
}
|
||||
|
||||
e.persist();
|
||||
const { target } = e;
|
||||
|
||||
if (target.scrollTop + target.offsetHeight === target.scrollHeight) {
|
||||
fetchMoreRfProfiles({
|
||||
variables: { context: { ...rfProfiles.getAllProfiles.context } },
|
||||
updateQuery: updateQueryGetAllProfiles,
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
const handleFetchOperatorProfiles = e => {
|
||||
if (operatorProfiles.getAllProfiles.context.lastPage) {
|
||||
return false;
|
||||
}
|
||||
|
||||
e.persist();
|
||||
const { target } = e;
|
||||
|
||||
if (target.scrollTop + target.offsetHeight === target.scrollHeight) {
|
||||
fetchMoreOperatorProfiles({
|
||||
variables: { context: { ...operatorProfiles.getAllProfiles.context } },
|
||||
updateQuery: updateQueryGetAllProfiles,
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
const handleFetchIdProviderProfiles = e => {
|
||||
if (idProviderProfiles.getAllProfiles.context.lastPage) {
|
||||
return false;
|
||||
}
|
||||
|
||||
e.persist();
|
||||
const { target } = e;
|
||||
|
||||
if (target.scrollTop + target.offsetHeight === target.scrollHeight) {
|
||||
fetchMoreIdProviderProfiles({
|
||||
variables: { context: { ...idProviderProfiles.getAllProfiles.context } },
|
||||
updateQuery: updateQueryGetAllProfiles,
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
const handleFetchMoreProfiles = (e, key) => {
|
||||
if (key === 'radius') fetchMoreProfiles(e, radiusProfiles, fetchMoreRadiusProfiles);
|
||||
else if (key === 'captive_portal')
|
||||
fetchMoreProfiles(e, captiveProfiles, fetchMoreCaptiveProfiles);
|
||||
else if (key === 'rf') fetchMoreProfiles(e, rfProfiles, fetchMoreRfProfiles);
|
||||
else if (key === 'passpoint_venue') fetchMoreProfiles(e, venueProfiles, fetchMoreVenueProfiles);
|
||||
else if (key === 'passpoint_operator')
|
||||
fetchMoreProfiles(e, operatorProfiles, fetchMoreOperatorProfiles);
|
||||
else if (key === 'passpoint_osu_id_provider')
|
||||
fetchMoreProfiles(e, idProviderProfiles, fetchMoreIdProviderProfiles);
|
||||
else fetchMoreProfiles(e, ssidProfiles, fetchMore);
|
||||
};
|
||||
|
||||
if (loading) {
|
||||
@@ -341,14 +302,11 @@ const ProfileDetails = () => {
|
||||
venueProfiles={venueProfiles?.getAllProfiles?.items}
|
||||
operatorProfiles={operatorProfiles?.getAllProfiles?.items}
|
||||
idProviderProfiles={idProviderProfiles?.getAllProfiles?.items}
|
||||
associatedSsidProfiles={data.getProfile?.associatedSsidProfiles}
|
||||
osuSsidProfile={data.getProfile?.osuSsidProfile}
|
||||
fileUpload={handleFileUpload}
|
||||
onFetchMoreProfiles={handleFetchProfiles}
|
||||
onFetchMoreRfProfiles={handleFetchRfProfiles}
|
||||
onFetchMoreRadiusProfiles={handleFetchRadiusProfiles}
|
||||
onFetchMoreCaptiveProfiles={handleFetchCaptiveProfiles}
|
||||
onFetchMoreVenueProfiles={handleFetchVenueProfiles}
|
||||
onFetchMoreOperatorProfiles={handleFetchOperatorProfiles}
|
||||
onFetchMoreIdProviderProfiles={handleFetchIdProviderProfiles}
|
||||
onFetchMoreProfiles={handleFetchMoreProfiles}
|
||||
onDownloadFile={handleDownloadFile}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -10,3 +10,21 @@ export const updateQueryGetAllProfiles = (previousResult, { fetchMoreResult }) =
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const fetchMoreProfiles = (e, profile, fetchMore) => {
|
||||
if (profile.getAllProfiles.context.lastPage) {
|
||||
return false;
|
||||
}
|
||||
|
||||
e.persist();
|
||||
const { target } = e;
|
||||
|
||||
if (target.scrollTop + target.offsetHeight + 10 >= target.scrollHeight) {
|
||||
fetchMore({
|
||||
variables: { context: { ...profile.getAllProfiles.context } },
|
||||
updateQuery: updateQueryGetAllProfiles,
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -255,6 +255,62 @@ export const CREATE_EQUIPMENT = gql`
|
||||
}
|
||||
`;
|
||||
|
||||
export const UPDATE_EQUIPMENT = gql`
|
||||
mutation UpdateEquipment(
|
||||
$id: ID!
|
||||
$equipmentType: String!
|
||||
$inventoryId: String!
|
||||
$customerId: ID!
|
||||
$profileId: ID!
|
||||
$locationId: ID!
|
||||
$name: String!
|
||||
$baseMacAddress: String
|
||||
$latitude: String
|
||||
$longitude: String
|
||||
$serial: String
|
||||
$lastModifiedTimestamp: String
|
||||
$details: JSONObject
|
||||
) {
|
||||
updateEquipment(
|
||||
id: $id
|
||||
equipmentType: $equipmentType
|
||||
inventoryId: $inventoryId
|
||||
customerId: $customerId
|
||||
profileId: $profileId
|
||||
locationId: $locationId
|
||||
name: $name
|
||||
baseMacAddress: $baseMacAddress
|
||||
latitude: $latitude
|
||||
longitude: $longitude
|
||||
serial: $serial
|
||||
lastModifiedTimestamp: $lastModifiedTimestamp
|
||||
details: $details
|
||||
) {
|
||||
id
|
||||
equipmentType
|
||||
inventoryId
|
||||
customerId
|
||||
profileId
|
||||
locationId
|
||||
name
|
||||
baseMacAddress
|
||||
latitude
|
||||
longitude
|
||||
serial
|
||||
lastModifiedTimestamp
|
||||
details
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const DELETE_EQUIPMENT = gql`
|
||||
mutation DeleteEquipment($id: ID!) {
|
||||
deleteEquipment(id: $id) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const UPDATE_CUSTOMER = gql`
|
||||
mutation UpdateCustomer(
|
||||
$id: ID!
|
||||
|
||||
@@ -70,6 +70,9 @@ export const FILTER_EQUIPMENT = gql`
|
||||
firmware {
|
||||
detailsJSON
|
||||
}
|
||||
channel {
|
||||
detailsJSON
|
||||
}
|
||||
}
|
||||
}
|
||||
context
|
||||
@@ -77,6 +80,67 @@ export const FILTER_EQUIPMENT = gql`
|
||||
}
|
||||
`;
|
||||
|
||||
export const GET_EQUIPMENT = gql`
|
||||
query GetEquipment($id: ID!) {
|
||||
getEquipment(id: $id) {
|
||||
id
|
||||
equipmentType
|
||||
inventoryId
|
||||
customerId
|
||||
profileId
|
||||
locationId
|
||||
name
|
||||
latitude
|
||||
longitude
|
||||
serial
|
||||
lastModifiedTimestamp
|
||||
details
|
||||
profile {
|
||||
id
|
||||
name
|
||||
childProfiles {
|
||||
id
|
||||
name
|
||||
details
|
||||
}
|
||||
}
|
||||
baseMacAddress
|
||||
manufacturer
|
||||
status {
|
||||
firmware {
|
||||
detailsJSON
|
||||
}
|
||||
protocol {
|
||||
detailsJSON
|
||||
}
|
||||
radioUtilization {
|
||||
detailsJSON
|
||||
}
|
||||
clientDetails {
|
||||
detailsJSON
|
||||
details {
|
||||
numClientsPerRadio
|
||||
}
|
||||
}
|
||||
osPerformance {
|
||||
detailsJSON
|
||||
}
|
||||
channel {
|
||||
detailsJSON
|
||||
}
|
||||
}
|
||||
model
|
||||
alarmsCount
|
||||
alarms {
|
||||
severity
|
||||
alarmCode
|
||||
details
|
||||
createdTimestamp
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const FILTER_EQUIPMENT_BULK_EDIT_APS = gql`
|
||||
query FilterEquipment(
|
||||
$locationIds: [ID]
|
||||
|
||||
10586
package-lock.json
generated
10586
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
35
package.json
35
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "wlan-cloud-ui",
|
||||
"version": "0.7.5",
|
||||
"version": "1.1.1",
|
||||
"author": "ConnectUs",
|
||||
"description": "React Portal",
|
||||
"engines": {
|
||||
@@ -9,9 +9,9 @@
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest --passWithNoTests --coverage",
|
||||
"start": "cross-env NODE_ENV=development webpack-dev-server",
|
||||
"start:bare": "cross-env API=https://wlan-graphql.qa.lab.wlan.tip.build NODE_ENV=bare webpack-dev-server",
|
||||
"start:dev": "cross-env API=https://wlan-graphql.qa.lab.wlan.tip.build NODE_ENV=development webpack-dev-server",
|
||||
"start": "cross-env NODE_ENV=development webpack serve",
|
||||
"start:bare": "cross-env API=ttps://portal.rtl.lab.netexperience.com NODE_ENV=bare webpack serve",
|
||||
"start:dev": "cross-env API=https://portal.rtl.lab.netexperience.com NODE_ENV=development webpack serve",
|
||||
"build": "webpack --mode=production",
|
||||
"format": "prettier --write 'app/**/*{.js,.scss}'",
|
||||
"eslint-fix": "eslint --fix 'app/**/*.js'",
|
||||
@@ -21,33 +21,29 @@
|
||||
"dependencies": {
|
||||
"@ant-design/icons": "^4.2.1",
|
||||
"@apollo/client": "^3.1.3",
|
||||
"@tip-wlan/wlan-cloud-ui-library": "^0.7.6",
|
||||
"@tip-wlan/wlan-cloud-ui-library": "^1.1.3",
|
||||
"antd": "^4.5.2",
|
||||
"apollo-upload-client": "^13.0.0",
|
||||
"clean-webpack-plugin": "^3.0.0",
|
||||
"graphql": "^14.6.0",
|
||||
"graphql": "^15.5.0",
|
||||
"highcharts": "^8.1.0",
|
||||
"highcharts-react-official": "^3.0.0",
|
||||
"history": "^4.10.1",
|
||||
"html-webpack-plugin": "^3.2.0",
|
||||
"lodash": "^4.17.15",
|
||||
"mini-css-extract-plugin": "^0.9.0",
|
||||
"moment": "^2.26.0",
|
||||
"optimize-css-assets-webpack-plugin": "^5.0.3",
|
||||
"prop-types": "^15.7.2",
|
||||
"react": "^16.13.0",
|
||||
"react-dom": "^16.13.0",
|
||||
"react-helmet": "^5.2.1",
|
||||
"react-jsx-highcharts": "^4.1.0",
|
||||
"react-jsx-highstock": "^4.1.0",
|
||||
"react-router-dom": "^5.1.2",
|
||||
"terser-webpack-plugin": "^2.3.5"
|
||||
"react-router-dom": "^5.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.8.7",
|
||||
"@babel/plugin-proposal-class-properties": "^7.8.3",
|
||||
"@babel/preset-env": "^7.8.7",
|
||||
"@babel/preset-react": "^7.8.3",
|
||||
"@babel/runtime": "^7.13.10",
|
||||
"@testing-library/react": "^10.0.3",
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-eslint": "^10.1.0",
|
||||
@@ -55,8 +51,10 @@
|
||||
"babel-loader": "^8.0.6",
|
||||
"babel-plugin-root-import": "^6.4.1",
|
||||
"babel-polyfill": "^6.26.0",
|
||||
"clean-webpack-plugin": "^3.0.0",
|
||||
"cross-env": "^7.0.2",
|
||||
"css-loader": "^3.4.2",
|
||||
"css-minimizer-webpack-plugin": "^1.3.0",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-config-airbnb": "^18.0.1",
|
||||
"eslint-config-prettier": "^6.10.0",
|
||||
@@ -68,20 +66,23 @@
|
||||
"eslint-plugin-react": "^7.19.0",
|
||||
"eslint-plugin-react-hooks": "^2.5.0",
|
||||
"file-loader": "^5.1.0",
|
||||
"html-webpack-plugin": "^5.3.1",
|
||||
"husky": "^4.2.3",
|
||||
"jest": "^25.4.0",
|
||||
"less": "^3.11.1",
|
||||
"less-loader": "^5.0.0",
|
||||
"less-loader": "^6.2.0",
|
||||
"lint-staged": "^10.0.8",
|
||||
"mini-css-extract-plugin": "^1.3.9",
|
||||
"node-sass": "^4.13.1",
|
||||
"prettier": "^1.19.1",
|
||||
"react-test-renderer": "^16.13.1",
|
||||
"sass-loader": "^8.0.2",
|
||||
"style-loader": "^1.1.3",
|
||||
"webpack": "^4.42.0",
|
||||
"webpack-cli": "^3.3.11",
|
||||
"webpack-dev-server": "^3.11.0",
|
||||
"webpack-merge": "^4.2.2"
|
||||
"terser-webpack-plugin": "^5.1.1",
|
||||
"webpack": "^5.28.0",
|
||||
"webpack-cli": "^4.5.0",
|
||||
"webpack-dev-server": "^3.11.2",
|
||||
"webpack-merge": "^5.7.3"
|
||||
},
|
||||
"browserslist": [
|
||||
"last 2 versions",
|
||||
|
||||
@@ -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 envs = {
|
||||
@@ -9,4 +10,4 @@ const envs = {
|
||||
/* eslint-disable global-require,import/no-dynamic-require */
|
||||
const env = envs[process.env.NODE_ENV || 'production'];
|
||||
const envConfig = require(`./webpack/webpack.${env}.js`);
|
||||
module.exports = webpackMerge(common, envConfig);
|
||||
module.exports = merge(common, envConfig);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
const HtmlWebPackPlugin = require('html-webpack-plugin');
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
const webpack = require('webpack');
|
||||
|
||||
@@ -25,10 +24,6 @@ module.exports = {
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebPackPlugin({
|
||||
template: commonPaths.templatePath,
|
||||
favicon: './app/images/favicon.ico',
|
||||
}),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env.API': JSON.stringify(process.env.API || 'http://localhost:4000'),
|
||||
}),
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
const path = require('path');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
|
||||
const commonPaths = require('./paths');
|
||||
|
||||
@@ -52,7 +54,9 @@ module.exports = {
|
||||
{
|
||||
loader: 'less-loader', // compiles Less to CSS
|
||||
options: {
|
||||
javascriptEnabled: true,
|
||||
lessOptions: {
|
||||
javascriptEnabled: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
@@ -79,4 +83,11 @@ module.exports = {
|
||||
),
|
||||
},
|
||||
},
|
||||
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
template: commonPaths.templatePath,
|
||||
favicon: './app/images/favicon.ico',
|
||||
}),
|
||||
],
|
||||
};
|
||||
|
||||
@@ -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 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 path = require('path');
|
||||
|
||||
@@ -8,45 +10,50 @@ const commonPaths = require('./paths');
|
||||
|
||||
module.exports = {
|
||||
output: {
|
||||
filename: `${commonPaths.jsFolder}/[name].[hash].js`,
|
||||
path: commonPaths.outputPath,
|
||||
publicPath: '/',
|
||||
chunkFilename: `${commonPaths.jsFolder}/[name].[chunkhash].js`,
|
||||
filename: `${commonPaths.jsFolder}/[name].[chunkhash].js`,
|
||||
chunkFilename: `${commonPaths.jsFolder}/[id].[chunkhash].js`,
|
||||
},
|
||||
|
||||
optimization: {
|
||||
minimize: true,
|
||||
minimizer: [
|
||||
new TerserPlugin({
|
||||
// Use multi-process parallel running to improve the build speed
|
||||
// Default number of concurrent runs: os.cpus().length - 1
|
||||
parallel: true,
|
||||
// Enable file caching
|
||||
cache: true,
|
||||
sourceMap: true,
|
||||
}),
|
||||
new OptimizeCSSAssetsPlugin(),
|
||||
],
|
||||
// Automatically split vendor and commons
|
||||
// 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',
|
||||
terserOptions: {
|
||||
warnings: false,
|
||||
compress: {
|
||||
comparisons: false,
|
||||
},
|
||||
parse: {},
|
||||
mangle: true,
|
||||
output: {
|
||||
comments: false,
|
||||
ascii_only: true,
|
||||
},
|
||||
},
|
||||
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[\\/]/,
|
||||
name: 'async',
|
||||
chunks: 'async',
|
||||
minChunks: 4,
|
||||
name(module) {
|
||||
const packageName = module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1];
|
||||
return `npm.${packageName.replace('@', '')}`;
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
// Keep the runtime chunk seperated to enable long term caching
|
||||
// https://twitter.com/wSokra/status/969679223278505985
|
||||
runtimeChunk: true,
|
||||
},
|
||||
|
||||
module: {
|
||||
@@ -78,25 +85,48 @@ module.exports = {
|
||||
{
|
||||
loader: 'less-loader', // compiles Less to CSS
|
||||
options: {
|
||||
javascriptEnabled: true,
|
||||
lessOptions: {
|
||||
javascriptEnabled: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
resolve: {
|
||||
modules: ['node_modules', 'app'],
|
||||
alias: {
|
||||
app: path.resolve(__dirname, '../', 'app'),
|
||||
},
|
||||
},
|
||||
|
||||
plugins: [
|
||||
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({
|
||||
filename: `${commonPaths.cssFolder}/[name].css`,
|
||||
chunkFilename: `${commonPaths.cssFolder}/[name].css`,
|
||||
chunkFilename: `${commonPaths.cssFolder}/[id].css`,
|
||||
}),
|
||||
],
|
||||
devtool: 'source-map',
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user