Merge branch 'master' into feature/WIFI-661

# Conflicts:
#	app/containers/Profiles/index.js
This commit is contained in:
Hassan Azmi
2020-08-21 13:07:04 -04:00
3 changed files with 27 additions and 3 deletions

View File

@@ -2,6 +2,7 @@ import React, { useContext } from 'react';
import { AddProfile as AddProfilePage } from '@tip-wlan/wlan-cloud-ui-library';
import { useMutation, useQuery, gql } from '@apollo/client';
import { notification } from 'antd';
import { useHistory } from 'react-router-dom';
import UserContext from 'contexts/UserContext';
import { GET_ALL_PROFILES } from 'graphql/queries';
@@ -36,6 +37,7 @@ const AddProfile = () => {
variables: { customerId, type: 'ssid', limit: 100 },
});
const [createProfile] = useMutation(CREATE_PROFILE);
const history = useHistory();
const handleAddProfile = (profileType, name, details, childProfileIds = []) => {
createProfile({
@@ -52,6 +54,7 @@ const AddProfile = () => {
message: 'Success',
description: 'Profile successfully created.',
});
history.push('/profiles', { refetch: true});
})
.catch(() =>
notification.error({

View File

@@ -12,7 +12,12 @@ import ClientDeviceDetails from 'containers/Network/containers/ClientDeviceDetai
import BulkEditAccessPoints from 'containers/Network/containers/BulkEditAccessPoints';
import UserContext from 'contexts/UserContext';
import { GET_ALL_LOCATIONS, GET_LOCATION, GET_ALL_PROFILES } from 'graphql/queries';
import {
GET_ALL_LOCATIONS,
GET_LOCATION,
GET_ALL_PROFILES,
FILTER_EQUIPMENT,
} from 'graphql/queries';
import {
CREATE_LOCATION,
UPDATE_LOCATION,
@@ -37,13 +42,21 @@ const Network = () => {
const [createLocation] = useMutation(CREATE_LOCATION);
const [updateLocation] = useMutation(UPDATE_LOCATION);
const [deleteLocation] = useMutation(DELETE_LOCATION);
const [createEquipment] = useMutation(CREATE_EQUIPMENT);
const [checkedLocations, setCheckedLocations] = useState([]);
const [deleteModal, setDeleteModal] = useState(false);
const [editModal, setEditModal] = useState(false);
const [addModal, setAddModal] = useState(false);
const [apModal, setApModal] = useState(false);
const [createEquipment] = useMutation(CREATE_EQUIPMENT, {
refetchQueries: [
{
query: FILTER_EQUIPMENT,
variables: { customerId, locationIds: checkedLocations, equipmentType: 'AP' },
},
],
});
const handleGetSingleLocation = id => {
getLocation({
variables: { id },

View File

@@ -1,5 +1,6 @@
import React, { useContext } from 'react';
import React, { useContext, useEffect } from 'react';
import { useQuery, useMutation, gql } from '@apollo/client';
import { useLocation } from 'react-router-dom';
import { Alert, notification } from 'antd';
import { Profile as ProfilePage, Loading } from '@tip-wlan/wlan-cloud-ui-library';
@@ -23,6 +24,13 @@ const Profiles = () => {
}
);
const [deleteProfile] = useMutation(DELETE_PROFILE);
const location = useLocation();
useEffect(() => {
if (location.state && location.state.refetch) {
refetch();
}
}, []);
const reloadTable = () => {
refetch()