From 0e35da83701d3eec80f8f1256ad61f22fb0814f4 Mon Sep 17 00:00:00 2001 From: Alex <33497058+bexsoft@users.noreply.github.com> Date: Wed, 16 Mar 2022 16:36:53 -0700 Subject: [PATCH] Added versions pill to versions page elements (#1728) Signed-off-by: Benjamin Perez --- .../Objects/ObjectDetails/FileVersionItem.tsx | 33 +++++++--- .../ObjectDetails/SpecificVersionPill.tsx | 60 +++++++++++++++++++ 2 files changed, 85 insertions(+), 8 deletions(-) create mode 100644 portal-ui/src/screens/Console/Buckets/ListBuckets/Objects/ObjectDetails/SpecificVersionPill.tsx diff --git a/portal-ui/src/screens/Console/Buckets/ListBuckets/Objects/ObjectDetails/FileVersionItem.tsx b/portal-ui/src/screens/Console/Buckets/ListBuckets/Objects/ObjectDetails/FileVersionItem.tsx index 73cdbe1ef..7d76d2403 100644 --- a/portal-ui/src/screens/Console/Buckets/ListBuckets/Objects/ObjectDetails/FileVersionItem.tsx +++ b/portal-ui/src/screens/Console/Buckets/ListBuckets/Objects/ObjectDetails/FileVersionItem.tsx @@ -30,6 +30,7 @@ import { ShareIcon, } from "../../../../../../icons"; import { niceBytes } from "../../../../../../common/utils"; +import SpecificVersionPill from "./SpecificVersionPill"; interface IFileVersionItem { fileName: string; @@ -51,6 +52,9 @@ const styles = (theme: Theme) => padding: "1rem 0", margin: "0 0.5rem 0 2.5rem", cursor: "pointer", + "&.deleted": { + color: "#868686", + }, }, intermediateLayer: { margin: "0 1.5rem 0 1.5rem", @@ -64,12 +68,13 @@ const styles = (theme: Theme) => versionContainer: { fontSize: 16, fontWeight: "bold", - color: "#000", display: "flex", alignItems: "center", "& svg.min-icon": { width: 18, height: 18, + minWidth: 18, + minHeight: 18, marginRight: 10, }, }, @@ -81,7 +86,6 @@ const styles = (theme: Theme) => }, versionID: { fontSize: "12px", - color: "#000", margin: "2px 0", }, versionData: { @@ -140,6 +144,16 @@ const FileVersionItem = ({ }, ]; + let pill: "deleted" | "current" | "null" | null = null; + + if (versionInfo.is_delete_marker) { + pill = "deleted"; + } else if (versionInfo.is_latest) { + pill = "current"; + } else if (versionInfo.version_id === "null") { + pill = "null"; + } + return ( - + {displayFileIconName(fileName, true)} v{index.toString()} + {pill && } {versionItemButtons.map((button, index) => { @@ -209,7 +230,7 @@ const FileVersionItem = ({ - {versionInfo.version_id} + {versionInfo.version_id !== "null" ? versionInfo.version_id : "-"} @@ -221,10 +242,6 @@ const FileVersionItem = ({ Size: {niceBytes(versionInfo.size || "0")} - - Deleted:{" "} - {versionInfo.is_delete_marker ? "Yes" : "No"} - diff --git a/portal-ui/src/screens/Console/Buckets/ListBuckets/Objects/ObjectDetails/SpecificVersionPill.tsx b/portal-ui/src/screens/Console/Buckets/ListBuckets/Objects/ObjectDetails/SpecificVersionPill.tsx new file mode 100644 index 000000000..d0df83ffb --- /dev/null +++ b/portal-ui/src/screens/Console/Buckets/ListBuckets/Objects/ObjectDetails/SpecificVersionPill.tsx @@ -0,0 +1,60 @@ +// This file is part of MinIO Console Server +// Copyright (c) 2022 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +import React from "react"; + +interface ISpecificVersionPillProps { + type: "null" | "current" | "deleted"; +} + +const SpecificVersionPill = ({ type }: ISpecificVersionPillProps) => { + let bgColor = "#000"; + let message = ""; + + switch (type) { + case "null": + bgColor = "#07193E"; + message = "NULL VERSION"; + break; + case "deleted": + bgColor = "#868686"; + message = "DELETED"; + break; + default: + bgColor = "#174551"; + message = "CURRENT VERSION"; + } + + return ( + + {message} + + ); +}; + +export default SpecificVersionPill;