Fix remaining api calls in APPM UI

feature/appm-store/pbac
Jayasanka 6 years ago
parent ac817c61f7
commit ef224a75dc

@ -15,7 +15,6 @@ class App extends React.Component {
}
render() {
console.log(this.routes);
return (
<Router>
<div>

@ -30,6 +30,7 @@ class DetailedRating extends React.Component{
}
getData = (type, uuid)=>{
console.log();
return axios.get(
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri +config.serverConfig.invoker.store+"/reviews/"+uuid+"/"+type+"-rating",
@ -38,7 +39,6 @@ class DetailedRating extends React.Component{
}).then(res => {
if (res.status === 200) {
let detailedRating = res.data.data;
console.log(type,uuid);
this.setState({
detailedRating
})
@ -48,15 +48,12 @@ class DetailedRating extends React.Component{
if (error.response.status === 401) {
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
}
console.log(error);
});
};
render() {
const detailedRating = this.state.detailedRating;
console.log(detailedRating);
if(detailedRating ==null){
return null;
@ -81,7 +78,6 @@ class DetailedRating extends React.Component{
}
}
console.log(ratingBarPercentages);
return (
<Row className="d-rating">

@ -12,7 +12,6 @@ class AppDetailsDrawer extends React.Component {
if (app == null) {
return null;
}
console.log(app);
return (
<div>

@ -113,8 +113,7 @@ class AppsTable extends React.Component {
const data = {
};
console.log(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri +config.serverConfig.invoker.publisher+"/applications?"+encodedExtraParams);
axios.post(
axios.post(
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri +config.serverConfig.invoker.publisher+"/applications?"+encodedExtraParams,
data,
{
@ -152,7 +151,6 @@ class AppsTable extends React.Component {
};
render() {
console.log("rendered");
return (
<Table

@ -26,7 +26,6 @@ class ConnectedListApps extends React.Component {
//handler to show app drawer
showDrawer = (app) => {
console.log(app);
this.setState({
isDrawerVisible: true,
selectedApp: app
@ -56,7 +55,7 @@ class ConnectedListApps extends React.Component {
<Col span={18} style={{textAlign: "right"}}>
<Search
placeholder="input search text"
onSearch={value => console.log(value)}
// onSearch={value => console.log(value)}
style={{width: 200}}
/>
</Col>

@ -62,8 +62,6 @@ class ConnectedLifecycleModal extends React.Component {
handleSubmit = event => {
this.setState({ loading: true });
event.preventDefault();
console.log(this.reason);
console.log("uuid", this.props.uuid);
this.props.updateLifecycleState(this.props.uuid, this.props.nextState, this.reason.state.value)
};

@ -72,7 +72,7 @@ class ReleaseView extends React.Component {
<DetailedRating type="release" uuid={release.uuid}/>
</Col>
</Row>
<Reviews uuid={release.uuid}/>
<Reviews type="release" uuid={release.uuid}/>
</div>
</div>
);

@ -28,10 +28,10 @@ class Reviews extends React.Component {
fetchData = (offset, limit, callback) => {
const {uuid} = this.props;
const {uuid, type} = this.props;
axios.get(
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri +config.serverConfig.invoker.store+"/reviews/app/"+uuid,
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri +config.serverConfig.invoker.store+"/reviews/"+type+"/"+uuid,
{
headers: {'X-Platform': config.serverConfig.platform}
}).then(res => {

@ -92,7 +92,7 @@ function connectNodes(nodeFrom, nodeTo) {
}
function f() {
console.log(1);
// console.log(1);
}
export default LifeCycleGraph;

@ -241,7 +241,6 @@ class ManageCategories extends React.Component {
saveInputRef = input => (this.input = input);
closeEditModal = e => {
console.log(e);
this.setState({
isEditModalVisible: false,
currentlyEditingId: null

@ -240,7 +240,6 @@ class ManageTags extends React.Component {
saveInputRef = input => (this.input = input);
closeEditModal = e => {
console.log(e);
this.setState({
isEditModalVisible: false,
currentlyEditingId: null

@ -98,7 +98,6 @@ class EditableTagGroup extends React.Component {
handleClose = (removedTag) => {
const tags = this.state.tags.filter(tag => tag !== removedTag);
console.log(tags);
this.setState({tags});
}

@ -2,7 +2,6 @@ import React from "react"
class Step3 extends React.Component {
render() {
console.log("hhhoohh");
return (
<p>tttoooeeee</p>
);

@ -41,7 +41,7 @@ class Apps extends React.Component {
<Col span={6} offset={18}>
<Search
placeholder="search"
onSearch={value => console.log(value)}
// onSearch={value => console.log(value)}
style={{ width: 200}}
/>
<Button style={{margin:5}}>Advanced Search</Button>

@ -53,14 +53,13 @@ class Release extends React.Component {
//send request to the invoker
axios.get(
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.store + "/applications/" + uuid,
config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/release/"+ uuid,
{
headers: {'X-Platform': config.serverConfig.platform}
}
).then(res => {
if (res.status === 200) {
let app = res.data.data;
console.log(app);
this.setState({
app: app,
loading: false,

@ -8,6 +8,12 @@
"hostname": "localhost",
"httpsPort": "9443",
"invokerUri": "/ui-request-handler/invoke/application-mgt-store/v1.0",
"invoker": {
"uri": "/ui-request-handler/invoke",
"publisher": "/application-mgt-publisher/v1.0",
"store": "/application-mgt-store/v1.0",
"admin" : ""
},
"loginUri": "/ui-request-handler/login",
"platform": "store"
},

@ -37,9 +37,11 @@ class AppList extends React.Component {
payload.deviceType= deviceType;
}
console.log("b",config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.store+"/applications/");
//send request to the invoker
axios.post(
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri+"/applications/",
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.store+"/applications/",
payload,
{
headers: { 'X-Platform': config.serverConfig.platform }
@ -54,7 +56,7 @@ class AppList extends React.Component {
})
}
}).catch((error) => {
}).catch((error) => { console.log(error.response);
if (error.hasOwnProperty("response") && error.response.status === 401) {
//todo display a popup with error
message.error('You are not logged in');

@ -1,12 +1,13 @@
import React from "react";
import {Row, Typography, Icon} from "antd";
import StarRatings from "react-star-ratings";
import axios from "axios";
import "./DetailedRating.css";
import config from "../../../../public/conf/config.json";
import axios from "axios";
const { Text } = Typography;
class DetailedRating extends React.Component{
constructor(props){
@ -17,20 +18,24 @@ class DetailedRating extends React.Component{
}
componentDidMount() {
this.getData(this.props.uuid);
const {type,uuid} = this.props;
this.getData(type,uuid);
}
componentDidUpdate(prevProps, prevState) {
if (prevProps.uuid !== this.props.uuid) {
this.getData(this.props.uuid);
const {type,uuid} = this.props;
this.getData(type,uuid);
}
}
getData = (uuid)=>{
const request = "method=get&content-type=application/json&payload={}&api-endpoint=/application-mgt-store/v1.0/reviews/"+uuid+"/rating";
getData = (type, uuid)=>{
return axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => {
return axios.get(
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri +config.serverConfig.invoker.store+"/reviews/"+uuid+"/"+type+"-rating",
{
headers: { 'X-Platform': config.serverConfig.platform }
}).then(res => {
if (res.status === 200) {
let detailedRating = res.data.data;
this.setState({
@ -48,8 +53,6 @@ class DetailedRating extends React.Component{
render() {
const detailedRating = this.state.detailedRating;
console.log(detailedRating);
if(detailedRating ==null){
return null;
}
@ -73,8 +76,6 @@ class DetailedRating extends React.Component{
}
}
console.log(ratingBarPercentages);
return (
<Row className="d-rating">
<div className="numeric-data">

@ -21,14 +21,14 @@ class ReleaseView extends React.Component {
}
}
installApp = (type,payload) => {
installApp = (type, payload) => {
const {uuid} = this.props.release;
const parameters = {
method: "post",
'content-type': "application/json",
payload: JSON.stringify(payload),
'api-endpoint': "/application-mgt-store/v1.0/subscription/install/" + uuid + "/"+type+"/install"
'api-endpoint': "/application-mgt-store/v1.0/subscription/install/" + uuid + "/" + type + "/install"
};
const request = Object.keys(parameters).map(key => key + '=' + parameters[key]).join('&');
@ -36,7 +36,7 @@ class ReleaseView extends React.Component {
loading: true,
});
axios.post(config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
axios.post(config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.store, request
).then(res => {
if (res.status === 201) {
this.setState({
@ -60,8 +60,9 @@ class ReleaseView extends React.Component {
}
}).catch((error) => {
console.log(error);
if (error.response.status === 401) {
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/store/login';
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/store/login';
} else {
this.setState({
loading: false,
@ -133,13 +134,13 @@ class ReleaseView extends React.Component {
<Text>REVIEWS</Text>
<Row>
<Col lg={18}>
<DetailedRating uuid={release.uuid}/>
<DetailedRating type="app" uuid={release.uuid}/>
</Col>
<Col lg={6}>
<AddReview uuid={release.uuid}/>
</Col>
</Row>
<Reviews uuid={release.uuid}/>
<Reviews type="app" uuid={release.uuid}/>
</div>
</div>
);

@ -21,7 +21,7 @@ class AppInstallModal extends React.Component{
onCancel={this.props.onClose}
footer={null}
>
<Tabs defaultActiveKey="1" onChange={()=>{console.log("changed");}}>
<Tabs defaultActiveKey="1">
<TabPane tab="User" key="1">
<UserInstall onInstall={this.props.onInstall}/>
</TabPane>

@ -95,7 +95,7 @@ class DeviceInstall extends React.Component {
rowSelection = {
onChange: (selectedRowKeys, selectedRows) => {
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
// console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
this.setState({
selectedRows: selectedRows
})
@ -138,11 +138,10 @@ class DeviceInstall extends React.Component {
const request = Object.keys(parameters).map(key => key + '=' + parameters[key]).join('&');
//send request to the invoker
axios.post(config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
axios.post(config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.store, request
).then(res => {
if (res.status === 200) {
const pagination = {...this.state.pagination};
console.log(res.data.data.devices);
this.setState({
loading: false,
data: res.data.data.devices,
@ -151,7 +150,7 @@ class DeviceInstall extends React.Component {
}
}).catch((error) => {
}).catch((error) => { console.log(error);
if (error.hasOwnProperty("status") && error.response.status === 401) {
//todo display a popop with error
message.error('You are not logged in');

@ -35,9 +35,7 @@ class GroupInstall extends React.Component {
'api-endpoint': "/device-mgt/v1.0/admin/groups?name=" + value
};
const request = Object.keys(parameters).map(key => key + '=' + parameters[key]).join('&');
console.log(request);
axios.post(config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
axios.post(config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.store, request
).then(res => {
if (res.status === 200) {
if (fetchId !== this.lastFetchId) {
@ -45,8 +43,6 @@ class GroupInstall extends React.Component {
return;
}
console.log(res.data.data);
const data = res.data.data.deviceGroups.map(group => ({
text: group.name,
value: group.name,
@ -55,7 +51,7 @@ class GroupInstall extends React.Component {
this.setState({data, fetching: false});
}
}).catch((error) => {
}).catch((error) => { console.log(error);
if (error.hasOwnProperty("status") && error.response.status === 401) {
message.error('You are not logged in');
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/store/login';

@ -35,9 +35,7 @@ class RoleInstall extends React.Component {
'api-endpoint': "/device-mgt/v1.0/roles?filter=" + value
};
const request = Object.keys(parameters).map(key => key + '=' + parameters[key]).join('&');
console.log(request);
axios.post(config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
axios.post(config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.store, request
).then(res => {
if (res.status === 200) {
if (fetchId !== this.lastFetchId) {
@ -45,8 +43,6 @@ class RoleInstall extends React.Component {
return;
}
console.log(res.data.data);
const data = res.data.data.roles.map(role => ({
text: role,
value: role,
@ -55,7 +51,7 @@ class RoleInstall extends React.Component {
this.setState({data, fetching: false});
}
}).catch((error) => {
}).catch((error) => { console.log(error);
if (error.hasOwnProperty("status") && error.response.status === 401) {
message.error('You are not logged in');
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/store/login';

@ -23,7 +23,6 @@ class UserInstall extends React.Component {
};
fetchUser = value => {
console.log('fetching user', value);
this.lastFetchId += 1;
const fetchId = this.lastFetchId;
this.setState({data: [], fetching: true});
@ -31,7 +30,7 @@ class UserInstall extends React.Component {
//send request to the invoker
axios.get(
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri+"/device-mgt/v1.0/users/search?username=" + value,
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.store+"/device-mgt/v1.0/users/search?username=" + value,
{
headers: { 'X-Platform': config.serverConfig.platform }
}
@ -42,8 +41,6 @@ class UserInstall extends React.Component {
return;
}
console.log(res.data.data);
const data = res.data.data.users.map(user => ({
text: user.username,
value: user.username,

@ -54,8 +54,12 @@ class AddReview extends React.Component {
const request = "method=post&content-type=application/json&payload="+JSON.stringify(payload)+"&api-endpoint=/application-mgt-store/v1.0/reviews/"+uuid;
axios.post(config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => {
axios.post(
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri +config.serverConfig.invoker.store+"/reviews/"+uuid,
payload,
{
headers: { 'X-Platform': config.serverConfig.platform }
}).then(res => {
if (res.status === 201) {
this.setState({
loading: false,

@ -27,9 +27,14 @@ class Reviews extends React.Component {
}
fetchData = (offset, limit, callback) => {
const request = "method=get&content-type=application/json&payload={}&api-endpoint=/application-mgt-store/v1.0/reviews/" + this.props.uuid + "?offset=" + offset + "%26limit=" + limit;
axios.post(config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => {
const {uuid, type} = this.props;
axios.get(
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri +config.serverConfig.invoker.store+"/reviews/"+type+"/"+uuid,
{
headers: {'X-Platform': config.serverConfig.platform}
}).then(res => {
if (res.status === 200) {
let reviews = res.data.data.data;
callback(reviews);

@ -19,7 +19,6 @@ class Dashboard extends React.Component {
}
changeSelectedMenuItem = (key) =>{
console.log("called", key);
this.setState({
selectedKeys: [key]
})
@ -27,7 +26,6 @@ class Dashboard extends React.Component {
render() {
const {selectedKeys} = this.state;
console.log(selectedKeys);
return (
<div>
<Layout className="layout">

@ -28,7 +28,6 @@ class Release extends React.Component {
}
componentDidUpdate(prevProps, prevState, snapshot) {
console.log(prevState);
if (prevState.uuid !== this.state.uuid) {
const {uuid,deviceType} = this.props.match.params;
this.fetchData(uuid);
@ -39,7 +38,7 @@ class Release extends React.Component {
fetchData = (uuid)=>{
//send request to the invoker
axios.get(
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri+"/applications/"+uuid,
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.store+"/applications/"+uuid,
{
headers: { 'X-Platform': config.serverConfig.platform }
}
@ -47,8 +46,6 @@ class Release extends React.Component {
if (res.status === 200) {
let app = res.data.data;
console.log(app);
this.setState({
app: app,
loading: false,
@ -56,7 +53,7 @@ class Release extends React.Component {
})
}
}).catch((error) => {
}).catch((error) => { console.log(error);
if (error.hasOwnProperty("response") && error.response.status === 401) {
//todo display a popop with error
message.error('You are not logged in');

Loading…
Cancel
Save