Merge branch 'feature/virtual-rooms-1.2' of github.com:ONLYOFFICE/AppServer into feature/virtual-rooms-1.2

This commit is contained in:
Nikita Gopienko 2022-04-21 10:29:57 +03:00
commit 8aa32c4717
24 changed files with 327 additions and 102 deletions

View File

@ -11,7 +11,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AspNetCore.HealthChecks.Elasticsearch" Version="6.0.1" />
<PackageReference Include="AspNetCore.HealthChecks.Elasticsearch" Version="5.0.1" />
<PackageReference Include="AspNetCore.HealthChecks.Kafka" Version="6.0.1" />
<PackageReference Include="AspNetCore.HealthChecks.MySql" Version="6.0.1" />
<PackageReference Include="AspNetCore.HealthChecks.NpgSql" Version="6.0.1" />

View File

@ -50,24 +50,24 @@ namespace ASC.Api.Core.Core
name: "kafka",
tags: new string[] { "kafka" });
}
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" });
}
}
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;

View File

@ -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
{

View File

@ -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
}

View File

@ -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);

View File

@ -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;

View File

@ -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}

View File

@ -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 (
<StyledLabel
id={id}
style={style}
isDisabled={isDisabled}
isIndeterminate={isIndeterminate}
className={className}
title={title}
>
<HiddenInput
name={name}
type="checkbox"
checked={this.state.checked}
<>
<StyledLabel
id={id}
style={style}
isDisabled={isDisabled}
ref={this.ref}
value={value}
onChange={this.onInputChange}
/>
<RenderCheckboxIcon {...this.props} />
{this.props.label && (
<Text
as="span"
title={title}
isIndeterminate={isIndeterminate}
className={className}
title={title}
>
<HiddenInput
name={name}
type="checkbox"
checked={this.state.checked}
isDisabled={isDisabled}
truncate={truncate}
className="checkbox-text"
>
{label}
</Text>
)}
</StyledLabel>
ref={this.ref}
value={value}
onChange={this.onInputChange}
/>
<RenderCheckboxIcon {...this.props} />
<div className="wrapper">
{this.props.label && (
<Text
as="span"
title={title}
isDisabled={isDisabled}
truncate={truncate}
className="checkbox-text"
>
{label}
</Text>
)}
{helpButton && (
<span className="help-button" onClick={this.onClick}>
{helpButton}
</span>
)}
</div>
</StyledLabel>
</>
);
}
}
@ -137,11 +151,16 @@ Checkbox.propTypes = {
title: PropTypes.string,
/** Disables word wrapping */
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);

View File

@ -3,7 +3,14 @@ import Base from "../themes/base";
const StyledLabel = styled.label`
display: flex;
align-items: center;
${(props) =>
!props.isLogin &&
css`
align-items: "center";
`};
justify-content: ${(props) => props.isLogin && "center"};
position: relative;
margin: 0;
@ -107,11 +114,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 };

View File

@ -77,13 +77,21 @@ StyledButton.defaultProps = { theme: Base };
const GroupMenuItem = ({ item }) => {
const { label, disabled, onClick, iconUrl, title } = item;
return (
<StyledButton
label={label}
title={title || label}
isDisabled={disabled}
onClick={onClick}
icon={<ReactSVG src={iconUrl} className="combo-button_selected-icon" />}
/>
<>
{disabled ? (
<></>
) : (
<StyledButton
label={label}
title={title || label}
isDisabled={disabled}
onClick={onClick}
icon={
<ReactSVG src={iconUrl} className="combo-button_selected-icon" />
}
/>
)}
</>
);
};

View File

@ -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

View File

@ -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) {

View File

@ -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)))
);

View File

@ -419,7 +419,7 @@ const FilesTableRow = (props) => {
);
};
export default withTranslation(["Home", "Common", "VersionBadge"])(
export default withTranslation(["Home", "Common", "VersionBadge", "InfoPanel"])(
withFileActions(
withRouter(withContent(withQuickButtons(withBadges(FilesTableRow))))
)

View File

@ -114,7 +114,7 @@ export default inject(({ settingsStore }) => {
const { getIcon } = settingsStore;
return { getIcon };
})(
withTranslation(["Home", "VersionBadge"])(
withTranslation(["Home", "VersionBadge", "InfoPanel"])(
withFileActions(
withRouter(withBadges(withQuickButtons(observer(FileTile))))
)

View File

@ -151,7 +151,7 @@ class ArticleMainButtonContent extends React.Component {
return isAdmin ? (
<>
{isMobileArticle && !isArticleLoading ? (
{isMobileArticle ? (
<MobileView
labelProps={t("OtherOperations")}
actionOptions={menuModel}

View File

@ -220,7 +220,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<DarkThemeSettings>().Theme;
return result;
}
[Read("email")]
@ -720,13 +724,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)
{
@ -1493,6 +1497,36 @@ namespace ASC.Employee.Core.Controllers
return users.Select(EmployeeWraperFullHelper.GetFull);
}
[Read("theme")]
public DarkThemeSettings GetTheme()
{
return SettingsManager.LoadForCurrentUser<DarkThemeSettings>();
}
[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<EmployeeWraperFull> ResendUserInvitesFromBody([FromBody] UpdateMembersModel model)

View File

@ -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; }
}

View File

@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M15 1V3V5C9.47715 5 5 9.47715 5 15H3H1C1 7.26801 7.26801 1 15 1ZM7 15C7 10.5817 10.5817 7 15 7V13C15 14.1046 14.1046 15 13 15H7Z" fill="#657077"/>
</svg>

After

Width:  |  Height:  |  Size: 299 B

View File

@ -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;

View File

@ -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 (
<StyledContainer isHeaderVisible={isHeaderVisible}>

View File

@ -28,6 +28,7 @@ const PortalRenaming = (props) => {
isLoaded,
setIsLoadedPortalRenaming,
isLoadedPage,
tenantAlias,
} = props;
const [isLoadingPortalNameSave, setIsLoadingPortalNameSave] = useState(false);
@ -39,7 +40,9 @@ const PortalRenaming = (props) => {
const errorValueFromSessionStorage = getFromSessionStorage("errorValue");
const [portalName, setPortalName] = useState(portalNameFromSessionStorage);
const [portalName, setPortalName] = useState(
portalNameFromSessionStorage || tenantAlias
);
const [portalNameDefault, setPortalNameDefault] = useState(
portalNameDefaultFromSessionStorage || portalName
);
@ -90,7 +93,6 @@ const PortalRenaming = (props) => {
if (isLoadedSetting) setIsLoadedPortalRenaming(isLoadedSetting);
}, [isLoadedSetting]);
//TODO: Need a method to get the portal name
const onSavePortalRename = () => {
setIsLoadingPortalNameSave(true);
@ -116,11 +118,15 @@ const PortalRenaming = (props) => {
if (
portalNameFromSessionStorage &&
!settingIsEqualInitialValue("portalName", portalNameFromSessionStorage)
!settingIsEqualInitialValue(portalNameFromSessionStorage)
) {
setPortalName(portalNameDefault);
saveToSessionStorage("portalName", "");
setShowReminder(false);
}
//TODO: delete?
checkChanges();
};
const onValidateInput = (value) => {
@ -145,6 +151,22 @@ const PortalRenaming = (props) => {
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;
@ -152,13 +174,16 @@ const PortalRenaming = (props) => {
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 +263,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 +271,7 @@ export default inject(({ auth, setup, common }) => {
setPortalRename,
isLoaded,
setIsLoadedPortalRenaming,
tenantAlias,
};
})(
withLoading(withTranslation(["Settings", "Common"])(observer(PortalRenaming)))

View File

@ -410,7 +410,6 @@ const Form = (props) => {
<form className="auth-form-container">
<FieldContainer
className="form-field"
isVertical={true}
labelVisible={false}
hasError={isEmailErrorShow}
@ -438,7 +437,6 @@ const Form = (props) => {
/>
</FieldContainer>
<FieldContainer
className="form-field"
isVertical={true}
labelVisible={false}
hasError={!passwordValid}
@ -465,19 +463,24 @@ const Form = (props) => {
<div className="login-forgot-wrapper">
<div className="login-checkbox-wrapper">
<Checkbox
className="login-checkbox"
isChecked={isChecked}
onChange={onChangeCheckbox}
label={<Text fontSize="13px">{t("Remember")}</Text>}
/>
<HelpButton
className="login-tooltip"
helpButtonHeaderContent={t("CookieSettingsTitle")}
tooltipContent={
<Text fontSize="12px">{t("RememberHelper")}</Text>
}
/>
<div className="remember-wrapper">
<Checkbox
className="login-checkbox"
isLogin={true}
isChecked={isChecked}
onChange={onChangeCheckbox}
label={t("Remember")}
helpButton={
<HelpButton
helpButtonHeaderContent={t("CookieSettingsTitle")}
tooltipContent={
<Text fontSize="12px">{t("RememberHelper")}</Text>
}
/>
}
/>
</div>
<Link
fontSize="13px"
color="#316DAA"

View File

@ -18,9 +18,11 @@ export const LoginContainer = styled.div`
margin: 56px auto 0 auto;
max-width: 960px;
.login-tooltip {
padding-left: 4px;
display: inline-block;
.remember-wrapper {
max-width: 142px;
display: flex;
flex-direction: row;
align-items: center;
}
.buttonWrapper {
@ -125,22 +127,21 @@ export const LoginContainer = styled.div`
width: 100%;
}
.form-field {
height: 48px;
}
.login-forgot-wrapper {
height: 36px;
padding: 14px 0;
.login-checkbox-wrapper {
display: flex;
//align-items: center;
.login-checkbox {
float: left;
span {
font-size: 12px;
}
display: flex;
}
.remember-helper-wrapper {
display: flex;
gap: 4px;
}
}