mirror of
https://github.com/Telecominfraproject/wlan-cloud-ui.git
synced 2025-11-01 11:17:59 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0017541d82 | ||
|
|
516fb50817 | ||
|
|
4449465edc | ||
|
|
57f91633c2 | ||
|
|
aa559971d8 |
4
.github/workflows/dockerpublish.yml
vendored
4
.github/workflows/dockerpublish.yml
vendored
@@ -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
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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
8
package-lock.json
generated
@@ -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",
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
Reference in New Issue
Block a user