From a429bd826f82df5b6578deb4fba5cbbff8a9f307 Mon Sep 17 00:00:00 2001 From: Kira Pilot Date: Mon, 27 Mar 2023 00:56:10 +0000 Subject: [PATCH 1/2] chore(UI): remove private icon from apps in dashboard --- .../components/AppLink/AppLink.stories.tsx | 30 ++++++++++++++++ site/src/components/AppLink/AppLink.tsx | 9 +++-- .../components/AppLink/ShareIcon.stories.tsx | 0 site/src/components/AppLink/ShareIcon.tsx | 34 +++++++++++-------- 4 files changed, 56 insertions(+), 17 deletions(-) create mode 100644 site/src/components/AppLink/ShareIcon.stories.tsx diff --git a/site/src/components/AppLink/AppLink.stories.tsx b/site/src/components/AppLink/AppLink.stories.tsx index f957316046ad1..43a0fea80b835 100644 --- a/site/src/components/AppLink/AppLink.stories.tsx +++ b/site/src/components/AppLink/AppLink.stories.tsx @@ -35,6 +35,36 @@ WithIconExternal.args = { agent: MockWorkspaceAgent, } +export const SharingLevelOwner = Template.bind({}) +SharingLevelOwner.args = { + workspace: MockWorkspace, + app: { + ...MockWorkspaceApp, + sharing_level: "owner", + }, + agent: MockWorkspaceAgent, +} + +export const SharingLevelAuthenticated = Template.bind({}) +SharingLevelAuthenticated.args = { + workspace: MockWorkspace, + app: { + ...MockWorkspaceApp, + sharing_level: "authenticated", + }, + agent: MockWorkspaceAgent, +} + +export const SharingLevelPublic = Template.bind({}) +SharingLevelPublic.args = { + workspace: MockWorkspace, + app: { + ...MockWorkspaceApp, + sharing_level: "public", + }, + agent: MockWorkspaceAgent, +} + export const WithoutIcon = Template.bind({}) WithoutIcon.args = { workspace: MockWorkspace, diff --git a/site/src/components/AppLink/AppLink.tsx b/site/src/components/AppLink/AppLink.tsx index c28f5d8870d90..26140c9703cf8 100644 --- a/site/src/components/AppLink/AppLink.tsx +++ b/site/src/components/AppLink/AppLink.tsx @@ -5,6 +5,7 @@ import { makeStyles } from "@material-ui/core/styles" import Tooltip from "@material-ui/core/Tooltip" import ErrorOutlineIcon from "@material-ui/icons/ErrorOutline" import { FC } from "react" +import { combineClasses } from "util/combineClasses" import * as TypesGen from "../../api/typesGenerated" import { generateRandomString } from "../../util/random" import { BaseIcon } from "./BaseIcon" @@ -79,15 +80,19 @@ export const AppLink: FC = ({ "Your admin has not configured subdomain application access" } + const isPrivateApp = app.sharing_level === "owner" + const button = ( ) diff --git a/site/src/components/AppLink/ShareIcon.stories.tsx b/site/src/components/AppLink/ShareIcon.stories.tsx new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/site/src/components/AppLink/ShareIcon.tsx b/site/src/components/AppLink/ShareIcon.tsx index 634d2a73beb9e..635d03bc8d7de 100644 --- a/site/src/components/AppLink/ShareIcon.tsx +++ b/site/src/components/AppLink/ShareIcon.tsx @@ -1,8 +1,6 @@ import PublicOutlinedIcon from "@material-ui/icons/PublicOutlined" -import LockOutlinedIcon from "@material-ui/icons/LockOutlined" import GroupOutlinedIcon from "@material-ui/icons/GroupOutlined" import LaunchOutlinedIcon from "@material-ui/icons/LaunchOutlined" -import { FC } from "react" import * as TypesGen from "../../api/typesGenerated" import Tooltip from "@material-ui/core/Tooltip" import { useTranslation } from "react-i18next" @@ -11,23 +9,29 @@ export interface ShareIconProps { app: TypesGen.WorkspaceApp } -export const ShareIcon: FC = ({ app }) => { +export const ShareIcon = ({ app }: ShareIconProps) => { const { t } = useTranslation("agent") - - let shareIcon = - let shareTooltip = t("shareTooltip.private") + if (app.external) { + return ( + + + + ) + } if (app.sharing_level === "authenticated") { - shareIcon = - shareTooltip = t("shareTooltip.authenticated") + return ( + + + + ) } if (app.sharing_level === "public") { - shareIcon = - shareTooltip = t("shareTooltip.public") - } - if (app.external) { - shareIcon = - shareTooltip = t("shareTooltip.external") + return ( + + + + ) } - return {shareIcon} + return null } From 0913fb0295cbe5cd208c85ec7230a4272a6ae3d4 Mon Sep 17 00:00:00 2001 From: Kira Pilot Date: Mon, 27 Mar 2023 01:13:54 +0000 Subject: [PATCH 2/2] clean up redudant snapshots --- site/src/components/AppLink/AppLink.stories.tsx | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/site/src/components/AppLink/AppLink.stories.tsx b/site/src/components/AppLink/AppLink.stories.tsx index 43a0fea80b835..b3784055081dc 100644 --- a/site/src/components/AppLink/AppLink.stories.tsx +++ b/site/src/components/AppLink/AppLink.stories.tsx @@ -25,8 +25,8 @@ WithIcon.args = { agent: MockWorkspaceAgent, } -export const WithIconExternal = Template.bind({}) -WithIconExternal.args = { +export const ExternalApp = Template.bind({}) +ExternalApp.args = { workspace: MockWorkspace, app: { ...MockWorkspaceApp, @@ -65,17 +65,6 @@ SharingLevelPublic.args = { agent: MockWorkspaceAgent, } -export const WithoutIcon = Template.bind({}) -WithoutIcon.args = { - workspace: MockWorkspace, - app: { - ...MockWorkspaceApp, - sharing_level: "owner", - health: "healthy", - }, - agent: MockWorkspaceAgent, -} - export const HealthDisabled = Template.bind({}) HealthDisabled.args = { workspace: MockWorkspace,