Skip to content

Commit f19bb9b

Browse files
feat: add deprecated labels for Jaeger, Falco, Httpbin and Kiali apps (#630)
* feat: add deprecated labels for Jaeger, Falco, Httpbin and Kiali apps * fix: improve UI and remove unnecessary code for deprecated apps --------- Co-authored-by: svcAPLBot <174728082+svcAPLBot@users.noreply.github.com>
1 parent 02cba86 commit f19bb9b

File tree

4 files changed

+39
-45
lines changed

4 files changed

+39
-45
lines changed

src/components/AppCard.tsx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,15 @@ const useStyles = makeStyles()((theme) => {
4949
border: 'none',
5050
borderRadius: '5px',
5151
},
52-
chipDeprecated: {
53-
color: `${theme.palette.text.primary}`,
54-
backgroundColor: '#a4a4a440',
55-
fontWeight: 'bold',
56-
},
5752
chipDark: {
58-
color: 'rgb(174, 192, 245)',
59-
backgroundColor: 'lch(77.7 28.7 275 / 0.12)',
53+
fontWeight: 'normal',
54+
color: p.grey[0],
55+
backgroundColor: p.grey[500_24],
6056
},
6157
chipLight: {
62-
color: '#696970',
63-
backgroundColor: 'rgba(0, 0, 0, 0.08)',
58+
fontWeight: 'normal',
59+
color: p.grey[1000],
60+
backgroundColor: p.grey[300],
6461
},
6562
contrast: {
6663
filter: 'drop-shadow(0 0 2px white)',
@@ -169,7 +166,11 @@ export default function ({
169166

170167
{isDeprecated && (
171168
<Box>
172-
<Chip className={cx(classes.chip, classes.chipDeprecated)} label='DEPRECATED' variant='outlined' />
169+
<Chip
170+
className={cx(classes.chip, isLight ? classes.chipLight : classes.chipDark)}
171+
label='DEPRECATED'
172+
variant='outlined'
173+
/>
173174
</Box>
174175
)}
175176
</Link>

src/components/Apps.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ function sortArray(a, b) {
9494
function getDeprecatedApps(apps, session, teamId) {
9595
return apps
9696
?.map((app) => {
97-
const { id, isDeprecated, deprecationInfo, externalUrl, replacementUrl } = getAppData(session, teamId, app)
98-
if (isDeprecated) return { id, deprecationInfo, externalUrl, replacementUrl }
97+
const { id, isDeprecated, deprecationInfo, externalUrl } = getAppData(session, teamId, app)
98+
if (isDeprecated) return { id, deprecationInfo, externalUrl }
9999
return null
100100
})
101101
?.filter((app) => app !== null)
@@ -203,11 +203,10 @@ export default function Apps({ teamId, apps, teamSettings, setAppState, objSetti
203203
return deprecatedApps?.map((app) => {
204204
const handleCancel = () => {
205205
setOpenModal('')
206-
window.open(app.externalUrl, '_blank')
206+
window.open(app?.externalUrl, '_blank')
207207
}
208208
const handleAction = () => {
209209
setOpenModal('')
210-
window.open(app.replacementUrl, '_blank')
211210
}
212211
return (
213212
<div key={`deprecated-${app.id}-modal`}>
@@ -219,7 +218,8 @@ export default function Apps({ teamId, apps, teamSettings, setAppState, objSetti
219218
handleCancel={handleCancel}
220219
cancelButtonText='I understand!'
221220
handleAction={handleAction}
222-
actionButtonText={`Go to ${app.deprecationInfo.replacement}`}
221+
actionButtonText='Cancel'
222+
actionButtonColor='primary'
223223
/>
224224
</div>
225225
)

src/components/DeprecatedModalInfo.tsx

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Box, Checkbox, FormControlLabel } from '@mui/material'
22
import React from 'react'
33
import { makeStyles } from 'tss-react/mui'
4-
import ForwardIcon from '@mui/icons-material/Forward'
54

65
const useStyles = makeStyles()((theme) => {
76
return {
@@ -27,10 +26,10 @@ interface Props {
2726
}
2827

2928
export default function ({ deprecatedApp }: Props): React.ReactElement {
30-
const { classes, cx } = useStyles()
29+
const { classes } = useStyles()
3130
const {
3231
id,
33-
deprecationInfo: { replacement, message, reasons, replacementAdvantages, options },
32+
deprecationInfo: { message, reasons, options },
3433
} = deprecatedApp
3534
const image = (id, img) => {
3635
return (
@@ -59,36 +58,32 @@ export default function ({ deprecatedApp }: Props): React.ReactElement {
5958
<Box>
6059
<Box sx={{ display: 'flex', alignItems: 'center' }}>
6160
<Box sx={{ width: '200px', position: 'relative', margin: 'auto' }}>{image(id, `/logos/${id}_logo.svg`)}</Box>
62-
<ForwardIcon className={classes.arrow} />
63-
<Box sx={{ width: '200px', position: 'relative', margin: 'auto' }}>
64-
{image(replacement, `/logos/${replacement}_logo.svg`)}
65-
</Box>
6661
</Box>
6762
<Box sx={{ mt: '2rem', mb: '1rem' }}>{message}</Box>
68-
<Box>
69-
<Box sx={{ fontWeight: 'bold' }}>Reasons:</Box>
63+
{reasons && (
7064
<Box>
71-
{reasons.map((reason) => (
72-
<Box sx={{ ml: '1rem' }}>{reason}</Box>
73-
))}
65+
<Box sx={{ fontWeight: 'bold' }}>Reasons:</Box>
66+
<Box component='ul' sx={{ pl: 2, mt: 1 }}>
67+
{reasons.map((reason) => (
68+
<Box component='li' sx={{ ml: '1rem' }} key={reason}>
69+
{reason}
70+
</Box>
71+
))}
72+
</Box>
7473
</Box>
75-
</Box>
76-
<Box sx={{ mt: '1rem' }}>
77-
<Box sx={{ fontWeight: 'bold' }}>Advantages of replacement:</Box>
78-
<Box>
79-
{replacementAdvantages.map((advantage) => (
80-
<Box sx={{ ml: '1rem' }}>{advantage}</Box>
81-
))}
74+
)}
75+
{options && (
76+
<Box sx={{ mt: '1rem' }}>
77+
<Box sx={{ fontWeight: 'bold' }}>Options:</Box>
78+
<Box component='ul' sx={{ pl: 2, mt: 1 }}>
79+
{options.map((option) => (
80+
<Box component='li' sx={{ ml: '1rem' }} key={option}>
81+
{option}
82+
</Box>
83+
))}
84+
</Box>
8285
</Box>
83-
</Box>
84-
<Box sx={{ mt: '1rem' }}>
85-
<Box sx={{ fontWeight: 'bold' }}>Options:</Box>
86-
<Box>
87-
{options.map((option) => (
88-
<Box sx={{ ml: '1rem' }}>{option}</Box>
89-
))}
90-
</Box>
91-
</Box>
86+
)}
9287
<Box sx={{ mt: '1rem' }}>
9388
<FormControlLabel control={<Checkbox onChange={toggleDontShowAgain} />} label="Don't show me again" />
9489
</Box>

src/utils/data.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ export const getAppData = (
179179
const isBeta = getBetaApp(session, appId)
180180
const isAlpha = getAlphaApp(session, appId)
181181
const deprecationInfo = getDeprecationInfo(session, appId)
182-
const replacementUrl = `https://${deprecationInfo?.replacement}.${cluster.domainSuffix}${deprecationInfo?.path ?? ''}`
183182
return {
184183
...coreApp,
185184
...app,
@@ -197,7 +196,6 @@ export const getAppData = (
197196
isBeta,
198197
isAlpha,
199198
deprecationInfo,
200-
replacementUrl,
201199
}
202200
}
203201

0 commit comments

Comments
 (0)