Merge branch 'develop' into feature/win-docker

This commit is contained in:
Ilya Oleshko 2022-11-23 13:19:28 +03:00
commit 5218123f56
14 changed files with 157 additions and 84 deletions

View File

@ -87,11 +87,6 @@ public static class BaseDbContextExtension
services.AddPooledDbContextFactory<T>(OptionsAction);
}
public static void AddBaseDbContext<T>(this IServiceCollection services) where T : DbContext
{
services.AddDbContext<T>(OptionsAction);
}
public static T AddOrUpdate<T, TContext>(this TContext b, Expression<Func<TContext, DbSet<T>>> expressionDbSet, T entity) where T : BaseEntity where TContext : DbContext
{
var dbSet = expressionDbSet.Compile().Invoke(b);

View File

@ -11,14 +11,18 @@ module.exports = (socket, next) => {
const token = req?.headers?.authorization;
if (!cookie && !token) {
const err = new Error("Authentication error (not token or cookie)");
logger.error(err);
socket.disconnect("unauthorized");
next(new Error("Authentication error"));
next(err);
return;
}
if (token) {
if (!check(token)) {
next(new Error("Authentication error"));
const err = new Error("Authentication error (token check)");
logger.error(err);
next(err);
} else {
session.system = true;
session.save();
@ -33,7 +37,9 @@ module.exports = (socket, next) => {
Authorization: cookie,
};
const basePath = portalManager(req).replace(/\/$/g, "");
const basePath = portalManager(req)?.replace(/\/$/g, "");
logger.info(`API basePath='${basePath}' Authorization='${cookie}'`);
const getUser = () => {
return request({
@ -55,14 +61,15 @@ module.exports = (socket, next) => {
return Promise.all([getUser(), getPortal()])
.then(([user, portal]) => {
logger.info("Get account info", { user, portal });
session.user = user;
session.portal = portal;
session.save();
next();
})
.catch((err) => {
logger.error(err);
logger.error("Error of getting account info", err);
socket.disconnect("Unauthorized");
next(new Error("Authentication error"));
next(err);
});
};

View File

@ -1,7 +1,7 @@
const conf = require("../config");
const portalInternalUrl = conf.get("core")["base-domain"] === "localhost" ? "http://localhost" : "";
//const conf = require("../config");
//const portalInternalUrl = conf.get("core")["base-domain"] === "localhost" ? "http://localhost" : ""; //Do not use base-domain for portalInternalUrl
module.exports = (req) => {
if (portalInternalUrl) return portalInternalUrl;
//if (portalInternalUrl) return portalInternalUrl; //TODO: Fix internal api url setup after external api domain complete
const xRewriterUrlInternalHeader = "x-rewriter-url-internal";
if (req.headers && req.headers[xRewriterUrlInternalHeader]) {

View File

@ -1,3 +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="M8 16C12.4183 16 16 12.4183 16 8C16 3.58172 12.4183 0 8 0C3.58172 0 0 3.58172 0 8C0 12.4183 3.58172 16 8 16ZM5.92946 11.3447C6.38262 11.7704 7.11827 11.7704 7.57165 11.3447L12.705 6.52487C13.5659 5.66404 12.5449 4.32781 11.4764 5.39665L7.04492 9.57739C6.93026 9.68463 6.74449 9.68463 6.63005 9.57739L4.70054 7.7408C3.54497 6.58529 2.37389 8.00675 3.38509 8.95572L5.92946 11.3447Z" fill="#657077"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.0005 8C14.0005 7.75799 13.9862 7.51933 13.9583 7.28482L15.6364 5.60676C15.873 6.36243 16.0005 7.16632 16.0005 8C16.0005 12.4183 12.4188 16 8.00049 16C3.58221 16 0.000488281 12.4183 0.000488281 8C0.000488281 3.58172 3.58221 0 8.00049 0C9.37555 0 10.6696 0.34692 11.7998 0.95801L10.301 2.45685C9.59253 2.16249 8.81549 2 8.00049 2C4.68678 2 2.00049 4.68629 2.00049 8C2.00049 11.3137 4.68678 14 8.00049 14C11.3142 14 14.0005 11.3137 14.0005 8ZM14.2076 4.20678L7.7076 10.7068C7.31708 11.0973 6.68391 11.0973 6.29339 10.7068L3.29338 7.70677L4.7076 6.29256L7.0005 8.58546L12.7934 2.79257L14.2076 4.20678Z" fill="#657077"/>
</svg>

Before

Width:  |  Height:  |  Size: 550 B

After

Width:  |  Height:  |  Size: 772 B

View File

@ -14,21 +14,23 @@ const StyledLink = styled(Link)`
color: #316daa;
`;
const ConfirmEmailBar = ({ t, onClick, onClose, onLoad }) => {
const ConfirmEmailBar = ({ t, tReady, onClick, onClose, onLoad }) => {
return (
<SnackBar
headerText={t("ConfirmEmailHeader")}
text={
<>
{t("ConfirmEmailDescription")}{" "}
<StyledLink onClick={onClick}>{t("RequestActivation")}</StyledLink>
</>
}
isCampaigns={false}
opacity={1}
onLoad={onLoad}
clickAction={onClose}
/>
tReady && (
<SnackBar
headerText={t("ConfirmEmailHeader")}
text={
<>
{t("ConfirmEmailDescription")}{" "}
<StyledLink onClick={onClick}>{t("RequestActivation")}</StyledLink>
</>
}
isCampaigns={false}
opacity={1}
onLoad={onLoad}
clickAction={onClose}
/>
)
);
};

View File

@ -16,6 +16,7 @@ const StyledLink = styled(Link)`
const QuotasBar = ({
t,
tReady,
isRoomQuota,
currentValue,
maxValue,
@ -57,24 +58,28 @@ const QuotasBar = ({
),
};
return isRoomQuota ? (
<SnackBar
headerText={roomQuota.header}
text={roomQuota.description}
isCampaigns={false}
opacity={1}
onLoad={onLoad}
clickAction={onCloseAction}
/>
return tReady ? (
isRoomQuota ? (
<SnackBar
headerText={roomQuota.header}
text={roomQuota.description}
isCampaigns={false}
opacity={1}
onLoad={onLoad}
clickAction={onCloseAction}
/>
) : (
<SnackBar
headerText={storageQuota.header}
text={storageQuota.description}
isCampaigns={false}
opacity={1}
onLoad={onLoad}
clickAction={onCloseAction}
/>
)
) : (
<SnackBar
headerText={storageQuota.header}
text={storageQuota.description}
isCampaigns={false}
opacity={1}
onLoad={onLoad}
clickAction={onCloseAction}
/>
<></>
);
};

View File

@ -11,8 +11,8 @@ const StyledContainer = styled.div`
${isMobileOnly &&
css`
width: calc(100% + 8px);
max-width: calc(100% + 8px);
width: calc(100% + 16px);
max-width: calc(100% + 16px);
margin-right: -16px;
margin-top: 48px;

View File

@ -138,7 +138,12 @@ const Article = ({
)}
{isAvailableArticlePaymentAlert &&
(isFreeTariff || isGracePeriod) &&
showText && <ArticlePaymentAlert isFreeTariff={isFreeTariff} />}
showText && (
<ArticlePaymentAlert
isFreeTariff={isFreeTariff}
toggleArticleOpen={toggleArticleOpen}
/>
)}
</SubArticleBody>
</StyledArticle>
{articleOpen && (isMobileOnly || window.innerWidth <= 375) && (

View File

@ -27,6 +27,7 @@ const ArticlePaymentAlert = ({
currencySymbol,
setPortalPaymentQuotas,
currentTariffPlanTitle,
toggleArticleOpen,
}) => {
const { t, ready } = useTranslation("Payments");
@ -40,6 +41,7 @@ const ArticlePaymentAlert = ({
"/payments/portal-payments"
);
history.push(paymentPageUrl);
toggleArticleOpen();
};
const isShowLoader = !ready;

View File

@ -1,6 +1,7 @@
import io from "socket.io-client";
let client = null;
let callbacks = [];
class SocketIOHelper {
socketUrl = null;
@ -21,7 +22,15 @@ class SocketIOHelper {
path: url,
});
client.on("connect", () => console.log("socket is connected"));
client.on("connect", () => {
console.log("socket is connected");
if (callbacks?.length > 0) {
callbacks.forEach(({ eventName, callback }) =>
client.on(eventName, callback)
);
callbacks = [];
}
});
client.on("connect_error", (err) =>
console.log("socket connect error", err)
);
@ -49,7 +58,10 @@ class SocketIOHelper {
};
on = (eventName, callback) => {
if (!this.isEnabled) return;
if (!this.isEnabled) {
callbacks.push({ eventName, callback });
return;
}
if (!client.connected) {
client.on("connect", () => {

View File

@ -2,38 +2,37 @@ import React from "react";
import PropTypes from "prop-types";
import styled, { keyframes } from "styled-components";
export const keyFrameBlue = keyframes`
0% { top:120px; background: #de7a59; }
10% { top:120px; background: #F2CBBF; }
14% { background: #fff; top: 120px; }
15% { background: #fff; top: 0; }
20% { background: #E6E4E4; }
30% { background: #D2D2D2; }
40% { top: 120px; }
100% { top: 120px; background: #de7a59; }
export const keyFrameBlue = (props) => keyframes`
0% { background: #de7a59; top: 120px; }
10% { background: ${props.colorStep_1}; top: 120px; }
14% { background: ${props.colorStep_2}; top: 120px; }
15% { background: ${props.colorStep_2}; top: 0; }
20% { background: ${props.colorStep_3}; }
30% { background: ${props.colorStep_4}; }
40% { top: 120px; }
100% { background: #de7a59; top: 120px; }
`;
export const keyFrameRed = keyframes`
0% { top:100px; background: #55bce6; opacity: 1; }
10% { top:100px; background: #BFE8F8; opacity: 1; }
14% { background: #fff; top: 100px; opacity: 1; }
15% { background: #fff; top: 0; opacity: 1; }
20% { background: #ffffff; top: 0; opacity: 0; }
25% { background: #ffffff; top: 0; opacity: 0; }
45% { background: #EFEFEF; top: 0; opacity: 0,2; }
100% { top: 100px; background: #55bce6; }
export const keyFrameRed = (props) => keyframes`
0% { background: #55bce6; top: 100px; opacity: 1; }
10% { background: ${props.colorStep_1}; top: 100px; opacity: 1; }
14% { background: ${props.colorStep_2}; top: 100px; opacity: 1; }
15% { background: ${props.colorStep_2}; top: 0; opacity: 1; }
20% { background: ${props.colorStep_2}; top: 0; opacity: 0; }
45% { background: ${props.colorStep_3}; top: 0; }
100% { background: #55bce6; top: 100px; }
`;
export const keyFrameGreen = keyframes`
0% { top:110px; background: #a1cb5c; opacity: 1; }
10% { top:110px; background: #CBE0AC; opacity: 1; }
14% { background: #fff; top: 110px; opacity: 1; }
15% { background: #fff; top: 0; opacity: 1; }
20% { background: #ffffff; top: 0; opacity: 0; }
25% { background: #EFEFEF; top: 0; opacity: 1; }
30% { background: #E6E4E4; }
70% { top: 110px; }
100% { top: 110px; background: #a1cb5c; }
export const keyFrameGreen = (props) => keyframes`
0% { background: #a1cb5c; top: 110px; opacity: 1; }
10% { background: ${props.colorStep_1}; top: 110px; opacity: 1; }
14% { background: ${props.colorStep_2}; top: 110px; opacity: 1; }
15% { background: ${props.colorStep_2}; top: 0; opacity: 1; }
20% { background: ${props.colorStep_2}; top: 0; opacity: 0; }
25% { background: ${props.colorStep_3}; top: 0; opacity: 1; }
30% { background: ${props.colorStep_4}; }
70% { top: 110px; }
100% { background: #a1cb5c; top: 110px; }
`;
const Romb = styled.div`
@ -63,9 +62,9 @@ const Romb = styled.div`
(props.color === "green" && "2")};
animation: ${(props) =>
(props.color === "blue" && keyFrameBlue) ||
(props.color === "red" && keyFrameRed) ||
(props.color === "green" && keyFrameGreen)}
(props.color === "blue" && keyFrameBlue(props.theme.rombsLoader.blue)) ||
(props.color === "red" && keyFrameRed(props.theme.rombsLoader.red)) ||
(props.color === "green" && keyFrameGreen(props.theme.rombsLoader.green))}
2s ease-in-out 0s infinite;
`;

View File

@ -1498,6 +1498,26 @@ const Base = {
borderRadius: "50%",
},
rombsLoader: {
blue: {
colorStep_1: "#F2CBBF",
colorStep_2: "#fff",
colorStep_3: "#E6E4E4",
colorStep_4: "#D2D2D2",
},
red: {
colorStep_1: "#BFE8F8",
colorStep_2: "#fff",
colorStep_3: "#EFEFEF",
},
green: {
colorStep_1: "#CBE0AC",
colorStep_2: "#fff",
colorStep_3: "#EFEFEF",
colorStep_4: "#E6E4E4",
},
},
dialogLoader: {
borderBottom: "1px solid rgb(222, 226, 230)",
},

View File

@ -1488,7 +1488,26 @@ const Dark = {
marginRight: "2px",
borderRadius: "50%",
},
rombsLoader: {
blue: {
colorStep_1: "#333",
colorStep_2: "#333",
colorStep_3: "#323032",
colorStep_4: "#323032",
},
red: {
colorStep_1: "#333",
colorStep_2: "#333",
colorStep_3: "#323032",
colorStep_4: "#323032",
},
green: {
colorStep_1: "#333",
colorStep_2: "#333",
colorStep_3: "#323032",
colorStep_4: "#323032",
},
},
dialogLoader: {
borderBottom: "1px solid #292929",
},

View File

@ -26,7 +26,7 @@
namespace ASC.Web.Files;
[Scope]
[Scope(Additional = typeof(FilesSpaceUsageStatExtension))]
public class FilesSpaceUsageStatManager : SpaceUsageStatManager, IUserSpaceUsage
{
private readonly IDbContextFactory<FilesDbContext> _dbContextFactory;
@ -139,5 +139,12 @@ public class FilesSpaceUsageStatManager : SpaceUsageStatManager, IUserSpaceUsage
new TenantQuotaRow { Tenant = TenantId, Path = $"/{FileConstant.ModuleId}/", Counter = size, Tag = WebItemManager.DocumentsProductID.ToString(), UserId = userId, LastModified = DateTime.UtcNow },
false);
}
}
}
public static class FilesSpaceUsageStatExtension
{
public static void Register(DIHelper services)
{
services.ServiceCollection.AddBaseDbContextPool<FilesDbContext>();
}
}