Skip to content

Commit ff574af

Browse files
authored
fix: update Alibaba Cloud logo and allow optional CSS for all logos (#3059)
1 parent ad50d98 commit ff574af

File tree

6 files changed

+126
-30
lines changed

6 files changed

+126
-30
lines changed

src/dataLoaders/components/collectorsWizard/select/TelegrafUIRefreshSelector.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ class TelegrafUIRefreshSelector extends PureComponent<Props, State> {
170170
id={item.id}
171171
name={item.name}
172172
image={item.image}
173+
style={item.style}
173174
url={`${item.id}`}
174175
selected={this.isCardChecked(item.id)}
175176
onClick={this.handleToggle}

src/perf/components/LazySVG.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
import React, {FC} from 'react'
1+
import React, {CSSProperties, FC} from 'react'
22

33
interface Props {
4+
alt: string
45
image: string
6+
style: CSSProperties
57
}
68

7-
const LazySVG: FC<Props> = ({image}) => {
8-
return <img src={image} />
9+
const LazySVG: FC<Props> = ({alt, image, style}) => {
10+
return <img src={image} style={style} alt={alt} />
911
}
1012

1113
export default LazySVG

src/writeData/components/TelegrafPluginSection.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ const TelegrafPluginSection = () => {
5252
id={item.id}
5353
name={item.name}
5454
image={item.image}
55+
style={item.style}
5556
url={`${TELEGRAF_PLUGINS}/${item.id}`}
5657
/>
5758
))}
Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Libraries
2-
import React, {FC, Suspense} from 'react'
2+
import React, {CSSProperties, FC, Suspense} from 'react'
33
import {useSelector} from 'react-redux'
44
import {useHistory} from 'react-router-dom'
55

@@ -24,6 +24,7 @@ interface Props {
2424
name: string
2525
url: string
2626
image?: string
27+
style?: CSSProperties
2728
selected?: boolean
2829
onClick?: any
2930
testID?: string
@@ -34,6 +35,7 @@ const WriteDataItem: FC<Props> = ({
3435
name,
3536
url,
3637
image,
38+
style,
3739
selected,
3840
onClick,
3941
testID,
@@ -46,46 +48,26 @@ const WriteDataItem: FC<Props> = ({
4648
}
4749

4850
let thumb = <img src={placeholderLogo} />
51+
const svgStyle = style ? style : ({} as CSSProperties)
4952

5053
if (image) {
5154
thumb = (
5255
<Suspense fallback="Loading...">
53-
<LazySVG image={image} />
56+
<LazySVG image={image} style={svgStyle} alt={name} />
5457
</Suspense>
5558
)
5659
}
5760

5861
if (onClick) {
59-
{
60-
return (
61-
<SquareGrid.Card key={id}>
62-
<SelectableCard
63-
id={id}
64-
formName="load-data-cards"
65-
label={name}
66-
selected={selected}
67-
onClick={onClick}
68-
testID={testID}
69-
fontSize={ComponentSize.ExtraSmall}
70-
className="write-data--item"
71-
>
72-
<div className="write-data--item-thumb">{thumb}</div>
73-
</SelectableCard>
74-
</SquareGrid.Card>
75-
)
76-
}
77-
}
78-
79-
{
8062
return (
8163
<SquareGrid.Card key={id}>
8264
<SelectableCard
8365
id={id}
8466
formName="load-data-cards"
8567
label={name}
86-
testID={`load-data-item ${id}`}
87-
selected={false}
88-
onClick={handleClick}
68+
selected={selected}
69+
onClick={onClick}
70+
testID={testID}
8971
fontSize={ComponentSize.ExtraSmall}
9072
className="write-data--item"
9173
>
@@ -94,6 +76,23 @@ const WriteDataItem: FC<Props> = ({
9476
</SquareGrid.Card>
9577
)
9678
}
79+
80+
return (
81+
<SquareGrid.Card key={id}>
82+
<SelectableCard
83+
id={id}
84+
formName="load-data-cards"
85+
label={name}
86+
testID={`load-data-item ${id}`}
87+
selected={false}
88+
onClick={handleClick}
89+
fontSize={ComponentSize.ExtraSmall}
90+
className="write-data--item"
91+
>
92+
<div className="write-data--item-thumb">{thumb}</div>
93+
</SelectableCard>
94+
</SquareGrid.Card>
95+
)
9796
}
9897

9998
export default WriteDataItem

src/writeData/constants/contentTelegrafPlugins.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,11 +404,13 @@ import zfsLogo from 'src/writeData/graphics/zfs.svg'
404404
import zipkinLogo from 'src/writeData/graphics/zipkin.svg'
405405
import zookeeperLogo from 'src/writeData/graphics/zookeeper.svg'
406406

407+
import {CSSProperties} from 'react'
407408
export interface TelegrafPluginAssets {
408409
id: string
409410
name: string
410411
image?: string
411412
markdown?: string
413+
style?: CSSProperties
412414
}
413415

414416
export const WRITE_DATA_TELEGRAF_PLUGINS: TelegrafPluginAssets[] = [
@@ -429,6 +431,7 @@ export const WRITE_DATA_TELEGRAF_PLUGINS: TelegrafPluginAssets[] = [
429431
name: 'Alibaba (Aliyun) CloudMonitor Service Statistics',
430432
markdown: aliyuncmsMarkdown,
431433
image: aliyuncmsLogo,
434+
style: {maxWidth: '150%'},
432435
},
433436
{
434437
id: 'amd_rocm_smi',
Lines changed: 91 additions & 1 deletion
Loading

0 commit comments

Comments
 (0)