Web: Client: Data Import: nextcloud index page was translated into ts
This commit is contained in:
parent
9a9e89180c
commit
515fc32865
@ -24,7 +24,12 @@
|
||||
// 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
|
||||
|
||||
import SelectFileStep from "./SelectFileStep";
|
||||
import { Trans } from "react-i18next";
|
||||
|
||||
import { Text } from "@docspace/shared/components/text";
|
||||
import { HelpButton } from "@docspace/shared/components/help-button";
|
||||
|
||||
import SelectFileStep from "../../components/SelectFileStep";
|
||||
import SelectUsersStep from "./SelectUsersStep";
|
||||
import AddEmailsStep from "./AddEmailsStep";
|
||||
import SelectUsersTypeStep from "./SelectUsersTypeStep";
|
||||
@ -32,43 +37,22 @@ import ImportStep from "./ImportStep";
|
||||
import ImportProcessingStep from "./ImportProcessingStep";
|
||||
import ImportCompleteStep from "./ImportCompleteStep";
|
||||
|
||||
import { HelpButton } from "@docspace/shared/components/help-button";
|
||||
import { Text } from "@docspace/shared/components/text";
|
||||
|
||||
import { Trans } from "react-i18next";
|
||||
import { TFunciton } from "../../types";
|
||||
|
||||
export const getStepsData = (
|
||||
t,
|
||||
currentStep,
|
||||
setCurrentStep,
|
||||
isTypeSelectEmpty,
|
||||
t: TFunciton,
|
||||
currentStep: number,
|
||||
incrementStep: () => void,
|
||||
decrementStep: () => void,
|
||||
isTypeSelectEmpty: boolean,
|
||||
) => {
|
||||
const isSixthStep = currentStep === 6;
|
||||
|
||||
const incrementStep = () => {
|
||||
setCurrentStep((prev) => {
|
||||
const nextStep = prev < 7 ? prev + 1 : 7;
|
||||
return nextStep;
|
||||
});
|
||||
};
|
||||
|
||||
const decrementStep = () => {
|
||||
if (currentStep !== 1) {
|
||||
setCurrentStep((prev) => prev - 1);
|
||||
}
|
||||
};
|
||||
|
||||
return [
|
||||
{
|
||||
title: t("Common:SelectFile"),
|
||||
description: t("Settings:SelectFileDescriptionNextcloud"),
|
||||
component: (
|
||||
<SelectFileStep
|
||||
t={t}
|
||||
incrementStep={incrementStep}
|
||||
decrementStep={decrementStep}
|
||||
/>
|
||||
),
|
||||
component: <SelectFileStep t={t} incrementStep={incrementStep} />,
|
||||
},
|
||||
{
|
||||
title: t("Settings:SelectUsersWithEmail"),
|
||||
@ -117,10 +101,10 @@ export const getStepsData = (
|
||||
ns="Settings"
|
||||
t={t}
|
||||
components={{
|
||||
1: <b></b>,
|
||||
2: <b></b>,
|
||||
3: <b></b>,
|
||||
4: <b></b>,
|
||||
1: <b />,
|
||||
2: <b />,
|
||||
3: <b />,
|
||||
4: <b />,
|
||||
}}
|
||||
/>
|
||||
</Text>
|
||||
@ -160,7 +144,6 @@ export const getStepsData = (
|
||||
<ImportProcessingStep
|
||||
t={t}
|
||||
incrementStep={incrementStep}
|
||||
decrementStep={decrementStep}
|
||||
isSixthStep={isSixthStep}
|
||||
/>
|
||||
),
|
||||
@ -168,13 +151,7 @@ export const getStepsData = (
|
||||
{
|
||||
title: t("Settings:DataImportComplete"),
|
||||
description: t("Settings:ImportCompleteDescriptionNextcloud"),
|
||||
component: (
|
||||
<ImportCompleteStep
|
||||
t={t}
|
||||
incrementStep={incrementStep}
|
||||
decrementStep={decrementStep}
|
||||
/>
|
||||
),
|
||||
component: <ImportCompleteStep t={t} />,
|
||||
},
|
||||
];
|
||||
};
|
@ -1,192 +0,0 @@
|
||||
// (c) Copyright Ascensio System SIA 2009-2024
|
||||
//
|
||||
// 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
|
||||
|
||||
import { useState, useEffect } from "react";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { withTranslation } from "react-i18next";
|
||||
import { isMobile } from "react-device-detect";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import useViewEffect from "SRC_DIR/Hooks/useViewEffect";
|
||||
import styled from "styled-components";
|
||||
|
||||
import { Text } from "@docspace/shared/components/text";
|
||||
import { toastr } from "@docspace/shared/components/toast";
|
||||
import { getStepsData } from "./Stepper";
|
||||
import BreakpointWarning from "SRC_DIR/components/BreakpointWarning";
|
||||
import SelectFileLoader from "../sub-components/SelectFileLoader";
|
||||
|
||||
const NextcloudWrapper = styled.div`
|
||||
max-width: 700px;
|
||||
|
||||
.data-import-counter {
|
||||
margin-top: 19px;
|
||||
margin-bottom: 9px;
|
||||
}
|
||||
|
||||
.data-import-section-description {
|
||||
margin-bottom: 8px;
|
||||
font-size: 12px;
|
||||
}
|
||||
`;
|
||||
|
||||
const NextcloudWorkspace = (props) => {
|
||||
const {
|
||||
t,
|
||||
tReady,
|
||||
theme,
|
||||
clearCheckedAccounts,
|
||||
viewAs,
|
||||
setViewAs,
|
||||
currentDeviceType,
|
||||
getMigrationStatus,
|
||||
setUsers,
|
||||
filteredUsers,
|
||||
} = props;
|
||||
const [currentStep, setCurrentStep] = useState(1);
|
||||
const [shouldRender, setShouldRender] = useState(false);
|
||||
const StepsData = getStepsData(
|
||||
t,
|
||||
currentStep,
|
||||
setCurrentStep,
|
||||
filteredUsers.length === 0,
|
||||
);
|
||||
const navigate = useNavigate();
|
||||
|
||||
useViewEffect({
|
||||
view: viewAs,
|
||||
setView: setViewAs,
|
||||
currentDeviceType,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
try {
|
||||
getMigrationStatus().then((res) => {
|
||||
if (
|
||||
!res ||
|
||||
res.parseResult.users.length +
|
||||
res.parseResult.existUsers.length +
|
||||
res.parseResult.withoutEmailUsers.length ===
|
||||
0
|
||||
) {
|
||||
setShouldRender(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (res.parseResult.migratorName !== "Nextcloud") {
|
||||
const workspacesEnum = {
|
||||
GoogleWorkspace: "google",
|
||||
Nextcloud: "nextcloud",
|
||||
Workspace: "onlyoffice",
|
||||
};
|
||||
const migratorName = res.parseResult.migratorName;
|
||||
|
||||
setShouldRender(true);
|
||||
navigate(
|
||||
`/portal-settings/data-import/migration/${workspacesEnum[migratorName]}?service=${migratorName}`,
|
||||
);
|
||||
}
|
||||
|
||||
if (res.parseResult.operation === "parse" && res.isCompleted) {
|
||||
setUsers(res.parseResult);
|
||||
setCurrentStep(2);
|
||||
}
|
||||
|
||||
if (res.parseResult.operation === "migration" && !res.isCompleted) {
|
||||
setCurrentStep(6);
|
||||
}
|
||||
|
||||
if (res.parseResult.operation === "migration" && res.isCompleted) {
|
||||
setCurrentStep(7);
|
||||
}
|
||||
|
||||
setShouldRender(true);
|
||||
});
|
||||
} catch (error) {
|
||||
toastr.error(error);
|
||||
}
|
||||
|
||||
return clearCheckedAccounts;
|
||||
}, []);
|
||||
|
||||
if (isMobile)
|
||||
return (
|
||||
<BreakpointWarning
|
||||
isMobileUnavailableOnly
|
||||
sectionName={t("Settings:DataImport")}
|
||||
/>
|
||||
);
|
||||
|
||||
if (!tReady || !shouldRender) return <SelectFileLoader />;
|
||||
|
||||
return (
|
||||
<>
|
||||
<NextcloudWrapper>
|
||||
<Text
|
||||
className="data-import-description"
|
||||
lineHeight="20px"
|
||||
color={theme.isBase ? "#657077" : "#ADADAD"}
|
||||
>
|
||||
{t("Settings:AboutDataImport")}
|
||||
</Text>
|
||||
<Text
|
||||
className="data-import-counter"
|
||||
fontSize="16px"
|
||||
fontWeight={700}
|
||||
lineHeight="22px"
|
||||
>
|
||||
{currentStep}/{StepsData.length}. {StepsData[currentStep - 1].title}
|
||||
</Text>
|
||||
<div className="data-import-section-description">
|
||||
{StepsData[currentStep - 1].description}
|
||||
</div>
|
||||
</NextcloudWrapper>
|
||||
{StepsData[currentStep - 1].component}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default inject(({ setup, settingsStore, importAccountsStore }) => {
|
||||
const { clearCheckedAccounts, getMigrationStatus, setUsers, filteredUsers } =
|
||||
importAccountsStore;
|
||||
const { initSettings, viewAs, setViewAs } = setup;
|
||||
const { currentDeviceType } = settingsStore;
|
||||
|
||||
return {
|
||||
initSettings,
|
||||
theme: settingsStore.theme,
|
||||
clearCheckedAccounts,
|
||||
viewAs,
|
||||
setViewAs,
|
||||
currentDeviceType,
|
||||
getMigrationStatus,
|
||||
setUsers,
|
||||
filteredUsers,
|
||||
};
|
||||
})(
|
||||
withTranslation(["Common, SMTPSettings, Settings"])(
|
||||
observer(NextcloudWorkspace),
|
||||
),
|
||||
);
|
@ -0,0 +1,115 @@
|
||||
// (c) Copyright Ascensio System SIA 2009-2024
|
||||
//
|
||||
// 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
|
||||
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import styled from "styled-components";
|
||||
|
||||
import { Text } from "@docspace/shared/components/text";
|
||||
import { getStepsData } from "./Stepper";
|
||||
import SelectFileLoader from "../sub-components/SelectFileLoader";
|
||||
import { InjectedNextcloudProps, NextcloudProps, TFunciton } from "../types";
|
||||
|
||||
const NextcloudWrapper = styled.div`
|
||||
max-width: 700px;
|
||||
|
||||
.data-import-counter {
|
||||
margin-top: 19px;
|
||||
margin-bottom: 9px;
|
||||
}
|
||||
|
||||
.data-import-section-description {
|
||||
margin-bottom: 8px;
|
||||
font-size: 12px;
|
||||
}
|
||||
`;
|
||||
|
||||
const NextcloudWorkspace = (props: NextcloudProps) => {
|
||||
const { theme, filteredUsers, step, incrementStep, decrementStep } =
|
||||
props as InjectedNextcloudProps;
|
||||
|
||||
const { t, ready }: { t: TFunciton; ready: boolean } = useTranslation([
|
||||
"Common, SMTPSettings, Settings",
|
||||
]);
|
||||
|
||||
const StepsData = getStepsData(
|
||||
t,
|
||||
step,
|
||||
incrementStep,
|
||||
decrementStep,
|
||||
filteredUsers.length === 0,
|
||||
);
|
||||
|
||||
if (!ready) return <SelectFileLoader />;
|
||||
|
||||
return (
|
||||
<>
|
||||
<NextcloudWrapper>
|
||||
<Text
|
||||
className="data-import-description"
|
||||
lineHeight="20px"
|
||||
color={theme.isBase ? "#657077" : "#ADADAD"}
|
||||
>
|
||||
{t("Settings:AboutDataImport")}
|
||||
</Text>
|
||||
<Text
|
||||
className="data-import-counter"
|
||||
fontSize="16px"
|
||||
fontWeight={700}
|
||||
lineHeight="22px"
|
||||
>
|
||||
{step}/{StepsData.length}. {StepsData[step - 1].title}
|
||||
</Text>
|
||||
<div className="data-import-section-description">
|
||||
{StepsData[step - 1].description}
|
||||
</div>
|
||||
</NextcloudWrapper>
|
||||
{StepsData[step - 1].component}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default inject<TStore>(({ settingsStore, importAccountsStore }) => {
|
||||
const {
|
||||
filteredUsers,
|
||||
step,
|
||||
setStep,
|
||||
incrementStep,
|
||||
decrementStep,
|
||||
setWorkspace,
|
||||
} = importAccountsStore;
|
||||
const { theme } = settingsStore;
|
||||
|
||||
return {
|
||||
theme,
|
||||
filteredUsers,
|
||||
step,
|
||||
setStep,
|
||||
incrementStep,
|
||||
decrementStep,
|
||||
setWorkspace,
|
||||
};
|
||||
})(observer(NextcloudWorkspace));
|
@ -34,6 +34,7 @@ import { toastr } from "@docspace/shared/components/toast";
|
||||
import { DataImportProps, InjectedDataImportProps } from "./types";
|
||||
|
||||
import Providers from "./components/Providers";
|
||||
import NextcloudWorkspace from "./NextcloudWorkspace";
|
||||
|
||||
const DataImport = (props: DataImportProps) => {
|
||||
const {
|
||||
@ -95,7 +96,7 @@ const DataImport = (props: DataImportProps) => {
|
||||
}, [isMigrationInit, updateStatus]);
|
||||
|
||||
return workspace === "Nextcloud" ? (
|
||||
<div>next</div>
|
||||
<NextcloudWorkspace />
|
||||
) : workspace === "GoogleWorkspace" ? (
|
||||
<div>google</div>
|
||||
) : workspace === "Workspace" ? (
|
||||
|
@ -24,6 +24,10 @@
|
||||
// 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
|
||||
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
export type TFunciton = ReturnType<typeof useTranslation>["t"];
|
||||
|
||||
export interface ProvidersProps {}
|
||||
|
||||
export interface InjectedProvidersProps extends ProvidersProps {
|
||||
@ -39,6 +43,7 @@ export interface InjectedProvidersProps extends ProvidersProps {
|
||||
}
|
||||
|
||||
export interface SelectFileStepProps {
|
||||
t: TFunciton;
|
||||
incrementStep: () => void;
|
||||
cancelUploadDialogVisible: TStore["dialogsStore"]["cancelUploadDialogVisible"];
|
||||
setCancelUploadDialogVisible: TStore["dialogsStore"]["setCancelUploadDialogVisible"];
|
||||
@ -53,7 +58,7 @@ export interface SelectFileStepProps {
|
||||
|
||||
export interface DataImportProps {}
|
||||
|
||||
export interface InjectedDataImportProps {
|
||||
export interface InjectedDataImportProps extends DataImportProps {
|
||||
setDocumentTitle: TStore["authStore"]["setDocumentTitle"];
|
||||
getMigrationStatus: TStore["importAccountsStore"]["getMigrationStatus"];
|
||||
viewAs: TStore["setup"]["viewAs"];
|
||||
@ -66,3 +71,13 @@ export interface InjectedDataImportProps {
|
||||
setFiles: TStore["importAccountsStore"]["setFiles"];
|
||||
setIsMigrationInit: TStore["importAccountsStore"]["setIsMigrationInit"];
|
||||
}
|
||||
|
||||
export interface NextcloudProps {}
|
||||
|
||||
export interface InjectedNextcloudProps extends NextcloudProps {
|
||||
theme: TStore["settingsStore"]["theme"];
|
||||
filteredUsers: TStore["importAccountsStore"]["filteredUsers"];
|
||||
step: TStore["importAccountsStore"]["step"];
|
||||
incrementStep: TStore["importAccountsStore"]["incrementStep"];
|
||||
decrementStep: TStore["importAccountsStore"]["decrementStep"];
|
||||
}
|
||||
|
@ -141,6 +141,14 @@ class ImportAccountsStore {
|
||||
this.step = step;
|
||||
};
|
||||
|
||||
incrementStep = () => {
|
||||
this.step += 1;
|
||||
};
|
||||
|
||||
decrementStep = () => {
|
||||
this.step -= 1;
|
||||
};
|
||||
|
||||
setWorkspace = (workspace: TWorkspaceService | "") => {
|
||||
this.workspace = workspace;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user