From 2ab2e635ffeed5f4181feed0281e2fd331e06fc2 Mon Sep 17 00:00:00 2001 From: Elyor Djalilov Date: Fri, 14 Jul 2023 15:48:06 +0500 Subject: [PATCH 001/335] Web: Client: PortalSettings: added data-import categories --- .../client/public/locales/en/Settings.json | 1 + .../client/public/locales/ru/Settings.json | 1 + .../Layout/Article/Body/index.js | 16 +++- .../categories/data-import/index.js | 4 + .../PortalSettings/utils/settingsTree.js | 35 ++++++-- packages/client/src/routes/portalSettings.js | 85 ++++++++++++++----- public/images/catalog.import.react.svg | 3 + 7 files changed, 110 insertions(+), 35 deletions(-) create mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/index.js create mode 100644 public/images/catalog.import.react.svg diff --git a/packages/client/public/locales/en/Settings.json b/packages/client/public/locales/en/Settings.json index 8e4dfe6377..f68a4c8cf2 100644 --- a/packages/client/public/locales/en/Settings.json +++ b/packages/client/public/locales/en/Settings.json @@ -64,6 +64,7 @@ "CustomTitlesText": "Welcome Page", "CustomTitlesWelcome": "Welcome Page Settings", "DataBackup": "Data backup", + "DataImport": "Data import", "Deactivate": "Deactivate", "DeactivateOrDeletePortal": "Deactivate or delete space.", "DeleteDocSpace": "Delete DocSpace", diff --git a/packages/client/public/locales/ru/Settings.json b/packages/client/public/locales/ru/Settings.json index 43c2ebf831..9d3aa9a613 100644 --- a/packages/client/public/locales/ru/Settings.json +++ b/packages/client/public/locales/ru/Settings.json @@ -64,6 +64,7 @@ "CustomTitlesText": "странице приветствия", "CustomTitlesWelcome": "Настройки страницы приветствия", "DataBackup": "Резервное копирование данных", + "DataImport": "Перенос данных", "Deactivate": "Деактивировать", "DeactivateOrDeletePortal": "Деактивировать или удалить портал.", "DeleteDocSpace": "Удалить DocSpace", diff --git a/packages/client/src/pages/PortalSettings/Layout/Article/Body/index.js b/packages/client/src/pages/PortalSettings/Layout/Article/Body/index.js index dda679f475..96e0eb8923 100644 --- a/packages/client/src/pages/PortalSettings/Layout/Article/Body/index.js +++ b/packages/client/src/pages/PortalSettings/Layout/Article/Body/index.js @@ -57,6 +57,8 @@ const getTreeItems = (data, path, t) => { return t("SingleSignOn"); case "DeveloperTools": return t("DeveloperTools"); + case "DataImport": + return t("DataImport"); default: throw new Error("Unexpected translation key"); } @@ -173,17 +175,21 @@ const ArticleBodyContent = (props) => { setSelectedKeys(["4-0"]); } - if (location.pathname.includes("developer")) { + if (location.pathname.includes("migration")) { setSelectedKeys(["5-0"]); } - if (location.pathname.includes("delete-data")) { + if (location.pathname.includes("developer")) { setSelectedKeys(["6-0"]); } - if (location.pathname.includes("payments")) { + if (location.pathname.includes("delete-data")) { setSelectedKeys(["7-0"]); } + + if (location.pathname.includes("payments")) { + setSelectedKeys(["8-0"]); + } } }, [tReady, setIsLoadedArticleBody, location.pathname, selectedKeys]); @@ -244,6 +250,8 @@ const ArticleBodyContent = (props) => { return t("PortalDeletion"); case "DeveloperTools": return t("DeveloperTools"); + case "DataImport": + return t("DataImport"); default: throw new Error("Unexpected translation key"); } @@ -285,7 +293,7 @@ const ArticleBodyContent = (props) => { isActive={item.key === selectedKeys[0][0]} onClick={() => onSelect(item.key)} folderId={item.id} - style={{ marginTop: `${item.key.includes(7) ? "16px" : "0"}` }} + style={{ marginTop: `${item.key.includes(8) ? "16px" : "0"}` }} /> ); }); diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/index.js new file mode 100644 index 0000000000..e8b5689295 --- /dev/null +++ b/packages/client/src/pages/PortalSettings/categories/data-import/index.js @@ -0,0 +1,4 @@ +const DataImport = () => { + return
Data Import Page
; +}; +export default DataImport; diff --git a/packages/client/src/pages/PortalSettings/utils/settingsTree.js b/packages/client/src/pages/PortalSettings/utils/settingsTree.js index 4ee7be4cba..409d55d071 100644 --- a/packages/client/src/pages/PortalSettings/utils/settingsTree.js +++ b/packages/client/src/pages/PortalSettings/utils/settingsTree.js @@ -7,6 +7,7 @@ import DataManagementIconUrl from "PUBLIC_DIR/images/data-management.react.svg?u import RestoreIconUrl from "PUBLIC_DIR/images/restore.react.svg?url"; import TrashIconUrl from "PUBLIC_DIR/images/trash.react.svg?url"; import DeveloperReactSvgUrl from "PUBLIC_DIR/images/catalog.developer.react.svg?url"; +import DataImportReactSvgUrl from "PUBLIC_DIR/images/catalog.import.react.svg?url"; /** * Array for generation current settings tree. @@ -281,8 +282,26 @@ export const settingsTree = [ ], }, { - id: "portal-settings_catalog-developer-tools", + id: "portal-settings_catalog-migration", key: "5", + icon: DataImportReactSvgUrl, + link: "migration", + tKey: "DataImport", + isHeader: true, + children: [ + { + id: "portal-settings_catalog-data-migration", + key: "5-0", + icon: "", + link: "data-import", + tKey: "DataImport", + isCategory: true, + }, + ], + }, + { + id: "portal-settings_catalog-developer-tools", + key: "6", icon: DeveloperReactSvgUrl, link: "developer-tools", tKey: "DeveloperTools", @@ -290,7 +309,7 @@ export const settingsTree = [ children: [ { id: "portal-settings_catalog-javascript-sdk", - key: "5-0", + key: "6-0", icon: "", link: "javascript-sdk", tKey: "DeveloperTools", @@ -298,7 +317,7 @@ export const settingsTree = [ }, { id: "portal-settings_catalog-webhooks", - key: "5-1", + key: "6-1", icon: "", link: "webhooks", tKey: "DeveloperTools", @@ -308,21 +327,21 @@ export const settingsTree = [ }, { id: "portal-settings_catalog-delete", - key: "6", + key: "7", icon: TrashIconUrl, link: "delete-data", tKey: "PortalDeletion", isHeader: true, children: [ { - key: "6-0", + key: "7-0", icon: "", link: "deletion", tKey: "PortalDeletion", isCategory: true, }, { - key: "6-1", + key: "7-1", icon: "", link: "deactivation", tKey: "PortalDeactivation", @@ -332,7 +351,7 @@ export const settingsTree = [ }, { id: "portal-settings_catalog-payments", - key: "7", + key: "8", icon: PaymentIconUrl, link: "payments", tKey: "Common:PaymentsTitle", @@ -340,7 +359,7 @@ export const settingsTree = [ children: [ { id: "portal-settings_catalog-portal-payments", - key: "7-0", + key: "8-0", icon: "", link: "portal-payments", tKey: "Common:PaymentsTitle", diff --git a/packages/client/src/routes/portalSettings.js b/packages/client/src/routes/portalSettings.js index 09d42b06a7..8e5e38770b 100644 --- a/packages/client/src/routes/portalSettings.js +++ b/packages/client/src/routes/portalSettings.js @@ -12,65 +12,100 @@ import { generalRoutes } from "./general"; const PortalSettings = loadable(() => import("../pages/PortalSettings")); const CustomizationSettings = loadable(() => - import("../pages/PortalSettings/categories/common/index.js"), + import("../pages/PortalSettings/categories/common/index.js") ); const LanguageAndTimeZoneSettings = loadable(() => - import("../pages/PortalSettings/categories/common/Customization/language-and-time-zone"), + import( + "../pages/PortalSettings/categories/common/Customization/language-and-time-zone" + ) ); const WelcomePageSettings = loadable(() => - import("../pages/PortalSettings/categories/common/Customization/welcome-page-settings"), + import( + "../pages/PortalSettings/categories/common/Customization/welcome-page-settings" + ) ); const DNSSettings = loadable(() => - import("../pages/PortalSettings/categories/common/Customization/dns-settings"), + import("../pages/PortalSettings/categories/common/Customization/dns-settings") ); const PortalRenaming = loadable(() => - import("../pages/PortalSettings/categories/common/Customization/portal-renaming"), + import( + "../pages/PortalSettings/categories/common/Customization/portal-renaming" + ) ); const WhiteLabel = loadable(() => - import("../pages/PortalSettings/categories/common/Branding/whitelabel"), + import("../pages/PortalSettings/categories/common/Branding/whitelabel") ); const SecuritySettings = loadable(() => - import("../pages/PortalSettings/categories/security/index.js"), + import("../pages/PortalSettings/categories/security/index.js") ); const TfaPage = loadable(() => - import("../pages/PortalSettings/categories/security/access-portal/tfa"), + import("../pages/PortalSettings/categories/security/access-portal/tfa") ); const PasswordStrengthPage = loadable(() => - import("../pages/PortalSettings/categories/security/access-portal/passwordStrength"), + import( + "../pages/PortalSettings/categories/security/access-portal/passwordStrength" + ) ); const TrustedMailPage = loadable(() => - import("../pages/PortalSettings/categories/security/access-portal/trustedMail"), + import( + "../pages/PortalSettings/categories/security/access-portal/trustedMail" + ) ); const IpSecurityPage = loadable(() => - import("../pages/PortalSettings/categories/security/access-portal/ipSecurity"), + import("../pages/PortalSettings/categories/security/access-portal/ipSecurity") ); const AdminMessagePage = loadable(() => - import("../pages/PortalSettings/categories/security/access-portal/adminMessage"), + import( + "../pages/PortalSettings/categories/security/access-portal/adminMessage" + ) ); const SessionLifetimePage = loadable(() => - import("../pages/PortalSettings/categories/security/access-portal/sessionLifetime"), + import( + "../pages/PortalSettings/categories/security/access-portal/sessionLifetime" + ) +); +const Integration = loadable(() => + import("../pages/PortalSettings/categories/integration") +); +const Payments = loadable(() => + import("../pages/PortalSettings/categories/payments") ); -const Integration = loadable(() => import("../pages/PortalSettings/categories/integration")); -const Payments = loadable(() => import("../pages/PortalSettings/categories/payments")); const ThirdParty = loadable(() => - import("../pages/PortalSettings/categories/integration/ThirdPartyServicesSettings"), + import( + "../pages/PortalSettings/categories/integration/ThirdPartyServicesSettings" + ) ); const SingleSignOn = loadable(() => - import("../pages/PortalSettings/categories/integration/SingleSignOn"), + import("../pages/PortalSettings/categories/integration/SingleSignOn") ); const DeveloperTools = loadable(() => - import("../pages/PortalSettings/categories/developer-tools/index.js"), + import("../pages/PortalSettings/categories/developer-tools/index.js") ); + +const DataImport = loadable(() => + import("../pages/PortalSettings/categories/data-import/index.js") +); + const WebhookHistory = loadable(() => - import("../pages/PortalSettings/categories/developer-tools/Webhooks/WebhookHistory"), + import( + "../pages/PortalSettings/categories/developer-tools/Webhooks/WebhookHistory" + ) ); const WebhookDetails = loadable(() => - import("../pages/PortalSettings/categories/developer-tools/Webhooks/WebhookEventDetails"), + import( + "../pages/PortalSettings/categories/developer-tools/Webhooks/WebhookEventDetails" + ) +); +const Backup = loadable(() => + import("../pages/PortalSettings/categories/data-management/index") +); +const DeleteDataPage = loadable(() => + import("../pages/PortalSettings/categories/delete-data") ); -const Backup = loadable(() => import("../pages/PortalSettings/categories/data-management/index")); -const DeleteDataPage = loadable(() => import("../pages/PortalSettings/categories/delete-data")); const RestoreBackup = loadable(() => - import("../pages/PortalSettings/categories/data-management/backup/restore-backup/index"), + import( + "../pages/PortalSettings/categories/data-management/backup/restore-backup/index" + ) ); const PortalSettingsRoutes = { @@ -188,6 +223,10 @@ const PortalSettingsRoutes = { path: "developer-tools/javascript-sdk", element: , }, + { + path: "migration/data-import", + element: , + }, { path: "developer-tools/webhooks", element: , diff --git a/public/images/catalog.import.react.svg b/public/images/catalog.import.react.svg new file mode 100644 index 0000000000..e7f1ff5690 --- /dev/null +++ b/public/images/catalog.import.react.svg @@ -0,0 +1,3 @@ + + + From 0b561e90fba27e53cace3ae018d067c44b3eae7b Mon Sep 17 00:00:00 2001 From: Vladimir Khvan Date: Mon, 17 Jul 2023 15:58:37 +0500 Subject: [PATCH 002/335] data migration page was created --- .../components/integration-button/index.js | 49 +++++++++++++++++++ .../categories/data-import/index.js | 44 ++++++++++++++++- public/images/googleworkspace.react.svg | 17 +++++++ public/images/logo/workspace.svg | 24 +++++++++ public/images/nextcloud.logo.react.svg | 4 ++ 5 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/components/integration-button/index.js create mode 100644 public/images/googleworkspace.react.svg create mode 100644 public/images/logo/workspace.svg create mode 100644 public/images/nextcloud.logo.react.svg diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/components/integration-button/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/components/integration-button/index.js new file mode 100644 index 0000000000..76daf9262a --- /dev/null +++ b/packages/client/src/pages/PortalSettings/categories/data-import/components/integration-button/index.js @@ -0,0 +1,49 @@ +import React from "react"; +import styled, { css } from "styled-components"; + +import Link from "@docspace/components/link"; +import NoUserSelect from "@docspace/components/utils/commonStyles"; +import Base from "@docspace/components/themes/base"; + +const StyledButtonWrapper = styled.div` + width: 340px; + height: 64px; + display: flex; + justify-content: space-between; + align-items: center; + padding: 12px 20px; + box-sizing: border-box; + + border-radius: 6px; + border: 1px solid #d0d5da; + ${NoUserSelect}; + + :hover { + border-color: #4781d1; + cursor: pointer; + } + + :active { + background-color: ${(props) => props.theme.button.backgroundColor.baseActive}; + + color: ${(props) => props.theme.button.color.baseActive}; + + ${() => css` + border: ${(props) => props.theme.button.border.primaryActive}; + box-sizing: ${(props) => props.theme.button.boxSizing}; + `} + } +`; + +StyledButtonWrapper.defaultProps = { theme: Base }; + +export const IntegrationButton = ({ icon, onClick }) => { + return ( + + + + Import + + + ); +}; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/index.js index e8b5689295..debefa05ba 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/index.js @@ -1,4 +1,46 @@ +import React from "react"; +import Text from "@docspace/components/text"; + +import styled from "styled-components"; + +import { IntegrationButton } from "./components/integration-button"; + +import GoogleWorkspaceSvg from "PUBLIC_DIR/images/googleworkspace.react.svg?url"; +import NextcloudSvg from "PUBLIC_DIR/images/nextcloud.logo.react.svg?url"; +import OnlyOfficeWorkspaceSvg from "PUBLIC_DIR/images/logo/workspace.svg?url"; + +const DescriptionWrapper = styled.div` + max-width: 675px; + margin-bottom: 21px; + margin-top: 3px; +`; +const WorkspacesWrapper = styled.div` + max-width: 700px; + margin-top: 21px; + gap: 20px; + display: flex; + flex-wrap: wrap; +`; + const DataImport = () => { - return
Data Import Page
; + return ( +
+ + + Import data from a third party service to ONLYOFFICE DocSpace. Data import allows + transferring data such as all users, their personal and shared documents. + + + + Upload a backup copy from a desired service below to start migration. + + + + + + + +
+ ); }; export default DataImport; diff --git a/public/images/googleworkspace.react.svg b/public/images/googleworkspace.react.svg new file mode 100644 index 0000000000..a36b119a3f --- /dev/null +++ b/public/images/googleworkspace.react.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/images/logo/workspace.svg b/public/images/logo/workspace.svg new file mode 100644 index 0000000000..b404d8f32b --- /dev/null +++ b/public/images/logo/workspace.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/images/nextcloud.logo.react.svg b/public/images/nextcloud.logo.react.svg new file mode 100644 index 0000000000..d9fbc53170 --- /dev/null +++ b/public/images/nextcloud.logo.react.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file From 7d6f35529e43ac6103311ea54698492c217d0b6f Mon Sep 17 00:00:00 2001 From: Elyor Djalilov Date: Mon, 17 Jul 2023 17:04:13 +0500 Subject: [PATCH 003/335] Web: Client: PortalSettings: added data-import services --- .../client/public/locales/en/Settings.json | 3 + .../client/public/locales/ru/Settings.json | 3 + .../data-import/StyledDataImport.js | 35 ++++++++++ .../categories/data-import/index.js | 70 ++++++++++++++++++- public/images/workspace.google.react.svg | 17 +++++ public/images/workspace.nextcloud.react.svg | 4 ++ public/images/workspace.onlyoffice.react.svg | 24 +++++++ 7 files changed, 153 insertions(+), 3 deletions(-) create mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js create mode 100644 public/images/workspace.google.react.svg create mode 100644 public/images/workspace.nextcloud.react.svg create mode 100644 public/images/workspace.onlyoffice.react.svg diff --git a/packages/client/public/locales/en/Settings.json b/packages/client/public/locales/en/Settings.json index f68a4c8cf2..94ad4ae154 100644 --- a/packages/client/public/locales/en/Settings.json +++ b/packages/client/public/locales/en/Settings.json @@ -65,6 +65,7 @@ "CustomTitlesWelcome": "Welcome Page Settings", "DataBackup": "Data backup", "DataImport": "Data import", + "DataImportDescription": "Import data from a third party service to ONLYOFFICE DocSpace. Data import allows transferring data such as all users, their personal and shared documents.", "Deactivate": "Deactivate", "DeactivateOrDeletePortal": "Deactivate or delete space.", "DeleteDocSpace": "Delete DocSpace", @@ -93,6 +94,7 @@ "EveryMonth": "Every month", "EveryWeek": "Every week", "ForcePathStyle": "Force Path Style", + "Import": "Import", "IPSecurity": "IP Security", "IPSecurityDescription": "IP Security is used to restrict login to the space from all IP addresses except certain addresses.", "IPSecurityHelper": "You can set the allowed IP addresses using either exact IP addresses in the IPv4 format (#.#.#.#, where # is a numeric value from 0 to 255) or IP range (in the #.#.#.#-#.#.#.# format).", @@ -191,6 +193,7 @@ "TwoFactorAuth": "Two-factor authentication", "TwoFactorAuthDescription": "Two-factor authentication provides a more secure way to log in. After entering the credentials, the user will have to enter a code from an SMS or the authentication app.", "TwoFactorAuthHelper": "Note: SMS messages can be sent if you have a positive balance only. You can always check your current balance in your SMS provider account. Do not forget to replenish your balance in good time.", + "UploadBackupData": "Upload a backup copy from a desired service below to start migration.", "UseAsLogoButton": "Use as logo", "UseDigits": "Use digits", "UseHttp": "Use Http", diff --git a/packages/client/public/locales/ru/Settings.json b/packages/client/public/locales/ru/Settings.json index 9d3aa9a613..7eee7f64c5 100644 --- a/packages/client/public/locales/ru/Settings.json +++ b/packages/client/public/locales/ru/Settings.json @@ -65,6 +65,7 @@ "CustomTitlesWelcome": "Настройки страницы приветствия", "DataBackup": "Резервное копирование данных", "DataImport": "Перенос данных", + "DataImportDescription": "Импорт данных из стороннего сервиса в ONLYOFFICE DocSpace. Импорт данных позволяет передавать такие данные, как все пользователи, их личные и общие документы.", "Deactivate": "Деактивировать", "DeactivateOrDeletePortal": "Деактивировать или удалить портал.", "DeleteDocSpace": "Удалить DocSpace", @@ -93,6 +94,7 @@ "EveryMonth": "Каждый месяц", "EveryWeek": "Каждую неделю", "ForcePathStyle": "Принудительно использовать стиль пути", + "Import": "Импортировать", "IPSecurity": "IP-безопасность", "IPSecurityDescription": "Настройки IP-безопасности используются для ограничения возможности входа на портал со всех IP-адресов, кроме указанных.", "IPSecurityHelper": "Вы можете задать разрешенные IP-адреса, указав конкретные значения IP-адресов в формате IPv4 (#.#.#.#, где # - это число от 0 до 255) или диапазон IP-адресов (в формате #.#.#.#-#.#.#.#).", @@ -191,6 +193,7 @@ "TwoFactorAuth": "Двухфакторная аутентификация", "TwoFactorAuthDescription": "Двухфакторная аутентификация обеспечивает более безопасный способ входа на портал. После ввода учетных данных пользователь должен будет ввести код из SMS или приложения для аутентификации.", "TwoFactorAuthHelper": "Обратите внимание: отправка SMS-сообщений осуществляется только при положительном балансе. Вы всегда можете проверить текущий баланс в учетной записи вашего SMS-провайдера. Не забывайте своевременно пополнять баланс.", + "UploadBackupData": "Загрузите резервную копию из нужного сервиса ниже, чтобы начать миграцию.", "UseAsLogoButton": "Использовать как логотип", "UseDigits": "Использовать цифры", "UseHttp": "Использовать Http", diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js b/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js new file mode 100644 index 0000000000..50a30e6ec2 --- /dev/null +++ b/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js @@ -0,0 +1,35 @@ +import styled from "styled-components"; + +const StyledWrapper = styled.div` + max-width: 700px; + + .data-import-description { + color: #657077; + margin-bottom: 20px; + } + + .start-migration-text { + margin-bottom: 20px; + } + + .service-list { + display: flex; + align-items: center; + justify-content: space-between; + flex-wrap: wrap; + gap: 20px; + } + + .service-wrapper { + border: 1px solid #d0d5da; + border-radius: 6px; + width: 340px; + height: 64px; + padding: 0 20px; + display: flex; + align-items: center; + justify-content: space-between; + } +`; + +export { StyledWrapper }; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/index.js index e8b5689295..bcbfafcde2 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/index.js @@ -1,4 +1,68 @@ -const DataImport = () => { - return
Data Import Page
; +import { withTranslation } from "react-i18next"; +import { inject, observer } from "mobx-react"; +import { ReactSVG } from "react-svg"; + +import Box from "@docspace/components/box"; +import Text from "@docspace/components/text"; +import Link from "@docspace/components/link"; +import { StyledWrapper } from "./StyledDataImport"; + +import WorkspaceGoogleSvgUrl from "PUBLIC_DIR/images/workspace.google.react.svg?url"; +import WorkspaceNextcloudSvgUrl from "PUBLIC_DIR/images/workspace.nextcloud.react.svg?url"; +import WorkspaceOnlyofficeeSvgUrl from "PUBLIC_DIR/images/workspace.onlyoffice.react.svg?url"; + +const services = [ + { + id: 1, + title: "google", + logo: WorkspaceGoogleSvgUrl, + }, + { + id: 2, + title: "nextcloud", + logo: WorkspaceNextcloudSvgUrl, + }, + { + id: 3, + title: "onlyoffice", + logo: WorkspaceOnlyofficeeSvgUrl, + }, +]; + +const DataImport = (props) => { + const { t } = props; + return ( + + + {t("Settings:DataImportDescription")} + + + {t("Settings:UploadBackupData")} + + +
+ {services.map((service) => ( + + + console.log("clicked")} + > + {t("Settings:Import")} + + + ))} +
+
+ ); }; -export default DataImport; + +export default inject(({ setup }) => { + const { initSettings } = setup; + return { + initSettings, + }; +})(withTranslation(["Settings"])(observer(DataImport))); diff --git a/public/images/workspace.google.react.svg b/public/images/workspace.google.react.svg new file mode 100644 index 0000000000..87b8f90136 --- /dev/null +++ b/public/images/workspace.google.react.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/public/images/workspace.nextcloud.react.svg b/public/images/workspace.nextcloud.react.svg new file mode 100644 index 0000000000..72d8d19afd --- /dev/null +++ b/public/images/workspace.nextcloud.react.svg @@ -0,0 +1,4 @@ + + + + diff --git a/public/images/workspace.onlyoffice.react.svg b/public/images/workspace.onlyoffice.react.svg new file mode 100644 index 0000000000..b404d8f32b --- /dev/null +++ b/public/images/workspace.onlyoffice.react.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + From 77b07ae32d3665b4a87089a2a51c4a559aa5ec92 Mon Sep 17 00:00:00 2001 From: Vladimir Khvan Date: Mon, 17 Jul 2023 17:41:47 +0500 Subject: [PATCH 004/335] routes for google-data-import and nextcloud-data-import were added / base pages were created / data-import route was changed --- .../components/integration-button/index.js | 2 +- .../data-import/googleWorkspace/index.js | 7 ++ .../categories/data-import/index.js | 15 ++- .../data-import/nextcloudWorkspace/index.js | 7 ++ .../PortalSettings/utils/settingsTree.js | 16 +++- packages/client/src/routes/portalSettings.js | 94 ++++++++----------- 6 files changed, 79 insertions(+), 62 deletions(-) create mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/googleWorkspace/index.js create mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/nextcloudWorkspace/index.js diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/components/integration-button/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/components/integration-button/index.js index 76daf9262a..315c0870cc 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/components/integration-button/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/components/integration-button/index.js @@ -41,7 +41,7 @@ export const IntegrationButton = ({ icon, onClick }) => { return ( - + Import diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/googleWorkspace/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/googleWorkspace/index.js new file mode 100644 index 0000000000..18f50da27c --- /dev/null +++ b/packages/client/src/pages/PortalSettings/categories/data-import/googleWorkspace/index.js @@ -0,0 +1,7 @@ +import React from "react"; + +const GoogleWorkspace = () => { + return
Google workspace
; +}; + +export default GoogleWorkspace; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/index.js index debefa05ba..90b7a4e6c2 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/index.js @@ -3,6 +3,8 @@ import Text from "@docspace/components/text"; import styled from "styled-components"; +import { useNavigate } from "react-router-dom"; + import { IntegrationButton } from "./components/integration-button"; import GoogleWorkspaceSvg from "PUBLIC_DIR/images/googleworkspace.react.svg?url"; @@ -23,6 +25,15 @@ const WorkspacesWrapper = styled.div` `; const DataImport = () => { + const navigate = useNavigate(); + + const redirectToGoogleMigration = () => { + navigate(window.location.pathname + `/google`); + }; + const redirectToNextcloudMigration = () => { + navigate(window.location.pathname + `/nextcloud`); + }; + return (
@@ -36,8 +47,8 @@ const DataImport = () => { - - + +
diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/nextcloudWorkspace/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/nextcloudWorkspace/index.js new file mode 100644 index 0000000000..3aeb401935 --- /dev/null +++ b/packages/client/src/pages/PortalSettings/categories/data-import/nextcloudWorkspace/index.js @@ -0,0 +1,7 @@ +import React from "react"; + +const NextcloudWorkspace = () => { + return
Nextcloud workspace
; +}; + +export default NextcloudWorkspace; diff --git a/packages/client/src/pages/PortalSettings/utils/settingsTree.js b/packages/client/src/pages/PortalSettings/utils/settingsTree.js index 409d55d071..cb927bd8e0 100644 --- a/packages/client/src/pages/PortalSettings/utils/settingsTree.js +++ b/packages/client/src/pages/PortalSettings/utils/settingsTree.js @@ -282,18 +282,26 @@ export const settingsTree = [ ], }, { - id: "portal-settings_catalog-migration", + id: "portal-settings_catalog-data-import", key: "5", icon: DataImportReactSvgUrl, - link: "migration", + link: "data-import", tKey: "DataImport", isHeader: true, children: [ { - id: "portal-settings_catalog-data-migration", + id: "portal-settings_catalog-google-data-migration", key: "5-0", icon: "", - link: "data-import", + link: "google", + tKey: "DataImport", + isCategory: true, + }, + { + id: "portal-settings_catalog-nextcloud-data-migration", + key: "5-1", + icon: "", + link: "nextcloud", tKey: "DataImport", isCategory: true, }, diff --git a/packages/client/src/routes/portalSettings.js b/packages/client/src/routes/portalSettings.js index 8e5e38770b..9808a5fa7e 100644 --- a/packages/client/src/routes/portalSettings.js +++ b/packages/client/src/routes/portalSettings.js @@ -12,100 +12,76 @@ import { generalRoutes } from "./general"; const PortalSettings = loadable(() => import("../pages/PortalSettings")); const CustomizationSettings = loadable(() => - import("../pages/PortalSettings/categories/common/index.js") + import("../pages/PortalSettings/categories/common/index.js"), ); const LanguageAndTimeZoneSettings = loadable(() => - import( - "../pages/PortalSettings/categories/common/Customization/language-and-time-zone" - ) + import("../pages/PortalSettings/categories/common/Customization/language-and-time-zone"), ); const WelcomePageSettings = loadable(() => - import( - "../pages/PortalSettings/categories/common/Customization/welcome-page-settings" - ) + import("../pages/PortalSettings/categories/common/Customization/welcome-page-settings"), ); const DNSSettings = loadable(() => - import("../pages/PortalSettings/categories/common/Customization/dns-settings") + import("../pages/PortalSettings/categories/common/Customization/dns-settings"), ); const PortalRenaming = loadable(() => - import( - "../pages/PortalSettings/categories/common/Customization/portal-renaming" - ) + import("../pages/PortalSettings/categories/common/Customization/portal-renaming"), ); const WhiteLabel = loadable(() => - import("../pages/PortalSettings/categories/common/Branding/whitelabel") + import("../pages/PortalSettings/categories/common/Branding/whitelabel"), ); const SecuritySettings = loadable(() => - import("../pages/PortalSettings/categories/security/index.js") + import("../pages/PortalSettings/categories/security/index.js"), ); const TfaPage = loadable(() => - import("../pages/PortalSettings/categories/security/access-portal/tfa") + import("../pages/PortalSettings/categories/security/access-portal/tfa"), ); const PasswordStrengthPage = loadable(() => - import( - "../pages/PortalSettings/categories/security/access-portal/passwordStrength" - ) + import("../pages/PortalSettings/categories/security/access-portal/passwordStrength"), ); const TrustedMailPage = loadable(() => - import( - "../pages/PortalSettings/categories/security/access-portal/trustedMail" - ) + import("../pages/PortalSettings/categories/security/access-portal/trustedMail"), ); const IpSecurityPage = loadable(() => - import("../pages/PortalSettings/categories/security/access-portal/ipSecurity") + import("../pages/PortalSettings/categories/security/access-portal/ipSecurity"), ); const AdminMessagePage = loadable(() => - import( - "../pages/PortalSettings/categories/security/access-portal/adminMessage" - ) + import("../pages/PortalSettings/categories/security/access-portal/adminMessage"), ); const SessionLifetimePage = loadable(() => - import( - "../pages/PortalSettings/categories/security/access-portal/sessionLifetime" - ) -); -const Integration = loadable(() => - import("../pages/PortalSettings/categories/integration") -); -const Payments = loadable(() => - import("../pages/PortalSettings/categories/payments") + import("../pages/PortalSettings/categories/security/access-portal/sessionLifetime"), ); +const Integration = loadable(() => import("../pages/PortalSettings/categories/integration")); +const Payments = loadable(() => import("../pages/PortalSettings/categories/payments")); const ThirdParty = loadable(() => - import( - "../pages/PortalSettings/categories/integration/ThirdPartyServicesSettings" - ) + import("../pages/PortalSettings/categories/integration/ThirdPartyServicesSettings"), ); const SingleSignOn = loadable(() => - import("../pages/PortalSettings/categories/integration/SingleSignOn") + import("../pages/PortalSettings/categories/integration/SingleSignOn"), ); const DeveloperTools = loadable(() => - import("../pages/PortalSettings/categories/developer-tools/index.js") + import("../pages/PortalSettings/categories/developer-tools/index.js"), ); const DataImport = loadable(() => - import("../pages/PortalSettings/categories/data-import/index.js") + import("../pages/PortalSettings/categories/data-import/index.js"), +); +const GoogleDataImport = loadable(() => + import("../pages/PortalSettings/categories/data-import/googleWorkspace/index.js"), +); +const NextcloudDataImport = loadable(() => + import("../pages/PortalSettings/categories/data-import/nextcloudWorkspace/index.js"), ); const WebhookHistory = loadable(() => - import( - "../pages/PortalSettings/categories/developer-tools/Webhooks/WebhookHistory" - ) + import("../pages/PortalSettings/categories/developer-tools/Webhooks/WebhookHistory"), ); const WebhookDetails = loadable(() => - import( - "../pages/PortalSettings/categories/developer-tools/Webhooks/WebhookEventDetails" - ) -); -const Backup = loadable(() => - import("../pages/PortalSettings/categories/data-management/index") -); -const DeleteDataPage = loadable(() => - import("../pages/PortalSettings/categories/delete-data") + import("../pages/PortalSettings/categories/developer-tools/Webhooks/WebhookEventDetails"), ); +const Backup = loadable(() => import("../pages/PortalSettings/categories/data-management/index")); +const DeleteDataPage = loadable(() => import("../pages/PortalSettings/categories/delete-data")); const RestoreBackup = loadable(() => - import( - "../pages/PortalSettings/categories/data-management/backup/restore-backup/index" - ) + import("../pages/PortalSettings/categories/data-management/backup/restore-backup/index"), ); const PortalSettingsRoutes = { @@ -224,9 +200,17 @@ const PortalSettingsRoutes = { element: , }, { - path: "migration/data-import", + path: "data-import", element: , }, + { + path: "data-import/google", + element: , + }, + { + path: "data-import/nextcloud", + element: , + }, { path: "developer-tools/webhooks", element: , From d07eca49573f8f66bba9cce118b7b708a75af0e8 Mon Sep 17 00:00:00 2001 From: Elyor Djalilov Date: Mon, 17 Jul 2023 18:32:52 +0500 Subject: [PATCH 005/335] fix bad merge --- .../data-import/StyledDataImport.js | 7 +- .../components/integration-button/index.js | 49 ---------- .../categories/data-import/index.js | 75 ++++++++------- .../googleWorkspace.js} | 0 .../nextcloudWorkspace.js} | 0 .../sub-components/onlyofficeWorkspace.js | 6 ++ .../data-import/sub-components/serviceItem.js | 22 +++++ packages/client/src/routes/portalSettings.js | 95 ++++++++++++++----- public/images/googleworkspace.react.svg | 17 ---- public/images/logo/workspace.svg | 24 ----- public/images/nextcloud.logo.react.svg | 4 - 11 files changed, 140 insertions(+), 159 deletions(-) delete mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/components/integration-button/index.js rename packages/client/src/pages/PortalSettings/categories/data-import/{googleWorkspace/index.js => sub-components/googleWorkspace.js} (100%) rename packages/client/src/pages/PortalSettings/categories/data-import/{nextcloudWorkspace/index.js => sub-components/nextcloudWorkspace.js} (100%) create mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/sub-components/onlyofficeWorkspace.js create mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/sub-components/serviceItem.js delete mode 100644 public/images/googleworkspace.react.svg delete mode 100644 public/images/logo/workspace.svg delete mode 100644 public/images/nextcloud.logo.react.svg diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js b/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js index 50a30e6ec2..1acedf1a13 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js @@ -25,10 +25,15 @@ const StyledWrapper = styled.div` border-radius: 6px; width: 340px; height: 64px; - padding: 0 20px; + box-sizing: border-box; + padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; + + &:hover { + border-color: #4781d1; + } } `; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/components/integration-button/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/components/integration-button/index.js deleted file mode 100644 index 315c0870cc..0000000000 --- a/packages/client/src/pages/PortalSettings/categories/data-import/components/integration-button/index.js +++ /dev/null @@ -1,49 +0,0 @@ -import React from "react"; -import styled, { css } from "styled-components"; - -import Link from "@docspace/components/link"; -import NoUserSelect from "@docspace/components/utils/commonStyles"; -import Base from "@docspace/components/themes/base"; - -const StyledButtonWrapper = styled.div` - width: 340px; - height: 64px; - display: flex; - justify-content: space-between; - align-items: center; - padding: 12px 20px; - box-sizing: border-box; - - border-radius: 6px; - border: 1px solid #d0d5da; - ${NoUserSelect}; - - :hover { - border-color: #4781d1; - cursor: pointer; - } - - :active { - background-color: ${(props) => props.theme.button.backgroundColor.baseActive}; - - color: ${(props) => props.theme.button.color.baseActive}; - - ${() => css` - border: ${(props) => props.theme.button.border.primaryActive}; - box-sizing: ${(props) => props.theme.button.boxSizing}; - `} - } -`; - -StyledButtonWrapper.defaultProps = { theme: Base }; - -export const IntegrationButton = ({ icon, onClick }) => { - return ( - - - - Import - - - ); -}; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/index.js index fac0b80d7c..df161e381d 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/index.js @@ -1,30 +1,17 @@ -import React from "react"; -import Text from "@docspace/components/text"; - -import styled from "styled-components"; - +import { withTranslation } from "react-i18next"; import { useNavigate } from "react-router-dom"; +import { inject, observer } from "mobx-react"; -import { IntegrationButton } from "./components/integration-button"; +import Text from "@docspace/components/text"; +import { StyledWrapper } from "./StyledDataImport"; +import ServiceItem from "./sub-components/serviceItem"; -import GoogleWorkspaceSvg from "PUBLIC_DIR/images/googleworkspace.react.svg?url"; -import NextcloudSvg from "PUBLIC_DIR/images/nextcloud.logo.react.svg?url"; -import OnlyOfficeWorkspaceSvg from "PUBLIC_DIR/images/logo/workspace.svg?url"; +import WorkspaceGoogleSvgUrl from "PUBLIC_DIR/images/workspace.google.react.svg?url"; +import WorkspaceNextcloudSvgUrl from "PUBLIC_DIR/images/workspace.nextcloud.react.svg?url"; +import WorkspaceOnlyofficeeSvgUrl from "PUBLIC_DIR/images/workspace.onlyoffice.react.svg?url"; -const DescriptionWrapper = styled.div` - max-width: 675px; - margin-bottom: 21px; - margin-top: 3px; -`; -const WorkspacesWrapper = styled.div` - max-width: 700px; - margin-top: 21px; - gap: 20px; - display: flex; - flex-wrap: wrap; -`; - -const DataImport = () => { +const DataImport = (props) => { + const { t } = props; const navigate = useNavigate(); const redirectToGoogleMigration = () => { @@ -33,25 +20,37 @@ const DataImport = () => { const redirectToNextcloudMigration = () => { navigate(window.location.pathname + `/nextcloud`); }; + const redirectToOnlyofficeMigration = () => { + navigate(window.location.pathname + `/onlyoffice`); + }; return ( -
- - - Import data from a third party service to ONLYOFFICE DocSpace. Data import allows - transferring data such as all users, their personal and shared documents. - - - - Upload a backup copy from a desired service below to start migration. + + + {t("Settings:DataImportDescription")} + + + {t("Settings:UploadBackupData")} - - - - - -
+
+ + + +
+ ); }; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/googleWorkspace/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/googleWorkspace.js similarity index 100% rename from packages/client/src/pages/PortalSettings/categories/data-import/googleWorkspace/index.js rename to packages/client/src/pages/PortalSettings/categories/data-import/sub-components/googleWorkspace.js diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/nextcloudWorkspace/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/nextcloudWorkspace.js similarity index 100% rename from packages/client/src/pages/PortalSettings/categories/data-import/nextcloudWorkspace/index.js rename to packages/client/src/pages/PortalSettings/categories/data-import/sub-components/nextcloudWorkspace.js diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/onlyofficeWorkspace.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/onlyofficeWorkspace.js new file mode 100644 index 0000000000..e6a035949d --- /dev/null +++ b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/onlyofficeWorkspace.js @@ -0,0 +1,6 @@ +import React from "react"; + +const OnlyofficeWorkspace = () => { + return
onlyofficeWorkspace
; +}; +export default OnlyofficeWorkspace; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/serviceItem.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/serviceItem.js new file mode 100644 index 0000000000..e40d85579c --- /dev/null +++ b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/serviceItem.js @@ -0,0 +1,22 @@ +import { ReactSVG } from "react-svg"; +import Link from "@docspace/components/link"; +import Box from "@docspace/components/box"; + +const ServiceItem = ({ t, logo, onClick }) => { + return ( + + + + {t("Settings:Import")} + + + ); +}; + +export default ServiceItem; diff --git a/packages/client/src/routes/portalSettings.js b/packages/client/src/routes/portalSettings.js index 9808a5fa7e..dc556f5455 100644 --- a/packages/client/src/routes/portalSettings.js +++ b/packages/client/src/routes/portalSettings.js @@ -12,76 +12,115 @@ import { generalRoutes } from "./general"; const PortalSettings = loadable(() => import("../pages/PortalSettings")); const CustomizationSettings = loadable(() => - import("../pages/PortalSettings/categories/common/index.js"), + import("../pages/PortalSettings/categories/common/index.js") ); const LanguageAndTimeZoneSettings = loadable(() => - import("../pages/PortalSettings/categories/common/Customization/language-and-time-zone"), + import( + "../pages/PortalSettings/categories/common/Customization/language-and-time-zone" + ) ); const WelcomePageSettings = loadable(() => - import("../pages/PortalSettings/categories/common/Customization/welcome-page-settings"), + import( + "../pages/PortalSettings/categories/common/Customization/welcome-page-settings" + ) ); const DNSSettings = loadable(() => - import("../pages/PortalSettings/categories/common/Customization/dns-settings"), + import("../pages/PortalSettings/categories/common/Customization/dns-settings") ); const PortalRenaming = loadable(() => - import("../pages/PortalSettings/categories/common/Customization/portal-renaming"), + import( + "../pages/PortalSettings/categories/common/Customization/portal-renaming" + ) ); const WhiteLabel = loadable(() => - import("../pages/PortalSettings/categories/common/Branding/whitelabel"), + import("../pages/PortalSettings/categories/common/Branding/whitelabel") ); const SecuritySettings = loadable(() => - import("../pages/PortalSettings/categories/security/index.js"), + import("../pages/PortalSettings/categories/security/index.js") ); const TfaPage = loadable(() => - import("../pages/PortalSettings/categories/security/access-portal/tfa"), + import("../pages/PortalSettings/categories/security/access-portal/tfa") ); const PasswordStrengthPage = loadable(() => - import("../pages/PortalSettings/categories/security/access-portal/passwordStrength"), + import( + "../pages/PortalSettings/categories/security/access-portal/passwordStrength" + ) ); const TrustedMailPage = loadable(() => - import("../pages/PortalSettings/categories/security/access-portal/trustedMail"), + import( + "../pages/PortalSettings/categories/security/access-portal/trustedMail" + ) ); const IpSecurityPage = loadable(() => - import("../pages/PortalSettings/categories/security/access-portal/ipSecurity"), + import("../pages/PortalSettings/categories/security/access-portal/ipSecurity") ); const AdminMessagePage = loadable(() => - import("../pages/PortalSettings/categories/security/access-portal/adminMessage"), + import( + "../pages/PortalSettings/categories/security/access-portal/adminMessage" + ) ); const SessionLifetimePage = loadable(() => - import("../pages/PortalSettings/categories/security/access-portal/sessionLifetime"), + import( + "../pages/PortalSettings/categories/security/access-portal/sessionLifetime" + ) +); +const Integration = loadable(() => + import("../pages/PortalSettings/categories/integration") +); +const Payments = loadable(() => + import("../pages/PortalSettings/categories/payments") ); -const Integration = loadable(() => import("../pages/PortalSettings/categories/integration")); -const Payments = loadable(() => import("../pages/PortalSettings/categories/payments")); const ThirdParty = loadable(() => - import("../pages/PortalSettings/categories/integration/ThirdPartyServicesSettings"), + import( + "../pages/PortalSettings/categories/integration/ThirdPartyServicesSettings" + ) ); const SingleSignOn = loadable(() => - import("../pages/PortalSettings/categories/integration/SingleSignOn"), + import("../pages/PortalSettings/categories/integration/SingleSignOn") ); const DeveloperTools = loadable(() => - import("../pages/PortalSettings/categories/developer-tools/index.js"), + import("../pages/PortalSettings/categories/developer-tools/index.js") ); const DataImport = loadable(() => - import("../pages/PortalSettings/categories/data-import/index.js"), + import("../pages/PortalSettings/categories/data-import/index.js") ); const GoogleDataImport = loadable(() => - import("../pages/PortalSettings/categories/data-import/googleWorkspace/index.js"), + import( + "../pages/PortalSettings/categories/data-import/sub-components/googleWorkspace.js" + ) ); const NextcloudDataImport = loadable(() => - import("../pages/PortalSettings/categories/data-import/nextcloudWorkspace/index.js"), + import( + "../pages/PortalSettings/categories/data-import/sub-components/nextcloudWorkspace.js" + ) +); +const OnlyofficeDataImport = loadable(() => + import( + "../pages/PortalSettings/categories/data-import/sub-components/onlyofficeWorkspace.js" + ) ); const WebhookHistory = loadable(() => - import("../pages/PortalSettings/categories/developer-tools/Webhooks/WebhookHistory"), + import( + "../pages/PortalSettings/categories/developer-tools/Webhooks/WebhookHistory" + ) ); const WebhookDetails = loadable(() => - import("../pages/PortalSettings/categories/developer-tools/Webhooks/WebhookEventDetails"), + import( + "../pages/PortalSettings/categories/developer-tools/Webhooks/WebhookEventDetails" + ) +); +const Backup = loadable(() => + import("../pages/PortalSettings/categories/data-management/index") +); +const DeleteDataPage = loadable(() => + import("../pages/PortalSettings/categories/delete-data") ); -const Backup = loadable(() => import("../pages/PortalSettings/categories/data-management/index")); -const DeleteDataPage = loadable(() => import("../pages/PortalSettings/categories/delete-data")); const RestoreBackup = loadable(() => - import("../pages/PortalSettings/categories/data-management/backup/restore-backup/index"), + import( + "../pages/PortalSettings/categories/data-management/backup/restore-backup/index" + ) ); const PortalSettingsRoutes = { @@ -211,6 +250,10 @@ const PortalSettingsRoutes = { path: "data-import/nextcloud", element: , }, + { + path: "data-import/onlyoffice", + element: , + }, { path: "developer-tools/webhooks", element: , diff --git a/public/images/googleworkspace.react.svg b/public/images/googleworkspace.react.svg deleted file mode 100644 index a36b119a3f..0000000000 --- a/public/images/googleworkspace.react.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/public/images/logo/workspace.svg b/public/images/logo/workspace.svg deleted file mode 100644 index b404d8f32b..0000000000 --- a/public/images/logo/workspace.svg +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/public/images/nextcloud.logo.react.svg b/public/images/nextcloud.logo.react.svg deleted file mode 100644 index d9fbc53170..0000000000 --- a/public/images/nextcloud.logo.react.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file From 430b1e9315d6a287dd8ff41071ffa6921d18dd21 Mon Sep 17 00:00:00 2001 From: Elyor Djalilov Date: Mon, 17 Jul 2023 19:10:01 +0500 Subject: [PATCH 006/335] added data-import children page --- .../client/src/pages/PortalSettings/utils/settingsTree.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/client/src/pages/PortalSettings/utils/settingsTree.js b/packages/client/src/pages/PortalSettings/utils/settingsTree.js index cb927bd8e0..c9f9e5bb1d 100644 --- a/packages/client/src/pages/PortalSettings/utils/settingsTree.js +++ b/packages/client/src/pages/PortalSettings/utils/settingsTree.js @@ -305,6 +305,14 @@ export const settingsTree = [ tKey: "DataImport", isCategory: true, }, + { + id: "portal-settings_catalog-onlyoffice-data-migration", + key: "5-2", + icon: "", + link: "onlyoffice", + tKey: "DataImport", + isCategory: true, + }, ], }, { From 8cb013d610710dfb46bd9a96fe5c50c59c562ce4 Mon Sep 17 00:00:00 2001 From: Elyor Djalilov Date: Mon, 17 Jul 2023 19:35:15 +0500 Subject: [PATCH 007/335] fixed first children page of data-import --- .../src/pages/PortalSettings/utils/settingsTree.js | 14 +++++++++++--- packages/client/src/routes/portalSettings.js | 8 ++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/packages/client/src/pages/PortalSettings/utils/settingsTree.js b/packages/client/src/pages/PortalSettings/utils/settingsTree.js index c9f9e5bb1d..d50ab166fc 100644 --- a/packages/client/src/pages/PortalSettings/utils/settingsTree.js +++ b/packages/client/src/pages/PortalSettings/utils/settingsTree.js @@ -290,16 +290,24 @@ export const settingsTree = [ isHeader: true, children: [ { - id: "portal-settings_catalog-google-data-migration", + id: "portal-settings_catalog-data-migration", key: "5-0", icon: "", + link: "migration", + tKey: "DataImport", + isCategory: true, + }, + { + id: "portal-settings_catalog-google-data-migration", + key: "5-1", + icon: "", link: "google", tKey: "DataImport", isCategory: true, }, { id: "portal-settings_catalog-nextcloud-data-migration", - key: "5-1", + key: "5-2", icon: "", link: "nextcloud", tKey: "DataImport", @@ -307,7 +315,7 @@ export const settingsTree = [ }, { id: "portal-settings_catalog-onlyoffice-data-migration", - key: "5-2", + key: "5-3", icon: "", link: "onlyoffice", tKey: "DataImport", diff --git a/packages/client/src/routes/portalSettings.js b/packages/client/src/routes/portalSettings.js index dc556f5455..0fa0cd0487 100644 --- a/packages/client/src/routes/portalSettings.js +++ b/packages/client/src/routes/portalSettings.js @@ -239,19 +239,19 @@ const PortalSettingsRoutes = { element: , }, { - path: "data-import", + path: "data-import/migration", element: , }, { - path: "data-import/google", + path: "data-import/migration/google", element: , }, { - path: "data-import/nextcloud", + path: "data-import/migration/nextcloud", element: , }, { - path: "data-import/onlyoffice", + path: "data-import/migration/onlyoffice", element: , }, { From 1c03c46cc004497a78ec7edf4341ec73cf457ac2 Mon Sep 17 00:00:00 2001 From: Elyor Djalilov Date: Mon, 17 Jul 2023 20:05:43 +0500 Subject: [PATCH 008/335] data-import refactoring --- .../categories/data-import/index.js | 61 +++++++++++-------- .../data-import/sub-components/serviceItem.js | 22 ------- 2 files changed, 37 insertions(+), 46 deletions(-) delete mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/sub-components/serviceItem.js diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/index.js index df161e381d..2c8b2870b7 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/index.js @@ -1,10 +1,12 @@ import { withTranslation } from "react-i18next"; import { useNavigate } from "react-router-dom"; import { inject, observer } from "mobx-react"; +import { ReactSVG } from "react-svg"; +import Link from "@docspace/components/link"; +import Box from "@docspace/components/box"; import Text from "@docspace/components/text"; import { StyledWrapper } from "./StyledDataImport"; -import ServiceItem from "./sub-components/serviceItem"; import WorkspaceGoogleSvgUrl from "PUBLIC_DIR/images/workspace.google.react.svg?url"; import WorkspaceNextcloudSvgUrl from "PUBLIC_DIR/images/workspace.nextcloud.react.svg?url"; @@ -14,14 +16,26 @@ const DataImport = (props) => { const { t } = props; const navigate = useNavigate(); - const redirectToGoogleMigration = () => { - navigate(window.location.pathname + `/google`); - }; - const redirectToNextcloudMigration = () => { - navigate(window.location.pathname + `/nextcloud`); - }; - const redirectToOnlyofficeMigration = () => { - navigate(window.location.pathname + `/onlyoffice`); + const services = [ + { id: 1, logo: WorkspaceGoogleSvgUrl, title: "google" }, + { id: 2, logo: WorkspaceNextcloudSvgUrl, title: "nextcloud" }, + { id: 3, logo: WorkspaceOnlyofficeeSvgUrl, title: "onlyoffice" }, + ]; + + const redirectToWorkspace = (title) => { + switch (title) { + case "google": + navigate(window.location.pathname + `/google`); + break; + case "nextcloud": + navigate(window.location.pathname + `/nextcloud`); + break; + case "onlyoffice": + navigate(window.location.pathname + `/onlyoffice`); + break; + default: + break; + } }; return ( @@ -34,21 +48,20 @@ const DataImport = (props) => {
- - - + {services.map((service) => ( + + + redirectToWorkspace(service.title)} + > + {t("Settings:Import")} + + + ))}
); diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/serviceItem.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/serviceItem.js deleted file mode 100644 index e40d85579c..0000000000 --- a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/serviceItem.js +++ /dev/null @@ -1,22 +0,0 @@ -import { ReactSVG } from "react-svg"; -import Link from "@docspace/components/link"; -import Box from "@docspace/components/box"; - -const ServiceItem = ({ t, logo, onClick }) => { - return ( - - - - {t("Settings:Import")} - - - ); -}; - -export default ServiceItem; From f452fd7aa47116659d9ec4df7b6160b93097765d Mon Sep 17 00:00:00 2001 From: Vladimir Khvan Date: Mon, 17 Jul 2023 20:13:19 +0500 Subject: [PATCH 009/335] import section component was added --- .../sub-components/importSection.js | 118 ++++++++++++++++++ public/images/arrow2.react.svg | 3 + 2 files changed, 121 insertions(+) create mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/sub-components/importSection.js create mode 100644 public/images/arrow2.react.svg diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/importSection.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/importSection.js new file mode 100644 index 0000000000..8c6c3ab42c --- /dev/null +++ b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/importSection.js @@ -0,0 +1,118 @@ +import React from "react"; +import Text from "@docspace/components/text"; +import ToggleButton from "@docspace/components/toggle-button"; +import styled from "styled-components"; +import ArrowSvg from "PUBLIC_DIR/images/arrow2.react.svg?url"; + +const SectionWrapper = styled.div` + width: 700px; + padding: 12px; + box-sizing: border-box; + display: flex; + justify-content: flex-start; + + border-radius: 6px; + background: #f8f9f9; + + .toggleButton { + position: relative; + margin-top: 0.5px; + } + + .description { + margin-top: 4px; + margin-bottom: 12px; + color: #333; + } +`; + +const FlexContainer = styled.div` + display: flex; +`; + +const ImportItemWrapper = styled.div` + padding-top: 8px; + + .importSection { + width: 160px; + height: 36px; + padding: 8px 12px; + box-sizing: border-box; + margin-top: 12px; + + border-radius: 3px; + background: #eceef1; + + color: #555f65; + font-weight: 600; + line-height: 20px; + + display: flex; + align-items: center; + + gap: 8px; + } +`; + +const ArrowWrapper = styled.div` + margin: 32px 12px 0; + height: 36px; + display: flex; + justify-content: center; + align-items: center; + width: 16px; +`; + +const ImportItem = ({ sectionName, sectionIcon, workspace }) => { + return ( + + + {workspace} + +
+ {sectionIcon && ( + {sectionName + )} + {sectionName} +
+
+ ); +}; + +const ImportSection = ({ + isDisabled, + isChecked, + onChange, + sectionName, + description, + exportSection, + importSection, +}) => { + return ( + + +
+ + {sectionName} + + + {description} + + + + + arrow + + + +
+
+ ); +}; + +export default ImportSection; diff --git a/public/images/arrow2.react.svg b/public/images/arrow2.react.svg new file mode 100644 index 0000000000..e23839024c --- /dev/null +++ b/public/images/arrow2.react.svg @@ -0,0 +1,3 @@ + + + From 6867b4d434cbecd69df3e4b89b9c1593da96721b Mon Sep 17 00:00:00 2001 From: Elyor Djalilov Date: Mon, 17 Jul 2023 20:59:36 +0500 Subject: [PATCH 010/335] added tKey for subroutes --- packages/client/public/locales/en/Settings.json | 3 +++ packages/client/public/locales/ru/Settings.json | 3 +++ .../PortalSettings/Layout/Article/Body/index.js | 14 +++++++++++++- .../PortalSettings/categories/data-import/index.js | 2 +- .../src/pages/PortalSettings/utils/settingsTree.js | 6 +++--- 5 files changed, 23 insertions(+), 5 deletions(-) diff --git a/packages/client/public/locales/en/Settings.json b/packages/client/public/locales/en/Settings.json index 94ad4ae154..c556af9f14 100644 --- a/packages/client/public/locales/en/Settings.json +++ b/packages/client/public/locales/en/Settings.json @@ -95,6 +95,9 @@ "EveryWeek": "Every week", "ForcePathStyle": "Force Path Style", "Import": "Import", + "ImportFromGoogle": "Import from Google Workspace", + "ImportFromNextcloud": "Import from Nextcloud Workspace", + "ImportFromOnlyoffice": "Import from Onlyoffice Workspace", "IPSecurity": "IP Security", "IPSecurityDescription": "IP Security is used to restrict login to the space from all IP addresses except certain addresses.", "IPSecurityHelper": "You can set the allowed IP addresses using either exact IP addresses in the IPv4 format (#.#.#.#, where # is a numeric value from 0 to 255) or IP range (in the #.#.#.#-#.#.#.# format).", diff --git a/packages/client/public/locales/ru/Settings.json b/packages/client/public/locales/ru/Settings.json index 7eee7f64c5..e267fc078f 100644 --- a/packages/client/public/locales/ru/Settings.json +++ b/packages/client/public/locales/ru/Settings.json @@ -95,6 +95,9 @@ "EveryWeek": "Каждую неделю", "ForcePathStyle": "Принудительно использовать стиль пути", "Import": "Импортировать", + "ImportFromGoogle": "Импортировать из Google Workspace", + "ImportFromNextcloud": "Импортировать из Nextcloud Workspace", + "ImportFromOnlyoffice": "Импортировать из Onlyoffice Workspace", "IPSecurity": "IP-безопасность", "IPSecurityDescription": "Настройки IP-безопасности используются для ограничения возможности входа на портал со всех IP-адресов, кроме указанных.", "IPSecurityHelper": "Вы можете задать разрешенные IP-адреса, указав конкретные значения IP-адресов в формате IPv4 (#.#.#.#, где # - это число от 0 до 255) или диапазон IP-адресов (в формате #.#.#.#-#.#.#.#).", diff --git a/packages/client/src/pages/PortalSettings/Layout/Article/Body/index.js b/packages/client/src/pages/PortalSettings/Layout/Article/Body/index.js index 96e0eb8923..86509529f9 100644 --- a/packages/client/src/pages/PortalSettings/Layout/Article/Body/index.js +++ b/packages/client/src/pages/PortalSettings/Layout/Article/Body/index.js @@ -59,6 +59,12 @@ const getTreeItems = (data, path, t) => { return t("DeveloperTools"); case "DataImport": return t("DataImport"); + case "ImportFromGoogle": + return t("ImportFromGoogle"); + case "ImportFromNextcloud": + return t("ImportFromNextcloud"); + case "ImportFromOnlyoffice": + return t("ImportFromOnlyoffice"); default: throw new Error("Unexpected translation key"); } @@ -175,7 +181,7 @@ const ArticleBodyContent = (props) => { setSelectedKeys(["4-0"]); } - if (location.pathname.includes("migration")) { + if (location.pathname.includes("data-import")) { setSelectedKeys(["5-0"]); } @@ -252,6 +258,12 @@ const ArticleBodyContent = (props) => { return t("DeveloperTools"); case "DataImport": return t("DataImport"); + case "ImportFromGoogle": + return t("ImportFromGoogle"); + case "ImportFromNextcloud": + return t("ImportFromNextcloud"); + case "ImportFromOnlyoffice": + return t("ImportFromOnlyoffice"); default: throw new Error("Unexpected translation key"); } diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/index.js index 2c8b2870b7..8cbb9d1905 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/index.js @@ -1,5 +1,5 @@ -import { withTranslation } from "react-i18next"; import { useNavigate } from "react-router-dom"; +import { withTranslation } from "react-i18next"; import { inject, observer } from "mobx-react"; import { ReactSVG } from "react-svg"; diff --git a/packages/client/src/pages/PortalSettings/utils/settingsTree.js b/packages/client/src/pages/PortalSettings/utils/settingsTree.js index d50ab166fc..00c61cda22 100644 --- a/packages/client/src/pages/PortalSettings/utils/settingsTree.js +++ b/packages/client/src/pages/PortalSettings/utils/settingsTree.js @@ -302,7 +302,7 @@ export const settingsTree = [ key: "5-1", icon: "", link: "google", - tKey: "DataImport", + tKey: "ImportFromGoogle", isCategory: true, }, { @@ -310,7 +310,7 @@ export const settingsTree = [ key: "5-2", icon: "", link: "nextcloud", - tKey: "DataImport", + tKey: "ImportFromNextcloud", isCategory: true, }, { @@ -318,7 +318,7 @@ export const settingsTree = [ key: "5-3", icon: "", link: "onlyoffice", - tKey: "DataImport", + tKey: "ImportFromOnlyoffice", isCategory: true, }, ], From 76cde1b25121caabebe6cf3e0b38a35d9be60d7f Mon Sep 17 00:00:00 2001 From: Elyor Djalilov Date: Tue, 18 Jul 2023 10:41:18 +0500 Subject: [PATCH 011/335] changed path to data-import sub-components --- .../client/public/locales/en/Settings.json | 1 + .../client/public/locales/ru/Settings.json | 1 + .../data-import/StyledDataImport.js | 16 ++++++++++++- .../categories/data-import/index.js | 1 + .../sub-components/googleWorkspace.js | 24 +++++++++++++++---- packages/client/src/routes/portalSettings.js | 6 ++--- 6 files changed, 41 insertions(+), 8 deletions(-) diff --git a/packages/client/public/locales/en/Settings.json b/packages/client/public/locales/en/Settings.json index c556af9f14..fa13b35a51 100644 --- a/packages/client/public/locales/en/Settings.json +++ b/packages/client/public/locales/en/Settings.json @@ -1,4 +1,5 @@ { + "AboutDataImport": "Data import is an asynchronous process. It includes several steps: data upload, parcing, import configuration, and import. Your backup file will be stored in ONLYOFFICE DocSpace servers for 24 hours, and then it will be automatically deleted.", "AccentColor": "Accent", "AccessRightsAccessToProduct": "Access to {{product}} module is given to", "AccessRightsAllUsers": "All {{users}}", diff --git a/packages/client/public/locales/ru/Settings.json b/packages/client/public/locales/ru/Settings.json index e267fc078f..26b8c9110b 100644 --- a/packages/client/public/locales/ru/Settings.json +++ b/packages/client/public/locales/ru/Settings.json @@ -1,4 +1,5 @@ { + "AboutDataImport": "Импорт данных — это асинхронный процесс. Он включает в себя несколько шагов: загрузка данных, парсинг, настройка импорта и импорт. Ваш файл резервной копии будет храниться на серверах ONLYOFFICE DocSpace в течение 24 часов, а затем будет автоматически удален.", "AccentColor": "Акцент", "AccessRightsAccessToProduct": "Доступ к модулю {{product}} предоставлен для", "AccessRightsAllUsers": "Всех участников со статусом {{users}}", diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js b/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js index 1acedf1a13..65fcfb1e1d 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js @@ -1,10 +1,16 @@ import styled from "styled-components"; +import { tablet, mobile } from "@docspace/components/utils/device"; const StyledWrapper = styled.div` max-width: 700px; + @media ${mobile} { + max-width: 343px; + } + .data-import-description { color: #657077; + line-height: 20px; margin-bottom: 20px; } @@ -15,7 +21,7 @@ const StyledWrapper = styled.div` .service-list { display: flex; align-items: center; - justify-content: space-between; + justify-content: flex-start; flex-wrap: wrap; gap: 20px; } @@ -34,6 +40,14 @@ const StyledWrapper = styled.div` &:hover { border-color: #4781d1; } + + @media ${tablet} { + width: 328px; + } + + @media ${mobile} { + width: 100%; + } } `; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/index.js index 8cbb9d1905..b7b7e073a1 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/index.js @@ -55,6 +55,7 @@ const DataImport = (props) => { type="page" fontWeight="600" color="#4781D1" + isHovered isTextOverflow onClick={() => redirectToWorkspace(service.title)} > diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/googleWorkspace.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/googleWorkspace.js index 18f50da27c..924c333ace 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/googleWorkspace.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/googleWorkspace.js @@ -1,7 +1,23 @@ -import React from "react"; +import { withTranslation } from "react-i18next"; +import { inject, observer } from "mobx-react"; -const GoogleWorkspace = () => { - return
Google workspace
; +import Text from "@docspace/components/text"; +import { StyledWrapper } from "../StyledDataImport"; + +const GoogleWorkspace = (props) => { + const { t } = props; + return ( + + + {t("Settings:AboutDataImport")} + + + ); }; -export default GoogleWorkspace; +export default inject(({ setup }) => { + const { initSettings } = setup; + return { + initSettings, + }; +})(withTranslation(["Settings"])(observer(GoogleWorkspace))); diff --git a/packages/client/src/routes/portalSettings.js b/packages/client/src/routes/portalSettings.js index 0fa0cd0487..6b9615fa95 100644 --- a/packages/client/src/routes/portalSettings.js +++ b/packages/client/src/routes/portalSettings.js @@ -87,17 +87,17 @@ const DataImport = loadable(() => ); const GoogleDataImport = loadable(() => import( - "../pages/PortalSettings/categories/data-import/sub-components/googleWorkspace.js" + "../pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace" ) ); const NextcloudDataImport = loadable(() => import( - "../pages/PortalSettings/categories/data-import/sub-components/nextcloudWorkspace.js" + "../pages/PortalSettings/categories/data-import/sub-components/NextcloudWorkspace" ) ); const OnlyofficeDataImport = loadable(() => import( - "../pages/PortalSettings/categories/data-import/sub-components/onlyofficeWorkspace.js" + "../pages/PortalSettings/categories/data-import/sub-components/OnlyofficeWorkspace" ) ); From 1db08e9361f8d031baf985fd64978e84a55ef0c0 Mon Sep 17 00:00:00 2001 From: Vladimir Khvan Date: Tue, 18 Jul 2023 11:47:02 +0500 Subject: [PATCH 012/335] file names' first letters were upper-cased --- .../sub-components/{googleWorkspace.js => GoogleWorkspace.js} | 0 .../sub-components/{importSection.js => ImportSection.js} | 0 .../{nextcloudWorkspace.js => NextcloudWorkspace.js} | 0 .../{onlyofficeWorkspace.js => OnlyofficeWorkspace.js} | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename packages/client/src/pages/PortalSettings/categories/data-import/sub-components/{googleWorkspace.js => GoogleWorkspace.js} (100%) rename packages/client/src/pages/PortalSettings/categories/data-import/sub-components/{importSection.js => ImportSection.js} (100%) rename packages/client/src/pages/PortalSettings/categories/data-import/sub-components/{nextcloudWorkspace.js => NextcloudWorkspace.js} (100%) rename packages/client/src/pages/PortalSettings/categories/data-import/sub-components/{onlyofficeWorkspace.js => OnlyofficeWorkspace.js} (100%) diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/googleWorkspace.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace.js similarity index 100% rename from packages/client/src/pages/PortalSettings/categories/data-import/sub-components/googleWorkspace.js rename to packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace.js diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/importSection.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/ImportSection.js similarity index 100% rename from packages/client/src/pages/PortalSettings/categories/data-import/sub-components/importSection.js rename to packages/client/src/pages/PortalSettings/categories/data-import/sub-components/ImportSection.js diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/nextcloudWorkspace.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/NextcloudWorkspace.js similarity index 100% rename from packages/client/src/pages/PortalSettings/categories/data-import/sub-components/nextcloudWorkspace.js rename to packages/client/src/pages/PortalSettings/categories/data-import/sub-components/NextcloudWorkspace.js diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/onlyofficeWorkspace.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/OnlyofficeWorkspace.js similarity index 100% rename from packages/client/src/pages/PortalSettings/categories/data-import/sub-components/onlyofficeWorkspace.js rename to packages/client/src/pages/PortalSettings/categories/data-import/sub-components/OnlyofficeWorkspace.js From 3221fc7f636427a96f392eb89b39ae5baf230340 Mon Sep 17 00:00:00 2001 From: Vladimir Khvan Date: Tue, 18 Jul 2023 12:11:57 +0500 Subject: [PATCH 013/335] routes nesting was fixed --- .../PortalSettings/utils/settingsTree.js | 50 ++++++++++--------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/packages/client/src/pages/PortalSettings/utils/settingsTree.js b/packages/client/src/pages/PortalSettings/utils/settingsTree.js index 00c61cda22..1e4a1ef7a7 100644 --- a/packages/client/src/pages/PortalSettings/utils/settingsTree.js +++ b/packages/client/src/pages/PortalSettings/utils/settingsTree.js @@ -296,30 +296,32 @@ export const settingsTree = [ link: "migration", tKey: "DataImport", isCategory: true, - }, - { - id: "portal-settings_catalog-google-data-migration", - key: "5-1", - icon: "", - link: "google", - tKey: "ImportFromGoogle", - isCategory: true, - }, - { - id: "portal-settings_catalog-nextcloud-data-migration", - key: "5-2", - icon: "", - link: "nextcloud", - tKey: "ImportFromNextcloud", - isCategory: true, - }, - { - id: "portal-settings_catalog-onlyoffice-data-migration", - key: "5-3", - icon: "", - link: "onlyoffice", - tKey: "ImportFromOnlyoffice", - isCategory: true, + children: [ + { + id: "portal-settings_catalog-google-data-migration", + key: "5-0-0", + icon: "", + link: "google", + tKey: "ImportFromGoogle", + isCategory: true, + }, + { + id: "portal-settings_catalog-nextcloud-data-migration", + key: "5-0-1", + icon: "", + link: "nextcloud", + tKey: "ImportFromNextcloud", + isCategory: true, + }, + { + id: "portal-settings_catalog-onlyoffice-data-migration", + key: "5-0-2", + icon: "", + link: "onlyoffice", + tKey: "ImportFromOnlyoffice", + isCategory: true, + }, + ], }, ], }, From 1bf2d75cdc6819ed8bca2bd54c6cca747d0342ee Mon Sep 17 00:00:00 2001 From: Vladimir Khvan Date: Tue, 18 Jul 2023 12:43:50 +0500 Subject: [PATCH 014/335] unchecked state was added --- .../sub-components/ImportSection.js | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/ImportSection.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/ImportSection.js index 8c6c3ab42c..524b9a5845 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/ImportSection.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/ImportSection.js @@ -1,7 +1,7 @@ import React from "react"; import Text from "@docspace/components/text"; import ToggleButton from "@docspace/components/toggle-button"; -import styled from "styled-components"; +import styled, { css } from "styled-components"; import ArrowSvg from "PUBLIC_DIR/images/arrow2.react.svg?url"; const SectionWrapper = styled.div` @@ -22,8 +22,21 @@ const SectionWrapper = styled.div` .description { margin-top: 4px; margin-bottom: 12px; - color: #333; } + + ${(props) => + !props.isChecked && + css` + .importSection { + color: #a3a9ae; + + svg { + path { + fill: #a3a9ae; + } + } + } + `} `; const FlexContainer = styled.div` @@ -43,7 +56,7 @@ const ImportItemWrapper = styled.div` border-radius: 3px; background: #eceef1; - color: #555f65; + color: "#555f65"; font-weight: 600; line-height: 20px; @@ -63,16 +76,14 @@ const ArrowWrapper = styled.div` width: 16px; `; -const ImportItem = ({ sectionName, sectionIcon, workspace }) => { +const ImportItem = ({ sectionName, SectionIcon, workspace }) => { return ( {workspace}
- {sectionIcon && ( - {sectionName - )} + {SectionIcon && } {sectionName}
@@ -89,7 +100,7 @@ const ImportSection = ({ importSection, }) => { return ( - + {sectionName} - + {description} From ea040f74d6c88ea96815b171ca19c09ec5af5f04 Mon Sep 17 00:00:00 2001 From: Elyor Djalilov Date: Tue, 18 Jul 2023 12:54:23 +0500 Subject: [PATCH 015/335] added googleWorkspace --- .../client/public/locales/en/Settings.json | 4 + .../client/public/locales/ru/Settings.json | 4 + .../sub-components/googleWorkspace.js | 98 ++++++++++++++++++- 3 files changed, 102 insertions(+), 4 deletions(-) diff --git a/packages/client/public/locales/en/Settings.json b/packages/client/public/locales/en/Settings.json index fa13b35a51..04c0b8492a 100644 --- a/packages/client/public/locales/en/Settings.json +++ b/packages/client/public/locales/en/Settings.json @@ -33,6 +33,7 @@ "AutoSavePeriod": "Autosave period", "AutoSavePeriodHelp": "The time shown below corresponds to the time zone set in the DocSpace.", "Backup": "Backup", + "BackupFile": "Backup file", "BackupCreatedError": "An error has been encountered. Please contact your administrator.", "BackupCreatedSuccess": "The backup copy has been successfully created.", "BackupList": "Backup List", @@ -160,6 +161,8 @@ "RestoreDefaultButton": "Restore to default", "RoomsModule": "Backup room", "RoomsModuleDescription": "You may create a new room specifically for the backup, choose one of the existing rooms, or save the copy in their {{roomName}} room.", + "SelectFileDescription": "Select the Google Workspace backup files to start the data import. Multiple files can be selected. Once the data upload and analysis are complete, the next step will be initiated automatically.", + "SelectFileTitle": "Choose the backup file", "SelectFileInGZFormat": "Select the file in .GZ format", "SendNotificationAboutRestoring": "Send notification about space restoring to users", "ServerSideEncryptionMethod": "Server Side Encryption Method", @@ -198,6 +201,7 @@ "TwoFactorAuthDescription": "Two-factor authentication provides a more secure way to log in. After entering the credentials, the user will have to enter a code from an SMS or the authentication app.", "TwoFactorAuthHelper": "Note: SMS messages can be sent if you have a positive balance only. You can always check your current balance in your SMS provider account. Do not forget to replenish your balance in good time.", "UploadBackupData": "Upload a backup copy from a desired service below to start migration.", + "UploadToServer": "Upload to server", "UseAsLogoButton": "Use as logo", "UseDigits": "Use digits", "UseHttp": "Use Http", diff --git a/packages/client/public/locales/ru/Settings.json b/packages/client/public/locales/ru/Settings.json index 26b8c9110b..33ace72a3e 100644 --- a/packages/client/public/locales/ru/Settings.json +++ b/packages/client/public/locales/ru/Settings.json @@ -33,6 +33,7 @@ "AutoSavePeriod": "Период автоматического сохранения", "AutoSavePeriodHelp": "Указанное ниже время соответствует часовому поясу, выставленному в DocSpace.", "Backup": "Резервное копирование", + "BackupFile": "Резервный файл", "BackupCreatedError": "Произошла ошибка. Пожалуйста, обратитесь к администратору.", "BackupCreatedSuccess": "Резервная копия успешно создана.", "BackupList": "Список резервных копий", @@ -160,6 +161,8 @@ "RestoreDefaultButton": "Настройки по умолчанию", "RoomsModule": "Резервная комната", "RoomsModuleDescription": "Вы можете создать новую комнату специально для резервного копирования, выбрать одну из существующих комнат или сохранить копию в {{roomName}}.", + "SelectFileDescription": "Выберите файлы резервных копий Google Workspace, чтобы начать импорт данных. Можно выбрать несколько файлов. После завершения загрузки и анализа данных следующий шаг будет инициирован автоматически.", + "SelectFileTitle": "Выберите файл резервной копии", "SelectFileInGZFormat": "Выбрать файл в формате .GZ", "SendNotificationAboutRestoring": "Оповестить пользователей о восстановлении портала", "ServerSideEncryptionMethod": "Метод шифрования на стороне сервера", @@ -198,6 +201,7 @@ "TwoFactorAuthDescription": "Двухфакторная аутентификация обеспечивает более безопасный способ входа на портал. После ввода учетных данных пользователь должен будет ввести код из SMS или приложения для аутентификации.", "TwoFactorAuthHelper": "Обратите внимание: отправка SMS-сообщений осуществляется только при положительном балансе. Вы всегда можете проверить текущий баланс в учетной записи вашего SMS-провайдера. Не забывайте своевременно пополнять баланс.", "UploadBackupData": "Загрузите резервную копию из нужного сервиса ниже, чтобы начать миграцию.", + "UploadToServer": "Загрузить на сервер", "UseAsLogoButton": "Использовать как логотип", "UseDigits": "Использовать цифры", "UseHttp": "Использовать Http", diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/googleWorkspace.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/googleWorkspace.js index 924c333ace..530fc0eef8 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/googleWorkspace.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/googleWorkspace.js @@ -1,17 +1,107 @@ import { withTranslation } from "react-i18next"; import { inject, observer } from "mobx-react"; +import { isMobile } from "react-device-detect"; +import { mobile } from "@docspace/components/utils/device"; +import styled from "styled-components"; +import BreakpointWarning from "SRC_DIR/components/BreakpointWarning"; +import SaveCancelButtons from "@docspace/components/save-cancel-buttons"; +import FileInput from "@docspace/components/file-input"; import Text from "@docspace/components/text"; -import { StyledWrapper } from "../StyledDataImport"; +import Box from "@docspace/components/box"; + +const WorkspaceWrapper = styled.div` + max-width: 700px; + + @media ${mobile} { + max-width: 343px; + } + + .data-import-description { + color: #657077; + line-height: 20px; + margin-bottom: 20px; + } + + .select-file-counter { + margin-right: 5px; + font-weight: 700; + font-size: 16px; + } + + .select-file-wrapper { + max-width: 350px; + } + + .select-file-description { + font-size: 12px; + margin-bottom: 16px; + line-height: 16px; + color: #333333; + } + + .select-file-title { + font-weight: 600; + line-height: 20px; + margin-bottom: 4px; + } + + .upload-backup-input { + height: 32px; + margin-bottom: 16px; + } +`; const GoogleWorkspace = (props) => { const { t } = props; + + const onClickInput = (file) => { + let data = new FormData(); + data.append("file", file); + + console.log(data); + }; + + if (isMobile) + return ; + return ( - + {t("Settings:AboutDataImport")} - + + 1/6. + + {t("Common:SelectFile")} + + + + {t("Settings:SelectFileDescription")} + + + + + {t("Settings:SelectFileTitle")} + + + console.log("save")} + onCancelClick={() => console.log("cancel")} + showReminder={false} + reminderTest={t("Settings:YouHaveUnsavedChanges")} + saveButtonLabel={t("Settings:UploadToServer")} + cancelButtonLabel={t("Common:Back")} + displaySettings={true} + /> + + ); }; @@ -20,4 +110,4 @@ export default inject(({ setup }) => { return { initSettings, }; -})(withTranslation(["Settings"])(observer(GoogleWorkspace))); +})(withTranslation(["Common, Settings"])(observer(GoogleWorkspace))); From 7eab311e24d0a78c2bfeb551bbcc7e3a1a41ac02 Mon Sep 17 00:00:00 2001 From: Vladimir Khvan Date: Tue, 18 Jul 2023 13:11:37 +0500 Subject: [PATCH 016/335] styles were corrected / on service block click redirection was added --- .../data-import/StyledDataImport.js | 15 +++++++++++++- .../categories/data-import/index.js | 20 +++++++------------ 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js b/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js index 65fcfb1e1d..d1613f69eb 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js @@ -3,19 +3,26 @@ import { tablet, mobile } from "@docspace/components/utils/device"; const StyledWrapper = styled.div` max-width: 700px; + margin-top: 4px; @media ${mobile} { max-width: 343px; } + .service-icon { + display: flex; + align-items: center; + } + .data-import-description { color: #657077; line-height: 20px; margin-bottom: 20px; + max-width: 675px; } .start-migration-text { - margin-bottom: 20px; + margin-bottom: 21px; } .service-list { @@ -37,10 +44,16 @@ const StyledWrapper = styled.div` align-items: center; justify-content: space-between; + cursor: pointer; + &:hover { border-color: #4781d1; } + &:active { + background-color: #eceef1; + } + @media ${tablet} { width: 328px; } diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/index.js index b7b7e073a1..b37f2e8af9 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/index.js @@ -40,25 +40,19 @@ const DataImport = (props) => { return ( - - {t("Settings:DataImportDescription")} - + {t("Settings:DataImportDescription")} {t("Settings:UploadBackupData")}
{services.map((service) => ( - - - redirectToWorkspace(service.title)} - > + redirectToWorkspace(service.title)}> + + {t("Settings:Import")} From 9411969debc0dc4278a7013f142ad92a2f1535bb Mon Sep 17 00:00:00 2001 From: Vladimir Khvan Date: Tue, 18 Jul 2023 15:08:56 +0500 Subject: [PATCH 017/335] base page was added --- .../sub-components/NextcloudWorkspace.js | 38 +++++++++++++++++-- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/NextcloudWorkspace.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/NextcloudWorkspace.js index 3aeb401935..c0f2165abb 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/NextcloudWorkspace.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/NextcloudWorkspace.js @@ -1,7 +1,37 @@ -import React from "react"; +import React, { useState } from "react"; +import { withTranslation } from "react-i18next"; +import { inject, observer } from "mobx-react"; -const NextcloudWorkspace = () => { - return
Nextcloud workspace
; +import ImportSection from "./ImportSection"; +import Text from "@docspace/components/text"; + +import PeopleIcon from "PUBLIC_DIR/images/catalog.accounts.react.svg"; + +const NextcloudWorkspace = (props) => { + const { t } = props; + const [isChecked, setIsChecked] = useState(false); + + const onChange = () => { + setIsChecked((prevIsChecked) => !prevIsChecked); + }; + return ( +
+ {t("Settings:AboutDataImport")} + +
+ ); }; -export default NextcloudWorkspace; +export default inject(({ setup }) => { + const { initSettings } = setup; + return { + initSettings, + }; +})(withTranslation(["Common, Settings"])(observer(NextcloudWorkspace))); From 52c913f8555365720c536f21378ffb24ce928b6d Mon Sep 17 00:00:00 2001 From: Elyor Djalilov Date: Wed, 19 Jul 2023 11:15:25 +0500 Subject: [PATCH 018/335] changed structure --- .../client/public/locales/en/Settings.json | 1 + .../client/public/locales/ru/Settings.json | 1 + .../data-import/StyledDataImport.js | 47 +++++++- .../categories/data-import/index.js | 6 +- .../sub-components/GoogleWorkspace.js | 113 ------------------ .../GoogleWorkspace/FileUpload.js | 32 +++++ .../GoogleWorkspace/SelectUsersTable.js | 5 + .../sub-components/GoogleWorkspace/index.js | 91 ++++++++++++++ .../index.js} | 2 - .../index.js} | 4 +- packages/client/src/routes/portalSettings.js | 6 +- 11 files changed, 182 insertions(+), 126 deletions(-) delete mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace.js create mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/FileUpload.js create mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/SelectUsersTable.js create mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/index.js rename packages/client/src/pages/PortalSettings/categories/data-import/sub-components/{NextcloudWorkspace.js => NextCloudWorkspace/index.js} (80%) rename packages/client/src/pages/PortalSettings/categories/data-import/sub-components/{OnlyofficeWorkspace.js => OnlyofficeWorkspace/index.js} (52%) diff --git a/packages/client/public/locales/en/Settings.json b/packages/client/public/locales/en/Settings.json index 04c0b8492a..8d7261eb78 100644 --- a/packages/client/public/locales/en/Settings.json +++ b/packages/client/public/locales/en/Settings.json @@ -127,6 +127,7 @@ "ManualBackupHelp": "Data Backup option is used to back up the space data to be able to restore it later to your local server.", "MaxCopies": "{{copiesCount}} - maximum number of backup copies", "Migration": "Migration", + "NextStep": "Next step", "NewColorScheme": "New color scheme", "PasswordMinLenght": "Minimal password length", "Path": "Path", diff --git a/packages/client/public/locales/ru/Settings.json b/packages/client/public/locales/ru/Settings.json index 33ace72a3e..2128ebc6fc 100644 --- a/packages/client/public/locales/ru/Settings.json +++ b/packages/client/public/locales/ru/Settings.json @@ -127,6 +127,7 @@ "ManualBackupHelp": "Опция Резервное копирование данных используется для создания резервной копии данных, чтобы в дальнейшем их можно было восстановить на локальном сервере.", "MaxCopies": "{{copiesCount}} - максимальное число копий", "Migration": "Миграция", + "NextStep": "Следующий шаг", "NewColorScheme": "Новая цветовая схема", "PasswordMinLenght": "Минимальная длина пароля", "Path": "Путь", diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js b/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js index d1613f69eb..1214b5bdc2 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js @@ -1,7 +1,7 @@ import styled from "styled-components"; import { tablet, mobile } from "@docspace/components/utils/device"; -const StyledWrapper = styled.div` +const DataImportWrapper = styled.div` max-width: 700px; margin-top: 4px; @@ -64,4 +64,47 @@ const StyledWrapper = styled.div` } `; -export { StyledWrapper }; +const WorkspaceWrapper = styled.div` + max-width: 700px; + margin-top: 4px; + + @media ${mobile} { + max-width: 343px; + } + + .data-import-description { + color: #657077; + line-height: 20px; + margin-bottom: 20px; + } + + .step-counter { + margin-right: 5px; + font-weight: 700; + font-size: 16px; + } + + .select-file-wrapper { + max-width: 350px; + } + + .select-file-description { + font-size: 12px; + margin-bottom: 16px; + line-height: 16px; + color: #333333; + } + + .select-file-title { + font-weight: 600; + line-height: 20px; + margin-bottom: 4px; + } + + .upload-backup-input { + height: 32px; + margin-bottom: 16px; + } +`; + +export { DataImportWrapper, WorkspaceWrapper }; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/index.js index b37f2e8af9..217add361f 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/index.js @@ -6,7 +6,7 @@ import { ReactSVG } from "react-svg"; import Link from "@docspace/components/link"; import Box from "@docspace/components/box"; import Text from "@docspace/components/text"; -import { StyledWrapper } from "./StyledDataImport"; +import { DataImportWrapper } from "./StyledDataImport"; import WorkspaceGoogleSvgUrl from "PUBLIC_DIR/images/workspace.google.react.svg?url"; import WorkspaceNextcloudSvgUrl from "PUBLIC_DIR/images/workspace.nextcloud.react.svg?url"; @@ -39,7 +39,7 @@ const DataImport = (props) => { }; return ( - + {t("Settings:DataImportDescription")} {t("Settings:UploadBackupData")} @@ -58,7 +58,7 @@ const DataImport = (props) => {
))}
-
+ ); }; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace.js deleted file mode 100644 index 530fc0eef8..0000000000 --- a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace.js +++ /dev/null @@ -1,113 +0,0 @@ -import { withTranslation } from "react-i18next"; -import { inject, observer } from "mobx-react"; -import { isMobile } from "react-device-detect"; -import { mobile } from "@docspace/components/utils/device"; -import styled from "styled-components"; - -import BreakpointWarning from "SRC_DIR/components/BreakpointWarning"; -import SaveCancelButtons from "@docspace/components/save-cancel-buttons"; -import FileInput from "@docspace/components/file-input"; -import Text from "@docspace/components/text"; -import Box from "@docspace/components/box"; - -const WorkspaceWrapper = styled.div` - max-width: 700px; - - @media ${mobile} { - max-width: 343px; - } - - .data-import-description { - color: #657077; - line-height: 20px; - margin-bottom: 20px; - } - - .select-file-counter { - margin-right: 5px; - font-weight: 700; - font-size: 16px; - } - - .select-file-wrapper { - max-width: 350px; - } - - .select-file-description { - font-size: 12px; - margin-bottom: 16px; - line-height: 16px; - color: #333333; - } - - .select-file-title { - font-weight: 600; - line-height: 20px; - margin-bottom: 4px; - } - - .upload-backup-input { - height: 32px; - margin-bottom: 16px; - } -`; - -const GoogleWorkspace = (props) => { - const { t } = props; - - const onClickInput = (file) => { - let data = new FormData(); - data.append("file", file); - - console.log(data); - }; - - if (isMobile) - return ; - - return ( - - - {t("Settings:AboutDataImport")} - - - 1/6. - - {t("Common:SelectFile")} - - - - {t("Settings:SelectFileDescription")} - - - - - {t("Settings:SelectFileTitle")} - - - console.log("save")} - onCancelClick={() => console.log("cancel")} - showReminder={false} - reminderTest={t("Settings:YouHaveUnsavedChanges")} - saveButtonLabel={t("Settings:UploadToServer")} - cancelButtonLabel={t("Common:Back")} - displaySettings={true} - /> - - - ); -}; - -export default inject(({ setup }) => { - const { initSettings } = setup; - return { - initSettings, - }; -})(withTranslation(["Common, Settings"])(observer(GoogleWorkspace))); diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/FileUpload.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/FileUpload.js new file mode 100644 index 0000000000..f0f7edfff9 --- /dev/null +++ b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/FileUpload.js @@ -0,0 +1,32 @@ +import Text from "@docspace/components/text"; +import Box from "@docspace/components/box"; +import FileInput from "@docspace/components/file-input"; + +const FileUpload = ({ t, setShowReminder }) => { + const onClickInput = (file) => { + let data = new FormData(); + data.append("file", file); + setShowReminder(true); + }; + + return ( + <> + + {t("Settings:SelectFileDescription")} + + + + {t("Settings:SelectFileTitle")} + + + + + ); +}; + +export default FileUpload; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/SelectUsersTable.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/SelectUsersTable.js new file mode 100644 index 0000000000..a4fb7bd5c7 --- /dev/null +++ b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/SelectUsersTable.js @@ -0,0 +1,5 @@ +const SelectUsersTable = () => { + return
SelectUsersTable
; +}; + +export default SelectUsersTable; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/index.js new file mode 100644 index 0000000000..92387db713 --- /dev/null +++ b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/index.js @@ -0,0 +1,91 @@ +import { useState } from "react"; +import { withTranslation } from "react-i18next"; +import { inject, observer } from "mobx-react"; +import { isMobile } from "react-device-detect"; + +import FileUpload from "./FileUpload"; +import BreakpointWarning from "SRC_DIR/components/BreakpointWarning"; +import SaveCancelButtons from "@docspace/components/save-cancel-buttons"; +import Text from "@docspace/components/text"; +import Box from "@docspace/components/box"; + +import { WorkspaceWrapper } from "../../StyledDataImport"; + +const GoogleWorkspace = (props) => { + const [showReminder, setShowReminder] = useState(false); + const [currentStep, setCurrentStep] = useState(1); + const { t } = props; + + const steps = [1, 2, 3, 4, 5, 6]; + + const getStepContent = (stepIndex) => { + switch (stepIndex) { + case 1: + return ; + case 2: + return 2 Step; + case 3: + return 3 Step; + case 4: + return 4 Step; + case 5: + return 5 Step; + case 6: + return 6 Step; + default: + break; + } + }; + + const isFirstStep = currentStep === 1; + + const saveButtonText = isFirstStep + ? t("Settings:UploadToServer") + : t("Settings:NextStep"); + + const onSaveClick = () => { + setCurrentStep((prev) => prev + 1); + }; + + const onCancelClick = () => { + setCurrentStep((prev) => prev - 1); + }; + + if (isMobile) + return ; + + return ( + + + {t("Settings:AboutDataImport")} + + + + {currentStep}/{steps.length}. + + + {t("Common:SelectFile")} + + + + {getStepContent(currentStep)} + + + + ); +}; + +export default inject(({ setup }) => { + const { initSettings } = setup; + return { + initSettings, + }; +})(withTranslation(["Common, Settings"])(observer(GoogleWorkspace))); diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/NextcloudWorkspace.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/NextCloudWorkspace/index.js similarity index 80% rename from packages/client/src/pages/PortalSettings/categories/data-import/sub-components/NextcloudWorkspace.js rename to packages/client/src/pages/PortalSettings/categories/data-import/sub-components/NextCloudWorkspace/index.js index 3aeb401935..426a990abc 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/NextcloudWorkspace.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/NextCloudWorkspace/index.js @@ -1,5 +1,3 @@ -import React from "react"; - const NextcloudWorkspace = () => { return
Nextcloud workspace
; }; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/OnlyofficeWorkspace.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/OnlyofficeWorkspace/index.js similarity index 52% rename from packages/client/src/pages/PortalSettings/categories/data-import/sub-components/OnlyofficeWorkspace.js rename to packages/client/src/pages/PortalSettings/categories/data-import/sub-components/OnlyofficeWorkspace/index.js index e6a035949d..1683c39b30 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/OnlyofficeWorkspace.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/OnlyofficeWorkspace/index.js @@ -1,6 +1,4 @@ -import React from "react"; - const OnlyofficeWorkspace = () => { - return
onlyofficeWorkspace
; + return
Onlyoffice workspace
; }; export default OnlyofficeWorkspace; diff --git a/packages/client/src/routes/portalSettings.js b/packages/client/src/routes/portalSettings.js index 6b9615fa95..b44b9bfd0e 100644 --- a/packages/client/src/routes/portalSettings.js +++ b/packages/client/src/routes/portalSettings.js @@ -87,17 +87,17 @@ const DataImport = loadable(() => ); const GoogleDataImport = loadable(() => import( - "../pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace" + "../pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/index.js" ) ); const NextcloudDataImport = loadable(() => import( - "../pages/PortalSettings/categories/data-import/sub-components/NextcloudWorkspace" + "../pages/PortalSettings/categories/data-import/sub-components/NextCloudWorkspace/index.js" ) ); const OnlyofficeDataImport = loadable(() => import( - "../pages/PortalSettings/categories/data-import/sub-components/OnlyofficeWorkspace" + "../pages/PortalSettings/categories/data-import/sub-components/OnlyofficeWorkspace/index.js" ) ); From 716597cdb5262323c6f2c2481e8f4dc8d3da8701 Mon Sep 17 00:00:00 2001 From: Vladimir Khvan Date: Wed, 19 Jul 2023 12:24:33 +0500 Subject: [PATCH 019/335] data-import step was created --- .../NextCloudWorkspace/index.js | 102 +++++++++++++++--- 1 file changed, 89 insertions(+), 13 deletions(-) diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/NextCloudWorkspace/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/NextCloudWorkspace/index.js index c0f2165abb..b5935ce63e 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/NextCloudWorkspace/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/NextCloudWorkspace/index.js @@ -1,4 +1,5 @@ import React, { useState } from "react"; +import styled from "styled-components"; import { withTranslation } from "react-i18next"; import { inject, observer } from "mobx-react"; @@ -6,26 +7,101 @@ import ImportSection from "./ImportSection"; import Text from "@docspace/components/text"; import PeopleIcon from "PUBLIC_DIR/images/catalog.accounts.react.svg"; +import UserIcon from "PUBLIC_DIR/images/catalog.user.react.svg"; +import SaveCancelButtons from "@docspace/components/save-cancel-buttons"; + +const NextcloudWrapper = styled.div` + max-width: 700px; + + .data-import-counter { + margin-top: 20px; + margin-bottom: 8px; + } + + .data-import-section-description { + margin-bottom: 16px; + } + + .sections-wrapper { + display: flex; + flex-direction: column; + gap: 12px; + } + + .save-cancel-buttons { + margin-top: 22px; + } +`; const NextcloudWorkspace = (props) => { const { t } = props; - const [isChecked, setIsChecked] = useState(false); + const [isChecked, setIsChecked] = useState({ users: true, pFiles: true, sFiles: true }); - const onChange = () => { - setIsChecked((prevIsChecked) => !prevIsChecked); + const onChange = (name) => { + setIsChecked((prevIsChecked) => ({ ...prevIsChecked, [name]: !prevIsChecked[name] })); }; return ( -
- {t("Settings:AboutDataImport")} - + + {t("Settings:AboutDataImport")} + + + 5/7. Data import + + + Select sections for import. They will appear in the corresponding sections of DocSpace. + +
+ onChange("users")} + sectionName="Users" + description="Section “Users” includes the users you selected in the previous step. By default, it is always enabled and can’t be unselected. " + exportSection={{ sectionName: "Users", workspace: "NextCloud" }} + importSection={{ + sectionName: "Accounts", + workspace: "DocSpace", + SectionIcon: PeopleIcon, + }} + isDisabled + /> + onChange("pFiles")} + sectionName="Personal files" + description={`Files and documents of Nextcloud users will be imported into the users' "My Documents" section.`} + exportSection={{ sectionName: "User’s Files", workspace: "NextCloud" }} + importSection={{ + sectionName: "Accounts", + workspace: "My documents", + SectionIcon: UserIcon, + }} + /> + onChange("sFiles")} + sectionName="Shared files" + description="Files shared with other users will be copied to their personal documents regardless of the permission level in Nextcloud. " + exportSection={{ sectionName: "Shared Files", workspace: "NextCloud" }} + importSection={{ + sectionName: "My documents", + workspace: "DocSpace", + SectionIcon: PeopleIcon, + }} + /> +
+ console.log("save")} + onCancelClick={() => console.log("cancel")} + showReminder={true} + // reminderTest={t("Settings:YouHaveUnsavedChanges")} + saveButtonLabel={"Next step"} + cancelButtonLabel={t("Common:Back")} + displaySettings={true} + cancelEnable /> -
+ ); }; From 5e0d199d52ea6513b396ce4f3395448507ebcc44 Mon Sep 17 00:00:00 2001 From: Elyor Djalilov Date: Mon, 24 Jul 2023 16:34:30 +0500 Subject: [PATCH 020/335] fixed path to ImportSection component --- .../NextCloudWorkspace/index.js | 39 +++++++++++++++---- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/NextCloudWorkspace/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/NextCloudWorkspace/index.js index b5935ce63e..3170a7410d 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/NextCloudWorkspace/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/NextCloudWorkspace/index.js @@ -3,7 +3,7 @@ import styled from "styled-components"; import { withTranslation } from "react-i18next"; import { inject, observer } from "mobx-react"; -import ImportSection from "./ImportSection"; +import ImportSection from "../ImportSection"; import Text from "@docspace/components/text"; import PeopleIcon from "PUBLIC_DIR/images/catalog.accounts.react.svg"; @@ -35,21 +35,38 @@ const NextcloudWrapper = styled.div` const NextcloudWorkspace = (props) => { const { t } = props; - const [isChecked, setIsChecked] = useState({ users: true, pFiles: true, sFiles: true }); + const [isChecked, setIsChecked] = useState({ + users: true, + pFiles: true, + sFiles: true, + }); const onChange = (name) => { - setIsChecked((prevIsChecked) => ({ ...prevIsChecked, [name]: !prevIsChecked[name] })); + setIsChecked((prevIsChecked) => ({ + ...prevIsChecked, + [name]: !prevIsChecked[name], + })); }; return ( - + {t("Settings:AboutDataImport")} - + 5/7. Data import - Select sections for import. They will appear in the corresponding sections of DocSpace. + Select sections for import. They will appear in the corresponding + sections of DocSpace.
{ onChange={() => onChange("pFiles")} sectionName="Personal files" description={`Files and documents of Nextcloud users will be imported into the users' "My Documents" section.`} - exportSection={{ sectionName: "User’s Files", workspace: "NextCloud" }} + exportSection={{ + sectionName: "User’s Files", + workspace: "NextCloud", + }} importSection={{ sectionName: "Accounts", workspace: "My documents", @@ -82,7 +102,10 @@ const NextcloudWorkspace = (props) => { onChange={() => onChange("sFiles")} sectionName="Shared files" description="Files shared with other users will be copied to their personal documents regardless of the permission level in Nextcloud. " - exportSection={{ sectionName: "Shared Files", workspace: "NextCloud" }} + exportSection={{ + sectionName: "Shared Files", + workspace: "NextCloud", + }} importSection={{ sectionName: "My documents", workspace: "DocSpace", From 84ad1f41eafa300063cb92b3441a113dc008dbe5 Mon Sep 17 00:00:00 2001 From: Elyor Djalilov Date: Mon, 24 Jul 2023 23:03:32 +0500 Subject: [PATCH 021/335] added table to 2 step --- .../client/public/locales/en/Settings.json | 4 +- .../client/public/locales/ru/Settings.json | 4 +- .../data-import/StyledDataImport.js | 10 +- .../GoogleWorkspace/FileUpload.js | 10 +- .../GWTable/GWRowView/index.js | 7 ++ .../GWTable/GWTableView/GWTableHeader.js | 103 ++++++++++++++++++ .../GWTable/GWTableView/GWTableRow.js | 75 +++++++++++++ .../GWTable/GWTableView/index.js | 101 +++++++++++++++++ .../GoogleWorkspace/GWTable/index.js | 53 +++++++++ .../GoogleWorkspace/SelectUsersTable.js | 5 - .../sub-components/GoogleWorkspace/index.js | 60 +++++++--- .../GoogleWorkspace/mockData.js | 20 ++++ 12 files changed, 424 insertions(+), 28 deletions(-) create mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWRowView/index.js create mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/GWTableHeader.js create mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/GWTableRow.js create mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/index.js create mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/index.js delete mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/SelectUsersTable.js create mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/mockData.js diff --git a/packages/client/public/locales/en/Settings.json b/packages/client/public/locales/en/Settings.json index 8d7261eb78..2ee1b051cd 100644 --- a/packages/client/public/locales/en/Settings.json +++ b/packages/client/public/locales/en/Settings.json @@ -65,6 +65,7 @@ "CustomTitlesSettingsTooltipDescription": "Enter the name you like in the <1>{{ header }} field.", "CustomTitlesText": "Welcome Page", "CustomTitlesWelcome": "Welcome Page Settings", + "ChooseBackupFile": "Choose the backup file", "DataBackup": "Data backup", "DataImport": "Data import", "DataImportDescription": "Import data from a third party service to ONLYOFFICE DocSpace. Data import allows transferring data such as all users, their personal and shared documents.", @@ -163,8 +164,9 @@ "RoomsModule": "Backup room", "RoomsModuleDescription": "You may create a new room specifically for the backup, choose one of the existing rooms, or save the copy in their {{roomName}} room.", "SelectFileDescription": "Select the Google Workspace backup files to start the data import. Multiple files can be selected. Once the data upload and analysis are complete, the next step will be initiated automatically.", - "SelectFileTitle": "Choose the backup file", "SelectFileInGZFormat": "Select the file in .GZ format", + "SelectUsers": "Select users", + "SelectUsersDescription": "Check users from the list to import into ONLYOFFICE DocSpace. Users from Google Workspace will be imported without First Name / Last Name, and their email name will be used instead. Names of the users can be changed after the import. Users already existing in ONLYOFFICE DocSpace are highlighted with a green color and are not checked by default.", "SendNotificationAboutRestoring": "Send notification about space restoring to users", "ServerSideEncryptionMethod": "Server Side Encryption Method", "ServiceUrl": "Service Url", diff --git a/packages/client/public/locales/ru/Settings.json b/packages/client/public/locales/ru/Settings.json index 2128ebc6fc..63cde207f1 100644 --- a/packages/client/public/locales/ru/Settings.json +++ b/packages/client/public/locales/ru/Settings.json @@ -65,6 +65,7 @@ "CustomTitlesSettingsTooltipDescription": "Введите в поле <1>{{ header }} нужное название.", "CustomTitlesText": "странице приветствия", "CustomTitlesWelcome": "Настройки страницы приветствия", + "ChooseBackupFile": "Выберите файл резервной копии", "DataBackup": "Резервное копирование данных", "DataImport": "Перенос данных", "DataImportDescription": "Импорт данных из стороннего сервиса в ONLYOFFICE DocSpace. Импорт данных позволяет передавать такие данные, как все пользователи, их личные и общие документы.", @@ -163,8 +164,9 @@ "RoomsModule": "Резервная комната", "RoomsModuleDescription": "Вы можете создать новую комнату специально для резервного копирования, выбрать одну из существующих комнат или сохранить копию в {{roomName}}.", "SelectFileDescription": "Выберите файлы резервных копий Google Workspace, чтобы начать импорт данных. Можно выбрать несколько файлов. После завершения загрузки и анализа данных следующий шаг будет инициирован автоматически.", - "SelectFileTitle": "Выберите файл резервной копии", "SelectFileInGZFormat": "Выбрать файл в формате .GZ", + "SelectUsers": "Выберите пользователей", + "SelectUsersDescription": "Отметьте пользователей из списка для импорта в ONLYOFFICE DocSpace. Пользователи из Google Workspace будут импортированы без имени/фамилии, вместо них будет использоваться их имя электронной почты. Имена пользователей могут быть изменены после импорта. Пользователи, уже существующие в ONLYOFFICE DocSpace, выделяются зеленым цветом и по умолчанию не проверяются.", "SendNotificationAboutRestoring": "Оповестить пользователей о восстановлении портала", "ServerSideEncryptionMethod": "Метод шифрования на стороне сервера", "ServiceUrl": "Url-адрес сервиса", diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js b/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js index 1214b5bdc2..06a97bc25b 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js @@ -65,13 +65,17 @@ const DataImportWrapper = styled.div` `; const WorkspaceWrapper = styled.div` - max-width: 700px; margin-top: 4px; @media ${mobile} { max-width: 343px; } + .header-content, + .description-wrapper { + max-width: 700px; + } + .data-import-description { color: #657077; line-height: 20px; @@ -88,14 +92,14 @@ const WorkspaceWrapper = styled.div` max-width: 350px; } - .select-file-description { + .step-description { font-size: 12px; margin-bottom: 16px; line-height: 16px; color: #333333; } - .select-file-title { + .choose-backup-file { font-weight: 600; line-height: 20px; margin-bottom: 4px; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/FileUpload.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/FileUpload.js index f0f7edfff9..6d07a55d52 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/FileUpload.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/FileUpload.js @@ -10,13 +10,13 @@ const FileUpload = ({ t, setShowReminder }) => { }; return ( - <> - + + {t("Settings:SelectFileDescription")} - - {t("Settings:SelectFileTitle")} + + {t("Settings:ChooseBackupFile")} { scale /> - + ); }; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWRowView/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWRowView/index.js new file mode 100644 index 0000000000..02ebe646f6 --- /dev/null +++ b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWRowView/index.js @@ -0,0 +1,7 @@ +import React from "react"; + +const GWRowView = () => { + return
GWRowView
; +}; + +export default GWRowView; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/GWTableHeader.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/GWTableHeader.js new file mode 100644 index 0000000000..2fe9870872 --- /dev/null +++ b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/GWTableHeader.js @@ -0,0 +1,103 @@ +import { useState } from "react"; +import { inject, observer } from "mobx-react"; + +import TableHeader from "@docspace/components/table-container/TableHeader"; + +const TABLE_VERSION = "6"; +const TABLE_COLUMNS = `GoogleWorkspaceColumns_ver-${TABLE_VERSION}`; + +const getColumns = (defaultColumns, userId) => { + const storageColumns = localStorage.getItem(`${TABLE_COLUMNS}=${userId}`); + const columns = []; + + if (storageColumns) { + const splitColumns = storageColumns.split(","); + + for (let col of defaultColumns) { + const column = splitColumns.find((key) => key === col.key); + column ? (col.enable = true) : (col.enable = false); + + columns.push(col); + } + return columns; + } else { + return defaultColumns; + } +}; + +const GWTableHeader = (props) => { + const { + userId, + sectionWidth, + tableRef, + columnStorageName, + columnInfoPanelStorageName, + setHideColumns, + } = props; + + const defaultColumns = [ + { + key: "Name", + title: "Name", + resizable: true, + enable: true, + default: true, + active: true, + minWidth: 180, + onChange: onColumnChange, + }, + { + key: "Email", + title: "Email", + enable: true, + resizable: true, + onChange: onColumnChange, + }, + { + key: "Dublicate", + title: "Dublicate", + enable: true, + resizable: true, + onChange: onColumnChange, + }, + ]; + + const [columns, setColumns] = useState(getColumns(defaultColumns, userId)); + + function onColumnChange(key, e) { + const columnIndex = columns.findIndex((c) => c.key === key); + + if (columnIndex === -1) return; + + setColumns((prevColumns) => + prevColumns.map((item, index) => + index === columnIndex ? { ...item, enable: !item.enable } : item + ) + ); + + const tableColumns = columns.map((c) => c.enable && c.key); + localStorage.setItem(`${TABLE_COLUMNS}=${userId}`, tableColumns); + } + + return ( + + ); +}; + +export default inject(({ auth }) => { + return { + userId: auth.userStore.user.id, + }; +})(observer(GWTableHeader)); diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/GWTableRow.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/GWTableRow.js new file mode 100644 index 0000000000..2dfd86947f --- /dev/null +++ b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/GWTableRow.js @@ -0,0 +1,75 @@ +import TableRow from "@docspace/components/table-container/TableRow"; +import TableCell from "@docspace/components/table-container/TableCell"; +import Text from "@docspace/components/text"; +import styled from "styled-components"; + +const StyledWrapper = styled.div` + display: contents; +`; + +const StyledTableRow = styled(TableRow)` + .table-container_cell { + padding-right: 30px; + text-overflow: ellipsis; + } + + .mr-8 { + margin-right: 8px; + } + .textOverflow { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } +`; + +const GWTableRow = ({ hideColumns, displayName, email, dublicate }) => { + const handleRowClick = (e) => { + if ( + e.target.closest(".checkbox") || + e.target.closest(".table-container_row-checkbox") || + e.target.closest(".type-combobox") || + e.target.closest(".table-container_row-context-menu-wrapper") || + e.target.closest(".toggleButton") || + e.detail === 0 + ) { + return; + } + }; + + return ( + + + + + {displayName} + + + + + {email} + + + + + {dublicate} + + + + + ); +}; + +export default GWTableRow; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/index.js new file mode 100644 index 0000000000..ba771278d1 --- /dev/null +++ b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/index.js @@ -0,0 +1,101 @@ +import { useState, useRef, useEffect } from "react"; +import { inject, observer } from "mobx-react"; +import { isMobile } from "react-device-detect"; +import { Base } from "@docspace/components/themes"; +import styled from "styled-components"; + +import GWTableHeader from "./GWTableHeader"; +import GWTableRow from "./GWTableRow"; +import TableContainer from "@docspace/components/table-container/TableContainer"; +import TableBody from "@docspace/components/table-container/TableBody"; + +import { mockData } from "../../mockData.js"; + +const TableWrapper = styled(TableContainer)` + margin: 20px 0; + + .header-container-text { + font-size: 12px; + } + + .table-container_header { + position: absolute; + } + + .table-list-item { + margin-top: -1px; + &:hover { + cursor: pointer; + background-color: ${(props) => + props.theme.isBase ? "#F8F9F9" : "#282828"}; + } + } +`; + +TableWrapper.defaultProps = { theme: Base }; + +const TABLE_VERSION = "6"; +const COLUMNS_SIZE = `googleWorkspaceColumnsSize_ver-${TABLE_VERSION}`; +const INFO_PANEL_COLUMNS_SIZE = `infoPanelGoogleWorkspaceColumnsSize_ver-${TABLE_VERSION}`; + +const GWTableView = (props) => { + const { userId, viewAs, setViewAs, sectionWidth } = props; + const [hideColumns, setHideColumns] = useState(false); + const tableRef = useRef(null); + + useEffect(() => { + if (!sectionWidth) return; + if (sectionWidth < 1025 || isMobile) { + viewAs !== "row" && setViewAs("row"); + } else { + viewAs !== "table" && setViewAs("table"); + } + }, [sectionWidth]); + + const columnStorageName = `${COLUMNS_SIZE}=${userId}`; + const columnInfoPanelStorageName = `${INFO_PANEL_COLUMNS_SIZE}=${userId}`; + + return ( + + + + {mockData.map((data) => ( + + ))} + + + ); +}; + +export default inject(({ setup, auth }) => { + const { viewAs, setViewAs } = setup; + const { id: userId } = auth.userStore.user; + + return { + viewAs, + setViewAs, + userId, + }; +})(observer(GWTableView)); diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/index.js new file mode 100644 index 0000000000..1bd84aad76 --- /dev/null +++ b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/index.js @@ -0,0 +1,53 @@ +import { Consumer } from "@docspace/components/utils/context"; +import { inject, observer } from "mobx-react"; + +import SaveCancelButtons from "@docspace/components/save-cancel-buttons"; +import Text from "@docspace/components/text"; +import Box from "@docspace/components/box"; + +import GWTableView from "./GWTableView"; +import GWRowView from "./GWRowView"; + +const GWTable = (props) => { + const { t, nextStep, prevStep, viewAs, showReminder } = props; + + return ( + <> + + + {t("Settings:SelectUsersDescription")} + + + + + + + + + {(context) => + viewAs === "table" ? ( + + ) : ( + + ) + } + + + ); +}; + +export default inject(({ setup }) => { + const { viewAs } = setup; + + return { + viewAs, + }; +})(observer(GWTable)); diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/SelectUsersTable.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/SelectUsersTable.js deleted file mode 100644 index a4fb7bd5c7..0000000000 --- a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/SelectUsersTable.js +++ /dev/null @@ -1,5 +0,0 @@ -const SelectUsersTable = () => { - return
SelectUsersTable
; -}; - -export default SelectUsersTable; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/index.js index 92387db713..052a4c2db9 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/index.js @@ -4,6 +4,7 @@ import { inject, observer } from "mobx-react"; import { isMobile } from "react-device-detect"; import FileUpload from "./FileUpload"; +import GwTable from "./GWTable"; import BreakpointWarning from "SRC_DIR/components/BreakpointWarning"; import SaveCancelButtons from "@docspace/components/save-cancel-buttons"; import Text from "@docspace/components/text"; @@ -23,7 +24,14 @@ const GoogleWorkspace = (props) => { case 1: return ; case 2: - return 2 Step; + return ( + + ); case 3: return 3 Step; case 4: @@ -37,6 +45,25 @@ const GoogleWorkspace = (props) => { } }; + const getStepTitle = (stepIndex) => { + switch (stepIndex) { + case 1: + return t("Common:SelectFile"); + case 2: + return t("Settings:SelectUsers"); + case 3: + return t("Settings:DataImport"); + case 4: + return t("Common:SelectFile"); + case 5: + return t("Common:SelectFile"); + case 6: + return t("Common:SelectFile"); + default: + return; + } + }; + const isFirstStep = currentStep === 1; const saveButtonText = isFirstStep @@ -44,11 +71,15 @@ const GoogleWorkspace = (props) => { : t("Settings:NextStep"); const onSaveClick = () => { - setCurrentStep((prev) => prev + 1); + if (currentStep !== 6) { + setCurrentStep((prev) => prev + 1); + } }; const onCancelClick = () => { - setCurrentStep((prev) => prev - 1); + if (currentStep !== 1) { + setCurrentStep((prev) => prev - 1); + } }; if (isMobile) @@ -56,18 +87,21 @@ const GoogleWorkspace = (props) => { return ( - - {t("Settings:AboutDataImport")} - - - - {currentStep}/{steps.length}. - - - {t("Common:SelectFile")} + + + {t("Settings:AboutDataImport")} + + + {currentStep}/{steps.length}. + + + {getStepTitle(currentStep)} + + - + + {getStepContent(currentStep)} Date: Tue, 25 Jul 2023 11:12:55 +0500 Subject: [PATCH 022/335] added SearchInput component --- .../data-import/StyledDataImport.js | 22 ++++++++ .../GWTable/GWTableView/GWTableRow.js | 15 +----- .../GWTable/GWTableView/index.js | 7 +++ .../GoogleWorkspace/GWTable/index.js | 17 ++++-- .../GoogleWorkspace/mockData.js | 54 +++++++++++++++++++ 5 files changed, 98 insertions(+), 17 deletions(-) diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js b/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js index 06a97bc25b..693fd950c2 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js @@ -109,6 +109,28 @@ const WorkspaceWrapper = styled.div` height: 32px; margin-bottom: 16px; } + + .selected-users-count { + margin-right: 24px; + color: #555f65; + font-weight: 700; + } + + .selected-admins-count { + margin-right: 8px; + color: #555f65; + font-weight: 700; + } + + .selected-users-info { + display: flex; + align-items: center; + max-width: 660px; + background: #f8f9f9; + padding: 12px 16px; + border-radius: 6px; + margin: 16px 0; + } `; export { DataImportWrapper, WorkspaceWrapper }; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/GWTableRow.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/GWTableRow.js index 2dfd86947f..72dd450e10 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/GWTableRow.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/GWTableRow.js @@ -24,21 +24,8 @@ const StyledTableRow = styled(TableRow)` `; const GWTableRow = ({ hideColumns, displayName, email, dublicate }) => { - const handleRowClick = (e) => { - if ( - e.target.closest(".checkbox") || - e.target.closest(".table-container_row-checkbox") || - e.target.closest(".type-combobox") || - e.target.closest(".table-container_row-context-menu-wrapper") || - e.target.closest(".toggleButton") || - e.detail === 0 - ) { - return; - } - }; - return ( - + diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/index.js index ba771278d1..e37aaef61f 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/index.js @@ -8,6 +8,7 @@ import GWTableHeader from "./GWTableHeader"; import GWTableRow from "./GWTableRow"; import TableContainer from "@docspace/components/table-container/TableContainer"; import TableBody from "@docspace/components/table-container/TableBody"; +import SearchInput from "@docspace/components/search-input"; import { mockData } from "../../mockData.js"; @@ -57,6 +58,12 @@ const GWTableView = (props) => { return ( + console.log("changed")} + onClearSearch={() => console.log("cleared")} + placeholder="Search" + /> { {t("Settings:SelectUsersDescription")} - - - { cancelButtonLabel={t("Common:Back")} displaySettings={true} /> + + Selected: 0/10 users + + License limit Admins/Power: 0/100 + + Paste you tooltip content here + } + /> + diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/mockData.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/mockData.js index 9520ce51be..6276847a07 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/mockData.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/mockData.js @@ -17,4 +17,58 @@ export const mockData = [ email: "imiller@hotmail.com", dublicate: 1, }, + { + id: 4, + displayName: "Martin Ralphs", + email: "rmartin@gmail.com", + dublicate: 0, + }, + { + id: 5, + displayName: "Whill Whill", + email: "whill@outlook.com", + dublicate: 1, + }, + { + id: 6, + displayName: "Imiller Imiller", + email: "imiller@hotmail.com", + dublicate: 1, + }, + { + id: 7, + displayName: "Martin Ralphs", + email: "rmartin@gmail.com", + dublicate: 0, + }, + { + id: 8, + displayName: "Whill Whill", + email: "whill@outlook.com", + dublicate: 1, + }, + { + id: 9, + displayName: "Imiller Imiller", + email: "imiller@hotmail.com", + dublicate: 1, + }, + { + id: 10, + displayName: "Martin Ralphs", + email: "rmartin@gmail.com", + dublicate: 0, + }, + { + id: 11, + displayName: "Whill Whill", + email: "whill@outlook.com", + dublicate: 1, + }, + { + id: 12, + displayName: "Imiller Imiller", + email: "imiller@hotmail.com", + dublicate: 1, + }, ]; From 0a7b793ffce5cc52098aca67d66cd20583875b31 Mon Sep 17 00:00:00 2001 From: Elyor Djalilov Date: Tue, 25 Jul 2023 12:52:05 +0500 Subject: [PATCH 023/335] added Checkbox to table --- .../GWTable/GWTableView/GWTableRow.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/GWTableRow.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/GWTableRow.js index 72dd450e10..b1e03ff687 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/GWTableRow.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/GWTableRow.js @@ -1,6 +1,8 @@ +import { useState } from "react"; import TableRow from "@docspace/components/table-container/TableRow"; import TableCell from "@docspace/components/table-container/TableCell"; import Text from "@docspace/components/text"; +import Checkbox from "@docspace/components/checkbox"; import styled from "styled-components"; const StyledWrapper = styled.div` @@ -23,11 +25,22 @@ const StyledTableRow = styled(TableRow)` } `; -const GWTableRow = ({ hideColumns, displayName, email, dublicate }) => { +const GWTableRow = ({ displayName, email, dublicate }) => { + const [isChecked, setIsChecked] = useState(false); + + const onChangeCheckbox = () => { + setIsChecked((prev) => !prev); + }; + return ( - + + {displayName} From dcb440262de59f0f4cee9757dc41279188a505bf Mon Sep 17 00:00:00 2001 From: Elyor Djalilov Date: Wed, 26 Jul 2023 13:22:35 +0500 Subject: [PATCH 024/335] changed structure --- .../Stepper/FirstStep/index.js | 60 ++++++++++ .../Stepper/SecondStep/RowView}/index.js | 0 .../SecondStep/TableView/UsersTableHeader.js} | 4 +- .../SecondStep/TableView/UsersTableRow.js | 70 ++++++++++++ .../Stepper/SecondStep/TableView}/index.js | 14 +-- .../Stepper/SecondStep/index.js | 81 ++++++++++++++ .../Stepper/SecondStep}/mockData.js | 0 .../Stepper/ThirdStep/index.js | 16 +++ .../GoogleWorkspace/index.js | 105 ++++++++---------- .../NextCloudWorkspace/index.js | 2 +- .../OnlyofficeWorkspace/index.js | 0 .../data-import/StyledDataImport.js | 65 ++--------- .../categories/data-import/index.js | 17 ++- .../GoogleWorkspace/FileUpload.js | 32 ------ .../GWTable/GWTableView/GWTableRow.js | 75 ------------- .../GoogleWorkspace/GWTable/index.js | 64 ----------- .../PortalSettings/utils/getStepTexts.js | 37 ++++++ .../src/pages/PortalSettings/utils/index.js | 1 + packages/client/src/routes/portalSettings.js | 6 +- 19 files changed, 350 insertions(+), 299 deletions(-) create mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/FirstStep/index.js rename packages/client/src/pages/PortalSettings/categories/data-import/{sub-components/GoogleWorkspace/GWTable/GWRowView => GoogleWorkspace/Stepper/SecondStep/RowView}/index.js (100%) rename packages/client/src/pages/PortalSettings/categories/data-import/{sub-components/GoogleWorkspace/GWTable/GWTableView/GWTableHeader.js => GoogleWorkspace/Stepper/SecondStep/TableView/UsersTableHeader.js} (97%) create mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/TableView/UsersTableRow.js rename packages/client/src/pages/PortalSettings/categories/data-import/{sub-components/GoogleWorkspace/GWTable/GWTableView => GoogleWorkspace/Stepper/SecondStep/TableView}/index.js (92%) create mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/index.js rename packages/client/src/pages/PortalSettings/categories/data-import/{sub-components/GoogleWorkspace => GoogleWorkspace/Stepper/SecondStep}/mockData.js (100%) create mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/ThirdStep/index.js rename packages/client/src/pages/PortalSettings/categories/data-import/{sub-components => }/GoogleWorkspace/index.js (52%) rename packages/client/src/pages/PortalSettings/categories/data-import/{sub-components => }/NextCloudWorkspace/index.js (98%) rename packages/client/src/pages/PortalSettings/categories/data-import/{sub-components => }/OnlyofficeWorkspace/index.js (100%) delete mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/FileUpload.js delete mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/GWTableRow.js delete mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/index.js create mode 100644 packages/client/src/pages/PortalSettings/utils/getStepTexts.js diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/FirstStep/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/FirstStep/index.js new file mode 100644 index 0000000000..34d556bbca --- /dev/null +++ b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/FirstStep/index.js @@ -0,0 +1,60 @@ +import Text from "@docspace/components/text"; +import FileInput from "@docspace/components/file-input"; +import SaveCancelButtons from "@docspace/components/save-cancel-buttons"; +import styled from "styled-components"; + +const Wrapper = styled.div` + max-width: 350px; + + .choose-backup-file { + font-weight: 600; + line-height: 20px; + margin-bottom: 4px; + } + + .upload-backup-input { + height: 32px; + margin-bottom: 16px; + } +`; + +const FirstStep = ({ + t, + onNextStepClick, + onPrevStepClick, + showReminder, + setShowReminder, +}) => { + const onClickInput = (file) => { + let data = new FormData(); + data.append("file", file); + setShowReminder(true); + }; + + return ( + <> + + + {t("Settings:ChooseBackupFile")} + + + + + + ); +}; + +export default FirstStep; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWRowView/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/RowView/index.js similarity index 100% rename from packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWRowView/index.js rename to packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/RowView/index.js diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/GWTableHeader.js b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/TableView/UsersTableHeader.js similarity index 97% rename from packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/GWTableHeader.js rename to packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/TableView/UsersTableHeader.js index 2fe9870872..f9dfa73586 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/GWTableHeader.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/TableView/UsersTableHeader.js @@ -25,7 +25,7 @@ const getColumns = (defaultColumns, userId) => { } }; -const GWTableHeader = (props) => { +const UsersTableHeader = (props) => { const { userId, sectionWidth, @@ -100,4 +100,4 @@ export default inject(({ auth }) => { return { userId: auth.userStore.user.id, }; -})(observer(GWTableHeader)); +})(observer(UsersTableHeader)); diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/TableView/UsersTableRow.js b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/TableView/UsersTableRow.js new file mode 100644 index 0000000000..98d28908ed --- /dev/null +++ b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/TableView/UsersTableRow.js @@ -0,0 +1,70 @@ +import { useState } from "react"; +import TableRow from "@docspace/components/table-container/TableRow"; +import TableCell from "@docspace/components/table-container/TableCell"; +import Text from "@docspace/components/text"; +import Checkbox from "@docspace/components/checkbox"; +import styled from "styled-components"; + +const StyledTableRow = styled(TableRow)` + .table-container_cell { + padding-right: 30px; + text-overflow: ellipsis; + } + + .mr-8 { + margin-right: 8px; + } + + .textOverflow { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } +`; + +const UsersTableRow = ({ displayName, email, dublicate }) => { + const [isChecked, setIsChecked] = useState(false); + + const onChangeCheckbox = () => { + setIsChecked((prev) => !prev); + }; + + return ( + + + + + {displayName} + + + + + {email} + + + + + {dublicate} + + + + ); +}; + +export default UsersTableRow; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/TableView/index.js similarity index 92% rename from packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/index.js rename to packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/TableView/index.js index e37aaef61f..ca15ac3d2c 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/TableView/index.js @@ -4,13 +4,13 @@ import { isMobile } from "react-device-detect"; import { Base } from "@docspace/components/themes"; import styled from "styled-components"; -import GWTableHeader from "./GWTableHeader"; -import GWTableRow from "./GWTableRow"; +import UsersTableHeader from "./UsersTableHeader"; +import UsersTableRow from "./UsersTableRow"; import TableContainer from "@docspace/components/table-container/TableContainer"; import TableBody from "@docspace/components/table-container/TableBody"; import SearchInput from "@docspace/components/search-input"; -import { mockData } from "../../mockData.js"; +import { mockData } from "../mockData.js"; const TableWrapper = styled(TableContainer)` margin: 20px 0; @@ -39,7 +39,7 @@ const TABLE_VERSION = "6"; const COLUMNS_SIZE = `googleWorkspaceColumnsSize_ver-${TABLE_VERSION}`; const INFO_PANEL_COLUMNS_SIZE = `infoPanelGoogleWorkspaceColumnsSize_ver-${TABLE_VERSION}`; -const GWTableView = (props) => { +const TableView = (props) => { const { userId, viewAs, setViewAs, sectionWidth } = props; const [hideColumns, setHideColumns] = useState(false); const tableRef = useRef(null); @@ -64,7 +64,7 @@ const GWTableView = (props) => { onClearSearch={() => console.log("cleared")} placeholder="Search" /> - { itemCount={mockData.length} > {mockData.map((data) => ( - { setViewAs, userId, }; -})(observer(GWTableView)); +})(observer(TableView)); diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/index.js new file mode 100644 index 0000000000..0b6d7bdc5e --- /dev/null +++ b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/index.js @@ -0,0 +1,81 @@ +import { Consumer } from "@docspace/components/utils/context"; +import { inject, observer } from "mobx-react"; +import styled from "styled-components"; + +import SaveCancelButtons from "@docspace/components/save-cancel-buttons"; +import Text from "@docspace/components/text"; +import HelpButton from "@docspace/components/help-button"; + +import TableView from "./TableView"; +import RowView from "./RowView"; + +const Wrapper = styled.div` + display: flex; + align-items: center; + max-width: 660px; + background: #f8f9f9; + padding: 12px 16px; + border-radius: 6px; + margin: 16px 0; + + .selected-users-count { + margin-right: 24px; + color: #555f65; + font-weight: 700; + } + + .selected-admins-count { + margin-right: 8px; + color: #555f65; + font-weight: 700; + } +`; + +const SecondStep = (props) => { + const { t, onNextStepClick, onPrevStepClick, viewAs, showReminder } = props; + + return ( + <> + + + Selected: 0/10 users + + License limit Admins/Power: 0/100 + + Paste you tooltip content here + } + /> + + + + {(context) => + viewAs === "table" ? ( + + ) : ( + + ) + } + + + ); +}; + +export default inject(({ setup }) => { + const { viewAs } = setup; + + return { + viewAs, + }; +})(observer(SecondStep)); diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/mockData.js b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/mockData.js similarity index 100% rename from packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/mockData.js rename to packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/mockData.js diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/ThirdStep/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/ThirdStep/index.js new file mode 100644 index 0000000000..ee4cc047f6 --- /dev/null +++ b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/ThirdStep/index.js @@ -0,0 +1,16 @@ +import SaveCancelButtons from "@docspace/components/save-cancel-buttons"; + +const ThirdStep = ({ t, onNextStepClick, onPrevStepClick, showReminder }) => { + return ( + + ); +}; +export default ThirdStep; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/index.js similarity index 52% rename from packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/index.js rename to packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/index.js index 052a4c2db9..36368dbd1f 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/index.js @@ -2,117 +2,108 @@ import { useState } from "react"; import { withTranslation } from "react-i18next"; import { inject, observer } from "mobx-react"; import { isMobile } from "react-device-detect"; +import FirstStep from "./Stepper/FirstStep"; +import SecondStep from "./Stepper/SecondStep"; +import ThirdStep from "./Stepper/ThirdStep"; -import FileUpload from "./FileUpload"; -import GwTable from "./GWTable"; import BreakpointWarning from "SRC_DIR/components/BreakpointWarning"; import SaveCancelButtons from "@docspace/components/save-cancel-buttons"; import Text from "@docspace/components/text"; import Box from "@docspace/components/box"; -import { WorkspaceWrapper } from "../../StyledDataImport"; +import { getStepTitle, getStepDescription } from "../../../utils"; +import { WorkspaceWrapper } from "../StyledDataImport"; const GoogleWorkspace = (props) => { const [showReminder, setShowReminder] = useState(false); const [currentStep, setCurrentStep] = useState(1); const { t } = props; - const steps = [1, 2, 3, 4, 5, 6]; - const getStepContent = (stepIndex) => { switch (stepIndex) { case 1: - return ; + return ( + + ); case 2: return ( - ); case 3: - return 3 Step; - case 4: - return 4 Step; - case 5: - return 5 Step; - case 6: - return 6 Step; + return ( + + ); default: break; } }; - const getStepTitle = (stepIndex) => { - switch (stepIndex) { - case 1: - return t("Common:SelectFile"); - case 2: - return t("Settings:SelectUsers"); - case 3: - return t("Settings:DataImport"); - case 4: - return t("Common:SelectFile"); - case 5: - return t("Common:SelectFile"); - case 6: - return t("Common:SelectFile"); - default: - return; - } - }; - - const isFirstStep = currentStep === 1; - - const saveButtonText = isFirstStep - ? t("Settings:UploadToServer") - : t("Settings:NextStep"); - - const onSaveClick = () => { + const onNextStepClick = () => { if (currentStep !== 6) { setCurrentStep((prev) => prev + 1); } }; - const onCancelClick = () => { + const onPrevStepClick = () => { if (currentStep !== 1) { setCurrentStep((prev) => prev - 1); } }; + const isSecondStep = currentStep === 2; + const isThirdStep = currentStep === 3; + if (isMobile) return ; return ( - - - {t("Settings:AboutDataImport")} - + + {t("Settings:AboutDataImport")} + +
- - {currentStep}/{steps.length}. + + {currentStep}/{6}. - {getStepTitle(currentStep)} + {getStepTitle(t, currentStep)} - - - + + {getStepDescription(t, currentStep)} + {getStepContent(currentStep)} +
+ {isSecondStep || isThirdStep ? ( -
+ ) : ( + <> + )}
); }; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/NextCloudWorkspace/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/NextCloudWorkspace/index.js similarity index 98% rename from packages/client/src/pages/PortalSettings/categories/data-import/sub-components/NextCloudWorkspace/index.js rename to packages/client/src/pages/PortalSettings/categories/data-import/NextCloudWorkspace/index.js index 3170a7410d..f47c5afbe8 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/NextCloudWorkspace/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/NextCloudWorkspace/index.js @@ -3,7 +3,7 @@ import styled from "styled-components"; import { withTranslation } from "react-i18next"; import { inject, observer } from "mobx-react"; -import ImportSection from "../ImportSection"; +import ImportSection from "../sub-components/ImportSection"; import Text from "@docspace/components/text"; import PeopleIcon from "PUBLIC_DIR/images/catalog.accounts.react.svg"; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/OnlyofficeWorkspace/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/OnlyofficeWorkspace/index.js similarity index 100% rename from packages/client/src/pages/PortalSettings/categories/data-import/sub-components/OnlyofficeWorkspace/index.js rename to packages/client/src/pages/PortalSettings/categories/data-import/OnlyofficeWorkspace/index.js diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js b/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js index 693fd950c2..4af1731cb5 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js @@ -9,11 +9,6 @@ const DataImportWrapper = styled.div` max-width: 343px; } - .service-icon { - display: flex; - align-items: center; - } - .data-import-description { color: #657077; line-height: 20px; @@ -21,8 +16,9 @@ const DataImportWrapper = styled.div` max-width: 675px; } - .start-migration-text { + .data-import-subtitle { margin-bottom: 21px; + font-weight: 600; } .service-list { @@ -61,76 +57,37 @@ const DataImportWrapper = styled.div` @media ${mobile} { width: 100%; } + + .service-icon { + display: flex; + align-items: center; + } } `; const WorkspaceWrapper = styled.div` margin-top: 4px; - @media ${mobile} { - max-width: 343px; - } - - .header-content, - .description-wrapper { - max-width: 700px; - } - - .data-import-description { + .data-import-subtitle { color: #657077; + max-width: 700px; line-height: 20px; margin-bottom: 20px; } - .step-counter { + .stepper { margin-right: 5px; font-weight: 700; font-size: 16px; } - .select-file-wrapper { - max-width: 350px; - } - .step-description { + max-width: 700px; font-size: 12px; margin-bottom: 16px; line-height: 16px; color: #333333; } - - .choose-backup-file { - font-weight: 600; - line-height: 20px; - margin-bottom: 4px; - } - - .upload-backup-input { - height: 32px; - margin-bottom: 16px; - } - - .selected-users-count { - margin-right: 24px; - color: #555f65; - font-weight: 700; - } - - .selected-admins-count { - margin-right: 8px; - color: #555f65; - font-weight: 700; - } - - .selected-users-info { - display: flex; - align-items: center; - max-width: 660px; - background: #f8f9f9; - padding: 12px 16px; - border-radius: 6px; - margin: 16px 0; - } `; export { DataImportWrapper, WorkspaceWrapper }; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/index.js index 217add361f..06223eab04 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/index.js @@ -40,8 +40,10 @@ const DataImport = (props) => { return ( - {t("Settings:DataImportDescription")} - + + {t("Settings:DataImportDescription")} + + {t("Settings:UploadBackupData")} @@ -50,9 +52,16 @@ const DataImport = (props) => { redirectToWorkspace(service.title)}> + onClick={() => redirectToWorkspace(service.title)} + > - + {t("Settings:Import")} diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/FileUpload.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/FileUpload.js deleted file mode 100644 index 6d07a55d52..0000000000 --- a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/FileUpload.js +++ /dev/null @@ -1,32 +0,0 @@ -import Text from "@docspace/components/text"; -import Box from "@docspace/components/box"; -import FileInput from "@docspace/components/file-input"; - -const FileUpload = ({ t, setShowReminder }) => { - const onClickInput = (file) => { - let data = new FormData(); - data.append("file", file); - setShowReminder(true); - }; - - return ( - - - {t("Settings:SelectFileDescription")} - - - - {t("Settings:ChooseBackupFile")} - - - - - ); -}; - -export default FileUpload; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/GWTableRow.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/GWTableRow.js deleted file mode 100644 index b1e03ff687..0000000000 --- a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/GWTableView/GWTableRow.js +++ /dev/null @@ -1,75 +0,0 @@ -import { useState } from "react"; -import TableRow from "@docspace/components/table-container/TableRow"; -import TableCell from "@docspace/components/table-container/TableCell"; -import Text from "@docspace/components/text"; -import Checkbox from "@docspace/components/checkbox"; -import styled from "styled-components"; - -const StyledWrapper = styled.div` - display: contents; -`; - -const StyledTableRow = styled(TableRow)` - .table-container_cell { - padding-right: 30px; - text-overflow: ellipsis; - } - - .mr-8 { - margin-right: 8px; - } - .textOverflow { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - } -`; - -const GWTableRow = ({ displayName, email, dublicate }) => { - const [isChecked, setIsChecked] = useState(false); - - const onChangeCheckbox = () => { - setIsChecked((prev) => !prev); - }; - - return ( - - - - - - {displayName} - - - - - {email} - - - - - {dublicate} - - - - - ); -}; - -export default GWTableRow; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/index.js deleted file mode 100644 index 714f3b0874..0000000000 --- a/packages/client/src/pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/GWTable/index.js +++ /dev/null @@ -1,64 +0,0 @@ -import { Consumer } from "@docspace/components/utils/context"; -import { inject, observer } from "mobx-react"; - -import SaveCancelButtons from "@docspace/components/save-cancel-buttons"; -import Text from "@docspace/components/text"; -import Box from "@docspace/components/box"; -import HelpButton from "@docspace/components/help-button"; - -import GWTableView from "./GWTableView"; -import GWRowView from "./GWRowView"; - -const GWTable = (props) => { - const { t, nextStep, prevStep, viewAs, showReminder } = props; - - return ( - <> - - - {t("Settings:SelectUsersDescription")} - - - - Selected: 0/10 users - - License limit Admins/Power: 0/100 - - Paste you tooltip content here - } - /> -
- - - - {(context) => - viewAs === "table" ? ( - - ) : ( - - ) - } - - - ); -}; - -export default inject(({ setup }) => { - const { viewAs } = setup; - - return { - viewAs, - }; -})(observer(GWTable)); diff --git a/packages/client/src/pages/PortalSettings/utils/getStepTexts.js b/packages/client/src/pages/PortalSettings/utils/getStepTexts.js new file mode 100644 index 0000000000..7937a7d7ca --- /dev/null +++ b/packages/client/src/pages/PortalSettings/utils/getStepTexts.js @@ -0,0 +1,37 @@ +export const getStepTitle = (t, stepIndex) => { + switch (stepIndex) { + case 1: + return t("Common:SelectFile"); + case 2: + return t("Settings:SelectUsers"); + case 3: + return t("Settings:DataImport"); + case 4: + return t("Common:SelectFile"); + case 5: + return t("Common:SelectFile"); + case 6: + return t("Common:SelectFile"); + default: + return; + } +}; + +export const getStepDescription = (t, stepIndex) => { + switch (stepIndex) { + case 1: + return t("Settings:SelectFileDescription"); + case 2: + return t("Settings:SelectUsersDescription"); + case 3: + return t("Settings:DataImport"); + case 4: + return t("Common:SelectFile"); + case 5: + return t("Common:SelectFile"); + case 6: + return t("Common:SelectFile"); + default: + return; + } +}; diff --git a/packages/client/src/pages/PortalSettings/utils/index.js b/packages/client/src/pages/PortalSettings/utils/index.js index f2a054c20c..052ddc1d0c 100644 --- a/packages/client/src/pages/PortalSettings/utils/index.js +++ b/packages/client/src/pages/PortalSettings/utils/index.js @@ -12,3 +12,4 @@ export { getFromLocalStorage } from "./getFromLocalStorage.js"; export { saveToLocalStorage } from "./saveToLocalStorage.js"; export { removeLocalStorage } from "./removeLocalStorage.js"; export { resetSessionStorage } from "./resetSessionStorage"; +export { getStepTitle, getStepDescription } from "./getStepTexts"; diff --git a/packages/client/src/routes/portalSettings.js b/packages/client/src/routes/portalSettings.js index b44b9bfd0e..fcd86acb0d 100644 --- a/packages/client/src/routes/portalSettings.js +++ b/packages/client/src/routes/portalSettings.js @@ -87,17 +87,17 @@ const DataImport = loadable(() => ); const GoogleDataImport = loadable(() => import( - "../pages/PortalSettings/categories/data-import/sub-components/GoogleWorkspace/index.js" + "../pages/PortalSettings/categories/data-import/GoogleWorkspace/index.js" ) ); const NextcloudDataImport = loadable(() => import( - "../pages/PortalSettings/categories/data-import/sub-components/NextCloudWorkspace/index.js" + "../pages/PortalSettings/categories/data-import/NextCloudWorkspace/index.js" ) ); const OnlyofficeDataImport = loadable(() => import( - "../pages/PortalSettings/categories/data-import/sub-components/OnlyofficeWorkspace/index.js" + "../pages/PortalSettings/categories/data-import/OnlyofficeWorkspace/index.js" ) ); From 4a52dab5b6137ffdb2df7d92143c04df53aab276 Mon Sep 17 00:00:00 2001 From: Elyor Djalilov Date: Wed, 26 Jul 2023 15:58:06 +0500 Subject: [PATCH 025/335] add RowView component --- .../Stepper/SecondStep/RowView/UsersRow.js | 35 ++++++++++++ .../SecondStep/RowView/UsersRowContent.js | 50 +++++++++++++++++ .../Stepper/SecondStep/RowView/index.js | 44 +++++++++++++-- .../SecondStep/TableView/UsersTableHeader.js | 6 +++ .../SecondStep/TableView/UsersTableRow.js | 53 ++++++++----------- .../Stepper/SecondStep/TableView/index.js | 8 +-- .../Stepper/SecondStep/mockData.js | 24 ++++----- .../Stepper/ThirdStep/index.js | 21 ++++---- .../table-container/TableHeaderCell.js | 11 +++- 9 files changed, 191 insertions(+), 61 deletions(-) create mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/RowView/UsersRow.js create mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/RowView/UsersRowContent.js diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/RowView/UsersRow.js b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/RowView/UsersRow.js new file mode 100644 index 0000000000..e6173e4e4a --- /dev/null +++ b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/RowView/UsersRow.js @@ -0,0 +1,35 @@ +import { useState } from "react"; +import Row from "@docspace/components/row"; +import UsersRowContent from "./UsersRowContent"; + +const UserskRow = (props) => { + const { data, sectionWidth } = props; + + const [isChecked, setIsChecked] = useState(false); + + const onChangeCheckbox = () => { + setIsChecked((prev) => !prev); + }; + + return ( + <> + console.log("row click")} + > + + + + ); +}; + +export default UserskRow; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/RowView/UsersRowContent.js b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/RowView/UsersRowContent.js new file mode 100644 index 0000000000..d22c3cb082 --- /dev/null +++ b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/RowView/UsersRowContent.js @@ -0,0 +1,50 @@ +import styled from "styled-components"; +import Text from "@docspace/components/text"; +import Box from "@docspace/components/box"; +import RowContent from "@docspace/components/row-content"; + +const StyledRowContent = styled(RowContent)` + display: flex; + + .rowMainContainer { + height: 100%; + width: 100%; + } + + .user-email { + margin-right: 5px; + font-size: 12px; + font-weight: 600; + color: #a3a9ae; + } + + .user-existing { + font-size: 12px; + font-weight: 600; + color: #2db482; + } +`; + +const UsersRowContent = ({ sectionWidth, displayName, email, dublicate }) => { + const isExistingUser = dublicate !== "—"; + + const contentData = [ + <> + + {displayName} + + + {email} + {isExistingUser && {dublicate}} + + , + ]; + + return ( + + {contentData} + + ); +}; + +export default UsersRowContent; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/RowView/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/RowView/index.js index 02ebe646f6..2b48f2c201 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/RowView/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/RowView/index.js @@ -1,7 +1,43 @@ -import React from "react"; +import { useEffect } from "react"; +import { inject, observer } from "mobx-react"; +import { isMobile } from "react-device-detect"; +import styled from "styled-components"; -const GWRowView = () => { - return
GWRowView
; +import RowContainer from "@docspace/components/row-container"; +import UsersRow from "./UsersRow"; +import { mockData } from "../mockData.js"; + +const StyledRowContainer = styled(RowContainer)` + margin: 20px 0; +`; + +const RowView = (props) => { + const { sectionWidth, viewAs, setViewAs } = props; + + useEffect(() => { + if (viewAs !== "table" && viewAs !== "row") return; + + if (sectionWidth < 1025 || isMobile) { + viewAs !== "row" && setViewAs("row"); + } else { + viewAs !== "table" && setViewAs("table"); + } + }, [sectionWidth]); + + return ( + + {mockData.map((data) => ( + + ))} + + ); }; -export default GWRowView; +export default inject(({ setup }) => { + const { viewAs, setViewAs } = setup; + + return { + viewAs, + setViewAs, + }; +})(observer(RowView)); diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/TableView/UsersTableHeader.js b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/TableView/UsersTableHeader.js index f9dfa73586..b25daf254e 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/TableView/UsersTableHeader.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/TableView/UsersTableHeader.js @@ -44,6 +44,12 @@ const UsersTableHeader = (props) => { default: true, active: true, minWidth: 180, + checkbox: { + value: true, + onChange: (e) => { + console.log(e); + }, + }, onChange: onColumnChange, }, { diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/TableView/UsersTableRow.js b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/TableView/UsersTableRow.js index 98d28908ed..ebf6842b41 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/TableView/UsersTableRow.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/TableView/UsersTableRow.js @@ -11,20 +11,31 @@ const StyledTableRow = styled(TableRow)` text-overflow: ellipsis; } - .mr-8 { - margin-right: 8px; + .user-email { + margin-right: 5px; + font-size: 13px; + font-weight: 600; + color: #a3a9ae; } - .textOverflow { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; + .not-existing { + font-size: 13px; + font-weight: 600; + color: #a3a9ae; + } + + .user-existing { + font-size: 13px; + font-weight: 600; + color: #2db482; } `; const UsersTableRow = ({ displayName, email, dublicate }) => { const [isChecked, setIsChecked] = useState(false); + const isExistingUser = dublicate !== "—"; + const onChangeCheckbox = () => { setIsChecked((prev) => !prev); }; @@ -32,34 +43,16 @@ const UsersTableRow = ({ displayName, email, dublicate }) => { return ( - - - {displayName} - + + {displayName} + - - {email} - + {email} + - + {dublicate} diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/TableView/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/TableView/index.js index ca15ac3d2c..5f1b62a00a 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/TableView/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/TableView/index.js @@ -12,7 +12,7 @@ import SearchInput from "@docspace/components/search-input"; import { mockData } from "../mockData.js"; -const TableWrapper = styled(TableContainer)` +const StyledTableContainer = styled(TableContainer)` margin: 20px 0; .header-container-text { @@ -33,7 +33,7 @@ const TableWrapper = styled(TableContainer)` } `; -TableWrapper.defaultProps = { theme: Base }; +StyledTableContainer.defaultProps = { theme: Base }; const TABLE_VERSION = "6"; const COLUMNS_SIZE = `googleWorkspaceColumnsSize_ver-${TABLE_VERSION}`; @@ -57,7 +57,7 @@ const TableView = (props) => { const columnInfoPanelStorageName = `${INFO_PANEL_COLUMNS_SIZE}=${userId}`; return ( - + console.log("changed")} @@ -92,7 +92,7 @@ const TableView = (props) => { /> ))} - + ); }; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/mockData.js b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/mockData.js index 6276847a07..8ef5359b80 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/mockData.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SecondStep/mockData.js @@ -3,72 +3,72 @@ export const mockData = [ id: 1, displayName: "Martin Ralphs", email: "rmartin@gmail.com", - dublicate: 0, + dublicate: "(Existing account)", }, { id: 2, displayName: "Whill Whill", email: "whill@outlook.com", - dublicate: 1, + dublicate: "—", }, { id: 3, displayName: "Imiller Imiller", email: "imiller@hotmail.com", - dublicate: 1, + dublicate: "—", }, { id: 4, displayName: "Martin Ralphs", email: "rmartin@gmail.com", - dublicate: 0, + dublicate: "—", }, { id: 5, displayName: "Whill Whill", email: "whill@outlook.com", - dublicate: 1, + dublicate: "—", }, { id: 6, displayName: "Imiller Imiller", email: "imiller@hotmail.com", - dublicate: 1, + dublicate: "—", }, { id: 7, displayName: "Martin Ralphs", email: "rmartin@gmail.com", - dublicate: 0, + dublicate: "—", }, { id: 8, displayName: "Whill Whill", email: "whill@outlook.com", - dublicate: 1, + dublicate: "—", }, { id: 9, displayName: "Imiller Imiller", email: "imiller@hotmail.com", - dublicate: 1, + dublicate: "—", }, { id: 10, displayName: "Martin Ralphs", email: "rmartin@gmail.com", - dublicate: 0, + dublicate: "—", }, { id: 11, displayName: "Whill Whill", email: "whill@outlook.com", - dublicate: 1, + dublicate: "—", }, { id: 12, displayName: "Imiller Imiller", email: "imiller@hotmail.com", - dublicate: 1, + dublicate: "—", }, ]; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/ThirdStep/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/ThirdStep/index.js index ee4cc047f6..f6261ed58a 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/ThirdStep/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/ThirdStep/index.js @@ -1,16 +1,17 @@ -import SaveCancelButtons from "@docspace/components/save-cancel-buttons"; +// import SaveCancelButtons from "@docspace/components/save-cancel-buttons"; const ThirdStep = ({ t, onNextStepClick, onPrevStepClick, showReminder }) => { return ( - +
Third Step
+ // ); }; export default ThirdStep; diff --git a/packages/components/table-container/TableHeaderCell.js b/packages/components/table-container/TableHeaderCell.js index e115f11023..d93b1698ae 100644 --- a/packages/components/table-container/TableHeaderCell.js +++ b/packages/components/table-container/TableHeaderCell.js @@ -5,6 +5,7 @@ import IconButton from "../icon-button"; import globalColors from "../utils/globalColors"; import { StyledTableHeaderCell } from "./StyledTableContainer"; import SortDescReactSvgUrl from "PUBLIC_DIR/images/sort.desc.react.svg?url"; +import Checkbox from "../checkbox"; const TableHeaderCell = ({ column, @@ -17,7 +18,7 @@ const TableHeaderCell = ({ sortingVisible, tagRef, }) => { - const { title, enable, active, minWidth, withTagRef } = column; + const { title, enable, active, minWidth, withTagRef, checkbox } = column; const isActive = (sortBy && column.sortBy === sortBy) || active; @@ -86,6 +87,14 @@ const TableHeaderCell = ({ >
+ {checkbox && ( + + )} + {enable ? title : ""} From 5c188d113925cad7749eaad74dc36b8e5afe035d Mon Sep 17 00:00:00 2001 From: Elyor Djalilov Date: Wed, 26 Jul 2023 16:30:37 +0500 Subject: [PATCH 026/335] added steps title and steps description --- packages/client/public/locales/en/Settings.json | 7 +++++++ packages/client/public/locales/ru/Settings.json | 7 +++++++ .../pages/PortalSettings/utils/getStepTexts.js | 16 ++++++++-------- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/packages/client/public/locales/en/Settings.json b/packages/client/public/locales/en/Settings.json index 2ee1b051cd..01f14ad5b3 100644 --- a/packages/client/public/locales/en/Settings.json +++ b/packages/client/public/locales/en/Settings.json @@ -68,7 +68,11 @@ "ChooseBackupFile": "Choose the backup file", "DataBackup": "Data backup", "DataImport": "Data import", + "DataImportComplete": "Data import complete", + "DataImportCompleteDescription": "Data import from Google Workspace to ONLYOFFICE DocSpace is complete!
70/70 users were imported successfully.", "DataImportDescription": "Import data from a third party service to ONLYOFFICE DocSpace. Data import allows transferring data such as all users, their personal and shared documents.", + "DataImportProcessing": "Processing of data import", + "DataImportProcessingDescription": "Data migration in progress. Please wait.", "Deactivate": "Deactivate", "DeactivateOrDeletePortal": "Deactivate or delete space.", "DeleteDocSpace": "Delete DocSpace", @@ -164,9 +168,12 @@ "RoomsModule": "Backup room", "RoomsModuleDescription": "You may create a new room specifically for the backup, choose one of the existing rooms, or save the copy in their {{roomName}} room.", "SelectFileDescription": "Select the Google Workspace backup files to start the data import. Multiple files can be selected. Once the data upload and analysis are complete, the next step will be initiated automatically.", + "SelectSectionsDescription": "Select sections for import. They will appear in the corresponding sections of DocSpace.", "SelectFileInGZFormat": "Select the file in .GZ format", "SelectUsers": "Select users", + "SelectUserTypes": "Select user types", "SelectUsersDescription": "Check users from the list to import into ONLYOFFICE DocSpace. Users from Google Workspace will be imported without First Name / Last Name, and their email name will be used instead. Names of the users can be changed after the import. Users already existing in ONLYOFFICE DocSpace are highlighted with a green color and are not checked by default.", + "SelectUserTypesDescription": "Select DocSpace roles for the imported users: DocSpace admin, Room admin or Power user. By default, Power user role is selected for each user. You can manage the roles after the import.", "SendNotificationAboutRestoring": "Send notification about space restoring to users", "ServerSideEncryptionMethod": "Server Side Encryption Method", "ServiceUrl": "Service Url", diff --git a/packages/client/public/locales/ru/Settings.json b/packages/client/public/locales/ru/Settings.json index 63cde207f1..6b6e4073c9 100644 --- a/packages/client/public/locales/ru/Settings.json +++ b/packages/client/public/locales/ru/Settings.json @@ -68,7 +68,11 @@ "ChooseBackupFile": "Выберите файл резервной копии", "DataBackup": "Резервное копирование данных", "DataImport": "Перенос данных", + "DataImportComplete": "Импорт данных завершен", + "DataImportCompleteDescription": "Импорт данных из Google Workspace в ONLYOFFICE DocSpace завершен!
70/70 пользователей были успешно импортированы.", "DataImportDescription": "Импорт данных из стороннего сервиса в ONLYOFFICE DocSpace. Импорт данных позволяет передавать такие данные, как все пользователи, их личные и общие документы.", + "DataImportProcessing": "Обработка импорта данных", + "DataImportProcessingDescription": "Выполняется перенос данных. Пожалуйста, подождите.", "Deactivate": "Деактивировать", "DeactivateOrDeletePortal": "Деактивировать или удалить портал.", "DeleteDocSpace": "Удалить DocSpace", @@ -164,9 +168,12 @@ "RoomsModule": "Резервная комната", "RoomsModuleDescription": "Вы можете создать новую комнату специально для резервного копирования, выбрать одну из существующих комнат или сохранить копию в {{roomName}}.", "SelectFileDescription": "Выберите файлы резервных копий Google Workspace, чтобы начать импорт данных. Можно выбрать несколько файлов. После завершения загрузки и анализа данных следующий шаг будет инициирован автоматически.", + "SelectSectionsDescription": "Выберите разделы для импорта. Они появятся в соответствующих разделах DocSpace.", "SelectFileInGZFormat": "Выбрать файл в формате .GZ", "SelectUsers": "Выберите пользователей", + "SelectUserTypes": "Выберите типы пользователей", "SelectUsersDescription": "Отметьте пользователей из списка для импорта в ONLYOFFICE DocSpace. Пользователи из Google Workspace будут импортированы без имени/фамилии, вместо них будет использоваться их имя электронной почты. Имена пользователей могут быть изменены после импорта. Пользователи, уже существующие в ONLYOFFICE DocSpace, выделяются зеленым цветом и по умолчанию не проверяются.", + "SelectUserTypesDescription": "Выберите роли DocSpace для импортированных пользователей: администратор DocSpace, администратор комнаты или опытный пользователь. По умолчанию для каждого пользователя выбрана роль опытного пользователя. Вы можете управлять ролями после импорта.", "SendNotificationAboutRestoring": "Оповестить пользователей о восстановлении портала", "ServerSideEncryptionMethod": "Метод шифрования на стороне сервера", "ServiceUrl": "Url-адрес сервиса", diff --git a/packages/client/src/pages/PortalSettings/utils/getStepTexts.js b/packages/client/src/pages/PortalSettings/utils/getStepTexts.js index 7937a7d7ca..41a9d6774d 100644 --- a/packages/client/src/pages/PortalSettings/utils/getStepTexts.js +++ b/packages/client/src/pages/PortalSettings/utils/getStepTexts.js @@ -5,13 +5,13 @@ export const getStepTitle = (t, stepIndex) => { case 2: return t("Settings:SelectUsers"); case 3: - return t("Settings:DataImport"); + return t("Settings:SelectUserTypes"); case 4: - return t("Common:SelectFile"); + return t("Settings:DataImport"); case 5: - return t("Common:SelectFile"); + return t("Settings:DataImportProcessing"); case 6: - return t("Common:SelectFile"); + return t("Settings:DataImportComplete"); default: return; } @@ -24,13 +24,13 @@ export const getStepDescription = (t, stepIndex) => { case 2: return t("Settings:SelectUsersDescription"); case 3: - return t("Settings:DataImport"); + return t("Settings:SelectUserTypesDescription"); case 4: - return t("Common:SelectFile"); + return t("Settings:SelectSectionsDescription"); case 5: - return t("Common:SelectFile"); + return t("Settings:DataImportProcessingDescription"); case 6: - return t("Common:SelectFile"); + return t("Settings:DataImportCompleteDescription"); default: return; } From 0da183728ba812d96c4b7cbb0e2b1731a0901401 Mon Sep 17 00:00:00 2001 From: Elyor Djalilov Date: Wed, 26 Jul 2023 16:49:47 +0500 Subject: [PATCH 027/335] added other steps --- .../Stepper/FifthStep/index.js | 17 ++++++++++ .../Stepper/FourthStep/index.js | 17 ++++++++++ .../Stepper/SixthStep/index.js | 15 +++++++++ .../Stepper/ThirdStep/index.js | 2 +- .../data-import/GoogleWorkspace/index.js | 31 +++++++++++++++++++ public/locales/en/Common.json | 1 + public/locales/ru/Common.json | 1 + 7 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/FifthStep/index.js create mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/FourthStep/index.js create mode 100644 packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SixthStep/index.js diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/FifthStep/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/FifthStep/index.js new file mode 100644 index 0000000000..447e958264 --- /dev/null +++ b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/FifthStep/index.js @@ -0,0 +1,17 @@ +import SaveCancelButtons from "@docspace/components/save-cancel-buttons"; + +const FifthStep = ({ t, onNextStepClick, onPrevStepClick, showReminder }) => { + return ( + + ); +}; + +export default FifthStep; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/FourthStep/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/FourthStep/index.js new file mode 100644 index 0000000000..85efb5317c --- /dev/null +++ b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/FourthStep/index.js @@ -0,0 +1,17 @@ +import SaveCancelButtons from "@docspace/components/save-cancel-buttons"; + +const FourthStep = ({ t, onNextStepClick, onPrevStepClick, showReminder }) => { + return ( + + ); +}; + +export default FourthStep; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SixthStep/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SixthStep/index.js new file mode 100644 index 0000000000..8dd3524b52 --- /dev/null +++ b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/SixthStep/index.js @@ -0,0 +1,15 @@ +import Button from "@docspace/components/button"; + +const SixthStep = ({ t, onNextStepClick, onPrevStepClick, showReminder }) => { + return ( +
diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js b/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js index 4af1731cb5..30f08e1d8b 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/StyledDataImport.js @@ -82,12 +82,19 @@ const WorkspaceWrapper = styled.div` } .step-description { + position: relative; max-width: 700px; font-size: 12px; margin-bottom: 16px; line-height: 16px; color: #333333; } + + .step-tooltip { + position: absolute; + top: 18px; + right: 45%; + } `; export { DataImportWrapper, WorkspaceWrapper }; diff --git a/packages/client/src/pages/PortalSettings/utils/getStepTexts.js b/packages/client/src/pages/PortalSettings/utils/getStepTexts.js index 41a9d6774d..0843f6973e 100644 --- a/packages/client/src/pages/PortalSettings/utils/getStepTexts.js +++ b/packages/client/src/pages/PortalSettings/utils/getStepTexts.js @@ -1,3 +1,5 @@ +import { Trans } from "react-i18next"; + export const getStepTitle = (t, stepIndex) => { switch (stepIndex) { case 1: @@ -20,17 +22,17 @@ export const getStepTitle = (t, stepIndex) => { export const getStepDescription = (t, stepIndex) => { switch (stepIndex) { case 1: - return t("Settings:SelectFileDescription"); + return ; case 2: - return t("Settings:SelectUsersDescription"); + return ; case 3: - return t("Settings:SelectUserTypesDescription"); + return ; case 4: - return t("Settings:SelectSectionsDescription"); + return ; case 5: - return t("Settings:DataImportProcessingDescription"); - case 6: - return t("Settings:DataImportCompleteDescription"); + return + case 6: + return default: return; } From c3ac1ecb54234e9e7597db06fef85c36c9bb588c Mon Sep 17 00:00:00 2001 From: Elyor Djalilov Date: Mon, 7 Aug 2023 18:26:30 +0500 Subject: [PATCH 053/335] added selection user type --- .../ThirdStep/RowView/UsersTypeRowContent.js | 61 ++++++++++++++++--- .../ThirdStep/TableView/UsersTypeTableRow.js | 59 ++++++++++++++++-- 2 files changed, 108 insertions(+), 12 deletions(-) diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/ThirdStep/RowView/UsersTypeRowContent.js b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/ThirdStep/RowView/UsersTypeRowContent.js index ad42ff44db..310b0c8726 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/ThirdStep/RowView/UsersTypeRowContent.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/ThirdStep/RowView/UsersTypeRowContent.js @@ -1,7 +1,10 @@ +import { useState, useRef } from "react"; import styled from "styled-components"; + import Text from "@docspace/components/text"; import Box from "@docspace/components/box"; import RowContent from "@docspace/components/row-content"; +import AccessRightSelect from "@docspace/components/access-right-select"; const StyledRowContent = styled(RowContent)` display: flex; @@ -23,13 +26,48 @@ const StyledRowContent = styled(RowContent)` } .user-type { - font-size: 13px; - font-weight: 600; - color: #a3a9ae; - } + .combo-button { + border: none; + padding: 0; + justify-content: flex-end; + background-color: transparent; + } + + .combo-button-label { + color: #a3a9ae; + } + + .combo-buttons_arrow-icon { + flex: initial; + margin-left: 0; + } + + svg { + path { + fill: #a3a9ae; + } + } `; +const data = [ + { + key: "key1", + label: "DocSpace admin", + }, + { + key: "key2", + label: "Room admin", + }, + { + key: "key3", + label: "Power user", + }, +]; + const UsersTypeRowContent = ({ sectionWidth, displayName, email, type }) => { + const [selectUserType, setSelectUserType] = useState(data[2]); + const userTypeRef = useRef(); + const contentData = [ @@ -38,9 +76,18 @@ const UsersTypeRowContent = ({ sectionWidth, displayName, email, type }) => { {email} - - {type} - + +
+ +
, ]; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/ThirdStep/TableView/UsersTypeTableRow.js b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/ThirdStep/TableView/UsersTypeTableRow.js index dae2668a55..738927edfe 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/ThirdStep/TableView/UsersTypeTableRow.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/ThirdStep/TableView/UsersTypeTableRow.js @@ -1,3 +1,6 @@ +import { useState, useRef } from "react"; + +import AccessRightSelect from "@docspace/components/access-right-select"; import TableRow from "@docspace/components/table-container/TableRow"; import TableCell from "@docspace/components/table-container/TableCell"; import Text from "@docspace/components/text"; @@ -18,21 +21,57 @@ const StyledTableRow = styled(TableRow)` } .user-type { - font-size: 13px; - font-weight: 600; - color: #a3a9ae; + .combo-button { + border: none; + padding: 0; + justify-content: flex-start; + background-color: transparent; + } + + .combo-button-label { + color: #a3a9ae; + } + + .combo-buttons_arrow-icon { + flex: initial; + margin-left: 0; + } + + svg { + path { + fill: #a3a9ae; + } + } } `; +const data = [ + { + key: "key1", + label: "DocSpace admin", + }, + { + key: "key2", + label: "Room admin", + }, + { + key: "key3", + label: "Power user", + }, +]; + const UsersTypeTableRow = ({ id, displayName, email, - type, + // type, isChecked, checkbox, onChangeCheckbox, }) => { + const [selectUserType, setSelectUserType] = useState(data[2]); + const userTypeRef = useRef(); + const onChange = (e) => { onChangeCheckbox(id, e.target.checked); }; @@ -45,7 +84,17 @@ const UsersTypeTableRow = ({ - {type} +
+ +
From 6e39c8d10474e524cae978893036781dba2867dc Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Mon, 7 Aug 2023 17:46:54 +0300 Subject: [PATCH 054/335] Migration: added ASC.Migration.BackgroundTasks --- ASC.Web.sln | 8 +- ASC.Web.slnf | 2 + .../ASC.Migration.BackgroundTasks.csproj | 12 + .../GlobalUsings.cs | 37 +++ .../Program.cs | 171 +++++++------- .../Properties/launchSettings.json | 54 ++--- .../Startup.cs | 88 +++---- .../appsettings.json | 3 + ...ation.csproj => ASC.Migration.Core.csproj} | 40 +++- common/ASC.Migration/GlobalUsings.cs | 17 +- .../Resources/MigrationResource.Designer.cs | 113 ++++++--- .../Resources/MigrationResource.resx | 15 ++ web/ASC.Web.Api/ASC.Web.Api.csproj | 1 + .../ASC.Web.Api}/Api/MigrationController.cs | 218 +++++++++--------- .../ApiModels/ResponseDto/MigrationStatus.cs | 54 ++--- web/ASC.Web.Api/GlobalUsings.cs | 9 +- 16 files changed, 485 insertions(+), 357 deletions(-) create mode 100644 common/ASC.Migration.BackgroundTasks/ASC.Migration.BackgroundTasks.csproj create mode 100644 common/ASC.Migration.BackgroundTasks/GlobalUsings.cs rename common/{ASC.Migration => ASC.Migration.BackgroundTasks}/Program.cs (93%) rename common/{ASC.Migration => ASC.Migration.BackgroundTasks}/Properties/launchSettings.json (96%) rename common/{ASC.Migration => ASC.Migration.BackgroundTasks}/Startup.cs (97%) create mode 100644 common/ASC.Migration.BackgroundTasks/appsettings.json rename common/ASC.Migration/{ASC.Migration.csproj => ASC.Migration.Core.csproj} (62%) rename {common/ASC.Migration => web/ASC.Web.Api}/Api/MigrationController.cs (87%) rename {common/ASC.Migration => web/ASC.Web.Api}/ApiModels/ResponseDto/MigrationStatus.cs (95%) diff --git a/ASC.Web.sln b/ASC.Web.sln index 8f1922e593..cbeef8a77e 100644 --- a/ASC.Web.sln +++ b/ASC.Web.sln @@ -79,7 +79,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.EventBus.RabbitMQ", "co EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.EventBus.Extensions.Logger", "common\ASC.EventBus.Extensions.Logger\ASC.EventBus.Extensions.Logger.csproj", "{ED8CEB38-7C95-43A8-B208-9C9828654AC1}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Migration", "common\ASC.Migration\ASC.Migration.csproj", "{05B8FF27-446B-49BF-B508-4A4C096D2BB2}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Migration.Core", "common\ASC.Migration\ASC.Migration.Core.csproj", "{05B8FF27-446B-49BF-B508-4A4C096D2BB2}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.ActiveDirectory", "common\ASC.ActiveDirectory\ASC.ActiveDirectory.csproj", "{9F81862F-303D-467F-8DC9-044BE2CCF329}" EndProject @@ -91,6 +91,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.ApiSystem", "common\ser EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.ApiCache", "common\services\ASC.ApiCache\ASC.ApiCache.csproj", "{AD4F5F31-625C-472D-BE2C-AD1FB693E065}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ASC.Migration.BackgroundTasks", "common\ASC.Migration.BackgroundTasks\ASC.Migration.BackgroundTasks.csproj", "{7783D579-5A2F-4536-A387-F6E0E0946C07}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -257,6 +259,10 @@ Global {AD4F5F31-625C-472D-BE2C-AD1FB693E065}.Debug|Any CPU.Build.0 = Debug|Any CPU {AD4F5F31-625C-472D-BE2C-AD1FB693E065}.Release|Any CPU.ActiveCfg = Release|Any CPU {AD4F5F31-625C-472D-BE2C-AD1FB693E065}.Release|Any CPU.Build.0 = Release|Any CPU + {7783D579-5A2F-4536-A387-F6E0E0946C07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7783D579-5A2F-4536-A387-F6E0E0946C07}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7783D579-5A2F-4536-A387-F6E0E0946C07}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7783D579-5A2F-4536-A387-F6E0E0946C07}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ASC.Web.slnf b/ASC.Web.slnf index 2d96054968..56da385c7f 100644 --- a/ASC.Web.slnf +++ b/ASC.Web.slnf @@ -18,6 +18,8 @@ "common\\ASC.Feed\\ASC.Feed.csproj", "common\\ASC.IPSecurity\\ASC.IPSecurity.csproj", "common\\ASC.MessagingSystem\\ASC.MessagingSystem.csproj", + "common\\ASC.Migration.BackgroundTasks\\ASC.Migration.BackgroundTasks.csproj", + "common\\ASC.Migration\\ASC.Migration.Core.csproj", "common\\ASC.Notify.Textile\\ASC.Notify.Textile.csproj", "common\\ASC.Textile\\ASC.Textile.csproj", "common\\ASC.Webhooks.Core\\ASC.Webhooks.Core.csproj", diff --git a/common/ASC.Migration.BackgroundTasks/ASC.Migration.BackgroundTasks.csproj b/common/ASC.Migration.BackgroundTasks/ASC.Migration.BackgroundTasks.csproj new file mode 100644 index 0000000000..024b380e2e --- /dev/null +++ b/common/ASC.Migration.BackgroundTasks/ASC.Migration.BackgroundTasks.csproj @@ -0,0 +1,12 @@ + + + + net7.0 + enable + + + + + + + diff --git a/common/ASC.Migration.BackgroundTasks/GlobalUsings.cs b/common/ASC.Migration.BackgroundTasks/GlobalUsings.cs new file mode 100644 index 0000000000..3d3c8e4615 --- /dev/null +++ b/common/ASC.Migration.BackgroundTasks/GlobalUsings.cs @@ -0,0 +1,37 @@ +// (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 + +global using System.Text; + +global using ASC.Api.Core; +global using ASC.Api.Core.Extensions; +global using ASC.Migration; + +global using Autofac; + +global using Microsoft.Extensions.Hosting.WindowsServices; + +global using NLog; diff --git a/common/ASC.Migration/Program.cs b/common/ASC.Migration.BackgroundTasks/Program.cs similarity index 93% rename from common/ASC.Migration/Program.cs rename to common/ASC.Migration.BackgroundTasks/Program.cs index 31d17b409c..30131e145d 100644 --- a/common/ASC.Migration/Program.cs +++ b/common/ASC.Migration.BackgroundTasks/Program.cs @@ -1,88 +1,85 @@ -// (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 - -var options = new WebApplicationOptions -{ - Args = args, - ContentRootPath = WindowsServiceHelpers.IsWindowsService() ? AppContext.BaseDirectory : default -}; - -var builder = WebApplication.CreateBuilder(options); - -builder.Configuration.AddDefaultConfiguration(builder.Environment) - .AddEnvironmentVariables() - .AddCommandLine(args); - -var logger = LogManager.Setup() - .SetupExtensions(s => - { - s.RegisterLayoutRenderer("application-context", (logevent) => AppName); - }) - .LoadConfiguration(builder.Configuration, builder.Environment) - .GetLogger(typeof(Startup).Namespace); - -try -{ - logger.Info("Configuring web host ({applicationContext})...", AppName); - builder.Host.ConfigureDefault(); - builder.WebHost.ConfigureDefaultKestrel(); - - var startup = new Startup(builder.Configuration, builder.Environment); - - startup.ConfigureServices(builder.Services); - - builder.Host.ConfigureContainer(containerBuilder => - { - startup.ConfigureContainer(containerBuilder); - }); - - var app = builder.Build(); - - startup.Configure(app, app.Environment); - - logger.Info("Starting web host ({applicationContext})...", AppName); - await app.RunWithTasksAsync(); -} -catch (Exception ex) -{ - if (logger != null) - { - logger.Error(ex, "Program terminated unexpectedly ({applicationContext})!", AppName); - } - - throw; -} -finally -{ - // Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux) - LogManager.Shutdown(); -} - -public partial class Program -{ - public static string Namespace = typeof(Startup).Namespace; - public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.') + 1); +// (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 + +var options = new WebApplicationOptions +{ + Args = args, + ContentRootPath = WindowsServiceHelpers.IsWindowsService() ? AppContext.BaseDirectory : default +}; + +var builder = WebApplication.CreateBuilder(options); + +builder.Configuration.AddDefaultConfiguration(builder.Environment) + .AddEnvironmentVariables() + .AddCommandLine(args); + +var logger = LogManager.Setup() + .SetupExtensions(s => + { + s.RegisterLayoutRenderer("application-context", (logevent) => AppName); + }) + .LoadConfiguration(builder.Configuration, builder.Environment) + .GetLogger(typeof(Startup).Namespace); + +try +{ + logger.Info("Configuring web host ({applicationContext})...", AppName); + builder.Host.ConfigureDefault(); + builder.WebHost.ConfigureDefaultKestrel(); + + var startup = new Startup(builder.Configuration, builder.Environment); + + startup.ConfigureServices(builder.Services); + + builder.Host.ConfigureContainer(startup.ConfigureContainer); + + var app = builder.Build(); + + startup.Configure(app, app.Environment); + + logger.Info("Starting web host ({applicationContext})...", AppName); + await app.RunWithTasksAsync(); +} +catch (Exception ex) +{ + if (logger != null) + { + logger.Error(ex, "Program terminated unexpectedly ({applicationContext})!", AppName); + } + + throw; +} +finally +{ + // Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux) + LogManager.Shutdown(); +} + +public partial class Program +{ + public static string Namespace = typeof(Startup).Namespace; + public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.') + 1); } \ No newline at end of file diff --git a/common/ASC.Migration/Properties/launchSettings.json b/common/ASC.Migration.BackgroundTasks/Properties/launchSettings.json similarity index 96% rename from common/ASC.Migration/Properties/launchSettings.json rename to common/ASC.Migration.BackgroundTasks/Properties/launchSettings.json index 616301c39b..ba327ac555 100644 --- a/common/ASC.Migration/Properties/launchSettings.json +++ b/common/ASC.Migration.BackgroundTasks/Properties/launchSettings.json @@ -1,28 +1,28 @@ -{ - "profiles": { - "Kestrel WebServer": { - "commandName": "Project", - "launchBrowser": false, - "environmentVariables": { - "$STORAGE_ROOT": "../../Data", - "log__name": "migration", - "log__dir": "../../Logs", - "ASPNETCORE_URLS": "http://localhost:5034", - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "WSL 2 : Ubuntu 20.04": { - "commandName": "WSL2", - "launchBrowser": false, - "launchUrl": "http://localhost:5034", - "environmentVariables": { - "$STORAGE_ROOT": "../../Data", - "log__name": "migration", - "log__dir": "../../Logs", - "ASPNETCORE_URLS": "http://localhost:5034", - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "distributionName": "Ubuntu-20.04" - } - } +{ + "profiles": { + "Kestrel WebServer": { + "commandName": "Project", + "launchBrowser": false, + "environmentVariables": { + "$STORAGE_ROOT": "../../Data", + "log__name": "migration", + "log__dir": "../../Logs", + "ASPNETCORE_URLS": "http://localhost:5034", + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "WSL 2 : Ubuntu 20.04": { + "commandName": "WSL2", + "launchBrowser": false, + "launchUrl": "http://localhost:5034", + "environmentVariables": { + "$STORAGE_ROOT": "../../Data", + "log__name": "migration", + "log__dir": "../../Logs", + "ASPNETCORE_URLS": "http://localhost:5034", + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "distributionName": "Ubuntu-20.04" + } + } } \ No newline at end of file diff --git a/common/ASC.Migration/Startup.cs b/common/ASC.Migration.BackgroundTasks/Startup.cs similarity index 97% rename from common/ASC.Migration/Startup.cs rename to common/ASC.Migration.BackgroundTasks/Startup.cs index e7a96ec86d..6eb27d2805 100644 --- a/common/ASC.Migration/Startup.cs +++ b/common/ASC.Migration.BackgroundTasks/Startup.cs @@ -1,45 +1,45 @@ -// (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 - -namespace ASC.Migration; - -public class Startup : BaseStartup -{ - public Startup(IConfiguration configuration, IHostEnvironment hostEnvironment) - : base(configuration, hostEnvironment) - { - - } - - public override void ConfigureServices(IServiceCollection services) - { - Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); - - services.AddMemoryCache(); - - base.ConfigureServices(services); - } +// (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 + +namespace ASC.Migration; + +public class Startup : BaseStartup +{ + public Startup(IConfiguration configuration, IHostEnvironment hostEnvironment) + : base(configuration, hostEnvironment) + { + + } + + public override void ConfigureServices(IServiceCollection services) + { + Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); + + services.AddMemoryCache(); + + base.ConfigureServices(services); + } } diff --git a/common/ASC.Migration.BackgroundTasks/appsettings.json b/common/ASC.Migration.BackgroundTasks/appsettings.json new file mode 100644 index 0000000000..9bf702e310 --- /dev/null +++ b/common/ASC.Migration.BackgroundTasks/appsettings.json @@ -0,0 +1,3 @@ +{ + "pathToConf": "..\\..\\..\\config" +} diff --git a/common/ASC.Migration/ASC.Migration.csproj b/common/ASC.Migration/ASC.Migration.Core.csproj similarity index 62% rename from common/ASC.Migration/ASC.Migration.csproj rename to common/ASC.Migration/ASC.Migration.Core.csproj index 2f66287406..f6ca6ddf75 100644 --- a/common/ASC.Migration/ASC.Migration.csproj +++ b/common/ASC.Migration/ASC.Migration.Core.csproj @@ -1,17 +1,14 @@ - + net7.0 false - ASC.Migration + ASC.Migration.Core Ascensio System SIA ASC.Migration (c) Ascensio System SIA. All rights reserved enable false - false - false - true @@ -20,15 +17,34 @@ 1701;1702;NU1701 - - - - + + + + - - - + + + + + + + + + + + + True + True + MigrationResource.resx + + + + + + PublicResXFileCodeGenerator + MigrationResource.Designer.cs + \ No newline at end of file diff --git a/common/ASC.Migration/GlobalUsings.cs b/common/ASC.Migration/GlobalUsings.cs index e4648209ff..fc803d9b26 100644 --- a/common/ASC.Migration/GlobalUsings.cs +++ b/common/ASC.Migration/GlobalUsings.cs @@ -26,36 +26,26 @@ global using System.IO.Compression; global using System.Reflection; -global using System.Runtime.Caching; global using System.Runtime.Serialization; global using System.Text; global using System.Text.Json.Serialization; global using System.Text.RegularExpressions; -global using ASC.Api.Core; -global using ASC.Api.Core.Extensions; global using ASC.Common; -global using ASC.Common.Caching; global using ASC.Common.Log; -global using ASC.Common.Web; global using ASC.Core; global using ASC.Core.Users; global using ASC.Files.Core; global using ASC.Files.Core.Resources; global using ASC.Files.Core.Security; -global using ASC.Migration; -global using ASC.Migration.ApiModels.ResponseDto; global using ASC.Migration.Core; global using ASC.Migration.Core.Models; global using ASC.Migration.Core.Models.Api; +global using ASC.Migration.Core.Resources; global using ASC.Migration.GoogleWorkspace.Models; global using ASC.Migration.GoogleWorkspace.Models.Parse; -global using ASC.Migration.Resources; -global using ASC.Web.Api.Routing; -global using ASC.Web.Core.Files; global using ASC.Web.Files.Classes; global using ASC.Web.Files.Services.WCFService; -global using ASC.Web.Studio.Core.Notify; global using Autofac; @@ -63,11 +53,8 @@ global using HtmlAgilityPack; global using Ical.Net; -global using Microsoft.AspNetCore.Mvc; -global using Microsoft.Extensions.Hosting.WindowsServices; +global using Microsoft.Extensions.Logging; global using MimeKit; global using Newtonsoft.Json; - -global using NLog; diff --git a/common/ASC.Migration/Resources/MigrationResource.Designer.cs b/common/ASC.Migration/Resources/MigrationResource.Designer.cs index ed393ee965..a49a20889d 100644 --- a/common/ASC.Migration/Resources/MigrationResource.Designer.cs +++ b/common/ASC.Migration/Resources/MigrationResource.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace ASC.Migration.Resources { +namespace ASC.Migration.Core.Resources { using System; @@ -19,10 +19,10 @@ namespace ASC.Migration.Resources { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class MigrationResource { + public class MigrationResource { private static global::System.Resources.ResourceManager resourceMan; @@ -36,10 +36,10 @@ namespace ASC.Migration.Resources { /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { + public static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ASC.Migration.Resources.MigrationResource", typeof(MigrationResource).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ASC.Migration.Core.Resources.MigrationResource", typeof(MigrationResource).Assembly); resourceMan = temp; } return resourceMan; @@ -51,7 +51,7 @@ namespace ASC.Migration.Resources { /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { + public static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } @@ -63,7 +63,7 @@ namespace ASC.Migration.Resources { /// /// Looks up a localized string similar to Clearing temporary data. /// - internal static string ClearingTemporaryData { + public static string ClearingTemporaryData { get { return ResourceManager.GetString("ClearingTemporaryData", resourceCulture); } @@ -72,7 +72,7 @@ namespace ASC.Migration.Resources { /// /// Looks up a localized string similar to Data processing.... /// - internal static string DataProcessing { + public static string DataProcessing { get { return ResourceManager.GetString("DataProcessing", resourceCulture); } @@ -81,7 +81,7 @@ namespace ASC.Migration.Resources { /// /// Looks up a localized string similar to Data processing completed. /// - internal static string DataProcessingCompleted { + public static string DataProcessingCompleted { get { return ResourceManager.GetString("DataProcessingCompleted", resourceCulture); } @@ -90,7 +90,7 @@ namespace ASC.Migration.Resources { /// /// Looks up a localized string similar to Database parsing. /// - internal static string DumpParse { + public static string DumpParse { get { return ResourceManager.GetString("DumpParse", resourceCulture); } @@ -99,7 +99,7 @@ namespace ASC.Migration.Resources { /// /// Looks up a localized string similar to Mail`s Contacts. /// - internal static string GoogleModuleNameContacts { + public static string GoogleModuleNameContacts { get { return ResourceManager.GetString("GoogleModuleNameContacts", resourceCulture); } @@ -108,7 +108,7 @@ namespace ASC.Migration.Resources { /// /// Looks up a localized string similar to Google Drive`s Files. /// - internal static string GoogleModuleNameDocuments { + public static string GoogleModuleNameDocuments { get { return ResourceManager.GetString("GoogleModuleNameDocuments", resourceCulture); } @@ -117,7 +117,7 @@ namespace ASC.Migration.Resources { /// /// Looks up a localized string similar to Group migration {0} ({1}/{2}). /// - internal static string GroupMigration { + public static string GroupMigration { get { return ResourceManager.GetString("GroupMigration", resourceCulture); } @@ -126,7 +126,7 @@ namespace ASC.Migration.Resources { /// /// Looks up a localized string similar to Migrating user contacts {0} ({1}/{2}). /// - internal static string MigratingUserContacts { + public static string MigratingUserContacts { get { return ResourceManager.GetString("MigratingUserContacts", resourceCulture); } @@ -135,7 +135,7 @@ namespace ASC.Migration.Resources { /// /// Looks up a localized string similar to Migrating user files {0} ({1}/{2}). /// - internal static string MigratingUserFiles { + public static string MigratingUserFiles { get { return ResourceManager.GetString("MigratingUserFiles", resourceCulture); } @@ -144,7 +144,7 @@ namespace ASC.Migration.Resources { /// /// Looks up a localized string similar to Migration canceled. /// - internal static string MigrationCanceled { + public static string MigrationCanceled { get { return ResourceManager.GetString("MigrationCanceled", resourceCulture); } @@ -153,16 +153,61 @@ namespace ASC.Migration.Resources { /// /// Looks up a localized string similar to Migration completed. /// - internal static string MigrationCompleted { + public static string MigrationCompleted { get { return ResourceManager.GetString("MigrationCompleted", resourceCulture); } } + /// + /// Looks up a localized string similar to Error while initializing {0} migrator. + /// + public static string MigrationInitException { + get { + return ResourceManager.GetString("MigrationInitException", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No such migration provider. + /// + public static string MigrationNotFoundException { + get { + return ResourceManager.GetString("MigrationNotFoundException", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No migration is in progress. + /// + public static string MigrationProgressException { + get { + return ResourceManager.GetString("MigrationProgressException", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Parsing is still in progress. + /// + public static string MigrationStartException { + get { + return ResourceManager.GetString("MigrationStartException", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Migration is already in progress. + /// + public static string MigrationUploadException { + get { + return ResourceManager.GetString("MigrationUploadException", resourceCulture); + } + } + /// /// Looks up a localized string similar to Calendar. /// - internal static string ModuleNameCalendar { + public static string ModuleNameCalendar { get { return ResourceManager.GetString("ModuleNameCalendar", resourceCulture); } @@ -171,7 +216,7 @@ namespace ASC.Migration.Resources { /// /// Looks up a localized string similar to Groups. /// - internal static string ModuleNameGroups { + public static string ModuleNameGroups { get { return ResourceManager.GetString("ModuleNameGroups", resourceCulture); } @@ -180,7 +225,7 @@ namespace ASC.Migration.Resources { /// /// Looks up a localized string similar to Mail. /// - internal static string ModuleNameMail { + public static string ModuleNameMail { get { return ResourceManager.GetString("ModuleNameMail", resourceCulture); } @@ -189,7 +234,7 @@ namespace ASC.Migration.Resources { /// /// Looks up a localized string similar to Users. /// - internal static string ModuleNameUsers { + public static string ModuleNameUsers { get { return ResourceManager.GetString("ModuleNameUsers", resourceCulture); } @@ -198,7 +243,7 @@ namespace ASC.Migration.Resources { /// /// Looks up a localized string similar to Contacts. /// - internal static string NextcloudModuleNameContacts { + public static string NextcloudModuleNameContacts { get { return ResourceManager.GetString("NextcloudModuleNameContacts", resourceCulture); } @@ -207,7 +252,7 @@ namespace ASC.Migration.Resources { /// /// Looks up a localized string similar to User`s Files. /// - internal static string NextcloudModuleNameDocuments { + public static string NextcloudModuleNameDocuments { get { return ResourceManager.GetString("NextcloudModuleNameDocuments", resourceCulture); } @@ -216,7 +261,7 @@ namespace ASC.Migration.Resources { /// /// Looks up a localized string similar to Calendar. /// - internal static string OnlyofficeModuleNameCalendar { + public static string OnlyofficeModuleNameCalendar { get { return ResourceManager.GetString("OnlyofficeModuleNameCalendar", resourceCulture); } @@ -225,7 +270,7 @@ namespace ASC.Migration.Resources { /// /// Looks up a localized string similar to Documents. /// - internal static string OnlyofficeModuleNameDocuments { + public static string OnlyofficeModuleNameDocuments { get { return ResourceManager.GetString("OnlyofficeModuleNameDocuments", resourceCulture); } @@ -234,7 +279,7 @@ namespace ASC.Migration.Resources { /// /// Looks up a localized string similar to Mail. /// - internal static string OnlyofficeModuleNameMail { + public static string OnlyofficeModuleNameMail { get { return ResourceManager.GetString("OnlyofficeModuleNameMail", resourceCulture); } @@ -243,7 +288,7 @@ namespace ASC.Migration.Resources { /// /// Looks up a localized string similar to People. /// - internal static string OnlyofficeModuleNamePeople { + public static string OnlyofficeModuleNamePeople { get { return ResourceManager.GetString("OnlyofficeModuleNamePeople", resourceCulture); } @@ -252,7 +297,7 @@ namespace ASC.Migration.Resources { /// /// Looks up a localized string similar to Preparing for migration. /// - internal static string PreparingForMigration { + public static string PreparingForMigration { get { return ResourceManager.GetString("PreparingForMigration", resourceCulture); } @@ -261,7 +306,7 @@ namespace ASC.Migration.Resources { /// /// Looks up a localized string similar to Starting data processing.... /// - internal static string StartOfDataProcessing { + public static string StartOfDataProcessing { get { return ResourceManager.GetString("StartOfDataProcessing", resourceCulture); } @@ -270,7 +315,7 @@ namespace ASC.Migration.Resources { /// /// Looks up a localized string similar to Unzipping.... /// - internal static string Unzipping { + public static string Unzipping { get { return ResourceManager.GetString("Unzipping", resourceCulture); } @@ -279,7 +324,7 @@ namespace ASC.Migration.Resources { /// /// Looks up a localized string similar to Unzipping completed.... /// - internal static string UnzippingFinished { + public static string UnzippingFinished { get { return ResourceManager.GetString("UnzippingFinished", resourceCulture); } @@ -288,7 +333,7 @@ namespace ASC.Migration.Resources { /// /// Looks up a localized string similar to User calendar migration {0} ({1}/{2}). /// - internal static string UserCalendarMigration { + public static string UserCalendarMigration { get { return ResourceManager.GetString("UserCalendarMigration", resourceCulture); } @@ -297,7 +342,7 @@ namespace ASC.Migration.Resources { /// /// Looks up a localized string similar to User migration {0} ({1}/{2}). /// - internal static string UserMigration { + public static string UserMigration { get { return ResourceManager.GetString("UserMigration", resourceCulture); } @@ -306,7 +351,7 @@ namespace ASC.Migration.Resources { /// /// Looks up a localized string similar to Failed to import user: {0} ({1}/{2}). /// - internal static string UserSkipped { + public static string UserSkipped { get { return ResourceManager.GetString("UserSkipped", resourceCulture); } diff --git a/common/ASC.Migration/Resources/MigrationResource.resx b/common/ASC.Migration/Resources/MigrationResource.resx index b7d7f30210..6e36bc6643 100644 --- a/common/ASC.Migration/Resources/MigrationResource.resx +++ b/common/ASC.Migration/Resources/MigrationResource.resx @@ -150,6 +150,21 @@ Migration completed + + Error while initializing {0} migrator + + + No such migration provider + + + No migration is in progress + + + Parsing is still in progress + + + Migration is already in progress + Calendar diff --git a/web/ASC.Web.Api/ASC.Web.Api.csproj b/web/ASC.Web.Api/ASC.Web.Api.csproj index 7d45d01b90..1ea8684f59 100644 --- a/web/ASC.Web.Api/ASC.Web.Api.csproj +++ b/web/ASC.Web.Api/ASC.Web.Api.csproj @@ -49,6 +49,7 @@ + diff --git a/common/ASC.Migration/Api/MigrationController.cs b/web/ASC.Web.Api/Api/MigrationController.cs similarity index 87% rename from common/ASC.Migration/Api/MigrationController.cs rename to web/ASC.Web.Api/Api/MigrationController.cs index e43a723d8f..e6a78e7636 100644 --- a/common/ASC.Migration/Api/MigrationController.cs +++ b/web/ASC.Web.Api/Api/MigrationController.cs @@ -1,61 +1,63 @@ -// (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 - +// (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.Migration.Core.Resources; + namespace ASC.Api.Migration; - + [Scope] [DefaultRoute] [ApiController] public class MigrationController : ControllerBase -{ - private const string MigrationCacheKey = "ASC.Migration.Ongoing"; - private readonly CoreBaseSettings _coreBaseSettings; - private readonly UserManager _userManager; - private readonly AuthContext _authContext; - private readonly TempPath _tempPath; - private readonly StudioNotifyService _studioNotifyService; - private readonly ICache _cache; - private readonly IHttpContextAccessor _httpContextAccessor; - - public MigrationController( - CoreBaseSettings coreBaseSettings, - UserManager userManager, - AuthContext authContext, - TempPath tempPath, - StudioNotifyService studioNotifyService, - ICache cache, +{ + private const string MigrationCacheKey = "ASC.Migration.Ongoing"; + private readonly CoreBaseSettings _coreBaseSettings; + private readonly UserManager _userManager; + private readonly AuthContext _authContext; + private readonly TempPath _tempPath; + private readonly StudioNotifyService _studioNotifyService; + private readonly ICache _cache; + private readonly IHttpContextAccessor _httpContextAccessor; + + public MigrationController( + CoreBaseSettings coreBaseSettings, + UserManager userManager, + AuthContext authContext, + TempPath tempPath, + StudioNotifyService studioNotifyService, + ICache cache, IHttpContextAccessor httpContextAccessor) - { - _coreBaseSettings = coreBaseSettings; - _userManager = userManager; - _authContext = authContext; - _tempPath = tempPath; - _studioNotifyService = studioNotifyService; - _cache = cache; - _httpContextAccessor = httpContextAccessor; + { + _coreBaseSettings = coreBaseSettings; + _userManager = userManager; + _authContext = authContext; + _tempPath = tempPath; + _studioNotifyService = studioNotifyService; + _cache = cache; + _httpContextAccessor = httpContextAccessor; } /// @@ -65,11 +67,11 @@ public class MigrationController : ControllerBase [HttpGet("backuptmp")] public async Task GetTmpFolderAsync() { - if (!_coreBaseSettings.Standalone || !await _userManager.IsDocSpaceAdminAsync(_authContext.CurrentAccount.ID)) - { - throw new System.Security.SecurityException(); - } - + if (!_coreBaseSettings.Standalone || !await _userManager.IsDocSpaceAdminAsync(_authContext.CurrentAccount.ID)) + { + throw new SecurityException(Resource.ErrorAccessDenied); + } + var tempFolder = Path.Combine(_tempPath.GetTempPath(), "migration", DateTime.Now.ToString("dd.MM.yyyy_HH_mm")); if (!Directory.Exists(tempFolder)) @@ -86,11 +88,11 @@ public class MigrationController : ControllerBase [HttpGet("list")] public async Task ListAsync() { - if (!_coreBaseSettings.Standalone || !await _userManager.IsDocSpaceAdminAsync(_authContext.CurrentAccount.ID)) - { - throw new System.Security.SecurityException(); - } - + if (!_coreBaseSettings.Standalone || !await _userManager.IsDocSpaceAdminAsync(_authContext.CurrentAccount.ID)) + { + throw new SecurityException(Resource.ErrorAccessDenied); + } + return MigrationCore.GetAvailableMigrations(); } @@ -102,20 +104,20 @@ public class MigrationController : ControllerBase [HttpPost("init/{migratorName}")] public async Task UploadAndInitAsync(string migratorName, string path) { - if (!_coreBaseSettings.Standalone || !await _userManager.IsDocSpaceAdminAsync(_authContext.CurrentAccount.ID)) - { - throw new System.Security.SecurityException(); - } - + if (!_coreBaseSettings.Standalone || !await _userManager.IsDocSpaceAdminAsync(_authContext.CurrentAccount.ID)) + { + throw new SecurityException(Resource.ErrorAccessDenied); + } + if (GetOngoingMigration() != null) { - throw new Exception("Migration is already in progress"); + throw new Exception(MigrationResource.MigrationUploadException); } var migratorMeta = MigrationCore.GetMigrator(migratorName); if (migratorMeta == null) { - throw new ItemNotFoundException("No such migration provider"); + throw new ItemNotFoundException(MigrationResource.MigrationNotFoundException); } var cts = new CancellationTokenSource(); var migrator = (IMigration)Activator.CreateInstance(migratorMeta.MigratorType); @@ -125,7 +127,7 @@ public class MigrationController : ControllerBase } catch (Exception ex) { - throw new Exception($"Error while initializing {migratorMeta.MigratorInfo.Name} migrator", ex); + throw new Exception(string.Format(MigrationResource.MigrationUploadException, migratorMeta.MigratorInfo.Name), ex); } var ongoingMigration = new OngoingMigration { Migration = migrator, CancelTokenSource = cts }; @@ -141,11 +143,11 @@ public class MigrationController : ControllerBase [HttpGet("status")] public async Task Status() { - if (!_coreBaseSettings.Standalone || !await _userManager.IsDocSpaceAdminAsync(_authContext.CurrentAccount.ID)) - { - throw new System.Security.SecurityException(); - } - + if (!_coreBaseSettings.Standalone || !await _userManager.IsDocSpaceAdminAsync(_authContext.CurrentAccount.ID)) + { + throw new SecurityException(Resource.ErrorAccessDenied); + } + var ongoingMigration = GetOngoingMigration(); if (ongoingMigration == null) { @@ -175,15 +177,15 @@ public class MigrationController : ControllerBase [HttpPost("cancel")] public async Task CancelAsync() { - if (!_coreBaseSettings.Standalone || !await _userManager.IsDocSpaceAdminAsync(_authContext.CurrentAccount.ID)) - { - throw new System.Security.SecurityException(); - } - + if (!_coreBaseSettings.Standalone || !await _userManager.IsDocSpaceAdminAsync(_authContext.CurrentAccount.ID)) + { + throw new SecurityException(Resource.ErrorAccessDenied); + } + var ongoingMigration = GetOngoingMigration(); if (ongoingMigration == null) { - throw new Exception("No migration is in progress"); + throw new Exception(MigrationResource.MigrationProgressException); } ongoingMigration.CancelTokenSource.Cancel(); } @@ -195,19 +197,19 @@ public class MigrationController : ControllerBase [HttpPost("migrate")] public async Task MigrateAsync(MigrationApiInfo info) { - if (!_coreBaseSettings.Standalone || !await _userManager.IsDocSpaceAdminAsync(_authContext.CurrentAccount.ID)) - { - throw new System.Security.SecurityException(); - } - + if (!_coreBaseSettings.Standalone || !await _userManager.IsDocSpaceAdminAsync(_authContext.CurrentAccount.ID)) + { + throw new SecurityException(Resource.ErrorAccessDenied); + } + var ongoingMigration = GetOngoingMigration(); if (ongoingMigration == null) { - throw new Exception("No migration is in progress"); + throw new Exception(MigrationResource.MigrationProgressException); } else if (!ongoingMigration.ParseTask.IsCompleted) { - throw new Exception("Parsing is still in progress"); + throw new Exception(MigrationResource.MigrationStartException); } ongoingMigration.MigrationTask = ongoingMigration.Migration.Migrate(info); @@ -220,19 +222,19 @@ public class MigrationController : ControllerBase [HttpGet("logs")] public async Task LogsAsync() { - if (!_coreBaseSettings.Standalone || !await _userManager.IsDocSpaceAdminAsync(_authContext.CurrentAccount.ID)) - { - throw new System.Security.SecurityException(); - } - + if (!_coreBaseSettings.Standalone || !await _userManager.IsDocSpaceAdminAsync(_authContext.CurrentAccount.ID)) + { + throw new SecurityException(Resource.ErrorAccessDenied); + } + var ongoingMigration = GetOngoingMigration(); if (ongoingMigration == null) { - throw new Exception("No migration is in progress"); - } - - _httpContextAccessor.HttpContext.Response.Headers.Add("Content-Disposition", ContentDispositionUtil.GetHeaderValue("migration.log")); - _httpContextAccessor.HttpContext.Response.ContentType = "text/plain; charset=UTF-8"; + throw new Exception(MigrationResource.MigrationProgressException); + } + + _httpContextAccessor.HttpContext.Response.Headers.Add("Content-Disposition", ContentDispositionUtil.GetHeaderValue("migration.log")); + _httpContextAccessor.HttpContext.Response.ContentType = "text/plain; charset=UTF-8"; await ongoingMigration.Migration.GetLogs().CopyToAsync(_httpContextAccessor.HttpContext.Response.Body); } @@ -243,17 +245,17 @@ public class MigrationController : ControllerBase [HttpPost("finish")] public async Task FinishAsync(bool isSendWelcomeEmail) { - if (!_coreBaseSettings.Standalone || !await _userManager.IsDocSpaceAdminAsync(_authContext.CurrentAccount.ID)) - { - throw new System.Security.SecurityException(); - } - + if (!_coreBaseSettings.Standalone || !await _userManager.IsDocSpaceAdminAsync(_authContext.CurrentAccount.ID)) + { + throw new SecurityException(Resource.ErrorAccessDenied); + } + if (isSendWelcomeEmail) { var ongoingMigration = GetOngoingMigration(); if (ongoingMigration == null) { - throw new Exception("No migration is in progress"); + throw new Exception(MigrationResource.MigrationProgressException); } var guidUsers = ongoingMigration.Migration.GetGuidImportedUsers(); foreach (var gu in guidUsers) @@ -263,9 +265,9 @@ public class MigrationController : ControllerBase } } ClearCache(); - } - - // ToDo: Use ASCCache + } + + // ToDo: Use ASCCache private void StoreOngoingMigration(OngoingMigration migration) { _cache.Insert(MigrationCacheKey, migration, TimeSpan.FromDays(1)); @@ -277,7 +279,7 @@ public class MigrationController : ControllerBase } private void ClearCache() - { + { _cache.Remove(MigrationCacheKey); } diff --git a/common/ASC.Migration/ApiModels/ResponseDto/MigrationStatus.cs b/web/ASC.Web.Api/ApiModels/ResponseDto/MigrationStatus.cs similarity index 95% rename from common/ASC.Migration/ApiModels/ResponseDto/MigrationStatus.cs rename to web/ASC.Web.Api/ApiModels/ResponseDto/MigrationStatus.cs index 635df947a1..ec2f520528 100644 --- a/common/ASC.Migration/ApiModels/ResponseDto/MigrationStatus.cs +++ b/web/ASC.Web.Api/ApiModels/ResponseDto/MigrationStatus.cs @@ -1,30 +1,30 @@ -// (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 - -namespace ASC.Migration.ApiModels.ResponseDto; +// (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 + +namespace ASC.Web.Api.ApiModels.ResponseDto; public class MigrationStatus { diff --git a/web/ASC.Web.Api/GlobalUsings.cs b/web/ASC.Web.Api/GlobalUsings.cs index c7e9e6979b..ad7bd07eda 100644 --- a/web/ASC.Web.Api/GlobalUsings.cs +++ b/web/ASC.Web.Api/GlobalUsings.cs @@ -29,6 +29,8 @@ global using System.Globalization; global using System.Net; global using System.Net.Mail; global using System.Net.Sockets; +global using System.Reflection; +global using System.Runtime.Caching; global using System.Security; global using System.ServiceModel.Security; global using System.Text; @@ -56,7 +58,6 @@ global using ASC.AuditTrail.Types; global using ASC.Common; global using ASC.Common.Caching; global using ASC.Common.Log; -global using ASC.Web.Core.RemovePortal; global using ASC.Common.Mapping; global using ASC.Common.Radicale; global using ASC.Common.Radicale.Core; @@ -96,13 +97,15 @@ global using ASC.Feed.Data; global using ASC.Files.Core.Core; global using ASC.Files.Core.EF; global using ASC.Files.Core.Helpers; -global using ASC.Files.Core.VirtualRooms; global using ASC.Files.Core.Security; +global using ASC.Files.Core.VirtualRooms; global using ASC.Geolocation; global using ASC.IPSecurity; global using ASC.MessagingSystem; global using ASC.MessagingSystem.Core; global using ASC.MessagingSystem.EF.Model; +global using ASC.Migration.Core; +global using ASC.Migration.Core.Models.Api; global using ASC.Notify.Cron; global using ASC.Security.Cryptography; global using ASC.Web.Api; @@ -116,11 +119,13 @@ global using ASC.Web.Api.Mapping; global using ASC.Web.Api.Models; global using ASC.Web.Api.Routing; global using ASC.Web.Core; +global using ASC.Web.Core.Files; global using ASC.Web.Core.Helpers; global using ASC.Web.Core.Mobile; global using ASC.Web.Core.Notify; global using ASC.Web.Core.PublicResources; global using ASC.Web.Core.Quota; +global using ASC.Web.Core.RemovePortal; global using ASC.Web.Core.Sms; global using ASC.Web.Core.Users; global using ASC.Web.Core.Utility; From 5d6b1baebedc8ff9fc3551ae9632d84b6f38a304 Mon Sep 17 00:00:00 2001 From: Elyor Djalilov Date: Mon, 7 Aug 2023 22:02:57 +0500 Subject: [PATCH 055/335] added progressBar component --- .../Stepper/FifthStep/index.js | 44 +++++++++++++++---- .../Stepper/FirstStep/index.js | 12 ++++- .../PortalSettings/utils/getStepTexts.js | 8 ++-- 3 files changed, 49 insertions(+), 15 deletions(-) diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/FifthStep/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/FifthStep/index.js index 447e958264..7410da8373 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/FifthStep/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/FifthStep/index.js @@ -1,16 +1,42 @@ import SaveCancelButtons from "@docspace/components/save-cancel-buttons"; +import ProgressBar from "@docspace/components/progress-bar"; +import Text from "@docspace/components/text"; +import styled from "styled-components"; + +const Wrapper = styled.div` + max-width: 350px; + + .data-import-progress-text { + position: relative; + max-width: 700px; + font-size: 12px; + margin-bottom: 8px; + line-height: 16px; + color: #333333; + } + + .data-import-progress-bar { + margin-bottom: 16px; + } +`; const FifthStep = ({ t, onNextStepClick, onPrevStepClick, showReminder }) => { return ( - + + + {t("Settings:DataImportProcessingDescription")} + + + + ); }; diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/FirstStep/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/FirstStep/index.js index 748750176d..e4efba103e 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/FirstStep/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/Stepper/FirstStep/index.js @@ -1,11 +1,13 @@ import { useState } from "react"; import { inject, observer } from "mobx-react"; +import styled from "styled-components"; + import Text from "@docspace/components/text"; import Button from "@docspace/components/button"; import FileInput from "@docspace/components/file-input"; +import ProgressBar from "@docspace/components/progress-bar"; import SaveCancelButtons from "@docspace/components/save-cancel-buttons"; import { CancelUploadDialog } from "SRC_DIR/components/dialogs"; -import styled from "styled-components"; const Wrapper = styled.div` max-width: 350px; @@ -18,13 +20,18 @@ const Wrapper = styled.div` .upload-backup-input { height: 32px; - margin-bottom: 12px; + margin-bottom: 16px; } .upload-backup-text { font-size: 12px; + margin-top: -4px; margin-bottom: 12px; } + + .data-import-progress-bar { + margin: 12px 0 16px; + } `; const FirstStep = ({ @@ -68,6 +75,7 @@ const FirstStep = ({ {t("Settings:BackupFileUploading")} +