deleted unnecessary func and action in Wizard
This commit is contained in:
parent
75b591ff1e
commit
c0e5626c1f
@ -14,7 +14,7 @@ import {
|
|||||||
Button, Box, Loader,
|
Button, Box, Loader,
|
||||||
ModalDialog, utils } from 'asc-web-components';
|
ModalDialog, utils } from 'asc-web-components';
|
||||||
|
|
||||||
import { getParams, setOwnerToSrv, saveNewEmail, getWizardInfo } from '../../../store/wizard/actions';
|
import { getWizardInfo } from '../../../store/wizard/actions';
|
||||||
|
|
||||||
const { EmailSettings } = utils.email;
|
const { EmailSettings } = utils.email;
|
||||||
const settings = new EmailSettings();
|
const settings = new EmailSettings();
|
||||||
@ -379,7 +379,6 @@ class Body extends Component {
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
console.log('valid params');
|
console.log('valid params');
|
||||||
|
|
||||||
const { setOwnerToSrv } = this.props;
|
|
||||||
const licenseFile = this.inputRef.current.files[0];
|
const licenseFile = this.inputRef.current.files[0];
|
||||||
|
|
||||||
const owner = {
|
const owner = {
|
||||||
@ -389,7 +388,6 @@ class Body extends Component {
|
|||||||
timezone: this.state.selectTimezone,
|
timezone: this.state.selectTimezone,
|
||||||
licenseFile: licenseFile
|
licenseFile: licenseFile
|
||||||
}
|
}
|
||||||
setOwnerToSrv(owner);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log('not valid params');
|
console.log('not valid params');
|
||||||
@ -407,9 +405,7 @@ class Body extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onSaveEmailHandler = () => {
|
onSaveEmailHandler = () => {
|
||||||
const { saveNewEmail } = this.props;
|
|
||||||
console.log('save email', this.state.email);
|
console.log('save email', this.state.email);
|
||||||
saveNewEmail(this.state.email)
|
|
||||||
this.setState({ visibleModal: false });
|
this.setState({ visibleModal: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -494,18 +490,14 @@ class Body extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderInputBox = () => {
|
renderInputBox = () => {
|
||||||
const { t, isOwner, settingsPassword, isWizardLoaded } = this.props;
|
const { t, isOwner, settingsPassword } = this.props;
|
||||||
|
|
||||||
let tooltipPassLength, tooltipPassTitle, tooltipPassDigits, tooltipPassCapital, tooltipPassSpecial;
|
|
||||||
|
|
||||||
if(isWizardLoaded) {
|
|
||||||
tooltipPassTitle = t('tooltipPasswordTitle');
|
|
||||||
tooltipPassLength = `${settingsPassword.minLength} ${t('tooltipPasswordLength')}`;
|
|
||||||
tooltipPassDigits = settingsPassword.digits ? `${t('tooltipPasswordDigits')}` : settingsPassword.digits;
|
|
||||||
tooltipPassCapital = settingsPassword.upperCase ? `${t('tooltipPasswordCapital')}` : settingsPassword.upperCase;
|
|
||||||
tooltipPassSpecial = settingsPassword.specSymbols ? `${t('tooltipPasswordSpecial')}` : settingsPassword.specSymbols;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
const tooltipPassTitle = t('tooltipPasswordTitle');
|
||||||
|
const tooltipPassLength = `${settingsPassword.minLength} ${t('tooltipPasswordLength')}`;
|
||||||
|
const tooltipPassDigits = settingsPassword.digits ? `${t('tooltipPasswordDigits')}` : null;
|
||||||
|
const tooltipPassCapital = settingsPassword.upperCase ? `${t('tooltipPasswordCapital')}` : null;
|
||||||
|
const tooltipPassSpecial = settingsPassword.specSymbols ? `${t('tooltipPasswordSpecial')}` : null;
|
||||||
|
|
||||||
const inputEmail = !isOwner
|
const inputEmail = !isOwner
|
||||||
? <EmailInput
|
? <EmailInput
|
||||||
className="wizard-input-email"
|
className="wizard-input-email"
|
||||||
@ -540,9 +532,6 @@ class Body extends Component {
|
|||||||
onChange={this.onChangePassword}
|
onChange={this.onChangePassword}
|
||||||
onValidateInput={this.isValidPassHandler}
|
onValidateInput={this.isValidPassHandler}
|
||||||
/>
|
/>
|
||||||
<Text className="password-tooltip">
|
|
||||||
{t('tooltipPass')}
|
|
||||||
</Text>
|
|
||||||
<InputBlock
|
<InputBlock
|
||||||
value={this.state.path}
|
value={this.state.path}
|
||||||
className="input-block"
|
className="input-block"
|
||||||
@ -646,26 +635,26 @@ class Body extends Component {
|
|||||||
render() {
|
render() {
|
||||||
const { isWizardLoaded } = this.props;
|
const { isWizardLoaded } = this.props;
|
||||||
|
|
||||||
console.log('wizard render')
|
console.log('wizard render', isWizardLoaded)
|
||||||
const headerBox = this.renderHeaderBox();
|
|
||||||
const inputBox = this.renderInputBox();
|
|
||||||
const settingsBox = this.renderSettingsBox();
|
|
||||||
const buttonBox = this.renderButtonBox();
|
|
||||||
const modalDialog = this.renderModalDialog();
|
|
||||||
|
|
||||||
const content = isWizardLoaded
|
|
||||||
? <WizardContainer>
|
|
||||||
<Box className="form-container">
|
|
||||||
{ modalDialog }
|
|
||||||
{headerBox}
|
|
||||||
{inputBox}
|
|
||||||
{settingsBox}
|
|
||||||
{buttonBox}
|
|
||||||
</Box>
|
|
||||||
</WizardContainer>
|
|
||||||
: <Loader className="pageLoader" type="rombs" size='40px' />
|
|
||||||
|
|
||||||
return content;
|
if (isWizardLoaded) {
|
||||||
|
const headerBox = this.renderHeaderBox();
|
||||||
|
const inputBox = this.renderInputBox();
|
||||||
|
const settingsBox = this.renderSettingsBox();
|
||||||
|
const buttonBox = this.renderButtonBox();
|
||||||
|
const modalDialog = this.renderModalDialog();
|
||||||
|
|
||||||
|
return <WizardContainer>
|
||||||
|
<Box className="form-container">
|
||||||
|
{ modalDialog }
|
||||||
|
{headerBox}
|
||||||
|
{inputBox}
|
||||||
|
{settingsBox}
|
||||||
|
{buttonBox}
|
||||||
|
</Box>
|
||||||
|
</WizardContainer>
|
||||||
|
}
|
||||||
|
return <Loader className="pageLoader" type="rombs" size='40px' />;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -700,7 +689,6 @@ function mapStateToProps(state) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(mapStateToProps, {
|
export default connect(mapStateToProps, {
|
||||||
getParams, setOwnerToSrv,
|
getWizardInfo
|
||||||
saveNewEmail, getWizardInfo
|
|
||||||
})(withRouter(Wizard));
|
})(withRouter(Wizard));
|
@ -4,7 +4,6 @@
|
|||||||
"desc": "Please setup the portal registration data.",
|
"desc": "Please setup the portal registration data.",
|
||||||
"placeholderEmail": "E-mail",
|
"placeholderEmail": "E-mail",
|
||||||
"placeholderPass": "Password",
|
"placeholderPass": "Password",
|
||||||
"tooltipPass": "2-30 characters",
|
|
||||||
"placeholderLicense": "Your license file",
|
"placeholderLicense": "Your license file",
|
||||||
"license": "Accept the terms of the ",
|
"license": "Accept the terms of the ",
|
||||||
"licenseLink": "License agreements",
|
"licenseLink": "License agreements",
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
"desc": "Пожалуйста, настройте регистрационные данные портала.",
|
"desc": "Пожалуйста, настройте регистрационные данные портала.",
|
||||||
"placeholderEmail": "E-mail",
|
"placeholderEmail": "E-mail",
|
||||||
"placeholderPass": "Пароль",
|
"placeholderPass": "Пароль",
|
||||||
"tooltipPass": "от 2 до 30 символов",
|
|
||||||
"placeholderLicense": "Ваш файл лицензии",
|
"placeholderLicense": "Ваш файл лицензии",
|
||||||
"license": "Принять условия ",
|
"license": "Принять условия ",
|
||||||
"licenseLink": "лицензионного соглашения",
|
"licenseLink": "лицензионного соглашения",
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
import { store } from "asc-web-common";
|
import { store } from "asc-web-common";
|
||||||
const { getPortalPasswordSettings } = store.auth.actions;
|
const { getPortalPasswordSettings } = store.auth.actions;
|
||||||
|
|
||||||
export const INIT_WIZARD = 'INIT_WIZARD';
|
|
||||||
export const SET_OWNER = 'SET_OWNER';
|
|
||||||
export const GET_PARAMS = 'GET_PARAMS';
|
|
||||||
export const SET_NEW_EMAIL = 'SET_NEW_EMAIL';
|
|
||||||
export const SET_IS_WIZARD_LOADED = 'SET_IS_WIZARD_LOADED';
|
export const SET_IS_WIZARD_LOADED = 'SET_IS_WIZARD_LOADED';
|
||||||
|
|
||||||
export function setIsWizardLoaded(isWizardLoaded) {
|
export function setIsWizardLoaded(isWizardLoaded) {
|
||||||
@ -19,61 +15,4 @@ export function getWizardInfo(token) {
|
|||||||
return getPortalPasswordSettings(dispatch, token)
|
return getPortalPasswordSettings(dispatch, token)
|
||||||
.then(() => dispatch(setIsWizardLoaded(true)));
|
.then(() => dispatch(setIsWizardLoaded(true)));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export function initWizard(params) {
|
|
||||||
return {
|
|
||||||
type: INIT_WIZARD,
|
|
||||||
params
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function setOwner(owner) {
|
|
||||||
return {
|
|
||||||
type: SET_OWNER,
|
|
||||||
owner
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function setNewEmail(newEmail) {
|
|
||||||
return {
|
|
||||||
type: SET_NEW_EMAIL,
|
|
||||||
newEmail
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getParams() {
|
|
||||||
return dispatch => {
|
|
||||||
const params = initParams();
|
|
||||||
return dispatch(initWizard(params));
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function setOwnerToSrv(owner) {
|
|
||||||
return dispatch => {
|
|
||||||
return setTimeout(() => {
|
|
||||||
dispatch(setOwner(owner));
|
|
||||||
}, 3000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function saveNewEmail(newEmail) {
|
|
||||||
return dispatch => {
|
|
||||||
return setTimeout(() => {
|
|
||||||
dispatch(setNewEmail(newEmail));
|
|
||||||
}, 3000)
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const initParams = () => {
|
|
||||||
return {
|
|
||||||
isOwner: true,
|
|
||||||
ownerEmail: 'portaldomainname@mail.com',
|
|
||||||
domain: 'portaldomainname.com',
|
|
||||||
language: "ru-RU",
|
|
||||||
timezone: "UTC",
|
|
||||||
languages: [ "English (United States)", "Русский (РФ)" ],
|
|
||||||
timezones: [ "UTC", "Not UTC"]
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
import { INIT_WIZARD, SET_OWNER, SET_NEW_EMAIL, SET_IS_WIZARD_LOADED } from "./actions";
|
import { SET_IS_WIZARD_LOADED } from "./actions";
|
||||||
// import { api } from "asc-web-common";
|
// import { api } from "asc-web-common";
|
||||||
|
|
||||||
const initState = {
|
const initState = {
|
||||||
@ -20,17 +20,6 @@ const ownerReducer = ( state = initState, action) => {
|
|||||||
isWizardLoaded: action.isWizardLoaded
|
isWizardLoaded: action.isWizardLoaded
|
||||||
});
|
});
|
||||||
|
|
||||||
case INIT_WIZARD:
|
|
||||||
return Object.assign({}, state, action.params);
|
|
||||||
|
|
||||||
case SET_OWNER:
|
|
||||||
console.log('SET_OWNER', action.owner);
|
|
||||||
return state;
|
|
||||||
|
|
||||||
case SET_NEW_EMAIL:
|
|
||||||
console.log('SET_NEW_EMAIL', action.newEmail);
|
|
||||||
return Object.assign({}, state, { ownerEmail: action.newEmail });
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user