Merge pull request #1028 from sinthuja/application-mgt

Application mgt
feature/appm-store/pbac
Megala Uthayakumar 7 years ago committed by GitHub
commit 370e1a8a6b

5
.gitignore vendored

@ -28,3 +28,8 @@ components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/s
components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/build/
components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/package-lock.json
components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/npm-debug.log
components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/public/dist/
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/node_modules/
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/public/dist/
components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/package-lock.json

@ -0,0 +1,84 @@
{
"welcomeFiles": [
"index.html"
],
"urlMappings": [
{
"url": "/login",
"path": "/index.html"
},
{
"url": "/assets/apps",
"path": "/index.html"
}
],
"listeners": [
{
"class": "org.owasp.csrfguard.CsrfGuardServletContextListener"
},
{
"class": "org.owasp.csrfguard.CsrfGuardHttpSessionListener"
}
],
"servlets": [
{
"name": "JavaScriptServlet",
"class": "org.owasp.csrfguard.servlet.JavaScriptServlet"
}
],
"servletMappings": [
{
"name": "JavaScriptServlet",
"url": "/csrf.js"
}
],
"contextParams": [
{
"name": "Owasp.CsrfGuard.Config",
"value": "repository/conf/security/Owasp.CsrfGuard.dashboard.properties"
}
],
"filters": [
{
"name": "ContentTypeBasedCachePreventionFilter",
"class": "org.wso2.carbon.ui.filters.cache.ContentTypeBasedCachePreventionFilter",
"params" : [
{"name" : "patterns", "value" : "text/html\" ,application/json\" ,text/plain"},
{"name" : "filterAction", "value" : "enforce"},
{"name" : "httpHeaders", "value" : "Cache-Control: no-store, no-cache, must-revalidate, private"}
]
},
{
"name": "HttpHeaderSecurityFilter",
"class": "org.apache.catalina.filters.HttpHeaderSecurityFilter",
"params": [
{
"name": "hstsEnabled",
"value": "false"
},
{
"name": "antiClickJackingOption",
"value": "SAMEORIGIN"
}
]
},
{
"name" : "CSRFGuard",
"class" : "org.owasp.csrfguard.CsrfGuardFilter"
}
],
"filterMappings": [
{
"name": "HttpHeaderSecurityFilter",
"url": "*"
},
{
"name" : "CSRFGuard",
"url" : "/*"
},
{
"name":"ContentTypeBasedCachePreventionFilter",
"url":"*"
}
]
}

@ -37,5 +37,7 @@
"Alpha.Releases" : "Alpha Releases",
"Version" : "Version",
"Status" : "Status",
"App.Publisher" : "Application Publisher"
"App.Publisher" : "Application Publisher",
"Login": "Login",
"Logout" : "Logout"
}

@ -87,7 +87,7 @@ body {
.btn-header {
margin-top: 15px;
margin-right: 20px;
margin-right: 100px;
color: white;
}

@ -63,6 +63,7 @@ class Base extends Component {
}
render() {
console.log('came to base ../////');
if (this.state.user !== null) {
return (
<div>
@ -106,12 +107,13 @@ class Store extends Component {
}
render() {
console.log('came to store');
return (
<div className="App">
<Router basename="store" history={history}>
<Switch>
<Route path="/login" component={Login}/>
<Route path="/logout" component={Login}/>
<Route exact path="/login" component={Login}/>
<Route exact path="/logout" component={Login}/>
<Route component={Base}/>
</Switch>
</Router>

@ -1,26 +0,0 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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 ReactDOM from 'react-dom';
import App from './App';
it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<App />, div);
});

@ -25,6 +25,7 @@ class Configuration {
constructor() {
this.serverConfig = {};
this.themeConfig = {};
this.hostConstants = {
baseURL: window.location.origin,
appContext: window.location.pathname.split("/")[1]
@ -35,8 +36,9 @@ class Configuration {
let thisObject = this;
axios.get(thisObject.hostConstants.baseURL + '/' + thisObject.hostConstants.appContext + "/config.json").
then(function (response) {
console.log('successfully loaded the configuration!');
console.log('succesfully loadedd....');
thisObject.serverConfig = response.data.config;
thisObject.themeConfig = response.data.theme;
Constants.load();
callback();
}).catch(function (error) {

@ -21,7 +21,7 @@ import React, {Component} from 'react';
import {withRouter} from 'react-router-dom';
import AuthHandler from "../../api/authHandler";
import {Col, Container, Input, Row,} from 'reactstrap';
import FloatingButton from "../UIComponents/FloatingButton/FloatingButton";
import UserOptions from '../UIComponents/UserOptions/UserOptions';
/**
* Base Layout:
@ -36,22 +36,18 @@ class BaseLayout extends Component {
this.state = {
notifications: 0,
user: 'Admin',
openModal: false
openModal: false,
userOptions : false
};
this.logout = this.logout.bind(this);
this.closeModal = this.closeModal.bind(this);
this.handleUserOptionsOnClick = this.handleUserOptionsOnClick.bind(this);
}
handleApplicationClick() {
this.handleHistory('/assets/apps');
}
handleApplicationCreateClick(event) {
event.preventDefault();
event.stopPropagation();
this.setState({openModal: true});
}
/**
* The method to update the history.
* to: The URL to route.
@ -68,6 +64,10 @@ class BaseLayout extends Component {
this.setState({openModal: false});
}
handleUserOptionsOnClick() {
this.setState({userOptions : true});
}
render() {
return (
<Container noGutters fluid id="container">
@ -78,7 +78,9 @@ class BaseLayout extends Component {
</span>
<div id="header-btn-container">
<i className="fw fw-notification btn-header"></i>
<i className="fw fw-user btn-header"></i>
<i className="fw fw-user btn-header" onClick={this.handleUserOptionsOnClick}>
<UserOptions userOptions={this.state.userOptions}/>
</i>
</div>
<div id="search-box">
<i className="fw fw-search search-icon">
@ -91,12 +93,6 @@ class BaseLayout extends Component {
/>
</div>
</div>
<div id="add-btn-container">
<FloatingButton
className="add-btn small"
onClick={this.handleApplicationCreateClick.bind(this)}
/>
</div>
</div>
<div id="application-content" style={this.state.style}>
<Row>

@ -238,6 +238,7 @@ class ApplicationListing extends Component {
}
render() {
console.log('render app listing');
return (
<div id="application-list" style={this.state.appListStyle}>
<Row>

@ -0,0 +1,61 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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 './user-options.css';
import AuthHandler from '../../../api/authHandler';
import {FormattedMessage} from 'react-intl';
class UserOptions extends Component {
constructor() {
super();
this.state = {};
}
componentWillMount() {
let user = AuthHandler.getUser();
if (user) {
if (!AuthHandler.isTokenExpired()) {
this.setState({user: user});
} else {
this.setState({user: null});
}
}
}
render() {
var displayOptions = this.props.userOptions ? "block" : "none";
if (this.state.user) {
return (
<div id='user-options-drop-down' className="dropdown-content" style={{display: displayOptions}}>
<a href="/store/logout"><FormattedMessage id="Logout" defaultMessage="Logout"/></a>
</div>
);
} else {
return (
<div id='user-options-drop-down' className="dropdown-content" style={{display: displayOptions}}>
<a href="/store/login"><FormattedMessage id="Login" defaultMessage="Login"/></a>
</div>
);
}
}
}
export default UserOptions;

@ -0,0 +1,60 @@
/*!
~ Copyright (c) 2017 WSO2 Inc. (http://wso2.com) All Rights Reserved.
~
~ Licensed 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.
*/
.dropbtn {
background-color: #4CAF50;
color: white;
padding: 16px;
font-size: 16px;
border: none;
cursor: pointer;
}
/* The container <div> - needed to position the dropdown content */
.dropdown {
position: relative;
display: inline-block;
}
/* Dropdown Content (Hidden by Default) */
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
/* Links inside the dropdown */
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
/* Change color of dropdown links on hover */
.dropdown-content a:hover {background-color: #f1f1f1}
/* Show the dropdown menu on hover */
.dropdown:hover .dropdown-content {
display: block;
}
/* Change the background color of the dropdown button when the dropdown content is shown */
.dropdown:hover .dropbtn {
background-color: #3e8e41;
}

@ -46,7 +46,7 @@ function loadStore() {
}).catch(error => {
addLocaleData(require('react-intl/locale-data/en'));
let defaultLocale = Axios.create({
baseURL: Configuration.hostConstants.baseURL + "/" + Configuration.hostConstants.appContext + "/locales"
baseURL: Configuration.hostConstants.baseURL + "/" + Configuration.hostConstants.appContext + "/locales/"
+ Constants.defaultLocale + ".json"
}).get();
defaultLocale.then(response => {

@ -17,6 +17,7 @@
*/
import axios from 'axios';
import Configuration from './common/configuration';
/**
* This class will read through the configuration file and saves the theme names for the usage in other files.
@ -33,8 +34,8 @@ class Theme {
this.selectedTheme = this.defaultThemeType;
//TODO Need to get the app context properly when the server is ready
this.baseURL = window.location.origin;
this.appContext = window.location.pathname.split("/")[1];
this.baseURL = Configuration.hostConstants.baseURL;
this.appContext = Configuration.hostConstants.appContext;
this.loadThemeConfigs = this.loadThemeConfigs.bind(this);
this.loadThemeFiles = this.loadThemeFiles.bind(this);
this.insertThemingScripts = this.insertThemingScripts.bind(this);

@ -64,7 +64,6 @@ const config = {
]
},
resolve: {
// you can now require('file') instead of require('file.coffee')
extensions: ['.jsx', '.js', '.ttf', '.woff', '.woff2', '.svg']
}

@ -38,6 +38,7 @@
<module>org.wso2.carbon.device.application.mgt.common</module>
<module>org.wso2.carbon.device.application.mgt.api</module>
<module>org.wso2.carbon.device.application.mgt.publisher.ui</module>
<module>org.wso2.carbon.device.application.mgt.store.ui</module>
<module>org.wso2.carbon.device.application.mgt.authhandler</module>
</modules>

@ -1,4 +1,4 @@
instructions.configure = \
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/webapps);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/webapps/publisher/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.application.mgt.publisher.ui_${feature.version}/publisher/public/,target:${installFolder}/../../deployment/server/webapps/publisher/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/jaggeryapp);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/jaggeryapps/publisher/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.application.mgt.publisher.ui_${feature.version}/publisher/public/,target:${installFolder}/../../deployment/server/jaggeryapps/publisher/,overwrite:true);\

@ -19,15 +19,102 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>application-mgt-feature</artifactId>
<version>3.0.46-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.application.mgt.store.ui.feature</artifactId>
<version>3.0.46-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Application Management Store UI Feature</name>
<url>http://wso2.org</url>
<description>This feature contains Application Management Store UI</description>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.application.mgt.store.ui</artifactId>
<version>${project.version}</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>
${project.build.directory}/maven-shared-archive-resources
</outputDirectory>
<includes>**/*</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>src/main/resources</outputDirectory>
<resources>
<resource>
<directory>resources</directory>
<includes>
<include>build.properties</include>
<include>p2.inf</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.wso2.maven</groupId>
<artifactId>carbon-p2-plugin</artifactId>
<executions>
<execution>
<id>p2-feature-generation</id>
<phase>package</phase>
<goals>
<goal>p2-feature-gen</goal>
</goals>
<configuration>
<id>org.wso2.carbon.device.application.mgt.store.ui</id>
<propertiesFile>../../../features/etc/feature.properties
</propertiesFile>
<adviceFile>
<properties>
<propertyDef>org.wso2.carbon.p2.category.type:server
</propertyDef>
<propertyDef>org.eclipse.equinox.p2.type.group:false
</propertyDef>
</properties>
</adviceFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,4 @@
instructions.configure = \
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/jaggeryapps);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/jaggeryapps/store/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.application.mgt.store.ui_${feature.version}/store/public/,target:${installFolder}/../../deployment/server/jaggeryapps/store/,overwrite:true);\

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 Inc. 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>application-mgt-feature</artifactId>
<version>3.0.46-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.application.mgt.ui.feature</artifactId>
<version>3.0.46-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Application Management UI Feature</name>
<url>http://wso2.org</url>
<description>This feature contains Application Management console UI</description>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.application.mgt.ui</artifactId>
<version>${project.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>
${project.build.directory}/maven-shared-archive-resources
</outputDirectory>
<includes>**/*</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>src/main/resources</outputDirectory>
<resources>
<resource>
<directory>resources</directory>
<includes>
<include>build.properties</include>
<include>p2.inf</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.wso2.maven</groupId>
<artifactId>carbon-p2-plugin</artifactId>
<executions>
<execution>
<id>p2-feature-generation</id>
<phase>package</phase>
<goals>
<goal>p2-feature-gen</goal>
</goals>
<configuration>
<id>org.wso2.carbon.device.application.mgt.ui</id>
<propertiesFile>../../../features/etc/feature.properties
</propertiesFile>
<adviceFile>
<properties>
<propertyDef>org.wso2.carbon.p2.category.type:server
</propertyDef>
<propertyDef>org.eclipse.equinox.p2.type.group:false
</propertyDef>
</properties>
</adviceFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

@ -1,9 +0,0 @@
instructions.configure = \
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/jaggeryapps/application-mgt);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.application.mgt.ui_${feature.version}/jaggeryapps/application-mgt,target:${installFolder}/../../deployment/server/jaggeryapps/application-mgt,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/jaggeryapps/appmgt-uuf-template-app);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.application.mgt.ui_${feature.version}/jaggeryapps/appmgt-uuf-template-app,target:${installFolder}/../../deployment/server/jaggeryapps/appmgt-uuf-template-app,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.application.mgt.ui_${feature.version}/jaggery-modules/utils/,target:${installFolder}/../../modules/utils,overwrite:true);\
instructions.unconfigure = \
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/application-mgt);\

@ -36,10 +36,9 @@
<modules>
<module>org.wso2.carbon.device.application.mgt.api.feature</module>
<module>org.wso2.carbon.device.application.mgt.auth.handler.feature</module>
<!--<module>org.wso2.carbon.device.application.mgt.ui.feature</module>-->
<module>org.wso2.carbon.device.application.mgt.feature</module>
<!--<module>org.wso2.carbon.device.application.mgt.extensions.feature</module>-->
<module>org.wso2.carbon.device.application.mgt.server.feature</module>
<module>org.wso2.carbon.device.application.mgt.publisher.ui.feature</module>
<module>org.wso2.carbon.device.application.mgt.store.ui.feature</module>
</modules>
</project>

@ -0,0 +1,4 @@
instructions.configure = \
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/webapps);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/webapps/publisher/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.application.mgt.publisher.ui_${feature.version}/publisher/public/,target:${installFolder}/../../deployment/server/webapps/publisher/,overwrite:true);\
Loading…
Cancel
Save