Adding changes for store.

feature/appm-store/pbac
sinthuja 7 years ago
parent 498b2c02aa
commit 410fc69bfa

@ -1,7 +1,7 @@
{
"name": "store",
"version": "1.0.0",
"description": "WSO2 IoT Server App Publisher",
"description": "WSO2 IoT Server App Store",
"main": "App.js",
"repository": {
"type": "git",

@ -2,5 +2,10 @@
"theme": {
"type": "default",
"value": "lightBaseTheme"
},
"config": {
"hostname": "localhost",
"httpsPort": "9443",
"apiPort": "8243"
}
}

@ -21,14 +21,14 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<link rel="stylesheet" type="text/css" href="/publisher/css/font-wso2.css">
<link rel="stylesheet" type="text/css" href="/publisher/themes/default/default-theme.css">
<link rel="stylesheet" type="text/css" href="/store/css/font-wso2.css">
<link rel="stylesheet" type="text/css" href="/store/themes/default/default-theme.css">
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="/publisher/manifest.json">
<link rel="shortcut icon" href="/publisher/images/favicon.png">
<link rel="manifest" href="/store/manifest.json">
<link rel="shortcut icon" href="/store/images/favicon.png">
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
@ -38,14 +38,14 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>WSO2 IoT App Publisher</title>
<title>WSO2 IoT App Store</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
<script src='/publisher/dist/index.js'></script>
<script src='/store/dist/index.js'></script>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

@ -1,6 +1,6 @@
{
"short_name": "App Publisher",
"name": "WSO2 IoT App Publisher",
"short_name": "App Store",
"name": "WSO2 IoT App Store",
"icons": [
{
"src": "images/favicon.png",

@ -42,7 +42,7 @@ const history = createHistory({basename: '/store'});
* The Router and Route components.
* The Router and Route is used for navigation.
* We specify the component which needs to be rendered for an URL.
* Ex: When navigate to publisher/overview, the overview component will be rendered inside the main layout.
* Ex: When navigate to store/overview, the overview component will be rendered inside the main layout.
*
* HashRouter is used because the other router types need the server to serve those urls. In hashRouter, server does
* not want to serve the URL.
@ -67,6 +67,7 @@ class Base extends Component {
}
render() {
console.log('in app.jsx');
if (this.state.user !== null) {
return (
<div>
@ -87,9 +88,19 @@ class Base extends Component {
</Switch>
</BaseLayout>
</div>
)
);
} else {
return (<Redirect to={"/assets/apps"}/>)
return (
<div>
<BaseLayout>
<Switch>
<Redirect exact path={"/"} to={"/assets/apps"}/>
<Route exact path={"/assets/apps"} component={ApplicationListing}/>
<Route component={NotFound}/>
</Switch>
</BaseLayout>
</div>
);
}
}
@ -97,24 +108,19 @@ class Base extends Component {
/**
* This component is referred by the index.js to initiate the application.
* TODO: Currently the URL shows like https://localhost:9443/publisher/#/publisher/assets/apps/create. this needs to
* be fixed as https://localhost:9443/publisher/#/assets/apps/create
* TODO: Currently the URL shows like https://localhost:9443/store/#/store/assets/apps/create. this needs to
* be fixed as https://localhost:9443/store/#/assets/apps/create
*
* */
class Store extends Component {
constructor() {
super();
this.state = {
muiTheme: null,
selectedType: null,
selectedTheme: null
};
}
render() {
return (
<div className="App">
<Router basename="publisher" history={history}>
<Router basename="store" history={history}>
<Switch>
<Route path="/login" component={Login}/>
<Route path="/logout" component={Login}/>

@ -60,6 +60,10 @@ class AuthHandler {
return login_promise;
};
static loginAsAnonymous(){
}
/**
* Persists the user object in browser's local storage.
* @param user: The user object.

@ -19,7 +19,7 @@
'use strict';
/**
* Helper methods for app publisher.
* Helper methods for app store.
* */
export default class Helper {

@ -16,32 +16,53 @@
* under the License.
*/
'use strict';
import axios from 'axios';
//TODO: Replace the server address with response from auth endpoint and remove hardcoded ids etc.
export default class Constants {
class Constants {
constructor() {
this.contentTypeHeaderName = 'Content-Type';
this.contentType = 'application/json';
this.https = 'https://';
console.log('server config called');
this.serverConfig = {};
this.getServerConfig();
static scopes = 'perm:application:get perm:application:create perm:application:update perm:application-mgt:login' +
this.scopes = 'perm:application:get perm:application:create perm:application:update perm:application-mgt:login' +
' perm:application:delete perm:platform:add perm:platform:remove perm:roles:view perm:devices:view';
static appManagerEndpoints = {
GET_ALL_APPS: 'https://localhost:8243/api/application-mgt/v1.0/applications/1.0.0/',
this.appManagerEndpoints = {
GET_ALL_APPS: this.https + this.serverConfig.hostname + ':' + this.serverConfig.httpsPort + '/api/application-mgt/v1.0/applications/1.0.0/',
CREATE_APP: 'https://localhost:8243/api/application-mgt/v1.0/applications/1.0.0/',
UPLOAD_IMAGE_ARTIFACTS: 'https://localhost:8243/api/application-mgt/v1.0/applications/1.0.0/upload-image-artifacts/', //+appId
GET_IMAGE_ARTIFACTS: "https://localhost:8243/api/application-mgt/v1.0/applications/1.0.0/image-artifacts/"
};
static platformManagerEndpoints = {
this.platformManagerEndpoints = {
CREATE_PLATFORM: 'https://localhost:8243/api/application-mgt/v1.0/platforms/1.0.0',
GET_ENABLED_PLATFORMS: 'https://localhost:8243/api/application-mgt/v1.0/platforms/1.0.0?status=ENABLED',
GET_PLATFORM: 'https://localhost:8243/api/application-mgt/v1.0/platforms/1.0.0/'
};
static userConstants = {
LOGIN_URL:"https://localhost:9443/auth/application-mgt/v1.0/auth/login",
this.userConstants = {
LOGIN_URL: "https://localhost:9443/auth/application-mgt/v1.0/auth/login",
LOGOUT_URL: "https://localhost:9443/auth/application-mgt/v1.0/auth/logout",
REFRESH_TOKEN_URL: "",
WSO2_USER: 'wso2_user',
PARTIAL_TOKEN: 'WSO2_IOT_TOKEN'
};
}
getServerConfig(callback) {
let baseURL = window.location.origin;
let appContext = window.location.pathname.split("/")[1];
let configFileName = 'config.json';
return axios.get(baseURL + "/" + configFileName);
}
}
export default (new Constants);

@ -75,7 +75,7 @@ class BaseLayout extends Component {
<div id="header-content">
<div id="header">
<span id="header-text">
WSO2 IoT App Publisher
WSO2 IoT App Store
</span>
<div id="header-btn-container">
<i className="fw fw-notification btn-header"></i>

@ -21,6 +21,7 @@ import {withRouter} from 'react-router-dom';
import {Button, Col, Row, Table} from 'reactstrap';
import Drawer from '../UIComponents/Drawer/Drawer';
import ApplicationView from './View/ApplicationView';
import Constants from '../../common/constants';
/**
* The App Create Component.
@ -54,6 +55,7 @@ class ApplicationListing extends Component {
src: "http://dl1.cbsistatic.com/i/r/2016/08/08/0e67e43a-5a45-41ab-b81d-acfba8708044/resize/736x552/0c0ee669677b5060a0fa1bfb0c7873b4/android-logo-promo-470.png"
}]
};
console.log(Constants.appManagerEndpoints.GET_ALL_APPS);
}
headers = [
@ -200,7 +202,7 @@ class ApplicationListing extends Component {
};
let appListStyle = {
marginRight: '500px',
marginRight: '500px'
};
this.setState({drawer: style, appListStyle: appListStyle});
@ -237,15 +239,7 @@ class ApplicationListing extends Component {
render() {
return (
<div id="application-list" style={this.state.appListStyle}>
<Row>
<Col xs="3 offset-9">
<div className="platform-link-placeholder">
<Button><i className="fw fw-settings"></i> Platforms</Button>
</div>
</Col>
</Row>
<Row>
<Col>
<Table striped hover>

@ -72,7 +72,7 @@ class ApplicationEdit extends Component {
}
handleOnBackClick() {
window.location.href = "/publisher/assets/apps"
window.location.href = "/store/assets/apps"
}
render() {

@ -132,7 +132,7 @@ class Login extends Component {
{/*TODO: Style the components.*/}
<Card id="login-card">
<CardBlock>
<CardTitle>WSO2 IoT APP Publisher</CardTitle>
<CardTitle>WSO2 IoT APP Store</CardTitle>
<Form onSubmit={this.handleLogin.bind(this)}>
<FormGroup row>
<Label for="userName" sm={2}>User Name:</Label>

@ -18,7 +18,7 @@
import Login from './User/Login/Login';
import NotFound from './Error/NotFound';
import BaseLayout from './AppPublisherBase/BaseLayout';
import BaseLayout from './AppStoreBase/BaseLayout';
import PlatformCreate from './Platform/PlatformCreate';
import PlatformListing from './Platform/PlatformListing';
import ApplicationCreate from './Application/Create/ApplicationCreate';

@ -48,7 +48,7 @@ export default function register() {
}
window.addEventListener('load', () => {
const swUrl = `${process.env.PUBLIC_URL}/publisher/service-worker.js`;
const swUrl = `${process.env.PUBLIC_URL}/store/service-worker.js`;
if (!isLocalhost) {
// Is not local host. Just register service worker

Loading…
Cancel
Save