mirror of
				https://github.com/Telecominfraproject/wlan-cloud-ui.git
				synced 2025-10-31 18:57:59 +00:00 
			
		
		
		
	Merge branch 'master' into hotfix/pagination
This commit is contained in:
		| @@ -10,7 +10,7 @@ import { | |||||||
|   Loading, |   Loading, | ||||||
| } from '@tip-wlan/wlan-cloud-ui-library'; | } from '@tip-wlan/wlan-cloud-ui-library'; | ||||||
|  |  | ||||||
| import { FILTER_SERVICE_METRICS, GET_ALL_PROFILES } from 'graphql/queries'; | import { FILTER_SERVICE_METRICS, GET_ALL_FIRMWARE, GET_ALL_PROFILES } from 'graphql/queries'; | ||||||
| import { UPDATE_EQUIPMENT_FIRMWARE } from 'graphql/mutations'; | import { UPDATE_EQUIPMENT_FIRMWARE } from 'graphql/mutations'; | ||||||
| import UserContext from 'contexts/UserContext'; | import UserContext from 'contexts/UserContext'; | ||||||
|  |  | ||||||
| @@ -74,20 +74,6 @@ const GET_EQUIPMENT = gql` | |||||||
|   } |   } | ||||||
| `; | `; | ||||||
|  |  | ||||||
| export const GET_ALL_FIRMWARE = gql` |  | ||||||
|   query GetAllFirmware { |  | ||||||
|     getAllFirmware { |  | ||||||
|       id |  | ||||||
|       modelId |  | ||||||
|       versionName |  | ||||||
|       description |  | ||||||
|       filename |  | ||||||
|       commit |  | ||||||
|       releaseDate |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
| `; |  | ||||||
|  |  | ||||||
| const UPDATE_EQUIPMENT = gql` | const UPDATE_EQUIPMENT = gql` | ||||||
|   mutation UpdateEquipment( |   mutation UpdateEquipment( | ||||||
|     $id: ID! |     $id: ID! | ||||||
| @@ -141,9 +127,20 @@ const AccessPointDetails = ({ locations }) => { | |||||||
|   const { customerId } = useContext(UserContext); |   const { customerId } = useContext(UserContext); | ||||||
|  |  | ||||||
|   const { loading, error, data, refetch } = useQuery(GET_EQUIPMENT, { |   const { loading, error, data, refetch } = useQuery(GET_EQUIPMENT, { | ||||||
|     variables: { id }, |     variables: { | ||||||
|  |       id, | ||||||
|  |     }, | ||||||
|   }); |   }); | ||||||
|   const { data: dataProfiles, error: errorProfiles, loading: landingProfiles } = useQuery( |  | ||||||
|  |   const { data: dataFirmware, error: errorFirmware, loading: loadingFirmware } = useQuery( | ||||||
|  |     GET_ALL_FIRMWARE, | ||||||
|  |     { | ||||||
|  |       skip: !data?.getEquipment?.model, | ||||||
|  |       variables: { modelId: data?.getEquipment?.model?.toLowerCase() }, | ||||||
|  |     } | ||||||
|  |   ); | ||||||
|  |  | ||||||
|  |   const { data: dataProfiles, error: errorProfiles, loading: loadingProfiles } = useQuery( | ||||||
|     GET_ALL_PROFILES(` |     GET_ALL_PROFILES(` | ||||||
|     childProfiles { |     childProfiles { | ||||||
|       id |       id | ||||||
| @@ -154,6 +151,7 @@ const AccessPointDetails = ({ locations }) => { | |||||||
|       variables: { customerId, type: 'equipment_ap', limit: 100 }, |       variables: { customerId, type: 'equipment_ap', limit: 100 }, | ||||||
|     } |     } | ||||||
|   ); |   ); | ||||||
|  |  | ||||||
|   const { |   const { | ||||||
|     loading: metricsLoading, |     loading: metricsLoading, | ||||||
|     error: metricsError, |     error: metricsError, | ||||||
| @@ -173,10 +171,6 @@ const AccessPointDetails = ({ locations }) => { | |||||||
|   const [updateEquipment] = useMutation(UPDATE_EQUIPMENT); |   const [updateEquipment] = useMutation(UPDATE_EQUIPMENT); | ||||||
|   const [updateEquipmentFirmware] = useMutation(UPDATE_EQUIPMENT_FIRMWARE); |   const [updateEquipmentFirmware] = useMutation(UPDATE_EQUIPMENT_FIRMWARE); | ||||||
|  |  | ||||||
|   const { data: dataFirmware, error: errorFirmware, loading: landingFirmware } = useQuery( |  | ||||||
|     GET_ALL_FIRMWARE |  | ||||||
|   ); |  | ||||||
|  |  | ||||||
|   const refetchData = () => { |   const refetchData = () => { | ||||||
|     refetch(); |     refetch(); | ||||||
|     metricsRefetch(); |     metricsRefetch(); | ||||||
| @@ -249,7 +243,7 @@ const AccessPointDetails = ({ locations }) => { | |||||||
|         }) |         }) | ||||||
|       ); |       ); | ||||||
|  |  | ||||||
|   if (loading || landingProfiles || landingFirmware) { |   if (loading) { | ||||||
|     return <Loading />; |     return <Loading />; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -264,42 +258,24 @@ const AccessPointDetails = ({ locations }) => { | |||||||
|     ); |     ); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   if (errorProfiles) { |  | ||||||
|     return ( |  | ||||||
|       <Alert |  | ||||||
|         message="Error" |  | ||||||
|         description="Failed to load Access Point profiles." |  | ||||||
|         type="error" |  | ||||||
|         showIcon |  | ||||||
|       /> |  | ||||||
|     ); |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   if (errorFirmware) { |  | ||||||
|     return ( |  | ||||||
|       <Alert |  | ||||||
|         message="Error" |  | ||||||
|         description="Failed to load Access Point firmware." |  | ||||||
|         type="error" |  | ||||||
|         showIcon |  | ||||||
|       /> |  | ||||||
|     ); |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   return ( |   return ( | ||||||
|     <AccessPointDetailsPage |     <AccessPointDetailsPage | ||||||
|       handleRefresh={refetchData} |       handleRefresh={refetchData} | ||||||
|       onUpdateEquipment={handleUpdateEquipment} |       onUpdateEquipment={handleUpdateEquipment} | ||||||
|       data={data.getEquipment} |       data={data?.getEquipment} | ||||||
|       profiles={dataProfiles.getAllProfiles.items} |       profiles={dataProfiles?.getAllProfiles?.items} | ||||||
|       osData={{ |       osData={{ | ||||||
|         loading: metricsLoading, |         loading: metricsLoading, | ||||||
|         error: metricsError, |         error: metricsError, | ||||||
|         data: metricsData && metricsData.filterServiceMetrics.items, |         data: metricsData && metricsData.filterServiceMetrics.items, | ||||||
|       }} |       }} | ||||||
|       firmware={dataFirmware.getAllFirmware} |       firmware={dataFirmware?.getAllFirmware} | ||||||
|       locations={locations} |       locations={locations} | ||||||
|       onUpdateEquipmentFirmware={handleUpdateEquipmentFirmware} |       onUpdateEquipmentFirmware={handleUpdateEquipmentFirmware} | ||||||
|  |       loadingProfiles={loadingProfiles} | ||||||
|  |       errorProfiles={errorProfiles} | ||||||
|  |       loadingFirmware={loadingFirmware} | ||||||
|  |       errorFirmware={errorFirmware} | ||||||
|     /> |     /> | ||||||
|   ); |   ); | ||||||
| }; | }; | ||||||
|   | |||||||
| @@ -21,7 +21,7 @@ | |||||||
|     "@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.2.9", |     "@tip-wlan/wlan-cloud-ui-library": "^0.2.9", | ||||||
|     "antd": "^4.3.1", |     "antd": "^4.5.2", | ||||||
|     "apollo-cache-inmemory": "^1.6.6", |     "apollo-cache-inmemory": "^1.6.6", | ||||||
|     "apollo-client": "^2.6.10", |     "apollo-client": "^2.6.10", | ||||||
|     "apollo-link": "^1.2.14", |     "apollo-link": "^1.2.14", | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Sean Macfarlane
					Sean Macfarlane