diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml index b0a30601ae..16cd11f5f8 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml @@ -32,9 +32,8 @@ true org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.FCMBasedPushNotificationProvider - org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.MQTTBasedPushNotificationProvider - org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.HTTPBasedPushNotificationProvider + org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.HTTPBasedPushNotificationProvider org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.XMPPBasedPushNotificationProvider diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/App.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/App.js index 264db3aed8..f4d08b4dea 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/App.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/App.js @@ -22,7 +22,7 @@ import RouteWithSubRoutes from './components/RouteWithSubRoutes'; import { BrowserRouter as Router, Redirect, Switch } from 'react-router-dom'; import axios from 'axios'; import { Layout, Spin, Result } from 'antd'; -import ConfigContext from './context/ConfigContext'; +import ConfigContext from './components/context/ConfigContext'; const { Content } = Layout; const loadingView = ( diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/RouteWithSubRoutes.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/RouteWithSubRoutes/index.js similarity index 100% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/RouteWithSubRoutes.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/RouteWithSubRoutes/index.js diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/context/ConfigContext.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/context/ConfigContext/index.js similarity index 100% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/context/ConfigContext.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/context/ConfigContext/index.js diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/index.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/index.js index 11c8700d39..c4249a4206 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/index.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/index.js @@ -18,12 +18,12 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import * as serviceWorker from './serviceWorker'; +import * as serviceWorker from './services/serviceWorkers/serviceWorker'; import App from './App'; -import Login from './pages/Login'; -import Dashboard from './pages/dashboard/Dashboard'; -import Apps from './pages/dashboard/apps/Apps'; -import Release from './pages/dashboard/apps/release/Release'; +import Login from './scenes/Login'; +import Dashboard from './scenes/Home'; +import Apps from './scenes/Home/scenes/Apps'; +import Release from './scenes/Home/scenes/Apps/scenes/Release'; import './index.css'; const routes = [ diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/dashboard/logout/Logout.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/components/Logout/index.js similarity index 92% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/dashboard/logout/Logout.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/components/Logout/index.js index 4cc01f9439..a11d1d029a 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/dashboard/logout/Logout.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/components/Logout/index.js @@ -19,8 +19,8 @@ import React from 'react'; import { Menu, Icon } from 'antd'; import axios from 'axios'; -import { withConfigContext } from '../../../context/ConfigContext'; -import { handleApiError } from '../../../js/Utils'; +import { withConfigContext } from '../../../../components/context/ConfigContext'; +import { handleApiError } from '../../../../services/utils/errorHandler'; /* This class for call the logout api by sending request diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/dashboard/Dashboard.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/index.js similarity index 97% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/dashboard/Dashboard.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/index.js index c3c57572e7..2c8a8d7d12 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/dashboard/Dashboard.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/index.js @@ -24,10 +24,10 @@ import { Link } from 'react-router-dom'; import RouteWithSubRoutes from '../../components/RouteWithSubRoutes'; import { Switch } from 'react-router'; import axios from 'axios'; -import './Dashboard.css'; -import { withConfigContext } from '../../context/ConfigContext'; -import Logout from './logout/Logout'; -import { handleApiError } from '../../js/Utils'; +import './styles.css'; +import { withConfigContext } from '../../components/context/ConfigContext'; +import Logout from './components/Logout'; +import { handleApiError } from '../../services/utils/errorHandler'; const { SubMenu } = Menu; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/AppCard.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/components/AppList/components/AppCard/index.js similarity index 99% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/AppCard.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/components/AppList/components/AppCard/index.js index 37ec0504fa..c0526ba91e 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/AppCard.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/components/AppList/components/AppCard/index.js @@ -19,7 +19,7 @@ import { Card, Typography, Col, Row } from 'antd'; import React from 'react'; import { Link } from 'react-router-dom'; -import './AppCard.css'; +import './styles.css'; import StarRatings from 'react-star-ratings'; const { Meta } = Card; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/AppCard.css b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/components/AppList/components/AppCard/styles.css similarity index 100% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/AppCard.css rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/components/AppList/components/AppCard/styles.css diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/AppList.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/components/AppList/index.js similarity index 95% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/AppList.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/components/AppList/index.js index 4d3f0fd047..48f896b092 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/AppList.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/components/AppList/index.js @@ -17,11 +17,11 @@ */ import React from 'react'; -import AppCard from './AppCard'; +import AppCard from './components/AppCard'; import { Col, Row, Result } from 'antd'; import axios from 'axios'; -import { withConfigContext } from '../../context/ConfigContext'; -import { handleApiError } from '../../js/Utils'; +import { withConfigContext } from '../../../../../../components/context/ConfigContext'; +import { handleApiError } from '../../../../../../services/utils/errorHandler'; import InfiniteScroll from 'react-infinite-scroller'; const limit = 30; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/dashboard/apps/Apps.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/index.js similarity index 95% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/dashboard/apps/Apps.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/index.js index bd8b2935d2..1edc6691c5 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/dashboard/apps/Apps.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/index.js @@ -17,7 +17,7 @@ */ import React from 'react'; -import AppList from '../../../components/apps/AppList'; +import AppList from './components/AppList'; class Apps extends React.Component { routes; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/images/ImgViewer.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ImageViewer/index.js similarity index 96% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/images/ImgViewer.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ImageViewer/index.js index 47edab6623..e4fa6dba15 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/images/ImgViewer.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ImageViewer/index.js @@ -19,7 +19,7 @@ import React, { Component } from 'react'; import RcViewer from 'rc-viewer'; -class ImgViewer extends Component { +class ImageViewer extends Component { render() { const options = { title: false, @@ -59,4 +59,4 @@ class ImgViewer extends Component { } } -export default ImgViewer; +export default ImageViewer; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/DeviceInstall.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Install/components/DeviceInstall/index.js similarity index 96% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/DeviceInstall.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Install/components/DeviceInstall/index.js index 94dd414243..19c2b1a76d 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/DeviceInstall.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Install/components/DeviceInstall/index.js @@ -23,9 +23,9 @@ import TimeAgo from 'javascript-time-ago'; // Load locale-specific relative date/time formatting rules. import en from 'javascript-time-ago/locale/en'; -import { withConfigContext } from '../../../../context/ConfigContext'; -import { handleApiError } from '../../../../js/Utils'; -import InstallModalFooter from './installModalFooter/InstallModalFooter'; +import { withConfigContext } from '../../../../../../../../../../../../components/context/ConfigContext'; +import { handleApiError } from '../../../../../../../../../../../../services/utils/errorHandler'; +import InstallModalFooter from '../../../installModalFooter'; const { Text } = Typography; const columns = [ diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/GroupInstall.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Install/components/GroupInstall/index.js similarity index 93% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/GroupInstall.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Install/components/GroupInstall/index.js index 0ecdcd8b39..ca17bf6640 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/GroupInstall.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Install/components/GroupInstall/index.js @@ -20,9 +20,9 @@ import React from 'react'; import { Typography, Select, Spin, Alert } from 'antd'; import debounce from 'lodash.debounce'; import axios from 'axios'; -import { withConfigContext } from '../../../../context/ConfigContext'; -import { handleApiError } from '../../../../js/Utils'; -import InstallModalFooter from './installModalFooter/InstallModalFooter'; +import { withConfigContext } from '../../../../../../../../../../../../components/context/ConfigContext'; +import { handleApiError } from '../../../../../../../../../../../../services/utils/errorHandler'; +import InstallModalFooter from '../../../installModalFooter'; const { Text } = Typography; const { Option } = Select; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/RoleInstall.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Install/components/RoleInstall/index.js similarity index 93% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/RoleInstall.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Install/components/RoleInstall/index.js index 63f6bfca77..633b6a9c7c 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/RoleInstall.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Install/components/RoleInstall/index.js @@ -20,9 +20,9 @@ import React from 'react'; import { Typography, Select, Spin, Alert } from 'antd'; import debounce from 'lodash.debounce'; import axios from 'axios'; -import { withConfigContext } from '../../../../context/ConfigContext'; -import { handleApiError } from '../../../../js/Utils'; -import InstallModalFooter from './installModalFooter/InstallModalFooter'; +import { withConfigContext } from '../../../../../../../../../../../../components/context/ConfigContext'; +import { handleApiError } from '../../../../../../../../../../../../services/utils/errorHandler'; +import InstallModalFooter from '../../../installModalFooter'; const { Text } = Typography; const { Option } = Select; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/UserInstall.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Install/components/UserInstall/index.js similarity index 93% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/UserInstall.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Install/components/UserInstall/index.js index 9c54d05f56..d0f6533087 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/UserInstall.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Install/components/UserInstall/index.js @@ -20,9 +20,9 @@ import React from 'react'; import { Typography, Select, Spin, Alert } from 'antd'; import debounce from 'lodash.debounce'; import axios from 'axios'; -import { withConfigContext } from '../../../../context/ConfigContext'; -import { handleApiError } from '../../../../js/Utils'; -import InstallModalFooter from './installModalFooter/InstallModalFooter'; +import { withConfigContext } from '../../../../../../../../../../../../components/context/ConfigContext'; +import { handleApiError } from '../../../../../../../../../../../../services/utils/errorHandler'; +import InstallModalFooter from '../../../installModalFooter'; const { Text } = Typography; const { Option } = Select; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/AppInstallModal.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Install/index.js similarity index 86% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/AppInstallModal.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Install/index.js index 3f3cac0152..bb8bd66673 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/AppInstallModal.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Install/index.js @@ -18,14 +18,14 @@ import React from 'react'; import { Modal, Spin, Tabs } from 'antd'; -import UserInstall from './UserInstall'; -import GroupInstall from './GroupInstall'; -import RoleInstall from './RoleInstall'; -import DeviceInstall from './DeviceInstall'; +import UserInstall from './components/UserInstall'; +import GroupInstall from './components/GroupInstall'; +import RoleInstall from './components/RoleInstall'; +import DeviceInstall from './components/DeviceInstall'; const { TabPane } = Tabs; -class AppInstallModal extends React.Component { +class Install extends React.Component { state = { data: [], }; @@ -65,4 +65,4 @@ class AppInstallModal extends React.Component { } } -export default AppInstallModal; +export default Install; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/AddReview.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/CurrentUsersReview/components/AddReview/index.js similarity index 95% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/AddReview.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/CurrentUsersReview/components/AddReview/index.js index 4f1c204d72..821cac5465 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/AddReview.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/CurrentUsersReview/components/AddReview/index.js @@ -31,8 +31,8 @@ import { } from 'antd'; import StarRatings from 'react-star-ratings'; import axios from 'axios'; -import { withConfigContext } from '../../../../context/ConfigContext'; -import { handleApiError } from '../../../../js/Utils'; +import { withConfigContext } from '../../../../../../../../../../../../../../components/context/ConfigContext'; +import { handleApiError } from '../../../../../../../../../../../../../../services/utils/errorHandler'; const { Title } = Typography; const { TextArea } = Input; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/CurrentUsersReview.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/CurrentUsersReview/index.js similarity index 93% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/CurrentUsersReview.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/CurrentUsersReview/index.js index f861d27e40..87df7e62c0 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/CurrentUsersReview.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/CurrentUsersReview/index.js @@ -18,9 +18,9 @@ import React from 'react'; import { List, Typography, Empty, Alert } from 'antd'; -import SingleReview from './singleReview/SingleReview'; -import AddReview from './AddReview'; -import { withConfigContext } from '../../../../context/ConfigContext'; +import SingleReview from '../Reviews/components/Review'; +import AddReview from './components/AddReview'; +import { withConfigContext } from '../../../../../../../../../../../../components/context/ConfigContext'; const { Text } = Typography; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/DetailedRating.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Rating/index.js similarity index 94% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/DetailedRating.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Rating/index.js index 3b28f6d1d4..454c88e69e 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/DetailedRating.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Rating/index.js @@ -19,12 +19,12 @@ import React from 'react'; import { Row, Typography, Icon } from 'antd'; import StarRatings from 'react-star-ratings'; -import './DetailedRating.css'; -import { withConfigContext } from '../../../context/ConfigContext'; +import './styles.css'; +import { withConfigContext } from '../../../../../../../../../../../../components/context/ConfigContext'; const { Text } = Typography; -class DetailedRating extends React.Component { +class Rating extends React.Component { render() { const { detailedRating } = this.props; @@ -122,4 +122,4 @@ class DetailedRating extends React.Component { } } -export default withConfigContext(DetailedRating); +export default withConfigContext(Rating); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/DetailedRating.css b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Rating/styles.css similarity index 100% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/DetailedRating.css rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Rating/styles.css diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/editReview/EditReview.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Reviews/components/Review/components/Edit/index.js similarity index 93% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/editReview/EditReview.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Reviews/components/Review/components/Edit/index.js index a03d80a8a0..13806129d9 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/editReview/EditReview.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Reviews/components/Review/components/Edit/index.js @@ -30,14 +30,14 @@ import { } from 'antd'; import StarRatings from 'react-star-ratings'; import axios from 'axios'; -import './EditReview.css'; -import { withConfigContext } from '../../../../../../context/ConfigContext'; -import { handleApiError } from '../../../../../../js/Utils'; +import './styles.css'; +import { withConfigContext } from '../../../../../../../../../../../../../../../../components/context/ConfigContext'; +import { handleApiError } from '../../../../../../../../../../../../../../../../services/utils/errorHandler'; const { Title } = Typography; const { TextArea } = Input; -class EditReview extends React.Component { +class Edit extends React.Component { constructor(props) { super(props); this.state = { @@ -195,4 +195,4 @@ class EditReview extends React.Component { } } -export default withConfigContext(EditReview); +export default withConfigContext(Edit); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/editReview/EditReview.css b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Reviews/components/Review/components/Edit/styles.css similarity index 100% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/editReview/EditReview.css rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Reviews/components/Review/components/Edit/styles.css diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/SingleReview.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Reviews/components/Review/index.js similarity index 91% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/SingleReview.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Reviews/components/Review/index.js index 7cbbbdc9e7..9722614e05 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/SingleReview.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Reviews/components/Review/index.js @@ -21,11 +21,11 @@ import { Avatar, notification } from 'antd'; import { List, Typography, Popconfirm } from 'antd'; import StarRatings from 'react-star-ratings'; import Twemoji from 'react-twemoji'; -import './SingleReview.css'; -import EditReview from './editReview/EditReview'; +import './styles.css'; +import EditReview from './components/Edit'; import axios from 'axios'; -import { withConfigContext } from '../../../../../context/ConfigContext'; -import { handleApiError } from '../../../../../js/Utils'; +import { withConfigContext } from '../../../../../../../../../../../../../../components/context/ConfigContext'; +import { handleApiError } from '../../../../../../../../../../../../../../services/utils/errorHandler'; const { Text, Paragraph } = Typography; const colorList = [ @@ -41,7 +41,7 @@ const colorList = [ '#f9ca24', ]; -class SingleReview extends React.Component { +class Review extends React.Component { static defaultProps = { isPersonalReview: false, }; @@ -167,4 +167,4 @@ class SingleReview extends React.Component { } } -export default withConfigContext(SingleReview); +export default withConfigContext(Review); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/SingleReview.css b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Reviews/components/Review/styles.css similarity index 100% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/singleReview/SingleReview.css rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Reviews/components/Review/styles.css diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/Reviews.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Reviews/index.js similarity index 94% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/Reviews.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Reviews/index.js index eab5ba3e4e..1f6620e118 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/Reviews.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Reviews/index.js @@ -18,13 +18,13 @@ import React from 'react'; import { List, Spin, Button, Alert } from 'antd'; -import './Reviews.css'; +import './styles.css'; import InfiniteScroll from 'react-infinite-scroller'; -import SingleReview from './singleReview/SingleReview'; +import SingleReview from './components/Review'; import axios from 'axios'; -import { withConfigContext } from '../../../../context/ConfigContext'; -import { handleApiError } from '../../../../js/Utils'; +import { withConfigContext } from '../../../../../../../../../../../../components/context/ConfigContext'; +import { handleApiError } from '../../../../../../../../../../../../services/utils/errorHandler'; const limit = 5; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/Reviews.css b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Reviews/styles.css similarity index 100% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/Reviews.css rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Reviews/styles.css diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/ReviewContainer.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/index.js similarity index 92% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/ReviewContainer.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/index.js index aaae16c01d..0c42aff3e4 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/review/ReviewContainer.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/index.js @@ -17,13 +17,13 @@ */ import React from 'react'; -import CurrentUsersReview from './CurrentUsersReview'; +import CurrentUsersReview from './componets/CurrentUsersReview'; import { Col, Divider, Row, Typography } from 'antd'; -import DetailedRating from '../DetailedRating'; -import Reviews from './Reviews'; +import DetailedRating from './componets/Rating'; +import Reviews from './componets/Reviews'; import axios from 'axios'; -import { handleApiError } from '../../../../js/Utils'; -import { withConfigContext } from '../../../../context/ConfigContext'; +import { handleApiError } from '../../../../../../../../../../services/utils/errorHandler'; +import { withConfigContext } from '../../../../../../../../../../components/context/ConfigContext'; const { Text } = Typography; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/SubscriptionDetails.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/SubscriptionDetails/index.js similarity index 97% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/SubscriptionDetails.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/SubscriptionDetails/index.js index 9fb6f3d91a..7bb1358fb0 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/SubscriptionDetails.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/SubscriptionDetails/index.js @@ -23,8 +23,8 @@ import TimeAgo from 'javascript-time-ago'; // Load locale-specific relative date/time formatting rules. import en from 'javascript-time-ago/locale/en'; -import { withConfigContext } from '../../../context/ConfigContext'; -import { handleApiError } from '../../../js/Utils'; +import { withConfigContext } from '../../../../../../../../../../components/context/ConfigContext'; +import { handleApiError } from '../../../../../../../../../../services/utils/errorHandler'; const { Text } = Typography; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/DeviceUninstall.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Uninstall/components/DeviceUninstall/index.js similarity index 96% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/DeviceUninstall.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Uninstall/components/DeviceUninstall/index.js index 303c1ecae0..8e9dc5b0cd 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/DeviceUninstall.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Uninstall/components/DeviceUninstall/index.js @@ -23,9 +23,9 @@ import TimeAgo from 'javascript-time-ago'; // Load locale-specific relative date/time formatting rules. import en from 'javascript-time-ago/locale/en'; -import { withConfigContext } from '../../../../context/ConfigContext'; -import { handleApiError } from '../../../../js/Utils'; -import InstallModalFooter from './installModalFooter/InstallModalFooter'; +import { withConfigContext } from '../../../../../../../../../../../../components/context/ConfigContext'; +import { handleApiError } from '../../../../../../../../../../../../services/utils/errorHandler'; +import InstallModalFooter from '../../../installModalFooter'; const { Text } = Typography; const columns = [ diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/GroupUninstall.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Uninstall/components/GroupUninstall/index.js similarity index 93% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/GroupUninstall.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Uninstall/components/GroupUninstall/index.js index 6205fc239b..d3dce763fe 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/GroupUninstall.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Uninstall/components/GroupUninstall/index.js @@ -20,9 +20,9 @@ import React from 'react'; import { Typography, Select, Spin, Alert } from 'antd'; import debounce from 'lodash.debounce'; import axios from 'axios'; -import { withConfigContext } from '../../../../context/ConfigContext'; -import { handleApiError } from '../../../../js/Utils'; -import InstallModalFooter from './installModalFooter/InstallModalFooter'; +import { withConfigContext } from '../../../../../../../../../../../../components/context/ConfigContext'; +import { handleApiError } from '../../../../../../../../../../../../services/utils/errorHandler'; +import InstallModalFooter from '../../../installModalFooter'; const { Text } = Typography; const { Option } = Select; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/RoleUninstall.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Uninstall/components/RoleUninstall/index.js similarity index 93% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/RoleUninstall.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Uninstall/components/RoleUninstall/index.js index 622cbe787a..da999eafdb 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/RoleUninstall.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Uninstall/components/RoleUninstall/index.js @@ -20,9 +20,9 @@ import React from 'react'; import { Typography, Select, Spin, Alert } from 'antd'; import debounce from 'lodash.debounce'; import axios from 'axios'; -import { withConfigContext } from '../../../../context/ConfigContext'; -import { handleApiError } from '../../../../js/Utils'; -import InstallModalFooter from './installModalFooter/InstallModalFooter'; +import { withConfigContext } from '../../../../../../../../../../../../components/context/ConfigContext'; +import { handleApiError } from '../../../../../../../../../../../../services/utils/errorHandler'; +import InstallModalFooter from '../../../installModalFooter'; const { Text } = Typography; const { Option } = Select; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/UserUninstall.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Uninstall/components/UserUninstall/index.js similarity index 93% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/UserUninstall.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Uninstall/components/UserUninstall/index.js index 4b7f824cbc..1d0799bcdb 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/UserUninstall.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Uninstall/components/UserUninstall/index.js @@ -20,9 +20,9 @@ import React from 'react'; import { Typography, Select, Spin, Alert } from 'antd'; import debounce from 'lodash.debounce'; import axios from 'axios'; -import { withConfigContext } from '../../../../context/ConfigContext'; -import { handleApiError } from '../../../../js/Utils'; -import InstallModalFooter from './installModalFooter/InstallModalFooter'; +import { withConfigContext } from '../../../../../../../../../../../../components/context/ConfigContext'; +import { handleApiError } from '../../../../../../../../../../../../services/utils/errorHandler'; +import InstallModalFooter from '../../../installModalFooter'; const { Text } = Typography; const { Option } = Select; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/AppUninstallModal.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Uninstall/index.js similarity index 87% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/AppUninstallModal.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Uninstall/index.js index 6b48b7793b..f320eeed53 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/AppUninstallModal.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Uninstall/index.js @@ -17,14 +17,14 @@ */ import React from 'react'; import { Modal, Spin, Tabs } from 'antd'; -import DeviceUninstall from './DeviceUninstall'; -import UserUninstall from './UserUninstall'; -import RoleUninstall from './RoleUninstall'; -import GroupUninstall from './GroupUninstall'; +import DeviceUninstall from './components/DeviceUninstall'; +import UserUninstall from './components/UserUninstall'; +import RoleUninstall from './components/RoleUninstall'; +import GroupUninstall from './components/GroupUninstall'; const { TabPane } = Tabs; -class AppUninstallModal extends React.Component { +class Uninstall extends React.Component { state = { data: [], }; @@ -74,4 +74,4 @@ class AppUninstallModal extends React.Component { } } -export default AppUninstallModal; +export default Uninstall; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/installModalFooter/InstallModalFooter.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/installModalFooter/index.js similarity index 100% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/installModalFooter/InstallModalFooter.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/installModalFooter/index.js diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/ReleaseView.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/index.js similarity index 93% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/ReleaseView.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/index.js index 8cad68f77a..d05adf76e7 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/ReleaseView.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/index.js @@ -30,17 +30,17 @@ import { Tabs, Tag, } from 'antd'; -import '../../../App.css'; -import ImgViewer from '../../apps/release/images/ImgViewer'; +import '../../../../../../../../App.css'; +import ImageViewer from './components/ImageViewer'; import StarRatings from 'react-star-ratings'; import axios from 'axios'; import pSBC from 'shade-blend-color'; -import AppInstallModal from './install/AppInstallModal'; -import AppUninstallModal from './install/AppUninstallModal'; -import { withConfigContext } from '../../../context/ConfigContext'; -import { handleApiError } from '../../../js/Utils'; -import ReviewContainer from './review/ReviewContainer'; -import SubscriptionDetails from './SubscriptionDetails'; +import AppInstallModal from './components/Install'; +import Uninstall from './components/Uninstall'; +import { withConfigContext } from '../../../../../../../../components/context/ConfigContext'; +import { handleApiError } from '../../../../../../../../services/utils/errorHandler'; +import ReviewContainer from './components/ReviewContainer'; +import SubscriptionDetails from './components/SubscriptionDetails'; const { Title, Text, Paragraph } = Typography; const { TabPane } = Tabs; @@ -175,7 +175,7 @@ class ReleaseView extends React.Component { onClose={this.closeAppOperationModal} onInstall={this.appOperation} /> - - + org.apache.maven.plugins maven-checkstyle-plugin + ${maven.checkstyle.vesion} diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml index 7294bc0499..d0a36224ab 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml @@ -32,9 +32,8 @@ true org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.FCMBasedPushNotificationProvider - org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.MQTTBasedPushNotificationProvider - org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.HTTPBasedPushNotificationProvider + org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.HTTPBasedPushNotificationProvider org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.XMPPBasedPushNotificationProvider diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/App.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/App.js index 12074a611e..61cce9fc07 100644 --- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/App.js +++ b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/App.js @@ -150,7 +150,7 @@ class App extends React.Component {
- + {this.props.routes.map(route => ( ))} diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/index.js index 07b2222a9c..90fb75fcd3 100644 --- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/index.js +++ b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/index.js @@ -32,6 +32,18 @@ import AppNotInstalledDevicesReport from './scenes/Home/scenes/Reports/scenes/Ap import Geo from './scenes/Home/scenes/Geo'; import EncryptionStatus from './scenes/Home/scenes/Reports/scenes/EncryptionStatus'; import OutdatedOSversionReport from './scenes/Home/scenes/Reports/scenes/OutdatedOSVersion'; +import Notifications from './scenes/Home/scenes/Notifications'; +import DeviceEnroll from './scenes/Home/scenes/Devices/scenes/Enroll'; +import Groups from './scenes/Home/scenes/Groups'; +import Users from './scenes/Home/scenes/Users'; +import Policies from './scenes/Home/scenes/Policies'; +import AddNewPolicy from './scenes/Home/scenes/Policies/scenes/AddNewPolicy'; +import Roles from './scenes/Home/scenes/Roles'; +import DeviceTypes from './scenes/Home/scenes/DeviceTypes'; +import Certificates from './scenes/Home/scenes/Configurations/scenes/Certificates'; +import Devices from './scenes/Home/scenes/Devices'; +import ViewPolicy from './scenes/Home/scenes/Policies/scenes/ViewPolicy'; +import EditSelectedPolicy from './scenes/Home/scenes/Policies/scenes/EditSelectedPolicy'; const routes = [ { @@ -44,28 +56,18 @@ const routes = [ exact: false, component: Home, routes: [ - // { - // path: '/entgra/devices', - // component: Devices, - // exact: true, - // }, - // { - // path: '/entgra/devices/enroll', - // component: DeviceEnroll, - // exact: true, - // }, - // { - // path: '/entgra/devices', - // component: Devices, - // exact: true, - // }, - // { - // path: '/entgra/devices/enroll', - // component: DeviceEnroll, - // exact: true, - // }, - { - path: '/entgra/geo', + { + path: '/entgra/devices', + component: Devices, + exact: true, + }, + { + path: '/entgra/devices/enroll', + component: DeviceEnroll, + exact: true, + }, + { + path: '/entgra/geo/history/:deviceType/:deviceIdentifier', component: Geo, exact: true, }, @@ -74,41 +76,56 @@ const routes = [ component: Reports, exact: true, }, - // { - // path: '/entgra/groups', - // component: Groups, - // exact: true, - // }, - // { - // path: '/entgra/users', - // component: Users, - // exact: true, - // }, - // { - // path: '/entgra/policies', - // component: Policies, - // exact: true, - // }, - // { - // path: '/entgra/policy/add', - // component: AddNewPolicy, - // exact: true, - // }, - // { - // path: '/entgra/roles', - // component: Roles, - // exact: true, - // }, - // { - // path: '/entgra/devicetypes', - // component: DeviceTypes, - // exact: true, - // }, - // { - // path: '/entgra/certificates', - // component: Certificates, - // exact: true, - // }, + { + path: '/entgra/groups', + component: Groups, + exact: true, + }, + { + path: '/entgra/users', + component: Users, + exact: true, + }, + { + path: '/entgra/policies', + component: Policies, + exact: true, + }, + { + path: '/entgra/policy/add', + component: AddNewPolicy, + exact: true, + }, + { + path: '/entgra/policy/view/:policyId', + component: ViewPolicy, + exact: true, + }, + { + path: '/entgra/policy/edit/:policyId', + component: EditSelectedPolicy, + exact: true, + }, + { + path: '/entgra/roles', + component: Roles, + exact: true, + }, + { + path: '/entgra/devicetypes', + component: DeviceTypes, + exact: true, + }, + { + path: '/entgra/configurations/certificates', + component: Certificates, + exact: true, + }, + { + path: '/entgra/notifications', + component: Notifications, + exact: true, + }, { path: '/entgra/reports/enrollments', component: EnrollmentsVsUnenrollmentsReport, diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/index.js index 529185c8b3..ab941cfb23 100644 --- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/index.js +++ b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/index.js @@ -20,7 +20,6 @@ import React from 'react'; import { Layout, Menu, Icon } from 'antd'; import { Switch, Link } from 'react-router-dom'; import RouteWithSubRoutes from '../../components/RouteWithSubRoutes'; -import { Redirect } from 'react-router'; import './styles.css'; import { withConfigContext } from '../../components/ConfigContext'; import Logout from './components/Logout'; @@ -72,43 +71,23 @@ class Home extends React.Component { marginRight: 110, }} > - {/* */} - {/* */} - {/* Devices*/} - {/* */} - {/* }*/} - {/* >*/} - {/* */} - {/* */} - {/* View*/} - {/* */} - {/* */} - {/* */} - {/* */} - {/* Enroll*/} - {/* */} - {/* */} - {/* */} - - Geo + + Devices } > - - - Single Device View + + + View - - - Device Group View + + + Enroll @@ -118,66 +97,70 @@ class Home extends React.Component { Reports - {/* */} - {/* */} - {/* */} - {/* Groups*/} - {/* */} - {/* */} - {/* */} - {/* */} - {/* */} - {/* Users*/} - {/* */} - {/* */} - {/* */} - {/* */} - {/* Policies*/} - {/* */} - {/* }*/} - {/* >*/} - {/* */} - {/* */} - {/* View*/} - {/* */} - {/* */} - {/* */} - {/* */} - {/* Add New Policy*/} - {/* */} - {/* */} - {/* */} - {/* */} - {/* */} - {/* */} - {/* Roles*/} - {/* */} - {/* */} - {/* */} - {/* */} - {/* */} - {/* Device Types*/} - {/* */} - {/* */} - {/* */} - {/* */} - {/* Configurations*/} - {/* */} - {/* }*/} - {/* >*/} - {/* */} - {/* */} - {/* Certificates*/} - {/* */} - {/* */} - {/* */} - + + + + Groups + + + + + + Users + + + + + Policies + + } + > + + + View + + + + + Add New Policy + + + + + + + Roles + + + + + + Device Types + + + + + Configurations + + } + > + + + Certificates + + + + + + Notifications + + - {this.state.routes.map(route => ( ))} diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Certificates/components/CertificateTable/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Configurations/scenes/Certificates/components/CertificateTable/index.js similarity index 98% rename from components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Certificates/components/CertificateTable/index.js rename to components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Configurations/scenes/Certificates/components/CertificateTable/index.js index f59fb81ffa..cafeaaca99 100644 --- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Certificates/components/CertificateTable/index.js +++ b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Configurations/scenes/Certificates/components/CertificateTable/index.js @@ -30,7 +30,7 @@ import { import TimeAgo from 'javascript-time-ago'; // Load locale-specific relative date/time formatting rules. import en from 'javascript-time-ago/locale/en'; -import { withConfigContext } from '../../../../../../components/ConfigContext'; +import { withConfigContext } from '../../../../../../../../components/ConfigContext'; import Moment from 'react-moment'; const { Paragraph, Text } = Typography; diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Certificates/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Configurations/scenes/Certificates/index.js similarity index 100% rename from components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Certificates/index.js rename to components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Configurations/scenes/Certificates/index.js diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Devices/components/DevicesTable/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Devices/components/DevicesTable/index.js index 11bba00611..e2e1a2b778 100644 --- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Devices/components/DevicesTable/index.js +++ b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Devices/components/DevicesTable/index.js @@ -33,6 +33,7 @@ import TimeAgo from 'javascript-time-ago'; import en from 'javascript-time-ago/locale/en'; import { withConfigContext } from '../../../../../../components/ConfigContext'; import BulkActionBar from './components/BulkActionBar'; +import { Link } from 'react-router-dom'; let config = null; @@ -126,6 +127,20 @@ const columns = [ }, // todo add filtering options }, + { + title: '', + dataIndex: 'deviceIdentifier', + key: 'actions', + // eslint-disable-next-line react/display-name + render: (data, row) => { + const { type, deviceIdentifier } = row; + return ( + + Location History + + ); + }, + }, ]; const getTimeAgo = time => { diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Geo/components/CustomMap/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Geo/components/CustomMap/index.js index 9dc2722e0f..7b3a88bfc2 100644 --- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Geo/components/CustomMap/index.js +++ b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Geo/components/CustomMap/index.js @@ -57,60 +57,42 @@ class CustomMap extends Component { /** * Polyline draw for historical locations - * @param locationData - location data object + * @param locationHistorySnapshots - location data object * @returns content */ - polylineMarker = locationData => { - const locationPoints = [...locationData]; + polylineMarker = locationHistorySnapshots => { const polyLines = []; + locationHistorySnapshots.forEach(locationHistorySnapshots => { + polyLines.push( + { + return [snapshot.latitude, snapshot.longitude]; + })} + smoothFactor={10} + weight={5} + />, + ); + }); - while (locationPoints.length > 0) { - // Array to store positions for next polyline - const positions = []; - // Make a copy of remaining location points - const cachedLocationPoints = [...locationPoints]; - // Iterate the remaining cached locations - for (let i = 0; i < cachedLocationPoints.length; i++) { - positions.push([ - cachedLocationPoints[i].latitude, - cachedLocationPoints[i].longitude, - ]); - const currentPoint = cachedLocationPoints[i]; - // Remove the current location from the locationPoints - locationPoints.shift(); - if (i < cachedLocationPoints.length - 1) { - const nextPoint = cachedLocationPoints[i + 1]; - // Draw a dashed line for long for location points with long interval - if ( - nextPoint.timestamp - currentPoint.timestamp > - this.props.context.geoMap.timeout * 1000 - ) { - // Create a dashed line - polyLines.push( - , - ); - break; - } - } - } - // Create a polyline from provided positions + for (let i = 1; i < locationHistorySnapshots.length; i++) { + const startPosition = locationHistorySnapshots[i][0]; + const endingPosition = + locationHistorySnapshots[i - 1][ + locationHistorySnapshots[i - 1].length - 1 + ]; polyLines.push( , ); } @@ -125,22 +107,23 @@ class CustomMap extends Component { }; render() { - const locationData = this.props.locationData; + const locationHistorySnapshots = this.props.locationHistorySnapshots; const config = this.props.context; const attribution = config.geoMap.attribution; const url = config.geoMap.url; - const startingPoint = [locationData[0].latitude, locationData[0].longitude]; - const endPoint = [ - locationData[locationData.length - 1].latitude, - locationData[locationData.length - 1].longitude, - ]; + const firstSnapshot = locationHistorySnapshots[0][0]; + const lastSnapshotList = + locationHistorySnapshots[locationHistorySnapshots.length - 1]; + const lastSnapshot = lastSnapshotList[lastSnapshotList.length - 1]; + const startingPoint = [firstSnapshot.latitude, firstSnapshot.longitude]; + const endPoint = [lastSnapshot.latitude, lastSnapshot.longitude]; const zoom = config.geoMap.defaultZoomLevel; return (
- {this.polylineMarker(locationData)} + {this.polylineMarker(locationHistorySnapshots)} Start diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Geo/components/GeoDashboard/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Geo/components/GeoDashboard/index.js index 410ce58a90..d8f5951d0a 100644 --- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Geo/components/GeoDashboard/index.js +++ b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Geo/components/GeoDashboard/index.js @@ -18,16 +18,7 @@ import React from 'react'; import moment from 'moment'; -import { - Button, - Select, - message, - notification, - Tag, - Tooltip, - Empty, - DatePicker, -} from 'antd'; +import { message, notification, Empty, DatePicker } from 'antd'; import axios from 'axios'; import { withConfigContext } from '../../../../../../components/ConfigContext'; import GeoCustomMap from '../CustomMap'; @@ -53,7 +44,7 @@ class GeoDashboard extends React.Component { this.state = { deviceData: [], selectedDevice: '', - locationData: [], + locationHistorySnapshots: [], loading: false, start: start, end: end, @@ -62,119 +53,23 @@ class GeoDashboard extends React.Component { } componentDidMount() { - this.fetchDevices(); - // this.fetchCurrentLocation(); + this.fetchLocationHistory(); } - /** * Call back on apply button in the date time picker * @param startDate - start date * @param endDate - end date */ applyCallback = (dates, dateStrings) => { - console.log('Apply Callback'); this.setState({ start: dateStrings[0], end: dateStrings[1], }); }; - /** - * Api call handle on fetch location date button - */ - handleApiCall = () => { - if (this.state.selectedDevice && this.state.start && this.state.end) { - const toInMills = moment(this.state.end); - const fromInMills = moment(this.state.start); - const deviceType = this.state.selectedDevice.type; - const deviceId = this.state.selectedDevice.deviceIdentifier; - const config = this.props.context; - this.setState({ loading: true }); - - axios - .get( - window.location.origin + - config.serverConfig.invoker.uri + - config.serverConfig.invoker.deviceMgt + - '/devices/' + - deviceType + - '/' + - deviceId + - '/location-history?' + - 'from=' + - fromInMills + - '&to=' + - toInMills, - ) - .then(res => { - if (res.status === 200) { - const locationData = JSON.parse(res.data.data); - this.setState({ - loading: false, - locationData, - }); - } - }) - .catch(error => { - if ( - error.hasOwnProperty('response') && - error.response.status === 401 - ) { - message.error('You are not logged in'); - window.location.href = window.location.origin + '/entgra/login'; - } else { - notification.error({ - message: 'There was a problem', - duration: 0, - description: - 'Error occurred while trying to fetch locations......', - }); - } - - this.setState({ loading: false }); - console.log(error); - }); - } else { - notification.error({ - message: 'There was a problem', - duration: 0, - description: 'Please provide a date range and a device.', - }); - } - }; - - /** - * Device dropdown list handler - * @param e - selected device data - */ - handleDeviceList = e => { - let selectedDevice = this.state.deviceData[e]; - this.setState({ selectedDevice }); - }; - - /** - * render fetch location button - */ - fetchLocationButton = () => { - let flag; - let toolTip = ''; - if (this.state.selectedDevice === '') { - flag = true; - toolTip = 'Please select a Device'; - } - return ( - - - - ); - }; - - /** - * fetches device data to populate the dropdown list - */ - fetchDevices = () => { + fetchLocationHistory = () => { + const toInMills = moment(this.state.end); + const fromInMills = moment(this.state.start); const config = this.props.context; this.setState({ loading: true }); @@ -183,14 +78,21 @@ class GeoDashboard extends React.Component { window.location.origin + config.serverConfig.invoker.uri + config.serverConfig.invoker.deviceMgt + - '/devices?status=ACTIVE&status=INACTIVE&status=UNCLAIMED&status=UNREACHABLE&status=SUSPENDED&' + - 'status=DISENROLLMENT_REQUESTED&status=BLOCKED&status=CREATED', + '/devices/' + + this.props.deviceType + + '/' + + this.props.deviceIdentifier + + '/location-history?' + + 'from=' + + fromInMills + + '&to=' + + toInMills, ) .then(res => { if (res.status === 200) { this.setState({ loading: false, - deviceData: res.data.data.devices, + locationHistorySnapshots: res.data.data.locationHistorySnapshots, }); } }) @@ -202,11 +104,12 @@ class GeoDashboard extends React.Component { notification.error({ message: 'There was a problem', duration: 0, - description: 'Error occurred while trying to load devices.', + description: 'Error occurred while trying to fetch locations......', }); } this.setState({ loading: false }); + console.log(error); }); }; @@ -235,76 +138,29 @@ class GeoDashboard extends React.Component { '1 Month': [moment(start).subtract(1, 'months'), moment(end)], }; - let { deviceData } = this.state; - return (
- - - - {this.fetchLocationButton()}
); }; - /** - * Creates color based tags on device status - * @param device - device object - */ - statusTag = device => { - const status = device.enrolmentInfo.status.toLowerCase(); - let color = '#f9ca24'; - switch (status) { - case 'active': - color = '#badc58'; - break; - case 'created': - color = '#6ab04c'; - break; - case 'inactive': - color = '#f9ca24'; - break; - case 'blocked': - color = '#636e72'; - break; - } - - return {status}; - }; - render() { - const locationData = [...this.state.locationData]; - + const { locationHistorySnapshots } = this.state; return (
{this.controllerBar()} - {locationData.length > 0 ? ( - + {locationHistorySnapshots.length > 0 ? ( + ) : ( )} diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Geo/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Geo/index.js index e82b13133b..c313b91252 100644 --- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Geo/index.js +++ b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Geo/index.js @@ -32,6 +32,7 @@ class Geo extends React.Component { } render() { + const { deviceIdentifier, deviceType } = this.props.match.params; return (
@@ -41,11 +42,14 @@ class Geo extends React.Component { Home - Geo + + Devices + + {`Location History - ${deviceType} / ${deviceIdentifier}`}
-

Geo

- Geo Location Service +

Location History

+ {`${deviceType} / ${deviceIdentifier}`}
- +
); diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Notifications/Components/NotificationsTable/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Notifications/Components/NotificationsTable/index.js new file mode 100644 index 0000000000..2b5b2bfc66 --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Notifications/Components/NotificationsTable/index.js @@ -0,0 +1,197 @@ +/* + * Copyright (c) 2020, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved. + * + * Entgra (pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import React from 'react'; +import axios from 'axios'; +import { Icon, Table } from 'antd'; +import TimeAgo from 'javascript-time-ago'; +// Load locale-specific relative date/time formatting rules. +import en from 'javascript-time-ago/locale/en'; +import { withConfigContext } from '../../../../../../components/ConfigContext'; +import { handleApiError } from '../../../../../../services/utils/errorHandler'; + +let config = null; + +const columns = [ + { + title: 'Device', + dataIndex: 'deviceName', + width: 100, + sorter: (a, b) => a.deviceName.localeCompare(b.deviceName), + }, + { + title: 'Type', + dataIndex: 'deviceType', + key: 'type', + // eslint-disable-next-line react/display-name + render: type => { + const defaultPlatformIcons = config.defaultPlatformIcons; + let icon = defaultPlatformIcons.default.icon; + let color = defaultPlatformIcons.default.color; + let theme = defaultPlatformIcons.default.theme; + + if (defaultPlatformIcons.hasOwnProperty(type)) { + icon = defaultPlatformIcons[type].icon; + color = defaultPlatformIcons[type].color; + theme = defaultPlatformIcons[type].theme; + } + + return ( + + + + ); + }, + }, + { + title: 'Description', + dataIndex: 'description', + key: 'description', + }, +]; + +class NotificationsTable extends React.Component { + constructor(props) { + super(props); + config = this.props.context; + TimeAgo.addLocale(en); + this.state = { + data: [], + pagination: {}, + loading: false, + selectedRows: [], + paramsObj: {}, + }; + } + + rowSelection = { + onChange: (selectedRowKeys, selectedRows) => { + this.setState({ + selectedRows: selectedRows, + }); + }, + }; + + componentDidMount() { + this.fetchData(); + } + + // Rerender component when parameters change + componentDidUpdate(prevProps, prevState, snapshot) { + if (prevProps.notificationType !== this.props.notificationType) { + this.fetchData(); + } + } + + // fetch data from api + fetchData = (params = {}) => { + // const policyReportData = this.props; + this.setState({ loading: true }); + // get current page + const currentPage = params.hasOwnProperty('page') ? params.page : 1; + + let extraParams; + + extraParams = { + offset: 10 * (currentPage - 1), // calculate the offset + limit: 10, + }; + + const encodedExtraParams = Object.keys(extraParams) + .map(key => key + '=' + extraParams[key]) + .join('&'); + + let apiUrl; + + if (this.props.notificationType === 'unread') { + apiUrl = + window.location.origin + + config.serverConfig.invoker.uri + + config.serverConfig.invoker.deviceMgt + + '/notifications?status=NEW&' + + encodedExtraParams; + } else { + apiUrl = + window.location.origin + + config.serverConfig.invoker.uri + + config.serverConfig.invoker.deviceMgt + + '/notifications?' + + encodedExtraParams; + } + + // send request to the invoker + axios + .get(apiUrl) + .then(res => { + if (res.status === 200) { + const pagination = { ...this.state.pagination }; + this.setState({ + loading: false, + data: res.data.data, + pagination, + }); + } + }) + .catch(error => { + handleApiError(error, 'Error occurred while trying to load devices.'); + this.setState({ loading: false }); + }); + }; + + handleTableChange = (pagination, filters, sorter) => { + const pager = { ...this.state.pagination }; + pager.current = pagination.current; + this.setState({ + pagination: pager, + }); + this.fetchData({ + results: pagination.pageSize, + page: pagination.current, + sortField: sorter.field, + sortOrder: sorter.order, + ...filters, + }); + }; + + render() { + let { data, pagination, loading } = this.state; + + return ( +
+ record.id} + dataSource={data.notifications} + pagination={{ + ...pagination, + size: 'small', + // position: "top", + total: data.count, + showTotal: (total, range) => + `showing ${range[0]}-${range[1]} of ${total} notifications`, + }} + loading={loading} + onChange={this.handleTableChange} + rowSelection={this.rowSelection} + /> + + ); + } +} + +export default withConfigContext(NotificationsTable); diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Notifications/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Notifications/index.js new file mode 100644 index 0000000000..456c3a9dab --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Notifications/index.js @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2020, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved. + * + * Entgra (pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import React from 'react'; +import { + message, + notification, + Button, + PageHeader, + Breadcrumb, + Icon, + Radio, +} from 'antd'; +import { withConfigContext } from '../../../../components/ConfigContext'; +import axios from 'axios'; +import { Link } from 'react-router-dom'; + +import NotificationsTable from './Components/NotificationsTable'; + +class Notifications extends React.Component { + constructor(props) { + super(props); + this.state = { + visible: false, + data: [], + notificationType: 'all', + }; + } + + handleModeChange = e => { + const notificationType = e.target.value; + this.setState({ notificationType }); + }; + + clearNotifications = () => { + const config = this.props.context; + axios + .put( + window.location.origin + + config.serverConfig.invoker.uri + + config.serverConfig.invoker.deviceMgt + + '/notifications/clear-all', + { 'Content-Type': 'application/json; charset=utf-8' }, + ) + .then(res => { + if (res.status === 200) { + notification.success({ + message: 'Done', + duration: 0, + description: 'All notifications are cleared.', + }); + } + }) + .catch(error => { + if (error.hasOwnProperty('response') && error.response.status === 401) { + // todo display a popop with error + message.error('You are not logged in'); + window.location.href = window.location.origin + '/entgra/login'; + } else { + notification.error({ + message: 'There was a problem', + duration: 0, + description: 'Error occurred while trying to clear notifications.', + }); + } + }); + }; + + render() { + const { notificationType } = this.state; + return ( +
+ + + + + Home + + + Notifications + +
+

DEVICE NOTIFICATIONS

+ + All Notifications + Unread Notifications + + +
+ +
+
+
+
+
+ ); + } +} + +export default withConfigContext(Notifications); diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/AddPolicy/components/AssignGroups/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/AddPolicy/components/AssignGroups/index.js new file mode 100644 index 0000000000..e90d0fa9dd --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/AddPolicy/components/AssignGroups/index.js @@ -0,0 +1,260 @@ +/* + * Copyright (c) 2020, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved. + * + * Entgra (pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import React from 'react'; +import { withConfigContext } from '../../../../../../../../components/ConfigContext'; +import { Button, Col, Form, message, notification, Radio, Select } from 'antd'; +import axios from 'axios'; +const { Option } = Select; + +class AssignGroups extends React.Component { + constructor(props) { + super(props); + this.config = this.props.context; + this.userSelector = React.createRef(); + this.roleSelector = React.createRef(); + this.state = { + roles: [], + users: [], + groups: [], + }; + } + componentDidMount() { + this.getRolesList(); + this.getGroupsList(); + } + + handleSetUserRoleFormItem = event => { + if (event.target.value === 'roleSelector') { + this.roleSelector.current.style.cssText = 'display: block;'; + this.userSelector.current.style.cssText = 'display: none;'; + } else { + this.roleSelector.current.style.cssText = 'display: none;'; + this.userSelector.current.style.cssText = 'display: block;'; + } + }; + + // generate payload by adding Assign Groups + onHandleContinue = (e, formName) => { + this.props.form.validateFields((err, values) => { + if (!err) { + if (typeof values.roles === 'string') { + values.roles = [values.roles]; + } + if (!values.users) { + delete values.users; + } + + if (values.deviceGroups === 'NONE') { + delete values.deviceGroups; + } + + this.props.getPolicyPayloadData(formName, values); + this.props.getNextStep(); + } + }); + }; + + getRolesList = () => { + let apiURL = + window.location.origin + + this.config.serverConfig.invoker.uri + + this.config.serverConfig.invoker.deviceMgt + + '/roles?user-store=PRIMARY&limit=100'; + + axios + .get(apiURL) + .then(res => { + if (res.status === 200) { + this.setState({ + roles: res.data.data.roles, + }); + } + }) + .catch(error => { + if (error.hasOwnProperty('response') && error.response.status === 401) { + // todo display a popop with error + + message.error('You are not logged in'); + window.location.href = window.location.origin + '/entgra/login'; + } else { + notification.error({ + message: 'There was a problem', + duration: 0, + description: 'Error occurred while trying to load roles.', + }); + } + }); + }; + + getUsersList = value => { + let apiURL = + window.location.origin + + this.config.serverConfig.invoker.uri + + this.config.serverConfig.invoker.deviceMgt + + '/users/search/usernames?filter=' + + value + + '&domain=Primary'; + axios + .get(apiURL) + .then(res => { + if (res.status === 200) { + let users = JSON.parse(res.data.data); + this.setState({ + users, + }); + } + }) + .catch(error => { + if (error.hasOwnProperty('response') && error.response.status === 401) { + // todo display a popop with error + message.error('You are not logged in'); + window.location.href = window.location.origin + '/entgra/login'; + } else { + notification.error({ + message: 'There was a problem', + duration: 0, + description: 'Error occurred while trying to load users.', + }); + } + }); + }; + + // fetch data from api + getGroupsList = () => { + let apiUrl = + window.location.origin + + this.config.serverConfig.invoker.uri + + this.config.serverConfig.invoker.deviceMgt + + '/admin/groups'; + + // send request to the invokerss + axios + .get(apiUrl) + .then(res => { + if (res.status === 200) { + this.setState({ + groups: res.data.data.deviceGroups, + }); + } + }) + .catch(error => { + if (error.hasOwnProperty('response') && error.response.status === 401) { + // todo display a popop with error + message.error('You are not logged in'); + window.location.href = window.location.origin + '/entgra/login'; + } else { + notification.error({ + message: 'There was a problem', + duration: 0, + description: 'Error occurred while trying to load device groups.', + }); + } + }); + }; + + render() { + const { getFieldDecorator } = this.props.form; + return ( +
+
+ + Set User role(s) + Set User(s) + +
+ + {getFieldDecorator('roles', { + initialValue: 'ANY', + })( + , + )} + +
+
+ + {getFieldDecorator('users', {})( + , + )} + +
+
+ + {getFieldDecorator('deviceGroups', { + initialValue: 'NONE', + })( + , + )} + +
+
+ + +
+ + + ); + } +} + +export default withConfigContext(Form.create()(AssignGroups)); diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/AddPolicy/components/ConfigureProfile/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/AddPolicy/components/ConfigureProfile/index.js index c28046d100..9e6fedb7e9 100644 --- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/AddPolicy/components/ConfigureProfile/index.js +++ b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/AddPolicy/components/ConfigureProfile/index.js @@ -45,6 +45,8 @@ const { TabPane } = Tabs; const { Option } = Select; const { TextArea } = Input; +const subPanelpayloadAttributes = {}; + class ConfigureProfile extends React.Component { constructor(props) { super(props); @@ -54,6 +56,8 @@ class ConfigureProfile extends React.Component { isDisplayMain: 'none', activePanelKeys: [], activeSubPanelKeys: [], + subFormList: [], + subPanelpayloadAttributes: {}, count: 0, dataArray: [], customInputDataArray: [], @@ -62,8 +66,6 @@ class ConfigureProfile extends React.Component { }; } - componentDidMount() {} - // convert time from 24h format to 12h format timeConverter = time => { time = time @@ -297,9 +299,66 @@ class ConfigureProfile extends React.Component { return columns; }; + // generate payload by adding policy configurations + onHandleContinue = (e, formname) => { + const allFields = this.props.form.getFieldsValue(); + let activeFields = []; + // get currently active field list + for (let i = 0; i < this.state.activePanelKeys.length; i++) { + Object.keys(allFields).map(key => { + if (key.includes(`${this.state.activePanelKeys[i]}-`)) { + if ( + subPanelpayloadAttributes.hasOwnProperty( + `${this.state.activePanelKeys[i]}`, + ) + ) { + Object.keys( + subPanelpayloadAttributes[this.state.activePanelKeys[i]], + ).map(subPanel => { + if (`${this.state.activePanelKeys[i]}-${subPanel}` === true) { + if (key.includes(`-${subPanel}-`)) { + activeFields.push(key); + } + } else if (!key.includes(`-${subPanel}-`)) { + activeFields.push(key); + } + }); + } else { + activeFields.push(key); + } + } + }); + } + // validate fields and get profile features list + this.props.form.validateFields(activeFields, (err, values) => { + if (!err) { + let profileFeaturesList = []; + for (let i = 0; i < this.state.activePanelKeys.length; i++) { + let content = {}; + Object.entries(values).map(([key, value]) => { + if (key.includes(`${this.state.activePanelKeys[i]}-`)) { + content[ + key.replace(`${this.state.activePanelKeys[i]}-`, '') + ] = value; + } + }); + let feature = { + featureCode: this.state.activePanelKeys[i], + deviceType: 'android', + content: content, + }; + profileFeaturesList.push(feature); + } + this.props.getPolicyPayloadData(formname, profileFeaturesList); + this.props.getNextStep(); + } + }); + }; + // generate form items - getPanelItems = panel => { + getPanelItems = (panel, panelId) => { const { getFieldDecorator } = this.props.form; + const subPanelList = {}; return panel.map((item, k) => { switch (item.type) { case 'select': @@ -399,7 +458,6 @@ class ConfigureProfile extends React.Component { style={{ display: 'block' }} > {getFieldDecorator(`${item.id}`, { - // valuePropName: 'option', initialValue: item.optional.initialDataIndex, })(