working RoomInfoStore

This commit is contained in:
mushka 2022-02-09 21:08:22 +03:00
parent ff3c55e892
commit 82c1c47be6
13 changed files with 696 additions and 654 deletions

View File

@ -1,61 +1,61 @@
{
"folders": [
{
"name": "✨ appserver",
"path": "."
"folders": [
{
"name": "✨ appserver",
"path": "."
},
{
"name": "📦 @appserver/common",
"path": "packages\\asc-web-common"
},
{
"name": "🚀 @appserver/files",
"path": "products\\ASC.Files\\Client"
},
{
"name": "📦 @appserver/components",
"path": "packages\\asc-web-components"
},
{
"name": "🚀 @appserver/people",
"path": "products\\ASC.People\\Client"
},
{
"name": "🚀 @appserver/crm",
"path": "products\\ASC.Crm\\Client"
},
{
"name": "🚀 @appserver/projects",
"path": "products\\ASC.Projects\\Client"
},
{
"name": "🚀 @appserver/mail",
"path": "products\\ASC.Mail\\Client"
},
{
"name": "🚀 @appserver/calendar",
"path": "products\\ASC.Calendar\\Client"
},
{
"name": "🚀 @appserver/studio",
"path": "web\\ASC.Web.Client"
},
{
"name": "🚀 @appserver/login",
"path": "web\\ASC.Web.Login"
},
{
"name": "🚀 @appserver/editor",
"path": "web\\ASC.Web.Editor"
}
],
"settings": {
"window.zoomLevel": 0,
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"liveServer.settings.multiRootWorkspaceName": "✨ appserver"
},
{
"name": "📦 @appserver/common",
"path": "packages\\asc-web-common"
},
{
"name": "📦 @appserver/components",
"path": "packages\\asc-web-components"
},
{
"name": "🚀 @appserver/files",
"path": "products\\ASC.Files\\Client"
},
{
"name": "🚀 @appserver/people",
"path": "products\\ASC.People\\Client"
},
{
"name": "🚀 @appserver/crm",
"path": "products\\ASC.Crm\\Client"
},
{
"name": "🚀 @appserver/projects",
"path": "products\\ASC.Projects\\Client"
},
{
"name": "🚀 @appserver/mail",
"path": "products\\ASC.Mail\\Client"
},
{
"name": "🚀 @appserver/calendar",
"path": "products\\ASC.Calendar\\Client"
},
{
"name": "🚀 @appserver/studio",
"path": "web\\ASC.Web.Client"
},
{
"name": "🚀 @appserver/login",
"path": "web\\ASC.Web.Login"
},
{
"name": "🚀 @appserver/editor",
"path": "web\\ASC.Web.Editor"
"extensions": {
"recommendations": ["folke.vscode-monorepo-workspace"]
}
],
"settings": {
"window.zoomLevel": 0,
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"liveServer.settings.multiRootWorkspaceName": "✨ appserver"
},
"extensions": {
"recommendations": ["folke.vscode-monorepo-workspace"]
}
}

View File

@ -611,6 +611,8 @@ PageLayout.SectionHeader = SectionHeader;
PageLayout.SectionFilter = SectionFilter;
PageLayout.SectionBody = SectionBody;
PageLayout.SectionPaging = SectionPaging;
PageLayout.RoomInfoHeader = RoomInfoHeader;
PageLayout.RoomInfoBody = RoomInfoBody;
export default inject(({ auth }) => {
const { isLoaded, settingsStore } = auth;

View File

@ -1,16 +1,22 @@
import { inject, observer } from "mobx-react";
import React from "react";
const SubRoomInfoBody = ({ children }) => {
console.log("SRIB children - ", children);
const SubRoomInfoBody = ({ children, isVisible }) => {
console.log("Body children - ", children);
return (
<div>
<p>Room Info Is {isVisible ? "Visible" : "Hidden"}</p>
<div>ROOM INFO BODY</div>
<div>Children - {children}</div>
</div>
);
};
export default inject(() => {
return {};
export default inject(({ roomInfoStore }) => {
let isVisible = false;
if (roomInfoStore) isVisible = roomInfoStore.isVisible;
return {
isVisible,
};
})(observer(SubRoomInfoBody));

View File

@ -2,7 +2,7 @@ import { inject, observer } from "mobx-react";
import React from "react";
const SubRoomInfoHeader = ({ children }) => {
console.log("SRIH children - ", { children });
console.log("Header children - ", { children });
return (
<div>
<div>ROOM INFO HEADER</div>

View File

@ -1,8 +1,10 @@
import { observer } from "mobx-react";
import { inject, observer } from "mobx-react";
import React from "react";
import styled from "styled-components";
const RoomInfo = ({ children }) => {
const RoomInfo = ({ children, isVisible }) => {
if (!isVisible) return null;
const StyledRoomInfo = styled.div`
height: 100%;
width: 400px;
@ -14,4 +16,10 @@ const RoomInfo = ({ children }) => {
return <StyledRoomInfo>{children}</StyledRoomInfo>;
};
export default observer(RoomInfo);
export default inject(({ roomInfoStore }) => {
let isVisible = false;
if (roomInfoStore) isVisible = roomInfoStore.isVisible;
return {
isVisible,
};
})(RoomInfo);

View File

@ -6,10 +6,10 @@ export const ARTICLE_PINNED_KEY = "asc_article_pinned_key";
* @readonly
*/
export const EmployeeActivationStatus = Object.freeze({
NotActivated: 0,
Activated: 1,
Pending: 2,
AutoGenerated: 4,
NotActivated: 0,
Activated: 1,
Pending: 2,
AutoGenerated: 4,
});
/**
@ -17,8 +17,8 @@ export const EmployeeActivationStatus = Object.freeze({
* @readonly
*/
export const EmployeeStatus = Object.freeze({
Active: 1,
Disabled: 2,
Active: 1,
Disabled: 2,
});
/**
@ -26,8 +26,8 @@ export const EmployeeStatus = Object.freeze({
* @readonly
*/
export const EmployeeType = Object.freeze({
User: 1,
Guest: 2,
User: 1,
Guest: 2,
});
/**
@ -35,18 +35,18 @@ export const EmployeeType = Object.freeze({
* @readonly
*/
export const FilterType = Object.freeze({
None: 0,
FilesOnly: 1,
FoldersOnly: 2,
DocumentsOnly: 3,
PresentationsOnly: 4,
SpreadsheetsOnly: 5,
ImagesOnly: 7,
ByUser: 8,
ByDepartment: 9,
ArchiveOnly: 10,
ByExtension: 11,
MediaOnly: 12,
None: 0,
FilesOnly: 1,
FoldersOnly: 2,
DocumentsOnly: 3,
PresentationsOnly: 4,
SpreadsheetsOnly: 5,
ImagesOnly: 7,
ByUser: 8,
ByDepartment: 9,
ArchiveOnly: 10,
ByExtension: 11,
MediaOnly: 12,
});
/**
@ -54,14 +54,14 @@ export const FilterType = Object.freeze({
* @readonly
*/
export const FileType = Object.freeze({
Unknown: 0,
Archive: 1,
Video: 2,
Audio: 3,
Image: 4,
Spreadsheet: 5,
Presentation: 6,
Document: 7,
Unknown: 0,
Archive: 1,
Video: 2,
Audio: 3,
Image: 4,
Spreadsheet: 5,
Presentation: 6,
Document: 7,
});
/**
@ -69,8 +69,8 @@ export const FileType = Object.freeze({
* @readonly
*/
export const FileAction = Object.freeze({
Create: 0,
Rename: 1,
Create: 0,
Rename: 1,
});
/**
@ -78,68 +78,68 @@ export const FileAction = Object.freeze({
* @readonly
*/
export const FolderType = Object.freeze({
DEFAULT: 0,
COMMON: 1,
BUNCH: 2,
TRASH: 3,
USER: 5,
SHARE: 6,
Projects: 8,
Favorites: 10,
Recent: 11,
Templates: 12,
Privacy: 13,
DEFAULT: 0,
COMMON: 1,
BUNCH: 2,
TRASH: 3,
USER: 5,
SHARE: 6,
Projects: 8,
Favorites: 10,
Recent: 11,
Templates: 12,
Privacy: 13,
});
export const ShareAccessRights = Object.freeze({
None: 0,
FullAccess: 1,
ReadOnly: 2,
DenyAccess: 3,
Varies: 4,
Review: 5,
Comment: 6,
FormFilling: 7,
CustomFilter: 8,
None: 0,
FullAccess: 1,
ReadOnly: 2,
DenyAccess: 3,
Varies: 4,
Review: 5,
Comment: 6,
FormFilling: 7,
CustomFilter: 8,
});
export const ConflictResolveType = Object.freeze({
Skip: 0,
Overwrite: 1,
Duplicate: 2,
Skip: 0,
Overwrite: 1,
Duplicate: 2,
});
export const providersData = Object.freeze({
google: {
label: "google",
icon: "/static/images/share.google.react.svg",
},
facebook: {
label: "facebook",
icon: "/static/images/share.facebook.react.svg",
},
twitter: {
label: "twitter",
icon: "/static/images/share.twitter.react.svg",
iconOptions: { color: "#2AA3EF" },
},
linkedin: {
label: "linkedin",
icon: "/static/images/share.linkedin.react.svg",
},
google: {
label: "google",
icon: "/static/images/share.google.react.svg",
},
facebook: {
label: "facebook",
icon: "/static/images/share.facebook.react.svg",
},
twitter: {
label: "twitter",
icon: "/static/images/share.twitter.react.svg",
iconOptions: { color: "#2AA3EF" },
},
linkedin: {
label: "linkedin",
icon: "/static/images/share.linkedin.react.svg",
},
});
export const LoaderStyle = {
title: "",
width: "100%",
height: "32",
backgroundColor: "#000000",
foregroundColor: "#000000",
backgroundOpacity: 0.1,
foregroundOpacity: 0.15,
borderRadius: "3",
radius: "3",
speed: 2,
animate: true,
title: "",
width: "100%",
height: "32",
backgroundColor: "#000000",
foregroundColor: "#000000",
backgroundOpacity: 0.1,
foregroundOpacity: 0.15,
borderRadius: "3",
radius: "3",
speed: 2,
animate: true,
};
import config from "./AppServerConfig";
@ -151,9 +151,9 @@ export const AppServerConfig = config;
* @readonly
*/
export const TenantTrustedDomainsType = Object.freeze({
None: 0,
Custom: 1,
All: 2,
None: 0,
Custom: 1,
All: 2,
});
export const PasswordLimitSpecialCharacters = "!@#$%^&*";

View File

@ -8,352 +8,357 @@ import { version } from "../package.json";
const { proxyURL } = AppServerConfig;
class SettingsStore {
isLoading = false;
isLoaded = false;
isLoading = false;
isLoaded = false;
currentProductId = "";
culture = "en-US";
cultures = [];
trustedDomains = [];
trustedDomainsType = 0;
trustedDomains = [];
timezone = "UTC";
timezones = [];
utcOffset = "00:00:00";
utcHoursOffset = 0;
defaultPage = "/";
homepage = "";
datePattern = "M/d/yyyy";
datePatternJQ = "00/00/0000";
dateTimePattern = "dddd, MMMM d, yyyy h:mm:ss tt";
datepicker = {
datePattern: "mm/dd/yy",
dateTimePattern: "DD, mm dd, yy h:mm:ss tt",
timePattern: "h:mm tt",
};
organizationName = "ONLYOFFICE";
greetingSettings = "Web Office Applications";
enableAdmMess = false;
enabledJoin = false;
urlLicense = "https://gnu.org/licenses/gpl-3.0.html";
urlSupport = "https://helpdesk.onlyoffice.com/";
logoUrl = combineUrl(proxyURL, "/static/images/nav.logo.opened.react.svg");
customNames = {
id: "Common",
userCaption: "User",
usersCaption: "Users",
groupCaption: "Group",
groupsCaption: "Groups",
userPostCaption: "Title",
regDateCaption: "Registration Date",
groupHeadCaption: "Head",
guestCaption: "Guest",
guestsCaption: "Guests",
};
isDesktopClient = window["AscDesktopEditor"] !== undefined;
//isDesktopEncryption: desktopEncryption;
isEncryptionSupport = false;
encryptionKeys = null;
currentProductId = "";
culture = "en-US";
cultures = [];
trustedDomains = [];
trustedDomainsType = 0;
trustedDomains = [];
timezone = "UTC";
timezones = [];
utcOffset = "00:00:00";
utcHoursOffset = 0;
defaultPage = "/";
homepage = "";
datePattern = "M/d/yyyy";
datePatternJQ = "00/00/0000";
dateTimePattern = "dddd, MMMM d, yyyy h:mm:ss tt";
datepicker = {
datePattern: "mm/dd/yy",
dateTimePattern: "DD, mm dd, yy h:mm:ss tt",
timePattern: "h:mm tt",
};
organizationName = "ONLYOFFICE";
greetingSettings = "Web Office Applications";
enableAdmMess = false;
enabledJoin = false;
urlLicense = "https://gnu.org/licenses/gpl-3.0.html";
urlSupport = "https://helpdesk.onlyoffice.com/";
logoUrl = combineUrl(proxyURL, "/static/images/nav.logo.opened.react.svg");
customNames = {
id: "Common",
userCaption: "User",
usersCaption: "Users",
groupCaption: "Group",
groupsCaption: "Groups",
userPostCaption: "Title",
regDateCaption: "Registration Date",
groupHeadCaption: "Head",
guestCaption: "Guest",
guestsCaption: "Guests",
};
isDesktopClient = window["AscDesktopEditor"] !== undefined;
//isDesktopEncryption: desktopEncryption;
isEncryptionSupport = false;
encryptionKeys = null;
personal = false;
personal = false;
isHeaderVisible = false;
isTabletView = false;
isArticlePinned =
localStorage.getItem(ARTICLE_PINNED_KEY) === "true" || false;
isArticleVisible = false;
isBackdropVisible = false;
isHeaderVisible = false;
isTabletView = false;
isArticlePinned =
localStorage.getItem(ARTICLE_PINNED_KEY) === "true" || false;
isArticleVisible = false;
isBackdropVisible = false;
isArticleVisibleOnUnpin = false;
isArticleVisibleOnUnpin = false;
hashSettings = null;
title = "";
ownerId = null;
nameSchemaId = null;
owner = {};
wizardToken = null;
passwordSettings = null;
hasShortenService = false;
hashSettings = null;
title = "";
ownerId = null;
nameSchemaId = null;
owner = {};
wizardToken = null;
passwordSettings = null;
hasShortenService = false;
customSchemaList = [];
firebase = {
apiKey: "",
authDomain: "",
projectId: "",
storageBucket: "",
messagingSenderId: "",
appId: "",
measurementId: "",
};
version = "";
buildVersionInfo = {
appServer: version,
documentServer: "6.4.1",
};
debugInfo = false;
customSchemaList = [];
firebase = {
apiKey: "",
authDomain: "",
projectId: "",
storageBucket: "",
messagingSenderId: "",
appId: "",
measurementId: "",
};
version = "";
buildVersionInfo = {
appServer: version,
documentServer: "6.4.1",
};
debugInfo = false;
userFormValidation = /^[\p{L}\p{M}'\-]+$/gu;
folderFormValidation = new RegExp('[*+:"<>?|\\\\/]', "gim");
userFormValidation = /^[\p{L}\p{M}'\-]+$/gu;
folderFormValidation = new RegExp('[*+:"<>?|\\\\/]', "gim");
constructor() {
makeAutoObservable(this);
}
get urlAuthKeys() {
const splitted = this.culture.split("-");
const lang = splitted.length > 0 ? splitted[0] : "en";
return `https://helpcenter.onlyoffice.com/${lang}/installation/groups-authorization-keys.aspx`;
}
get wizardCompleted() {
return this.isLoaded && !this.wizardToken;
}
get helpUrlCommonSettings() {
const substring = this.culture.substring(0, this.culture.indexOf("-"));
const lang = substring.length > 0 ? substring : "en";
return `https://helpcenter.onlyoffice.com/${lang}/administration/configuration.aspx#CustomizingPortal_block`;
}
setIsArticleVisible = (visible) => {
this.isArticleVisible = this.isArticlePinned ? true : visible;
};
setIsBackdropVisible = (visible) => {
this.isBackdropVisible = visible;
};
hideArticle = () => {
this.setIsArticleVisible(false);
this.setIsBackdropVisible(false);
};
setValue = (key, value) => {
this[key] = value;
};
setDefaultPage = (defaultPage) => {
this.defaultPage = defaultPage;
};
getSettings = async () => {
const newSettings = await api.settings.getSettings();
if (window["AscDesktopEditor"] !== undefined || this.personal) {
const dp = combineUrl(proxyURL, "/products/files/");
this.setDefaultPage(dp);
constructor() {
makeAutoObservable(this);
}
Object.keys(newSettings).map((key) => {
if (key in this) {
this.setValue(
key,
key === "defaultPage"
? combineUrl(proxyURL, newSettings[key])
: newSettings[key]
);
if (key === "culture") {
const language = localStorage.getItem(LANGUAGE);
if (!language || language == "undefined") {
localStorage.setItem(LANGUAGE, newSettings[key]);
}
}
if (key === "personal") {
window.AppServer = {
...window.AppServer,
personal: newSettings[key],
};
}
} else if (key === "passwordHash") {
this.setValue("hashSettings", newSettings[key]);
}
});
return newSettings;
};
getCurrentCustomSchema = async (id) => {
this.customNames = await api.settings.getCurrentCustomSchema(id);
};
getCustomSchemaList = async () => {
this.customSchemaList = await api.settings.getCustomSchemaList();
};
getPortalSettings = async () => {
const origSettings = await this.getSettings();
if (origSettings.nameSchemaId) {
this.getCurrentCustomSchema(origSettings.nameSchemaId);
get urlAuthKeys() {
const splitted = this.culture.split("-");
const lang = splitted.length > 0 ? splitted[0] : "en";
return `https://helpcenter.onlyoffice.com/${lang}/installation/groups-authorization-keys.aspx`;
}
};
init = async () => {
this.setIsLoading(true);
await Promise.all([this.getPortalSettings(), this.getBuildVersionInfo()]);
this.setIsLoading(false);
this.setIsLoaded(true);
};
setIsLoading = (isLoading) => {
this.isLoading = isLoading;
};
setIsLoaded = (isLoaded) => {
this.isLoaded = isLoaded;
};
getPortalCultures = async () => {
this.cultures = await api.settings.getPortalCultures();
};
setIsEncryptionSupport = (isEncryptionSupport) => {
this.isEncryptionSupport = isEncryptionSupport;
};
getIsEncryptionSupport = async () => {
const isEncryptionSupport = await api.files.getIsEncryptionSupport();
this.setIsEncryptionSupport(isEncryptionSupport);
};
updateEncryptionKeys = (encryptionKeys) => {
this.encryptionKeys = encryptionKeys ?? {};
};
setEncryptionKeys = async (keys) => {
await api.files.setEncryptionKeys(keys);
this.updateEncryptionKeys(keys);
};
getEncryptionKeys = async () => {
const encryptionKeys = await api.files.getEncryptionKeys();
this.updateEncryptionKeys(encryptionKeys);
};
getOAuthToken = (tokenGetterWin) => {
return new Promise((resolve, reject) => {
localStorage.removeItem("code");
let interval = null;
interval = setInterval(() => {
try {
const code = localStorage.getItem("code");
if (code) {
localStorage.removeItem("code");
clearInterval(interval);
resolve(code);
} else if (tokenGetterWin && tokenGetterWin.closed) {
clearInterval(interval);
reject();
}
} catch {
return;
}
}, 500);
});
};
getLoginLink = (token, code) => {
return combineUrl(proxyURL, `/login.ashx?p=${token}&code=${code}`);
};
setModuleInfo = (homepage, productId) => {
if (this.homepage === homepage || this.currentProductId === productId)
return;
console.log(`setModuleInfo('${homepage}', '${productId}')`);
this.homepage = homepage;
this.setCurrentProductId(productId);
const baseElm = document.getElementsByTagName("base");
if (baseElm && baseElm.length === 1) {
const baseUrl = homepage
? homepage[homepage.length - 1] === "/"
? homepage
: `${homepage}/`
: "/";
console.log("SET base URL", baseUrl);
baseElm[0].setAttribute("href", baseUrl);
get wizardCompleted() {
return this.isLoaded && !this.wizardToken;
}
};
setCurrentProductId = (currentProductId) => {
this.currentProductId = currentProductId;
};
get helpUrlCommonSettings() {
const substring = this.culture.substring(0, this.culture.indexOf("-"));
const lang = substring.length > 0 ? substring : "en";
getPortalOwner = async () => {
const owner = await api.people.getUserById(this.ownerId);
this.owner = owner;
return owner;
};
return `https://helpcenter.onlyoffice.com/${lang}/administration/configuration.aspx#CustomizingPortal_block`;
}
setWizardComplete = () => {
this.wizardToken = null;
};
setPasswordSettings = (passwordSettings) => {
this.passwordSettings = passwordSettings;
};
getPortalPasswordSettings = async (confirmKey = null) => {
const settings = await api.settings.getPortalPasswordSettings(confirmKey);
this.setPasswordSettings(settings);
};
setTimezones = (timezones) => {
this.timezones = timezones;
};
getPortalTimezones = async (token = undefined) => {
const timezones = await api.settings.getPortalTimezones(token);
this.setTimezones(timezones);
};
setHeaderVisible = (isHeaderVisible) => {
this.isHeaderVisible = isHeaderVisible;
};
setIsTabletView = (isTabletView) => {
this.isTabletView = isTabletView;
};
setArticlePinned = (isPinned) => {
isPinned
? localStorage.setItem(ARTICLE_PINNED_KEY, isPinned)
: localStorage.removeItem(ARTICLE_PINNED_KEY);
this.isArticlePinned = isPinned;
};
setArticleVisibleOnUnpin = (visible) => {
this.isArticleVisibleOnUnpin = visible;
};
get firebaseHelper() {
window.firebaseHelper = new FirebaseHelper(this.firebase);
return window.firebaseHelper;
}
getBuildVersionInfo = async () => {
const versionInfo = await api.settings.getBuildVersion();
this.setBuildVersionInfo(versionInfo);
};
setBuildVersionInfo = (versionInfo) => {
this.buildVersionInfo = {
...this.buildVersionInfo,
appServer: version,
...versionInfo,
setIsArticleVisible = (visible) => {
this.isArticleVisible = this.isArticlePinned ? true : visible;
};
if (!this.buildVersionInfo.documentServer)
this.buildVersionInfo.documentServer = "6.4.1";
};
setIsBackdropVisible = (visible) => {
this.isBackdropVisible = visible;
};
hideArticle = () => {
this.setIsArticleVisible(false);
this.setIsBackdropVisible(false);
};
setValue = (key, value) => {
this[key] = value;
};
setDefaultPage = (defaultPage) => {
this.defaultPage = defaultPage;
};
getSettings = async () => {
const newSettings = await api.settings.getSettings();
if (window["AscDesktopEditor"] !== undefined || this.personal) {
const dp = combineUrl(proxyURL, "/products/files/");
this.setDefaultPage(dp);
}
Object.keys(newSettings).map((key) => {
if (key in this) {
this.setValue(
key,
key === "defaultPage"
? combineUrl(proxyURL, newSettings[key])
: newSettings[key]
);
if (key === "culture") {
const language = localStorage.getItem(LANGUAGE);
if (!language || language == "undefined") {
localStorage.setItem(LANGUAGE, newSettings[key]);
}
}
if (key === "personal") {
window.AppServer = {
...window.AppServer,
personal: newSettings[key],
};
}
} else if (key === "passwordHash") {
this.setValue("hashSettings", newSettings[key]);
}
});
return newSettings;
};
getCurrentCustomSchema = async (id) => {
this.customNames = await api.settings.getCurrentCustomSchema(id);
};
getCustomSchemaList = async () => {
this.customSchemaList = await api.settings.getCustomSchemaList();
};
getPortalSettings = async () => {
const origSettings = await this.getSettings();
if (origSettings.nameSchemaId) {
this.getCurrentCustomSchema(origSettings.nameSchemaId);
}
};
init = async () => {
this.setIsLoading(true);
await Promise.all([
this.getPortalSettings(),
this.getBuildVersionInfo(),
]);
this.setIsLoading(false);
this.setIsLoaded(true);
};
setIsLoading = (isLoading) => {
this.isLoading = isLoading;
};
setIsLoaded = (isLoaded) => {
this.isLoaded = isLoaded;
};
getPortalCultures = async () => {
this.cultures = await api.settings.getPortalCultures();
};
setIsEncryptionSupport = (isEncryptionSupport) => {
this.isEncryptionSupport = isEncryptionSupport;
};
getIsEncryptionSupport = async () => {
const isEncryptionSupport = await api.files.getIsEncryptionSupport();
this.setIsEncryptionSupport(isEncryptionSupport);
};
updateEncryptionKeys = (encryptionKeys) => {
this.encryptionKeys = encryptionKeys ?? {};
};
setEncryptionKeys = async (keys) => {
await api.files.setEncryptionKeys(keys);
this.updateEncryptionKeys(keys);
};
getEncryptionKeys = async () => {
const encryptionKeys = await api.files.getEncryptionKeys();
this.updateEncryptionKeys(encryptionKeys);
};
getOAuthToken = (tokenGetterWin) => {
return new Promise((resolve, reject) => {
localStorage.removeItem("code");
let interval = null;
interval = setInterval(() => {
try {
const code = localStorage.getItem("code");
if (code) {
localStorage.removeItem("code");
clearInterval(interval);
resolve(code);
} else if (tokenGetterWin && tokenGetterWin.closed) {
clearInterval(interval);
reject();
}
} catch {
return;
}
}, 500);
});
};
getLoginLink = (token, code) => {
return combineUrl(proxyURL, `/login.ashx?p=${token}&code=${code}`);
};
setModuleInfo = (homepage, productId) => {
if (this.homepage === homepage || this.currentProductId === productId)
return;
console.log(`setModuleInfo('${homepage}', '${productId}')`);
this.homepage = homepage;
this.setCurrentProductId(productId);
const baseElm = document.getElementsByTagName("base");
if (baseElm && baseElm.length === 1) {
const baseUrl = homepage
? homepage[homepage.length - 1] === "/"
? homepage
: `${homepage}/`
: "/";
console.log("SET base URL", baseUrl);
baseElm[0].setAttribute("href", baseUrl);
}
};
setCurrentProductId = (currentProductId) => {
this.currentProductId = currentProductId;
};
getPortalOwner = async () => {
const owner = await api.people.getUserById(this.ownerId);
this.owner = owner;
return owner;
};
setWizardComplete = () => {
this.wizardToken = null;
};
setPasswordSettings = (passwordSettings) => {
this.passwordSettings = passwordSettings;
};
getPortalPasswordSettings = async (confirmKey = null) => {
const settings = await api.settings.getPortalPasswordSettings(
confirmKey
);
this.setPasswordSettings(settings);
};
setTimezones = (timezones) => {
this.timezones = timezones;
};
getPortalTimezones = async (token = undefined) => {
const timezones = await api.settings.getPortalTimezones(token);
this.setTimezones(timezones);
};
setHeaderVisible = (isHeaderVisible) => {
this.isHeaderVisible = isHeaderVisible;
};
setIsTabletView = (isTabletView) => {
this.isTabletView = isTabletView;
};
setArticlePinned = (isPinned) => {
isPinned
? localStorage.setItem(ARTICLE_PINNED_KEY, isPinned)
: localStorage.removeItem(ARTICLE_PINNED_KEY);
this.isArticlePinned = isPinned;
};
setArticleVisibleOnUnpin = (visible) => {
this.isArticleVisibleOnUnpin = visible;
};
get firebaseHelper() {
window.firebaseHelper = new FirebaseHelper(this.firebase);
return window.firebaseHelper;
}
getBuildVersionInfo = async () => {
const versionInfo = await api.settings.getBuildVersion();
this.setBuildVersionInfo(versionInfo);
};
setBuildVersionInfo = (versionInfo) => {
this.buildVersionInfo = {
...this.buildVersionInfo,
appServer: version,
...versionInfo,
};
if (!this.buildVersionInfo.documentServer)
this.buildVersionInfo.documentServer = "6.4.1";
};
}
export default SettingsStore;

View File

@ -1,12 +1,7 @@
import { inject, observer } from "mobx-react";
import React from "react";
import { withTranslation } from "react-i18next";
import { withRouter } from "react-router";
const RoomInfoBodyContent = () => {
return <div>NOTIFICATION BODY CONTENT</div>;
};
export default inject(({}) => {
return {};
})(observer(RoomInfoBodyContent));
export default RoomInfoBodyContent;

View File

@ -1,7 +1,5 @@
import { inject, observer } from "mobx-react";
import React from "react";
import { withTranslation } from "react-i18next";
import { withRouter } from "react-router";
const RoomInfoHeaderContent = () => {
return <div>NOTIFICATION HEADER CONTENT</div>;

View File

@ -119,6 +119,11 @@ const StyledContainer = styled.div`
}
}
}
.room-info-button {
position: absolute;
right: 0;
}
}
.group-button-menu-container {
@ -553,7 +558,7 @@ class SectionHeaderContent extends React.Component {
/>
</span>
)}
<span>
<>
<IconButton
iconName="/static/images/arrow.path.react.svg"
size="15"
@ -561,9 +566,9 @@ class SectionHeaderContent extends React.Component {
hoverColor="#657077"
isFill={true}
onClick={this.onToggleRoomInfo}
className="trash-button"
className="room-info-button"
/>
</span>
</>
</>
)}
</div>
@ -584,6 +589,7 @@ export default inject(
filesActionsStore,
settingsStore,
treeFoldersStore,
roomInfoStore,
}) => {
const {
setSelected,
@ -621,6 +627,7 @@ export default inject(
downloadAction,
getHeaderMenu,
} = filesActionsStore;
const toggleRoomInfo = roomInfoStore.toggleIsVisible;
return {
isDesktop: auth.settingsStore.isDesktopClient,
@ -630,6 +637,7 @@ export default inject(
currentFolderId: selectedFolderStore.id,
filter,
canCreate,
toggleRoomInfo,
isHeaderVisible,
isHeaderIndeterminate,
isHeaderChecked,

View File

@ -8,8 +8,12 @@ class RoomInfoStore {
}
toggleIsVisible = () => {
isVisible = !this.isVisible;
this.isVisible = !this.isVisible;
};
get isVisible() {
return this.isVisible;
}
}
export default RoomInfoStore;

View File

@ -1,188 +1,204 @@
import { makeAutoObservable } from "mobx";
import api from "@appserver/common/api";
import axios from "axios";
import {
setFavoritesSetting,
setRecentSetting,
setFavoritesSetting,
setRecentSetting,
} from "@appserver/common/api/files";
import { FolderType } from "@appserver/common/constants";
import axios from "axios";
import { makeAutoObservable } from "mobx";
class SettingsStore {
thirdPartyStore;
treeFoldersStore;
thirdPartyStore;
treeFoldersStore;
isErrorSettings = null;
expandedSetting = null;
isErrorSettings = null;
expandedSetting = null;
confirmDelete = null;
enableThirdParty = null;
forcesave = null;
storeForcesave = null;
storeOriginalFiles = null;
updateIfExist = null;
favoritesSection = null;
recentSection = null;
hideConfirmConvertSave = null;
chunkUploadSize = 1024 * 1023; // 1024 * 1023; //~0.999mb
confirmDelete = null;
enableThirdParty = null;
forcesave = null;
storeForcesave = null;
storeOriginalFiles = null;
updateIfExist = null;
favoritesSection = null;
recentSection = null;
hideConfirmConvertSave = null;
chunkUploadSize = 1024 * 1023; // 1024 * 1023; //~0.999mb
settingsIsLoaded = false;
roomInfoIsVisible = false;
constructor(thirdPartyStore, treeFoldersStore) {
makeAutoObservable(this);
settingsIsLoaded = false;
this.thirdPartyStore = thirdPartyStore;
this.treeFoldersStore = treeFoldersStore;
}
constructor(thirdPartyStore, treeFoldersStore) {
makeAutoObservable(this);
setIsLoaded = (isLoaded) => {
this.settingsIsLoaded = isLoaded;
};
get isLoadedSettingsTree() {
return (
this.confirmDelete !== null &&
this.enableThirdParty !== null &&
this.forcesave !== null &&
this.storeForcesave !== null &&
this.storeOriginalFiles !== null &&
this.updateIfExist !== null
);
}
setFilesSettings = (settings) => {
const settingsItems = Object.keys(settings);
for (let key of settingsItems) {
this[key] = settings[key];
this.thirdPartyStore = thirdPartyStore;
this.treeFoldersStore = treeFoldersStore;
}
};
setIsErrorSettings = (isError) => {
this.isErrorSettings = isError;
};
setExpandSettingsTree = (expandedSetting) => {
this.expandedSetting = expandedSetting;
};
getFilesSettings = () => {
if (!this.isLoadedSettingsTree) {
return api.files
.getSettingsFiles()
.then((settings) => {
this.setFilesSettings(settings);
if (settings.enableThirdParty) {
this.setIsLoaded(true);
return axios
.all([
api.files.getThirdPartyCapabilities(),
api.files.getThirdPartyList(),
])
.then(([capabilities, providers]) => {
for (let item of capabilities) {
item.splice(1, 1);
}
this.thirdPartyStore.setThirdPartyCapabilities(capabilities); //TODO: Out of bounds read: 1
this.thirdPartyStore.setThirdPartyProviders(providers);
});
}
return this.setIsLoaded(true);
})
.catch(() => this.setIsErrorSettings(true));
} else {
return Promise.resolve();
get roomInfoIsVisible() {
return this.roomInfoIsVisible;
}
};
setFilesSetting = (setting, val) => {
this[setting] = val;
};
setIsLoaded = (isLoaded) => {
this.settingsIsLoaded = isLoaded;
};
setUpdateIfExist = (data, setting) =>
api.files
.updateIfExist(data)
.then((res) => this.setFilesSetting(setting, res));
setStoreOriginal = (data, setting) =>
api.files
.storeOriginal(data)
.then((res) => this.setFilesSetting(setting, res));
setConfirmDelete = (data, setting) =>
api.files
.changeDeleteConfirm(data)
.then((res) => this.setFilesSetting(setting, res));
setStoreForceSave = (data, setting) =>
api.files
.storeForceSave(data)
.then((res) => this.setFilesSetting(setting, res));
setEnableThirdParty = async (data, setting) => {
const res = await api.files.thirdParty(data);
this.setFilesSetting(setting, res);
if (data) {
return axios
.all([
api.files.getThirdPartyCapabilities(),
api.files.getThirdPartyList(),
])
.then(([capabilities, providers]) => {
for (let item of capabilities) {
item.splice(1, 1);
}
this.thirdPartyStore.setThirdPartyCapabilities(capabilities); //TODO: Out of bounds read: 1
this.thirdPartyStore.setThirdPartyProviders(providers);
});
} else {
return Promise.resolve();
}
};
setForceSave = (data, setting) =>
api.files.forceSave(data).then((res) => this.setFilesSetting(setting, res));
updateRootTreeFolders = (set, rootFolderIndex, folderType) => {
const {
getFoldersTree,
treeFolders,
setTreeFolders,
} = this.treeFoldersStore;
getFoldersTree().then((root) => {
if (set) {
const rootFolder = root.find((x) => x.rootFolderType === folderType);
const newTreeFolders = treeFolders;
newTreeFolders.splice(rootFolderIndex, 0, rootFolder);
setTreeFolders(newTreeFolders);
} else {
const newTreeFolders = treeFolders.filter(
(x) => x.rootFolderType !== folderType
get isLoadedSettingsTree() {
return (
this.confirmDelete !== null &&
this.enableThirdParty !== null &&
this.forcesave !== null &&
this.storeForcesave !== null &&
this.storeOriginalFiles !== null &&
this.updateIfExist !== null
);
setTreeFolders(newTreeFolders);
}
});
};
}
setFavoritesSetting = (set, setting) => {
return setFavoritesSetting(set).then((res) => {
this.setFilesSetting(setting, res);
this.updateRootTreeFolders(set, 2, FolderType.Favorites);
});
};
setFilesSettings = (settings) => {
const settingsItems = Object.keys(settings);
for (let key of settingsItems) {
this[key] = settings[key];
}
};
setRecentSetting = (set, setting) => {
return setRecentSetting(set).then((res) => {
this.setFilesSetting(setting, res);
const index = this.treeFoldersStore.favoritesFolder ? 3 : 2;
this.updateRootTreeFolders(set, index, FolderType.Recent);
});
};
setIsErrorSettings = (isError) => {
this.isErrorSettings = isError;
};
hideConfirmConvert = async (save = true) => {
const hideConfirmConvertSave = await api.files.hideConfirmConvert(save);
this.hideConfirmConvertSave = hideConfirmConvertSave;
};
setExpandSettingsTree = (expandedSetting) => {
this.expandedSetting = expandedSetting;
};
getFilesSettings = () => {
if (!this.isLoadedSettingsTree) {
return api.files
.getSettingsFiles()
.then((settings) => {
this.setFilesSettings(settings);
if (settings.enableThirdParty) {
this.setIsLoaded(true);
return axios
.all([
api.files.getThirdPartyCapabilities(),
api.files.getThirdPartyList(),
])
.then(([capabilities, providers]) => {
for (let item of capabilities) {
item.splice(1, 1);
}
this.thirdPartyStore.setThirdPartyCapabilities(
capabilities
); //TODO: Out of bounds read: 1
this.thirdPartyStore.setThirdPartyProviders(
providers
);
});
}
return this.setIsLoaded(true);
})
.catch(() => this.setIsErrorSettings(true));
} else {
return Promise.resolve();
}
};
setFilesSetting = (setting, val) => {
this[setting] = val;
};
setUpdateIfExist = (data, setting) =>
api.files
.updateIfExist(data)
.then((res) => this.setFilesSetting(setting, res));
setStoreOriginal = (data, setting) =>
api.files
.storeOriginal(data)
.then((res) => this.setFilesSetting(setting, res));
setConfirmDelete = (data, setting) =>
api.files
.changeDeleteConfirm(data)
.then((res) => this.setFilesSetting(setting, res));
setStoreForceSave = (data, setting) =>
api.files
.storeForceSave(data)
.then((res) => this.setFilesSetting(setting, res));
setEnableThirdParty = async (data, setting) => {
const res = await api.files.thirdParty(data);
this.setFilesSetting(setting, res);
if (data) {
return axios
.all([
api.files.getThirdPartyCapabilities(),
api.files.getThirdPartyList(),
])
.then(([capabilities, providers]) => {
for (let item of capabilities) {
item.splice(1, 1);
}
this.thirdPartyStore.setThirdPartyCapabilities(
capabilities
); //TODO: Out of bounds read: 1
this.thirdPartyStore.setThirdPartyProviders(providers);
});
} else {
return Promise.resolve();
}
};
setForceSave = (data, setting) =>
api.files
.forceSave(data)
.then((res) => this.setFilesSetting(setting, res));
updateRootTreeFolders = (set, rootFolderIndex, folderType) => {
const {
getFoldersTree,
treeFolders,
setTreeFolders,
} = this.treeFoldersStore;
getFoldersTree().then((root) => {
if (set) {
const rootFolder = root.find(
(x) => x.rootFolderType === folderType
);
const newTreeFolders = treeFolders;
newTreeFolders.splice(rootFolderIndex, 0, rootFolder);
setTreeFolders(newTreeFolders);
} else {
const newTreeFolders = treeFolders.filter(
(x) => x.rootFolderType !== folderType
);
setTreeFolders(newTreeFolders);
}
});
};
setFavoritesSetting = (set, setting) => {
return setFavoritesSetting(set).then((res) => {
this.setFilesSetting(setting, res);
this.updateRootTreeFolders(set, 2, FolderType.Favorites);
});
};
setRecentSetting = (set, setting) => {
return setRecentSetting(set).then((res) => {
this.setFilesSetting(setting, res);
const index = this.treeFoldersStore.favoritesFolder ? 3 : 2;
this.updateRootTreeFolders(set, index, FolderType.Recent);
});
};
hideConfirmConvert = async (save = true) => {
const hideConfirmConvertSave = await api.files.hideConfirmConvert(save);
this.hideConfirmConvertSave = hideConfirmConvertSave;
};
}
export default SettingsStore;

View File

@ -1,4 +1,3 @@
import RoomInfoStore from "./RoomInfoStore";
import store from "studio/store";
import DialogsStore from "./DialogsStore";
@ -11,6 +10,7 @@ import iconFormatsStore from "./IconFormatsStore";
import MediaViewerDataStore from "./MediaViewerDataStore";
import mediaViewersFormatsStore from "./MediaViewersFormatsStore";
import PrimaryProgressDataStore from "./PrimaryProgressDataStore";
import RoomInfoStore from "./RoomInfoStore";
import SecondaryProgressDataStore from "./SecondaryProgressDataStore";
import selectedFilesStore from "./SelectedFilesStore";
import selectedFolderStore from "./SelectedFolderStore";