5 Commits

Author SHA1 Message Date
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
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
6 changed files with 59 additions and 13 deletions

View File

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

View File

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

View File

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

View File

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

8
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{ {
"name": "wlan-cloud-ui", "name": "wlan-cloud-ui",
"version": "1.1.8", "version": "1.1.9",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@@ -2223,9 +2223,9 @@
} }
}, },
"@tip-wlan/wlan-cloud-ui-library": { "@tip-wlan/wlan-cloud-ui-library": {
"version": "1.1.13", "version": "1.1.14",
"resolved": "https://tip.jfrog.io/artifactory/api/npm/tip-wlan-cloud-npm-repo/@tip-wlan/wlan-cloud-ui-library/-/@tip-wlan/wlan-cloud-ui-library-1.1.13.tgz", "resolved": "https://tip.jfrog.io/artifactory/api/npm/tip-wlan-cloud-npm-repo/@tip-wlan/wlan-cloud-ui-library/-/@tip-wlan/wlan-cloud-ui-library-1.1.14.tgz",
"integrity": "sha1-vAxSv7SrTSO2PWIdITaEw7y6ONk=" "integrity": "sha1-BRTU+IQ03oDQWJM5xGo+D+S49Kc="
}, },
"@types/anymatch": { "@types/anymatch": {
"version": "1.3.1", "version": "1.3.1",

View File

@@ -1,6 +1,6 @@
{ {
"name": "wlan-cloud-ui", "name": "wlan-cloud-ui",
"version": "1.1.8", "version": "1.1.9",
"author": "ConnectUs", "author": "ConnectUs",
"description": "React Portal", "description": "React Portal",
"engines": { "engines": {
@@ -21,7 +21,7 @@
"dependencies": { "dependencies": {
"@ant-design/icons": "^4.2.1", "@ant-design/icons": "^4.2.1",
"@apollo/client": "^3.1.3", "@apollo/client": "^3.1.3",
"@tip-wlan/wlan-cloud-ui-library": "^1.1.13", "@tip-wlan/wlan-cloud-ui-library": "^1.1.14",
"antd": "^4.5.2", "antd": "^4.5.2",
"apollo-upload-client": "^13.0.0", "apollo-upload-client": "^13.0.0",
"graphql": "^15.5.0", "graphql": "^15.5.0",