mirror of
https://github.com/Telecominfraproject/wlan-cloud-ui.git
synced 2025-11-01 19:27:51 +00:00
Merge branch 'master' into feature/TW-975
This commit is contained in:
@@ -8,8 +8,8 @@ import { Accounts as AccountsPage, Loading } from '@tip-wlan/wlan-cloud-ui-libra
|
||||
import UserContext from 'contexts/UserContext';
|
||||
|
||||
const GET_ALL_USERS = gql`
|
||||
query GetAllUsers($customerId: ID!, $cursor: String) {
|
||||
getAllUsers(customerId: $customerId, cursor: $cursor) {
|
||||
query GetAllUsers($customerId: ID!, $context: JSONObject) {
|
||||
getAllUsers(customerId: $customerId, context: $context) {
|
||||
items {
|
||||
id
|
||||
email: username
|
||||
@@ -17,10 +17,7 @@ const GET_ALL_USERS = gql`
|
||||
lastModifiedTimestamp
|
||||
customerId
|
||||
}
|
||||
context {
|
||||
cursor
|
||||
lastPage
|
||||
}
|
||||
context
|
||||
}
|
||||
}
|
||||
`;
|
||||
@@ -82,7 +79,7 @@ const Accounts = () => {
|
||||
const handleLoadMore = () => {
|
||||
if (!data.getAllUsers.context.lastPage) {
|
||||
fetchMore({
|
||||
variables: { cursor: data.getAllUsers.context.cursor },
|
||||
variables: { context: data.getAllUsers.context },
|
||||
updateQuery: (previousResult, { fetchMoreResult }) => {
|
||||
const previousEntry = previousResult.getAllUsers;
|
||||
const newItems = fetchMoreResult.getAllUsers.items;
|
||||
|
||||
@@ -33,8 +33,8 @@ const CREATE_PROFILE = gql`
|
||||
|
||||
const AddProfile = () => {
|
||||
const { customerId } = useContext(UserContext);
|
||||
const { data: ssidProfiles } = useQuery(GET_ALL_PROFILES, {
|
||||
variables: { customerId, type: 'ssid' },
|
||||
const { data: ssidProfiles } = useQuery(GET_ALL_PROFILES(), {
|
||||
variables: { customerId, type: 'ssid', limit: 100 },
|
||||
});
|
||||
const [createProfile] = useMutation(CREATE_PROFILE);
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ import { Alarms as AlarmsPage, Loading } from '@tip-wlan/wlan-cloud-ui-library';
|
||||
import UserContext from 'contexts/UserContext';
|
||||
|
||||
const GET_ALL_ALARMS = gql`
|
||||
query GetAllAlarms($customerId: ID!, $cursor: String) {
|
||||
getAllAlarms(customerId: $customerId, cursor: $cursor) {
|
||||
query GetAllAlarms($customerId: ID!, $context: JSONObject) {
|
||||
getAllAlarms(customerId: $customerId, context: $context) {
|
||||
items {
|
||||
severity
|
||||
alarmCode
|
||||
@@ -19,10 +19,7 @@ const GET_ALL_ALARMS = gql`
|
||||
name
|
||||
}
|
||||
}
|
||||
context {
|
||||
cursor
|
||||
lastPage
|
||||
}
|
||||
context
|
||||
}
|
||||
}
|
||||
`;
|
||||
@@ -53,7 +50,7 @@ const Alarms = () => {
|
||||
const handleLoadMore = () => {
|
||||
if (!data.getAllAlarms.context.lastPage) {
|
||||
fetchMore({
|
||||
variables: { cursor: data.getAllAlarms.context.cursor },
|
||||
variables: { context: data.getAllAlarms.context },
|
||||
updateQuery: (previousResult, { fetchMoreResult }) => {
|
||||
const previousEntry = previousResult.getAllAlarms;
|
||||
const newItems = fetchMoreResult.getAllAlarms.items;
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
Loading,
|
||||
} from '@tip-wlan/wlan-cloud-ui-library';
|
||||
|
||||
import { FILTER_SERVICE_METRICS, GET_ALL_FIRMWARE } from 'graphql/queries';
|
||||
import { FILTER_SERVICE_METRICS, GET_ALL_FIRMWARE, GET_ALL_PROFILES } from 'graphql/queries';
|
||||
import { UPDATE_EQUIPMENT_FIRMWARE } from 'graphql/mutations';
|
||||
import UserContext from 'contexts/UserContext';
|
||||
|
||||
@@ -119,28 +119,6 @@ const UPDATE_EQUIPMENT = gql`
|
||||
}
|
||||
`;
|
||||
|
||||
export const GET_ALL_PROFILES = gql`
|
||||
query GetAllProfiles($customerId: ID!, $cursor: String, $type: String, $limit: Int) {
|
||||
getAllProfiles(customerId: $customerId, cursor: $cursor, type: $type, limit: $limit) {
|
||||
items {
|
||||
id
|
||||
name
|
||||
profileType
|
||||
details
|
||||
childProfiles {
|
||||
id
|
||||
name
|
||||
details
|
||||
}
|
||||
}
|
||||
context {
|
||||
cursor
|
||||
lastPage
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const toTime = moment();
|
||||
const fromTime = moment().subtract(1, 'hour');
|
||||
|
||||
@@ -163,7 +141,12 @@ const AccessPointDetails = ({ locations }) => {
|
||||
);
|
||||
|
||||
const { data: dataProfiles, error: errorProfiles, loading: loadingProfiles } = useQuery(
|
||||
GET_ALL_PROFILES,
|
||||
GET_ALL_PROFILES(`
|
||||
childProfiles {
|
||||
id
|
||||
name
|
||||
details
|
||||
}`),
|
||||
{
|
||||
variables: { customerId, type: 'equipment_ap', limit: 100 },
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ const AccessPoints = ({ checkedLocations }) => {
|
||||
const handleLoadMore = () => {
|
||||
if (!equipData.filterEquipment.context.lastPage) {
|
||||
fetchMore({
|
||||
variables: { cursor: equipData.filterEquipment.context.cursor },
|
||||
variables: { context: equipData.filterEquipment.context },
|
||||
updateQuery: (previousResult, { fetchMoreResult }) => {
|
||||
const previousEntry = previousResult.filterEquipment;
|
||||
const newItems = fetchMoreResult.filterEquipment.items;
|
||||
|
||||
@@ -327,7 +327,7 @@ const BulkEditAPs = ({ locations, checkedLocations }) => {
|
||||
const handleLoadMore = () => {
|
||||
if (!equipData.filterEquipment.context.lastPage) {
|
||||
fetchMore({
|
||||
variables: { cursor: equipData.filterEquipment.context.cursor },
|
||||
variables: { context: equipData.filterEquipment.context },
|
||||
updateQuery: (previousResult, { fetchMoreResult }) => {
|
||||
const previousEntry = previousResult.filterEquipment;
|
||||
const newItems = fetchMoreResult.filterEquipment.items;
|
||||
|
||||
@@ -39,7 +39,7 @@ const ClientDevices = ({ checkedLocations }) => {
|
||||
const handleLoadMore = () => {
|
||||
if (!data.filterClientSessions.context.lastPage) {
|
||||
fetchMore({
|
||||
variables: { cursor: data.filterClientSessions.context.cursor },
|
||||
variables: { context: data.filterClientSessions.context },
|
||||
updateQuery: (previousResult, { fetchMoreResult }) => {
|
||||
const previousEntry = previousResult.filterClientSessions;
|
||||
const newItems = fetchMoreResult.filterClientSessions.items;
|
||||
|
||||
@@ -27,7 +27,7 @@ const Network = () => {
|
||||
variables: { customerId },
|
||||
});
|
||||
const { loading: loadingProfile, error: errorProfile, data: apProfiles } = useQuery(
|
||||
GET_ALL_PROFILES,
|
||||
GET_ALL_PROFILES(),
|
||||
{
|
||||
variables: { customerId, type: 'equipment_ap' },
|
||||
}
|
||||
|
||||
@@ -77,8 +77,7 @@ const ProfileDetails = () => {
|
||||
const { loading, error, data } = useQuery(GET_PROFILE, {
|
||||
variables: { id },
|
||||
});
|
||||
|
||||
const { data: ssidProfiles } = useQuery(GET_ALL_PROFILES, {
|
||||
const { data: ssidProfiles } = useQuery(GET_ALL_PROFILES(), {
|
||||
variables: { customerId, type: 'ssid' },
|
||||
});
|
||||
|
||||
|
||||
@@ -1,29 +1,11 @@
|
||||
import React, { useContext } from 'react';
|
||||
import gql from 'graphql-tag';
|
||||
import { useQuery, useMutation } from '@apollo/react-hooks';
|
||||
|
||||
import { Alert, notification } from 'antd';
|
||||
|
||||
import { Profile as ProfilePage, Loading } from '@tip-wlan/wlan-cloud-ui-library';
|
||||
import UserContext from 'contexts/UserContext';
|
||||
|
||||
const GET_ALL_PROFILES = gql`
|
||||
query GetAllProfiles($customerId: ID!, $cursor: String, $limit: Int) {
|
||||
getAllProfiles(customerId: $customerId, cursor: $cursor, limit: $limit) {
|
||||
items {
|
||||
id
|
||||
name
|
||||
profileType
|
||||
details
|
||||
equipmentCount
|
||||
}
|
||||
context {
|
||||
cursor
|
||||
lastPage
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
import { GET_ALL_PROFILES } from 'graphql/queries';
|
||||
import UserContext from 'contexts/UserContext';
|
||||
|
||||
const DELETE_PROFILE = gql`
|
||||
mutation DeleteProfile($id: ID!) {
|
||||
@@ -35,9 +17,12 @@ const DELETE_PROFILE = gql`
|
||||
|
||||
const Profiles = () => {
|
||||
const { customerId } = useContext(UserContext);
|
||||
const { loading, error, data, refetch, fetchMore } = useQuery(GET_ALL_PROFILES, {
|
||||
variables: { customerId, limit: 100 },
|
||||
});
|
||||
const { loading, error, data, refetch, fetchMore } = useQuery(
|
||||
GET_ALL_PROFILES(`equipmentCount`),
|
||||
{
|
||||
variables: { customerId },
|
||||
}
|
||||
);
|
||||
const [deleteProfile] = useMutation(DELETE_PROFILE);
|
||||
|
||||
const reloadTable = () => {
|
||||
@@ -59,14 +44,14 @@ const Profiles = () => {
|
||||
const handleLoadMore = () => {
|
||||
if (!data.getAllProfiles.context.lastPage) {
|
||||
fetchMore({
|
||||
variables: { cursor: data.getAllProfiles.context.cursor },
|
||||
variables: { context: { ...data.getAllProfiles.context } },
|
||||
updateQuery: (previousResult, { fetchMoreResult }) => {
|
||||
const previousEntry = previousResult.getAllProfiles;
|
||||
const newItems = fetchMoreResult.getAllProfiles.items;
|
||||
|
||||
return {
|
||||
getAllProfiles: {
|
||||
context: fetchMoreResult.getAllProfiles.context,
|
||||
context: { ...fetchMoreResult.getAllProfiles.context },
|
||||
items: [...previousEntry.items, ...newItems],
|
||||
__typename: previousEntry.__typename,
|
||||
},
|
||||
@@ -104,7 +89,7 @@ const Profiles = () => {
|
||||
<ProfilePage
|
||||
data={data.getAllProfiles.items}
|
||||
onReload={reloadTable}
|
||||
isLastPage={data.getAllProfiles.context.lastPage}
|
||||
isLastPage={data?.getAllProfiles?.context?.lastPage}
|
||||
onDeleteProfile={handleDeleteProfile}
|
||||
onLoadMore={handleLoadMore}
|
||||
/>
|
||||
|
||||
@@ -21,7 +21,7 @@ const AutoProvision = () => {
|
||||
}
|
||||
);
|
||||
const { data: dataProfile, loading: loadingProfile, error: errorProfile } = useQuery(
|
||||
GET_ALL_PROFILES,
|
||||
GET_ALL_PROFILES(),
|
||||
{
|
||||
variables: { customerId, type: 'equipment_ap' },
|
||||
}
|
||||
|
||||
@@ -16,13 +16,13 @@ export const FILTER_EQUIPMENT = gql`
|
||||
$locationIds: [ID]
|
||||
$customerId: ID!
|
||||
$equipmentType: String
|
||||
$cursor: String
|
||||
$context: JSONObject
|
||||
) {
|
||||
filterEquipment(
|
||||
customerId: $customerId
|
||||
locationIds: $locationIds
|
||||
equipmentType: $equipmentType
|
||||
cursor: $cursor
|
||||
context: $context
|
||||
) {
|
||||
items {
|
||||
name
|
||||
@@ -63,10 +63,7 @@ export const FILTER_EQUIPMENT = gql`
|
||||
}
|
||||
}
|
||||
}
|
||||
context {
|
||||
lastPage
|
||||
cursor
|
||||
}
|
||||
context
|
||||
}
|
||||
}
|
||||
`;
|
||||
@@ -76,13 +73,13 @@ export const FILTER_EQUIPMENT_BULK_EDIT_APS = gql`
|
||||
$locationIds: [ID]
|
||||
$customerId: ID!
|
||||
$equipmentType: String
|
||||
$cursor: String
|
||||
$context: JSONObject
|
||||
) {
|
||||
filterEquipment(
|
||||
customerId: $customerId
|
||||
locationIds: $locationIds
|
||||
equipmentType: $equipmentType
|
||||
cursor: $cursor
|
||||
context: $context
|
||||
) {
|
||||
items {
|
||||
name
|
||||
@@ -91,10 +88,7 @@ export const FILTER_EQUIPMENT_BULK_EDIT_APS = gql`
|
||||
channel
|
||||
details
|
||||
}
|
||||
context {
|
||||
lastPage
|
||||
cursor
|
||||
}
|
||||
context
|
||||
}
|
||||
}
|
||||
`;
|
||||
@@ -112,8 +106,8 @@ export const GET_LOCATION = gql`
|
||||
`;
|
||||
|
||||
export const FILTER_CLIENT_SESSIONS = gql`
|
||||
query FilterClientSessions($customerId: ID!, $locationIds: [ID], $cursor: String) {
|
||||
filterClientSessions(customerId: $customerId, locationIds: $locationIds, cursor: $cursor) {
|
||||
query FilterClientSessions($customerId: ID!, $locationIds: [ID], $context: JSONObject) {
|
||||
filterClientSessions(customerId: $customerId, locationIds: $locationIds, context: $context) {
|
||||
items {
|
||||
id
|
||||
macAddress
|
||||
@@ -127,10 +121,7 @@ export const FILTER_CLIENT_SESSIONS = gql`
|
||||
name
|
||||
}
|
||||
}
|
||||
context {
|
||||
lastPage
|
||||
cursor
|
||||
}
|
||||
context
|
||||
}
|
||||
}
|
||||
`;
|
||||
@@ -157,7 +148,7 @@ export const GET_CLIENT_SESSION = gql`
|
||||
export const FILTER_SERVICE_METRICS = gql`
|
||||
query FilterServiceMetrics(
|
||||
$customerId: ID!
|
||||
$cursor: String
|
||||
$context: JSONObject
|
||||
$fromTime: String!
|
||||
$toTime: String!
|
||||
$clientMacs: [String]
|
||||
@@ -167,7 +158,7 @@ export const FILTER_SERVICE_METRICS = gql`
|
||||
) {
|
||||
filterServiceMetrics(
|
||||
customerId: $customerId
|
||||
cursor: $cursor
|
||||
context: $context
|
||||
fromTime: $fromTime
|
||||
toTime: $toTime
|
||||
clientMacs: $clientMacs
|
||||
@@ -183,27 +174,34 @@ export const FILTER_SERVICE_METRICS = gql`
|
||||
txBytes
|
||||
detailsJSON
|
||||
}
|
||||
context {
|
||||
lastPage
|
||||
cursor
|
||||
}
|
||||
context
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const GET_ALL_PROFILES = gql`
|
||||
query GetAllProfiles($customerId: ID!, $cursor: String, $type: String) {
|
||||
getAllProfiles(customerId: $customerId, cursor: $cursor, type: $type) {
|
||||
export const GET_ALL_PROFILES = (fields = '') => gql`
|
||||
query GetAllProfiles(
|
||||
$customerId: ID!
|
||||
$cursor: String
|
||||
$limit: Int
|
||||
$type: String
|
||||
$context: JSONObject
|
||||
) {
|
||||
getAllProfiles(
|
||||
customerId: $customerId
|
||||
cursor: $cursor
|
||||
limit: $limit
|
||||
type: $type
|
||||
context: $context
|
||||
) {
|
||||
items {
|
||||
id
|
||||
name
|
||||
profileType
|
||||
details
|
||||
${fields}
|
||||
}
|
||||
context {
|
||||
cursor
|
||||
lastPage
|
||||
}
|
||||
context
|
||||
}
|
||||
}
|
||||
`;
|
||||
@@ -219,10 +217,7 @@ export const GET_ALL_STATUS = gql`
|
||||
clientCountPerOui
|
||||
}
|
||||
}
|
||||
context {
|
||||
lastPage
|
||||
cursor
|
||||
}
|
||||
context
|
||||
}
|
||||
}
|
||||
`;
|
||||
@@ -298,7 +293,7 @@ export const FILTER_SYSTEM_EVENTS = gql`
|
||||
$toTime: String!
|
||||
$equipmentIds: [ID]
|
||||
$dataTypes: [String]
|
||||
$cursor: String
|
||||
$context: JSONObject
|
||||
$limit: Int
|
||||
) {
|
||||
filterSystemEvents(
|
||||
@@ -307,14 +302,11 @@ export const FILTER_SYSTEM_EVENTS = gql`
|
||||
toTime: $toTime
|
||||
dataTypes: $dataTypes
|
||||
equipmentIds: $equipmentIds
|
||||
cursor: $cursor
|
||||
context: $context
|
||||
limit: $limit
|
||||
) {
|
||||
items
|
||||
context {
|
||||
lastPage
|
||||
cursor
|
||||
}
|
||||
context
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
865
package-lock.json
generated
865
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "wlan-cloud-ui",
|
||||
"version": "0.2.9",
|
||||
"version": "0.3.0",
|
||||
"author": "ConnectUs",
|
||||
"description": "React Portal",
|
||||
"engines": {
|
||||
|
||||
Reference in New Issue
Block a user