Refactoring

feature/appm-store/pbac
megala21 7 years ago
parent aae017d6f4
commit d2d56a3dac

@ -31,26 +31,11 @@ import {
PlatformCreate,
PlatformListing
} from './components';
import Theme from './themes/theme';
import Theme from './theme';
const history = createHistory({basename: '/publisher'});
<<<<<<< HEAD
=======
/**
*Loading the theme files based on the the user-preference.
*/
let muiTheme = null;
let selected = Theme.selectedTheme;
if (Theme.currentTheme === "default") {
let defaultTheme = require("material-ui/styles/baseThemes/" + selected);
muiTheme = getMuiTheme(defaultTheme.default);
} else {
let customTheme = require("./themes/" + selected + "/theme.js");
muiTheme = getMuiTheme(customTheme.default);
}
>>>>>>> parent of 8f3d11f... refactoring theming support
/**
* This component defines the layout and the routes for the app.

@ -24,11 +24,7 @@ import {Step1, Step2, Step3} from './CreateSteps';
import RaisedButton from 'material-ui/RaisedButton';
import {Card, CardActions, CardTitle} from 'material-ui/Card';
import {Step, StepLabel, Stepper,} from 'material-ui/Stepper';
<<<<<<< HEAD
import Theme from '../../theme';
=======
import Theme from '../../themes/theme';
>>>>>>> parent of 8f3d11f... refactoring theming support
/**
* The App Create Component.
@ -56,7 +52,6 @@ class ApplicationCreate extends Component {
}
componentWillMount() {
<<<<<<< HEAD
/**
*Loading the theme files based on the the user-preference.
*/
@ -94,18 +89,6 @@ class ApplicationCreate extends Component {
if (styleSheet !== null) {
styleSheet.disabled = true;
styleSheet.parentNode.removeChild(styleSheet);
=======
let selected = Theme.selectedTheme;
if (Theme.currentTheme === "default") {
require("../../themes/default/application-create.css");
} else {
try {
require("../../themes/" + selected + "/application-create.css");
} catch (ex){
// If the particular customized file does not exist, use the default one.
require("../../themes/default/application-create.css");
}
>>>>>>> parent of 8f3d11f... refactoring theming support
}
}

@ -21,11 +21,7 @@ import {withRouter} from 'react-router-dom';
import TextField from 'material-ui/TextField';
import DataTable from '../UIComponents/DataTable';
import {Card, CardActions, CardTitle} from 'material-ui/Card';
<<<<<<< HEAD
import Theme from '../../theme';
=======
import Theme from '../../themes/theme';
>>>>>>> parent of 8f3d11f... refactoring theming support
/**
* The App Create Component.
@ -117,7 +113,6 @@ class ApplicationListing extends Component {
componentWillMount() {
//Fetch all the applications from backend and create application objects.
this.setState({data: this.data});
<<<<<<< HEAD
/**
*Loading the theme files based on the the user-preference.
*/
@ -154,19 +149,6 @@ class ApplicationListing extends Component {
if (styleSheet !== null) {
styleSheet.disabled = true;
styleSheet.parentNode.removeChild(styleSheet);
=======
let selected = Theme.selectedTheme;
if (Theme.currentTheme === "default") {
require("../../themes/default/application-listing.css");
} else {
try {
require("../../themes/" + selected + "/application-listing.css");
} catch (ex) {
// If the particular customized file does not exist, use the default one.
require("../../themes/default/application-listing.css");
}
>>>>>>> parent of 8f3d11f... refactoring theming support
}
}

@ -21,13 +21,7 @@ import React, {Component} from 'react';
import MenuItem from 'material-ui/MenuItem';
import SelectField from 'material-ui/SelectField';
import RaisedButton from 'material-ui/RaisedButton';
<<<<<<< HEAD
import Theme from '../../../theme';
=======
import Theme from '../../../themes/theme';
>>>>>>> parent of 8f3d11f... refactoring theming support
/**
* The first step of the application creation wizard.
@ -57,7 +51,6 @@ class Step1 extends Component {
}
componentWillMount() {
<<<<<<< HEAD
/**
*Loading the theme files based on the the user-preference.
*/
@ -94,18 +87,6 @@ class Step1 extends Component {
if (styleSheet !== null) {
styleSheet.disabled = true;
styleSheet.parentNode.removeChild(styleSheet);
=======
let selected = Theme.selectedTheme;
if (Theme.currentTheme === "default") {
require("../../../themes/default/application-create-step1.css");
} else {
try {
require("../../../themes/" + selected + "/application-create-step1.css");
} catch (ex){
// If the particular customized file does not exist, use the default one.
require("../../../themes/default/application-create-step1.css");
}
>>>>>>> parent of 8f3d11f... refactoring theming support
}
}

@ -28,11 +28,7 @@ import SelectField from 'material-ui/SelectField';
import RaisedButton from 'material-ui/RaisedButton';
import Clear from 'material-ui/svg-icons/content/clear';
import {GridList, GridTile} from 'material-ui/GridList';
<<<<<<< HEAD
import Theme from '../../../theme';
=======
import Theme from '../../../themes/theme';
>>>>>>> parent of 8f3d11f... refactoring theming support
/**
* The Second step of application create wizard.
@ -74,7 +70,6 @@ class Step2 extends Component {
}
componentWillMount() {
<<<<<<< HEAD
/**
*Loading the theme files based on the the user-preference.
*/
@ -112,18 +107,6 @@ class Step2 extends Component {
if (styleSheet !== null) {
styleSheet.disabled = true;
styleSheet.parentNode.removeChild(styleSheet);
=======
let selected = Theme.selectedTheme;
if (Theme.currentTheme === "default") {
require("../../../themes/default/application-create-step2.css");
} else {
try {
require("../../../themes/" + selected + "/application-create-step2.css");
} catch (ex){
// If the particular customized file does not exist, use the default one.
require("../../../themes/default/application-create-step2.css");
}
>>>>>>> parent of 8f3d11f... refactoring theming support
}
}

@ -24,11 +24,7 @@ import TextField from 'material-ui/TextField';
import FlatButton from 'material-ui/FlatButton';
import SelectField from 'material-ui/SelectField';
import RaisedButton from 'material-ui/RaisedButton';
<<<<<<< HEAD
import Theme from '../../../theme';
=======
import Theme from '../../../themes/theme';
>>>>>>> parent of 8f3d11f... refactoring theming support
/**
* The Third step of application create wizard. {Application Release Step}
@ -63,7 +59,6 @@ class Step3 extends Component {
}
componentWillMount() {
<<<<<<< HEAD
/**
*Loading the theme files based on the the user-preference.
*/
@ -101,18 +96,6 @@ class Step3 extends Component {
if (styleSheet !== null) {
styleSheet.disabled = true;
styleSheet.parentNode.removeChild(styleSheet);
=======
let selected = Theme.selectedTheme;
if (Theme.currentTheme === "default") {
require("../../../themes/default/application-create-step3.css");
} else {
try {
require("../../../themes/" + selected + "/application-create-step3.css");
} catch (ex){
// If the particular customized file does not exist, use the default one.
require("../../../themes/default/application-create-step3.css");
}
>>>>>>> parent of 8f3d11f... refactoring theming support
}
}

@ -30,11 +30,7 @@ import Feedback from 'material-ui/svg-icons/action/feedback';
import DevicesOther from 'material-ui/svg-icons/hardware/devices-other';
import NotificationsIcon from 'material-ui/svg-icons/social/notifications';
import ActionAccountCircle from 'material-ui/svg-icons/action/account-circle';
<<<<<<< HEAD
import Theme from '../../theme';
=======
import Theme from '../../themes/theme';
>>>>>>> parent of 8f3d11f... refactoring theming support
/**
@ -54,7 +50,6 @@ class BaseLayout extends Component {
}
componentWillMount() {
<<<<<<< HEAD
/**
*Loading the theme files based on the the user-preference.
*/
@ -94,18 +89,6 @@ class BaseLayout extends Component {
if (styleSheet !== null) {
styleSheet.disabled = true;
styleSheet.parentNode.removeChild(styleSheet);
=======
let selected = Theme.selectedTheme;
if (Theme.currentTheme === "default") {
require("../../themes/default/basic-layout.css");
} else {
try {
require("../../themes/" + selected + "/basic-layout.css");
} catch (ex){
// If the particular customized file does not exist, use the default one.
require("../../themes/default/basic-layout.css");
}
>>>>>>> parent of 8f3d11f... refactoring theming support
}
}

@ -31,11 +31,7 @@ import {GridList, GridTile} from 'material-ui/GridList';
import Close from 'material-ui/svg-icons/navigation/close';
import {Card, CardActions, CardTitle} from 'material-ui/Card';
import AddCircleOutline from 'material-ui/svg-icons/content/add-circle-outline';
<<<<<<< HEAD
import Theme from '../../theme';
=======
import Theme from '../../themes/theme';
>>>>>>> parent of 8f3d11f... refactoring theming support
/**
* Platform Create component.
@ -70,7 +66,6 @@ class PlatformCreate extends Component {
}
componentWillMount() {
<<<<<<< HEAD
/**
*Loading the theme files based on the the user-preference.
*/
@ -108,18 +103,6 @@ class PlatformCreate extends Component {
if (styleSheet !== null) {
styleSheet.disabled = true;
styleSheet.parentNode.removeChild(styleSheet);
=======
let selected = Theme.selectedTheme;
if (Theme.currentTheme === "default") {
require("../../themes/default/platform-create.css");
} else {
try {
require("../../themes/" + selected + "/platform-create.css");
} catch (ex) {
// If the particular customized file does not exist, use the default one.
require("../../themes/default/platform-create.css");
}
>>>>>>> parent of 8f3d11f... refactoring theming support
}
}

@ -21,11 +21,7 @@ import {withRouter} from 'react-router-dom';
import TextField from 'material-ui/TextField';
import DataTable from '../UIComponents/DataTable';
import {Card, CardActions, CardTitle} from 'material-ui/Card';
<<<<<<< HEAD
import Theme from '../../theme';
=======
import Theme from '../../themes/theme';
>>>>>>> parent of 8f3d11f... refactoring theming support
/**
* The App Create Component.
@ -45,7 +41,6 @@ class PlatformListing extends Component {
}
componentWillMount() {
<<<<<<< HEAD
console.log(Theme.currentThemeType);
/**
*Loading the theme files based on the the user-preference.
@ -84,18 +79,6 @@ class PlatformListing extends Component {
if (styleSheet !== null) {
styleSheet.disabled = true;
styleSheet.parentNode.removeChild(styleSheet);
=======
let selected = Theme.selectedTheme;
if (Theme.currentTheme === "default") {
require("../../themes/default/platform-listing.css");
} else {
try {
require("../../themes/" + selected + "/platform-listing.css");
} catch (ex) {
// If the particular customized file does not exist, use the default one.
require("../../themes/default/platform-listing.css");
}
>>>>>>> parent of 8f3d11f... refactoring theming support
}
}

@ -22,11 +22,7 @@ import DataTableRow from './DataTableRow';
import DataTableHeader from './DataTableHeader';
import RaisedButton from 'material-ui/RaisedButton';
import {Table, TableBody, TableHeader, TableRow} from 'material-ui/Table';
<<<<<<< HEAD
import Theme from '../../theme';
=======
import Theme from '../../themes/theme';
>>>>>>> parent of 8f3d11f... refactoring theming support
/**
* The Custom Table Component.
@ -66,7 +62,6 @@ class DataTable extends Component {
componentWillMount() {
this.setState({data: this.props.data, headers: this.props.headers});
<<<<<<< HEAD
/**
*Loading the theme files based on the the user-preference.
*/
@ -102,18 +97,6 @@ class DataTable extends Component {
if (styleSheet !== null) {
styleSheet.disabled = true;
styleSheet.parentNode.removeChild(styleSheet);
=======
let selected = Theme.selectedTheme;
if (Theme.currentTheme === "default") {
require("../../themes/default/data-table.css");
} else {
try {
require("../../themes/" + selected + "/data-table.css");
} catch (ex) {
// If the particular customized file does not exist, use the default one.
require("../../themes/default/data-table.css");
}
>>>>>>> parent of 8f3d11f... refactoring theming support
}
}

@ -20,11 +20,7 @@ import PropTypes from 'prop-types';
import React, {Component} from 'react';
import FlatButton from 'material-ui/FlatButton';
import {TableHeaderColumn} from 'material-ui/Table';
<<<<<<< HEAD
import Theme from '../../theme';
=======
import Theme from '../../themes/theme';
>>>>>>> parent of 8f3d11f... refactoring theming support
/**
* Data Table header component.
@ -37,7 +33,6 @@ class DataTableHeader extends Component {
}
componentWillMount() {
<<<<<<< HEAD
/**
*Loading the theme files based on the the user-preference.
*/
@ -76,18 +71,6 @@ class DataTableHeader extends Component {
if (styleSheet !== null) {
styleSheet.disabled = true;
styleSheet.parentNode.removeChild(styleSheet);
=======
let selected = Theme.selectedTheme;
if (Theme.currentTheme === "default") {
require("../../themes/default/data-table.css");
} else {
try {
require("../../themes/" + selected + "/data-table.css");
} catch (ex) {
// If the particular customized file does not exist, use the default one.
require("../../themes/default/data-table.css");
}
>>>>>>> parent of 8f3d11f... refactoring theming support
}
}

@ -19,11 +19,7 @@
import PropTypes from 'prop-types';
import React, {Component} from 'react';
import {TableRow, TableRowColumn} from 'material-ui/Table';
<<<<<<< HEAD
import Theme from '../../theme';
=======
import Theme from '../../themes/theme';
>>>>>>> parent of 8f3d11f... refactoring theming support
/**
* Data table row component.
@ -40,13 +36,12 @@ class DataTableRow extends Component {
componentWillMount() {
this.setState({dataItem: this.props.dataItem});
<<<<<<< HEAD
/**
*Loading the theme files based on the the user-preference.
*/
const selected =
(Theme.currentThemeType === Theme.defaultThemeType) ? Theme.defaultThemeType : Theme.currentTheme;
(Theme.currentThemeType === Theme.defaultThemeType) ? Theme.defaultThemeType : Theme.currentThemeType;
const dataTableCss = "data-table.css";
const dataTableId = "data-table";
let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + dataTableCss;
@ -78,18 +73,6 @@ class DataTableRow extends Component {
if (styleSheet !== null) {
styleSheet.disabled = true;
styleSheet.parentNode.removeChild(styleSheet);
=======
let selected = Theme.selectedTheme;
if (Theme.currentTheme === "default") {
require("../../themes/default/data-table.css");
} else {
try {
require("../../themes/" + selected + "/data-table.css");
} catch (ex) {
// If the particular customized file does not exist, use the default one.
require("../../themes/default/data-table.css");
}
>>>>>>> parent of 8f3d11f... refactoring theming support
}
}

@ -24,7 +24,6 @@ import axios from 'axios';
*/
class Theme {
constructor() {
<<<<<<< HEAD:components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/theme.js
this.defaultThemeType = "default";
this.currentThemeType = this.defaultThemeType;
this.currentTheme = "lightBaseTheme";
@ -37,15 +36,6 @@ class Theme {
this.appContext = window.location.pathname.split("/")[1];
this.loadThemeProperties.bind(this);
this.loadThemeFiles.bind(this);
=======
const theme = require("../config.json").theme;
this.currentTheme = theme.type;
if (this.currentTheme === "default") {
this.selectedTheme = theme.value;
} else {
this.selectedTheme = theme.value;
}
>>>>>>> parent of 8f3d11f... refactoring theming support:components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/themes/theme.js
}
loadThemeProperties () {
Loading…
Cancel
Save