- );
- }
-}
-
-export default withConfigContext(Home);
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Configurations/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
deleted file mode 100644
index cafeaaca99..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Configurations/scenes/Certificates/components/CertificateTable/index.js
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * 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,
- message,
- notification,
- Popconfirm,
- Table,
- Tooltip,
- Typography,
-} 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 Moment from 'react-moment';
-
-const { Paragraph, Text } = Typography;
-
-let config = null;
-
-class CertificateTable extends React.Component {
- constructor(props) {
- super(props);
- config = this.props.context;
- TimeAgo.addLocale(en);
- this.state = {
- data: [],
- pagination: {},
- loading: false,
- };
- }
-
- componentDidMount() {
- this.fetch();
- }
-
- // fetch data from api
- fetch = (params = {}) => {
- this.setState({ loading: true });
- // get current page
- const currentPage = params.hasOwnProperty('page') ? params.page : 1;
-
- const extraParams = {
- offset: 10 * (currentPage - 1), // calculate the offset
- limit: 10,
- };
-
- const encodedExtraParams = Object.keys(extraParams)
- .map(key => key + '=' + extraParams[key])
- .join('&');
-
- // send request to the invoker
- axios
- .get(
- window.location.origin +
- config.serverConfig.invoker.uri +
- '/certificate-mgt/v1.0/admin/certificates' +
- encodedExtraParams,
- )
- .then(res => {
- if (res.status === 200) {
- const pagination = { ...this.state.pagination };
- this.setState({
- loading: false,
- data: res.data.data.certificates,
- pagination,
- });
- }
- })
- .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 devices.',
- });
- }
-
- this.setState({ loading: false });
- });
- };
-
- handleTableChange = (pagination, filters, sorter) => {
- const pager = { ...this.state.pagination };
- pager.current = pagination.current;
- this.setState({
- pagination: pager,
- });
- this.fetch({
- results: pagination.pageSize,
- page: pagination.current,
- sortField: sorter.field,
- sortOrder: sorter.order,
- ...filters,
- });
- };
-
- deleteCertificate = serialNumber => {
- axios
- .delete(
- window.location.origin +
- config.serverConfig.invoker.uri +
- '/certificate-mgt/v1.0/admin/certificates/' +
- serialNumber,
- { headers: { 'Content-Type': 'application/json' } },
- )
- .then(res => {
- if (res.status === 200) {
- this.fetch();
- notification.success({
- message: 'Done',
- duration: 4,
- description: 'Successfully deleted the certificate.',
- });
- }
- })
- .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 delete the certificate.',
- });
- }
- });
- };
-
- columns = [
- {
- title: 'Serial Number',
- dataIndex: 'serialNumber',
- },
- {
- title: 'Username',
- dataIndex: 'username',
- },
- {
- title: 'Certificate Version',
- dataIndex: 'certificateVersion',
- },
- {
- title: 'Certificate Serial',
- dataIndex: 'certificateserial',
- },
- {
- title: 'Not Before',
- dataIndex: 'notBefore',
- render: notBefore => (
-
- ),
- },
- {
- title: 'Not After',
- dataIndex: 'notAfter',
- render: notAfter => ,
- },
- {
- title: 'Subject',
- dataIndex: 'subject',
- render: subject => (
-
- {subject}
-
- ),
- },
- {
- title: 'Issuer',
- dataIndex: 'issuer',
- render: issuer => (
-
- {issuer}
-
- ),
- },
- {
- title: 'Actions',
- key: 'actions',
- dataIndex: 'serialNumber',
- render: serialNumber => (
-
- {
- this.deleteCertificate(serialNumber);
- }}
- okText="Ok"
- cancelText="Cancel"
- >
-
-
-
-
-
-
-
- ),
- },
- ];
-
- render() {
- const { data, pagination, loading } = this.state;
-
- return (
-
-
-
record.serialNumber}
- dataSource={data}
- pagination={{
- ...pagination,
- size: 'small',
- // position: "top",
- showTotal: (total, range) =>
- `showing ${range[0]}-${range[1]} of ${total} devices`,
- // showQuickJumper: true
- }}
- loading={loading}
- onChange={this.handleTableChange}
- />
-
-
- );
- }
-}
-
-export default withConfigContext(CertificateTable);
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Configurations/scenes/Certificates/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Configurations/scenes/Certificates/index.js
deleted file mode 100644
index f4bdc4862a..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Configurations/scenes/Certificates/index.js
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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 { PageHeader, Typography, Breadcrumb, Icon } from 'antd';
-import { Link } from 'react-router-dom';
-import CertificateTable from './components/CertificateTable';
-
-const { Paragraph } = Typography;
-
-class Certificates extends React.Component {
- routes;
-
- constructor(props) {
- super(props);
- this.routes = props.routes;
- }
-
- render() {
- return (
-
- );
- }
-}
-
-export default withConfigContext(Index);
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/DeviceTypes/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/DeviceTypes/index.js
deleted file mode 100644
index 2ef4b495a3..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/DeviceTypes/index.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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 { PageHeader, Typography, Breadcrumb, Icon } from 'antd';
-import { Link } from 'react-router-dom';
-import DeviceTypesTable from './components/DeviceTypesTable';
-
-const { Paragraph } = Typography;
-
-class DeviceTypes extends React.Component {
- routes;
-
- constructor(props) {
- super(props);
- this.routes = props.routes;
- }
-
- render() {
- return (
-
-
-
-
-
- Home
-
-
- Device Types
-
-
-
Device Types
- All device types for device management.
-
-
-
-
-
-
-
- );
- }
-}
-
-export default DeviceTypes;
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Devices/components/DevicesTable/components/BulkActionBar/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Devices/components/DevicesTable/components/BulkActionBar/index.js
deleted file mode 100644
index f55d6b2440..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Devices/components/DevicesTable/components/BulkActionBar/index.js
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * 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 { Button, Tooltip, Popconfirm, Divider } from 'antd';
-
-class BulkActionBar extends React.Component {
- constructor(props) {
- super(props);
- this.state = {
- selectedMultiple: false,
- selectedSingle: false,
- canDelete: true,
- };
- }
-
- // This method checks whether NON-REMOVED devices are selected
- onDeleteDeviceCall = () => {
- let tempDeleteState;
- for (let i = 0; i < this.props.selectedRows.length; i++) {
- if (this.props.selectedRows[i].enrolmentInfo.status != 'REMOVED') {
- tempDeleteState = false;
- break;
- }
- tempDeleteState = true;
- }
- this.setState({ canDelete: tempDeleteState });
- };
-
- onConfirmDelete = () => {
- if (this.state.canDelete) {
- this.props.deleteDevice();
- }
- };
-
- onConfirmDisenroll = () => {
- this.props.disenrollDevice();
- };
-
- onDeviceGroupCall = () => {
- this.props.getGroups();
- };
-
- render() {
- const isSelected = this.props.selectedRows.length > 0;
- const isSelectedSingle = this.props.selectedRows.length == 1;
-
- return (
-
-
-
-
- );
- }
-}
-
-export default withConfigContext(DeviceTable);
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Devices/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Devices/index.js
deleted file mode 100644
index 542fb88ec6..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Devices/index.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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 { PageHeader, Typography, Breadcrumb, Icon } from 'antd';
-import { Link } from 'react-router-dom';
-import DeviceTable from './components/DevicesTable';
-
-const { Paragraph } = Typography;
-
-class Devices extends React.Component {
- routes;
-
- constructor(props) {
- super(props);
- this.routes = props.routes;
- }
-
- render() {
- return (
-
-
-
-
-
- Home
-
-
- Devices
-
-
-
Devices
- All enrolled devices
-
-
-
-
-
-
-
- );
- }
-}
-
-export default Devices;
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Devices/scenes/Enroll/components/AddDevice/components/DeviceType/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Devices/scenes/Enroll/components/AddDevice/components/DeviceType/index.js
deleted file mode 100644
index f9ec0718c6..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Devices/scenes/Enroll/components/AddDevice/components/DeviceType/index.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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 { Card, Col, Icon, Row } 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';
-
-class DeviceType extends React.Component {
- constructor(props) {
- super(props);
- TimeAgo.addLocale(en);
- this.config = this.props.context;
- this.state = {
- data: this.config.deviceTypes,
- pagination: {},
- loading: false,
- selectedRows: [],
- };
- }
-
- onClickCard = (e, deviceType) => {
- this.props.getDeviceType(deviceType);
- };
-
- render() {
- const { data } = this.state;
- const { Meta } = Card;
- const itemCard = data.map(data => (
-
- );
- }
-}
-
-export default withConfigContext(DeviceType);
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Devices/scenes/Enroll/components/AddDevice/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Devices/scenes/Enroll/components/AddDevice/index.js
deleted file mode 100644
index a0bfb21a53..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Devices/scenes/Enroll/components/AddDevice/index.js
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * 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 { Form, Row, Col, Card, Steps } from 'antd';
-import { withConfigContext } from '../../../../../../../../components/ConfigContext';
-import DeviceType from './components/DeviceType';
-import SelectEnrollmentType from '../SelectEnrolmentType';
-import EnrollDevice from '../EnrollDevice';
-import DownloadAgent from '../DownloadAgent';
-const { Step } = Steps;
-
-class AddDevice extends React.Component {
- constructor(props) {
- super(props);
- this.config = this.props.context;
- this.state = {
- isAddDeviceModalVisible: false,
- current: 0,
- deviceType: 'android',
- enrollmentType: 'qr',
- };
- }
-
- getDeviceType = deviceType => {
- this.setState({
- current: 1,
- deviceType: deviceType,
- });
- };
-
- goNext = () => {
- this.setState({
- current: 2,
- });
- };
-
- goBackToDeviceType = () => {
- this.setState({
- current: 0,
- });
- };
-
- goBackToDownloadAgent = () => {
- this.setState({
- current: 1,
- });
- };
-
- goBackToEnrollmentType = () => {
- this.setState({
- current: 2,
- });
- };
-
- getEnrollmentData = enrollmentType => {
- this.setState({
- current: 3,
- enrollmentType: enrollmentType,
- });
- };
-
- render() {
- const { current, deviceType, enrollmentType } = this.state;
- return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- );
- }
-}
-
-export default withConfigContext(
- Form.create({ name: 'add-device' })(AddDevice),
-);
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Devices/scenes/Enroll/components/DownloadAgent/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Devices/scenes/Enroll/components/DownloadAgent/index.js
deleted file mode 100644
index 8a628ee439..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Devices/scenes/Enroll/components/DownloadAgent/index.js
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * 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 { Button, Card, Divider, message, notification } from 'antd';
-import TimeAgo from 'javascript-time-ago/modules/JavascriptTimeAgo';
-import en from 'javascript-time-ago/locale/en';
-import axios from 'axios';
-import { withConfigContext } from '../../../../../../../../components/ConfigContext';
-import QRCode from 'qrcode.react';
-
-class DownloadAgent extends React.Component {
- constructor(props) {
- super(props);
- this.config = this.props.context;
- TimeAgo.addLocale(en);
- this.state = {
- pagination: {},
- loading: false,
- selectedRows: [],
- buttonTitle: 'Download Agent',
- skipButtonTitle: 'Skip',
- };
- }
-
- onClickSkip = () => {
- this.props.goNext();
- };
-
- onClickGoBack = () => {
- this.props.goBack();
- };
-
- onClickDownloadAgent = () => {
- this.downloadAgent();
- };
-
- // fetch data from api
- downloadAgent = () => {
- const { deviceType } = this.props;
- this.setState({ loading: true, buttonTitle: 'Downloading..' });
-
- const apiUrl =
- window.location.origin +
- '/api/application-mgt/v1.0/artifact/' +
- deviceType +
- '/agent/-1234';
-
- // send request to the invokerss
- axios
- .get(apiUrl)
- .then(res => {
- if (res.status === 200) {
- // Download file in same window
- const url = window.URL.createObjectURL(new Blob([res.data]));
- const link = document.createElement('a');
- link.href = url;
- link.setAttribute('download', 'android-agent.apk'); // or any other extension
- document.body.appendChild(link);
- link.click();
- this.setState({
- loading: false,
- buttonTitle: 'Download Agent',
- skipButtonTitle: 'Next',
- });
- }
- })
- .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 download Entgra Android Agent',
- });
- }
-
- this.setState({ loading: false });
- });
- };
-
- render() {
- const { loading, buttonTitle, skipButtonTitle } = this.state;
- const { deviceType } = this.props;
-
- const apiUrl =
- window.location.origin +
- '/api/application-mgt/v1.0/artifact/' +
- deviceType +
- '/agent/-1234';
- return (
-
- Step 01 - Get your Android Agent.
-
-
- The Android agent can be downloaded by using following QR. The
- generated QR code can be scanned, and the agent APK downloaded from
- the link, and transferred to the device and then installed.
-
- );
- }
-}
-
-export default withConfigContext(DownloadAgent);
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Devices/scenes/Enroll/components/EnrollDevice/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Devices/scenes/Enroll/components/EnrollDevice/index.js
deleted file mode 100644
index 72a63ea8ac..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Devices/scenes/Enroll/components/EnrollDevice/index.js
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * 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 {
- Divider,
- message,
- notification,
- Select,
- Card,
- Spin,
- Button,
- Row,
- Col,
-} from 'antd';
-import TimeAgo from 'javascript-time-ago/modules/JavascriptTimeAgo';
-import en from 'javascript-time-ago/locale/en';
-import { withConfigContext } from '../../../../../../../../components/ConfigContext';
-import axios from 'axios';
-import QRCode from 'qrcode.react';
-import QRPlaceholder from '../../../../../../../../../public/images/qr-code.png';
-import installAgent from '../../../../../../../../../public/images/install_agent.png';
-import register from '../../../../../../../../../public/images/register.png';
-import registration from '../../../../../../../../../public/images/registration.png';
-import setProfile from '../../../../../../../../../public/images/set_profile.png';
-
-const { Option } = Select;
-
-class EnrollDevice extends React.Component {
- constructor(props) {
- super(props);
- this.config = this.props.context;
- TimeAgo.addLocale(en);
- this.state = {
- isSelected: false,
- loading: false,
- payload: {},
- };
- }
-
- // fetch data from api
- generateQRCode = ownershipType => {
- const { deviceType } = this.props;
- this.setState({ loading: true });
-
- let apiUrl =
- window.location.origin +
- this.config.serverConfig.invoker.uri +
- '/device-mgt/' +
- deviceType +
- '/v1.0/configuration/enrollment-qr-config/' +
- ownershipType;
-
- // send request to the invokerss
- axios
- .get(apiUrl)
- .then(res => {
- if (res.status === 200) {
- this.setState({
- loading: false,
- payload: res.data.data,
- isSelected: true,
- });
- }
- })
- .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 get QR code payload.',
- });
- }
-
- this.setState({ loading: false });
- });
- };
-
- onChange = value => {
- this.generateQRCode(value);
- };
-
- onClick = () => {
- this.props.goBack();
- };
-
- render() {
- const { payload, isSelected, loading } = this.state;
- const { enrollmentType } = this.props;
- return (
-
-
-
-
-
Step 1
-
- {/* eslint-disable-next-line react/no-unescaped-entities */}
- Let's start by installing the Android agent on your device. Open
- the downloaded file, and tap INSTALL.
-
-
-
-
-
Step 2
-
Tap Skip to proceed with the default enrollment process.
-
-
-
-
Step 3
-
- Enter the server address based on your environment, in the text
- box provided.
-
-
-
-
-
Step 4
-
Enter your:
-
-
Organization: carbon.super
-
Username: admin
-
Password: Your password
-
-
-
-
-
-
-
- Generate QR code to QR based Provisioning.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- );
- }
-}
-
-export default withConfigContext(EnrollDevice);
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Devices/scenes/Enroll/components/SelectEnrolmentType/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Devices/scenes/Enroll/components/SelectEnrolmentType/index.js
deleted file mode 100644
index 3c18db71e9..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Devices/scenes/Enroll/components/SelectEnrolmentType/index.js
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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 { Button, Divider } from 'antd';
-import TimeAgo from 'javascript-time-ago/modules/JavascriptTimeAgo';
-import en from 'javascript-time-ago/locale/en';
-import { withConfigContext } from '../../../../../../../../components/ConfigContext';
-
-class SelectEnrollmentType extends React.Component {
- constructor(props) {
- super(props);
- this.config = this.props.context;
- TimeAgo.addLocale(en);
- this.state = {
- pagination: {},
- loading: false,
- selectedRows: [],
- };
- }
-
- onEnrollWithQR = () => {
- this.props.getEnrollmentData('qr');
- };
-
- onEnrollManually = () => {
- this.props.getEnrollmentData('manual');
- };
-
- onClick = () => {
- this.props.goBack();
- };
-
- render() {
- return (
-
-
- Step 02 - Enroll the Android Agent.
-
-
-
-
- {' '}
- Your device can be enrolled with Entgra IoTS automatically via QR
- code. To enroll first download agent as mentioned in Step 1 then
- proceed with the ENROLL WITH QR option from the device setup
- activity. Thereafter select the ownership configuration and scan the
- generated QR to complete the process.
-
- );
- }
-}
-
-export default withConfigContext(GeoDashboard);
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Geo/components/GeoDashboard/styles.css b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Geo/components/GeoDashboard/styles.css
deleted file mode 100644
index abd20795db..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Geo/components/GeoDashboard/styles.css
+++ /dev/null
@@ -1,10 +0,0 @@
-.leaflet-container {
- align-content: center;
- padding-top: 80px;
- height: 550px;
- width: 100%;
-}
-
-.controllerDiv {
- padding-bottom: 30px;
-}
\ No newline at end of file
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
deleted file mode 100644
index c313b91252..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Geo/index.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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 { PageHeader, Typography, Breadcrumb, Icon } from 'antd';
-import { Link } from 'react-router-dom';
-import GeoDashboard from './components/GeoDashboard';
-
-const { Paragraph } = Typography;
-
-class Geo extends React.Component {
- routes;
-
- constructor(props) {
- super(props);
- this.routes = props.routes;
- }
-
- render() {
- const { deviceIdentifier, deviceType } = this.props.match.params;
- return (
-
- );
- }
-}
-
-export default withConfigContext(
- Form.create({ name: 'group-actions' })(GroupActions),
-);
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Groups/components/GroupsTable/components/GroupDevicesModal/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Groups/components/GroupsTable/components/GroupDevicesModal/index.js
deleted file mode 100644
index f844b79db2..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Groups/components/GroupsTable/components/GroupDevicesModal/index.js
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * 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 { Button, Modal } 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 DevicesTable from '../../../../../../components/DevicesTable';
-
-let apiUrl;
-
-class GroupDevicesModal extends React.Component {
- constructor(props) {
- super(props);
- TimeAgo.addLocale(en);
- this.state = {
- data: [],
- pagination: {},
- loading: false,
- selectedRows: [],
- visible: false,
- apiUrl: null,
- };
- }
-
- openDrawer = () => {
- this.setState({ visible: true });
- const groupData = {
- groupId: this.props.groupData.id,
- groupName: this.props.groupData.name,
- };
- this.fetchGroupDevices(groupData);
- };
-
- handleModalCancel = () => {
- this.setState({
- visible: false,
- });
- };
-
- // fetch data from api
- fetchGroupDevices = (params = {}, filters = {}) => {
- const config = this.props.context;
-
- // get current page
- const currentPage = params.hasOwnProperty('page') ? params.page : 1;
-
- const extraParams = {
- offset: 10 * (currentPage - 1), // calculate the offset
- limit: 10,
- ...params,
- };
-
- const encodedExtraParams = Object.keys(extraParams)
- .map(key => key + '=' + extraParams[key])
- .join('&');
-
- apiUrl =
- window.location.origin +
- config.serverConfig.invoker.uri +
- config.serverConfig.invoker.deviceMgt +
- '/devices?' +
- encodedExtraParams;
-
- this.setState({ apiUrl: apiUrl });
- };
-
- handleTableChange = (pagination, filters, sorter) => {
- const pager = { ...this.state.pagination };
- pager.current = pagination.current;
- this.setState({
- pagination: pager,
- });
- this.fetchGroupDevices({
- results: pagination.pageSize,
- page: pagination.current,
- sortField: sorter.field,
- sortOrder: sorter.order,
- ...filters,
- });
- };
-
- render() {
- const { apiUrl, visible } = this.state;
- return (
-
-
-
- Cancel
- ,
- ,
- ]}
- >
-
-
-
-
-
- );
- }
-}
-
-export default withConfigContext(GroupDevicesModal);
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Groups/components/GroupsTable/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Groups/components/GroupsTable/index.js
deleted file mode 100644
index 5ba0a8497b..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Groups/components/GroupsTable/index.js
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * 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 { message, notification, 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 GroupActions from './components/GroupActions';
-import AddGroup from './components/AddGroup';
-import Filter from '../../../../components/Filter';
-import GroupDevicesModal from './components/GroupDevicesModal';
-
-const searchFields = [
- {
- name: 'name',
- placeholder: 'Name',
- },
- {
- name: 'owner',
- placeholder: 'Owner',
- },
-];
-
-let apiUrl;
-
-class GroupsTable extends React.Component {
- constructor(props) {
- super(props);
- TimeAgo.addLocale(en);
- this.state = {
- data: [],
- pagination: {},
- loading: false,
- selectedRows: [],
- };
- }
-
- columns = [
- {
- title: 'Group Name',
- dataIndex: 'name',
- width: 100,
- },
- {
- title: 'Owner',
- dataIndex: 'owner',
- key: 'owner',
- // render: enrolmentInfo => enrolmentInfo.owner
- // todo add filtering options
- },
- {
- title: 'Description',
- dataIndex: 'description',
- key: 'description',
- // render: enrolmentInfo => enrolmentInfo.ownership
- // todo add filtering options
- },
- {
- title: 'Action',
- dataIndex: 'id',
- key: 'action',
- render: (id, row) => (
-
-
-
- ),
- },
- {
- title: 'Devices',
- dataIndex: 'id',
- key: 'details',
- render: (id, row) => ,
- },
- {
- title: 'Devices',
- dataIndex: 'id',
- key: 'details',
- render: (id, row) => ,
- },
- ];
-
- rowSelection = {
- onChange: (selectedRowKeys, selectedRows) => {
- this.setState({
- selectedRows: selectedRows,
- });
- },
- };
-
- componentDidMount() {
- this.fetchGroups();
- }
-
- // fetch data from api
- fetchGroups = (params = {}, filters = {}) => {
- const config = this.props.context;
- this.setState({ loading: true });
-
- // get current page
- const currentPage = params.hasOwnProperty('page') ? params.page : 1;
-
- const extraParams = {
- offset: 10 * (currentPage - 1), // calculate the offset
- limit: 10,
- ...filters,
- };
-
- const encodedExtraParams = Object.keys(extraParams)
- .map(key => key + '=' + extraParams[key])
- .join('&');
-
- apiUrl =
- window.location.origin +
- config.serverConfig.invoker.uri +
- config.serverConfig.invoker.deviceMgt +
- '/admin/groups?' +
- encodedExtraParams;
-
- // send request to the invokerss
- 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 => {
- 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.',
- });
- }
-
- this.setState({ loading: false });
- });
- };
-
- handleTableChange = (pagination, filters, sorter) => {
- const pager = { ...this.state.pagination };
- pager.current = pagination.current;
- this.setState({
- pagination: pager,
- });
- this.fetchGroups({
- results: pagination.pageSize,
- page: pagination.current,
- sortField: sorter.field,
- sortOrder: sorter.order,
- ...filters,
- });
- };
-
- render() {
- const { data, pagination, loading } = this.state;
-
- return (
-
-
-
-
-
-
-
-
-
record.id}
- dataSource={data.deviceGroups}
- pagination={{
- ...pagination,
- size: 'small',
- total: data.count,
- pageSize: 10,
- showTotal: (total, range) =>
- `showing ${range[0]}-${range[1]} of ${total} groups`,
- }}
- loading={loading}
- onChange={this.handleTableChange}
- rowSelection={this.rowSelection}
- />
-
-
- );
- }
-}
-
-export default withConfigContext(GroupsTable);
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Groups/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Groups/index.js
deleted file mode 100644
index 5dac20d050..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Groups/index.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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 { PageHeader, Typography, Breadcrumb, Icon } from 'antd';
-import { Link } from 'react-router-dom';
-import GroupsTable from './components/GroupsTable';
-
-const { Paragraph } = Typography;
-
-class Groups extends React.Component {
- routes;
-
- constructor(props) {
- super(props);
- this.routes = props.routes;
- }
-
- render() {
- return (
-
-
-
-
-
- Home
-
-
- Groups
-
-
-
Groups
- All device groups.
-
-
-
-
-
-
- );
- }
-}
-
-export default Groups;
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
deleted file mode 100644
index 2b5b2bfc66..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Notifications/Components/NotificationsTable/index.js
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * 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
deleted file mode 100644
index 456c3a9dab..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Notifications/index.js
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * 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
deleted file mode 100644
index e90d0fa9dd..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/AddPolicy/components/AssignGroups/index.js
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * 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 (
-
-
-
- );
- }
-}
-
-export default withConfigContext(Form.create()(ConfigureProfile));
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/AddPolicy/components/PublishDevices/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/AddPolicy/components/PublishDevices/index.js
deleted file mode 100644
index 3fc1d758e7..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/AddPolicy/components/PublishDevices/index.js
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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, Input } from 'antd';
-const { TextArea } = Input;
-
-class PublishDevices extends React.Component {
- constructor(props) {
- super(props);
- this.config = this.props.context;
- }
-
- onClickSavePolicy = (event, isPublish, formName) => {
- this.props.form.validateFields((err, values) => {
- if (!err) {
- values.active = isPublish;
- this.props.getPolicyPayloadData(formName, values);
- }
- });
- };
-
- render() {
- const { getFieldDecorator } = this.props.form;
- return (
-
-
-
- );
- }
-}
-
-export default withConfigContext(Form.create()(ConfigureProfile));
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/EditPolicy/components/PublishDevices/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/EditPolicy/components/PublishDevices/index.js
deleted file mode 100644
index e24cfd55d4..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/EditPolicy/components/PublishDevices/index.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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, Input } from 'antd';
-const { TextArea } = Input;
-
-class PublishDevices extends React.Component {
- constructor(props) {
- super(props);
- this.config = this.props.context;
- }
-
- onClickSavePolicy = (event, formName) => {
- this.props.form.validateFields((err, values) => {
- if (!err) {
- this.props.getPolicyPayloadData(formName, values);
- }
- });
- };
-
- render() {
- const { policyData } = this.props;
- const { getFieldDecorator } = this.props.form;
- return (
-
- );
- }
-}
-
-export default withConfigContext(Form.create()(SelectPolicyType));
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/EditPolicy/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/EditPolicy/index.js
deleted file mode 100644
index 3c69618ae1..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/EditPolicy/index.js
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * 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 { Form, Row, Col, Card, Steps, message, notification } from 'antd';
-import { withConfigContext } from '../../../../../../components/ConfigContext';
-import ConfigureProfile from './components/ConfigureProfile';
-import SelectPolicyType from './components/SelectPolicyType';
-import AssignGroups from './components/AssignGroups';
-import PublishDevices from './components/PublishDevices';
-import axios from 'axios';
-const { Step } = Steps;
-
-class EditPolicy extends React.Component {
- constructor(props) {
- super(props);
- this.config = this.props.context;
- this.state = {
- currentStepIndex: 0,
- policyUIConfigurationsList: null,
- newPolicyPayload: { compliance: 'enforce' },
- policyProfile: {},
- payloadData: {},
- policyFeatureList: [],
- policyData: {},
- deviceType: null,
- };
- }
-
- componentDidMount() {
- this.getSelectedPolicy(this.props.policyId);
- }
-
- getPolicyPayloadData = (dataName, dataValue) => {
- Object.defineProperty(this.state.payloadData, dataName, {
- value: dataValue,
- writable: true,
- });
- if (dataName === 'publishDevicesData') {
- this.createPayload();
- }
- };
-
- createPayload = () => {
- const {
- publishDevicesData,
- configureProfileData,
- policyTypeData,
- groupData,
- } = this.state.payloadData;
- const profile = {
- profileName: publishDevicesData.policyName,
- deviceType: this.state.deviceType,
- profileFeaturesList: configureProfileData,
- };
-
- const payload = {
- ...publishDevicesData,
- compliance: 'enforce',
- ownershipType: null,
- ...policyTypeData,
- profile: profile,
- ...groupData,
- };
- this.onEditPolicy(JSON.stringify(payload));
- };
-
- getSelectedPolicy = policyId => {
- let apiUrl =
- window.location.origin +
- this.config.serverConfig.invoker.uri +
- this.config.serverConfig.invoker.deviceMgt +
- '/policies/' +
- policyId;
-
- // send request to the invokers
- axios
- .get(apiUrl)
- .then(res => {
- if (res.status === 200) {
- this.setState({
- isLoading: true,
- policyData: res.data.data,
- deviceType: res.data.data.profile.deviceType,
- policyFeatureList: res.data.data.profile.profileFeaturesList,
- });
- this.getPolicyConfigJson(res.data.data.profile.deviceType);
- }
- })
- .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 selected policy.',
- });
- }
- });
- };
-
- getPolicyConfigJson = type => {
- this.setState({ isLoading: true });
-
- let apiUrl =
- window.location.origin +
- this.config.serverConfig.invoker.uri +
- this.config.serverConfig.invoker.deviceMgt +
- '/device-types/' +
- type +
- '/ui-policy-configurations';
- // send request to the invokers
- axios
- .get(apiUrl)
- .then(res => {
- if (res.status === 200) {
- this.setState({
- policyUIConfigurationsList: JSON.parse(res.data.data),
- });
- }
- })
- .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 Policy details.',
- });
- }
- });
- };
-
- onEditPolicy = value => {
- axios
- .put(
- window.location.origin +
- this.config.serverConfig.invoker.uri +
- this.config.serverConfig.invoker.deviceMgt +
- '/policies/' +
- this.props.policyId,
- value,
- { headers: { 'Content-Type': 'application-json' } },
- )
- .then(res => {
- if (res.status === 200) {
- notification.success({
- message: 'Done',
- duration: 4,
- description: 'Successfully Updated the Policy.',
- });
- }
- })
- .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 Updated the Policy.',
- });
- }
- });
- };
-
- getNextStep = () => {
- const currentStepIndex = this.state.currentStepIndex + 1;
- this.setState({ currentStepIndex });
- };
-
- getPrevStep = () => {
- const currentStepIndex = this.state.currentStepIndex - 1;
- this.setState({ currentStepIndex });
- };
-
- render() {
- const {
- currentStepIndex,
- policyUIConfigurationsList,
- policyFeatureList,
- policyData,
- deviceType,
- } = this.state;
- return (
-
- {policyUIConfigurationsList != null && (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- )}
-
- );
- }
-}
-
-export default withConfigContext(
- Form.create({ name: 'edit-policy' })(EditPolicy),
-);
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/PoliciesTable/component/PolicyAction/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/PoliciesTable/component/PolicyAction/index.js
deleted file mode 100644
index 53b309e220..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/PoliciesTable/component/PolicyAction/index.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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 { Divider, Icon, Tooltip } from 'antd';
-import { withConfigContext } from '../../../../../../../../components/ConfigContext';
-import { Link } from 'react-router-dom';
-
-class PolicyAction extends React.Component {
- constructor(props) {
- super(props);
- this.config = this.props.context;
- }
-
- render() {
- return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- );
- }
-}
-
-export default withConfigContext(PolicyAction);
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/PoliciesTable/component/PolicyBulkActionBar/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/PoliciesTable/component/PolicyBulkActionBar/index.js
deleted file mode 100644
index c2751c20a0..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/PoliciesTable/component/PolicyBulkActionBar/index.js
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * 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 { Button, Tooltip, Popconfirm, Divider } from 'antd';
-
-class BulkActionBar extends React.Component {
- constructor(props) {
- super(props);
- this.state = {
- selectedMultiple: false,
- selectedSingle: false,
- isPolicyActive: true,
- };
- }
-
- // This method checks whether active devices are selected
- onCheckPolicyStatus = () => {
- let tempIsPolicyActive;
- for (let i = 0; i < this.props.selectedRows.length; i++) {
- if (this.props.selectedRows[i].active) {
- tempIsPolicyActive = true;
- break;
- }
- tempIsPolicyActive = false;
- }
- this.setState({ isPolicyActive: tempIsPolicyActive });
- };
-
- onConfirmRemove = () => {
- if (!this.state.isPolicyActive) {
- this.props.removePolicy();
- }
- };
-
- onConfirmPublish = () => {
- if (!this.state.isPolicyActive) {
- this.props.publishPolicy();
- }
- };
-
- onConfirmUnpublish = () => {
- if (this.state.isPolicyActive) {
- this.props.unpublishPolicy();
- }
- };
-
- render() {
- const isSelected = this.props.selectedRows.length > 0;
-
- return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- );
- }
-}
-
-export default BulkActionBar;
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/PoliciesTable/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/PoliciesTable/index.js
deleted file mode 100644
index 62c89e4032..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/PoliciesTable/index.js
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- * 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 { message, notification, 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 PolicyAction from './component/PolicyAction';
-import PolicyBulkActionBar from './component/PolicyBulkActionBar';
-
-let apiUrl;
-
-class PoliciesTable extends React.Component {
- constructor(props) {
- super(props);
- TimeAgo.addLocale(en);
- this.config = this.props.context;
- this.state = {
- data: [],
- pagination: {},
- loading: false,
- selectedRows: [],
- };
- }
-
- rowSelection = {
- onChange: (selectedRowKeys, selectedRows) => {
- this.setState({
- selectedRows: selectedRows,
- });
- },
- };
-
- componentDidMount() {
- this.fetchGroups();
- }
-
- // fetch data from api
- fetchGroups = (params = {}) => {
- const config = this.props.context;
- this.setState({ loading: true });
-
- // get current page
- const currentPage = params.hasOwnProperty('page') ? params.page : 1;
-
- const extraParams = {
- offset: 10 * (currentPage - 1), // calculate the offset
- limit: 10,
- };
-
- const encodedExtraParams = Object.keys(extraParams)
- .map(key => key + '=' + extraParams[key])
- .join('&');
-
- apiUrl =
- window.location.origin +
- config.serverConfig.invoker.uri +
- config.serverConfig.invoker.deviceMgt +
- '/policies?' +
- encodedExtraParams;
-
- // send request to the invokerss
- axios
- .get(apiUrl)
- .then(res => {
- if (res.status === 200) {
- const pagination = { ...this.state.pagination };
- this.setState({
- loading: false,
- data: res.data.data.policies,
- pagination,
- });
- }
- })
- .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 policies.',
- });
- }
-
- this.setState({ loading: false });
- });
- };
-
- handleTableChange = (pagination, filters, sorter) => {
- const pager = { ...this.state.pagination };
- pager.current = pagination.current;
- this.setState({
- pagination: pager,
- });
- this.fetch({
- results: pagination.pageSize,
- page: pagination.current,
- sortField: sorter.field,
- sortOrder: sorter.order,
- ...filters,
- });
- };
-
- unpublishPolicy = () => {
- const policyIDs = this.state.selectedRows.map(obj => obj.id);
- // send request to the invoker
- axios
- .post(
- window.location.origin +
- this.config.serverConfig.invoker.uri +
- this.config.serverConfig.invoker.deviceMgt +
- '/policies/deactivate-policy',
- policyIDs,
- { headers: { 'Content-Type': 'application/json' } },
- )
- .then(res => {
- if (res.status === 200) {
- this.fetchGroups();
- notification.success({
- message: 'Done',
- duration: 4,
- description: 'Selected policy(s) was successfully unpublished',
- });
- }
- })
- .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 unpublish policy(s).',
- });
- }
- });
- };
-
- publishPolicy = () => {
- const policyIDs = this.state.selectedRows.map(obj => obj.id);
- // send request to the invoker
- axios
- .post(
- window.location.origin +
- this.config.serverConfig.invoker.uri +
- this.config.serverConfig.invoker.deviceMgt +
- '/policies/activate-policy',
- policyIDs,
- { headers: { 'Content-Type': 'application/json' } },
- )
- .then(res => {
- if (res.status === 200) {
- this.fetchGroups();
- notification.success({
- message: 'Done',
- duration: 4,
- description: 'Selected policy(s) was successfully unpublished',
- });
- }
- })
- .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 unpublish policy(s).',
- });
- }
- });
- };
-
- removePolicy = () => {
- const policyIDs = this.state.selectedRows.map(obj => obj.id);
- // send request to the invoker
- axios
- .post(
- window.location.origin +
- this.config.serverConfig.invoker.uri +
- this.config.serverConfig.invoker.deviceMgt +
- '/policies/remove-policy',
- policyIDs,
- { headers: { 'Content-Type': 'application/json' } },
- )
- .then(res => {
- if (res.status === 200) {
- this.fetchGroups();
- notification.success({
- message: 'Done',
- duration: 4,
- description: 'Selected policy(s) was successfully removed.',
- });
- }
- })
- .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 remove policy(s).',
- });
- }
- });
- };
-
- applyChanges = () => {
- // send request to the invoker
- axios
- .put(
- window.location.origin +
- this.config.serverConfig.invoker.uri +
- this.config.serverConfig.invoker.deviceMgt +
- '/policies/apply-changes',
- 'null',
- { headers: { 'Content-Type': 'application/json' } },
- )
- .then(res => {
- if (res.status === 200) {
- this.fetchGroups();
- notification.success({
- message: 'Done',
- duration: 4,
- description: 'Changes applied successfully.',
- });
- }
- })
- .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 apply changes to device.',
- });
- }
- });
- };
-
- render() {
- const { data, pagination, loading, selectedRows } = this.state;
- const columns = [
- {
- title: 'Policy Name',
- dataIndex: 'policyName',
- width: 100,
- },
- {
- title: 'Description',
- dataIndex: 'description',
- key: 'description',
- // render: enrolmentInfo => enrolmentInfo.owner
- // todo add filtering options
- },
- {
- title: 'Compilance',
- dataIndex: 'compliance',
- key: 'compliance',
- // render: enrolmentInfo => enrolmentInfo.ownership
- // todo add filtering options
- },
- {
- title: 'Policy Type',
- dataIndex: 'policyType',
- key: 'policyType',
- // render: enrolmentInfo => enrolmentInfo.ownership
- // todo add filtering options
- },
- {
- title: 'Action',
- dataIndex: 'id',
- key: 'action',
- render: (id, row) => (
-
-
-
- ),
- },
- ];
- return (
-
-
-
record.id}
- dataSource={data}
- pagination={{
- ...pagination,
- size: 'small',
- // position: "top",
- showTotal: (total, range) =>
- `showing ${range[0]}-${range[1]} of ${total} groups`,
- // showQuickJumper: true
- }}
- loading={loading}
- onChange={this.handleTableChange}
- rowSelection={this.rowSelection}
- />
-
- );
- }
-}
-
-export default withConfigContext(PoliciesTable);
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/PolicyProfile/component/PolicyInfo/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/PolicyProfile/component/PolicyInfo/index.js
deleted file mode 100644
index be10903697..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/PolicyProfile/component/PolicyInfo/index.js
+++ /dev/null
@@ -1,831 +0,0 @@
-/*
- * 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 {
- Alert,
- Button,
- Checkbox,
- Col,
- Collapse,
- Form,
- Icon,
- Input,
- Popconfirm,
- Radio,
- Row,
- Select,
- Table,
- Tabs,
- Tooltip,
- Typography,
- Upload,
-} from 'antd';
-import { withConfigContext } from '../../../../../../../../components/ConfigContext';
-import moment from 'moment';
-
-const { Text, Title, Paragraph } = Typography;
-const { TabPane } = Tabs;
-const { Option } = Select;
-const { TextArea } = Input;
-
-const subPanelpayloadAttributes = {};
-const fieldKeys = [];
-let subFormContainer = {};
-let radioSubPanelSwitches = [];
-let radioPanelStatusList = {};
-
-class PolicyInfo extends React.Component {
- constructor(props) {
- super(props);
- this.config = this.props.context;
- this.state = {
- data: {},
- policyFeatureList: [],
- activePanelKeys: [],
- activeSubPanelKeys: [],
- profilePreviewKey: '',
- customInputDataArray: [],
- inputTableDataSources: {},
- isInfoPreview: false,
- subPanelRadio: {},
- };
- }
-
- setProfileInfo = e => {
- let activePolicies = [];
- let activePolicyFields = {};
- let activeSubPanels = [];
- let subPanelRadio = this.state.subPanelRadio;
- this.setState({
- subPanelRadio: radioPanelStatusList,
- });
- const allFields = this.props.form.getFieldsValue();
- this.props.policyFeatureList.map(element => {
- activePolicies.push(element.featureCode);
- let featureData = JSON.parse(element.content);
- Object.keys(featureData).map(key => {
- if (element.featureCode in subPanelpayloadAttributes) {
- Object.entries(subPanelpayloadAttributes[element.featureCode]).map(
- ([panelKey, payloadAttr]) => {
- if (key === payloadAttr) {
- activeSubPanels.push(`${element.featureCode}-${panelKey}`);
- }
- },
- );
-
- let regex = new RegExp(`${element.featureCode}.+${key}`, 'g');
- Object.keys(allFields).map(fieldName => {
- if (fieldName.match(regex) != null) {
- activePolicyFields[fieldName] = featureData[key];
- }
- });
- } else if (element.featureCode in subFormContainer) {
- let regex = new RegExp(`.+${element.featureCode}-${key}`, 'g');
- Object.keys(allFields).map(fieldName => {
- if (fieldName.match(regex) != null) {
- activePolicyFields[fieldName] = featureData[key];
- if (
- !activePolicies.includes(
- fieldName.replace(`-${element.featureCode}-${key}`, ''),
- )
- ) {
- activePolicies.push(
- fieldName.replace(`-${element.featureCode}-${key}`, ''),
- );
- }
- }
- });
- } else {
- let regex = new RegExp(`${element.featureCode}.+${key}`, 'g');
- Object.keys(allFields).map(fieldName => {
- if (fieldName.match(regex) != null) {
- activePolicyFields[fieldName] = featureData[key];
- }
- if (
- radioSubPanelSwitches.includes(
- `${element.featureCode}-${featureData[key]}`,
- )
- ) {
- let subPanelViewStatus = {
- [featureData[key]]: true,
- };
- Object.assign(subPanelRadio, subPanelViewStatus);
- }
- });
- }
- });
- });
- this.props.form.setFieldsValue(activePolicyFields);
- this.setState({
- activePanelKeys: activePolicies,
- activeSubPanelKeys: activeSubPanels,
- subPanelRadio,
- });
- };
-
- // convert time from 24h format to 12h format
- timeConverter = time => {
- time = time
- .toString()
- .match(/^([01]\d|2[0-3])(:)([0-5]\d)(:[0-5]\d)?$/) || [time];
- if (time.length > 1) {
- time = time.slice(1);
- time[5] = +time[0] < 12 ? ' AM' : ' PM';
- time[0] = +time[0] % 12 || 12;
- }
- return time.join('');
- };
-
- // get Option value from start Time, end Time and time difference between 2 values
- getOptionForTimeSelectors = (startTimeValue, endTimeValue, timeIncrement) => {
- let timeOptions = [];
- let time = new Date(
- moment()
- .startOf('day')
- .format('YYYY/MM/DD'),
- );
- let tempValue = startTimeValue;
- time.setMinutes(time.getMinutes() + tempValue);
- let startOption = (
-
- );
- timeOptions.push(startOption);
-
- while (tempValue !== endTimeValue) {
- time = new Date(
- moment()
- .startOf('day')
- .format('YYYY/MM/DD'),
- );
- tempValue += timeIncrement;
- if (tempValue > 1440) {
- tempValue = 0;
- continue;
- }
- time.setMinutes(time.getMinutes() + tempValue);
- let option = (
-
- );
- timeOptions.push(option);
- }
- return timeOptions;
- };
-
- // handle items which handle from radio buttons
- handleRadioPanel = (e, subPanel) => {
- {
- subPanel.map((panel, i) => {
- if (panel.value === e.target.value) {
- document.getElementById(panel.value).style.display = 'block';
- } else {
- document.getElementById(panel.value).style.display = 'none';
- }
- });
- }
- };
-
- // handle items which handle from select options
- handleSelectedPanel = (e, subPanel) => {
- {
- subPanel.map((panel, i) => {
- if (panel.id === e) {
- document.getElementById(panel.id).style.display = 'block';
- } else {
- document.getElementById(panel.id).style.display = 'none';
- }
- });
- }
- };
-
- getColumns = ({ getFieldDecorator }, arr) => {
- const columnArray = [];
- const actionColumn = [
- {
- title: '',
- dataIndex: 'operation',
- render: (name, row) => (
-
-
-
-
-
-
-
-
-
- ),
- },
- ];
- Object.values(arr).map((columnData, c) => {
- if (columnData.type === 'input') {
- const column = {
- title: `${columnData.name}`,
- dataIndex: `${columnData.key}`,
- key: `${columnData.key}`,
- render: (name, row, i) => (
-
- {getFieldDecorator(`${columnData.key}${i}`, {})(
- ,
- )}
-
- ),
- };
- columnArray.push(column);
- } else if (columnData.type === 'upload') {
- const column = {
- title: `${columnData.name}`,
- dataIndex: `${columnData.key}`,
- key: `${columnData.key}`,
- render: (name, row, i) => (
-
- {getFieldDecorator(`${columnData.key}${i}`, {})(
-
-
- ,
- )}
-
- ),
- };
- columnArray.push(column);
- } else if (columnData.type === 'select') {
- const column = {
- title: `${columnData.name}`,
- dataIndex: `${columnData.key}`,
- key: `${columnData.key}`,
- render: (name, row, i) => (
-
- {getFieldDecorator(`${columnData.key}${i}`, {
- initialValue: columnData.others.initialDataIndex,
- })(
- ,
- )}
-
- ),
- };
- columnArray.push(column);
- }
- });
- const columns = columnArray.concat(actionColumn);
- return columns;
- };
-
- // generate form items
- getPanelItems = (panel, panelId) => {
- const { getFieldDecorator } = this.props.form;
- const subPanelList = {};
- return panel.map((item, k) => {
- fieldKeys.push(item.id);
- switch (item.type) {
- case 'select':
- if (item.optional.hasOwnProperty('subPanel')) {
- return (
-
-
-
-
- );
- }
-}
-
-export default withConfigContext(Form.create()(PolicyInfo));
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/PolicyProfile/component/ProfileOverview/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/PolicyProfile/component/ProfileOverview/index.js
deleted file mode 100644
index 798fc84c0f..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/PolicyProfile/component/ProfileOverview/index.js
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * 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 { Card, Col, Icon, Row, Typography } from 'antd';
-import { withConfigContext } from '../../../../../../../../components/ConfigContext';
-const { Title, Text } = Typography;
-
-class ProfileOverview extends React.Component {
- constructor(props) {
- super(props);
- this.config = this.props.context;
- this.state = {
- data: {},
- };
- }
-
- render() {
- const { policyData } = this.props;
- return (
-
- );
- }
-}
-
-export default withConfigContext(ProfileOverview);
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/PolicyProfile/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/PolicyProfile/index.js
deleted file mode 100644
index 29666f67e2..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/components/PolicyProfile/index.js
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * 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 { Col, message, notification } from 'antd';
-import { withConfigContext } from '../../../../../../components/ConfigContext';
-import PolicyInfo from './component/PolicyInfo';
-import ProfileOverview from './component/ProfileOverview';
-import axios from 'axios';
-
-class PolicyProfile extends React.Component {
- constructor(props) {
- super(props);
- this.config = this.props.context;
- this.state = {
- policyId: this.props.policyId,
- policyData: null,
- policyUIConfigurationsList: [],
- policyFeatureList: [],
- };
- }
-
- componentDidMount() {
- this.getSelectedPolicy(this.props.policyId);
- }
-
- getSelectedPolicy = policyId => {
- let apiUrl =
- window.location.origin +
- this.config.serverConfig.invoker.uri +
- this.config.serverConfig.invoker.deviceMgt +
- '/policies/' +
- policyId;
-
- // send request to the invokers
- axios
- .get(apiUrl)
- .then(res => {
- if (res.status === 200) {
- this.setState({
- policyData: res.data.data,
- policyFeatureList: res.data.data.profile.profileFeaturesList,
- });
- this.getPolicyConfigJson(res.data.data.profile.deviceType);
- }
- })
- .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 selected policy.',
- });
- }
- });
- };
-
- getPolicyConfigJson = type => {
- this.setState({ isLoading: true });
-
- let apiUrl =
- window.location.origin +
- this.config.serverConfig.invoker.uri +
- this.config.serverConfig.invoker.deviceMgt +
- '/device-types/' +
- type +
- '/ui-policy-configurations';
- // send request to the invokers
- axios
- .get(apiUrl)
- .then(res => {
- if (res.status === 200) {
- this.setState({
- isLoading: false,
- policyUIConfigurationsList: JSON.parse(res.data.data),
- });
- }
- })
- .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 Policy details.',
- });
- }
- this.setState({ isLoading: false });
- });
- };
-
- render() {
- const {
- policyData,
- policyUIConfigurationsList,
- policyFeatureList,
- } = this.state;
- return (
-
-
- {/* */}
-
- {policyData != null && (
-
- )}
-
-
- {policyData != null && (
-
- )}
-
-
-
- );
- }
-}
-
-export default withConfigContext(PolicyProfile);
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/index.js
deleted file mode 100644
index 94e12f8025..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/index.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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 { PageHeader, Typography, Breadcrumb, Icon } from 'antd';
-import { Link } from 'react-router-dom';
-import PoliciesTable from './components/PoliciesTable';
-
-const { Paragraph } = Typography;
-
-class Policies extends React.Component {
- routes;
-
- constructor(props) {
- super(props);
- this.routes = props.routes;
- }
-
- render() {
- return (
-
-
-
-
-
- Home
-
-
- Policies
-
-
-
Policies
- All policies for device management
-
-
-
-
-
-
-
- );
- }
-}
-
-export default Policies;
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/scenes/AddNewPolicy/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/scenes/AddNewPolicy/index.js
deleted file mode 100644
index bfaf976298..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/scenes/AddNewPolicy/index.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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 { PageHeader, Typography, Breadcrumb, Icon } from 'antd';
-import { Link } from 'react-router-dom';
-import AddPolicy from '../../components/AddPolicy';
-
-const { Paragraph } = Typography;
-
-class AddNewPolicy extends React.Component {
- routes;
-
- constructor(props) {
- super(props);
- this.routes = props.routes;
- }
-
- render() {
- return (
-
-
-
-
-
- Home
-
-
- Policies
-
-
-
Policies
- Create new policy on IoT Server.
-
-
-
-
-
-
-
- );
- }
-}
-
-export default AddNewPolicy;
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/scenes/EditSelectedPolicy/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/scenes/EditSelectedPolicy/index.js
deleted file mode 100644
index ba2a94ed7a..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/scenes/EditSelectedPolicy/index.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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, { Component } from 'react';
-import { Breadcrumb, Icon, PageHeader } from 'antd';
-import { Link } from 'react-router-dom';
-import EditPolicy from '../../components/EditPolicy';
-import { withConfigContext } from '../../../../../../components/ConfigContext';
-class EditSelectedPolicy extends Component {
- routes;
-
- constructor(props) {
- super(props);
- this.routes = props.routes;
- this.config = this.props.context;
- this.state = {
- data: {},
- policyOverview: {},
- policyId: '',
- };
- }
-
- render() {
- const {
- match: { params },
- } = this.props;
-
- return (
-
-
-
-
-
- Home
-
-
- Policies
-
-
- {/*
Policies
*/}
- {/* Create new policy on IoT Server.*/}
-
-
-
-
-
-
-
- );
- }
-}
-export default withConfigContext(EditSelectedPolicy);
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/scenes/ViewPolicy/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/scenes/ViewPolicy/index.js
deleted file mode 100644
index 74b98521eb..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/scenes/ViewPolicy/index.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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, { Component } from 'react';
-import { Breadcrumb, Icon, PageHeader } from 'antd';
-import { Link } from 'react-router-dom';
-import { withConfigContext } from '../../../../../../components/ConfigContext';
-import PolicyProfile from '../../components/PolicyProfile';
-class ViewPolicy extends Component {
- routes;
-
- constructor(props) {
- super(props);
- this.routes = props.routes;
- this.config = this.props.context;
- this.state = {
- data: {},
- policyOverview: {},
- policyId: '',
- };
- }
-
- render() {
- const {
- match: { params },
- } = this.props;
- return (
-
-
-
-
-
- Home
-
-
- Policies
-
-
- {/*
Policies
*/}
- {/* Create new policy on IoT Server.*/}
-
-
-
-
-
-
-
- );
- }
-}
-export default withConfigContext(ViewPolicy);
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/styles.css b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/styles.css
deleted file mode 100644
index 0290b03179..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Policies/styles.css
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.
- */
-
-.tab-container > .ant-tabs > .ant-tabs-bar {
- border-color: #aaaaaa;
-}
-
-.tab-container > .ant-tabs > .ant-tabs-bar .ant-tabs-tab {
- height: 50px;
- margin: 0;
-}
-
-.tab-container > .ant-tabs > .ant-tabs-bar .ant-tabs-tab-active {
- border-color: transparent;
- background: #4b92db;
- color: #fff;
-}
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Roles/components/RolesTable/components/AddRole/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Roles/components/RolesTable/components/AddRole/index.js
deleted file mode 100644
index d8770f81b1..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Roles/components/RolesTable/components/AddRole/index.js
+++ /dev/null
@@ -1,410 +0,0 @@
-/*
- * 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 {
- Button,
- Form,
- Input,
- message,
- Modal,
- notification,
- Select,
- Tree,
-} from 'antd';
-import { withConfigContext } from '../../../../../../../../components/ConfigContext';
-import axios from 'axios';
-
-const { Option } = Select;
-const { TreeNode } = Tree;
-
-class AddRole extends React.Component {
- constructor(props) {
- super(props);
- this.config = this.props.context;
- this.expandKeys = [];
- this.state = {
- isAddRoleModalVisible: false,
- isAddPermissionModalVisible: false,
- roleName: '',
- users: [],
- nodeList: [],
- expandedKeys: [],
- autoExpandParent: true,
- checkedKeys: [],
- isNodeList: false,
- };
- }
-
- openAddModal = () => {
- this.setState({
- isAddRoleModalVisible: true,
- });
- };
-
- onCancelHandler = e => {
- this.setState({
- isAddRoleModalVisible: false,
- isAddPermissionModalVisible: false,
- });
- };
-
- getCheckedPermissionsList = data => {
- data.forEach(item => {
- if (item !== null) {
- this.expandKeys.push(item.resourcePath);
- this.getCheckedPermissionsList(item.nodeList);
- } else {
- return null;
- }
- });
- };
-
- onAddRole = e => {
- this.props.form.validateFields((err, values) => {
- if (!err) {
- this.onConfirmAddRole(values);
- }
- console.log(values);
- });
- };
-
- onExpand = expandedKeys => {
- this.setState({
- expandedKeys,
- autoExpandParent: false,
- });
- };
-
- onCheck = checkedKeys => {
- this.setState({ checkedKeys });
- };
-
- onConfirmAddRole = value => {
- const roleData = {
- roleName: value.roleName,
- users: value.users,
- };
- this.setState({
- roleName: value.roleName,
- });
- axios
- .post(
- window.location.origin +
- this.config.serverConfig.invoker.uri +
- this.config.serverConfig.invoker.deviceMgt +
- '/roles',
- roleData,
- { headers: { 'Content-Type': 'application-json' } },
- )
- .then(res => {
- if (res.status === 201) {
- this.props.fetchUsers();
- this.setState({
- isAddRoleModalVisible: false,
- isAddPermissionModalVisible: true,
- });
- notification.success({
- message: 'Done',
- duration: 4,
- description: 'Successfully added the role.',
- });
- this.loadPermissionList();
- }
- })
- .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 add role.',
- });
- }
- });
- };
-
- renderTreeNodes = data => {
- return data.map(item => {
- if (item !== null) {
- if (item.hasOwnProperty('nodeList')) {
- return (
-
- {this.renderTreeNodes(item.nodeList)}
-
- );
- }
- return ;
- }
-
- // eslint-disable-next-line react/jsx-key
- return ;
- });
- };
-
- onAssignPermissions = () => {
- const roleData = {
- roleName: this.state.roleName,
- permissions: this.state.checkedKeys,
- };
- axios
- .put(
- window.location.origin +
- this.config.serverConfig.invoker.uri +
- this.config.serverConfig.invoker.deviceMgt +
- '/roles/' +
- this.state.roleName,
- roleData,
- { headers: { 'Content-Type': 'application-json' } },
- )
- .then(res => {
- if (res.status === 200) {
- this.props.fetchUsers();
- notification.success({
- message: 'Done',
- duration: 4,
- description: 'Successfully Updated the Permissions.',
- });
- this.setState({
- isAddPermissionModalVisible: false,
- });
- }
- })
- .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 add permissions.',
- });
- }
- });
- };
-
- loadPermissionList = () => {
- let apiURL =
- window.location.origin +
- this.config.serverConfig.invoker.uri +
- this.config.serverConfig.invoker.deviceMgt +
- '/roles/' +
- this.state.roleName +
- '/permissions';
-
- axios
- .get(apiURL)
- .then(res => {
- if (res.status === 200) {
- this.getCheckedPermissionsList(res.data.data.nodeList);
- this.setState({
- nodeList: res.data.data.nodeList,
- isNodeList: true,
- expandedKeys: this.expandKeys,
- });
- }
- })
- .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 permission.',
- });
- }
- });
- };
-
- loadUsersList = 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 user = JSON.parse(res.data.data);
- let users = [];
- for (let i = 0; i < user.length; i++) {
- users.push(
- ,
- );
- }
- this.setState({
- users: 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.',
- });
- }
- });
- };
-
- render() {
- const { getFieldDecorator } = this.props.form;
- return (
-
-
-
-
-
-
- Cancel
- ,
- ,
- ]}
- >
-
-
Create new user on IoT Server.
-
- {getFieldDecorator('userStoreDomain', {
- initialValue: 'PRIMARY',
- })(
- ,
- )}
-
-
- {getFieldDecorator('roleName', {
- rules: [
- {
- pattern: new RegExp('^(((?!(\\@|\\/|\\s)).){3,})*$'),
- message:
- 'Role name should be in minimum 3 characters long and not ' +
- 'include any whitespaces or @ or /',
- },
- {
- required: true,
- message: 'This field is required.',
- },
- ],
- })()}
-
-
- {getFieldDecorator('users', {})(
- ,
- )}
-
-
-
-
- );
- }
-}
-
-export default withConfigContext(RolesTable);
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Roles/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Roles/index.js
deleted file mode 100644
index 4ebafc7a16..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Roles/index.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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 { PageHeader, Typography, Breadcrumb, Icon } from 'antd';
-import { Link } from 'react-router-dom';
-import RolesTable from './components/RolesTable';
-
-const { Paragraph } = Typography;
-
-class Roles extends React.Component {
- routes;
-
- constructor(props) {
- super(props);
- this.routes = props.routes;
- }
-
- render() {
- return (
-
-
-
-
-
- Home
-
-
- Roles
-
-
-
Roles
- All user roles
-
-
-
-
-
-
- );
- }
-}
-
-export default Roles;
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Users/components/UsersTable/components/AddUser/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Users/components/UsersTable/components/AddUser/index.js
deleted file mode 100644
index 24ce1a631b..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Users/components/UsersTable/components/AddUser/index.js
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * 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 {
- Button,
- Form,
- Select,
- Input,
- message,
- Modal,
- notification,
-} from 'antd';
-import axios from 'axios';
-import { withConfigContext } from '../../../../../../../../components/ConfigContext';
-const { Option } = Select;
-
-class AddUser extends React.Component {
- constructor(props) {
- super(props);
- this.config = this.props.context;
- this.state = {
- isModalVisible: false,
- roles: [],
- };
- }
-
- componentDidMount() {
- this.getRole();
- }
-
- openAddModal = () => {
- this.setState({
- isModalVisible: true,
- });
- };
-
- onSubmitHandler = e => {
- this.props.form.validateFields((err, values) => {
- if (!err) {
- this.onConfirmAddUser(values);
- }
- });
- };
-
- onConfirmAddUser = value => {
- const userData = {
- username: value.userStoreDomain + '/' + value.userName,
- firstname: value.firstName,
- lastname: value.lastName,
- emailAddress: value.email,
- roles: value.userRoles,
- };
- axios
- .post(
- window.location.origin +
- this.config.serverConfig.invoker.uri +
- this.config.serverConfig.invoker.deviceMgt +
- '/users',
- userData,
- { headers: { 'Content-Type': 'application-json' } },
- )
- .then(res => {
- if (res.status === 201) {
- this.props.fetchUsers();
- this.setState({
- isModalVisible: false,
- });
- notification.success({
- message: 'Done',
- duration: 4,
- description: 'Successfully added the user.',
- });
- }
- })
- .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 add user.',
- });
- }
- });
- };
-
- onCancelHandler = e => {
- this.setState({
- isModalVisible: false,
- });
- };
-
- getRole = () => {
- 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) {
- const roles = [];
- for (let i = 0; i < res.data.data.roles.length; i++) {
- roles.push(
- ,
- );
- }
- this.setState({
- roles: 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.',
- });
- }
- });
- };
-
- render() {
- const { getFieldDecorator } = this.props.form;
- return (
-
-
-
-
-
-
- Cancel
- ,
- ,
- ]}
- >
-
-
Create new user on IoT Server.
-
- {getFieldDecorator('userStoreDomain', {
- initialValue: 'PRIMARY',
- })(
- ,
- )}
-
-
- {getFieldDecorator('userName', {
- rules: [
- {
- required: true,
- message:
- 'This field is required. Username should be at least 3 characters long with no white spaces.',
- },
- ],
- })()}
-
-
- {getFieldDecorator('firstName', {
- rules: [
- {
- required: true,
- message: 'This field is required',
- },
- ],
- })()}
-
-
- {getFieldDecorator('lastName', {
- rules: [
- {
- required: true,
- message: 'This field is required',
- },
- ],
- })()}
-
-
- {getFieldDecorator('email', {
- rules: [
- {
- type: 'email',
- message: 'Invalid Email Address',
- },
- {
- required: true,
- message: 'This field is required',
- },
- ],
- })()}
-
-
- {getFieldDecorator('userRoles', {})(
- ,
- )}
-
-
-
-
-
-
- );
- }
-}
-
-export default withConfigContext(Form.create({ name: 'add-user' })(AddUser));
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Users/components/UsersTable/components/ExternalDevicesModal/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Users/components/UsersTable/components/ExternalDevicesModal/index.js
deleted file mode 100644
index c1c7d1878c..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Users/components/UsersTable/components/ExternalDevicesModal/index.js
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * 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 { Button, Form, Input, Modal, notification, Col, Row } from 'antd';
-import axios from 'axios';
-import { withConfigContext } from '../../../../../../../../components/ConfigContext';
-import { handleApiError } from '../../../../../../../../services/utils/errorHandler';
-const InputGroup = Input.Group;
-
-class ExternalDevicesModal extends React.Component {
- constructor(props) {
- super(props);
- this.config = this.props.context;
- this.state = {
- isDeviceEditModalVisible: false,
- metaData: [],
- };
- }
-
- openDeviceEditModal = () => {
- this.setState({
- isDeviceEditModalVisible: true,
- });
- this.getExternalDevicesForUser(this.props.user);
- };
-
- onCancelHandler = () => {
- this.setState({
- isDeviceEditModalVisible: false,
- });
- };
-
- getExternalDevicesForUser = userName => {
- let apiURL =
- window.location.origin +
- this.config.serverConfig.invoker.uri +
- this.config.serverConfig.invoker.deviceMgt +
- `/users/claims/${userName}`;
-
- axios
- .get(apiURL)
- .then(res => {
- if (res.status === 200) {
- if (res.data.data.hasOwnProperty('http://wso2.org/claims/devices')) {
- this.setState({
- metaData: JSON.parse(
- res.data.data['http://wso2.org/claims/devices'],
- ),
- });
- }
- }
- })
- .catch(error => {
- handleApiError(
- error,
- 'Error occurred while trying to retrieve claims.',
- );
- });
- };
-
- setExternalDevicesForUser = (userName, payload) => {
- let apiURL =
- window.location.origin +
- this.config.serverConfig.invoker.uri +
- this.config.serverConfig.invoker.deviceMgt +
- `/users/claims/${userName}`;
-
- axios
- .put(apiURL, payload)
- .then(res => {
- if (res.status === 200) {
- notification.success({
- message: 'Done',
- duration: 0,
- description: 'Succussfully updated.',
- });
- }
- this.setState({
- isDeviceEditModalVisible: false,
- });
- })
- .catch(error => {
- handleApiError(error, 'Error occurred while trying to update claims.');
- });
- };
-
- onSubmitClaims = e => {
- this.props.form.validateFields(['meta'], (err, values) => {
- if (!err) {
- this.setExternalDevicesForUser(this.props.user, this.state.metaData);
- }
- });
- };
-
- addNewMetaData = () => {
- this.setState({
- metaData: [...this.state.metaData, { deviceName: '', id: '' }],
- });
- };
-
- render() {
- const { getFieldDecorator } = this.props.form;
- const { metaData } = this.state;
- return (
-
-
- );
- }
-}
-
-export default withConfigContext(UsersTable);
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Users/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Users/index.js
deleted file mode 100644
index e7e341afd2..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/scenes/Users/index.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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 { PageHeader, Typography, Breadcrumb, Icon } from 'antd';
-import { Link } from 'react-router-dom';
-import UsersTable from './components/UsersTable';
-
-const { Paragraph } = Typography;
-
-class Users extends React.Component {
- routes;
-
- constructor(props) {
- super(props);
- this.routes = props.routes;
- }
-
- render() {
- return (
-
-
-
-
-
- Home
-
-
- Users
-
-
-
Users
- All users for device management.
-
-
-
-
-
- );
- }
-}
-
-export default Users;
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/styles.css b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/styles.css
deleted file mode 100644
index 3b49514ce4..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Home/styles.css
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.
- */
-
-.profile {
- float: right;
- margin-right: 2%;
-}
-
-.layout .trigger {
- font-size: 18px;
- padding: 0 24px;
- cursor: pointer;
- transition: color 0.3s;
- float: left;
- width: 40px;
-}
-
-.layout .trigger:hover {
- color: #1890ff;
-}
-
-.layout .logo-image {
- float: left;
-}
-
-.layout .brand{
- display: inline-block;
- color: #fff;
- font-weight: 600;
- font-size: 20px;
- font-family: Avenir,Helvetica Neue,Arial,Helvetica,sans-serif;
- vertical-align: middle;
-}
-
-.layout .logo-image img {
- height: 45px;
- margin-top: 5px;
- margin-left: 16px;
- margin-right: 16px;
- margin-bottom: 5px;
-}
-
-@media only screen and (min-width: 760px) {
- @media screen and (max-width: 1030px) {
-
- Footer{
- margin-bottom: 45%;
- }
- }
-}
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Login/index.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Login/index.js
deleted file mode 100644
index 1d3da6c586..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Login/index.js
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * 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 {
- Typography,
- Row,
- Col,
- Form,
- Icon,
- Input,
- Button,
- Checkbox,
-} from 'antd';
-import './styles.css';
-import axios from 'axios';
-import { withConfigContext } from '../../components/ConfigContext';
-
-const { Title } = Typography;
-const { Text } = Typography;
-
-class Login extends React.Component {
- render() {
- const config = this.props.context;
- return (
-
-
-
-
-
-
-
-
-
-
-
- Login
-
-
-
-
-
-
-
-
- );
- }
-}
-
-class NormalLoginForm extends React.Component {
- constructor(props) {
- super(props);
- this.state = {
- inValid: false,
- loading: false,
- };
- }
-
- handleSubmit = e => {
- const thisForm = this;
- const config = this.props.context;
- console.log(config);
-
- e.preventDefault();
- this.props.form.validateFields((err, values) => {
- thisForm.setState({
- inValid: false,
- });
- if (!err) {
- thisForm.setState({
- loading: true,
- });
- const parameters = {
- username: values.username,
- password: values.password,
- platform: 'entgra',
- };
-
- const request = Object.keys(parameters)
- .map(key => key + '=' + parameters[key])
- .join('&');
-
- axios
- .post(window.location.origin + config.serverConfig.loginUri, request)
- .then(res => {
- if (res.status === 200) {
- let redirectUrl = window.location.origin + '/entgra';
- const searchParams = new URLSearchParams(window.location.search);
- if (searchParams.has('redirect')) {
- redirectUrl = searchParams.get('redirect');
- }
- window.location = redirectUrl;
- }
- })
- .catch(function(error) {
- if (error.response.status === 400) {
- thisForm.setState({
- inValid: true,
- loading: false,
- });
- }
- });
- }
- });
- };
-
- render() {
- const { getFieldDecorator } = this.props.form;
- let errorMsg = '';
- if (this.state.inValid) {
- errorMsg = Invalid Login Details;
- }
- let loading = '';
- if (this.state.loading) {
- loading = Loading..;
- }
- return (
-
- {getFieldDecorator('username', {
- rules: [{ required: true, message: 'Please input your username!' }],
- })(
- }
- placeholder="Username"
- />,
- )}
-
-
- {getFieldDecorator('password', {
- rules: [{ required: true, message: 'Please input your Password!' }],
- })(
- }
- type="password"
- placeholder="Password"
- />,
- )}
-
- {loading}
- {errorMsg}
-
- {getFieldDecorator('remember', {
- valuePropName: 'checked',
- initialValue: true,
- })(Remember me)}
-
-
- Forgot password
-
-
-
-
- );
- }
-}
-
-const WrappedNormalLoginForm = withConfigContext(
- Form.create({ name: 'normal_login' })(NormalLoginForm),
-);
-
-export default withConfigContext(Login);
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Login/styles.css b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Login/styles.css
deleted file mode 100644
index 241959bec0..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/scenes/Login/styles.css
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.
- */
-
-@-moz-keyframes spin {
- 0% {
- -moz-transform: rotate(0deg) scale(1.0);
- }
- 100% {
- -moz-transform: rotate(360deg) scale(0.1);
- }
-}
-
-@-webkit-keyframes spin {
- 0% {
- -webkit-transform: rotate(0deg) scale(1.0);
- }
- 100% {
- -webkit-transform: rotate(360deg) scale(0.1);
- }
-}
-
-@keyframes spin {
- 0% {
- -webkit-transform: rotate(0deg) scale(1.0);
- }
- 100% {
- -webkit-transform: rotate(360deg) scale(0.1);
- transform: rotate(360deg) scale(0.1);
- }
-}
-
-.background {
- position: absolute;
- height: 100%;
- width: 100%;
- z-index: 0;
- background-image: url('https://gw.alipayobjects.com/zos/rmsportal/TVYTbAXWheQpRcWDaDMu.svg');
- background-repeat: no-repeat;
- background-position: center 110px;
- background-size: 100%;
- animation: spin 200s infinite linear;
-}
-
-.content {
- position: relative;
- z-index: 1;
-}
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/services/serviceWorkers/serviceWorker.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/services/serviceWorkers/serviceWorker.js
deleted file mode 100644
index b316b427d7..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/services/serviceWorkers/serviceWorker.js
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * 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.
- */
-
-// This optional code is used to register a service worker.
-// register() is not called by default.
-
-// This lets the app load faster on subsequent visits in production, and gives
-// it offline capabilities. However, it also means that developers (and users)
-// will only see deployed updates on subsequent visits to a page, after all the
-// existing tabs open on the page have been closed, since previously cached
-// resources are updated in the background.
-
-// To learn more about the benefits of this model and instructions on how to
-// opt-in, read https://bit.ly/CRA-PWA
-
-const isLocalhost = Boolean(
- window.location.hostname === 'localhost' ||
- // [::1] is the IPv6 localhost address.
- window.location.hostname === '[::1]' ||
- // 127.0.0.1/8 is considered localhost for IPv4.
- window.location.hostname.match(
- /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/,
- ),
-);
-
-export function register(config) {
- if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
- // The URL constructor is available in all browsers that support SW.
- const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
- if (publicUrl.origin !== window.location.origin) {
- // Our service worker won't work if PUBLIC_URL is on a different origin
- // from what our page is served on. This might happen if a CDN is used to
- // serve assets; see https://github.com/facebook/create-react-app/issues/2374
- return;
- }
-
- window.addEventListener('load', () => {
- const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
-
- if (isLocalhost) {
- // This is running on localhost. Let's check if a service worker still exists or not.
- checkValidServiceWorker(swUrl, config);
-
- // Add some additional logging to localhost, pointing developers to the
- // service worker/PWA documentation.
- navigator.serviceWorker.ready.then(() => {
- console.log(
- 'This web app is being served cache-first by a service ' +
- 'worker. To learn more, visit https://bit.ly/CRA-PWA',
- );
- });
- } else {
- // Is not localhost. Just register service worker
- registerValidSW(swUrl, config);
- }
- });
- }
-}
-
-function registerValidSW(swUrl, config) {
- navigator.serviceWorker
- .register(swUrl)
- .then(registration => {
- registration.onupdatefound = () => {
- const installingWorker = registration.installing;
- if (installingWorker == null) {
- return;
- }
- installingWorker.onstatechange = () => {
- if (installingWorker.state === 'installed') {
- if (navigator.serviceWorker.controller) {
- // At this point, the updated precached content has been fetched,
- // but the previous service worker will still serve the older
- // content until all client tabs are closed.
- console.log(
- 'New content is available and will be used when all ' +
- 'tabs for this page are closed. See https://bit.ly/CRA-PWA.',
- );
-
- // Execute callback
- if (config && config.onUpdate) {
- config.onUpdate(registration);
- }
- } else {
- // At this point, everything has been precached.
- // It's the perfect time to display a
- // "Content is cached for offline use." message.
- console.log('Content is cached for offline use.');
-
- // Execute callback
- if (config && config.onSuccess) {
- config.onSuccess(registration);
- }
- }
- }
- };
- };
- })
- .catch(error => {
- console.error('Error during service worker registration:', error);
- });
-}
-
-function checkValidServiceWorker(swUrl, config) {
- // Check if the service worker can be found. If it can't reload the page.
- fetch(swUrl)
- .then(response => {
- // Ensure service worker exists, and that we really are getting a JS file.
- const contentType = response.headers.get('content-type');
- if (
- response.status === 404 ||
- (contentType != null && contentType.indexOf('javascript') === -1)
- ) {
- // No service worker found. Probably a different app. Reload the page.
- navigator.serviceWorker.ready.then(registration => {
- registration.unregister().then(() => {
- window.location.reload();
- });
- });
- } else {
- // Service worker found. Proceed as normal.
- registerValidSW(swUrl, config);
- }
- })
- .catch(() => {
- console.log(
- 'No internet connection found. App is running in offline mode.',
- );
- });
-}
-
-export function unregister() {
- if ('serviceWorker' in navigator) {
- navigator.serviceWorker.ready.then(registration => {
- registration.unregister();
- });
- }
-}
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/services/utils/errorHandler.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/services/utils/errorHandler.js
deleted file mode 100644
index 9d5b09e3f5..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/src/services/utils/errorHandler.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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 { message, notification } from 'antd';
-
-export const handleApiError = (
- error,
- errorMessage,
- isForbiddenMessageSilent = false,
-) => {
- if (error.hasOwnProperty('response') && error.response.status === 401) {
- message.error('You are not logged in');
- const redirectUrl = encodeURI(window.location.href);
- window.location.href =
- window.location.origin + `/entgra/login?redirect=${redirectUrl}`;
- // silence 403 forbidden message
- } else if (
- !(
- isForbiddenMessageSilent &&
- error.hasOwnProperty('response') &&
- error.response.status === 403
- )
- ) {
- notification.error({
- message: 'There was a problem',
- duration: 10,
- description: errorMessage,
- });
- }
-};
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/react-app/webpack.config.js b/components/device-mgt/io.entgra.device.mgt.ui/react-app/webpack.config.js
deleted file mode 100644
index d666101916..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/react-app/webpack.config.js
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * 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.
- */
-var path = require('path');
-const HtmlWebPackPlugin = require('html-webpack-plugin');
-const MiniCssExtractPlugin = require('mini-css-extract-plugin');
-const configurations = require('./public/conf/config.json');
-
-const config = {
- devtool: 'source-map',
- output: {
- publicPath: '/entgra/',
- },
- watch: false,
- resolve: {
- alias: {
- AppData: path.resolve(__dirname, 'source/src/app/common/'),
- AppComponents: path.resolve(__dirname, 'source/src/app/components/'),
- },
- extensions: ['.jsx', '.js', '.ttf', '.woff', '.woff2', '.svg'],
- },
- module: {
- rules: [
- {
- test: /\.(js|jsx)$/,
- exclude: /node_modules/,
- use: [
- {
- loader: 'babel-loader',
- },
- ],
- },
- {
- test: /\.html$/,
- use: [
- {
- loader: 'html-loader',
- options: { minimize: true },
- },
- ],
- },
- {
- test: /\.css$/,
- use: [MiniCssExtractPlugin.loader, 'css-loader'],
- },
- {
- test: /\.scss$/,
- use: [
- MiniCssExtractPlugin.loader,
- 'css-loader',
- 'postcss-loader',
- 'sass-loader',
- ],
- },
- {
- test: /\.scss$/,
- use: ['style-loader', 'scss-loader'],
- },
- {
- test: /\.less$/,
- use: [
- {
- loader: 'style-loader',
- },
- {
- loader: 'css-loader',
- },
- {
- loader: 'less-loader',
- options: {
- modifyVars: {
- 'primary-color': configurations.theme.primaryColor,
- 'link-color': configurations.theme.primaryColor,
- },
- javascriptEnabled: true,
- },
- },
- ],
- },
- {
- test: /\.(woff|woff2|eot|ttf|svg)$/,
- loader: 'url-loader?limit=100000',
- },
- {
- test: /\.(png|jpe?g)/i,
- use: [
- {
- loader: 'url-loader',
- options: {
- name: './img/[name].[ext]',
- limit: 10000,
- },
- },
- {
- loader: 'img-loader',
- },
- ],
- },
- ],
- },
- plugins: [
- new HtmlWebPackPlugin({
- template: './src/index.html',
- filename: './index.html',
- }),
- new MiniCssExtractPlugin({
- filename: '[name].css',
- chunkFilename: '[id].css',
- }),
- ],
- externals: {
- Config: JSON.stringify(require('./public/conf/config.json')),
- },
-};
-
-if (process.env.NODE_ENV === 'development') {
- config.watch = true;
-}
-
-module.exports = config;
diff --git a/components/device-mgt/io.entgra.device.mgt.ui/src/main/webapp/WEB-INF/web.xml b/components/device-mgt/io.entgra.device.mgt.ui/src/main/webapp/WEB-INF/web.xml
deleted file mode 100644
index d9fcd747a0..0000000000
--- a/components/device-mgt/io.entgra.device.mgt.ui/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
- Entgra-Webapp
-
- 404
- /index.html
-
-
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Feature.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Feature.java
index 897abc67de..fcc61c08b3 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Feature.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Feature.java
@@ -19,15 +19,13 @@ package org.wso2.carbon.device.mgt.common.policy.mgt.ui;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
-import java.util.List;
@XmlRootElement(name = "Feature")
public class Feature {
private String featureCode;
- private List contents;
+ private Content content;
@XmlAttribute(name = "code", required = true)
public String getFeatureCode() {
@@ -38,13 +36,12 @@ public class Feature {
this.featureCode = featureCode;
}
- @XmlElementWrapper(name = "Contents")
@XmlElement(name = "Content")
- public List getContents() {
- return contents;
+ public Content getContent() {
+ return content;
}
- public void setContents(List contents) {
- this.contents = contents;
+ public void setContent(Content content) {
+ this.content = content;
}
}
diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml
index 194676fd50..f3c899be4c 100644
--- a/components/device-mgt/pom.xml
+++ b/components/device-mgt/pom.xml
@@ -41,7 +41,6 @@
org.wso2.carbon.device.mgt.analytics.data.publisherorg.wso2.carbon.device.mgt.url.printerorg.wso2.carbon.device.mgt.analytics.wsproxy
- io.entgra.device.mgt.uiio.entgra.carbon.device.mgt.config.api
diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml
index 223a7469af..25a7d7e095 100644
--- a/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml
+++ b/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml
@@ -62,29 +62,6 @@
-
- copy-entgra-ui
- package
-
- copy
-
-
-
-
- org.wso2.carbon.devicemgt
- io.entgra.device.mgt.ui
- ${project.version}
- war
- true
-
- ${project.build.directory}/maven-shared-archive-resources/webapps
-
- entgra.war
- **/*
-
-
-
-
diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/src/main/resources/p2.inf b/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/src/main/resources/p2.inf
index 7d162718ff..f8525a42a6 100644
--- a/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/src/main/resources/p2.inf
+++ b/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/src/main/resources/p2.inf
@@ -4,4 +4,3 @@ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../featur
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/jaggeryapps/uuf-template-app);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.ui_${feature.version}/jaggeryapps/uuf-template-app,target:${installFolder}/../../deployment/server/jaggeryapps/uuf-template-app,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.ui_${feature.version}/jaggery-modules/utils/,target:${installFolder}/../../modules/utils,overwrite:true);\
-org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.ui_${feature.version}/webapps/entgra.war,target:${installFolder}/../../deployment/server/webapps/entgra.war,overwrite:true);\