forked from community/device-mgt-core
parent
0725ecc0d4
commit
aaf6f647ec
@ -0,0 +1,27 @@
|
|||||||
|
import react from 'react';
|
||||||
|
import { withConfigContext } from '../context/ConfigContext';
|
||||||
|
|
||||||
|
class Authorized extends react.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
}
|
||||||
|
|
||||||
|
isAuthorized = (user, permission) => {
|
||||||
|
if (!user || !permission) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return user.permissions.includes(permission);
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return this.isAuthorized(this.props.context.user, this.props.permission)
|
||||||
|
? this.props.yes
|
||||||
|
: this.props.no;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Authorized.defaultProps = {
|
||||||
|
yes: () => null,
|
||||||
|
no: () => null,
|
||||||
|
};
|
||||||
|
export default withConfigContext(Authorized);
|
0
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ImageViewer/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/ImageViewer/index.js
vendored
0
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ImageViewer/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/ImageViewer/index.js
vendored
4
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Install/components/DeviceInstall/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/Install/components/DeviceInstall/index.js
vendored
4
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Install/components/DeviceInstall/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/Install/components/DeviceInstall/index.js
vendored
4
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Install/components/GroupInstall/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/Install/components/GroupInstall/index.js
vendored
4
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Install/components/GroupInstall/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/Install/components/GroupInstall/index.js
vendored
4
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Install/components/RoleInstall/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/Install/components/RoleInstall/index.js
vendored
4
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Install/components/RoleInstall/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/Install/components/RoleInstall/index.js
vendored
4
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Install/components/UserInstall/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/Install/components/UserInstall/index.js
vendored
4
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Install/components/UserInstall/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/Install/components/UserInstall/index.js
vendored
0
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Install/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/Install/index.js
vendored
0
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Install/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/Install/index.js
vendored
4
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/CurrentUsersReview/components/AddReview/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/ReviewContainer/componets/CurrentUsersReview/components/AddReview/index.js
vendored
4
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/CurrentUsersReview/components/AddReview/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/ReviewContainer/componets/CurrentUsersReview/components/AddReview/index.js
vendored
27
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/CurrentUsersReview/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/ReviewContainer/componets/CurrentUsersReview/index.js
vendored
27
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/CurrentUsersReview/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/ReviewContainer/componets/CurrentUsersReview/index.js
vendored
2
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Rating/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/ReviewContainer/componets/Rating/index.js
vendored
2
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Rating/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/ReviewContainer/componets/Rating/index.js
vendored
0
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Rating/styles.css → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/ReviewContainer/componets/Rating/styles.css
0
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Rating/styles.css → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/ReviewContainer/componets/Rating/styles.css
4
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Reviews/components/Review/components/Edit/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/ReviewContainer/componets/Reviews/components/Review/components/Edit/index.js
vendored
4
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Reviews/components/Review/components/Edit/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/ReviewContainer/componets/Reviews/components/Review/components/Edit/index.js
vendored
0
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Reviews/components/Review/components/Edit/styles.css → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/ReviewContainer/componets/Reviews/components/Review/components/Edit/styles.css
0
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Reviews/components/Review/components/Edit/styles.css → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/ReviewContainer/componets/Reviews/components/Review/components/Edit/styles.css
29
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Reviews/components/Review/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/ReviewContainer/componets/Reviews/components/Review/index.js
vendored
29
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Reviews/components/Review/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/ReviewContainer/componets/Reviews/components/Review/index.js
vendored
0
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Reviews/components/Review/styles.css → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/ReviewContainer/componets/Reviews/components/Review/styles.css
0
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Reviews/components/Review/styles.css → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/ReviewContainer/componets/Reviews/components/Review/styles.css
4
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Reviews/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/ReviewContainer/componets/Reviews/index.js
vendored
4
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Reviews/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/ReviewContainer/componets/Reviews/index.js
vendored
0
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Reviews/styles.css → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/ReviewContainer/componets/Reviews/styles.css
0
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/componets/Reviews/styles.css → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/ReviewContainer/componets/Reviews/styles.css
32
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/ReviewContainer/index.js
vendored
32
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/ReviewContainer/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/ReviewContainer/index.js
vendored
24
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/SubscriptionDetails/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/SubscriptionDetails/index.js
vendored
24
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/SubscriptionDetails/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/SubscriptionDetails/index.js
vendored
4
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Uninstall/components/DeviceUninstall/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/Uninstall/components/DeviceUninstall/index.js
vendored
4
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Uninstall/components/DeviceUninstall/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/Uninstall/components/DeviceUninstall/index.js
vendored
4
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Uninstall/components/GroupUninstall/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/Uninstall/components/GroupUninstall/index.js
vendored
4
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Uninstall/components/GroupUninstall/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/Uninstall/components/GroupUninstall/index.js
vendored
4
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Uninstall/components/RoleUninstall/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/Uninstall/components/RoleUninstall/index.js
vendored
4
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Uninstall/components/RoleUninstall/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/Uninstall/components/RoleUninstall/index.js
vendored
4
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Uninstall/components/UserUninstall/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/Uninstall/components/UserUninstall/index.js
vendored
4
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Uninstall/components/UserUninstall/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/Uninstall/components/UserUninstall/index.js
vendored
0
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Uninstall/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/Uninstall/index.js
vendored
0
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/Uninstall/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/Uninstall/index.js
vendored
0
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/installModalFooter/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/installModalFooter/index.js
vendored
0
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/components/installModalFooter/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/components/installModalFooter/index.js
vendored
24
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/index.js
vendored
24
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleaseView/index.js → components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/scenes/Home/scenes/Apps/scenes/Release/components/ReleasePage/components/ReleaseView/index.js
vendored
@ -0,0 +1,135 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019, 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 '../../../../../../../../App.css';
|
||||||
|
import { Skeleton, Typography, Row, Col, Card, Breadcrumb, Icon } from 'antd';
|
||||||
|
import ReleaseView from './components/ReleaseView';
|
||||||
|
import axios from 'axios';
|
||||||
|
import { withConfigContext } from '../../../../../../../../components/context/ConfigContext';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
import { handleApiError } from '../../../../../../../../services/utils/errorHandler';
|
||||||
|
|
||||||
|
const { Title } = Typography;
|
||||||
|
|
||||||
|
class ReleasePage extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
loading: true,
|
||||||
|
app: null,
|
||||||
|
uuid: null,
|
||||||
|
forbiddenErrors: {
|
||||||
|
app: false,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
const { uuid, deviceType } = this.props;
|
||||||
|
this.fetchData(uuid);
|
||||||
|
this.props.changeSelectedMenuItem(deviceType);
|
||||||
|
}
|
||||||
|
|
||||||
|
fetchData = uuid => {
|
||||||
|
const config = this.props.context;
|
||||||
|
|
||||||
|
// send request to the invoker
|
||||||
|
axios
|
||||||
|
.get(
|
||||||
|
window.location.origin +
|
||||||
|
config.serverConfig.invoker.uri +
|
||||||
|
config.serverConfig.invoker.store +
|
||||||
|
'/applications/' +
|
||||||
|
uuid,
|
||||||
|
)
|
||||||
|
.then(res => {
|
||||||
|
if (res.status === 200) {
|
||||||
|
let app = res.data.data;
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
app: app,
|
||||||
|
loading: false,
|
||||||
|
uuid: uuid,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
handleApiError(
|
||||||
|
error,
|
||||||
|
'Error occurred while trying to load releases.',
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
if (error.hasOwnProperty('response') && error.response.status === 403) {
|
||||||
|
const { forbiddenErrors } = this.state;
|
||||||
|
forbiddenErrors.app = true;
|
||||||
|
this.setState({
|
||||||
|
forbiddenErrors,
|
||||||
|
loading: false,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.setState({
|
||||||
|
loading: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { app, loading } = this.state;
|
||||||
|
const { deviceType } = this.props;
|
||||||
|
|
||||||
|
let content = <Title level={3}>No Releases Found</Title>;
|
||||||
|
let appName = 'loading...';
|
||||||
|
|
||||||
|
if (app != null && app.applicationReleases.length !== 0) {
|
||||||
|
content = <ReleaseView app={app} deviceType={deviceType} />;
|
||||||
|
appName = app.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div style={{ background: '#f0f2f5', minHeight: 780 }}>
|
||||||
|
<Row style={{ padding: 10 }}>
|
||||||
|
<Col lg={4}></Col>
|
||||||
|
<Col lg={16} md={24} style={{ padding: 3 }}>
|
||||||
|
<Breadcrumb style={{ paddingBottom: 16 }}>
|
||||||
|
<Breadcrumb.Item>
|
||||||
|
<Link to={'/store/' + deviceType}>
|
||||||
|
<Icon type="home" /> {deviceType + ' apps'}{' '}
|
||||||
|
</Link>
|
||||||
|
</Breadcrumb.Item>
|
||||||
|
<Breadcrumb.Item>{appName}</Breadcrumb.Item>
|
||||||
|
</Breadcrumb>
|
||||||
|
<Card>
|
||||||
|
<Skeleton
|
||||||
|
loading={loading}
|
||||||
|
avatar={{ size: 'large' }}
|
||||||
|
active
|
||||||
|
paragraph={{ rows: 8 }}
|
||||||
|
>
|
||||||
|
{content}
|
||||||
|
</Skeleton>
|
||||||
|
</Card>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default withConfigContext(ReleasePage);
|
@ -1,138 +1,31 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2019, 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 React from 'react';
|
||||||
import '../../../../../../App.css';
|
import Authorized from '../../../../../../components/Authorized';
|
||||||
import { Skeleton, Typography, Row, Col, Card, Breadcrumb, Icon } from 'antd';
|
import ReleasePage from './components/ReleasePage';
|
||||||
import ReleaseView from './components/ReleaseView';
|
import { Result } from 'antd';
|
||||||
import axios from 'axios';
|
|
||||||
import { withConfigContext } from '../../../../../../components/context/ConfigContext';
|
|
||||||
import { Link } from 'react-router-dom';
|
|
||||||
import { handleApiError } from '../../../../../../services/utils/errorHandler';
|
|
||||||
|
|
||||||
const { Title } = Typography;
|
|
||||||
|
|
||||||
class Release extends React.Component {
|
class Release extends React.Component {
|
||||||
routes;
|
render() {
|
||||||
|
|
||||||
constructor(props) {
|
|
||||||
super(props);
|
|
||||||
this.routes = props.routes;
|
|
||||||
this.state = {
|
|
||||||
loading: true,
|
|
||||||
app: null,
|
|
||||||
uuid: null,
|
|
||||||
forbiddenErrors: {
|
|
||||||
app: false,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
const { uuid, deviceType } = this.props.match.params;
|
const { uuid, deviceType } = this.props.match.params;
|
||||||
this.fetchData(uuid);
|
return (
|
||||||
this.props.changeSelectedMenuItem(deviceType);
|
<Authorized
|
||||||
}
|
permission="/permission/admin/app-mgt/store/application/view"
|
||||||
|
yes={
|
||||||
fetchData = uuid => {
|
<ReleasePage
|
||||||
const config = this.props.context;
|
uuid={uuid}
|
||||||
|
deviceType={deviceType}
|
||||||
// send request to the invoker
|
changeSelectedMenuItem={this.props.changeSelectedMenuItem}
|
||||||
axios
|
/>
|
||||||
.get(
|
|
||||||
window.location.origin +
|
|
||||||
config.serverConfig.invoker.uri +
|
|
||||||
config.serverConfig.invoker.store +
|
|
||||||
'/applications/' +
|
|
||||||
uuid,
|
|
||||||
)
|
|
||||||
.then(res => {
|
|
||||||
if (res.status === 200) {
|
|
||||||
let app = res.data.data;
|
|
||||||
|
|
||||||
this.setState({
|
|
||||||
app: app,
|
|
||||||
loading: false,
|
|
||||||
uuid: uuid,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
})
|
no={
|
||||||
.catch(error => {
|
<Result
|
||||||
handleApiError(
|
status="403"
|
||||||
error,
|
title="403"
|
||||||
'Error occurred while trying to load releases.',
|
subTitle="You don't have permission to view apps."
|
||||||
false,
|
/>
|
||||||
);
|
|
||||||
if (error.hasOwnProperty('response') && error.response.status === 403) {
|
|
||||||
const { forbiddenErrors } = this.state;
|
|
||||||
forbiddenErrors.app = true;
|
|
||||||
this.setState({
|
|
||||||
forbiddenErrors,
|
|
||||||
loading: false,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.setState({
|
|
||||||
loading: false,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
/>
|
||||||
};
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const { app, loading } = this.state;
|
|
||||||
const { deviceType } = this.props.match.params;
|
|
||||||
|
|
||||||
let content = <Title level={3}>No Releases Found</Title>;
|
|
||||||
let appName = 'loading...';
|
|
||||||
|
|
||||||
if (app != null && app.applicationReleases.length !== 0) {
|
|
||||||
content = <ReleaseView app={app} deviceType={deviceType} />;
|
|
||||||
appName = app.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div style={{ background: '#f0f2f5', minHeight: 780 }}>
|
|
||||||
<Row style={{ padding: 10 }}>
|
|
||||||
<Col lg={4}></Col>
|
|
||||||
<Col lg={16} md={24} style={{ padding: 3 }}>
|
|
||||||
<Breadcrumb style={{ paddingBottom: 16 }}>
|
|
||||||
<Breadcrumb.Item>
|
|
||||||
<Link to={'/store/' + deviceType}>
|
|
||||||
<Icon type="home" /> {deviceType + ' apps'}{' '}
|
|
||||||
</Link>
|
|
||||||
</Breadcrumb.Item>
|
|
||||||
<Breadcrumb.Item>{appName}</Breadcrumb.Item>
|
|
||||||
</Breadcrumb>
|
|
||||||
<Card>
|
|
||||||
<Skeleton
|
|
||||||
loading={loading}
|
|
||||||
avatar={{ size: 'large' }}
|
|
||||||
active
|
|
||||||
paragraph={{ rows: 8 }}
|
|
||||||
>
|
|
||||||
{content}
|
|
||||||
</Skeleton>
|
|
||||||
</Card>
|
|
||||||
</Col>
|
|
||||||
</Row>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withConfigContext(Release);
|
export default Release;
|
||||||
|
Loading…
Reference in new issue