mirror of
https://github.com/Telecominfraproject/wlan-cloud-graphql-gw.git
synced 2026-03-22 12:39:22 +00:00
Compare commits
37 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2dc9ae048a | ||
|
|
e5ea6dd230 | ||
|
|
8da48f870c | ||
|
|
0c83c42a5b | ||
|
|
23b7605821 | ||
|
|
f3e433abe4 | ||
|
|
18e8efb2a0 | ||
|
|
334fae144e | ||
|
|
9cfefd2c9a | ||
|
|
b663641d04 | ||
|
|
689046f41d | ||
|
|
27d33b100e | ||
|
|
d3667a26d1 | ||
|
|
b3f8f6bb56 | ||
|
|
5213719292 | ||
|
|
dd7c24d0dc | ||
|
|
2426a4e7e2 | ||
|
|
6fdb196aed | ||
|
|
6f5ab5c2f6 | ||
|
|
4be5b3e42d | ||
|
|
6a2c2900ce | ||
|
|
a6cc03f496 | ||
|
|
0a6523a48e | ||
|
|
2850f3b3c4 | ||
|
|
d9d4f474f7 | ||
|
|
e3b647ac22 | ||
|
|
fd8212efe9 | ||
|
|
f1dcd0e952 | ||
|
|
8c3afd4527 | ||
|
|
1737221692 | ||
|
|
f54ca7a535 | ||
|
|
dbeb75a702 | ||
|
|
82df3e7f4a | ||
|
|
6cead31c0c | ||
|
|
6d4d212d8b | ||
|
|
e6cde6f6d4 | ||
|
|
6f75486bfc |
42
.github/workflows/dockerpublish.yml
vendored
42
.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:
|
||||
@@ -13,6 +14,10 @@ on:
|
||||
# Run tests for any PRs.
|
||||
pull_request:
|
||||
|
||||
schedule:
|
||||
# runs nightly build at 5AM
|
||||
- cron: '00 09 * * *'
|
||||
|
||||
env:
|
||||
IMAGE_NAME: wlan-cloud-graphql-gw
|
||||
DOCKER_REPO: tip-tip-wlan-cloud-docker-repo.jfrog.io
|
||||
@@ -39,26 +44,46 @@ jobs:
|
||||
needs: test
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'push'
|
||||
if: github.event_name == 'push' || github.event_name == 'schedule'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ssh-key: ${{ secrets.GH_AUTOMATION_KEY }}
|
||||
|
||||
- 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,')
|
||||
|
||||
# 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=1.2.0-SNAPSHOT
|
||||
|
||||
TIMESTAMP=$(date +'%Y-%m-%d')
|
||||
echo date=$TIMESTAMP > commit.properties
|
||||
echo commitId=$GITHUB_SHA >> commit.properties
|
||||
echo projectVersion=$VERSION>> commit.properties
|
||||
|
||||
- name: Build image
|
||||
run: docker build . --file Dockerfile --tag image
|
||||
|
||||
|
||||
- name: Login to Docker Hub
|
||||
env:
|
||||
DOCKER_PASSWORD: ${{ secrets.REPO_PASSWORD }}
|
||||
run: |
|
||||
echo "${DOCKER_PASSWORD}" | docker login $DOCKER_REPO --username "build-pipeline" --password-stdin
|
||||
echo "${DOCKER_PASSWORD}" | docker login $DOCKER_REPO --username "build-pipeline" --password-stdin
|
||||
|
||||
- name: Push image
|
||||
run: |
|
||||
IMAGE_ID=$DOCKER_REPO/$IMAGE_NAME
|
||||
|
||||
TIMESTAMP=$(date +'%Y-%m-%d')
|
||||
|
||||
# Change all uppercase to lowercase
|
||||
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
|
||||
|
||||
@@ -68,11 +93,18 @@ 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.2.0-SNAPSHOT
|
||||
|
||||
echo IMAGE_ID=$IMAGE_ID
|
||||
echo VERSION=$VERSION
|
||||
echo TIMESTAMP=$TIMESTAMP
|
||||
|
||||
docker tag image $IMAGE_ID:$VERSION
|
||||
docker push $IMAGE_ID:$VERSION
|
||||
|
||||
docker tag image $IMAGE_ID:$VERSION-$TIMESTAMP
|
||||
docker push $IMAGE_ID:$VERSION-$TIMESTAMP
|
||||
|
||||
14
package-lock.json
generated
14
package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "wlan-cloud-graphql-apollo",
|
||||
"version": "0.3.0",
|
||||
"version": "1.0.1",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@@ -2181,9 +2181,9 @@
|
||||
}
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.19",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz",
|
||||
"integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==",
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
|
||||
"dev": true
|
||||
},
|
||||
"lodash.sortby": {
|
||||
@@ -2321,9 +2321,9 @@
|
||||
"integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA=="
|
||||
},
|
||||
"object-path": {
|
||||
"version": "0.11.4",
|
||||
"resolved": "https://registry.npmjs.org/object-path/-/object-path-0.11.4.tgz",
|
||||
"integrity": "sha1-NwrnUvvzfePqcKhhwju6iRVpGUk="
|
||||
"version": "0.11.5",
|
||||
"resolved": "https://registry.npmjs.org/object-path/-/object-path-0.11.5.tgz",
|
||||
"integrity": "sha512-jgSbThcoR/s+XumvGMTMf81QVBmah+/Q7K7YduKeKVWL7N111unR2d6pZZarSk6kY/caeNxUDyxOvMWyzoU2eg=="
|
||||
},
|
||||
"object.assign": {
|
||||
"version": "4.1.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "wlan-cloud-graphql-apollo",
|
||||
"version": "0.3.1",
|
||||
"version": "1.0.1",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
|
||||
@@ -204,9 +204,36 @@ export class API extends RESTDataSource {
|
||||
}
|
||||
|
||||
async createProfile(profile) {
|
||||
return this.post('portal/profile', {
|
||||
const newProfile = await this.post('portal/profile', {
|
||||
...profile,
|
||||
});
|
||||
|
||||
if (profile.profileType === 'passpoint') {
|
||||
const {
|
||||
id,
|
||||
details: { associatedAccessSsidProfileIds, osuSsidProfileId },
|
||||
} = newProfile;
|
||||
this.get('portal/profile', {
|
||||
profileId: osuSsidProfileId,
|
||||
}).then((profile) => {
|
||||
this.put('portal/profile', {
|
||||
...profile,
|
||||
childProfileIds: [...profile.childProfileIds, id],
|
||||
});
|
||||
});
|
||||
associatedAccessSsidProfileIds.forEach((profileId) => {
|
||||
this.get('portal/profile', {
|
||||
profileId,
|
||||
}).then((profile) => {
|
||||
this.put('portal/profile', {
|
||||
...profile,
|
||||
childProfileIds: [...profile.childProfileIds, id],
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return newProfile;
|
||||
}
|
||||
async getProfile(profileId) {
|
||||
return this.get('portal/profile', {
|
||||
@@ -214,6 +241,35 @@ export class API extends RESTDataSource {
|
||||
});
|
||||
}
|
||||
async updateProfile(profile) {
|
||||
if (profile.profileType === 'passpoint') {
|
||||
const {
|
||||
id,
|
||||
details: { associatedAccessSsidProfileIds, osuSsidProfileId },
|
||||
} = profile;
|
||||
this.get('portal/profile', {
|
||||
profileId: osuSsidProfileId,
|
||||
}).then((profile) => {
|
||||
if (!profile.childProfileIds.includes(parseInt(id, 10))) {
|
||||
this.put('portal/profile', {
|
||||
...profile,
|
||||
childProfileIds: [...profile.childProfileIds, id],
|
||||
});
|
||||
}
|
||||
});
|
||||
associatedAccessSsidProfileIds.forEach((profileId) => {
|
||||
this.get('portal/profile', {
|
||||
profileId,
|
||||
}).then((profile) => {
|
||||
if (!profile.childProfileIds.includes(parseInt(id, 10))) {
|
||||
this.put('portal/profile', {
|
||||
...profile,
|
||||
childProfileIds: [...profile.childProfileIds, id],
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return this.put('portal/profile', {
|
||||
...profile,
|
||||
});
|
||||
@@ -224,17 +280,11 @@ export class API extends RESTDataSource {
|
||||
});
|
||||
}
|
||||
async getAllProfiles({ customerId, cursor, limit, type, context }) {
|
||||
const result = await this.get('portal/profile/forCustomer', {
|
||||
return this.get('portal/profile/forCustomer', {
|
||||
customerId,
|
||||
...(type && { profileType: type }),
|
||||
paginationContext: buildPaginationContext(cursor, limit, context),
|
||||
});
|
||||
|
||||
if (type && result.items) {
|
||||
result.items = result.items.filter((i) => i.profileType === type);
|
||||
return result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
async getProfilesById(profileIdSet) {
|
||||
return this.get('portal/profile/inSet', {
|
||||
|
||||
@@ -168,19 +168,19 @@ const resolvers = {
|
||||
return dataSources.api.updateToken(refreshToken);
|
||||
},
|
||||
|
||||
createUser: async (_, { username, password, role, customerId }, { dataSources }) => {
|
||||
return dataSources.api.createUser({ username, password, role, customerId });
|
||||
createUser: async (_, { username, password, roles, customerId }, { dataSources }) => {
|
||||
return dataSources.api.createUser({ username, password, roles, customerId });
|
||||
},
|
||||
updateUser: async (
|
||||
_,
|
||||
{ id, username, password, role, customerId, lastModifiedTimestamp },
|
||||
{ id, username, password, roles, customerId, lastModifiedTimestamp },
|
||||
{ dataSources }
|
||||
) => {
|
||||
return dataSources.api.updateUser({
|
||||
id,
|
||||
username,
|
||||
password,
|
||||
role,
|
||||
roles,
|
||||
customerId,
|
||||
lastModifiedTimestamp,
|
||||
});
|
||||
@@ -238,6 +238,7 @@ const resolvers = {
|
||||
profileId,
|
||||
locationId,
|
||||
name,
|
||||
baseMacAddress,
|
||||
latitude,
|
||||
longitude,
|
||||
serial,
|
||||
@@ -254,6 +255,7 @@ const resolvers = {
|
||||
profileId,
|
||||
locationId,
|
||||
name,
|
||||
baseMacAddress: { addressAsString: baseMacAddress },
|
||||
latitude,
|
||||
longitude,
|
||||
serial,
|
||||
@@ -378,6 +380,31 @@ const resolvers = {
|
||||
},
|
||||
},
|
||||
Equipment: {
|
||||
baseMacAddress: ({ baseMacAddress }) => baseMacAddress && baseMacAddress.addressAsString,
|
||||
manufacturer: async ({ customerId, id, baseMacAddress }, args, { dataSources }) => {
|
||||
const manufacturerData = await dataSources.api.getEquipmentStatus(
|
||||
customerId,
|
||||
[id],
|
||||
['EQUIPMENT_MANUFACTURER_DATA']
|
||||
);
|
||||
|
||||
if (
|
||||
manufacturerData &&
|
||||
manufacturerData[0] &&
|
||||
manufacturerData[0].details &&
|
||||
manufacturerData[0].details.manufacturerName
|
||||
) {
|
||||
return manufacturerData[0].details.manufacturerName;
|
||||
}
|
||||
|
||||
return (
|
||||
baseMacAddress &&
|
||||
baseMacAddress.addressAsString &&
|
||||
dataSources.api.getOuiLookup(
|
||||
baseMacAddress.addressAsString.replace(/[:-]/g, '').substring(0, 6)
|
||||
)
|
||||
);
|
||||
},
|
||||
profile: ({ profileId }, args, { dataSources }) => {
|
||||
return dataSources.api.getProfile(profileId);
|
||||
},
|
||||
@@ -385,7 +412,14 @@ const resolvers = {
|
||||
return dataSources.api.getEquipmentStatus(
|
||||
customerId,
|
||||
[id],
|
||||
['PROTOCOL', 'OS_PERFORMANCE', 'RADIO_UTILIZATION', 'CLIENT_DETAILS', 'FIRMWARE']
|
||||
[
|
||||
'PROTOCOL',
|
||||
'OS_PERFORMANCE',
|
||||
'RADIO_UTILIZATION',
|
||||
'CLIENT_DETAILS',
|
||||
'FIRMWARE',
|
||||
'RADIO_CHANNEL',
|
||||
]
|
||||
);
|
||||
},
|
||||
channel: ({ details }) => {
|
||||
@@ -422,6 +456,7 @@ const resolvers = {
|
||||
clientDetails: (items) => items.find((i) => i.statusDataType === 'CLIENT_DETAILS') || {},
|
||||
firmware: (items) => items.find((i) => i.statusDataType === 'FIRMWARE') || {},
|
||||
dashboard: (items) => items.find((i) => i.statusDataType === 'CUSTOMER_DASHBOARD') || {},
|
||||
channel: (items) => items.find((i) => i.statusDataType === 'RADIO_CHANNEL') || {},
|
||||
},
|
||||
Status: {
|
||||
detailsJSON: ({ details }) => details || {},
|
||||
@@ -450,7 +485,7 @@ const resolvers = {
|
||||
reportedMacAddr &&
|
||||
reportedMacAddr.addressAsString &&
|
||||
dataSources.api.getOuiLookup(
|
||||
reportedMacAddr.addressAsString.replace(/:/g, '').substring(0, 6)
|
||||
reportedMacAddr.addressAsString.replace(/[:-]/g, '').substring(0, 6)
|
||||
)
|
||||
);
|
||||
},
|
||||
@@ -501,6 +536,18 @@ const resolvers = {
|
||||
|
||||
return result && result.value2;
|
||||
},
|
||||
associatedSsidProfiles: ({ details }, args, { dataSources }) => {
|
||||
return (
|
||||
details &&
|
||||
details.associatedAccessSsidProfileIds &&
|
||||
dataSources.api.getProfilesById(details.associatedAccessSsidProfileIds)
|
||||
);
|
||||
},
|
||||
osuSsidProfile: ({ details }, args, { dataSources }) => {
|
||||
return (
|
||||
details && details.osuSsidProfileId && dataSources.api.getProfile(details.osuSsidProfileId)
|
||||
);
|
||||
},
|
||||
},
|
||||
ClientSession: {
|
||||
id: ({ macAddress }) => macAddress.addressAsString,
|
||||
@@ -514,7 +561,9 @@ const resolvers = {
|
||||
return (
|
||||
macAddress &&
|
||||
macAddress.addressAsString &&
|
||||
dataSources.api.getOuiLookup(macAddress.addressAsString.replace(/:/g, '').substring(0, 6))
|
||||
dataSources.api.getOuiLookup(
|
||||
macAddress.addressAsString.replace(/[:-]/g, '').substring(0, 6)
|
||||
)
|
||||
);
|
||||
},
|
||||
equipment: ({ equipmentId }, args, { dataSources }) => {
|
||||
|
||||
@@ -116,7 +116,7 @@ const typeDefs = gql`
|
||||
id: ID!
|
||||
username: String!
|
||||
password: String
|
||||
role: String!
|
||||
roles: [String]
|
||||
customerId: ID!
|
||||
lastModifiedTimestamp: String
|
||||
}
|
||||
@@ -159,6 +159,8 @@ const typeDefs = gql`
|
||||
profileId: ID!
|
||||
locationId: ID!
|
||||
name: String!
|
||||
baseMacAddress: String
|
||||
manufacturer: String
|
||||
latitude: String
|
||||
longitude: String
|
||||
serial: String
|
||||
@@ -189,6 +191,7 @@ const typeDefs = gql`
|
||||
clientDetails: Status
|
||||
firmware: Status
|
||||
dashboard: Status
|
||||
channel: Status
|
||||
}
|
||||
|
||||
type Status {
|
||||
@@ -228,6 +231,8 @@ const typeDefs = gql`
|
||||
lastModifiedTimestamp: String
|
||||
equipmentCount: Int
|
||||
details: JSONObject
|
||||
associatedSsidProfiles: [Profile]
|
||||
osuSsidProfile: Profile
|
||||
}
|
||||
|
||||
type ProfilePagination {
|
||||
@@ -350,12 +355,12 @@ const typeDefs = gql`
|
||||
authenticateUser(email: String!, password: String!): Token
|
||||
updateToken(refreshToken: String!): Token
|
||||
|
||||
createUser(username: String!, password: String!, role: String!, customerId: ID!): User
|
||||
createUser(username: String!, password: String!, roles: [String], customerId: ID!): User
|
||||
updateUser(
|
||||
id: ID!
|
||||
username: String!
|
||||
password: String!
|
||||
role: String!
|
||||
roles: [String]
|
||||
customerId: ID!
|
||||
lastModifiedTimestamp: String
|
||||
): User
|
||||
@@ -397,6 +402,7 @@ const typeDefs = gql`
|
||||
profileId: ID!
|
||||
locationId: ID!
|
||||
name: String!
|
||||
baseMacAddress: String
|
||||
latitude: String
|
||||
longitude: String
|
||||
serial: String
|
||||
|
||||
Reference in New Issue
Block a user