Skip to content

Commit

Permalink
Web: DBT Logo for processing engine (#2899)
Browse files Browse the repository at this point in the history
* Greyscale logos for spark and airflow.

* Adding dbt logo and simplifying code.
  • Loading branch information
phixMe authored Sep 18, 2024
1 parent 6d68cf8 commit 9450410
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
22 changes: 15 additions & 7 deletions web/src/components/search/open-search/OpenSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import MqText from '../../core/text/MqText'
import React, { useCallback, useEffect } from 'react'
import airflow_logo from './airlfow-logo.svg'
import spark_logo from './spark-logo.svg'
import dbt_logo from './dbt-logo.svg'

interface StateProps {
openSearchJobs: IOpenSearchJobsState
Expand All @@ -46,6 +47,12 @@ type TextSegment = {
isHighlighted: boolean
}

const LOGO_MAP = {
spark: spark_logo,
airflow: airflow_logo,
dbt: dbt_logo,
};

function parseStringToSegments(input: string): TextSegment[] {
return input.split(/(<em>.*?<\/em>)/).map((segment) => {
if (segment.startsWith('<em>') && segment.endsWith('</em>')) {
Expand Down Expand Up @@ -209,13 +216,14 @@ const OpenSearch: React.FC<StateProps & DispatchProps & Props> = ({
<MqText subdued label>
{'Integration'}
</MqText>
{hit.runFacets.processing_engine.name === 'spark' ? (
<img src={spark_logo} height={24} alt='Spark' />
) : hit.runFacets.processing_engine.name === 'Airflow' ? (
<img src={airflow_logo} height={24} alt='Airflow' />
) : (
<Chip size={'small'} label={hit.runFacets?.processing_engine.name} />
)}
{(() => {
const engineName = hit.runFacets.processing_engine.name.toLowerCase();
return LOGO_MAP[engineName as keyof typeof LOGO_MAP] ? (
<img src={LOGO_MAP[engineName as keyof typeof LOGO_MAP]} height={24} alt={engineName.charAt(0).toUpperCase() + engineName.slice(1)} />
) : (
<Chip size={'small'} label={hit.runFacets?.processing_engine.name} />
);
})()}
</Box>
</>
)}
Expand Down
6 changes: 6 additions & 0 deletions web/src/components/search/open-search/dbt-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9450410

Please sign in to comment.