mirror of
https://github.com/Telecominfraproject/wlan-cloud-ui.git
synced 2025-11-02 19:57:58 +00:00
finished ap profiles
This commit is contained in:
@@ -1,9 +1,11 @@
|
|||||||
import React, { useContext } from 'react';
|
import React, { useContext } from 'react';
|
||||||
import { AddProfile as AddProfilePage } from '@tip-wlan/wlan-cloud-ui-library';
|
import { AddProfile as AddProfilePage } from '@tip-wlan/wlan-cloud-ui-library';
|
||||||
import gql from 'graphql-tag';
|
import gql from 'graphql-tag';
|
||||||
import { useMutation } from '@apollo/react-hooks';
|
import { useMutation, useQuery } from '@apollo/react-hooks';
|
||||||
import { notification } from 'antd';
|
import { notification } from 'antd';
|
||||||
|
|
||||||
import UserContext from 'contexts/UserContext';
|
import UserContext from 'contexts/UserContext';
|
||||||
|
import { GET_ALL_PROFILES } from 'graphql/queries';
|
||||||
|
|
||||||
const CREATE_PROFILE = gql`
|
const CREATE_PROFILE = gql`
|
||||||
mutation CreateProfile(
|
mutation CreateProfile(
|
||||||
@@ -31,6 +33,9 @@ const CREATE_PROFILE = gql`
|
|||||||
|
|
||||||
const AddProfile = () => {
|
const AddProfile = () => {
|
||||||
const { customerId } = useContext(UserContext);
|
const { customerId } = useContext(UserContext);
|
||||||
|
const { data: ssidProfiles } = useQuery(GET_ALL_PROFILES, {
|
||||||
|
variables: { customerId, type: 'ssid' },
|
||||||
|
});
|
||||||
const [createProfile] = useMutation(CREATE_PROFILE);
|
const [createProfile] = useMutation(CREATE_PROFILE);
|
||||||
|
|
||||||
const handleAddProfile = (profileType, name, details, childProfileIds = []) => {
|
const handleAddProfile = (profileType, name, details, childProfileIds = []) => {
|
||||||
@@ -57,7 +62,14 @@ const AddProfile = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
return <AddProfilePage onCreateProfile={handleAddProfile} />;
|
return (
|
||||||
|
<AddProfilePage
|
||||||
|
onCreateProfile={handleAddProfile}
|
||||||
|
ssidProfiles={
|
||||||
|
(ssidProfiles && ssidProfiles.getAllProfiles && ssidProfiles.getAllProfiles.items) || []
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default AddProfile;
|
export default AddProfile;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { Alert, Spin, notification } from 'antd';
|
|||||||
import { ProfileDetails as ProfileDetailsPage } from '@tip-wlan/wlan-cloud-ui-library';
|
import { ProfileDetails as ProfileDetailsPage } from '@tip-wlan/wlan-cloud-ui-library';
|
||||||
|
|
||||||
import UserContext from 'contexts/UserContext';
|
import UserContext from 'contexts/UserContext';
|
||||||
|
import { GET_ALL_PROFILES } from 'graphql/queries';
|
||||||
|
|
||||||
const GET_PROFILE = gql`
|
const GET_PROFILE = gql`
|
||||||
query GetProfile($id: Int!) {
|
query GetProfile($id: Int!) {
|
||||||
@@ -28,23 +29,6 @@ const GET_PROFILE = gql`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const GET_ALL_PROFILES = gql`
|
|
||||||
query GetAllProfiles($customerId: Int!, $cursor: String, $type: String) {
|
|
||||||
getAllProfiles(customerId: $customerId, cursor: $cursor, type: $type) {
|
|
||||||
items {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
profileType
|
|
||||||
details
|
|
||||||
}
|
|
||||||
context {
|
|
||||||
cursor
|
|
||||||
lastPage
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const DELETE_PROFILE = gql`
|
const DELETE_PROFILE = gql`
|
||||||
query DeleteProfile($id: Int!) {
|
query DeleteProfile($id: Int!) {
|
||||||
deleteProfile(id: $id) {
|
deleteProfile(id: $id) {
|
||||||
|
|||||||
@@ -157,3 +157,20 @@ export const FILTER_SERVICE_METRICS = gql`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export const GET_ALL_PROFILES = gql`
|
||||||
|
query GetAllProfiles($customerId: Int!, $cursor: String, $type: String) {
|
||||||
|
getAllProfiles(customerId: $customerId, cursor: $cursor, type: $type) {
|
||||||
|
items {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
profileType
|
||||||
|
details
|
||||||
|
}
|
||||||
|
context {
|
||||||
|
cursor
|
||||||
|
lastPage
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
"@ant-design/icons": "^4.2.1",
|
"@ant-design/icons": "^4.2.1",
|
||||||
"@apollo/react-hoc": "^3.1.4",
|
"@apollo/react-hoc": "^3.1.4",
|
||||||
"@apollo/react-hooks": "^3.1.3",
|
"@apollo/react-hooks": "^3.1.3",
|
||||||
"@tip-wlan/wlan-cloud-ui-library": "^0.1.15",
|
"@tip-wlan/wlan-cloud-ui-library": "^0.1.16",
|
||||||
"antd": "^4.3.1",
|
"antd": "^4.3.1",
|
||||||
"apollo-boost": "^0.4.7",
|
"apollo-boost": "^0.4.7",
|
||||||
"clean-webpack-plugin": "^3.0.0",
|
"clean-webpack-plugin": "^3.0.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user