-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #973 from equinor/master
Show ext alias links (#972)
- Loading branch information
Showing
11 changed files
with
320 additions
and
160 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { Accordion, List, Typography } from '@equinor/eds-core-react'; | ||
import { FunctionComponent } from 'react'; | ||
import { DnsAlias, DnsExternalAlias } from '../../store/radix-api'; | ||
import { DNSAlias } from './dns_alias'; | ||
|
||
export interface DefaultAppAliasProps { | ||
appName: string; | ||
dnsAliases?: DnsAlias[] | DnsExternalAlias[]; | ||
title: string; | ||
} | ||
|
||
export const DNSAliases: FunctionComponent<DefaultAppAliasProps> = ({ | ||
appName, | ||
dnsAliases, | ||
title, | ||
}) => ( | ||
<> | ||
{dnsAliases?.length > 0 && | ||
(dnsAliases.length == 1 ? ( | ||
<div className="grid grid--gap-x-small"> | ||
<Typography variant="h4">{title}</Typography> | ||
<Typography as="span"> | ||
<DNSAlias | ||
appName={appName} | ||
url={dnsAliases[0].url} | ||
componentName={dnsAliases[0].componentName} | ||
environmentName={dnsAliases[0].environmentName} | ||
/> | ||
</Typography> | ||
</div> | ||
) : ( | ||
<> | ||
<Typography className="whitespace-nowrap" variant="h4" as="span"> | ||
{title} | ||
</Typography> | ||
<Accordion className="accordion elevated" chevronPosition="right"> | ||
<Accordion.Item isExpanded={false}> | ||
<Accordion.Header> | ||
<Accordion.HeaderTitle> | ||
<Typography className="whitespace-nowrap" as="span"> | ||
<DNSAlias | ||
appName={appName} | ||
url={dnsAliases[0].url} | ||
componentName={dnsAliases[0].componentName} | ||
environmentName={dnsAliases[0].environmentName} | ||
/> | ||
</Typography> | ||
</Accordion.HeaderTitle> | ||
</Accordion.Header> | ||
<Accordion.Panel> | ||
<List> | ||
{dnsAliases.slice(1)?.map((dnsAlias, index) => ( | ||
<div key={index} className="o-item-list"> | ||
<Typography as="span"> | ||
<DNSAlias | ||
appName={appName} | ||
url={dnsAlias.url} | ||
componentName={dnsAlias.componentName} | ||
environmentName={dnsAlias.environmentName} | ||
/> | ||
</Typography> | ||
</div> | ||
))} | ||
</List> | ||
</Accordion.Panel> | ||
</Accordion.Item> | ||
</Accordion> | ||
</> | ||
))} | ||
</> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Icon, Typography } from '@equinor/eds-core-react'; | ||
import { link } from '@equinor/eds-icons'; | ||
import { FunctionComponent } from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
import { getActiveComponentUrl, getEnvUrl } from '../../utils/routing'; | ||
export interface EnvironmentComponentProps { | ||
appName: string; | ||
url: string; | ||
componentName: string; | ||
environmentName: string; | ||
} | ||
|
||
export const DNSAlias: FunctionComponent<EnvironmentComponentProps> = ({ | ||
appName, | ||
url, | ||
componentName, | ||
environmentName, | ||
}) => ( | ||
<> | ||
<Icon data={link} /> | ||
<Typography link href={`https://${url}`}> | ||
{url} | ||
</Typography>{' '} | ||
is mapped to component{' '} | ||
<Typography | ||
as={Link} | ||
to={getActiveComponentUrl(appName, environmentName, componentName)} | ||
link | ||
> | ||
{componentName} | ||
</Typography>{' '} | ||
in environment{' '} | ||
<Typography as={Link} to={getEnvUrl(appName, environmentName)} link> | ||
{environmentName} | ||
</Typography> | ||
</> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,17 @@ | ||
import * as PropTypes from 'prop-types'; | ||
import { Icon, Typography } from '@equinor/eds-core-react'; | ||
import { external_link } from '@equinor/eds-icons'; | ||
import { FunctionComponent } from 'react'; | ||
import { Icon, List, Typography } from '@equinor/eds-core-react'; | ||
import { link } from '@equinor/eds-icons'; | ||
import { DnsAlias as DnsAliasModel } from '../../store/radix-api'; | ||
|
||
export interface DNSAliasProps { | ||
dnsAliases?: DnsAliasModel[]; | ||
export interface EnvironmentComponentProps { | ||
url: string; | ||
} | ||
|
||
export const DnsAlias: FunctionComponent<DNSAliasProps> = ({ dnsAliases }) => ( | ||
export const DNSAlias: FunctionComponent<EnvironmentComponentProps> = ({ | ||
url, | ||
}) => ( | ||
<> | ||
{dnsAliases && ( | ||
<div className="grid grid--gap-x-small"> | ||
<Typography>DNS alias{dnsAliases.length > 1 ? 'es' : ''}</Typography> | ||
<List> | ||
{dnsAliases.map((dnsAlias, index) => ( | ||
<div key={index} className="o-item-list"> | ||
<Typography> | ||
<Icon data={link} /> | ||
<Typography link href={`https://${dnsAlias.url}`}> | ||
{dnsAlias.url} | ||
</Typography> | ||
</Typography> | ||
</div> | ||
))} | ||
</List> | ||
</div> | ||
)} | ||
<Typography link href={`https://${url}`}> | ||
{url} <Icon data={external_link} size={16} /> | ||
</Typography> | ||
</> | ||
); | ||
|
||
DnsAlias.propTypes = { | ||
dnsAliases: PropTypes.arrayOf( | ||
PropTypes.object as PropTypes.Validator<DnsAliasModel> | ||
).isRequired, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { Accordion, List, Typography } from '@equinor/eds-core-react'; | ||
import { FunctionComponent } from 'react'; | ||
import { DNSAlias } from './dns-alias'; | ||
|
||
export interface DefaultAppAliasProps { | ||
urls?: string[]; | ||
title: string; | ||
} | ||
|
||
export const DNSAliases: FunctionComponent<DefaultAppAliasProps> = ({ | ||
urls, | ||
title, | ||
}) => ( | ||
<> | ||
{urls.length > 0 && | ||
(urls.length == 1 ? ( | ||
<div className="grid grid--gap-x-small"> | ||
<Typography variant="h4">{title}</Typography> | ||
<Typography as="span"> | ||
<DNSAlias url={urls[0]} /> | ||
</Typography> | ||
</div> | ||
) : ( | ||
<> | ||
<Typography className="whitespace-nowrap" variant="h4" as="span"> | ||
{title} | ||
</Typography> | ||
<Accordion className="accordion elevated" chevronPosition="right"> | ||
<Accordion.Item isExpanded={false}> | ||
<Accordion.Header> | ||
<Accordion.HeaderTitle> | ||
<Typography className="whitespace-nowrap" as="span"> | ||
<DNSAlias url={urls[0]} /> | ||
</Typography> | ||
</Accordion.HeaderTitle> | ||
</Accordion.Header> | ||
<Accordion.Panel> | ||
<List> | ||
{urls.slice(1)?.map((url, index) => ( | ||
<div key={index} className="o-item-list"> | ||
<Typography as="span"> | ||
<DNSAlias url={url} /> | ||
</Typography> | ||
</div> | ||
))} | ||
</List> | ||
</Accordion.Panel> | ||
</Accordion.Item> | ||
</Accordion> | ||
</> | ||
))} | ||
</> | ||
); |
Oops, something went wrong.