From 539a0fe3be7a91c8fcaa105a94aaea3330ff1bef Mon Sep 17 00:00:00 2001 From: Tatiana Lopaeva Date: Tue, 5 Oct 2021 19:56:38 +0300 Subject: [PATCH] Web: Restore: cChanging the backup list component to fit the layout. --- .../data-management/styled-backup.js | 50 ++++++++++++++ .../backupListBody.js | 67 ++++++++++++++----- .../sub-components-restore-backup/listRow.js | 43 ++++++++++++ 3 files changed, 142 insertions(+), 18 deletions(-) create mode 100644 web/ASC.Web.Client/src/components/pages/Settings/categories/data-management/sub-components-restore-backup/listRow.js diff --git a/web/ASC.Web.Client/src/components/pages/Settings/categories/data-management/styled-backup.js b/web/ASC.Web.Client/src/components/pages/Settings/categories/data-management/styled-backup.js index e031784cda..1e6a819d2d 100644 --- a/web/ASC.Web.Client/src/components/pages/Settings/categories/data-management/styled-backup.js +++ b/web/ASC.Web.Client/src/components/pages/Settings/categories/data-management/styled-backup.js @@ -254,6 +254,56 @@ const StyledBackupList = styled.div` .restore_context-options { margin-top: 16px; } + + .backup-list_icon { + grid-area: icon-name; + } + + .backup-list_entry-title { + font-weight: 600; + } + .backup-list_file-exst { + color: #a3a9ae; + } + + .backup-list_full-name { + grid-area: full-name; + display: flex; + ${(props) => + props.displayType === "aside" && + css` + padding-top: 4px; + `} + } + .backup-list_children { + grid-area: children; + margin-right: 16px; + ${(props) => + props.displayType === "aside" && + css` + margin-top: -17px; + `} + } + .backup-list_file-name { + border-radius: 3px; + + cursor: default; + border-bottom: 1px solid #eceef1; + align-items: center; + display: grid; + + ${(props) => + props.displayType === "aside" + ? css` + height: 56px; + grid-template-areas: "icon-name full-name children"; + ` + : css` + height: 36px; + grid-template-areas: "icon-name full-name children"; + `} + grid-template-columns: 32px 1fr; + } `; export { StyledModules, diff --git a/web/ASC.Web.Client/src/components/pages/Settings/categories/data-management/sub-components-restore-backup/backupListBody.js b/web/ASC.Web.Client/src/components/pages/Settings/categories/data-management/sub-components-restore-backup/backupListBody.js index be41e86eb6..b2bbce92e5 100644 --- a/web/ASC.Web.Client/src/components/pages/Settings/categories/data-management/sub-components-restore-backup/backupListBody.js +++ b/web/ASC.Web.Client/src/components/pages/Settings/categories/data-management/sub-components-restore-backup/backupListBody.js @@ -1,17 +1,18 @@ -import React from "react"; +import React, { useCallback } from "react"; import { FixedSizeList as List } from "react-window"; import AutoSizer from "react-virtualized-auto-sizer"; -import ListRow from "files/ListRow"; +import ListRow from "./listRow"; import Link from "@appserver/components/link"; import CustomScrollbarsVirtualList from "@appserver/components/scrollbar/custom-scrollbars-virtual-list"; import TrashIcon from "../../../../../../../../../public/images/button.trash.react.svg"; +import ContextMenuButton from "@appserver/components/context-menu-button"; const BackupListBody = ({ displayType, needRowSelection, filesList, - onIconClick, + onDeleteClick, onRestoreClick, t, }) => { @@ -20,29 +21,59 @@ const BackupListBody = ({ const fileName = file.fileName; const fileExst = "gz"; const modifyFileName = fileName.substring(0, fileName.indexOf("gz")); + + const getContextBackupOptions = useCallback(() => { + return [ + { + "data-index": `${index}`, + key: "restore-backup", + label: t("RestoreBackup"), + onClick: onRestoreClick, + }, + { + "data-index": `${index}`, + key: "delete-backup", + label: t("Common:Delete"), + onClick: onDeleteClick, + }, + ]; + }, [t, onDeleteClick, onRestoreClick]); + return (
-
- - {t("RestoreBackup")} - - +
+ {displayType === "modal" ? ( + <> + + {t("RestoreBackup")} + + + + ) : ( + + )}
diff --git a/web/ASC.Web.Client/src/components/pages/Settings/categories/data-management/sub-components-restore-backup/listRow.js b/web/ASC.Web.Client/src/components/pages/Settings/categories/data-management/sub-components-restore-backup/listRow.js new file mode 100644 index 0000000000..ab0c60f913 --- /dev/null +++ b/web/ASC.Web.Client/src/components/pages/Settings/categories/data-management/sub-components-restore-backup/listRow.js @@ -0,0 +1,43 @@ +import React from "react"; +import { ReactSVG } from "react-svg"; +import Text from "@appserver/components/text"; +import { StyledBackupList } from "../styled-backup"; +const ListRow = (props) => { + const { + displayType, + needRowSelection, + index, + fileName, + children, + fileExst, + isChecked, + noCheckBox, + } = props; + return ( + +
+ +
+ + {fileName} + + +
+ {fileExst} +
+
+
{children}
+
+
+ ); +}; + +export default ListRow;