Merge pull request #110 from Telecominfraproject/hotfix/PasspointProfileFixes

hotfix/PasspointProfileFixes: Added Passpoint profile to Add/Update profile
This commit is contained in:
Sean Macfarlane
2021-08-23 22:36:27 -04:00
committed by GitHub
2 changed files with 29 additions and 8 deletions

View File

@@ -79,6 +79,15 @@ const AddProfile = () => {
variables: { customerId, type: 'rf' },
fetchPolicy: 'network-only',
});
const { data: passpointProfiles, fetchMore: fetchMorePasspointProfiles } = useQuery(
GET_ALL_PROFILES(),
{
variables: { customerId, type: 'passpoint' },
fetchPolicy: 'network-only',
}
);
const [createProfile] = useMutation(CREATE_PROFILE);
const history = useHistory();
@@ -117,6 +126,8 @@ const AddProfile = () => {
fetchMoreProfiles(e, operatorProfiles, fetchMoreOperatorProfiles);
else if (key === 'passpoint_osu_id_provider')
fetchMoreProfiles(e, idProviderProfiles, fetchMoreIdProviderProfiles);
else if (key === 'passpoint')
fetchMoreProfiles(e, passpointProfiles, fetchMorePasspointProfiles);
else fetchMoreProfiles(e, ssidProfiles, fetchMore);
};
@@ -170,6 +181,7 @@ const AddProfile = () => {
operatorProfiles={operatorProfiles?.getAllProfiles?.items}
idProviderProfiles={idProviderProfiles?.getAllProfiles?.items}
rfProfiles={rfProfiles?.getAllProfiles?.items}
passpointProfiles={passpointProfiles?.getAllProfiles?.items}
onFetchMoreProfiles={handleFetchMoreProfiles}
fileUpload={handleFileUpload}
/>

View File

@@ -1,7 +1,7 @@
import React, { useState, useContext } from 'react';
import { useParams, Redirect } from 'react-router-dom';
import { useQuery, useMutation, gql } from '@apollo/client';
import { Alert, notification } from 'antd';
import { notification } from 'antd';
import { ProfileDetails as ProfileDetailsPage, Loading } from '@tip-wlan/wlan-cloud-ui-library';
import { ROUTES, AUTH_TOKEN } from 'constants/index';
@@ -32,6 +32,8 @@ const GET_PROFILE = gql`
osuSsidProfile {
id
name
profileType
details
}
childProfileIds
createdTimestamp
@@ -87,9 +89,10 @@ const ProfileDetails = () => {
const { data: apiUrl } = useQuery(GET_API_URL);
const { loading, error, data } = useQuery(GET_PROFILE, {
const { loading, data } = useQuery(GET_PROFILE, {
variables: { id },
fetchPolicy: 'network-only',
errorPolicy: 'all',
});
const { data: ssidProfiles, fetchMore } = useQuery(GET_ALL_PROFILES(), {
@@ -139,6 +142,14 @@ const ProfileDetails = () => {
fetchPolicy: 'network-only',
});
const { data: passpointProfiles, fetchMore: fetchMorePasspointProfiles } = useQuery(
GET_ALL_PROFILES(),
{
variables: { customerId, type: 'passpoint' },
fetchPolicy: 'network-only',
}
);
const [updateProfile] = useMutation(UPDATE_PROFILE);
const [deleteProfile] = useMutation(DELETE_PROFILE);
@@ -269,6 +280,8 @@ const ProfileDetails = () => {
fetchMoreProfiles(e, operatorProfiles, fetchMoreOperatorProfiles);
else if (key === 'passpoint_osu_id_provider')
fetchMoreProfiles(e, idProviderProfiles, fetchMoreIdProviderProfiles);
else if (key === 'passpoint')
fetchMoreProfiles(e, passpointProfiles, fetchMorePasspointProfiles);
else fetchMoreProfiles(e, ssidProfiles, fetchMore);
};
@@ -276,12 +289,6 @@ const ProfileDetails = () => {
return <Loading />;
}
if (error) {
return (
<Alert message="Error" description="Failed to load profile data." type="error" showIcon />
);
}
if (redirect) {
return <Redirect to={ROUTES.profiles} />;
}
@@ -289,6 +296,7 @@ const ProfileDetails = () => {
return (
<ProfileDetailsPage
name={data.getProfile.name}
profileId={data?.getProfile?.id}
profileType={data.getProfile.profileType}
details={data.getProfile.details}
childProfiles={data.getProfile.childProfiles}
@@ -304,6 +312,7 @@ const ProfileDetails = () => {
idProviderProfiles={idProviderProfiles?.getAllProfiles?.items}
associatedSsidProfiles={data.getProfile?.associatedSsidProfiles}
osuSsidProfile={data.getProfile?.osuSsidProfile}
passpointProfiles={passpointProfiles?.getAllProfiles?.items}
fileUpload={handleFileUpload}
onFetchMoreProfiles={handleFetchMoreProfiles}
onDownloadFile={handleDownloadFile}