From 01d7a7c0957a6ccdfa4a0035a7569d808a658dbc Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Tue, 19 Apr 2022 11:35:00 +0300 Subject: [PATCH 01/20] CustomHealthCheck: try, catch --- common/ASC.Api.Core/Core/CustomHealthCheck.cs | 39 +++++++++++-------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/common/ASC.Api.Core/Core/CustomHealthCheck.cs b/common/ASC.Api.Core/Core/CustomHealthCheck.cs index 29b56aa66d..e6cdf208ae 100644 --- a/common/ASC.Api.Core/Core/CustomHealthCheck.cs +++ b/common/ASC.Api.Core/Core/CustomHealthCheck.cs @@ -52,22 +52,29 @@ namespace ASC.Api.Core.Core } - - var elasticSettings = configuration.GetSection("elastic"); - - if (elasticSettings != null && elasticSettings.GetChildren().Any()) - { - var host = elasticSettings.GetSection("Host").Value ?? "localhost"; - var scheme = elasticSettings.GetSection("Scheme").Value ?? "http"; - var port = elasticSettings.GetSection("Port").Value ?? "9200"; - var elasticSearchUri = $"{scheme}://{host}:{port}"; - - if (Uri.IsWellFormedUriString(elasticSearchUri, UriKind.Absolute)) - { - hcBuilder.AddElasticsearch(elasticSearchUri, - name: "elasticsearch", - tags: new string[] { "elasticsearch" }); - } + + try + { + var elasticSettings = configuration.GetSection("elastic"); + + if (elasticSettings != null && elasticSettings.GetChildren().Any()) + { + var host = elasticSettings.GetSection("Host").Value ?? "localhost"; + var scheme = elasticSettings.GetSection("Scheme").Value ?? "http"; + var port = elasticSettings.GetSection("Port").Value ?? "9200"; + var elasticSearchUri = $"{scheme}://{host}:{port}"; + + if (Uri.IsWellFormedUriString(elasticSearchUri, UriKind.Absolute)) + { + hcBuilder.AddElasticsearch(elasticSearchUri, + name: "elasticsearch", + tags: new string[] { "elasticsearch" }); + } + } + } + catch (Exception) + { + } return services; From 3e4e293775855dbf6f561a803be03c4e93a0d28e Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Tue, 19 Apr 2022 13:48:11 +0300 Subject: [PATCH 02/20] Api: downgrade AspNetCore.HealthChecks.Elasticsearch, because we need to use Nest 7.10 --- common/ASC.Api.Core/ASC.Api.Core.csproj | 2 +- common/ASC.Api.Core/Core/CustomHealthCheck.cs | 39 ++++++++----------- 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/common/ASC.Api.Core/ASC.Api.Core.csproj b/common/ASC.Api.Core/ASC.Api.Core.csproj index da346a0610..14937240f7 100644 --- a/common/ASC.Api.Core/ASC.Api.Core.csproj +++ b/common/ASC.Api.Core/ASC.Api.Core.csproj @@ -11,7 +11,7 @@ - + diff --git a/common/ASC.Api.Core/Core/CustomHealthCheck.cs b/common/ASC.Api.Core/Core/CustomHealthCheck.cs index e6cdf208ae..9803d49ca0 100644 --- a/common/ASC.Api.Core/Core/CustomHealthCheck.cs +++ b/common/ASC.Api.Core/Core/CustomHealthCheck.cs @@ -50,31 +50,24 @@ namespace ASC.Api.Core.Core name: "kafka", tags: new string[] { "kafka" }); - } - - - try - { - var elasticSettings = configuration.GetSection("elastic"); - - if (elasticSettings != null && elasticSettings.GetChildren().Any()) - { - var host = elasticSettings.GetSection("Host").Value ?? "localhost"; - var scheme = elasticSettings.GetSection("Scheme").Value ?? "http"; - var port = elasticSettings.GetSection("Port").Value ?? "9200"; - var elasticSearchUri = $"{scheme}://{host}:{port}"; - - if (Uri.IsWellFormedUriString(elasticSearchUri, UriKind.Absolute)) - { - hcBuilder.AddElasticsearch(elasticSearchUri, - name: "elasticsearch", - tags: new string[] { "elasticsearch" }); - } - } } - catch (Exception) - { + + var elasticSettings = configuration.GetSection("elastic"); + + if (elasticSettings != null && elasticSettings.GetChildren().Any()) + { + var host = elasticSettings.GetSection("Host").Value ?? "localhost"; + var scheme = elasticSettings.GetSection("Scheme").Value ?? "http"; + var port = elasticSettings.GetSection("Port").Value ?? "9200"; + var elasticSearchUri = $"{scheme}://{host}:{port}"; + + if (Uri.IsWellFormedUriString(elasticSearchUri, UriKind.Absolute)) + { + hcBuilder.AddElasticsearch(elasticSearchUri, + name: "elasticsearch", + tags: new string[] { "elasticsearch" }); + } } return services; From cc999eddbfe78802b304ea1fd695ff74d4e1a468 Mon Sep 17 00:00:00 2001 From: Viktor Fomin Date: Tue, 19 Apr 2022 18:16:43 +0300 Subject: [PATCH 03/20] Web: Login: delete useless --- web/ASC.Web.Login/src/Login.jsx | 2 -- web/ASC.Web.Login/src/StyledLogin.js | 4 ---- 2 files changed, 6 deletions(-) diff --git a/web/ASC.Web.Login/src/Login.jsx b/web/ASC.Web.Login/src/Login.jsx index cb0e93d125..46a353ce23 100644 --- a/web/ASC.Web.Login/src/Login.jsx +++ b/web/ASC.Web.Login/src/Login.jsx @@ -410,7 +410,6 @@ const Form = (props) => {
{ /> Date: Wed, 20 Apr 2022 12:33:51 +0300 Subject: [PATCH 04/20] Web: Components: Checkbox: add helpButton prop, fix style --- packages/asc-web-components/checkbox/index.js | 72 +++++++++++-------- .../checkbox/styled-checkbox.js | 13 +++- 2 files changed, 56 insertions(+), 29 deletions(-) diff --git a/packages/asc-web-components/checkbox/index.js b/packages/asc-web-components/checkbox/index.js index b1bc4062f4..3947d8e303 100644 --- a/packages/asc-web-components/checkbox/index.js +++ b/packages/asc-web-components/checkbox/index.js @@ -62,6 +62,10 @@ class Checkbox extends React.Component { this.props.onChange && this.props.onChange(e); } + onClick(e) { + return e.preventDefault(); + } + render() { //console.log("Checkbox render"); const { @@ -75,39 +79,49 @@ class Checkbox extends React.Component { title, truncate, name, + helpButton, } = this.props; return ( - - + - - {this.props.label && ( - + - {label} - - )} - + ref={this.ref} + value={value} + onChange={this.onInputChange} + /> + +
+ {this.props.label && ( + + {label} + + )} + {helpButton && ( + + {helpButton} + + )} +
+
+ ); } } @@ -137,6 +151,8 @@ Checkbox.propTypes = { title: PropTypes.string, /** Disables word wrapping */ truncate: PropTypes.bool, + /** Help button render */ + helpButton: PropTypes.any, }; Checkbox.defaultProps = { diff --git a/packages/asc-web-components/checkbox/styled-checkbox.js b/packages/asc-web-components/checkbox/styled-checkbox.js index 98f6024861..3b930b0aa9 100644 --- a/packages/asc-web-components/checkbox/styled-checkbox.js +++ b/packages/asc-web-components/checkbox/styled-checkbox.js @@ -3,7 +3,8 @@ import Base from "../themes/base"; const StyledLabel = styled.label` display: flex; - align-items: center; + //align-items: center; + justify-content: center; position: relative; margin: 0; @@ -107,11 +108,21 @@ const StyledLabel = styled.label` `} } + .wrapper { + display: inline-block; + } + .checkbox-text { color: ${(props) => props.isDisabled ? props.theme.text.disableColor : props.theme.text.color}; + margin-top: -2px; + } + + .help-button { + display: inline-block; + margin-left: 4px; } `; StyledLabel.defaultProps = { theme: Base }; From f72dbca58e81cc8f8c446bb457ebfc11340a07d9 Mon Sep 17 00:00:00 2001 From: Viktor Fomin Date: Wed, 20 Apr 2022 12:34:21 +0300 Subject: [PATCH 05/20] Web: Login: fix checkbox wrapper --- web/ASC.Web.Login/src/Login.jsx | 30 ++++++++++++++++------------ web/ASC.Web.Login/src/StyledLogin.js | 19 +++++++++++------- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/web/ASC.Web.Login/src/Login.jsx b/web/ASC.Web.Login/src/Login.jsx index 46a353ce23..74ca68b3c9 100644 --- a/web/ASC.Web.Login/src/Login.jsx +++ b/web/ASC.Web.Login/src/Login.jsx @@ -463,19 +463,23 @@ const Form = (props) => {
- {t("Remember")}} - /> - {t("RememberHelper")} - } - /> +
+ {t("RememberHelper")} + } + /> + } + /> +
+ Date: Wed, 20 Apr 2022 12:41:35 +0300 Subject: [PATCH 06/20] Web: Files: fix load t --- .../src/pages/Home/Section/Body/RowsView/SimpleFilesRow.js | 5 +++-- .../Client/src/pages/Home/Section/Body/TableView/TableRow.js | 2 +- .../Client/src/pages/Home/Section/Body/TilesView/FileTile.js | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/products/ASC.Files/Client/src/pages/Home/Section/Body/RowsView/SimpleFilesRow.js b/products/ASC.Files/Client/src/pages/Home/Section/Body/RowsView/SimpleFilesRow.js index c6e78706e1..0c965f7b3f 100644 --- a/products/ASC.Files/Client/src/pages/Home/Section/Body/RowsView/SimpleFilesRow.js +++ b/products/ASC.Files/Client/src/pages/Home/Section/Body/RowsView/SimpleFilesRow.js @@ -98,7 +98,8 @@ const StyledSimpleFilesRow = styled(Row)` .row_content { ${(props) => - props.sectionWidth > 500 && `max-width: fit-content;`}//min-width: auto;; + props.sectionWidth > 500 && + `max-width: fit-content;`}//min-width: auto;;;; } .badges { @@ -260,6 +261,6 @@ const SimpleFilesRow = (props) => { ); }; -export default withTranslation(["Home", "Translations"])( +export default withTranslation(["Home", "Translations", "InfoPanel"])( withFileActions(withRouter(withQuickButtons(SimpleFilesRow))) ); diff --git a/products/ASC.Files/Client/src/pages/Home/Section/Body/TableView/TableRow.js b/products/ASC.Files/Client/src/pages/Home/Section/Body/TableView/TableRow.js index f31b181e26..a2ea730227 100644 --- a/products/ASC.Files/Client/src/pages/Home/Section/Body/TableView/TableRow.js +++ b/products/ASC.Files/Client/src/pages/Home/Section/Body/TableView/TableRow.js @@ -417,7 +417,7 @@ const FilesTableRow = (props) => { ); }; -export default withTranslation(["Home", "Common", "VersionBadge"])( +export default withTranslation(["Home", "Common", "VersionBadge", "InfoPanel"])( withFileActions( withRouter(withContent(withQuickButtons(withBadges(FilesTableRow)))) ) diff --git a/products/ASC.Files/Client/src/pages/Home/Section/Body/TilesView/FileTile.js b/products/ASC.Files/Client/src/pages/Home/Section/Body/TilesView/FileTile.js index 496f2d2abc..9eaf3de7bb 100644 --- a/products/ASC.Files/Client/src/pages/Home/Section/Body/TilesView/FileTile.js +++ b/products/ASC.Files/Client/src/pages/Home/Section/Body/TilesView/FileTile.js @@ -112,7 +112,7 @@ export default inject(({ settingsStore }) => { const { getIcon } = settingsStore; return { getIcon }; })( - withTranslation(["Home", "VersionBadge"])( + withTranslation(["Home", "VersionBadge", "InfoPanel"])( withFileActions( withRouter(withBadges(withQuickButtons(observer(FileTile)))) ) From 45c746fdf28f11f5aa2c76209e1343cd597d43db Mon Sep 17 00:00:00 2001 From: Viktor Fomin Date: Wed, 20 Apr 2022 12:58:09 +0300 Subject: [PATCH 07/20] Web: Components: Checkbox: fix style --- packages/asc-web-components/checkbox/index.js | 3 +++ .../asc-web-components/checkbox/styled-checkbox.js | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/asc-web-components/checkbox/index.js b/packages/asc-web-components/checkbox/index.js index 3947d8e303..ec04e6f4b9 100644 --- a/packages/asc-web-components/checkbox/index.js +++ b/packages/asc-web-components/checkbox/index.js @@ -153,11 +153,14 @@ Checkbox.propTypes = { truncate: PropTypes.bool, /** Help button render */ helpButton: PropTypes.any, + + isLogin: PropTypes.bool, }; Checkbox.defaultProps = { isChecked: false, truncate: false, + isLogin: false, }; export default React.memo(Checkbox); diff --git a/packages/asc-web-components/checkbox/styled-checkbox.js b/packages/asc-web-components/checkbox/styled-checkbox.js index 3b930b0aa9..dc972e4dac 100644 --- a/packages/asc-web-components/checkbox/styled-checkbox.js +++ b/packages/asc-web-components/checkbox/styled-checkbox.js @@ -3,8 +3,14 @@ import Base from "../themes/base"; const StyledLabel = styled.label` display: flex; - //align-items: center; - justify-content: center; + + ${(props) => + !props.isLogin && + css` + align-items: "center"; + `}; + + justify-content: ${(props) => props.isLogin && "center"}; position: relative; margin: 0; From aa16542fb4aef06a8ce7956774efe1932263e8e0 Mon Sep 17 00:00:00 2001 From: Viktor Fomin Date: Wed, 20 Apr 2022 12:58:20 +0300 Subject: [PATCH 08/20] Web: Login: fix style --- web/ASC.Web.Login/src/Login.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/web/ASC.Web.Login/src/Login.jsx b/web/ASC.Web.Login/src/Login.jsx index 74ca68b3c9..3dee195b8d 100644 --- a/web/ASC.Web.Login/src/Login.jsx +++ b/web/ASC.Web.Login/src/Login.jsx @@ -466,6 +466,7 @@ const Form = (props) => {
Date: Wed, 20 Apr 2022 14:43:14 +0300 Subject: [PATCH 09/20] Web: Files: MediaViewer: fix t key --- products/ASC.Files/Client/src/pages/Home/MediaViewer/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/products/ASC.Files/Client/src/pages/Home/MediaViewer/index.js b/products/ASC.Files/Client/src/pages/Home/MediaViewer/index.js index 906ce78737..889e699a62 100644 --- a/products/ASC.Files/Client/src/pages/Home/MediaViewer/index.js +++ b/products/ASC.Files/Client/src/pages/Home/MediaViewer/index.js @@ -85,8 +85,8 @@ const FilesMediaViewer = (props) => { const onDeleteMediaFile = (id) => { const translations = { deleteOperation: t("Translations:DeleteOperation"), - folderRemoved: t("FolderRemoved"), - fileRemoved: t("FileRemoved"), + successRemoveFolder: t("FolderRemoved"), + successRemoveFile: t("FileRemoved"), }; if (files.length > 0) { From ee931b3098bba315cdb14676d89d4610f38d9e00 Mon Sep 17 00:00:00 2001 From: Viktor Fomin Date: Wed, 20 Apr 2022 14:55:23 +0300 Subject: [PATCH 10/20] Web: Files: fix share icon --- products/ASC.Files/Client/src/components/QuickButtons.js | 4 ++-- public/images/shared.share.react.svg | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 public/images/shared.share.react.svg diff --git a/products/ASC.Files/Client/src/components/QuickButtons.js b/products/ASC.Files/Client/src/components/QuickButtons.js index 16f1940c84..3f9e903674 100644 --- a/products/ASC.Files/Client/src/components/QuickButtons.js +++ b/products/ASC.Files/Client/src/components/QuickButtons.js @@ -29,8 +29,8 @@ const QuickButtons = ({ const isTile = viewAs === "tile"; const iconShare = shared - ? "/static/images/file.actions.share.react.svg" - : "/static/images/catalog.share.react.svg"; + ? "/static/images/shared.share.react.svg" + : "/static/images/share.react.svg"; const colorShare = shared ? theme.filesQuickButtons.sharedColor diff --git a/public/images/shared.share.react.svg b/public/images/shared.share.react.svg new file mode 100644 index 0000000000..5af3c19faf --- /dev/null +++ b/public/images/shared.share.react.svg @@ -0,0 +1,3 @@ + + + From bba207a4c9ccdf3bfec8a6cd292009d49acaad47 Mon Sep 17 00:00:00 2001 From: Timofey Boyko Date: Wed, 20 Apr 2022 16:57:06 +0300 Subject: [PATCH 11/20] Web:Components:TableContainer: hide disabled item for table group menu --- .../table-container/GroupMenuItem.js | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/packages/asc-web-components/table-container/GroupMenuItem.js b/packages/asc-web-components/table-container/GroupMenuItem.js index f60d05e41b..9104339e0b 100644 --- a/packages/asc-web-components/table-container/GroupMenuItem.js +++ b/packages/asc-web-components/table-container/GroupMenuItem.js @@ -77,13 +77,21 @@ StyledButton.defaultProps = { theme: Base }; const GroupMenuItem = ({ item }) => { const { label, disabled, onClick, iconUrl, title } = item; return ( - } - /> + <> + {disabled ? ( + <> + ) : ( + + } + /> + )} + ); }; From e9223f91e3085467a333c0a617b391a88806219b Mon Sep 17 00:00:00 2001 From: Timofey Boyko Date: Wed, 20 Apr 2022 17:08:50 +0300 Subject: [PATCH 12/20] Web:People:Article: delete useless code --- .../Client/src/components/Article/MainButton/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/products/ASC.People/Client/src/components/Article/MainButton/index.js b/products/ASC.People/Client/src/components/Article/MainButton/index.js index 4c946e2df8..54be31e671 100644 --- a/products/ASC.People/Client/src/components/Article/MainButton/index.js +++ b/products/ASC.People/Client/src/components/Article/MainButton/index.js @@ -151,7 +151,7 @@ class ArticleMainButtonContent extends React.Component { return isAdmin ? ( <> - {isMobileArticle && !isArticleLoading ? ( + {isMobileArticle ? ( Date: Wed, 20 Apr 2022 17:15:44 +0300 Subject: [PATCH 13/20] Web:Components:CatalogItem: remove hover effect for mobile devices --- .../asc-web-components/catalog-item/styled-catalog-item.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/asc-web-components/catalog-item/styled-catalog-item.js b/packages/asc-web-components/catalog-item/styled-catalog-item.js index 511d72a1b3..a3252d50bd 100644 --- a/packages/asc-web-components/catalog-item/styled-catalog-item.js +++ b/packages/asc-web-components/catalog-item/styled-catalog-item.js @@ -250,6 +250,10 @@ const StyledCatalogItemSibling = styled.div` css` min-height: ${(props) => props.theme.catalogItem.container.tablet.height}; max-height: ${(props) => props.theme.catalogItem.container.tablet.height}; + + &:hover { + background-color: transparent; + } `} ${(props) => props.isDragging && draggingSiblingCss} From 6c28b6777d3cdc8df9396739db4fd8fe544bf572 Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Wed, 20 Apr 2022 17:19:06 +0300 Subject: [PATCH 14/20] added DarkThemeSettings --- .../ASC.Api.Core/Model/EmployeeWraperFull.cs | 4 +- .../Users/DarkThemeSettings.cs | 61 +++++++++++++++++++ .../Server/Controllers/PeopleController.cs | 40 +++++++++++- .../Server/Models/DarkThemeSettingsModel.cs | 34 +++++++++++ 4 files changed, 135 insertions(+), 4 deletions(-) create mode 100644 common/ASC.Core.Common/Users/DarkThemeSettings.cs create mode 100644 products/ASC.People/Server/Models/DarkThemeSettingsModel.cs diff --git a/common/ASC.Api.Core/Model/EmployeeWraperFull.cs b/common/ASC.Api.Core/Model/EmployeeWraperFull.cs index ddc5f1095c..379bdabeda 100644 --- a/common/ASC.Api.Core/Model/EmployeeWraperFull.cs +++ b/common/ASC.Api.Core/Model/EmployeeWraperFull.cs @@ -98,7 +98,9 @@ namespace ASC.Web.Api.Models public bool IsSSO { get; set; } - public new static EmployeeWraperFull GetSample() + public DarkThemeSettingsEnum? Theme { get; set; } + + public static new EmployeeWraperFull GetSample() { return new EmployeeWraperFull { diff --git a/common/ASC.Core.Common/Users/DarkThemeSettings.cs b/common/ASC.Core.Common/Users/DarkThemeSettings.cs new file mode 100644 index 0000000000..e5c2050a6a --- /dev/null +++ b/common/ASC.Core.Common/Users/DarkThemeSettings.cs @@ -0,0 +1,61 @@ +// (c) Copyright Ascensio System SIA 2010-2022 +// +// This program is a free software product. +// You can redistribute it and/or modify it under the terms +// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software +// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended +// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of +// any third-party rights. +// +// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see +// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html +// +// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021. +// +// The interactive user interfaces in modified source and object code versions of the Program must +// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3. +// +// Pursuant to Section 7(b) of the License you must retain the original Product logo when +// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under +// trademark law for use of our trademarks. +// +// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing +// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 +// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + + +using System; +using System.Text.Json.Serialization; + +using ASC.Core.Common.Settings; + +namespace ASC.Web.Core.Users; + +[Serializable] +public class DarkThemeSettings : ISettings +{ + [JsonIgnore] + public Guid ID + { + get { return new Guid("{38362061-066D-4C57-A23E-8953CF34EFC3}"); } + } + + public DarkThemeSettingsEnum Theme { get; set; } + + public ISettings GetDefault(IServiceProvider serviceProvider) + { + return new DarkThemeSettings + { + Theme = DarkThemeSettingsEnum.Base, + }; + } +} + +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum DarkThemeSettingsEnum +{ + Base, + Dark, + System +} diff --git a/products/ASC.People/Server/Controllers/PeopleController.cs b/products/ASC.People/Server/Controllers/PeopleController.cs index dcb2936b08..87a2dfe450 100644 --- a/products/ASC.People/Server/Controllers/PeopleController.cs +++ b/products/ASC.People/Server/Controllers/PeopleController.cs @@ -219,7 +219,11 @@ namespace ASC.Employee.Core.Controllers [Read("@self")] public EmployeeWraper Self() { - return EmployeeWraperFullHelper.GetFull(UserManager.GetUser(SecurityContext.CurrentAccount.ID, EmployeeWraperFullHelper.GetExpression(ApiContext))); + var result = EmployeeWraperFullHelper.GetFull(UserManager.GetUser(SecurityContext.CurrentAccount.ID, EmployeeWraperFullHelper.GetExpression(ApiContext))); + + result.Theme = SettingsManager.LoadForCurrentUser().Theme; + + return result; } [Read("email")] @@ -707,13 +711,13 @@ namespace ASC.Employee.Core.Controllers return EmployeeWraperFullHelper.GetFull(user); } - [Update("{userid}")] + [Update("{userid}", order: int.MaxValue, DisableFormat = true)] public EmployeeWraperFull UpdateMemberFromBody(string userid, [FromBody] UpdateMemberModel memberModel) { return UpdateMember(userid, memberModel); } - [Update("{userid}")] + [Update("{userid}", order: int.MaxValue, DisableFormat = true)] [Consumes("application/x-www-form-urlencoded")] public EmployeeWraperFull UpdateMemberFromForm(string userid, [FromForm] UpdateMemberModel memberModel) { @@ -1480,6 +1484,36 @@ namespace ASC.Employee.Core.Controllers return users.Select(EmployeeWraperFullHelper.GetFull); } + [Read("theme")] + public DarkThemeSettings GetTheme() + { + return SettingsManager.LoadForCurrentUser(); + } + + [Update("theme")] + public DarkThemeSettings ChangeThemeFromBody([FromBody] DarkThemeSettingsModel model) + { + return ChangeTheme(model); + } + + [Update("theme")] + [Consumes("application/x-www-form-urlencoded")] + public DarkThemeSettings ChangeThemeFromForm([FromForm] DarkThemeSettingsModel model) + { + return ChangeTheme(model); + } + + private DarkThemeSettings ChangeTheme(DarkThemeSettingsModel model) + { + var darkThemeSettings = new DarkThemeSettings + { + Theme = model.Theme + }; + + SettingsManager.SaveForCurrentUser(darkThemeSettings); + + return darkThemeSettings; + } [Update("invite")] public IEnumerable ResendUserInvitesFromBody([FromBody] UpdateMembersModel model) diff --git a/products/ASC.People/Server/Models/DarkThemeSettingsModel.cs b/products/ASC.People/Server/Models/DarkThemeSettingsModel.cs new file mode 100644 index 0000000000..fb6f3ea119 --- /dev/null +++ b/products/ASC.People/Server/Models/DarkThemeSettingsModel.cs @@ -0,0 +1,34 @@ +// (c) Copyright Ascensio System SIA 2010-2022 +// +// This program is a free software product. +// You can redistribute it and/or modify it under the terms +// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software +// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended +// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of +// any third-party rights. +// +// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see +// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html +// +// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021. +// +// The interactive user interfaces in modified source and object code versions of the Program must +// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3. +// +// Pursuant to Section 7(b) of the License you must retain the original Product logo when +// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under +// trademark law for use of our trademarks. +// +// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing +// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 +// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + +using ASC.Web.Core.Users; + +namespace ASC.People.Models; + +public class DarkThemeSettingsModel +{ + public DarkThemeSettingsEnum Theme { get; set; } +} From 924409d1ab9434f1f571eed79727f37939278873 Mon Sep 17 00:00:00 2001 From: Timofey Boyko Date: Wed, 20 Apr 2022 18:02:22 +0300 Subject: [PATCH 15/20] Web:Common:Article: hide article header loader for file module --- .../components/Article/sub-components/article-header.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/asc-web-common/components/Article/sub-components/article-header.js b/packages/asc-web-common/components/Article/sub-components/article-header.js index 6a54304bde..29717fbfa0 100644 --- a/packages/asc-web-common/components/Article/sub-components/article-header.js +++ b/packages/asc-web-common/components/Article/sub-components/article-header.js @@ -27,7 +27,9 @@ const ArticleHeader = ({ const isLoadedSetting = isLoaded; const commonSettings = - location.pathname.includes("common") || location.pathname === "/settings"; + (location.pathname.includes("common") || + location.pathname === "/settings") && + !location.pathname.includes("files"); useEffect(() => { if (isLoadedSetting) setIsLoadedArticleHeader(isLoadedSetting); From bcef47efa21c6fe58d660bd2e08d5591e582dc1f Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 20 Apr 2022 18:24:21 +0300 Subject: [PATCH 16/20] =?UTF-8?q?Web:Common:Added=20tenantAlias,=20setTena?= =?UTF-8?q?ntAlias=20=E2=80=8B=E2=80=8Bto=20SettingsStore.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/asc-web-common/store/SettingsStore.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/asc-web-common/store/SettingsStore.js b/packages/asc-web-common/store/SettingsStore.js index 92d11bdb75..c491d8803f 100644 --- a/packages/asc-web-common/store/SettingsStore.js +++ b/packages/asc-web-common/store/SettingsStore.js @@ -33,6 +33,7 @@ class SettingsStore { trustedDomainsType = 0; timezone = "UTC"; timezones = []; + tenantAlias = ""; utcOffset = "00:00:00"; utcHoursOffset = 0; defaultPage = "/"; @@ -221,6 +222,10 @@ class SettingsStore { ) { this.getCurrentCustomSchema(origSettings.nameSchemaId); } + + if (origSettings.tenantAlias) { + this.setTenantAlias(origSettings.tenantAlias); + } }; init = async () => { @@ -454,6 +459,10 @@ class SettingsStore { this.trustedDomains = data.domains; return res; }; + + setTenantAlias = (tenantAlias) => { + this.tenantAlias = tenantAlias; + }; } export default SettingsStore; From d703edba81f48b75818fa7c1c201dc8f0c533868 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 20 Apr 2022 18:26:23 +0300 Subject: [PATCH 17/20] Web:Studio:Added tenantAlias, checkChanges function to PortalRenaming. --- .../settingsCustomization/portal-renaming.js | 67 ++++++++++++++----- 1 file changed, 51 insertions(+), 16 deletions(-) diff --git a/web/ASC.Web.Client/src/components/pages/Settings/categories/common/settingsCustomization/portal-renaming.js b/web/ASC.Web.Client/src/components/pages/Settings/categories/common/settingsCustomization/portal-renaming.js index e2fad305a6..f6a295b4a6 100644 --- a/web/ASC.Web.Client/src/components/pages/Settings/categories/common/settingsCustomization/portal-renaming.js +++ b/web/ASC.Web.Client/src/components/pages/Settings/categories/common/settingsCustomization/portal-renaming.js @@ -28,6 +28,7 @@ const PortalRenaming = (props) => { isLoaded, setIsLoadedPortalRenaming, isLoadedPage, + tenantAlias, } = props; const [isLoadingPortalNameSave, setIsLoadingPortalNameSave] = useState(false); @@ -39,10 +40,19 @@ const PortalRenaming = (props) => { const errorValueFromSessionStorage = getFromSessionStorage("errorValue"); - const [portalName, setPortalName] = useState(portalNameFromSessionStorage); + const [portalName, setPortalName] = useState( + portalNameFromSessionStorage || tenantAlias + ); const [portalNameDefault, setPortalNameDefault] = useState( portalNameDefaultFromSessionStorage || portalName ); + console.log("portalNameFromSessionStorage", portalNameFromSessionStorage); + console.log( + "portalNameDefaultFromSessionStorage", + portalNameDefaultFromSessionStorage + ); + console.log("portalNameDefault", portalNameDefault); + console.log("portalName", portalName); const [showReminder, setShowReminder] = useState(false); const [hasScroll, setHasScroll] = useState(false); @@ -90,22 +100,21 @@ const PortalRenaming = (props) => { if (isLoadedSetting) setIsLoadedPortalRenaming(isLoadedSetting); }, [isLoadedSetting]); - //TODO: Need a method to get the portal name const onSavePortalRename = () => { setIsLoadingPortalNameSave(true); - setPortalRename(portalName) - .then(() => toastr.success(t("SuccessfullySavePortalNameMessage"))) - .catch((error) => { - //TODO: Add translation - setErrorValue("Incorrect account name"); - saveToSessionStorage("errorValue", "Incorrect account name"); - }) - .finally(() => setIsLoadingPortalNameSave(false)); + // setPortalRename(portalName) + // .then(() => toastr.success(t("SuccessfullySavePortalNameMessage"))) + // .catch((error) => { + // //TODO: Add translation + // setErrorValue("Incorrect account name"); + // saveToSessionStorage("errorValue", "Incorrect account name"); + // }) + // .finally(() => setIsLoadingPortalNameSave(false)); setShowReminder(false); - setPortalName(portalName); - setPortalNameDefault(portalName); + // setPortalName(portalName); + //setPortalNameDefault(portalName); saveToSessionStorage("portalName", portalName); saveToSessionStorage("portalNameDefault", portalName); @@ -116,11 +125,15 @@ const PortalRenaming = (props) => { if ( portalNameFromSessionStorage && - !settingIsEqualInitialValue("portalName", portalNameFromSessionStorage) + !settingIsEqualInitialValue(portalNameFromSessionStorage) ) { setPortalName(portalNameDefault); saveToSessionStorage("portalName", ""); + setShowReminder(false); } + + //TODO: delete? + checkChanges(); }; const onValidateInput = (value) => { @@ -142,23 +155,44 @@ const PortalRenaming = (props) => { const settingIsEqualInitialValue = (value) => { const defaultValue = JSON.stringify(portalNameDefault); const currentValue = JSON.stringify(value); + console.log("defaultValue", defaultValue); + console.log("currentValue", currentValue); return defaultValue === currentValue; }; + const checkChanges = () => { + let hasChanged = false; + + const valueFromSessionStorage = getFromSessionStorage("portalName"); + if ( + valueFromSessionStorage && + !settingIsEqualInitialValue(valueFromSessionStorage) + ) { + hasChanged = true; + } + + if (hasChanged !== showReminder) { + setShowReminder(hasChanged); + } + }; + const onChangePortalName = (e) => { const value = e.target.value; - + console.log("value", value); onValidateInput(value); setPortalName(value); - if (settingIsEqualInitialValue("portalName", value)) { + if (settingIsEqualInitialValue(value)) { saveToSessionStorage("portalName", ""); saveToSessionStorage("portalNameDefault", ""); + setShowReminder(false); } else { saveToSessionStorage("portalName", value); setShowReminder(true); } + + checkChanges(); }; const checkInnerWidth = () => { @@ -238,7 +272,7 @@ const PortalRenaming = (props) => { }; export default inject(({ auth, setup, common }) => { - const { theme } = auth.settingsStore; + const { theme, tenantAlias } = auth.settingsStore; const { setPortalRename } = setup; const { isLoaded, setIsLoadedPortalRenaming } = common; return { @@ -246,6 +280,7 @@ export default inject(({ auth, setup, common }) => { setPortalRename, isLoaded, setIsLoadedPortalRenaming, + tenantAlias, }; })( withLoading(withTranslation(["Settings", "Common"])(observer(PortalRenaming))) From 49e50093bcb8225cd7e236d7756e5f54dc233c23 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 20 Apr 2022 18:28:34 +0300 Subject: [PATCH 18/20] Web:Studio:Delete console.log. --- .../settingsCustomization/portal-renaming.js | 31 +++++++------------ 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/web/ASC.Web.Client/src/components/pages/Settings/categories/common/settingsCustomization/portal-renaming.js b/web/ASC.Web.Client/src/components/pages/Settings/categories/common/settingsCustomization/portal-renaming.js index f6a295b4a6..a13ae4e56e 100644 --- a/web/ASC.Web.Client/src/components/pages/Settings/categories/common/settingsCustomization/portal-renaming.js +++ b/web/ASC.Web.Client/src/components/pages/Settings/categories/common/settingsCustomization/portal-renaming.js @@ -46,13 +46,6 @@ const PortalRenaming = (props) => { const [portalNameDefault, setPortalNameDefault] = useState( portalNameDefaultFromSessionStorage || portalName ); - console.log("portalNameFromSessionStorage", portalNameFromSessionStorage); - console.log( - "portalNameDefaultFromSessionStorage", - portalNameDefaultFromSessionStorage - ); - console.log("portalNameDefault", portalNameDefault); - console.log("portalName", portalName); const [showReminder, setShowReminder] = useState(false); const [hasScroll, setHasScroll] = useState(false); @@ -103,18 +96,18 @@ const PortalRenaming = (props) => { const onSavePortalRename = () => { setIsLoadingPortalNameSave(true); - // setPortalRename(portalName) - // .then(() => toastr.success(t("SuccessfullySavePortalNameMessage"))) - // .catch((error) => { - // //TODO: Add translation - // setErrorValue("Incorrect account name"); - // saveToSessionStorage("errorValue", "Incorrect account name"); - // }) - // .finally(() => setIsLoadingPortalNameSave(false)); + setPortalRename(portalName) + .then(() => toastr.success(t("SuccessfullySavePortalNameMessage"))) + .catch((error) => { + //TODO: Add translation + setErrorValue("Incorrect account name"); + saveToSessionStorage("errorValue", "Incorrect account name"); + }) + .finally(() => setIsLoadingPortalNameSave(false)); setShowReminder(false); - // setPortalName(portalName); - //setPortalNameDefault(portalName); + setPortalName(portalName); + setPortalNameDefault(portalName); saveToSessionStorage("portalName", portalName); saveToSessionStorage("portalNameDefault", portalName); @@ -155,8 +148,6 @@ const PortalRenaming = (props) => { const settingIsEqualInitialValue = (value) => { const defaultValue = JSON.stringify(portalNameDefault); const currentValue = JSON.stringify(value); - console.log("defaultValue", defaultValue); - console.log("currentValue", currentValue); return defaultValue === currentValue; }; @@ -178,7 +169,7 @@ const PortalRenaming = (props) => { const onChangePortalName = (e) => { const value = e.target.value; - console.log("value", value); + onValidateInput(value); setPortalName(value); From 03f24dacac39645a2ee4d3b902eb7e2f3ddd3aa6 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 20 Apr 2022 18:29:13 +0300 Subject: [PATCH 19/20] Web:Studio:Fix location.pathname. --- .../src/components/pages/Settings/Layout/Article/Body/index.js | 3 ++- .../components/pages/Settings/Layout/Section/Header/index.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/web/ASC.Web.Client/src/components/pages/Settings/Layout/Article/Body/index.js b/web/ASC.Web.Client/src/components/pages/Settings/Layout/Article/Body/index.js index 12eb133274..b1535a5563 100644 --- a/web/ASC.Web.Client/src/components/pages/Settings/Layout/Article/Body/index.js +++ b/web/ASC.Web.Client/src/components/pages/Settings/Layout/Article/Body/index.js @@ -156,7 +156,8 @@ class ArticleBodyContent extends React.Component { const { isLoadedPage, location } = this.props; const commonSettings = - location.pathname.includes("common") || location.pathname === "/settings"; + location.pathname.includes("common/customization") || + location.pathname === "/settings"; const showLoader = commonSettings ? !isLoadedPage : false; diff --git a/web/ASC.Web.Client/src/components/pages/Settings/Layout/Section/Header/index.js b/web/ASC.Web.Client/src/components/pages/Settings/Layout/Section/Header/index.js index 713e58fbd6..ff17087e34 100644 --- a/web/ASC.Web.Client/src/components/pages/Settings/Layout/Section/Header/index.js +++ b/web/ASC.Web.Client/src/components/pages/Settings/Layout/Section/Header/index.js @@ -251,7 +251,8 @@ class SectionHeaderContent extends React.Component { ]; const commonSettings = - location.pathname.includes("common") || location.pathname === "/settings"; + location.pathname.includes("common/customization") || + location.pathname === "/settings"; const showLoader = commonSettings ? !isLoadedPage : false; return ( From 7a55486b715cd7cdc3ce43a274040a388a1fa1c2 Mon Sep 17 00:00:00 2001 From: gazizova-vlada Date: Wed, 20 Apr 2022 18:29:29 +0300 Subject: [PATCH 20/20] Web:Common:Fix location.pathname. --- .../components/Article/sub-components/article-header.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/asc-web-common/components/Article/sub-components/article-header.js b/packages/asc-web-common/components/Article/sub-components/article-header.js index 6a54304bde..aa7f7c579a 100644 --- a/packages/asc-web-common/components/Article/sub-components/article-header.js +++ b/packages/asc-web-common/components/Article/sub-components/article-header.js @@ -27,7 +27,8 @@ const ArticleHeader = ({ const isLoadedSetting = isLoaded; const commonSettings = - location.pathname.includes("common") || location.pathname === "/settings"; + location.pathname.includes("common/customization") || + location.pathname === "/settings"; useEffect(() => { if (isLoadedSetting) setIsLoadedArticleHeader(isLoadedSetting);