2022-03-10 02:22:07 +00:00
|
|
|
import React, {
|
|
|
|
|
useEffect,
|
|
|
|
|
useState,
|
|
|
|
|
useRef,
|
|
|
|
|
useContext,
|
2022-03-25 10:43:26 +00:00
|
|
|
useMemo,
|
2022-03-10 02:22:07 +00:00
|
|
|
useCallback,
|
|
|
|
|
} from "react";
|
2021-02-11 12:54:00 +00:00
|
|
|
import styled, { ThemeContext } from "styled-components";
|
2020-09-16 11:50:47 +00:00
|
|
|
import {
|
|
|
|
|
Card,
|
|
|
|
|
Classes,
|
|
|
|
|
HTMLDivProps,
|
|
|
|
|
ICardProps,
|
|
|
|
|
Position,
|
|
|
|
|
} from "@blueprintjs/core";
|
2019-11-21 10:52:49 +00:00
|
|
|
import { ApplicationPayload } from "constants/ReduxActionConstants";
|
2020-05-27 13:36:06 +00:00
|
|
|
import {
|
|
|
|
|
isPermitted,
|
|
|
|
|
PERMISSION_TYPE,
|
|
|
|
|
} from "pages/Applications/permissionHelpers";
|
2020-09-16 11:50:47 +00:00
|
|
|
import {
|
|
|
|
|
getInitialsAndColorCode,
|
|
|
|
|
getApplicationIcon,
|
2020-12-07 06:51:13 +00:00
|
|
|
getRandomPaletteColor,
|
2020-09-16 11:50:47 +00:00
|
|
|
} from "utils/AppsmithUtils";
|
2022-02-17 16:38:36 +00:00
|
|
|
import { noop, omit } from "lodash";
|
2020-09-16 11:50:47 +00:00
|
|
|
import Text, { TextType } from "components/ads/Text";
|
2021-10-04 15:34:37 +00:00
|
|
|
import Button, { Category, Size, IconPositions } from "components/ads/Button";
|
2020-09-16 11:50:47 +00:00
|
|
|
import Icon, { IconSize } from "components/ads/Icon";
|
|
|
|
|
import Menu from "components/ads/Menu";
|
|
|
|
|
import MenuItem, { MenuItemProps } from "components/ads/MenuItem";
|
|
|
|
|
import AppIcon, { AppIconName } from "components/ads/AppIcon";
|
|
|
|
|
import EditableText, {
|
|
|
|
|
EditInteractionKind,
|
|
|
|
|
SavingState,
|
|
|
|
|
} from "components/ads/EditableText";
|
|
|
|
|
import ColorSelector from "components/ads/ColorSelector";
|
|
|
|
|
import MenuDivider from "components/ads/MenuDivider";
|
|
|
|
|
import IconSelector from "components/ads/IconSelector";
|
|
|
|
|
import { useSelector } from "react-redux";
|
|
|
|
|
import { UpdateApplicationPayload } from "api/ApplicationApi";
|
2020-10-14 10:35:19 +00:00
|
|
|
import {
|
|
|
|
|
getIsFetchingApplications,
|
|
|
|
|
getIsSavingAppName,
|
2021-06-24 06:32:09 +00:00
|
|
|
getIsErroredSavingAppName,
|
2020-10-14 10:35:19 +00:00
|
|
|
} from "selectors/applicationSelectors";
|
2020-09-23 14:06:50 +00:00
|
|
|
import { Classes as CsClasses } from "components/ads/common";
|
2020-11-09 11:30:34 +00:00
|
|
|
import TooltipComponent from "components/ads/Tooltip";
|
2021-10-04 15:34:37 +00:00
|
|
|
import {
|
2022-03-24 07:44:53 +00:00
|
|
|
isVerticalEllipsisActive,
|
2021-10-04 15:34:37 +00:00
|
|
|
truncateString,
|
|
|
|
|
howMuchTimeBeforeText,
|
|
|
|
|
} from "utils/helpers";
|
2021-05-04 06:04:23 +00:00
|
|
|
import ForkApplicationModal from "./ForkApplicationModal";
|
2021-06-03 06:18:08 +00:00
|
|
|
import { Toaster } from "components/ads/Toast";
|
|
|
|
|
import { Variant } from "components/ads/common";
|
2022-01-07 06:08:17 +00:00
|
|
|
import { getExportAppAPIRoute } from "@appsmith/constants/ApiConstants";
|
2021-10-04 15:34:37 +00:00
|
|
|
import { Colors } from "constants/Colors";
|
2022-02-11 18:08:46 +00:00
|
|
|
import { CONNECTED_TO_GIT, createMessage } from "@appsmith/constants/messages";
|
2022-03-25 10:43:26 +00:00
|
|
|
import { builderURL, viewerURL } from "RouteBuilder";
|
2022-03-10 02:22:07 +00:00
|
|
|
import history from "utils/history";
|
2020-08-18 06:40:11 +00:00
|
|
|
|
2020-08-21 06:44:21 +00:00
|
|
|
type NameWrapperProps = {
|
2020-08-18 06:40:11 +00:00
|
|
|
hasReadPermission: boolean;
|
|
|
|
|
showOverlay: boolean;
|
2020-10-14 10:35:19 +00:00
|
|
|
isMenuOpen: boolean;
|
2020-08-21 06:44:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const NameWrapper = styled((props: HTMLDivProps & NameWrapperProps) => (
|
2020-10-14 10:35:19 +00:00
|
|
|
<div {...omit(props, ["hasReadPermission", "showOverlay", "isMenuOpen"])} />
|
2020-08-21 06:44:21 +00:00
|
|
|
))`
|
2020-09-16 11:50:47 +00:00
|
|
|
.bp3-card {
|
|
|
|
|
border-radius: 0;
|
|
|
|
|
box-shadow: none;
|
2021-10-04 15:34:37 +00:00
|
|
|
padding: 16px;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
2020-09-16 11:50:47 +00:00
|
|
|
}
|
2020-12-24 04:32:25 +00:00
|
|
|
${(props) =>
|
2020-08-18 06:40:11 +00:00
|
|
|
props.showOverlay &&
|
|
|
|
|
`
|
|
|
|
|
{
|
2020-09-16 11:50:47 +00:00
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
2020-08-18 06:40:11 +00:00
|
|
|
|
|
|
|
|
.overlay {
|
2021-10-04 15:34:37 +00:00
|
|
|
position: relative;
|
2020-08-18 06:40:11 +00:00
|
|
|
${props.hasReadPermission &&
|
|
|
|
|
`text-decoration: none;
|
|
|
|
|
&:after {
|
|
|
|
|
left: 0;
|
|
|
|
|
top: 0;
|
|
|
|
|
content: "";
|
|
|
|
|
position: absolute;
|
|
|
|
|
height: 100%;
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
|
|
|
|
& .control {
|
2021-10-04 15:34:37 +00:00
|
|
|
display: flex;
|
|
|
|
|
flex-direction: row;
|
2020-08-18 06:40:11 +00:00
|
|
|
z-index: 1;
|
2021-10-04 15:34:37 +00:00
|
|
|
|
|
|
|
|
& .t--application-view-link {
|
2021-10-20 05:22:17 +00:00
|
|
|
border: 2px solid ${Colors.BLACK};
|
|
|
|
|
background-color: ${Colors.BLACK};
|
|
|
|
|
color: ${Colors.WHITE};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
& .t--application-view-link:hover {
|
|
|
|
|
background-color: transparent;
|
|
|
|
|
border: 2px solid ${Colors.BLACK};
|
|
|
|
|
color: ${Colors.BLACK};
|
|
|
|
|
|
|
|
|
|
svg {
|
|
|
|
|
path {
|
|
|
|
|
fill: ${Colors.BLACK};
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-10-04 15:34:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
& .t--application-edit-link, & .t--application-view-link {
|
|
|
|
|
span {
|
|
|
|
|
margin-right: 2px;
|
|
|
|
|
|
|
|
|
|
svg {
|
|
|
|
|
width: 16px;
|
|
|
|
|
height: 16px;
|
|
|
|
|
path {
|
2021-10-20 05:22:17 +00:00
|
|
|
fill: ${Colors.WHITE};
|
2021-10-04 15:34:37 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-18 06:40:11 +00:00
|
|
|
}`}
|
|
|
|
|
|
2021-10-04 15:34:37 +00:00
|
|
|
& div.overlay-blur {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
background-color: ${
|
2020-10-14 10:35:19 +00:00
|
|
|
props.hasReadPermission && !props.isMenuOpen
|
2021-10-04 15:34:37 +00:00
|
|
|
? `rgba(255, 255, 255, 0.5)`
|
2020-08-18 06:40:11 +00:00
|
|
|
: null
|
2021-10-04 15:34:37 +00:00
|
|
|
};
|
|
|
|
|
@supports ((-webkit-backdrop-filter: none) or (backdrop-filter: none)) {
|
|
|
|
|
background-color: transparent;
|
|
|
|
|
backdrop-filter: ${
|
|
|
|
|
props.hasReadPermission && !props.isMenuOpen
|
|
|
|
|
? `blur(6px)`
|
|
|
|
|
: null
|
|
|
|
|
};
|
2020-08-18 06:40:11 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
`}
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
`;
|
|
|
|
|
|
2020-08-21 06:44:21 +00:00
|
|
|
const Wrapper = styled(
|
|
|
|
|
(
|
|
|
|
|
props: ICardProps & {
|
|
|
|
|
hasReadPermission?: boolean;
|
|
|
|
|
backgroundColor: string;
|
2022-02-17 16:38:36 +00:00
|
|
|
isMobile?: boolean;
|
2020-08-21 06:44:21 +00:00
|
|
|
},
|
2022-03-11 11:21:58 +00:00
|
|
|
) => (
|
|
|
|
|
<Card
|
|
|
|
|
{...omit(props, ["hasReadPermission", "backgroundColor", "isMobile"])}
|
|
|
|
|
/>
|
|
|
|
|
),
|
2020-08-21 06:44:21 +00:00
|
|
|
)`
|
2019-11-21 10:52:49 +00:00
|
|
|
display: flex;
|
2021-10-04 15:34:37 +00:00
|
|
|
flex-direction: row-reverse;
|
2019-11-21 10:52:49 +00:00
|
|
|
justify-content: center;
|
2020-12-24 04:32:25 +00:00
|
|
|
width: ${(props) => props.theme.card.minWidth}px;
|
|
|
|
|
height: ${(props) => props.theme.card.minHeight}px;
|
2019-11-21 10:52:49 +00:00
|
|
|
position: relative;
|
2020-12-24 04:32:25 +00:00
|
|
|
background-color: ${(props) => props.backgroundColor};
|
2020-08-18 06:40:11 +00:00
|
|
|
.overlay {
|
2020-01-20 08:07:00 +00:00
|
|
|
display: block;
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: 0;
|
|
|
|
|
top: 0;
|
2020-08-18 06:40:11 +00:00
|
|
|
height: 100%;
|
2020-01-20 08:07:00 +00:00
|
|
|
width: 100%;
|
2020-12-24 04:32:25 +00:00
|
|
|
${(props) => !props.hasReadPermission && `pointer-events: none;`}
|
2020-01-20 08:07:00 +00:00
|
|
|
}
|
2020-09-16 11:50:47 +00:00
|
|
|
.bp3-card {
|
|
|
|
|
border-radius: 0;
|
|
|
|
|
}
|
2020-09-23 14:06:50 +00:00
|
|
|
.${CsClasses.APP_ICON} {
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
svg {
|
|
|
|
|
path {
|
|
|
|
|
fill: #fff;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-02-17 16:38:36 +00:00
|
|
|
|
|
|
|
|
${({ isMobile }) =>
|
|
|
|
|
isMobile &&
|
|
|
|
|
`
|
|
|
|
|
width: 100% !important;
|
|
|
|
|
height: 126px !important;
|
|
|
|
|
`}
|
2019-11-21 10:52:49 +00:00
|
|
|
`;
|
2020-08-18 06:40:11 +00:00
|
|
|
|
2019-11-21 10:52:49 +00:00
|
|
|
const ApplicationImage = styled.div`
|
2020-01-28 08:21:22 +00:00
|
|
|
&& {
|
|
|
|
|
height: 100%;
|
|
|
|
|
width: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
& {
|
|
|
|
|
.control {
|
|
|
|
|
button {
|
|
|
|
|
span {
|
2020-12-24 04:32:25 +00:00
|
|
|
font-weight: ${(props) => props.theme.fontWeights[3]};
|
2020-01-28 08:21:22 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-11-21 10:52:49 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
|
|
2020-05-05 12:16:51 +00:00
|
|
|
const Control = styled.div<{ fixed?: boolean }>`
|
2019-11-21 10:52:49 +00:00
|
|
|
outline: none;
|
|
|
|
|
border: none;
|
|
|
|
|
cursor: pointer;
|
2021-10-04 15:34:37 +00:00
|
|
|
display: flex;
|
|
|
|
|
flex-direction: row;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
gap: 8px;
|
|
|
|
|
align-items: center;
|
2020-08-18 06:40:11 +00:00
|
|
|
|
|
|
|
|
.${Classes.BUTTON} {
|
|
|
|
|
margin-top: 7px;
|
|
|
|
|
|
|
|
|
|
div {
|
|
|
|
|
width: auto;
|
|
|
|
|
height: auto;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.${Classes.BUTTON_TEXT} {
|
|
|
|
|
font-size: 12px;
|
2020-08-21 15:25:49 +00:00
|
|
|
color: white;
|
2020-08-18 06:40:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.more {
|
|
|
|
|
position: absolute;
|
2020-12-24 04:32:25 +00:00
|
|
|
right: ${(props) => props.theme.spaces[6]}px;
|
|
|
|
|
top: ${(props) => props.theme.spaces[4]}px;
|
2020-08-18 06:40:11 +00:00
|
|
|
}
|
2019-11-21 10:52:49 +00:00
|
|
|
`;
|
|
|
|
|
|
2020-10-14 10:35:19 +00:00
|
|
|
const MoreOptionsContainer = styled.div`
|
|
|
|
|
width: 22px;
|
|
|
|
|
height: 22px;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
const AppNameWrapper = styled.div<{ isFetching: boolean }>`
|
2021-10-04 15:34:37 +00:00
|
|
|
padding: 0;
|
|
|
|
|
padding-right: 12px;
|
2020-12-24 04:32:25 +00:00
|
|
|
${(props) =>
|
2020-10-14 10:35:19 +00:00
|
|
|
props.isFetching
|
|
|
|
|
? `
|
|
|
|
|
width: 119px;
|
|
|
|
|
height: 16px;
|
|
|
|
|
margin-left: 10px;
|
|
|
|
|
`
|
|
|
|
|
: null};
|
2020-11-09 11:30:34 +00:00
|
|
|
overflow: hidden;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
display: -webkit-box;
|
|
|
|
|
-webkit-line-clamp: 3; /* number of lines to show */
|
|
|
|
|
-webkit-box-orient: vertical;
|
2020-12-10 08:06:13 +00:00
|
|
|
word-break: break-word;
|
2020-12-24 04:32:25 +00:00
|
|
|
color: ${(props) => props.theme.colors.text.heading};
|
2021-10-04 15:34:37 +00:00
|
|
|
flex: 1;
|
2021-11-23 08:01:46 +00:00
|
|
|
|
|
|
|
|
.bp3-popover-target {
|
|
|
|
|
display: inline;
|
|
|
|
|
}
|
2020-08-18 06:40:11 +00:00
|
|
|
`;
|
2021-10-04 15:34:37 +00:00
|
|
|
|
2019-11-21 10:52:49 +00:00
|
|
|
type ApplicationCardProps = {
|
|
|
|
|
application: ApplicationPayload;
|
2020-01-27 08:24:58 +00:00
|
|
|
duplicate?: (applicationId: string) => void;
|
|
|
|
|
share?: (applicationId: string) => void;
|
2020-11-25 12:24:14 +00:00
|
|
|
delete?: (applicationId: string) => void;
|
2020-09-16 11:50:47 +00:00
|
|
|
update?: (id: string, data: UpdateApplicationPayload) => void;
|
2021-06-03 06:18:08 +00:00
|
|
|
enableImportExport?: boolean;
|
2022-02-17 16:38:36 +00:00
|
|
|
isMobile?: boolean;
|
2019-11-21 10:52:49 +00:00
|
|
|
};
|
|
|
|
|
|
2020-09-16 11:50:47 +00:00
|
|
|
const EditButton = styled(Button)`
|
2021-10-04 15:34:37 +00:00
|
|
|
margin-bottom: 0;
|
2020-09-16 11:50:47 +00:00
|
|
|
`;
|
|
|
|
|
|
2021-10-04 15:34:37 +00:00
|
|
|
const ContextDropdownWrapper = styled.div``;
|
|
|
|
|
|
|
|
|
|
const CircleAppIcon = styled(AppIcon)`
|
|
|
|
|
padding: 12px;
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
box-shadow: 0px 2px 16px rgba(0, 0, 0, 0.07);
|
|
|
|
|
border-radius: 50%;
|
2020-09-16 11:50:47 +00:00
|
|
|
|
2021-10-04 15:34:37 +00:00
|
|
|
svg {
|
|
|
|
|
path {
|
|
|
|
|
fill: #000 !important;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
const ModifiedDataComponent = styled.div`
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
color: #8a8a8a;
|
|
|
|
|
&::first-letter {
|
|
|
|
|
text-transform: uppercase;
|
|
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
const CardFooter = styled.div`
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
|
|
|
|
margin-top: 4px;
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
const IconScrollWrapper = styled.div`
|
|
|
|
|
position: relative;
|
|
|
|
|
.t--icon-selected {
|
|
|
|
|
background-color: rgba(248, 106, 43, 0.2);
|
|
|
|
|
border: 1px solid ${(props) => props.theme.colors.applications.cardMenuIcon};
|
|
|
|
|
svg {
|
|
|
|
|
path {
|
|
|
|
|
fill: ${(props) => props.theme.colors.applications.iconColor};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.icon-selector::-webkit-scrollbar-thumb {
|
|
|
|
|
background-color: transparent;
|
|
|
|
|
}
|
|
|
|
|
.icon-selector::-webkit-scrollbar {
|
|
|
|
|
width: 0px;
|
|
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
const MenuItemWrapper = styled(MenuItem)`
|
|
|
|
|
&.error-menuitem {
|
|
|
|
|
.${CsClasses.TEXT} {
|
|
|
|
|
color: ${Colors.DANGER_SOLID};
|
|
|
|
|
}
|
|
|
|
|
.${CsClasses.ICON} {
|
2020-09-23 14:06:50 +00:00
|
|
|
svg {
|
2021-10-04 15:34:37 +00:00
|
|
|
fill: ${Colors.DANGER_SOLID};
|
2020-09-23 14:06:50 +00:00
|
|
|
path {
|
2021-10-04 15:34:37 +00:00
|
|
|
fill: ${Colors.DANGER_SOLID};
|
2020-09-23 14:06:50 +00:00
|
|
|
}
|
|
|
|
|
}
|
2020-09-16 11:50:47 +00:00
|
|
|
}
|
|
|
|
|
}
|
2021-10-04 15:34:37 +00:00
|
|
|
|
|
|
|
|
.${CsClasses.ICON} {
|
|
|
|
|
svg {
|
|
|
|
|
width: 18px;
|
|
|
|
|
height: 18px;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-09-16 11:50:47 +00:00
|
|
|
`;
|
|
|
|
|
|
2021-12-07 07:59:32 +00:00
|
|
|
const StyledGitConnectedBadge = styled.div`
|
|
|
|
|
width: 24px;
|
|
|
|
|
height: 24px;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: -12px;
|
|
|
|
|
right: -12px;
|
|
|
|
|
box-shadow: 0px 2px 16px rgba(0, 0, 0, 0.07);
|
|
|
|
|
background: ${Colors.WHITE};
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
function GitConnectedBadge() {
|
|
|
|
|
return (
|
|
|
|
|
<StyledGitConnectedBadge>
|
|
|
|
|
<TooltipComponent
|
|
|
|
|
content={createMessage(CONNECTED_TO_GIT)}
|
|
|
|
|
maxWidth="400px"
|
|
|
|
|
>
|
|
|
|
|
<Icon fillColor={Colors.GREY_7} name="fork" size={IconSize.XXL} />
|
|
|
|
|
</TooltipComponent>
|
|
|
|
|
</StyledGitConnectedBadge>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-17 16:38:36 +00:00
|
|
|
const Container = styled.div<{ isMobile?: boolean }>`
|
2021-12-07 07:59:32 +00:00
|
|
|
position: relative;
|
|
|
|
|
overflow: visible;
|
2022-02-17 16:38:36 +00:00
|
|
|
${({ isMobile }) => isMobile && `width: 100%;`}
|
2021-12-07 07:59:32 +00:00
|
|
|
`;
|
|
|
|
|
|
2021-04-28 10:28:39 +00:00
|
|
|
export function ApplicationCard(props: ApplicationCardProps) {
|
2020-10-14 10:35:19 +00:00
|
|
|
const isFetchingApplications = useSelector(getIsFetchingApplications);
|
2021-02-11 12:54:00 +00:00
|
|
|
const theme = useContext(ThemeContext);
|
2020-10-14 10:35:19 +00:00
|
|
|
const isSavingName = useSelector(getIsSavingAppName);
|
2021-06-24 06:32:09 +00:00
|
|
|
const isErroredSavingName = useSelector(getIsErroredSavingAppName);
|
2020-09-16 11:50:47 +00:00
|
|
|
const initialsAndColorCode = getInitialsAndColorCode(
|
|
|
|
|
props.application.name,
|
2021-02-11 12:54:00 +00:00
|
|
|
theme.colors.appCardColors,
|
2020-09-16 11:50:47 +00:00
|
|
|
);
|
|
|
|
|
let initials = initialsAndColorCode[0];
|
2020-10-14 10:35:19 +00:00
|
|
|
|
|
|
|
|
const [showOverlay, setShowOverlay] = useState(false);
|
2020-12-07 06:51:13 +00:00
|
|
|
const [selectedColor, setSelectedColor] = useState<string>("");
|
2020-10-14 10:35:19 +00:00
|
|
|
const [moreActionItems, setMoreActionItems] = useState<MenuItemProps[]>([]);
|
|
|
|
|
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
2021-05-04 06:04:23 +00:00
|
|
|
const [isForkApplicationModalopen, setForkApplicationModalOpen] = useState(
|
|
|
|
|
false,
|
|
|
|
|
);
|
2020-10-14 10:35:19 +00:00
|
|
|
const [lastUpdatedValue, setLastUpdatedValue] = useState("");
|
2020-11-09 11:30:34 +00:00
|
|
|
const appNameWrapperRef = useRef<HTMLDivElement>(null);
|
2020-10-14 10:35:19 +00:00
|
|
|
|
2021-10-18 14:03:44 +00:00
|
|
|
const applicationId = props.application?.id;
|
2022-02-08 16:16:16 +00:00
|
|
|
const showGitBadge = props.application?.gitApplicationMetadata?.branchName;
|
2021-10-18 14:03:44 +00:00
|
|
|
|
2022-03-25 10:43:26 +00:00
|
|
|
const defaultPageSlug = useMemo(() => {
|
|
|
|
|
const pages = props.application.pages || [];
|
|
|
|
|
const defaultPage = pages.find((page) => page.isDefault);
|
|
|
|
|
return defaultPage?.slug || defaultPage?.name;
|
|
|
|
|
}, []);
|
|
|
|
|
|
2020-10-14 10:35:19 +00:00
|
|
|
useEffect(() => {
|
2020-12-07 06:51:13 +00:00
|
|
|
let colorCode;
|
|
|
|
|
if (props.application.color) {
|
|
|
|
|
colorCode = props.application.color;
|
|
|
|
|
} else {
|
2021-02-11 12:54:00 +00:00
|
|
|
colorCode = getRandomPaletteColor(theme.colors.appCardColors);
|
2020-12-07 06:51:13 +00:00
|
|
|
}
|
2020-10-14 10:35:19 +00:00
|
|
|
setSelectedColor(colorCode);
|
2020-12-09 07:06:02 +00:00
|
|
|
}, [props.application.color]);
|
2021-10-04 15:34:37 +00:00
|
|
|
|
2020-10-14 10:35:19 +00:00
|
|
|
useEffect(() => {
|
|
|
|
|
if (props.share) {
|
|
|
|
|
moreActionItems.push({
|
|
|
|
|
onSelect: shareApp,
|
|
|
|
|
text: "Share",
|
|
|
|
|
icon: "share",
|
|
|
|
|
cypressSelector: "t--share",
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (props.duplicate && hasEditPermission) {
|
|
|
|
|
moreActionItems.push({
|
|
|
|
|
onSelect: duplicateApp,
|
|
|
|
|
text: "Duplicate",
|
|
|
|
|
icon: "duplicate",
|
|
|
|
|
cypressSelector: "t--duplicate",
|
|
|
|
|
});
|
|
|
|
|
}
|
2021-05-04 06:04:23 +00:00
|
|
|
// add fork app option to menu
|
|
|
|
|
if (hasEditPermission) {
|
|
|
|
|
moreActionItems.push({
|
|
|
|
|
onSelect: forkApplicationInitiate,
|
|
|
|
|
text: "Fork",
|
2022-03-10 14:39:05 +00:00
|
|
|
icon: "compasses-line",
|
2021-05-04 06:04:23 +00:00
|
|
|
cypressSelector: "t--fork-app",
|
|
|
|
|
});
|
|
|
|
|
}
|
2021-06-15 12:48:21 +00:00
|
|
|
if (!!props.enableImportExport && hasExportPermission) {
|
2021-06-03 06:18:08 +00:00
|
|
|
moreActionItems.push({
|
|
|
|
|
onSelect: exportApplicationAsJSONFile,
|
|
|
|
|
text: "Export",
|
|
|
|
|
icon: "download",
|
|
|
|
|
cypressSelector: "t--export-app",
|
|
|
|
|
});
|
|
|
|
|
}
|
2020-10-14 10:35:19 +00:00
|
|
|
setMoreActionItems(moreActionItems);
|
|
|
|
|
addDeleteOption();
|
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}, []);
|
2020-08-18 06:40:11 +00:00
|
|
|
|
2020-10-14 10:35:19 +00:00
|
|
|
const appIcon = (props.application?.icon ||
|
2021-10-18 14:03:44 +00:00
|
|
|
getApplicationIcon(applicationId)) as AppIconName;
|
2020-05-27 13:36:06 +00:00
|
|
|
const hasEditPermission = isPermitted(
|
|
|
|
|
props.application?.userPermissions ?? [],
|
|
|
|
|
PERMISSION_TYPE.MANAGE_APPLICATION,
|
2020-05-14 10:47:13 +00:00
|
|
|
);
|
2020-05-27 13:36:06 +00:00
|
|
|
const hasReadPermission = isPermitted(
|
|
|
|
|
props.application?.userPermissions ?? [],
|
|
|
|
|
PERMISSION_TYPE.READ_APPLICATION,
|
2020-05-14 10:47:13 +00:00
|
|
|
);
|
2021-06-15 12:48:21 +00:00
|
|
|
const hasExportPermission = isPermitted(
|
|
|
|
|
props.application?.userPermissions ?? [],
|
|
|
|
|
PERMISSION_TYPE.EXPORT_APPLICATION,
|
|
|
|
|
);
|
2020-09-16 11:50:47 +00:00
|
|
|
const updateColor = (color: string) => {
|
|
|
|
|
setSelectedColor(color);
|
|
|
|
|
props.update &&
|
2021-10-18 14:03:44 +00:00
|
|
|
props.update(applicationId, {
|
2020-09-16 11:50:47 +00:00
|
|
|
color: color,
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
const updateIcon = (icon: AppIconName) => {
|
|
|
|
|
props.update &&
|
2021-10-18 14:03:44 +00:00
|
|
|
props.update(applicationId, {
|
2020-09-16 11:50:47 +00:00
|
|
|
icon: icon,
|
|
|
|
|
});
|
|
|
|
|
};
|
2019-11-21 10:52:49 +00:00
|
|
|
const duplicateApp = () => {
|
2021-10-18 14:03:44 +00:00
|
|
|
props.duplicate && props.duplicate(applicationId);
|
2019-11-21 10:52:49 +00:00
|
|
|
};
|
|
|
|
|
const shareApp = () => {
|
2021-10-18 14:03:44 +00:00
|
|
|
props.share && props.share(applicationId);
|
2019-11-21 10:52:49 +00:00
|
|
|
};
|
2021-06-03 06:18:08 +00:00
|
|
|
const exportApplicationAsJSONFile = () => {
|
|
|
|
|
// export api response comes with content-disposition header.
|
|
|
|
|
// there is no straightforward way to handle it with axios/fetch
|
|
|
|
|
const id = `t--export-app-link`;
|
|
|
|
|
const existingLink = document.getElementById(id);
|
|
|
|
|
existingLink && existingLink.remove();
|
|
|
|
|
const link = document.createElement("a");
|
2021-08-27 07:19:21 +00:00
|
|
|
|
2021-10-18 14:03:44 +00:00
|
|
|
link.href = getExportAppAPIRoute(applicationId);
|
2021-06-03 06:18:08 +00:00
|
|
|
link.id = id;
|
|
|
|
|
document.body.appendChild(link);
|
2021-08-23 09:16:25 +00:00
|
|
|
// will fetch the file manually during cypress test run.
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
if (!window.Cypress) {
|
|
|
|
|
link.click();
|
|
|
|
|
}
|
2021-06-03 06:18:08 +00:00
|
|
|
setIsMenuOpen(false);
|
|
|
|
|
Toaster.show({
|
|
|
|
|
text: `Successfully exported ${props.application.name}`,
|
|
|
|
|
variant: Variant.success,
|
|
|
|
|
});
|
|
|
|
|
};
|
2021-05-04 06:04:23 +00:00
|
|
|
const forkApplicationInitiate = () => {
|
|
|
|
|
// open fork application modal
|
|
|
|
|
// on click on an organisation, create app and take to app
|
|
|
|
|
setForkApplicationModalOpen(true);
|
|
|
|
|
};
|
2019-11-21 10:52:49 +00:00
|
|
|
const deleteApp = () => {
|
2020-10-14 10:35:19 +00:00
|
|
|
setShowOverlay(false);
|
2021-10-18 14:03:44 +00:00
|
|
|
props.delete && props.delete(applicationId);
|
2019-11-21 10:52:49 +00:00
|
|
|
};
|
2020-10-14 10:35:19 +00:00
|
|
|
const askForConfirmation = () => {
|
|
|
|
|
const updatedActionItems = [...moreActionItems];
|
|
|
|
|
updatedActionItems.pop();
|
|
|
|
|
updatedActionItems.push({
|
2019-11-21 10:52:49 +00:00
|
|
|
onSelect: deleteApp,
|
2020-10-14 10:35:19 +00:00
|
|
|
text: "Are you sure?",
|
2021-10-04 15:34:37 +00:00
|
|
|
icon: "delete-blank",
|
2020-10-14 10:35:19 +00:00
|
|
|
type: "warning",
|
2020-09-16 11:50:47 +00:00
|
|
|
cypressSelector: "t--delete",
|
2020-01-27 08:24:58 +00:00
|
|
|
});
|
2020-10-14 10:35:19 +00:00
|
|
|
setMoreActionItems(updatedActionItems);
|
|
|
|
|
};
|
|
|
|
|
const addDeleteOption = () => {
|
|
|
|
|
if (props.delete && hasEditPermission) {
|
2021-10-04 15:34:37 +00:00
|
|
|
const index = moreActionItems.findIndex(
|
|
|
|
|
(el) => el.icon === "delete-blank",
|
|
|
|
|
);
|
2020-10-14 10:35:19 +00:00
|
|
|
if (index >= 0) {
|
|
|
|
|
moreActionItems.pop();
|
|
|
|
|
}
|
|
|
|
|
moreActionItems.push({
|
|
|
|
|
onSelect: askForConfirmation,
|
|
|
|
|
text: "Delete",
|
2021-10-04 15:34:37 +00:00
|
|
|
icon: "delete-blank",
|
2020-10-14 10:35:19 +00:00
|
|
|
cypressSelector: "t--delete-confirm",
|
|
|
|
|
});
|
|
|
|
|
setMoreActionItems(moreActionItems);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
if (initials.length < 2 && props.application.name.length > 1) {
|
|
|
|
|
initials += props.application.name[1].toUpperCase() || "";
|
2020-01-27 08:24:58 +00:00
|
|
|
}
|
2021-10-18 14:03:44 +00:00
|
|
|
|
2022-03-25 10:43:26 +00:00
|
|
|
const viewApplicationURL = viewerURL({
|
|
|
|
|
applicationSlug: props.application.slug as string,
|
|
|
|
|
applicationVersion: props.application.applicationVersion,
|
|
|
|
|
pageSlug: defaultPageSlug || "page",
|
|
|
|
|
applicationId: props.application.id,
|
|
|
|
|
pageId: props.application.defaultPageId as string,
|
2021-10-18 14:03:44 +00:00
|
|
|
});
|
2022-03-25 10:43:26 +00:00
|
|
|
const editApplicationURL = builderURL({
|
|
|
|
|
applicationSlug: props.application.slug as string,
|
|
|
|
|
applicationVersion: props.application.applicationVersion,
|
|
|
|
|
applicationId: props.application.id,
|
|
|
|
|
pageSlug: defaultPageSlug || "page",
|
|
|
|
|
pageId: props.application.defaultPageId as string,
|
2021-10-18 14:03:44 +00:00
|
|
|
});
|
|
|
|
|
|
2020-11-10 10:28:21 +00:00
|
|
|
const appNameText = (
|
2021-04-28 10:28:39 +00:00
|
|
|
<Text cypressSelector="t--app-card-name" type={TextType.H3}>
|
2020-11-10 10:28:21 +00:00
|
|
|
{props.application.name}
|
|
|
|
|
</Text>
|
|
|
|
|
);
|
2020-09-16 11:50:47 +00:00
|
|
|
|
|
|
|
|
const ContextMenu = (
|
|
|
|
|
<ContextDropdownWrapper>
|
|
|
|
|
<Menu
|
|
|
|
|
className="more"
|
|
|
|
|
onClosing={() => {
|
|
|
|
|
setIsMenuOpen(false);
|
|
|
|
|
setShowOverlay(false);
|
2020-10-14 10:35:19 +00:00
|
|
|
addDeleteOption();
|
|
|
|
|
if (lastUpdatedValue && props.application.name !== lastUpdatedValue) {
|
|
|
|
|
props.update &&
|
2021-10-18 14:03:44 +00:00
|
|
|
props.update(applicationId, {
|
2020-10-14 10:35:19 +00:00
|
|
|
name: lastUpdatedValue,
|
|
|
|
|
});
|
|
|
|
|
}
|
2020-09-16 11:50:47 +00:00
|
|
|
}}
|
2021-04-28 10:28:39 +00:00
|
|
|
onOpening={() => {
|
|
|
|
|
setIsMenuOpen(true);
|
|
|
|
|
}}
|
|
|
|
|
position={Position.RIGHT_TOP}
|
|
|
|
|
target={
|
|
|
|
|
<MoreOptionsContainer>
|
2021-10-04 15:34:37 +00:00
|
|
|
<Icon
|
|
|
|
|
fillColor={isMenuOpen ? "#000" : "#8a8a8a"}
|
|
|
|
|
hoverFillColor="#000"
|
|
|
|
|
name="context-menu"
|
|
|
|
|
size={IconSize.XXXL}
|
|
|
|
|
/>
|
2021-04-28 10:28:39 +00:00
|
|
|
</MoreOptionsContainer>
|
|
|
|
|
}
|
2020-09-16 11:50:47 +00:00
|
|
|
>
|
|
|
|
|
{hasEditPermission && (
|
|
|
|
|
<EditableText
|
2021-11-23 08:01:46 +00:00
|
|
|
className="px-3 pt-3 pb-2 t--application-name"
|
2020-09-16 11:50:47 +00:00
|
|
|
defaultValue={props.application.name}
|
|
|
|
|
editInteractionKind={EditInteractionKind.SINGLE}
|
2021-04-28 10:28:39 +00:00
|
|
|
fill
|
2020-09-16 11:50:47 +00:00
|
|
|
hideEditIcon={false}
|
2021-06-24 06:32:09 +00:00
|
|
|
isError={isErroredSavingName}
|
2020-09-16 11:50:47 +00:00
|
|
|
isInvalid={(value: string) => {
|
|
|
|
|
if (!value) {
|
|
|
|
|
return "Name cannot be empty";
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
onBlur={(value: string) => {
|
|
|
|
|
props.update &&
|
2021-10-18 14:03:44 +00:00
|
|
|
props.update(applicationId, {
|
2020-09-16 11:50:47 +00:00
|
|
|
name: value,
|
|
|
|
|
});
|
|
|
|
|
}}
|
2021-04-28 10:28:39 +00:00
|
|
|
onTextChanged={(value: string) => {
|
|
|
|
|
setLastUpdatedValue(value);
|
|
|
|
|
}}
|
|
|
|
|
placeholder={"Edit text input"}
|
|
|
|
|
savingState={
|
|
|
|
|
isSavingName ? SavingState.STARTED : SavingState.NOT_STARTED
|
|
|
|
|
}
|
2021-02-11 12:54:00 +00:00
|
|
|
underline
|
2020-09-16 11:50:47 +00:00
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
{hasEditPermission && (
|
|
|
|
|
<>
|
|
|
|
|
<ColorSelector
|
2021-02-11 12:54:00 +00:00
|
|
|
colorPalette={theme.colors.appCardColors}
|
2021-04-28 10:28:39 +00:00
|
|
|
defaultValue={selectedColor}
|
|
|
|
|
fill
|
2020-09-16 11:50:47 +00:00
|
|
|
onSelect={updateColor}
|
|
|
|
|
/>
|
|
|
|
|
<MenuDivider />
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
{hasEditPermission && (
|
2021-10-04 15:34:37 +00:00
|
|
|
<IconScrollWrapper>
|
2020-09-16 11:50:47 +00:00
|
|
|
<IconSelector
|
2021-10-04 15:34:37 +00:00
|
|
|
className="icon-selector"
|
2021-04-28 10:28:39 +00:00
|
|
|
fill
|
2020-09-16 11:50:47 +00:00
|
|
|
onSelect={updateIcon}
|
2021-10-04 15:34:37 +00:00
|
|
|
selectedColor={theme.colors.applications.cardMenuIcon}
|
2021-04-28 10:28:39 +00:00
|
|
|
selectedIcon={appIcon}
|
2020-09-16 11:50:47 +00:00
|
|
|
/>
|
|
|
|
|
<MenuDivider />
|
2021-10-04 15:34:37 +00:00
|
|
|
</IconScrollWrapper>
|
2020-09-16 11:50:47 +00:00
|
|
|
)}
|
|
|
|
|
{moreActionItems.map((item: MenuItemProps) => {
|
2021-10-04 15:34:37 +00:00
|
|
|
return (
|
|
|
|
|
<MenuItemWrapper
|
|
|
|
|
key={item.text}
|
|
|
|
|
{...item}
|
|
|
|
|
className={item.icon === "delete-blank" ? "error-menuitem" : ""}
|
|
|
|
|
/>
|
|
|
|
|
);
|
2020-09-16 11:50:47 +00:00
|
|
|
})}
|
2021-05-04 06:04:23 +00:00
|
|
|
<ForkApplicationModal
|
2021-10-18 14:03:44 +00:00
|
|
|
applicationId={applicationId}
|
2021-05-04 06:04:23 +00:00
|
|
|
isModalOpen={isForkApplicationModalopen}
|
|
|
|
|
setModalClose={setForkApplicationModalOpen}
|
|
|
|
|
/>
|
2020-09-16 11:50:47 +00:00
|
|
|
</Menu>
|
|
|
|
|
</ContextDropdownWrapper>
|
|
|
|
|
);
|
2020-08-18 06:40:11 +00:00
|
|
|
|
2021-10-04 15:34:37 +00:00
|
|
|
const editedByText = () => {
|
|
|
|
|
let editedBy = props.application.modifiedBy
|
|
|
|
|
? props.application.modifiedBy
|
|
|
|
|
: "";
|
|
|
|
|
let editedOn = props.application.modifiedAt
|
|
|
|
|
? props.application.modifiedAt
|
|
|
|
|
: "";
|
|
|
|
|
|
|
|
|
|
if (editedBy === "" && editedOn === "") return "";
|
|
|
|
|
|
|
|
|
|
editedBy = editedBy.split("@")[0];
|
|
|
|
|
editedBy = truncateString(editedBy, 9);
|
|
|
|
|
|
|
|
|
|
//assuming modifiedAt will be always available
|
|
|
|
|
editedOn = howMuchTimeBeforeText(editedOn);
|
|
|
|
|
editedOn = editedOn !== "" ? editedOn + " ago" : "";
|
|
|
|
|
return editedBy + " edited " + editedOn;
|
|
|
|
|
};
|
|
|
|
|
|
2022-03-10 02:22:07 +00:00
|
|
|
const LaunchAppInMobile = useCallback(() => {
|
|
|
|
|
history.push(viewApplicationURL);
|
|
|
|
|
}, [viewApplicationURL]);
|
2022-02-17 16:38:36 +00:00
|
|
|
|
2019-11-21 10:52:49 +00:00
|
|
|
return (
|
2022-02-17 16:38:36 +00:00
|
|
|
<Container
|
|
|
|
|
isMobile={props.isMobile}
|
|
|
|
|
onClick={props.isMobile ? LaunchAppInMobile : noop}
|
|
|
|
|
>
|
2021-12-07 07:59:32 +00:00
|
|
|
<NameWrapper
|
|
|
|
|
className="t--application-card"
|
2021-10-04 15:34:37 +00:00
|
|
|
hasReadPermission={hasReadPermission}
|
2021-12-07 07:59:32 +00:00
|
|
|
isMenuOpen={isMenuOpen}
|
|
|
|
|
onMouseEnter={() => {
|
|
|
|
|
!isFetchingApplications && setShowOverlay(true);
|
|
|
|
|
}}
|
|
|
|
|
onMouseLeave={() => {
|
|
|
|
|
// If the menu is not open, then setOverlay false
|
|
|
|
|
// Set overlay false on outside click.
|
|
|
|
|
!isMenuOpen && setShowOverlay(false);
|
|
|
|
|
}}
|
|
|
|
|
showOverlay={showOverlay}
|
2021-10-04 15:34:37 +00:00
|
|
|
>
|
2021-12-07 07:59:32 +00:00
|
|
|
<Wrapper
|
|
|
|
|
backgroundColor={selectedColor}
|
|
|
|
|
className={
|
|
|
|
|
isFetchingApplications
|
|
|
|
|
? Classes.SKELETON
|
|
|
|
|
: "t--application-card-background"
|
|
|
|
|
}
|
|
|
|
|
hasReadPermission={hasReadPermission}
|
2022-02-17 16:38:36 +00:00
|
|
|
isMobile={props.isMobile}
|
2021-12-07 07:59:32 +00:00
|
|
|
key={props.application.id}
|
2020-10-14 10:35:19 +00:00
|
|
|
>
|
2021-12-07 07:59:32 +00:00
|
|
|
<CircleAppIcon name={appIcon} size={Size.large} />
|
|
|
|
|
<AppNameWrapper
|
|
|
|
|
className={isFetchingApplications ? Classes.SKELETON : ""}
|
|
|
|
|
isFetching={isFetchingApplications}
|
|
|
|
|
ref={appNameWrapperRef}
|
|
|
|
|
>
|
2022-03-24 07:44:53 +00:00
|
|
|
{isVerticalEllipsisActive(appNameWrapperRef?.current) ? (
|
2021-12-07 07:59:32 +00:00
|
|
|
<TooltipComponent
|
|
|
|
|
content={props.application.name}
|
|
|
|
|
maxWidth="400px"
|
|
|
|
|
>
|
|
|
|
|
{appNameText}
|
|
|
|
|
</TooltipComponent>
|
|
|
|
|
) : (
|
|
|
|
|
appNameText
|
|
|
|
|
)}
|
|
|
|
|
</AppNameWrapper>
|
2022-02-17 16:38:36 +00:00
|
|
|
{showOverlay && !props.isMobile && (
|
2021-12-07 07:59:32 +00:00
|
|
|
<div className="overlay">
|
|
|
|
|
<div className="overlay-blur" />
|
|
|
|
|
<ApplicationImage className="image-container">
|
|
|
|
|
<Control className="control">
|
|
|
|
|
{hasEditPermission && !isMenuOpen && (
|
|
|
|
|
<EditButton
|
|
|
|
|
className="t--application-edit-link"
|
|
|
|
|
fill
|
|
|
|
|
icon={"edit"}
|
|
|
|
|
iconPosition={IconPositions.left}
|
2022-03-10 02:22:07 +00:00
|
|
|
onClick={(e) => {
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
history.push(editApplicationURL);
|
|
|
|
|
}}
|
2021-12-07 07:59:32 +00:00
|
|
|
size={Size.medium}
|
2022-03-10 02:22:07 +00:00
|
|
|
tag="button"
|
2021-12-07 07:59:32 +00:00
|
|
|
text="Edit"
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
{!isMenuOpen && (
|
|
|
|
|
<Button
|
|
|
|
|
category={Category.tertiary}
|
|
|
|
|
className="t--application-view-link"
|
|
|
|
|
fill
|
|
|
|
|
icon={"rocket"}
|
|
|
|
|
iconPosition={IconPositions.left}
|
2022-03-10 02:22:07 +00:00
|
|
|
onClick={(e) => {
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
history.push(viewApplicationURL);
|
|
|
|
|
}}
|
2021-12-07 07:59:32 +00:00
|
|
|
size={Size.medium}
|
2022-03-10 02:22:07 +00:00
|
|
|
tag="button"
|
2021-12-07 07:59:32 +00:00
|
|
|
text="Launch"
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
</Control>
|
|
|
|
|
</ApplicationImage>
|
|
|
|
|
</div>
|
2020-11-09 11:30:34 +00:00
|
|
|
)}
|
2021-12-07 07:59:32 +00:00
|
|
|
</Wrapper>
|
|
|
|
|
<CardFooter>
|
|
|
|
|
<ModifiedDataComponent>{editedByText()}</ModifiedDataComponent>
|
2022-02-17 16:38:36 +00:00
|
|
|
{!!moreActionItems.length && !props.isMobile && ContextMenu}
|
2021-12-07 07:59:32 +00:00
|
|
|
</CardFooter>
|
|
|
|
|
</NameWrapper>
|
|
|
|
|
{showGitBadge && <GitConnectedBadge />}
|
|
|
|
|
</Container>
|
2019-11-21 10:52:49 +00:00
|
|
|
);
|
2021-04-28 10:28:39 +00:00
|
|
|
}
|
2019-11-21 10:52:49 +00:00
|
|
|
|
|
|
|
|
export default ApplicationCard;
|