deleted unnecessary func and action in Wizard

This commit is contained in:
Artem Tarasov 2020-07-06 14:26:47 +03:00
parent 75b591ff1e
commit c0e5626c1f
5 changed files with 31 additions and 117 deletions

View File

@ -14,7 +14,7 @@ import {
Button, Box, Loader,
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 settings = new EmailSettings();
@ -379,7 +379,6 @@ class Body extends Component {
if (valid) {
console.log('valid params');
const { setOwnerToSrv } = this.props;
const licenseFile = this.inputRef.current.files[0];
const owner = {
@ -389,7 +388,6 @@ class Body extends Component {
timezone: this.state.selectTimezone,
licenseFile: licenseFile
}
setOwnerToSrv(owner);
}
else {
console.log('not valid params');
@ -407,9 +405,7 @@ class Body extends Component {
}
onSaveEmailHandler = () => {
const { saveNewEmail } = this.props;
console.log('save email', this.state.email);
saveNewEmail(this.state.email)
this.setState({ visibleModal: false });
}
@ -494,17 +490,13 @@ class Body extends Component {
}
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
? <EmailInput
@ -540,9 +532,6 @@ class Body extends Component {
onChange={this.onChangePassword}
onValidateInput={this.isValidPassHandler}
/>
<Text className="password-tooltip">
{t('tooltipPass')}
</Text>
<InputBlock
value={this.state.path}
className="input-block"
@ -646,15 +635,16 @@ class Body extends Component {
render() {
const { isWizardLoaded } = this.props;
console.log('wizard render')
console.log('wizard render', isWizardLoaded)
if (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>
return <WizardContainer>
<Box className="form-container">
{ modalDialog }
{headerBox}
@ -663,9 +653,8 @@ class Body extends Component {
{buttonBox}
</Box>
</WizardContainer>
: <Loader className="pageLoader" type="rombs" size='40px' />
return content;
}
return <Loader className="pageLoader" type="rombs" size='40px' />;
}
}
@ -701,6 +690,5 @@ function mapStateToProps(state) {
}
export default connect(mapStateToProps, {
getParams, setOwnerToSrv,
saveNewEmail, getWizardInfo
getWizardInfo
})(withRouter(Wizard));

View File

@ -4,7 +4,6 @@
"desc": "Please setup the portal registration data.",
"placeholderEmail": "E-mail",
"placeholderPass": "Password",
"tooltipPass": "2-30 characters",
"placeholderLicense": "Your license file",
"license": "Accept the terms of the ",
"licenseLink": "License agreements",

View File

@ -4,7 +4,6 @@
"desc": "Пожалуйста, настройте регистрационные данные портала.",
"placeholderEmail": "E-mail",
"placeholderPass": "Пароль",
"tooltipPass": "от 2 до 30 символов",
"placeholderLicense": "Ваш файл лицензии",
"license": "Принять условия ",
"licenseLink": "лицензионного соглашения",

View File

@ -1,10 +1,6 @@
import { store } from "asc-web-common";
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 function setIsWizardLoaded(isWizardLoaded) {
@ -20,60 +16,3 @@ export function getWizardInfo(token) {
.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"]
}
}

View File

@ -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";
const initState = {
@ -20,17 +20,6 @@ const ownerReducer = ( state = initState, action) => {
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:
return state;
}