159 Commits

Author SHA1 Message Date
Sean Macfarlane
eeb1f8a886 Merge pull request #109 from Telecominfraproject/NETEXP-3471
WIFI-3471 Change image tag to 1.3.0-SNAPSHOT
2021-08-17 14:55:09 -04:00
AkshayJagadish-ne
7588eae33d Update dockerpublish.yml 2021-08-13 14:17:42 -04:00
Sean Macfarlane
8b4d15d0b2 updated library 2021-08-09 15:48:48 -04:00
Sean Macfarlane
716b5e227e Merge pull request #108 from Telecominfraproject/hotfix/AutoProvisionLocationSelect
hotfix/AutoProvisionLocation: Changed location data structure for Auto-Provision
2021-08-09 14:01:19 -04:00
irtiza-h30
27a2548c71 Changed location data structure for Auto-Provision 2021-08-06 18:46:13 -04:00
Sean Macfarlane
6e7d857bbe v1.2.0 2021-07-29 18:55:18 -04:00
Sean Macfarlane
6cd475ea8e v1.1.21 2021-07-26 16:47:11 -04:00
Sean Macfarlane
66c7d629a3 Merge pull request #107 from Telecominfraproject/hotfix/BulkEditAllowedChannels
hotfix/BulkEditAllowedChannels: Added allowedChannels field to BulkEditTable
2021-07-26 13:07:35 -04:00
irtiza-h30
5c84362777 added allowedChannels field to BulkEditTable 2021-07-23 12:18:38 -04:00
Sean Macfarlane
29a66613c1 v1.1.20 2021-07-22 18:10:13 -04:00
Sean Macfarlane
10adeeeba3 Merge pull request #106 from Telecominfraproject/bugfix/NOJIRA-dashboard-data-structure
Bugfix/NOJIRA: Restructure Dashboard Data
2021-07-22 17:59:04 -04:00
Hassan Azmi
8938b9a800 restructure data 2021-07-21 15:15:56 -04:00
Sean Macfarlane
9592450d5f v1.1.19 2021-07-20 11:43:50 -04:00
Sean Macfarlane
d4b12c614f updated library 2021-07-09 16:48:58 -04:00
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
Sean Macfarlane
7810f51baf updated versions 2021-03-23 11:05:19 -04:00
Sean Macfarlane
300f00cc85 Merge pull request #95 from Telecominfraproject/bugfix/NETEXP-1335
bugfix/NETEXP-1335: Added associatedSsidProfiles field in GetProfile query
2021-03-23 10:49:20 -04:00
irtiza-h30
0b83cce523 Added osuSsidProfile in getProfile query 2021-03-22 15:26:22 -04:00
irtiza-h30
5de121330e associatedSsidProfiles field in GetProfile query 2021-03-19 17:11:11 -04:00
Sean Macfarlane
252047aad4 WIFI-1557 2021-03-19 00:42:26 -04:00
Sean Macfarlane
a7c7b0f295 Merge pull request #94 from Telecominfraproject/bugfix/WIFI-1755
bugfix/WIFI-1755: Used correct dataIndex for AP Table Channels
2021-03-17 14:09:27 -04:00
Sean Macfarlane
8d14212702 updated library 2021-03-17 14:03:06 -04:00
irtiza-h30
70d609643c used correct dataIndex for AP Table Channels 2021-03-17 12:45:02 -04:00
Sean Macfarlane
a6e2f9b5c7 Merge pull request #93 from Telecominfraproject/hotfix/BulkEditTable
hotfix/BulkEditTable: Added radioMap property to tableData array
2021-03-17 11:47:25 -04:00
irtiza-h30
569ce9d5f9 added radioMap property to tableData array 2021-03-16 19:32:41 -04:00
Sean Macfarlane
a0506eaf07 update library 2021-03-12 13:52:50 -05:00
Sean Macfarlane
31074ac42e fixed image upload 2021-03-11 18:46:11 -05:00
Sean Macfarlane
2eebd4ac3d update version 2021-03-09 21:11:46 -05:00
Sean Macfarlane
153e4f7dcf updated library 2021-03-09 17:43:13 -05:00
Sean Macfarlane
325f86ff42 Merge pull request #92 from Telecominfraproject/bugfix/WIFI-1452
bugfix/WIFI-1452: Fixed bug on Edit User page
2021-03-09 12:04:06 -05:00
irtiza-h30
5bff3379d5 fixed rendering bug 2021-03-08 22:05:04 -05:00
irtiza-h30
a2cf42e90c Fixed bug on Edit User page 2021-03-08 17:56:50 -05:00
Sean Macfarlane
0fd5803584 updated library 2021-03-08 16:01:11 -05:00
Sean Macfarlane
af98ac522a Merge pull request #91 from Telecominfraproject/bugfix/WIFI-824
bugfix/WIFI-824: File downloading functionality for Captive Portal Page
2021-03-08 16:00:00 -05:00
irtiza-h30
6baf3785da file downloading functionality 2021-03-08 15:39:15 -05:00
Sean Macfarlane
36682cd207 fixed publish action 2021-03-04 13:25:12 -05:00
Sean Macfarlane
63ac433ad8 fixed actin 2021-03-04 13:16:13 -05:00
Sean Macfarlane
2ed09f903c release 1.0.0 2021-03-04 13:01:34 -05:00
Sean Macfarlane
2c0fa53896 Merge pull request #90 from Telecominfraproject/bugfix/WIFI-1505
hotfix/WIFI-1505: Manual Channel Editing
2021-03-04 12:41:10 -05:00
irtiza-h30
9bf737c1eb Manual backup channel change for Bulk-Edit APs 2021-03-03 14:22:02 -05:00
Sean Macfarlane
cf5be15402 removed caching 2021-02-26 14:06:09 -05:00
Sean Macfarlane
f3ee2f5a7c fixed ap details profiles 2021-02-22 22:27:56 -05:00
Sean Macfarlane
6ddd9b30f3 updated library 2021-02-20 20:38:19 -05:00
Sean Macfarlane
8acdd0ca4a updated library 2021-02-18 14:10:41 -05:00
Sean Macfarlane
8670e74b77 Merge pull request #88 from Telecominfraproject/bugfix/WIFI-1442
Bugfix/WIFI-1442: Bulk-Edit APs Page Fixes
2021-02-18 11:10:06 -05:00
irtiza-h30
c8798dd6b3 fixed function for updated param type 2021-02-18 10:19:38 -05:00
Sean Macfarlane
82b5688503 WIFI-1557 2021-02-17 13:55:54 -05:00
irtiza-h30
fadb618c6a fixed column styling 2021-02-16 17:53:46 -05:00
Sean Macfarlane
dbf54d26b6 updated library 2021-02-16 14:36:42 -05:00
irtiza-h30
11e7b92902 null safe fix 2021-02-12 14:52:23 -05:00
irtiza-h30
cb8364b1ab fixed saving bug 2021-02-12 11:45:53 -05:00
Sean Macfarlane
796bf24ef9 updated library 2021-02-05 12:45:47 -05:00
Sean Macfarlane
444a9a929d updated library 2021-01-29 14:25:45 -05:00
Sean Macfarlane
efea725ce9 Merge pull request #87 from Telecominfraproject/hotfix/ProfilePages
hotfix/ProfilePages: fixed prop names
2021-01-23 16:01:41 -05:00
Sean Macfarlane
7a3bcbb2cb update versions 2021-01-23 16:00:06 -05:00
Sean Macfarlane
a3e304323d Merge branch 'master' into hotfix/ProfilePages 2021-01-22 19:04:16 -05:00
Sean Macfarlane
af182c93c6 fixed update equipment 2021-01-22 18:56:16 -05:00
irtiza-h30
78fde75678 fixed props 2021-01-21 19:32:14 -05:00
Sean Macfarlane
7eda2074b2 updated version 2021-01-20 12:22:44 -05:00
Sean Macfarlane
ded1b2d088 fixed error policies 2021-01-20 12:21:45 -05:00
Sean Macfarlane
e1f0357c1f Merge pull request #86 from Telecominfraproject/bugfix/NETEXP-523
bugfix/NETEXP-523: Passed down radius & captive profiles to AddProfile
2021-01-05 12:14:21 -05:00
ToanDo
b84e156f74 Passed down radius&captive profiles to AddProfile 2021-01-04 18:02:00 -05:00
Sean Macfarlane
cae23638ee Merge pull request #85 from Telecominfraproject/bugfix/NETEXP-839
bugfix/NETEXP-839: Added comparison to filter out negative values of the traffic graph
2020-12-21 21:59:40 -05:00
ToanDo
569154ff95 Added comparator to filter out negative traffic 2020-12-21 15:15:03 -05:00
Sean Macfarlane
78146969f3 update version 2020-12-16 13:22:20 -05:00
Sean Macfarlane
c39ee3e2c0 update version 2020-12-14 22:59:10 -05:00
Sean Macfarlane
017a3de539 Merge pull request #83 from Telecominfraproject/bugfix/NETEXP-783
bugfix/NETEXP-783: AP table uses baseMacAddress and manufacturer
2020-12-14 22:30:34 -05:00
Sean Macfarlane
85ef801831 fixed macaddress 2020-12-14 22:25:12 -05:00
ToanDo
9582ca56af AP table uses baseMacAddress and manufacturer 2020-12-14 21:49:32 -05:00
Sean Macfarlane
26c11502e3 Merge pull request #82 from Telecominfraproject/hotfix/NETEXP-558
hotfix/NETEXP-558: Auto updates firmware version
2020-12-13 14:38:21 -05:00
Sean Macfarlane
83e4bc5e33 updated library 2020-12-13 12:12:54 -05:00
Sean Macfarlane
a89ac6e550 Merge pull request #81 from Telecominfraproject/hotfix/NETEXP-750
hotfix/NETEXP-750: Friendly Radio Names
2020-12-13 11:55:58 -05:00
chris-cosentino
3910e75712 updated list of firmware targets 2020-12-13 01:28:25 -05:00
chris-cosentino
2bf34a62e3 additional user friendly radio label fixes 2020-12-12 20:49:18 -05:00
Sean Macfarlane
2d06e56ffb update version 2020-12-12 18:43:39 -05:00
chris-cosentino
f13ec45465 added radioTypes constant 2020-12-12 17:50:35 -05:00
Sean Macfarlane
d2fe2c7dc3 Merge pull request #80 from Telecominfraproject/bugfix/NETEXP-741
bugfix/NETEXP-741: Passed down currentUserId to accounts page
2020-12-12 15:45:18 -05:00
ToanDo
2aeaaab3bc Passed down currentUserId to accounts page 2020-12-12 15:17:51 -05:00
Sean Macfarlane
4dbed9922b updated library 2020-12-10 14:01:07 -05:00
Sean Macfarlane
7d2b1ea5fc Merge pull request #78 from Telecominfraproject/hotfix/WIFI-640
Hotfix/WIFI-640: Added delete button
2020-12-09 17:24:00 -05:00
chris-cosentino
6dd251dd94 added fetch policy 2020-12-09 16:26:35 -05:00
Sean Macfarlane
285444f0b9 Merge pull request #79 from Telecominfraproject/feature/WIFI-1089
Feature/WIFI-1089: Added venue, operator, & id provider props
2020-12-09 16:13:52 -05:00
Sean Macfarlane
7c16a50e81 Merge branch 'master' into feature/WIFI-1089 2020-12-09 15:48:19 -05:00
chris-cosentino
8f2a33b625 used history push and removed cache when delete ap 2020-12-09 11:04:11 -05:00
chris-cosentino
3be405a577 added delete equipment 2020-12-08 15:52:30 -05:00
Toan Do
940eeb72fd Add childProfiles prop 2020-12-07 11:03:25 -05:00
Toan Do
0c14857dac removed unused props 2020-12-03 17:36:40 -05:00
Sean Macfarlane
612e9eb449 fixed precommit 2020-12-03 13:55:29 -05:00
Sean Macfarlane
e02bd79c26 fixed precommit 2020-12-03 13:54:18 -05:00
Sean Macfarlane
0b1e2a7427 Merge pull request #77 from Telecominfraproject/hotfix/WIFI-1133
hotfix/WIFI-1133: Added rfProfiles and fetchMoreRfProfiles
2020-12-03 13:49:40 -05:00
Sean Macfarlane
ea605f333c update package 2020-12-03 13:49:10 -05:00
Sean Macfarlane
1e8306ad4b updated version and fixed precommit 2020-12-03 12:55:47 -05:00
Sean Macfarlane
965dca7e7f Merge branch 'master' into hotfix/WIFI-1133 2020-12-03 12:39:03 -05:00
Toan Do
de2570662a added childProfiles prop 2020-12-01 15:52:16 -05:00
Toan Do
64a1ecae8a Added childProfiles prop 2020-12-01 15:17:40 -05:00
Toan Do
0ceff9e42e adjusted ssid & rf profiles props 2020-12-01 10:10:05 -05:00
Toan Do
b287aa4005 included new API in package.json 2020-12-01 10:00:16 -05:00
Sean Macfarlane
23cc799d71 switched live server 2020-12-01 01:56:22 -05:00
Toan Do
4ea1e55cdd Added rfProfiles and fetchMoreRfProfiles 2020-11-30 12:25:54 -05:00
Sean Macfarlane
cca9fc3667 switched Role to Roles 2020-11-27 20:34:29 -05:00
Toan Do
883379c48c Added profiiles data&fetch to AddProfiles 2020-11-26 10:06:49 -05:00
Toan Do
514100c6bc Added venue, operator, and id provider data &fetch 2020-11-26 09:45:11 -05:00
Sean Macfarlane
0f463832a7 added GenericNotFound 2020-11-21 01:03:03 -05:00
Sean Macfarlane
157b4ecb33 update version 2020-11-21 00:38:35 -05:00
Sean Macfarlane
155aeb27e0 made constant for Routes 2020-11-21 00:36:48 -05:00
Sean Macfarlane
6b43f8967d updated package 2020-11-19 21:26:52 -05:00
Sean Macfarlane
e744fed5d8 updated version 2020-11-17 18:00:59 -05:00
Sean Macfarlane
1f9da3f314 updated version 2020-11-17 17:58:57 -05:00
Sean Macfarlane
0d6b2f05af fixed prettier formatting 2020-11-17 15:24:57 -05:00
Sean Macfarlane
98d6fb6dbd fixed npm commands 2020-11-16 15:18:06 -05:00
31 changed files with 6414 additions and 7730 deletions

View File

@@ -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=1.3.0-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=1.3.0-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

1
.gitignore vendored
View File

@@ -4,6 +4,7 @@
/node_modules
/.pnp
.pnp.js
package-lock.json
# testing
/coverage

File diff suppressed because it is too large Load Diff

View File

@@ -12,7 +12,7 @@ const GET_ALL_USERS = gql`
items {
id
email: username
role
roles
lastModifiedTimestamp
customerId
}
@@ -22,10 +22,10 @@ const GET_ALL_USERS = gql`
`;
const CREATE_USER = gql`
mutation CreateUser($username: String!, $password: String!, $role: String!, $customerId: ID!) {
createUser(username: $username, password: $password, role: $role, customerId: $customerId) {
mutation CreateUser($username: String!, $password: String!, $roles: [String], $customerId: ID!) {
createUser(username: $username, password: $password, roles: $roles, customerId: $customerId) {
username
role
roles
customerId
}
}
@@ -36,7 +36,7 @@ const UPDATE_USER = gql`
$id: ID!
$username: String!
$password: String!
$role: String!
$roles: [String]
$customerId: ID!
$lastModifiedTimestamp: String
) {
@@ -44,13 +44,13 @@ const UPDATE_USER = gql`
id: $id
username: $username
password: $password
role: $role
roles: $roles
customerId: $customerId
lastModifiedTimestamp: $lastModifiedTimestamp
) {
id
username
role
roles
customerId
lastModifiedTimestamp
}
@@ -66,7 +66,7 @@ const DELETE_USER = gql`
`;
const Accounts = () => {
const { customerId } = useContext(UserContext);
const { customerId, id: currentUserId } = useContext(UserContext);
const { data, loading, error, refetch, fetchMore } = useQuery(GET_ALL_USERS, {
variables: { customerId },
@@ -95,12 +95,12 @@ const Accounts = () => {
}
};
const handleCreateUser = (email, password, role) => {
const handleCreateUser = ({ email, password, roles }) => {
createUser({
variables: {
username: email,
password,
role,
roles: [roles],
customerId,
},
})
@@ -119,13 +119,13 @@ const Accounts = () => {
);
};
const handleEditUser = (id, email, password, role, lastModifiedTimestamp) => {
const handleEditUser = ({ id, email, password, roles, lastModifiedTimestamp }) => {
updateUser({
variables: {
id,
username: email,
password,
role,
roles: [roles],
customerId,
lastModifiedTimestamp,
},
@@ -173,6 +173,7 @@ const Accounts = () => {
return (
<AccountsPage
data={data.getAllUsers.items}
currentUserId={currentUserId}
onLoadMore={handleLoadMore}
onCreateUser={handleCreateUser}
onEditUser={handleEditUser}

View File

@@ -4,9 +4,11 @@ import { useMutation, useQuery, gql } from '@apollo/client';
import { notification } from 'antd';
import { useHistory } from 'react-router-dom';
import { ROUTES, AUTH_TOKEN } from 'constants/index';
import UserContext from 'contexts/UserContext';
import { GET_ALL_PROFILES } from 'graphql/queries';
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 CREATE_PROFILE = gql`
mutation CreateProfile(
@@ -34,8 +36,48 @@ const CREATE_PROFILE = gql`
const AddProfile = () => {
const { customerId } = useContext(UserContext);
const { data: apiUrl } = useQuery(GET_API_URL);
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();
@@ -55,7 +97,7 @@ const AddProfile = () => {
message: 'Success',
description: 'Profile successfully created.',
});
history.push('/profiles', { refetch: true });
history.push(ROUTES.profiles, { refetch: true });
})
.catch(() =>
notification.error({
@@ -65,31 +107,71 @@ const AddProfile = () => {
);
};
const handleFetchProfiles = e => {
if (ssidProfiles.getAllProfiles.context.lastPage) {
return false;
}
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);
};
e.persist();
const { target } = e;
const handleFileUpload = async (fileName, file) => {
const token = getItem(AUTH_TOKEN);
if (target.scrollTop + target.offsetHeight === target.scrollHeight) {
fetchMore({
variables: { context: { ...ssidProfiles.getAllProfiles.context } },
updateQuery: updateQueryGetAllProfiles,
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 true;
};
return (
<AddProfilePage
onCreateProfile={handleAddProfile}
ssidProfiles={
(ssidProfiles && ssidProfiles.getAllProfiles && ssidProfiles.getAllProfiles.items) || []
}
onFetchMoreProfiles={handleFetchProfiles}
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={handleFetchMoreProfiles}
fileUpload={handleFileUpload}
/>
);
};

View File

@@ -2,12 +2,12 @@ import React, { useState } from 'react';
import { Helmet } from 'react-helmet';
import { Switch, Redirect } from 'react-router-dom';
import { ThemeProvider } from '@tip-wlan/wlan-cloud-ui-library';
import { ThemeProvider, GenericNotFound } from '@tip-wlan/wlan-cloud-ui-library';
import logo from 'images/tip-logo.png';
import logoMobile from 'images/tip-logo-mobile.png';
import { AUTH_TOKEN, COMPANY } from 'constants/index';
import { AUTH_TOKEN, COMPANY, ROUTES, USER_FRIENDLY_RADIOS } from 'constants/index';
import Login from 'containers/Login';
import Network from 'containers/Network';
@@ -32,7 +32,7 @@ import ProtectedRouteWithLayout from './components/ProtectedRouteWithLayout';
const RedirectToDashboard = () => (
<Redirect
to={{
pathname: '/dashboard',
pathname: ROUTES.dashboard,
}}
/>
);
@@ -42,7 +42,7 @@ const App = () => {
let initialUser = {};
if (token) {
const { userId, userName, userRole, customerId } = parseJwt(token.access_token);
initialUser = { id: userId, email: userName, role: userRole, customerId };
initialUser = { id: userId, email: userName, roles: userRole, customerId };
}
const [user, setUser] = useState(initialUser);
@@ -50,7 +50,7 @@ const App = () => {
setItem(AUTH_TOKEN, newToken);
if (newToken) {
const { userId, userName, userRole, customerId } = parseJwt(newToken.access_token);
setUser({ id: userId, email: userName, role: userRole, customerId });
setUser({ id: userId, email: userName, roles: userRole, customerId });
}
};
@@ -60,32 +60,44 @@ const App = () => {
<UserProvider
id={user.id}
email={user.email}
role={user.role}
roles={user.roles}
customerId={user.customerId}
updateUser={updateUser}
updateToken={updateToken}
>
<ThemeProvider company={COMPANY} logo={logo} logoMobile={logoMobile}>
<ThemeProvider
company={COMPANY}
logo={logo}
logoMobile={logoMobile}
routes={ROUTES}
radioTypes={USER_FRIENDLY_RADIOS}
>
<Helmet titleTemplate={`%s - ${COMPANY}`} defaultTitle={COMPANY}>
<meta name="description" content={COMPANY} />
</Helmet>
<Switch>
<UnauthenticatedRoute exact path="/login" component={Login} />
<ProtectedRouteWithLayout exact path="/" component={RedirectToDashboard} />
<ProtectedRouteWithLayout exact path="/dashboard" component={Dashboard} />
<ProtectedRouteWithLayout path="/network" component={Network} />
<ProtectedRouteWithLayout path="/system" component={System} />
<UnauthenticatedRoute exact path={ROUTES.login} component={Login} />
<ProtectedRouteWithLayout exact path={ROUTES.root} component={RedirectToDashboard} />
<ProtectedRouteWithLayout exact path={ROUTES.dashboard} component={Dashboard} />
<ProtectedRouteWithLayout path={ROUTES.network} component={Network} />
<ProtectedRouteWithLayout path={ROUTES.system} component={System} />
<ProtectedRouteWithLayout exact path="/profiles" component={Profiles} />
<ProtectedRouteWithLayout exact path="/profiles/:id" component={ProfileDetails} />
<ProtectedRouteWithLayout exact path="/addprofile" component={AddProfile} />
<ProtectedRouteWithLayout exact path={ROUTES.profiles} component={Profiles} />
<ProtectedRouteWithLayout
exact
path={`${ROUTES.profiles}/:id`}
component={ProfileDetails}
/>
<ProtectedRouteWithLayout exact path={ROUTES.addprofile} component={AddProfile} />
<ProtectedRouteWithLayout exact path="/alarms" component={Alarms} />
<ProtectedRouteWithLayout exact path="/account/edit" component={EditAccount} />
{user.role === 'SuperUser' && (
<ProtectedRouteWithLayout exact path="/accounts" component={Accounts} />
<ProtectedRouteWithLayout exact path={ROUTES.alarms} component={Alarms} />
{user?.id !== 0 && (
<ProtectedRouteWithLayout exact path={ROUTES.account} component={EditAccount} />
)}
{user?.roles?.[0] === 'SuperUser' && (
<ProtectedRouteWithLayout exact path={ROUTES.users} component={Accounts} />
)}
<ProtectedRouteWithLayout component={GenericNotFound} />
</Switch>
</ThemeProvider>
</UserProvider>

View File

@@ -5,6 +5,7 @@ import { useQuery } from '@apollo/client';
import { Dashboard as DashboardPage, Loading } from '@tip-wlan/wlan-cloud-ui-library';
import UserContext from 'contexts/UserContext';
import { FILTER_SYSTEM_EVENTS, GET_ALL_STATUS } from 'graphql/queries';
import { USER_FRIENDLY_RADIOS } from 'constants/index';
function formatBytes(bytes, decimals = 2) {
if (bytes === 0) return '0 Bytes';
@@ -19,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() {
@@ -29,20 +33,28 @@ function trafficTooltipFormatter() {
)}</b><br/>`;
}
const USER_FRIENDLY_RADIOS = {
is2dot4GHz: '2.4GHz',
is5GHzL: '5GHz (L)',
is5GHzU: '5GHz (U)',
is5GHz: '5GHz',
};
const lineChartConfig = [
{ key: 'inservicesAPs', title: 'Inservice APs (24 hours)' },
{ key: 'clientDevices', title: 'Client Devices (24 hours)' },
{
key: 'service',
title: 'Inservice APs (24 hours)',
lines: [{ key: 'inServiceAps', name: 'Inservice APs' }],
},
{
key: 'clientDevices',
title: 'Client Devices (24 hours)',
lines: [
{ key: 'clientDevices2dot4GHz', name: '2.4GHz' },
{ key: 'clientDevices5GHz', name: '5GHz' },
],
},
{
key: 'traffic',
title: 'Traffic (24 hours)',
options: { formatter: trafficLabelFormatter, tooltipFormatter: trafficTooltipFormatter },
title: 'Traffic - 5 min intervals (24 hours)',
lines: [
{ key: 'trafficBytesDownstreamData', name: 'Downstream' },
{ key: 'trafficBytesUpstreamData', name: 'Upstream' },
],
options: { formatter: trafficLabelFormatter, trafficTooltipFormatter },
},
];
@@ -61,32 +73,8 @@ const Dashboard = () => {
variables: { customerId, statusDataTypes: ['CUSTOMER_DASHBOARD'] },
});
const [lineChartData, setLineChartData] = useState({
inservicesAPs: {
key: 'Inservice APs',
value: [],
},
clientDevices: {
is2dot4GHz: {
key: USER_FRIENDLY_RADIOS.is2dot4GHz,
value: [],
},
is5GHz: {
key: USER_FRIENDLY_RADIOS.is5GHz,
value: [],
},
},
traffic: {
trafficBytesDownstream: {
key: 'Down Stream',
value: [],
},
trafficBytesUpstream: {
key: 'Up Stream',
value: [],
},
},
});
const [lineChartData, setLineChartData] = useState([]);
const [trafficBytesData, setTrafficBytesData] = useState();
const { loading: metricsLoading, error: metricsError, data: metricsData, fetchMore } = useQuery(
FILTER_SYSTEM_EVENTS,
@@ -104,74 +92,65 @@ const Dashboard = () => {
const formatLineChartData = (list = []) => {
if (list.length) {
setLineChartData(prev => {
const inservicesAPs = [];
const clientDevices2dot4GHz = [];
const clientDevices5GHz = [];
const trafficBytesDownstreamData = [];
const trafficBytesUpstreamData = [];
let totalDown = 0;
let totalUp = 0;
const chartData = [];
list.forEach(
({
eventTimestamp,
details: {
payload: {
details: {
equipmentInServiceCount,
associatedClientsCountPerRadio: radios,
trafficBytesDownstream,
trafficBytesUpstream,
},
let inServiceAps = 0;
let clientDevices2dot4GHz = 0;
let clientDevices5GHz = 0;
let trafficBytesDownstreamData = 0;
let trafficBytesUpstreamData = 0;
let totalDown = 0;
let totalUp = 0;
list.forEach(
({
eventTimestamp,
details: {
payload: {
details: {
equipmentInServiceCount,
associatedClientsCountPerRadio: radios,
trafficBytesDownstream,
trafficBytesUpstream,
},
},
}) => {
inservicesAPs.push([eventTimestamp, equipmentInServiceCount]);
},
}) => {
const timestamp = parseInt(eventTimestamp, 10);
inServiceAps = equipmentInServiceCount;
let total5GHz = 0;
total5GHz += (radios?.is5GHz || 0) + (radios?.is5GHzL || 0) + (radios?.is5GHzU || 0); // combine all 5GHz radios
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 = radios.is2dot4GHz || 0;
clientDevices5GHz = total5GHz || 0;
trafficBytesDownstreamData.push([eventTimestamp, trafficBytesDownstream || 0]);
trafficBytesUpstreamData.push([eventTimestamp, trafficBytesUpstream || 0]);
trafficBytesDownstreamData = (trafficBytesDownstream > 0 && trafficBytesDownstream) || 0;
trafficBytesUpstreamData = (trafficBytesUpstream > 0 && trafficBytesUpstream) || 0;
totalDown += trafficBytesDownstream || 0;
totalUp += trafficBytesUpstream || 0;
}
);
totalDown += (trafficBytesDownstream > 0 && trafficBytesDownstream) || 0;
totalUp += (trafficBytesUpstream > 0 && trafficBytesUpstream) || 0;
chartData.push({
timestamp,
inServiceAps,
clientDevices2dot4GHz,
clientDevices5GHz,
trafficBytesDownstreamData,
trafficBytesUpstreamData,
});
}
);
setTrafficBytesData(prev => {
return {
inservicesAPs: {
...prev.inservicesAPs,
value: [...prev.inservicesAPs.value, ...inservicesAPs],
},
clientDevices: {
is2dot4GHz: {
...prev.clientDevices.is2dot4GHz,
value: [...prev.clientDevices.is2dot4GHz.value, ...clientDevices2dot4GHz],
},
is5GHz: {
...prev.clientDevices.is5GHz,
value: [...prev.clientDevices.is5GHz.value, ...clientDevices5GHz],
},
},
traffic: {
trafficBytesDownstream: {
...prev.traffic.trafficBytesDownstream,
value: [...prev.traffic.trafficBytesDownstream.value, ...trafficBytesDownstreamData],
},
trafficBytesUpstream: {
...prev.traffic.trafficBytesUpstream,
value: [...prev.traffic.trafficBytesUpstream.value, ...trafficBytesUpstreamData],
},
},
totalDownstreamTraffic: totalDown,
totalUpstreamTraffic: totalUp,
totalUpstreamTraffic: (prev?.totalUpstreamTraffic || 0) + totalUp,
totalDownstreamTraffic: (prev?.totalDownstreamTraffic || 0) + totalDown,
};
});
setLineChartData(prev => {
return [...prev, ...chartData];
});
}
};
@@ -271,8 +250,8 @@ const Dashboard = () => {
},
{
title: 'Usage Information (24 hours)',
'Total Traffic (US)': formatBytes(lineChartData?.totalUpstreamTraffic),
'Total Traffic (DS)': formatBytes(lineChartData?.totalDownstreamTraffic),
'Total Traffic (Downstream)': formatBytes(trafficBytesData?.totalDownstreamTraffic),
'Total Traffic (Upstream)': formatBytes(trafficBytesData?.totalUpstreamTraffic),
},
]}
pieChartDetails={pieChartsData}

View File

@@ -10,7 +10,7 @@ const GET_USER = gql`
getUser(id: $id) {
id
username
role
roles
customerId
lastModifiedTimestamp
}
@@ -22,7 +22,7 @@ const UPDATE_USER = gql`
$id: ID!
$username: String!
$password: String!
$role: String!
$roles: [String]
$customerId: ID!
$lastModifiedTimestamp: String
) {
@@ -30,13 +30,13 @@ const UPDATE_USER = gql`
id: $id
username: $username
password: $password
role: $role
roles: $roles
customerId: $customerId
lastModifiedTimestamp: $lastModifiedTimestamp
) {
id
username
role
roles
customerId
lastModifiedTimestamp
}
@@ -49,14 +49,14 @@ const EditAccount = () => {
const [updateUser] = useMutation(UPDATE_USER);
const handleSubmit = newPassword => {
const { role, customerId, lastModifiedTimestamp } = data.getUser;
const { roles, customerId, lastModifiedTimestamp } = data.getUser;
updateUser({
variables: {
id,
username: email,
password: newPassword,
role,
roles,
customerId,
lastModifiedTimestamp,
},

View File

@@ -6,14 +6,14 @@ import { AppLayout as Layout } from '@tip-wlan/wlan-cloud-ui-library';
import { GET_ALARM_COUNT } from 'graphql/queries';
import { AUTH_TOKEN } from 'constants/index';
import { AUTH_TOKEN, ROUTES } from 'constants/index';
import { removeItem } from 'utils/localStorage';
import UserContext from 'contexts/UserContext';
const MasterLayout = ({ children }) => {
const { role, customerId } = useContext(UserContext);
const { roles, customerId, id: currentUserId } = useContext(UserContext);
const client = useApolloClient();
const location = useLocation();
@@ -30,75 +30,60 @@ const MasterLayout = ({ children }) => {
const menuItems = [
{
key: 'dashboard',
path: '/dashboard',
path: ROUTES.dashboard,
text: 'Dashboard',
},
{
key: 'network',
path: '/network',
path: ROUTES.network,
text: 'Network',
},
{
key: 'profiles',
path: '/profiles',
path: ROUTES.profiles,
text: 'Profiles',
},
{
key: 'system',
path: '/system',
path: ROUTES.system,
text: 'System',
},
];
const mobileMenuItems = [
{
key: 'dashboard',
path: '/dashboard',
text: 'Dashboard',
},
{
key: 'network',
path: '/network',
text: 'Network',
},
{
key: 'profiles',
path: '/profiles',
text: 'Profiles',
},
{
key: 'system',
path: '/system',
text: 'System',
},
...menuItems,
{
key: 'settings',
text: 'Settings',
children: [
{
key: 'editAccount',
path: '/account/edit',
text: 'Edit Account',
},
...(currentUserId !== 0
? [
{
key: 'editAccount',
path: ROUTES.account,
text: 'Edit Account',
},
]
: []),
{
key: 'logout',
path: '/',
path: ROUTES.root,
text: 'Log Out',
},
],
},
];
if (role === 'SuperUser') {
if (roles?.[0] === 'SuperUser') {
menuItems.push({
key: 'accounts',
path: '/accounts',
text: 'Accounts',
key: 'users',
path: ROUTES.users,
text: 'Users',
});
mobileMenuItems.push({
key: 'accounts',
path: '/accounts',
text: 'Accounts',
key: 'users',
path: ROUTES.users,
text: 'Users',
});
}
@@ -109,6 +94,7 @@ const MasterLayout = ({ children }) => {
menuItems={menuItems}
mobileMenuItems={mobileMenuItems}
totalAlarms={data && data.getAlarmCount}
currentUserId={currentUserId}
>
{children}
</Layout>

View File

@@ -1,7 +1,7 @@
import React, { useContext } from 'react';
import PropTypes from 'prop-types';
import { useParams } from 'react-router-dom';
import { useQuery, useMutation, gql } from '@apollo/client';
import { useParams, useHistory } from 'react-router-dom';
import { useQuery, useMutation } from '@apollo/client';
import { Alert, notification } from 'antd';
import moment from 'moment';
import {
@@ -9,131 +9,36 @@ 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
}
}
status {
firmware {
detailsJSON
}
protocol {
detailsJSON
details {
reportedMacAddr
manufacturer
}
}
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 toTime = moment();
const fromTime = moment().subtract(1, 'hour');
const AccessPointDetails = ({ locations }) => {
const { id } = useParams();
const { customerId } = useContext(UserContext);
const history = useHistory();
const { loading, error, data, refetch } = useQuery(GET_EQUIPMENT, {
variables: {
id,
},
fetchPolicy: 'network-only',
errorPolicy: 'all',
});
const { data: dataFirmware, error: errorFirmware, loading: loadingFirmware } = useQuery(
@@ -141,9 +46,9 @@ const AccessPointDetails = ({ locations }) => {
{
skip: !data?.getEquipment?.model,
variables: { modelId: data?.getEquipment?.model },
errorPolicy: 'all',
}
);
const {
data: dataProfiles,
error: errorProfiles,
@@ -158,6 +63,7 @@ const AccessPointDetails = ({ locations }) => {
}`),
{
variables: { customerId, type: 'equipment_ap' },
fetchPolicy: 'network-only',
}
);
@@ -165,7 +71,7 @@ const AccessPointDetails = ({ locations }) => {
loading: metricsLoading,
error: metricsError,
data: metricsData,
refetch: metricsRefetch,
fetchMore: fetchMoreServiceMetrics,
} = useQuery(FILTER_SERVICE_METRICS, {
variables: {
customerId,
@@ -181,26 +87,50 @@ const AccessPointDetails = ({ locations }) => {
const [updateEquipmentFirmware] = useMutation(UPDATE_EQUIPMENT_FIRMWARE);
const [requestEquipmentSwitchBank] = useMutation(REQUEST_EQUIPMENT_SWITCH_BANK);
const [requestEquipmentReboot] = useMutation(REQUEST_EQUIPMENT_REBOOT);
const [deleteEquipment] = useMutation(DELETE_EQUIPMENT);
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,
@@ -210,11 +140,12 @@ const AccessPointDetails = ({ locations }) => {
profileId,
locationId,
name,
baseMacAddress,
latitude,
longitude,
serial,
lastModifiedTimestamp,
details,
details: formattedData,
},
})
.then(() => {
@@ -232,6 +163,25 @@ const AccessPointDetails = ({ locations }) => {
);
};
const handleDeleteEquipment = () => {
deleteEquipment({
variables: { id },
})
.then(() => {
history.push('/network/access-points');
notification.success({
message: 'Success',
description: 'Equipment successfully deleted',
});
})
.catch(() =>
notification.error({
message: 'Error',
description: 'Equipment could not be deleted.',
})
);
};
const handleUpdateEquipmentFirmware = (equipmentId, firmwareVersionId) =>
updateEquipmentFirmware({ variables: { equipmentId, firmwareVersionId } })
.then(firmwareResp => {
@@ -299,28 +249,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"
@@ -335,6 +271,7 @@ const AccessPointDetails = ({ locations }) => {
<AccessPointDetailsPage
handleRefresh={refetchData}
onUpdateEquipment={handleUpdateEquipment}
onDeleteEquipment={handleDeleteEquipment}
data={data?.getEquipment}
profiles={dataProfiles?.getAllProfiles?.items}
osData={{

View File

@@ -6,6 +6,7 @@ import { notification } from 'antd';
import { floor, padStart } from 'lodash';
import { NetworkTableContainer } from '@tip-wlan/wlan-cloud-ui-library';
import { ROUTES } from 'constants/index';
import UserContext from 'contexts/UserContext';
import { FILTER_EQUIPMENT } from 'graphql/queries';
@@ -58,12 +59,12 @@ const accessPointsTableColumns = [
},
{
title: 'MAC',
dataIndex: ['status', 'protocol', 'details', 'reportedMacAddr'],
dataIndex: 'baseMacAddress',
render: renderTableCell,
},
{
title: 'MANUFACTURER',
dataIndex: ['status', 'protocol', 'details', 'manufacturer'],
dataIndex: 'manufacturer',
render: renderTableCell,
},
{
@@ -88,8 +89,8 @@ const accessPointsTableColumns = [
},
{
title: 'CHANNEL',
dataIndex: 'channel',
render: renderTableCell,
dataIndex: ['status', 'channel', 'detailsJSON', 'channelNumberStatusDataMap'],
render: text => renderTableCell(Object.values(text ?? [])),
},
{
title: 'OCCUPANCY',
@@ -165,7 +166,7 @@ const AccessPoints = ({ checkedLocations }) => {
return (
<NetworkTableContainer
activeTab="/network/access-points"
activeTab={ROUTES.accessPoints}
onRefresh={handleOnRefresh}
tableColumns={accessPointsTableColumns}
tableData={equipData && equipData.filterEquipment && equipData.filterEquipment.items}

View File

@@ -1,9 +1,12 @@
import React, { useContext, useMemo } from 'react';
import React, { useContext, useMemo, useEffect } from 'react';
import PropTypes from 'prop-types';
import { Alert, notification } from 'antd';
import { useParams } from 'react-router-dom';
import { useQuery, useMutation } from '@apollo/client';
import { BulkEditAccessPoints, Loading } from '@tip-wlan/wlan-cloud-ui-library';
import { useLazyQuery, useMutation } from '@apollo/client';
import { BulkEditAccessPoints, sortRadioTypes } from '@tip-wlan/wlan-cloud-ui-library';
import { USER_FRIENDLY_RADIOS } from 'constants/index';
import { getBreadcrumbPath, getLocationPath } from 'utils/locations';
import { FILTER_EQUIPMENT_BULK_EDIT_APS } from 'graphql/queries';
import { UPDATE_EQUIPMENT_BULK } from 'graphql/mutations';
@@ -25,243 +28,200 @@ 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: 'Radios',
dataIndex: 'radioMap',
width: 150,
render: text => renderTableCell(text.map(i => USER_FRIENDLY_RADIOS[i])),
},
{
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,
},
];
const getBreadcrumbPath = (id, locations) => {
const locationsPath = [];
const treeRecurse = (parentNodeId, node) => {
if (node.id === parentNodeId) {
locationsPath.unshift(node);
return node;
}
if (node.children) {
let parent;
node.children.some(i => {
parent = treeRecurse(parentNodeId, i);
return parent;
});
if (parent) {
locationsPath.unshift(node);
}
return parent;
}
return null;
};
const getRadioDetails = (radioDetails, type) => {
const sortedRadios = sortRadioTypes(Object.keys(radioDetails?.radioMap || {}));
treeRecurse(id, {
id: 0,
children: locations,
});
return locationsPath;
};
const getLocationPath = (selectedId, locations) => {
const locationsPath = [];
const treeRecurse = (parentNodeId, node) => {
if (node.id === parentNodeId) {
locationsPath.unshift(node.id);
if (node.children) {
const flatten = children => {
children.forEach(i => {
locationsPath.unshift(i.id);
if (i.children) {
flatten(i.children);
}
});
};
flatten(node.children);
}
return node;
}
if (node.children) {
let parent;
node.children.some(i => {
parent = treeRecurse(parentNodeId, i);
return parent;
});
return parent;
}
return null;
};
if (selectedId) {
treeRecurse(selectedId, { id: 0, children: locations });
if (type === 'manualChannelNumber') {
return sortedRadios.map(i => radioDetails.radioMap[i]?.manualChannelNumber);
}
return locationsPath;
if (type === 'manualBackupChannelNumber') {
return sortedRadios.map(i => radioDetails.radioMap[i]?.manualBackupChannelNumber);
}
if (type === 'snrDrop') {
return sortedRadios.map(
i => radioDetails.advancedRadioMap[i]?.bestApSettings?.value?.dropInSnrPercentage
);
}
if (type === 'allowedChannels') {
return sortedRadios.map(i => radioDetails.radioMap[i]?.allowedChannelsPowerLevels);
}
if (type === 'minLoad') {
return sortedRadios.map(
i => radioDetails.advancedRadioMap[i]?.bestApSettings?.value?.minLoadFactor
);
}
if (type === 'cellSize') {
return sortedRadios.map(i => radioDetails.radioMap[i]?.rxCellSizeDb?.value);
}
if (type === 'probeResponseThreshold') {
return sortedRadios.map(i => radioDetails.radioMap[i]?.probeResponseThresholdDb?.value);
}
if (type === 'clientDisconnectThreshold') {
return sortedRadios.map(i => radioDetails.radioMap[i]?.clientDisconnectThresholdDb?.value);
}
return sortedRadios;
};
const formatRadioFrequencies = ({
manualChannelNumber,
manualBackupChannelNumber,
snrDrop,
minLoad,
cellSize,
probeResponseThreshold,
clientDisconnectThreshold,
radioMap = [],
}) => {
const frequencies = {};
radioMap.forEach((i, index) => {
frequencies[i] = {
channelNumber: manualChannelNumber[index],
backupChannelNumber: manualBackupChannelNumber[index],
dropInSnrPercentage: snrDrop[index],
minLoadFactor: minLoad[index],
rxCellSizeDb: {
auto: true,
value: cellSize[index],
},
probeResponseThresholdDb: {
auto: true,
value: probeResponseThreshold[index],
},
clientDisconnectThresholdDb: {
auto: true,
value: clientDisconnectThreshold[index],
},
};
});
return frequencies;
};
const BulkEditAPs = ({ locations, checkedLocations }) => {
const { id } = useParams();
const { customerId } = useContext(UserContext);
const locationIds = useMemo(() => {
const locationPath = getLocationPath(id, locations);
return locationPath.filter(f => checkedLocations.includes(f));
}, [id, locations, checkedLocations]);
const {
loading: filterEquipmentLoading,
error: filterEquipmentError,
refetch,
data: equipData,
fetchMore,
} = useQuery(FILTER_EQUIPMENT_BULK_EDIT_APS, {
variables: { customerId, locationIds, equipmentType: 'AP' },
const [
filterEquipment,
{
loading: filterEquipmentLoading,
error: filterEquipmentError,
refetch,
data: equipData,
fetchMore,
},
] = useLazyQuery(FILTER_EQUIPMENT_BULK_EDIT_APS, {
errorPolicy: 'all',
fetchPolicy: 'cache-first',
});
const fetchFilterEquipment = async () => {
filterEquipment({
variables: {
customerId,
locationIds,
equipmentType: 'AP',
},
});
};
const [updateEquipmentBulk] = useMutation(UPDATE_EQUIPMENT_BULK);
const getRadioDetails = (radioDetails, type) => {
if (type === 'cellSize') {
const cellSizeValues = [];
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 => {
return probeResponseThresholdValues.push(
radioDetails.radioMap[i].probeResponseThresholdDb.value
);
});
return probeResponseThresholdValues;
}
if (type === 'clientDisconnectThreshold') {
const clientDisconnectThresholdValues = [];
Object.keys(radioDetails.radioMap).map(i => {
return clientDisconnectThresholdValues.push(
radioDetails.radioMap[i].clientDisconnectThresholdDb.value
);
});
return clientDisconnectThresholdValues;
}
if (type === 'snrDrop') {
const snrDropValues = [];
Object.keys(radioDetails.advancedRadioMap).map(i => {
return snrDropValues.push(
radioDetails.advancedRadioMap[i].bestApSettings.dropInSnrPercentage
);
});
return snrDropValues;
}
const minLoadValue = [];
Object.keys(radioDetails.advancedRadioMap).map(i => {
return minLoadValue.push(radioDetails.advancedRadioMap[i].bestApSettings.minLoadFactor);
});
return minLoadValue;
};
const setAccessPointsBulkEditTableData = (dataSource = []) => {
const tableData = dataSource.items.map(({ id: key, name, channel, details }) => {
return {
const formattedTableData = useMemo(
() =>
equipData?.filterEquipment?.items?.map(({ id: key, name, details = {} }) => ({
key,
id: key,
name,
channel,
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'),
};
});
return tableData;
};
const setUpdatedBulkEditTableData = (
equipmentId,
channel,
cellSize,
probeResponseThreshold,
clientDisconnectThreshold,
snrDrop,
minLoad,
dataSource = []
) => {
const updatedItems = [];
let dropInSnrPercentage;
let minLoadFactor;
dataSource.items.forEach(({ id: itemId, details }) => {
if (equipmentId === itemId) {
Object.keys(details.radioMap).forEach((i, dataIndex) => {
const frequencies = {};
dropInSnrPercentage = snrDrop[dataIndex];
minLoadFactor = minLoad[dataIndex];
frequencies[`${i}`] = {
channelNumber: channel[dataIndex],
rxCellSizeDb: {
auto: true,
value: cellSize[dataIndex],
},
probeResponseThresholdDb: {
auto: true,
value: probeResponseThreshold[dataIndex],
},
clientDisconnectThresholdDb: {
auto: true,
value: clientDisconnectThreshold[dataIndex],
},
dropInSnrPercentage,
minLoadFactor,
};
updatedItems.push(frequencies);
});
}
});
return updatedItems;
};
radioMap: getRadioDetails(details, 'radioMap'),
allowedChannels: getRadioDetails(details, 'allowedChannels'),
})),
[equipData?.filterEquipment?.items]
);
const updateEquipments = editedRowsArr => {
updateEquipmentBulk({
@@ -286,42 +246,13 @@ 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);
}
);
updateEquipments(editedRowsArr);
}
Object.keys(updatedRows).forEach(key => {
return editedRowsArr.push({
equipmentId: updatedRows[key].id,
perRadioDetails: formatRadioFrequencies(updatedRows[key]),
});
});
updateEquipments(editedRowsArr);
};
const handleLoadMore = () => {
@@ -343,33 +274,30 @@ const BulkEditAPs = ({ locations, checkedLocations }) => {
}
};
if (filterEquipmentLoading) {
return <Loading />;
}
useEffect(() => {
fetchFilterEquipment();
}, [locationIds]);
if (filterEquipmentError) {
return (
<Alert message="Error" description="Failed to load equipments data." type="error" showIcon />
<Alert
message="Error"
description="Failed to load equipment(s) data."
type="error"
showIcon
/>
);
}
return (
<BulkEditAccessPoints
tableColumns={accessPointsChannelTableColumns}
tableData={
equipData &&
equipData.filterEquipment &&
setAccessPointsBulkEditTableData(equipData && equipData.filterEquipment)
}
tableData={formattedTableData}
onLoadMore={handleLoadMore}
isLastPage={
equipData &&
equipData.filterEquipment &&
equipData.filterEquipment.context &&
equipData.filterEquipment.context.lastPage
}
isLastPage={equipData?.filterEquipment?.context?.lastPage}
onSaveChanges={handleSaveChanges}
breadcrumbPath={getBreadcrumbPath(id, locations)}
loading={filterEquipmentLoading}
/>
);
};

View File

@@ -1,5 +1,4 @@
.tabColumn {
display: flex;
flex-direction: column;
padding: 0 30px;
}

View File

@@ -5,6 +5,7 @@ import { notification } from 'antd';
import { NetworkTableContainer } from '@tip-wlan/wlan-cloud-ui-library';
import { ROUTES, USER_FRIENDLY_RADIOS } from 'constants/index';
import UserContext from 'contexts/UserContext';
import { FILTER_CLIENT_SESSIONS } from 'graphql/queries';
@@ -22,7 +23,11 @@ const clientDevicesTableColumns = [
{ title: 'HOST NAME', dataIndex: 'hostname' },
{ title: 'ACCESS POINT', dataIndex: ['equipment', 'name'] },
{ title: 'SSID', dataIndex: 'ssid' },
{ title: 'BAND', dataIndex: 'radioType' },
{
title: 'BAND',
dataIndex: 'radioType',
render: band => USER_FRIENDLY_RADIOS[band],
},
{ title: 'SIGNAL', dataIndex: 'signal' },
{
title: 'STATUS',
@@ -96,7 +101,7 @@ const ClientDevices = ({ checkedLocations }) => {
return (
<NetworkTableContainer
activeTab="/network/client-devices"
activeTab={ROUTES.clientDevices}
tableColumns={clientDevicesTableColumns}
tableData={data?.filterClientSessions?.items}
onLoadMore={handleLoadMore}

View File

@@ -4,10 +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, 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!) {
@@ -22,6 +23,16 @@ const GET_PROFILE = gql`
profileType
details
}
associatedSsidProfiles {
id
name
profileType
details
}
osuSsidProfile {
id
name
}
childProfileIds
createdTimestamp
lastModifiedTimestamp
@@ -74,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',
@@ -81,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',
}
);
@@ -94,14 +109,39 @@ 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',
}
);
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 [updateProfile] = useMutation(UPDATE_PROFILE);
const [deleteProfile] = useMutation(DELETE_PROFILE);
const [fileUpload] = useMutation(FILE_UPLOAD);
const handleDeleteProfile = () => {
deleteProfile({ variables: { id } })
.then(() => {
@@ -147,73 +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 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) {
@@ -227,7 +283,7 @@ const ProfileDetails = () => {
}
if (redirect) {
return <Redirect to="/profiles" />;
return <Redirect to={ROUTES.profiles} />;
}
return (
@@ -235,18 +291,22 @@ const ProfileDetails = () => {
name={data.getProfile.name}
profileType={data.getProfile.profileType}
details={data.getProfile.details}
childProfiles={data.getProfile.childProfiles}
childProfileIds={data.getProfile.childProfileIds}
onDeleteProfile={handleDeleteProfile}
onUpdateProfile={handleUpdateProfile}
ssidProfiles={
(ssidProfiles && ssidProfiles.getAllProfiles && ssidProfiles.getAllProfiles.items) || []
}
ssidProfiles={ssidProfiles?.getAllProfiles?.items}
rfProfiles={rfProfiles?.getAllProfiles?.items}
radiusProfiles={radiusProfiles?.getAllProfiles?.items}
captiveProfiles={captiveProfiles?.getAllProfiles?.items}
venueProfiles={venueProfiles?.getAllProfiles?.items}
operatorProfiles={operatorProfiles?.getAllProfiles?.items}
idProviderProfiles={idProviderProfiles?.getAllProfiles?.items}
associatedSsidProfiles={data.getProfile?.associatedSsidProfiles}
osuSsidProfile={data.getProfile?.osuSsidProfile}
fileUpload={handleFileUpload}
onFetchMoreProfiles={handleFetchProfiles}
onFetchMoreRadiusProfiles={handleFetchRadiusProfiles}
onFetchMoreCaptiveProfiles={handleFetchCaptiveProfiles}
onFetchMoreProfiles={handleFetchMoreProfiles}
onDownloadFile={handleDownloadFile}
/>
);
};

View File

@@ -1,4 +1,4 @@
import React, { useContext } from 'react';
import React, { useContext, useMemo } from 'react';
import { useQuery, useMutation } from '@apollo/client';
import { Alert, notification } from 'antd';
import { AutoProvision as AutoProvisionPage, Loading } from '@tip-wlan/wlan-cloud-ui-library';
@@ -6,6 +6,8 @@ import { AutoProvision as AutoProvisionPage, Loading } from '@tip-wlan/wlan-clou
import UserContext from 'contexts/UserContext';
import { GET_CUSTOMER, GET_ALL_LOCATIONS, GET_ALL_PROFILES } from 'graphql/queries';
import { UPDATE_CUSTOMER } from 'graphql/mutations';
import { fetchMoreProfiles } from 'graphql/functions';
import { formatLocations } from 'utils/locations';
const AutoProvision = () => {
const { customerId } = useContext(UserContext);
@@ -14,13 +16,13 @@ const AutoProvision = () => {
});
const [updateCustomer] = useMutation(UPDATE_CUSTOMER);
const { data: dataLocation, loading: loadingLoaction, error: errorLocation } = useQuery(
const { data: dataLocation, loading: loadingLocation, error: errorLocation } = useQuery(
GET_ALL_LOCATIONS,
{
variables: { customerId },
}
);
const { data: dataProfile, loading: loadingProfile, error: errorProfile } = useQuery(
const { data: dataProfile, loading: loadingProfile, error: errorProfile, fetchMore } = useQuery(
GET_ALL_PROFILES(),
{
variables: { customerId, type: 'equipment_ap', limit: 100 },
@@ -60,6 +62,14 @@ const AutoProvision = () => {
);
};
const handleFetchMoreProfiles = e => {
fetchMoreProfiles(e, dataProfile, fetchMore);
};
const locationsTree = useMemo(() => {
return formatLocations(dataLocation?.getAllLocations, true);
}, [dataLocation?.getAllLocations]);
if (loading) {
return <Loading />;
}
@@ -72,14 +82,15 @@ const AutoProvision = () => {
return (
<AutoProvisionPage
data={data && data.getCustomer}
dataLocation={dataLocation && dataLocation.getAllLocations}
dataProfile={dataProfile && dataProfile.getAllProfiles.items}
loadingLoaction={loadingLoaction}
data={data?.getCustomer}
locationsTree={locationsTree}
dataProfile={dataProfile?.getAllProfiles?.items}
loadingLocation={loadingLocation}
loadingProfile={loadingProfile}
errorLocation={errorLocation}
errorProfile={errorProfile}
onUpdateCustomer={handleUpdateCustomer}
onFetchMoreProfiles={handleFetchMoreProfiles}
/>
);
};

View File

@@ -22,7 +22,7 @@ const Firmware = () => {
const [
getAllFirmware,
{ data: firmwareVersionData, loading: firmwareVersionLoading },
] = useLazyQuery(GET_ALL_FIRMWARE);
] = useLazyQuery(GET_ALL_FIRMWARE, { fetchPolicy: 'network-only' });
const {
data: trackAssignmentData,

View File

@@ -1,11 +1,12 @@
import React from 'react';
import PropTypes from 'prop-types';
import { RolesProvider } from '@tip-wlan/wlan-cloud-ui-library';
import UserContext from 'contexts/UserContext';
const UserProvider = ({ children, id, email, role, customerId, updateUser, updateToken }) => (
<UserContext.Provider value={{ id, email, role, customerId, updateUser, updateToken }}>
{children}
const UserProvider = ({ children, id, email, roles, customerId, updateUser, updateToken }) => (
<UserContext.Provider value={{ id, email, roles, customerId, updateUser, updateToken }}>
<RolesProvider role={roles}>{children}</RolesProvider>
</UserContext.Provider>
);
@@ -15,14 +16,14 @@ UserProvider.propTypes = {
updateToken: PropTypes.func.isRequired,
id: PropTypes.number,
email: PropTypes.string,
role: PropTypes.string,
roles: PropTypes.instanceOf(Array),
customerId: PropTypes.number,
};
UserProvider.defaultProps = {
id: null,
email: null,
role: null,
roles: [],
customerId: null,
};

View File

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

View File

@@ -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!

View File

@@ -42,12 +42,12 @@ export const FILTER_EQUIPMENT = gql`
profile {
name
}
baseMacAddress
manufacturer
status {
protocol {
details {
reportedIpV4Addr
reportedMacAddr
manufacturer
}
}
osPerformance {
@@ -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]

View File

@@ -14,6 +14,7 @@ import { AUTH_TOKEN } from 'constants/index';
import { REFRESH_TOKEN } from 'graphql/mutations';
import { getItem, setItem, removeItem } from 'utils/localStorage';
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 MOUNT_NODE = document.getElementById('root');
@@ -102,6 +103,7 @@ const render = () => {
ReactDOM.render(
<Router history={history}>
<ApolloProvider client={client}>
<ScrollToTop />
<App />
</ApolloProvider>
</Router>,

View File

@@ -1,3 +1,14 @@
body {
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;
}

View File

@@ -1,4 +1,4 @@
$sidebar-width: 234px;
$sidebar-collapsed-width: 80px;
$header-height: 64px;
$header-height: 64px;

110
app/utils/locations.js Normal file
View File

@@ -0,0 +1,110 @@
import { filter, isEmpty, each } from 'lodash';
export const NETWORK_NODE = {
title: 'Network',
id: '0',
key: '0',
value: '0',
name: 'Network',
};
export const formatLocations = (list = [], disableRoot = false) => {
function unflatten(array, p) {
let tree = [];
const parent = typeof p !== 'undefined' ? p : { id: '0' };
let children = filter(array, child => child.parentId === parent.id);
children = children.map(c => ({
title: c.name,
value: `${c.id}`,
key: c.id,
isLeaf: false,
...c,
}));
if (!isEmpty(children)) {
if (parent.id === '0') {
tree = children;
} else {
parent.children = children;
}
each(children, child => unflatten(array, child));
}
return tree;
}
return [
{
...NETWORK_NODE,
...(disableRoot && { disabled: true }),
children: unflatten(list),
},
];
};
export const getBreadcrumbPath = (id, locations) => {
const locationsPath = [];
const treeRecurse = (parentNodeId, node) => {
if (node.id === parentNodeId) {
locationsPath.unshift(node);
return node;
}
if (node.children) {
let parent;
node.children.some(i => {
parent = treeRecurse(parentNodeId, i);
return parent;
});
if (parent) {
locationsPath.unshift(node);
}
return parent;
}
return null;
};
treeRecurse(id, {
id: 0,
children: locations,
});
return locationsPath;
};
export const getLocationPath = (selectedId, locations) => {
const locationsPath = [];
const treeRecurse = (parentNodeId, node) => {
if (node.id === parentNodeId) {
locationsPath.unshift(node.id);
if (node.children) {
const flatten = children => {
children.forEach(i => {
locationsPath.unshift(i.id);
if (i.children) {
flatten(i.children);
}
});
};
flatten(node.children);
}
return node;
}
if (node.children) {
let parent;
node.children.some(i => {
parent = treeRecurse(parentNodeId, i);
return parent;
});
return parent;
}
return null;
};
if (selectedId) {
treeRecurse(selectedId, { id: 0, children: locations });
}
return locationsPath;
};

10903
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "wlan-cloud-ui",
"version": "0.5.3",
"version": "1.2.0",
"author": "ConnectUs",
"description": "React Portal",
"engines": {
@@ -9,45 +9,38 @@
},
"scripts": {
"test": "jest --passWithNoTests --coverage",
"start": "cross-env NODE_ENV=development webpack-dev-server",
"start:bare": "cross-env API=https://wlan-graphql.zone3.lab.connectus.ai NODE_ENV=bare webpack-dev-server",
"start:dev": "cross-env API=https://wlan-graphql.zone3.lab.connectus.ai NODE_ENV=development webpack-dev-server",
"start": "cross-env NODE_ENV=development webpack serve --mode development",
"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://wlan-ui.tip-sdk.lab.netexperience.com NODE_ENV=development webpack serve --mode development",
"build": "webpack --mode=production",
"format": "prettier --write \"app/**/*.js\"",
"eslint-fix": "eslint --fix \"app/**/*.js\"",
"eslint": "eslint \"app/**/*.js\" --max-warnings=0"
"format": "prettier --write 'app/**/*{.js,.scss}'",
"eslint-fix": "eslint --fix 'app/**/*.js'",
"eslint": "eslint 'app/**/*.js' --max-warnings=0"
},
"license": "MIT",
"dependencies": {
"@ant-design/icons": "^4.2.1",
"@apollo/client": "^3.1.3",
"@tip-wlan/wlan-cloud-ui-library": "^0.3.16",
"@tip-wlan/wlan-cloud-ui-library": "^1.2.2",
"antd": "^4.5.2",
"apollo-upload-client": "^13.0.0",
"clean-webpack-plugin": "^3.0.0",
"graphql": "^14.6.0",
"highcharts": "^8.1.0",
"highcharts-react-official": "^3.0.0",
"graphql": "^15.5.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"
"recharts": "^2.0.9"
},
"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 +48,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,38 +63,38 @@
"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",
"pretty-quick": "^2.0.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"
},
"precommit": "NODE_ENV=production lint-staged",
"browserslist": [
"last 2 versions",
"> 1%",
"IE 10"
],
"lint-staged": {
"*.{js,jsx}": [
"pretty-quick --staged",
"eslint . --fix \"app/**/*.js\" --max-warnings=0",
"git add"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{js,jsx}": [
"eslint --fix 'app/**/*.js' --max-warnings=0",
"prettier --write"
]
}
}

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

View File

@@ -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'),
}),

View File

@@ -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',
}),
],
};

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 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',
};