Skip to content
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-922] feat: sources condition #1221

Merged
merged 175 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
175 commits
Select commit Hold shift + click to select a range
95b7e2a
WIP
alonkeyval Jul 30, 2023
91375ca
Merge branch 'main' of github.com:alonkeyval/odigos into TASK-149-ove…
alonkeyval Jul 30, 2023
3f0700a
WIP
alonkeyval Jul 30, 2023
9e4a5ac
source manage card
alonkeyval Jul 30, 2023
e03bf92
Merge pull request #344 from alonkeyval/TASK-149-overview-container
alonkeyval Jul 30, 2023
0c4b42e
fixed pr comments
alonkeyval Jul 30, 2023
d5fe630
fixed pr comments
alonkeyval Jul 30, 2023
fbaa04c
Merge branch 'main' of github.com:alonkeyval/odigos into TASK-142-dis…
alonkeyval Jul 30, 2023
5504348
sources list display
alonkeyval Jul 30, 2023
ae80c0a
change image url to cloud front
alonkeyval Jul 30, 2023
79f2c53
fixed pr comments
alonkeyval Jul 30, 2023
8267a10
Merge pull request #346 from alonkeyval/TASK-107-overview-sources-card
alonkeyval Jul 30, 2023
5fffc40
add new action menu
alonkeyval Jul 30, 2023
18cd5c4
on add btn click
alonkeyval Jul 30, 2023
3ac58d1
Merge pull request #347 from alonkeyval/TASK-142-display-source-manag…
alonkeyval Jul 30, 2023
ab642bd
WIP
alonkeyval Jul 30, 2023
b6287db
Merge pull request #348 from alonkeyval/TASK-143-add-new-source-btn
alonkeyval Jul 31, 2023
64c31c4
restructe source filter option
alonkeyval Jul 31, 2023
4192289
filters
alonkeyval Jul 31, 2023
1006d44
WIP
alonkeyval Jul 31, 2023
537aa75
new back button
alonkeyval Jul 31, 2023
ab32b46
WIP
alonkeyval Jul 31, 2023
d1c9029
Merge pull request #359 from alonkeyval/TASK-145-handle-new-sources-c…
alonkeyval Jul 31, 2023
042cb10
Merge branch 'main' of github.com:alonkeyval/odigos into overview-sou…
alonkeyval Jul 31, 2023
0d97d64
filter instromented apps
alonkeyval Jul 31, 2023
f38568b
WIP
alonkeyval Jul 31, 2023
d57d024
WIP
alonkeyval Jul 31, 2023
6b1a812
WIP
alonkeyval Jul 31, 2023
d6e9f6f
WIP
alonkeyval Jul 31, 2023
7c655a0
WIP
alonkeyval Jul 31, 2023
fbe5504
WIP
alonkeyval Aug 1, 2023
8a93e8a
fixed pr comments
alonkeyval Aug 1, 2023
d9958c8
fixed pr comments
alonkeyval Aug 1, 2023
89dc8ae
Task 158 back button (#360)
alonkeyval Aug 1, 2023
5d5bf9b
fixed pr comments
alonkeyval Aug 1, 2023
a682311
Merge remote-tracking branch 'upstream/main' into TASK-141-sources-ov…
alonkeyval Aug 1, 2023
15ba9c3
Merge remote-tracking branch 'upstream/TASK-141-sources-overview' int…
alonkeyval Aug 1, 2023
a131614
fixed pr comments
alonkeyval Aug 1, 2023
180fd5d
hide checkboxs
alonkeyval Aug 1, 2023
d4d5211
WIP
alonkeyval Aug 1, 2023
97e1983
Merge branch 'main' of github.com:alonkeyval/odigos into TASK-161-zer…
alonkeyval Aug 1, 2023
61fc2fc
WIP
alonkeyval Aug 1, 2023
49f6983
fixed pr comments
alonkeyval Aug 1, 2023
b1f12e7
remove scrollbars
alonkeyval Aug 1, 2023
f81d618
WIP
alonkeyval Aug 1, 2023
5e68cdd
added quick help
alonkeyval Aug 2, 2023
32bec3d
WIP
alonkeyval Aug 2, 2023
e368ede
Merge remote-tracking branch 'upstream/main' into TASK-141-sources-ov…
alonkeyval Aug 2, 2023
4d7b99d
Merge remote-tracking branch 'upstream/TASK-141-sources-overview' int…
alonkeyval Aug 2, 2023
f91d357
create destinaion flow match url
alonkeyval Aug 2, 2023
f0e6d64
new dest flow
alonkeyval Aug 2, 2023
0a30a23
manage dest flow
alonkeyval Aug 2, 2023
71e52b7
fixed pr comments
alonkeyval Aug 2, 2023
55cae09
Overview sources (#364)
alonkeyval Aug 2, 2023
60a61ee
WIP
alonkeyval Aug 2, 2023
c44837e
WIP
alonkeyval Aug 2, 2023
6253cbc
Merge branch 'main' into TASK-141-sources-overview
alonkeyval Aug 2, 2023
59029f1
Merge branch 'TASK-141-sources-overview' into TASK-156-match-url-to-a…
alonkeyval Aug 2, 2023
924cee2
fixed pr comments
alonkeyval Aug 2, 2023
004ca63
restruce file system
alonkeyval Aug 2, 2023
cf77635
wip
alonkeyval Aug 2, 2023
4616dcf
add pen icon and danger zone
alonkeyval Aug 2, 2023
5d85d7c
manage delete source
alonkeyval Aug 3, 2023
b655e18
WIP
alonkeyval Aug 3, 2023
592be7e
WIP
alonkeyval Aug 3, 2023
ef93cc6
WIP
alonkeyval Aug 3, 2023
9e322bf
WIP
alonkeyval Aug 3, 2023
5ad8d1d
WIP
alonkeyval Aug 3, 2023
26033f7
Task 165 manage source (#368)
alonkeyval Aug 3, 2023
4e02ce6
WIP
alonkeyval Aug 3, 2023
b49275e
delete files
alonkeyval Aug 3, 2023
beb029f
WIP
alonkeyval Aug 3, 2023
4c28472
move page logic to container
alonkeyval Aug 3, 2023
5eb7361
move page logic to container
alonkeyval Aug 3, 2023
5fe763a
WIP
alonkeyval Aug 3, 2023
bfb54d8
Task 168 refactor (#370)
alonkeyval Aug 3, 2023
0662844
Merge branch 'TASK-141-sources-overview' into main
alonkeyval Aug 3, 2023
f15d28d
WIP
alonkeyval Aug 3, 2023
cfbfc2a
Merge remote-tracking branch 'upstream/main'
alonkeyval Aug 6, 2023
c9d170e
edit resource name
alonkeyval Aug 6, 2023
3b8983c
refactor sources|
alonkeyval Aug 6, 2023
0dbc53d
change files names
alonkeyval Aug 7, 2023
bb9c9d5
change files names
alonkeyval Aug 7, 2023
c2e13cd
delete dest fixed
alonkeyval Aug 7, 2023
61183a4
WIP
alonkeyval Aug 7, 2023
c374b8e
refactor services
alonkeyval Aug 7, 2023
55be5ce
Merge branch 'main' of github.com:alonkeyval/odigos
alonkeyval Aug 7, 2023
f1618a5
WIP
alonkeyval Aug 7, 2023
fd269a6
change file names
alonkeyval Aug 7, 2023
8769e67
WIP
alonkeyval Aug 7, 2023
f5220c5
WIP
alonkeyval Aug 7, 2023
7626088
add contact button
alonkeyval Aug 8, 2023
cef20f6
WIP
alonkeyval Aug 9, 2023
52f92f0
fixed setup source and destinations list wrapping
alonkeyval Aug 9, 2023
6095f4d
manage destination list set up
alonkeyval Aug 9, 2023
960f16d
remove unused code
alonkeyval Aug 10, 2023
d62193b
fixed repeat numbers
alonkeyval Aug 10, 2023
ac1b8f9
remove comments
alonkeyval Aug 10, 2023
419d22c
Merge branch 'TASK-217-centerlize-lists' into TASK-218-remove-next-stop
alonkeyval Aug 10, 2023
68ffb8c
Merge branch 'keyval-dev:main' into main
alonkeyval Aug 10, 2023
5bb8c42
Merge branch 'main' of github.com:alonkeyval/odigos into TASK-218-rem…
alonkeyval Aug 10, 2023
883d21b
WIP
alonkeyval Aug 10, 2023
d6f4127
focus on hover
alonkeyval Aug 10, 2023
7c0e27a
types
alonkeyval Aug 10, 2023
d2ae596
fixed focus issue
alonkeyval Aug 10, 2023
0d38d2a
remove scroll bar on firefox
alonkeyval Aug 10, 2023
0a35b8c
fixed focus issue
alonkeyval Aug 10, 2023
fec0da9
WIP
alonkeyval Aug 10, 2023
41f1d1d
WIP
alonkeyval Aug 10, 2023
41d9ec0
WIP
alonkeyval Aug 10, 2023
b91dcfc
Merge branch 'keyval-dev:main' into main
alonkeyval Aug 10, 2023
0581273
Merge branch 'keyval-dev:main' into main
alonkeyval Aug 16, 2023
7f83013
Merge branch 'keyval-dev:main' into main
alonkeyval Aug 16, 2023
764b34e
Merge branch 'keyval-dev:main' into main
alonkeyval Aug 17, 2023
aae797f
Merge branch 'keyval-dev:main' into main
alonkeyval Aug 24, 2023
eccae08
WIP
alonkeyval Aug 24, 2023
cbc404c
chore: merge master
alonkeyval Sep 13, 2023
4133dbd
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Oct 24, 2023
0e20d78
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Oct 25, 2023
0e03acd
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Nov 12, 2023
792fa0e
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Nov 28, 2023
dc00780
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Dec 25, 2023
5ea8080
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Dec 25, 2023
af2c604
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Dec 26, 2023
a5458e1
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Jan 3, 2024
f59a287
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Jan 8, 2024
88b0f44
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Jan 8, 2024
d5b91f9
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Jan 29, 2024
692e8de
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Feb 4, 2024
6d2aa66
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Feb 5, 2024
10bdc06
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Feb 8, 2024
fcbd0a9
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Feb 8, 2024
87aec56
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Feb 11, 2024
ea0a726
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Feb 18, 2024
f0c48c9
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Feb 20, 2024
5729525
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Feb 20, 2024
197a7f9
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Feb 21, 2024
442499f
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Feb 22, 2024
daaf4bd
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Feb 26, 2024
0a5e45d
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Feb 29, 2024
d77bd9c
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Mar 3, 2024
37df88e
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Mar 6, 2024
1f8d7ef
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Mar 7, 2024
b84263e
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Mar 7, 2024
25a6e7a
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Mar 10, 2024
caa3fa7
chore: wip
alonkeyval Mar 10, 2024
06afb46
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Mar 11, 2024
da00e35
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Mar 12, 2024
54f669f
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Mar 12, 2024
d89a229
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Mar 12, 2024
16815d7
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Mar 13, 2024
21096f4
chore: wip
alonkeyval Mar 13, 2024
99bac3f
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Mar 14, 2024
8290402
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Mar 18, 2024
82e6b80
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Apr 18, 2024
8b8f4f1
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval Apr 25, 2024
285a13b
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval May 8, 2024
e91e7cc
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval May 9, 2024
a53e048
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval May 16, 2024
596be25
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval May 16, 2024
8188793
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval May 19, 2024
9488eb0
Merge branch 'main' of github.com:keyval-dev/odigos
alonkeyval May 21, 2024
f15234a
chore: add conditions to sources
alonkeyval May 22, 2024
264ae58
chore: render conditions
alonkeyval May 22, 2024
9c333f7
chore: wip
alonkeyval May 22, 2024
0b23850
chore: wip
alonkeyval May 22, 2024
94567e6
chore: fixed pr comments
alonkeyval May 22, 2024
08a7050
Merge branch 'main' into task-922-sources-condition
alonkeyval May 22, 2024
5bec835
chore: ui cosmetics
alonkeyval May 22, 2024
bf20c7e
Merge branch 'task-922-sources-condition' of github.com:alonkeyval/od…
alonkeyval May 22, 2024
b9dc7b6
chore: wip
alonkeyval May 22, 2024
2d739fd
chore: wip
alonkeyval May 22, 2024
214f4e9
chore: added condition check
alonkeyval May 22, 2024
1fc2af7
chore: wip
alonkeyval May 22, 2024
cf5948d
chore: fixed build
alonkeyval May 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions frontend/endpoints/sources.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ type SourceLanguage struct {
}

type InstrumentedApplicationDetails struct {
Languages []SourceLanguage `json:"languages,omitempty"`
Languages []SourceLanguage `json:"languages,omitempty"`
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

// this object contains only part of the source fields. It is used to display the sources in the frontend
Expand Down Expand Up @@ -244,8 +245,18 @@ func k8sInstrumentedAppToThinSource(app *v1alpha1.InstrumentedApplication) ThinS
source.Name = app.OwnerReferences[0].Name
source.Kind = app.OwnerReferences[0].Kind
source.Namespace = app.Namespace
var conditions []metav1.Condition
for _, condition := range app.Status.Conditions {
conditions = append(conditions, metav1.Condition{
Type: condition.Type,
Status: condition.Status,
Message: condition.Message,
LastTransitionTime: condition.LastTransitionTime,
})
}
source.IaDetails = &InstrumentedApplicationDetails{
Languages: []SourceLanguage{},
Languages: []SourceLanguage{},
Conditions: conditions,
}
for _, language := range app.Spec.RuntimeDetails {
source.IaDetails.Languages = append(source.IaDetails.Languages, SourceLanguage{
Expand Down
3 changes: 3 additions & 0 deletions frontend/webapp/assets/icons/app/green-check.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions frontend/webapp/assets/icons/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import Check from './check.svg';
import Copy from './copy.svg';
import Copied from './copied.svg';
import YamlIcon from './yaml.svg';

import GreenCheck from './green-check.svg';
import RedError from './red-error.svg';

export {
RightArrow,
Charge,
Expand All @@ -21,4 +25,6 @@ export {
Copy,
Copied,
YamlIcon,
GreenCheck,
RedError,
};
4 changes: 4 additions & 0 deletions frontend/webapp/assets/icons/app/red-error.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 55 additions & 0 deletions frontend/webapp/components/common/conditions.check.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import React from 'react';
import { GreenCheck, RedError } from '@/assets/icons/app';
import styled from 'styled-components';
import { KeyvalText } from '@/design.system';

const Container = styled.div`
display: inline-block;
position: relative;
`;

const StatusIcon = styled.div`
font-size: 24px;
cursor: pointer;
`;

const Tooltip = styled.div`
visibility: hidden;
width: max-content;
background-color: black;
color: #fff;
text-align: center;
border-radius: 5px;
padding: 8px;
position: absolute;
z-index: 1;
bottom: 100%; /* Position above the icon */
left: 50%;
transform: translateX(-50%);
opacity: 0;
transition: opacity 0.3s;

${Container}:hover & {
visibility: visible;
opacity: 1;
}
`;

export const ConditionCheck = ({ conditions }) => {
const healthyCount = conditions.filter(
(condition) => condition.status === 'True'
).length;
const totalCount = conditions.length;
const allHealthy = healthyCount === totalCount;

return (
<Container>
<StatusIcon>{allHealthy ? <GreenCheck /> : <RedError />}</StatusIcon>
<Tooltip>
<KeyvalText
size={12}
>{`${healthyCount}/${totalCount} checks OK`}</KeyvalText>
</Tooltip>
</Container>
);
};
1 change: 1 addition & 0 deletions frontend/webapp/components/common/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './multi.checkbox';
export * from './conditions.check';
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import { KIND_COLORS } from '@/styles/global';
import {
LANGUAGES_COLORS,
LANGUAGES_LOGOS,
WORKLOAD_PROGRAMMING_LANGUAGES,
getMainContainerLanguage,
} from '@/utils';
import { ConditionCheck } from '@/components/common';

const StyledTr = styled.tr`
&:hover {
Expand Down Expand Up @@ -109,6 +109,7 @@ export function SourcesTableRow({

const containerName =
item?.instrumented_application_details.languages?.[0].container_name || '';

return (
<StyledTr key={item.kind}>
<StyledMainTd isFirstRow={index === 0}>
Expand All @@ -131,8 +132,12 @@ export function SourcesTableRow({
<KeyvalText weight={600}>
{`${item.name || 'Source'} `}
</KeyvalText>
<KeyvalText weight={600}>
{`${item.reported_name || ''} `}
<KeyvalText color={theme.text.light_grey} size={14}>
<ConditionCheck
conditions={
item?.instrumented_application_details?.conditions || []
}
/>
</KeyvalText>
</NameContainer>
<FooterContainer>
Expand Down
91 changes: 51 additions & 40 deletions frontend/webapp/containers/overview/sources/edit.source/index.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
'use client';
import React, { useEffect, useState } from 'react';
import theme from '@/styles/palette';
import { ManagedSource } from '@/types';
import { useMutation } from 'react-query';
import { Back } from '@/assets/icons/overview';
import { DeleteSource } from '@/components/overview';
import { useKeyDown, useNotification } from '@/hooks';
import { useRouter, useSearchParams } from 'next/navigation';
import { deleteSource, getSource, patchSources } from '@/services';
import { ManageSourceHeader } from '@/components/overview/sources/manage.source.header/manage.source.header';
import {
SETUP,
ACTION,
LANGUAGES_LOGOS,
NOTIFICATION,
OVERVIEW,
ROUTES,
SETUP,
OVERVIEW,
NOTIFICATION,
LANGUAGES_LOGOS,
getMainContainerLanguage,
} from '@/utils';
import { useRouter, useSearchParams } from 'next/navigation';
import React, { useEffect, useState } from 'react';
import { useMutation } from 'react-query';
import {
ManageSourcePageContainer,
BackButtonWrapper,
FieldWrapper,
BackButtonWrapper,
ManageSourcePageContainer,
SaveSourceButtonWrapper,
} from './styled';
import { Back } from '@/assets/icons/overview';
import {
KeyvalButton,
KeyvalInput,
KeyvalLoader,
KeyvalText,
Conditions,
} from '@/design.system';
import { DeleteSource } from '@/components/overview';
import { deleteSource, getSource, patchSources } from '@/services/sources';
import { useKeyDown, useNotification } from '@/hooks';
import theme from '@/styles/palette';
import { ManagedSource } from '@/types/sources';

const NAME = 'name';
const KIND = 'kind';
Expand Down Expand Up @@ -114,32 +115,42 @@ export function EditSourceForm() {
<KeyvalText size={14}>{SETUP.BACK}</KeyvalText>
</BackButtonWrapper>
{currentSource && <ManageSourceHeader source={currentSource} />}
<FieldWrapper>
<KeyvalInput
label={OVERVIEW.REPORTED_NAME}
value={inputValue}
onChange={(e) => setInputValue(e)}
<div style={{ display: 'flex', gap: 60 }}>
<div>
<FieldWrapper>
<KeyvalInput
label={OVERVIEW.REPORTED_NAME}
value={inputValue}
onChange={(e) => setInputValue(e)}
/>
</FieldWrapper>
<SaveSourceButtonWrapper>
<KeyvalButton disabled={!inputValue} onClick={onSaveClick}>
<KeyvalText color={theme.colors.dark_blue} size={14} weight={600}>
{ACTION.SAVE}
</KeyvalText>
</KeyvalButton>
</SaveSourceButtonWrapper>
<DeleteSource
onDelete={onSourceDelete}
name={currentSource?.name}
image_url={
LANGUAGES_LOGOS[
getMainContainerLanguage(
currentSource?.instrumented_application_details.languages ||
undefined
)
]
}
/>
</div>
<Conditions
conditions={
currentSource.instrumented_application_details?.conditions
}
/>
</FieldWrapper>
<SaveSourceButtonWrapper>
<KeyvalButton disabled={!inputValue} onClick={onSaveClick}>
<KeyvalText color={theme.colors.dark_blue} size={14} weight={600}>
{ACTION.SAVE}
</KeyvalText>
</KeyvalButton>
</SaveSourceButtonWrapper>
<DeleteSource
onDelete={onSourceDelete}
name={currentSource?.name}
image_url={
LANGUAGES_LOGOS[
getMainContainerLanguage(
currentSource?.instrumented_application_details.languages ||
undefined
)
]
}
/>
</div>

<Notification />
</ManageSourcePageContainer>
);
Expand Down
118 changes: 118 additions & 0 deletions frontend/webapp/design.system/condition.alert/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
import React from 'react';
import styled from 'styled-components';
import theme from '@/styles/palette';
import { Condition } from '@/types';
import { KeyvalText } from '../text/text';
import { GreenCheck, RedError } from '@/assets/icons/app';

interface ConditionAlertProps {
conditions: Condition[] | undefined;
title?: string;
}

const ConditionAlertContainer = styled.div`
border: 1px solid ${theme.colors.blue_grey};
border-radius: 8px;
padding: 10px;
margin-top: 8px;
`;

const ConditionItem = styled.div`
padding: 10px;
`;

const ConditionIconContainer = styled.div``;

const ConditionDetails = styled.div`
display: flex;
flex-wrap: wrap;
margin-top: 4px;
`;

const ConditionSeparator = styled.div`
width: 2px;
height: 30px;
border-radius: 20px;
background-color: ${theme.colors.blue_grey};
margin-left: 10px;
`;

const IconWrapper = styled.div<{ bgColor: string }>`
width: 32px;
height: 32px;
border-radius: 20px;
display: flex;
align-items: center;
justify-content: center;
background-color: ${({ bgColor }) => bgColor};
`;

const InnerIconWrapper = styled.div<{ borderColor: string }>`
width: 16px;
height: 16px;
border-radius: 20px;
display: flex;
align-items: center;
justify-content: center;
border: 2px solid ${({ borderColor }) => borderColor};
`;

export const Conditions: React.FC<ConditionAlertProps> = ({
conditions,
title = 'Status',
}) => {
const getSuccessIcon = () => (
<IconWrapper bgColor="#3fb94f40">
<InnerIconWrapper borderColor="#3fb950">
<GreenCheck style={{ width: 10, height: 10 }} />
</InnerIconWrapper>
</IconWrapper>
);

const getErrorIcon = () => (
<IconWrapper bgColor="#f8524952">
<InnerIconWrapper borderColor="#f85249">
<RedError
style={{ width: 10, height: 10, marginLeft: 2, marginBottom: 2 }}
/>
</InnerIconWrapper>
</IconWrapper>
);

return conditions ? (
<div>
<KeyvalText size={14} weight={600}>
{title}
</KeyvalText>
<ConditionAlertContainer>
{conditions.map((condition, index) => (
<ConditionItem key={index}>
<div style={{ display: 'flex', gap: '8px' }}>
<ConditionIconContainer>
{condition.status === 'True'
? getSuccessIcon()
: getErrorIcon()}
</ConditionIconContainer>
<div>
<KeyvalText size={14}>{condition.message}</KeyvalText>
<ConditionDetails>
<KeyvalText
style={{ marginRight: '8px' }}
color={theme.text.grey}
size={12}
>
{condition.type}
</KeyvalText>
<KeyvalText color={theme.text.grey} size={12}>
{condition.last_transition_time}
</KeyvalText>
</ConditionDetails>
</div>
</div>
{index !== conditions.length - 1 && <ConditionSeparator />}
</ConditionItem>
))}
</ConditionAlertContainer>
</div>
) : null;
};
1 change: 1 addition & 0 deletions frontend/webapp/design.system/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ export { OdigosActionsGroup as ActionsGroup } from './action.group';
export { OdigosTable as Table } from './table';
export { YMLEditor } from './yml.editor';
export { CodeBlock } from './code-block';
export { Conditions } from './condition.alert';
Loading
Loading