From bae91ab561ef0d51b1df641dcb51dcecfa34e773 Mon Sep 17 00:00:00 2001 From: Ilya Oleshko Date: Fri, 27 Sep 2019 12:20:05 +0300 Subject: [PATCH 001/320] web: People: Fixed email link errors and locale selector width at profile viewer. --- .../pages/Profile/Section/Body/index.js | 32 ++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/products/ASC.People/Client/src/components/pages/Profile/Section/Body/index.js b/products/ASC.People/Client/src/components/pages/Profile/Section/Body/index.js index 7cad1d6df6..d74efa8dc6 100644 --- a/products/ASC.People/Client/src/components/pages/Profile/Section/Body/index.js +++ b/products/ASC.People/Client/src/components/pages/Profile/Section/Body/index.js @@ -76,17 +76,13 @@ const InfoItemLabel = styled.div` `; const InfoItemValue = styled.div` - width: 220px; + width: 240px; .language-combo { padding-top: 4px; & > div { padding-left: 0px; - - & > div { - line-height: 18px; - } } } `; @@ -261,13 +257,7 @@ class ProfileInfo extends React.PureComponent { {t('Email')}: - + <> {activationStatus === 2 && (isAdmin || isSelf) && } - {email} + + {email} + {(isAdmin || isSelf) && } - + } @@ -322,7 +320,7 @@ class ProfileInfo extends React.PureComponent { } - {(mobilePhone || isSelf) && + {(mobilePhone) && {t('PhoneLbl')}: @@ -380,13 +378,11 @@ class ProfileInfo extends React.PureComponent { { }} selectedOption={fakeLanguage.find(item => item.key === language)} isDisabled={false} noBorder={true} - dropDownMaxHeight={250} scaled={false} - scaledOptions={true} + scaledOptions={false} size='content' className='language-combo' /> From ac8c69821ef367c1d50cd969a0b87643f06321f1 Mon Sep 17 00:00:00 2001 From: Ilya Oleshko Date: Fri, 27 Sep 2019 12:36:25 +0300 Subject: [PATCH 002/320] web: People: Fixed empty culture at profile viewer. --- .../Client/src/components/pages/Profile/Section/Body/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/products/ASC.People/Client/src/components/pages/Profile/Section/Body/index.js b/products/ASC.People/Client/src/components/pages/Profile/Section/Body/index.js index d74efa8dc6..ce31e09742 100644 --- a/products/ASC.People/Client/src/components/pages/Profile/Section/Body/index.js +++ b/products/ASC.People/Client/src/components/pages/Profile/Section/Body/index.js @@ -235,7 +235,7 @@ class ProfileInfo extends React.PureComponent { key: "ru-RU", label: "Russian (Russia)" }]; - const language = cultureName || currentCulture; + const language = cultureName || currentCulture || this.props.culture; const workFromDate = new Date(workFrom).toLocaleDateString(language); const birthDayDate = new Date(birthday).toLocaleDateString(language); const formatedSex = capitalizeFirstLetter(sex); @@ -441,7 +441,7 @@ const SectionBodyContent = props => { )} - + {isSelf && ( From 59a69007bc7f8be9ff190a0a57a891add657831e Mon Sep 17 00:00:00 2001 From: Alexey Safronov Date: Fri, 27 Sep 2019 12:42:32 +0300 Subject: [PATCH 003/320] web: Components: Init Aside inside AdvancedSelector --- .../advanced-selector.stories.js | 67 +------ .../src/components/advanced-selector/index.js | 40 ++-- .../examples/people.selectors.stories.js | 183 +----------------- 3 files changed, 34 insertions(+), 256 deletions(-) diff --git a/web/ASC.Web.Components/src/components/advanced-selector/advanced-selector.stories.js b/web/ASC.Web.Components/src/components/advanced-selector/advanced-selector.stories.js index 8eb524ff9d..83334460c6 100644 --- a/web/ASC.Web.Components/src/components/advanced-selector/advanced-selector.stories.js +++ b/web/ASC.Web.Components/src/components/advanced-selector/advanced-selector.stories.js @@ -1,12 +1,11 @@ import React from "react"; import { storiesOf } from "@storybook/react"; import { action } from '@storybook/addon-actions'; -import { withKnobs, text, number } from "@storybook/addon-knobs/react"; +import { withKnobs, text, number, boolean, select } from "@storybook/addon-knobs/react"; import withReadme from "storybook-readme/with-readme"; import Readme from "./README.md"; import AdvancedSelector from "./"; import Section from "../../../.storybook/decorators/section"; -import { boolean, select } from "@storybook/addon-knobs/dist/deprecated"; import { ArrayValue, BooleanValue } from "react-values"; import Button from "../button"; @@ -78,6 +77,7 @@ const groups = [ ]; const sizes = ["compact", "full"]; +const displayTypes = ['dropdown', 'aside']; storiesOf("Components|AdvancedSelector", module) .addDecorator(withKnobs) @@ -95,65 +95,6 @@ storiesOf("Components|AdvancedSelector", module) }; }); - return ( -
- action("options onChange")} - > - {({ value, set }) => ( - { - action("onSearchChanged")(value); - set( - options.filter(option => { - return option.label.indexOf(value) > -1; - }) - ); - }} - options={value} - groups={groups} - selectedGroups={[groups[0]]} - isMultiSelect={boolean("isMultiSelect", true)} - buttonLabel={text("buttonLabel", "Add members")} - selectAllLabel={text("selectAllLabel", "Select all")} - onSelect={selectedOptions => { - action("onSelect")(selectedOptions); - }} - onChangeGroup={group => { - set( - options.filter(option => { - return ( - option.groups && - option.groups.length > 0 && - option.groups.indexOf(group.key) > -1 - ); - }) - ); - }} - allowCreation={boolean("allowCreation", false)} - onAddNewClick={() => action("onSelect") } - /> - )} - -
- ); - }) - .add("drop down", () => { - const optionsCount = number("Users count", 1000); - const options = Array.from({ length: optionsCount }, (v, index) => { - const additional_group = groups[getRandomInt(1, 6)]; - groups[0].total++; - additional_group.total++; - return { - key: `user${index}`, - groups: ["group-all", additional_group.key], - label: `User${index + 1} (All groups, ${additional_group.label})` - }; - }); - return (
( { action("onSearchChanged")(value); @@ -205,6 +144,8 @@ storiesOf("Components|AdvancedSelector", module) }} allowCreation={boolean("allowCreation", false)} onAddNewClick={() => action("onSelect") } + isOpen={isOpen} + displayType={select("displayType", displayTypes, "dropdown")} /> )} diff --git a/web/ASC.Web.Components/src/components/advanced-selector/index.js b/web/ASC.Web.Components/src/components/advanced-selector/index.js index be1c559fa1..defffd2ac5 100644 --- a/web/ASC.Web.Components/src/components/advanced-selector/index.js +++ b/web/ASC.Web.Components/src/components/advanced-selector/index.js @@ -16,6 +16,9 @@ import isEqual from "lodash/isEqual"; import DropDown from "../drop-down"; import { handleAnyClick } from "../../utils/event"; import isEmpty from "lodash/isEmpty"; +import Aside from "../layout/sub-components/aside"; + +const displayTypes = ['dropdown', 'aside']; /* eslint-disable no-unused-vars */ /* eslint-disable react/prop-types */ @@ -37,7 +40,7 @@ const Container = ({ selectedGroups, onChangeGroup, isOpen, - isDropDown, + displayType, containerWidth, containerHeight, allowCreation, @@ -63,13 +66,13 @@ const StyledContainer = styled(Container)` .head_container { display: flex; - margin-bottom: ${props => props.isDropDown ? 8 : 16}px; + margin-bottom: ${props => props.displayType === "dropdown" ? 8 : 16}px; .options_searcher { display: inline-block; width: 100%; - ${props => props.isDropDown && props.size === "full" && css` + ${props => props.displayType === "dropdown" && props.size === "full" && css` margin-right: ${props => props.allowCreation ? 8 : 16 @@ -106,7 +109,7 @@ const StyledContainer = styled(Container)` .data_column_one { ${props => - props.isDropDown && props.groups && props.groups.length > 0 + props.displayType === "dropdown" && props.groups && props.groups.length > 0 ? css` width: 50%; display: inline-block; @@ -138,7 +141,7 @@ const StyledContainer = styled(Container)` .data_column_two { ${props => - props.isDropDown && props.groups && props.groups.length > 0 + props.displayType === "dropdown" && props.groups && props.groups.length > 0 ? css` width: 50%; display: inline-block; @@ -371,7 +374,7 @@ class AdvancedSelector extends React.Component { buttonLabel, selectAllLabel, size, - isDropDown, + displayType, onAddNewClick, allowCreation } = this.props; @@ -408,14 +411,14 @@ class AdvancedSelector extends React.Component { case "compact": containerHeight = hasGroups ? "326px" : "100%"; containerWidth = "379px"; - listWidth = isDropDown ? 356 : 356; + listWidth = displayType === "dropdown" ? 356 : 356; listHeight = hasGroups ? 488 : isMultiSelect ? 176 : 226; break; case "full": default: containerHeight = "100%"; - containerWidth = isDropDown ? "690px" : "326px"; - listWidth = isDropDown ? 320 : 302; + containerWidth = displayType === "dropdown" ? "690px" : "326px"; + listWidth = displayType === "dropdown" ? 320 : 302; listHeight = 488; break; } @@ -458,7 +461,7 @@ class AdvancedSelector extends React.Component { /> )} - {!isDropDown && + {displayType === "aside" && groups && groups.length > 0 && ( - {isDropDown && size === "full" && groups && groups.length > 0 && ( + {displayType === "dropdown" && size === "full" && groups && groups.length > 0 && (
{this.renderBody()} ) : ( - this.renderBody() + ); } } @@ -570,11 +575,11 @@ AdvancedSelector.propTypes = { onSelect: PropTypes.func, onChangeGroup: PropTypes.func, onCancel: PropTypes.func, - isDropDown: PropTypes.bool, isOpen: PropTypes.bool, allowCreation: PropTypes.bool, onAddNewClick: PropTypes.func, - allowAnyClickClose: PropTypes.bool + allowAnyClickClose: PropTypes.bool, + displayType: PropTypes.oneOf(displayTypes) }; AdvancedSelector.defaultProps = { @@ -582,7 +587,8 @@ AdvancedSelector.defaultProps = { size: "compact", buttonLabel: "Add members", selectAllLabel: "Select all", - allowAnyClickClose: true + allowAnyClickClose: true, + displayType: "dropdown" }; export default AdvancedSelector; diff --git a/web/ASC.Web.Components/src/components/examples/people.selectors.stories.js b/web/ASC.Web.Components/src/components/examples/people.selectors.stories.js index adde432d0f..b497640ff4 100644 --- a/web/ASC.Web.Components/src/components/examples/people.selectors.stories.js +++ b/web/ASC.Web.Components/src/components/examples/people.selectors.stories.js @@ -100,7 +100,7 @@ storiesOf("EXAMPLES|AdvancedSelector", module) > {({ value, set }) => ( - action("modalVisible changed")} - > - {({ value: modalVisible, toggle: toggleModalVisible }) => ( - action("isOpen changed")} - > - {({ value: isOpen, toggle }) => ( -
-
- } - footerContent={[ -
- )} -
- )} - -
- ); - }) - .add("people user selector as advanced ComboBox", () => { - const optionsCount = number("Users count", 1000); - const options = Array.from({ length: optionsCount }, (v, index) => { - const additional_group = groups[getRandomInt(1, 6)]; - groups[0].total++; - additional_group.total++; - return { - key: `user${index}`, - groups: ["group-all", additional_group.key], - label: `User${index + 1} (All groups, ${additional_group.label})` - }; - }); - let selectedOptionsHead = []; - const getSelectedOption = (count, maxCount) => { - return { - key: 0, - //icon: 'icon_name', //if you need insert ComboBox styled image - label: `Selected (${count}/${maxCount})` - } - } return (
@@ -333,7 +160,11 @@ storiesOf("EXAMPLES|AdvancedSelector", module) label="Toggle dropdown" options={options} isOpen={isOpen} - selectedOption={getSelectedOption(selectedOptionsHead.length, options.length)} + selectedOption={{ + key: 0, + //icon: 'icon_name', //if you need insert ComboBox styled image + label: "Add employee" + }} //innerContainer={react.node} // if you need insert custom node element inside ComboBox onClick={toggle} /> @@ -344,7 +175,7 @@ storiesOf("EXAMPLES|AdvancedSelector", module) {({ value, set }) => ( <> Date: Fri, 27 Sep 2019 12:43:30 +0300 Subject: [PATCH 004/320] web: components: bump version --- web/ASC.Web.Components/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/ASC.Web.Components/package.json b/web/ASC.Web.Components/package.json index cf56b0b33f..07e358583d 100644 --- a/web/ASC.Web.Components/package.json +++ b/web/ASC.Web.Components/package.json @@ -1,6 +1,6 @@ { "name": "asc-web-components", - "version": "1.0.99", + "version": "1.0.100", "description": "Ascensio System SIA component library", "license": "AGPL-3.0", "main": "dist/asc-web-components.js", From ce47b822fecb4ea266efccd4d76616d7e194e561 Mon Sep 17 00:00:00 2001 From: NikolayRechkin Date: Fri, 27 Sep 2019 14:04:09 +0300 Subject: [PATCH 005/320] web: components: small change in avatar editor --- .../src/components/avatar-editor/index.js | 32 +++++++++---------- .../sub-components/avatar-editor-body.js | 1 + 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/web/ASC.Web.Components/src/components/avatar-editor/index.js b/web/ASC.Web.Components/src/components/avatar-editor/index.js index 15674d3540..d12be92a0d 100644 --- a/web/ASC.Web.Components/src/components/avatar-editor/index.js +++ b/web/ASC.Web.Components/src/components/avatar-editor/index.js @@ -32,6 +32,7 @@ class AvatarEditor extends React.Component { y: 0, width: 0, height: 0, + croppedImage: '', displayType: this.props.displayType !== 'auto' ? this.props.displayType : window.innerWidth <= desktop.match(/\d+/)[0] ? 'aside' : 'modal' } @@ -57,6 +58,9 @@ class AvatarEditor extends React.Component { } } onImageChange(file) { + this.setState({ + croppedImage: file + }) if (typeof this.props.onImageChange === 'function') this.props.onImageChange(file); } onDeleteImage() { @@ -69,17 +73,7 @@ class AvatarEditor extends React.Component { this.setState(data); } onLoadFileError(error) { - switch (error) { - case 0: - - break; - case 1: - - break; - case 2: - - break; - } + if (typeof this.props.onLoadFileError === 'function') this.props.onLoadFileError(error); } onLoadFile(file) { if (typeof this.props.onLoadFile === 'function') this.props.onLoadFile(file); @@ -87,12 +81,15 @@ class AvatarEditor extends React.Component { } onSaveButtonClick() { - this.props.onSave(this.state.isContainsFile, { - x: this.state.x, - y: this.state.y, - width: this.state.width, - height: this.state.height - }); + this.state.isContainsFile ? + this.props.onSave(this.state.isContainsFile, { + x: this.state.x, + y: this.state.y, + width: this.state.width, + height: this.state.height + },this.state.croppedImage) : + + this.props.onSave(this.state.isContainsFile); } onClose() { @@ -204,6 +201,7 @@ AvatarEditor.propTypes = { onDeleteImage: PropTypes.func, onLoadFile: PropTypes.func, onImageChange: PropTypes.func, + onLoadFileError: PropTypes.func, unknownTypeError: PropTypes.string, unknownError: PropTypes.string, displayType: PropTypes.oneOf(['auto', 'modal', 'aside']), diff --git a/web/ASC.Web.Components/src/components/avatar-editor/sub-components/avatar-editor-body.js b/web/ASC.Web.Components/src/components/avatar-editor/sub-components/avatar-editor-body.js index 70799a9d6b..6e1fa72420 100644 --- a/web/ASC.Web.Components/src/components/avatar-editor/sub-components/avatar-editor-body.js +++ b/web/ASC.Web.Components/src/components/avatar-editor/sub-components/avatar-editor-body.js @@ -227,6 +227,7 @@ class AvatarEditorBody extends React.Component { this.setState({ croppedImage: this.setEditorRef.current.getImage().toDataURL() }); + this.props.onImageChange(this.setEditorRef.current.getImage().toDataURL()); this.props.onPositionChange({ x: 0.5, y: 0.5, From 507a78c0e3fe177a87a3def1131ee5635135256b Mon Sep 17 00:00:00 2001 From: NikolayRechkin Date: Fri, 27 Sep 2019 14:05:35 +0300 Subject: [PATCH 006/320] web: people: create an avatar for a new user --- .../Section/Body/createUserForm.js | 129 ++++++++++++++---- 1 file changed, 101 insertions(+), 28 deletions(-) diff --git a/products/ASC.People/Client/src/components/pages/ProfileAction/Section/Body/createUserForm.js b/products/ASC.People/Client/src/components/pages/ProfileAction/Section/Body/createUserForm.js index 519df38fd1..341dd6420b 100644 --- a/products/ASC.People/Client/src/components/pages/ProfileAction/Section/Body/createUserForm.js +++ b/products/ASC.People/Client/src/components/pages/ProfileAction/Section/Body/createUserForm.js @@ -4,7 +4,7 @@ import { connect } from 'react-redux' import { Avatar, Button, Textarea, toastr, AvatarEditor } from 'asc-web-components' import { withTranslation } from 'react-i18next'; import { toEmployeeWrapper, getUserRole, getUserContactsPattern, getUserContacts, mapGroupsToGroupSelectorOptions, mapGroupSelectorOptionsToGroups, filterGroupSelectorOptions } from "../../../../../store/people/selectors"; -import { createProfile, loadAvatar } from '../../../../../store/profile/actions'; +import { createProfile, loadAvatar, createThumbnailsAvatar } from '../../../../../store/profile/actions'; import { MainContainer, AvatarContainer, MainFieldsContainer } from './FormFields/Form' import TextField from './FormFields/TextField' import PasswordField from './FormFields/PasswordField' @@ -43,38 +43,91 @@ class CreateUserForm extends React.Component { this.onSaveAvatar = this.onSaveAvatar.bind(this); this.onCloseAvatarEditor = this.onCloseAvatarEditor.bind(this); this.createAvatar = this.createAvatar.bind(this); + this.onLoadFileAvatar = this.onLoadFileAvatar.bind(this); + } createAvatar(userId,userName){ - this.props.updateAvatar( - userId, - { - croppedImage: this.state.croppedAvatarImage, - defaultImage: this.state.defaultAvatarImage - }) - .then((result) => { + this.props.createThumbnailsAvatar(userId, { + x: this.state.avatar.x, + y: this.state.avatar.y, + width: this.state.avatar.width, + height: this.state.avatar.height, + tmpFile: this.state.avatar.tmpFile + }) + .then((result) => { + if(result.status === 200){ toastr.success("Success"); this.props.history.push(`${this.props.settings.homepage}/view/${userName}`); - }) - .catch((error) => { - toastr.error(error.message); - this.props.history.push(`${this.props.settings.homepage}/view/${userName}`); - }); + } + }) + .catch((error) => { + toastr.error(error.message); + }); } openAvatarEditor(){ + let avatarDefault = this.state.profile.avatarDefault ? "data:image/png;base64," + this.state.profile.avatarDefault : null; + let _this = this; + if(avatarDefault !== null){ + let img = new Image(); + img.onload = function () { + _this.setState({ + avatar:{ + defaultWidth: img.width, + defaultHeight: img.height + } + }) + }; + img.src = avatarDefault; + } this.setState({ visibleAvatarEditor: true, }); } - onSaveAvatar(result){ - this.setState({ - croppedAvatarImage: result.croppedImage, - defaultAvatarImage: result.defaultImage, - }) + onLoadFileAvatar(file) { + let data = new FormData(); + let _this = this; + data.append("file", file); + data.append("Autosave", false); + this.props.loadAvatar(0, data) + .then((result) => { + var img = new Image(); + img.onload = function () { + var stateCopy = Object.assign({}, _this.state); + stateCopy.avatar = { + tmpFile: result.data.response.data, + image: result.data.response.data, + defaultWidth: img.width, + defaultHeight: img.height + } + _this.setState(stateCopy); + }; + img.src = result.data.response.data; + }) + .catch((error) => { + toastr.error(error.message); + }); + } + onSaveAvatar(isUpdate, result, file){ + var stateCopy = Object.assign({}, this.state); + + stateCopy.visibleAvatarEditor = false; + stateCopy.croppedAvatarImage = file; + if(isUpdate){ + stateCopy.avatar.x = Math.round(result.x*this.state.avatar.defaultWidth - result.width/2); + stateCopy.avatar.y = Math.round(result.y*this.state.avatar.defaultHeight - result.height/2); + stateCopy.avatar.width = result.width; + stateCopy.avatar.height = result.height; + } + this.setState(stateCopy); } onCloseAvatarEditor(){ this.setState({ visibleAvatarEditor: false, + croppedAvatarImage: "", + avatar:{ + tmpFile: "" + } }); } @@ -95,7 +148,6 @@ class CreateUserForm extends React.Component { return { visibleAvatarEditor: false, croppedAvatarImage: "", - defaultAvatarImage: "", isLoading: false, errors: { firstName: false, @@ -109,6 +161,16 @@ class CreateUserForm extends React.Component { allOptions: allOptions, options: [...allOptions], selected: selected + }, + avatar: { + tmpFile:"", + image: profile.avatarDefault ? "data:image/png;base64," + profile.avatarDefault : null, + defaultWidth: 0, + defaultHeight: 0, + x: 0, + y: 0, + width: 0, + height: 0 } }; } @@ -153,9 +215,12 @@ class CreateUserForm extends React.Component { this.props.createProfile(this.state.profile) .then((profile) => { - toastr.success("Success"); - this.props.history.push(`${this.props.settings.homepage}/view/${profile.userName}`); - //if(this.state.defaultImage !== '') this.createAvatar(profile.id,profile.userName); + if(this.state.avatar.tmpFile !== ""){ + this.createAvatar(profile.id,profile.userName); + }else{ + toastr.success("Success"); + this.props.history.push(`${this.props.settings.homepage}/view/${profile.userName}`); + } }) .catch((error) => { toastr.error(error.message) @@ -249,11 +314,18 @@ class CreateUserForm extends React.Component { editLabel={t("AddPhoto")} editAction={this.openAvatarEditor} /> - + + Date: Fri, 27 Sep 2019 14:06:13 +0300 Subject: [PATCH 007/320] web: components: bump version --- web/ASC.Web.Components/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/ASC.Web.Components/package.json b/web/ASC.Web.Components/package.json index 07e358583d..696fd1abcf 100644 --- a/web/ASC.Web.Components/package.json +++ b/web/ASC.Web.Components/package.json @@ -1,6 +1,6 @@ { "name": "asc-web-components", - "version": "1.0.100", + "version": "1.0.101", "description": "Ascensio System SIA component library", "license": "AGPL-3.0", "main": "dist/asc-web-components.js", From 1b293c6112511f4c8f5769e51042f76ab517b1ee Mon Sep 17 00:00:00 2001 From: Alexey Safronov Date: Fri, 27 Sep 2019 14:42:17 +0300 Subject: [PATCH 008/320] web: People: Fixed set filter by url --- .../components/pages/Home/Section/Filter/index.js | 12 ------------ products/ASC.People/Client/src/store/auth/actions.js | 10 ++++++++-- .../ASC.People/Client/src/store/people/actions.js | 6 +++++- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/products/ASC.People/Client/src/components/pages/Home/Section/Filter/index.js b/products/ASC.People/Client/src/components/pages/Home/Section/Filter/index.js index 8128d70c85..1d14adfc96 100644 --- a/products/ASC.People/Client/src/components/pages/Home/Section/Filter/index.js +++ b/products/ASC.People/Client/src/components/pages/Home/Section/Filter/index.js @@ -12,18 +12,6 @@ import { department } from "./../../../../../helpers/customNames"; import { withRouter } from "react-router"; -import Filter from "../../../../../store/people/filter"; -import { - EMPLOYEE_STATUS, - ACTIVATION_STATUS, - ROLE, - GROUP, - SEARCH, - SORT_BY, - SORT_ORDER, - PAGE, - PAGE_COUNT -} from "../../../../../helpers/constants"; import { getFilterByLocation } from "../../../../../helpers/converters"; const getEmployeeStatus = filterValues => { diff --git a/products/ASC.People/Client/src/store/auth/actions.js b/products/ASC.People/Client/src/store/auth/actions.js index 5d0441fea7..b7eed49761 100644 --- a/products/ASC.People/Client/src/store/auth/actions.js +++ b/products/ASC.People/Client/src/store/auth/actions.js @@ -2,6 +2,7 @@ import * as api from "../services/api"; import { setGroups, fetchPeopleAsync } from "../people/actions"; import setAuthorizationToken from "../../store/services/setAuthorizationToken"; import { getFilterByLocation } from "../../helpers/converters"; +import config from "../../../package.json"; export const LOGIN_POST = "LOGIN_POST"; export const SET_CURRENT_USER = "SET_CURRENT_USER"; @@ -60,9 +61,14 @@ export async function getUserInfo(dispatch) { dispatch(setGroups(groupResp.data.response)); - const newFilter = getFilterByLocation(window.location); + var re = new RegExp(`${config.homepage}((/?)$|/filter)`, "gm"); + const match = window.location.pathname.match(re); - await fetchPeopleAsync(dispatch, newFilter); + if (match && match.length > 0) + { + const newFilter = getFilterByLocation(window.location); + await fetchPeopleAsync(dispatch, newFilter); + } return dispatch(setIsLoaded(true)); } diff --git a/products/ASC.People/Client/src/store/people/actions.js b/products/ASC.People/Client/src/store/people/actions.js index 6a246de579..744a8553ff 100644 --- a/products/ASC.People/Client/src/store/people/actions.js +++ b/products/ASC.People/Client/src/store/people/actions.js @@ -86,7 +86,7 @@ export function deselectUser(user) { }; } -export function setFilter(filter) { +export function setFilterUrl(filter) { const defaultFilter = Filter.getDefault(); const params = []; @@ -121,6 +121,10 @@ export function setFilter(filter) { if (params.length > 0) { history.push(`${config.homepage}/filter?${params.join("&")}`); } +} + +export function setFilter(filter) { + setFilterUrl(filter); return { type: SET_FILTER, filter From 49ba16ba4bb04669647986e6c4bd78a5934fea8f Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Fri, 27 Sep 2019 15:05:38 +0300 Subject: [PATCH 009/320] Web: Client: fixed change password link --- .../pages/Confirm/sub-components/changePassword.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/ASC.Web.Client/src/components/pages/Confirm/sub-components/changePassword.js b/web/ASC.Web.Client/src/components/pages/Confirm/sub-components/changePassword.js index 8d50d9da26..6b45332854 100644 --- a/web/ASC.Web.Client/src/components/pages/Confirm/sub-components/changePassword.js +++ b/web/ASC.Web.Client/src/components/pages/Confirm/sub-components/changePassword.js @@ -65,9 +65,13 @@ const Form = props => { console.log("changePassword onSubmit", match, location, history); const str = location.search.split("&"); - const userId = str[1].slice(4); + const userId = str[2].slice(4); const key = `type=PasswordChange&${location.search.slice(1)}`; + //console.log("str", str); + //console.log("key", key); + //console.log("userId", userId); + changePassword(userId, {password}, key) .then(() => { console.log("UPDATE PASSWORD"); From 6b69bf0fbbfa8be3b0b6cac7d0452388bbf5f679 Mon Sep 17 00:00:00 2001 From: NikolayRechkin Date: Fri, 27 Sep 2019 15:25:28 +0300 Subject: [PATCH 010/320] web: components: created a return to an edit page after closing a avatar editor --- .../src/components/avatar-editor/index.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/web/ASC.Web.Components/src/components/avatar-editor/index.js b/web/ASC.Web.Components/src/components/avatar-editor/index.js index d12be92a0d..3b269ce2cc 100644 --- a/web/ASC.Web.Components/src/components/avatar-editor/index.js +++ b/web/ASC.Web.Components/src/components/avatar-editor/index.js @@ -46,7 +46,7 @@ class AvatarEditor extends React.Component { this.onDeleteImage = this.onDeleteImage.bind(this); this.throttledResize = throttle(this.resize, 300); - + this.popstate = this.popstate.bind(this); } resize = () => { if (this.props.displayType === "auto") { @@ -81,14 +81,14 @@ class AvatarEditor extends React.Component { } onSaveButtonClick() { - this.state.isContainsFile ? + this.state.isContainsFile ? this.props.onSave(this.state.isContainsFile, { x: this.state.x, y: this.state.y, width: this.state.width, height: this.state.height - },this.state.croppedImage) : - + }, this.state.croppedImage) : + this.props.onSave(this.state.isContainsFile); } @@ -96,7 +96,11 @@ class AvatarEditor extends React.Component { this.setState({ visible: false }); this.props.onClose(); } - + popstate() { + window.history.go(1); + this.onClose(); + window.removeEventListener('popstate', this.popstate, false); + } componentDidUpdate(prevProps) { if (this.props.visible !== prevProps.visible) { this.setState({ visible: this.props.visible }); @@ -104,6 +108,9 @@ class AvatarEditor extends React.Component { if (this.props.displayType !== prevProps.displayType) { this.setState({ displayType: this.props.displayType !== 'auto' ? this.props.displayType : window.innerWidth <= desktop.match(/\d+/)[0] ? 'aside' : 'modal' }); } + if (this.state.visible && this.state.displayType === "aside") { + window.addEventListener("popstate", this.popstate, false); + } } componentDidMount() { window.addEventListener('resize', this.throttledResize); From 2b084d38ba1cc5040c4e1ce36fef9b7369400d31 Mon Sep 17 00:00:00 2001 From: NikolayRechkin Date: Fri, 27 Sep 2019 15:25:58 +0300 Subject: [PATCH 011/320] web: components: bump version --- web/ASC.Web.Components/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/ASC.Web.Components/package.json b/web/ASC.Web.Components/package.json index 696fd1abcf..1d0cb6c092 100644 --- a/web/ASC.Web.Components/package.json +++ b/web/ASC.Web.Components/package.json @@ -1,6 +1,6 @@ { "name": "asc-web-components", - "version": "1.0.101", + "version": "1.0.102", "description": "Ascensio System SIA component library", "license": "AGPL-3.0", "main": "dist/asc-web-components.js", From 857c486dc4f8f9525baa558ca0c9c8fcb5f17d0f Mon Sep 17 00:00:00 2001 From: Alexey Safronov Date: Fri, 27 Sep 2019 15:27:16 +0300 Subject: [PATCH 012/320] web: components: Fixed props as attributes error --- .../src/components/layout/sub-components/aside.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/web/ASC.Web.Components/src/components/layout/sub-components/aside.js b/web/ASC.Web.Components/src/components/layout/sub-components/aside.js index 9835faadc1..c292788def 100644 --- a/web/ASC.Web.Components/src/components/layout/sub-components/aside.js +++ b/web/ASC.Web.Components/src/components/layout/sub-components/aside.js @@ -3,7 +3,17 @@ import PropTypes from "prop-types"; import styled from "styled-components"; import Scrollbar from "../../scrollbar"; -const StyledAside = styled.aside` +/* eslint-disable no-unused-vars */ +/* eslint-disable react/prop-types */ +const Container = ({ + visible, + scale, + ...props +}) =>
+ )); \ No newline at end of file diff --git a/web/ASC.Web.Components/src/components/side-panel/side-panel.test.js b/web/ASC.Web.Components/src/components/side-panel/side-panel.test.js new file mode 100644 index 0000000000..641fd4065d --- /dev/null +++ b/web/ASC.Web.Components/src/components/side-panel/side-panel.test.js @@ -0,0 +1,13 @@ +import React from 'react'; +import { mount } from 'enzyme'; +import SidePanel from '.'; + +describe('', () => { + it('renders without error', () => { + const wrapper = mount( + + ); + + expect(wrapper).toExist(); + }); +}); diff --git a/web/ASC.Web.Components/src/index.js b/web/ASC.Web.Components/src/index.js index 67942d73c9..7796ba0467 100644 --- a/web/ASC.Web.Components/src/index.js +++ b/web/ASC.Web.Components/src/index.js @@ -57,3 +57,4 @@ export { default as FieldContainer } from './components/field-container' export { default as utils } from './utils' export { default as DatePicker } from './components/date-picker' export { default as PasswordInput } from './components/password-input' +export { default as SidePanel } from './components/side-panel' From e0e8924b03ebda4584ca02e52340436a8a4de0b6 Mon Sep 17 00:00:00 2001 From: Andrey Savihin Date: Mon, 30 Sep 2019 16:17:16 +0300 Subject: [PATCH 075/320] ASC.Web.Components: AvatarEditor: using SidePanel --- .../src/components/avatar-editor/index.js | 81 +++++++------------ 1 file changed, 31 insertions(+), 50 deletions(-) diff --git a/web/ASC.Web.Components/src/components/avatar-editor/index.js b/web/ASC.Web.Components/src/components/avatar-editor/index.js index 32254f1a68..4748823e4b 100644 --- a/web/ASC.Web.Components/src/components/avatar-editor/index.js +++ b/web/ASC.Web.Components/src/components/avatar-editor/index.js @@ -3,23 +3,10 @@ import PropTypes from 'prop-types' import ModalDialog from '../modal-dialog' import Button from '../button' import AvatarEditorBody from './sub-components/avatar-editor-body' -import Aside from "../layout/sub-components/aside"; -import IconButton from '../icon-button' -import styled from 'styled-components' +import SidePanel from '../side-panel' import { desktop } from '../../utils/device'; import throttle from 'lodash/throttle'; -const Header = styled.div` - margin-bottom: 10px; -`; - -const StyledAside = styled(Aside)` - padding: 10px; - - .aside-save-button{ - margin-top: 10px; - } -`; class AvatarEditor extends React.Component { constructor(props) { @@ -106,7 +93,7 @@ class AvatarEditor extends React.Component { this.setState({ visible: this.props.visible }); } if (this.props.displayType !== prevProps.displayType) { - this.setState({ displayType: this.props.displayType !== 'auto' ? this.props.displayType : window.innerWidth <= desktop.match(/\d+/)[0] ? 'aside' : 'modal' }); + this.setState({ displayType: this.props.displayType !== 'auto' ? this.props.displayType : window.innerWidth < desktop.match(/\d+/)[0] ? 'aside' : 'modal' }); } if (this.state.visible && this.state.displayType === "aside") { window.addEventListener("popstate", this.popstate, false); @@ -146,50 +133,44 @@ class AvatarEditor extends React.Component { key="SaveBtn" label={this.props.saveButtonLabel} primary={true} + size="medium" onClick={this.onSaveButtonClick} /> ]} onClose={this.props.onClose} /> : - -
- -
- - - -