-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Task 107 overview sources card #346
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { SOURCES_LOGOS } from "./sources.card/sources.card"; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export const SOURCES_LOGOS = { | ||
java: "https://odigos-sources.s3.amazonaws.com/java.svg", | ||
go: "https://odigos-sources.s3.amazonaws.com/go.svg", | ||
javascript: "https://odigos-sources.s3.amazonaws.com/nodejs.svg", | ||
python: "https://odigos-sources.s3.amazonaws.com/python.svg", | ||
dotnet: "https://odigos-sources.s3.amazonaws.com/dotnet.svg", | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export { OverviewHeader } from "./overview.header/overview.header"; | ||
export { ManageDestination } from "./destination/manage.destination/manage.destination"; | ||
export { DestinationsManagedList } from "./destination/destination.list/destinations.managed.list"; | ||
export { SourcesManagedList } from "./sources/sources.manage.list/sources.manage.list"; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from "react"; | ||
import { KeyvalImage, KeyvalTag, KeyvalText } from "@/design.system"; | ||
import { CardWrapper } from "./sources.manage.styled"; | ||
import theme from "@/styles/palette"; | ||
import { KIND_COLORS } from "@/styles/global"; | ||
import { SOURCES_LOGOS } from "@/assets/images"; | ||
import { ManagedSource } from "@/types/sources"; | ||
|
||
const TEXT_STYLE: React.CSSProperties = { | ||
textOverflow: "ellipsis", | ||
whiteSpace: "nowrap", | ||
overflow: "hidden", | ||
width: 224, | ||
textAlign: "center", | ||
}; | ||
const LOGO_STYLE: React.CSSProperties = { | ||
padding: 4, | ||
backgroundColor: theme.colors.white, | ||
}; | ||
Comment on lines
+9
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use styled components instead? |
||
|
||
interface SourceManagedCardProps { | ||
item: ManagedSource; | ||
} | ||
const DEPLOYMENT = "deployment"; | ||
export default function SourceManagedCard({ | ||
item = {} as ManagedSource, | ||
}: SourceManagedCardProps) { | ||
return ( | ||
<CardWrapper> | ||
<KeyvalImage | ||
src={SOURCES_LOGOS[item?.languages[0].language || ""]} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want to always show the first one? what if there are many? |
||
width={56} | ||
height={56} | ||
style={LOGO_STYLE} | ||
alt="source-logo" | ||
/> | ||
<KeyvalText size={18} weight={700} style={TEXT_STYLE}> | ||
{item?.name} | ||
</KeyvalText> | ||
<KeyvalTag | ||
title={item?.kind || ""} | ||
color={KIND_COLORS[item?.kind.toLowerCase() || DEPLOYMENT]} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if item?.kind?.toLowerCase() |
||
/> | ||
<KeyvalText size={14} color={theme.text.light_grey} style={TEXT_STYLE}> | ||
{item?.namespace} | ||
</KeyvalText> | ||
</CardWrapper> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from "react"; | ||
import { ManagedListWrapper, EmptyListWrapper } from "./sources.manage.styled"; | ||
import Empty from "@/assets/images/empty-list.svg"; | ||
import SourceManagedCard from "./sources.manage.card"; | ||
|
||
export function SourcesManagedList({ data = [1, 1, 1, 1] }) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is |
||
function renderDestinations() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. destinations -> sources |
||
return data.map((source: any) => <SourceManagedCard />); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't we need a react key prop for this list? |
||
} | ||
|
||
return ( | ||
<> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. redundant |
||
<ManagedListWrapper> | ||
{data?.length === 0 ? ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. id |
||
<EmptyListWrapper> | ||
<Empty /> | ||
</EmptyListWrapper> | ||
) : ( | ||
renderDestinations() | ||
)} | ||
</ManagedListWrapper> | ||
</> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { styled } from "styled-components"; | ||
|
||
export const CardWrapper = styled.div` | ||
display: flex; | ||
width: 272px; | ||
height: 152px; | ||
padding-top: 32px; | ||
padding-bottom: 24px; | ||
border-radius: 24px; | ||
border: 1px solid var(--dark-mode-dark-3, #203548); | ||
background: var(--dark-mode-dark-1, #07111a); | ||
align-items: center; | ||
flex-direction: column; | ||
gap: 10px; | ||
cursor: pointer; | ||
&:hover { | ||
background: var(--dark-mode-dark-1, #07111a81); | ||
} | ||
`; | ||
|
||
export const EmptyListWrapper = styled.div` | ||
width: 100%; | ||
margin-top: 130px; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
`; | ||
|
||
export const ManagedListWrapper = styled.div` | ||
width: 100%; | ||
display: flex; | ||
flex-wrap: wrap; | ||
gap: 24px; | ||
overflow-y: scroll; | ||
padding: 0px 36px; | ||
padding-bottom: 50px; | ||
margin-top: 88px; | ||
`; |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -12,11 +12,7 @@ import { | |||||
} from "./source.card.styled"; | ||||||
import Logo from "assets/logos/code-sandbox-logo.svg"; | ||||||
import { SETUP } from "@/utils/constants"; | ||||||
|
||||||
const KIND_COLORS = { | ||||||
deployment: "#203548", | ||||||
DaemonSet: "#033869", | ||||||
}; | ||||||
import { KIND_COLORS } from "@/styles/global"; | ||||||
|
||||||
const TEXT_STYLE = { | ||||||
textOverflow: "ellipsis", | ||||||
|
@@ -37,7 +33,10 @@ export function SourceCard({ item, onClick, focus }: any) { | |||||
{item.name} | ||||||
</KeyvalText> | ||||||
</ApplicationNameWrapper> | ||||||
<KeyvalTag title={item.kind} color={KIND_COLORS[item.kind]} /> | ||||||
<KeyvalTag | ||||||
title={item.kind} | ||||||
color={KIND_COLORS[item.kind].toLowerCase()} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Current implementation will lower case the color (
Suggested change
|
||||||
/> | ||||||
<KeyvalText size={14} weight={400}> | ||||||
{`${item?.instances} ${SETUP.RUNNING_INSTANCES}`} | ||||||
</KeyvalText> | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,5 @@ | ||||||
export const KIND_COLORS = { | ||||||
deployment: "#203548", | ||||||
daemonSet: "#033869", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
statefulset: "#0F2C3F", | ||||||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export interface ManagedSource { | ||
kind: string; | ||
name: string; | ||
namespace: string; | ||
languages: [ | ||
{ | ||
container_name: string; | ||
language: string; | ||
} | ||
]; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the logo of programming languages, not sources