diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/ListApps.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/ListApps.js index 803d4bbeb0..d5639cea70 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/ListApps.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/ListApps.js @@ -17,10 +17,11 @@ */ import React from "react"; -import {Card, Col, Row, Typography, Input, Divider} from "antd"; +import {Card, Col, Row, Typography, Input, Divider, notification} from "antd"; import AppsTable from "./appsTable/AppsTable"; import Filters from "./Filters"; import AppDetailsDrawer from "./AppDetailsDrawer/AppDetailsDrawer"; +import axios from "axios"; const {Title} = Typography; const Search = Input.Search; @@ -51,6 +52,68 @@ class ListApps extends React.Component { }); }; + getCategories = () => { + const config = this.props.context; + axios.get( + window.location.origin+ config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/categories" + ).then(res => { + if (res.status === 200) { + let categories = JSON.parse(res.data.data); + this.getTags(); + this.setState({ + categories: categories, + loading: false + }); + } + + }).catch((error) => { + if (error.hasOwnProperty("response") && error.response.status === 401) { + window.location.href = window.location.origin+ '/publisher/login'; + } else { + notification["error"]({ + message: "There was a problem", + duration: 0, + description: + "Error occurred while trying to load categories.", + }); + } + this.setState({ + loading: false + }); + }); + }; + + getTags = () => { + const config = this.props.context; + axios.get( + window.location.origin+ config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/tags" + ).then(res => { + if (res.status === 200) { + let tags = JSON.parse(res.data.data); + this.getDeviceTypes(); + this.setState({ + tags: tags, + loading: false, + }); + } + + }).catch((error) => { + if (error.hasOwnProperty("response") && error.response.status === 401) { + window.location.href = window.location.origin+ '/publisher/login'; + } else { + notification["error"]({ + message: "There was a problem", + duration: 0, + description: + "Error occurred while trying to load tags.", + }); + } + this.setState({ + loading: false + }); + }); + }; + render() { const {isDrawerVisible, filters} = this.state; return ( diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps.js index 248fca92ae..de480c0c5d 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps.js @@ -27,6 +27,8 @@ class Apps extends React.Component { } + + render() { return (