Ivan - Fix installation issues [skip ci]

This commit is contained in:
ivan 2017-03-30 20:37:55 -03:00
parent 199921b213
commit d10de13626
9 changed files with 48 additions and 37 deletions

View File

@ -6,5 +6,7 @@ var config = require('../config');
gulp.task('copyIndex', function() { gulp.task('copyIndex', function() {
gulp.src(config.sourceDir + 'index.html').pipe(gulp.dest(config.buildDir)); gulp.src(config.sourceDir + 'index.html').pipe(gulp.dest(config.buildDir));
gulp.src(config.sourceDir + 'index.php').pipe(gulp.dest(config.buildDir));
gulp.src(config.sourceDir + '.htaccess').pipe(gulp.dest(config.buildDir));
}); });

5
client/src/.htaccess Normal file
View File

@ -0,0 +1,5 @@
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/?(api)/
RewriteRule .* index.php [PT,L]

View File

@ -102,6 +102,14 @@ class App extends React.Component {
if(props.config['user-system-enabled'] && _.includes(props.location.pathname, '/check-ticket')) { if(props.config['user-system-enabled'] && _.includes(props.location.pathname, '/check-ticket')) {
browserHistory.push('/'); browserHistory.push('/');
} }
if(props.config.installedDone && !props.config.installed && !_.includes(props.location.pathname, '/install')) {
browserHistory.push('/install');
}
if(props.config.installedDone && props.config.installed && _.includes(props.location.pathname, '/install')) {
browserHistory.push('/');
}
} }
isPathAvailableForStaff(props) { isPathAvailableForStaff(props) {

View File

@ -2,6 +2,7 @@ import React from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import _ from 'lodash'; import _ from 'lodash';
import {browserHistory} from 'react-router'; import {browserHistory} from 'react-router';
import DocumentTitle from 'react-document-title';
import i18n from 'lib-app/i18n'; import i18n from 'lib-app/i18n';
import API from 'lib-app/api-call'; import API from 'lib-app/api-call';
@ -33,32 +34,34 @@ class InstallLayout extends React.Component {
render() { render() {
return ( return (
<Widget className="install-layout"> <DocumentTitle title="OpenSupports Installation">
<div className="install-layout__header"> <Widget className="install-layout">
<div className="install-layout__header-logo"> <div className="install-layout__header">
<img width="100%" src="../../images/logo.png" alt="OpenSupports Installation"/> <div className="install-layout__header-logo">
</div> <img width="100%" src="../../images/logo.png" alt="OpenSupports Installation"/>
<div className="install-layout__header-text">
<div className="install-layout__header-title">
{i18n('INSTALL_HEADER_TITLE')}
</div> </div>
<div className="install-layout__header-description"> <div className="install-layout__header-text">
{i18n('INSTALL_HEADER_DESCRIPTION')} <div className="install-layout__header-title">
{i18n('INSTALL_HEADER_TITLE')}
</div>
<div className="install-layout__header-description">
{i18n('INSTALL_HEADER_DESCRIPTION')}
</div>
</div> </div>
</div> </div>
</div> <span className="separator"/>
<span className="separator"/> <div className="install-layout__body row">
<div className="install-layout__body row"> <div className="col-md-3">
<div className="col-md-3"> <ul className="install-layout__steps">
<ul className="install-layout__steps"> {steps.map(this.renderStep.bind(this))}
{steps.map(this.renderStep.bind(this))} </ul>
</ul> </div>
<div className="install-layout__content col-md-9">
{this.props.children}
</div>
</div> </div>
<div className="install-layout__content col-md-9"> </Widget>
{this.props.children} </DocumentTitle>
</div>
</div>
</Widget>
); );
} }

View File

@ -9,6 +9,7 @@
&__next { &__next {
float: left; float: left;
position: absolute; position: absolute;
margin-left: 286px; margin-left: 230px;
min-width: 70px;
} }
} }

View File

@ -30,7 +30,6 @@ class InstallStep5Admin extends React.Component {
<FormField name="password" validation="PASSWORD" label={i18n('ADMIN_PASSWORD')} infoMessage={i18n('ADMIN_PASSWORD_DESCRIPTION')} fieldProps={{size: 'large', autoComplete: 'off'}} required/> <FormField name="password" validation="PASSWORD" label={i18n('ADMIN_PASSWORD')} infoMessage={i18n('ADMIN_PASSWORD_DESCRIPTION')} fieldProps={{size: 'large', autoComplete: 'off'}} required/>
<div className="install-step-5__buttons"> <div className="install-step-5__buttons">
<SubmitButton className="install-step-5__next" size="medium" type="secondary">{i18n('NEXT')}</SubmitButton> <SubmitButton className="install-step-5__next" size="medium" type="secondary">{i18n('NEXT')}</SubmitButton>
<Button className="install-step-5__previous" size="medium" onClick={this.onPreviousClick.bind(this)}>{i18n('PREVIOUS')}</Button>
</div> </div>
</Form> </Form>
</div> </div>
@ -50,11 +49,6 @@ class InstallStep5Admin extends React.Component {
return message; return message;
} }
onPreviousClick(event) {
event.preventDefault();
browserHistory.push('/install/step-4');
}
onSubmit(form) { onSubmit(form) {
this.setState({ this.setState({

View File

@ -6,13 +6,7 @@
margin-bottom: 20px; margin-bottom: 20px;
} }
&__previous {
margin-right: 20px;
}
&__next { &__next {
float: left; min-width: 70px;
position: absolute;
margin-left: 286px;
} }
} }

4
server/.htaccess Normal file
View File

@ -0,0 +1,4 @@
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [PT,L]

View File

@ -14,7 +14,7 @@ class InitDatabaseController extends Controller {
} }
public function handler() { public function handler() {
if(InstallationDoneController::isInstallationDone()) { if(defined('MYSQL_HOST')) {
throw new Exception(ERRORS::INIT_SETTINGS_DONE); throw new Exception(ERRORS::INIT_SETTINGS_DONE);
} }