-
Notifications
You must be signed in to change notification settings - Fork 239
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 #815 from porter-dev/lost-tailscale-changes
Service list form component for tailscale add-on
- Loading branch information
Showing
11 changed files
with
233 additions
and
35 deletions.
There are no files selected for viewing
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
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,114 @@ | ||
import React, { Component } from "react"; | ||
import styled from "styled-components"; | ||
import { Context } from "shared/Context"; | ||
import { hardcodedNames, hardcodedIcons } from "shared/hardcodedNameDict"; | ||
|
||
type PropsType = { | ||
service: { | ||
clusterIP: string; | ||
name: string; | ||
release: string; | ||
app: string; | ||
namespace: string; | ||
type?: string; | ||
}; | ||
}; | ||
|
||
type StateType = any; | ||
|
||
export default class ServiceRow extends Component<PropsType, StateType> { | ||
render() { | ||
let { clusterIP, name, namespace, type, app, release } = this.props.service; | ||
name = name || release; | ||
type = type || app; | ||
return ( | ||
<> | ||
{name && | ||
type && | ||
hardcodedNames[type] && | ||
hardcodedIcons[type] && | ||
namespace !== "kube-system" && ( | ||
<StyledServiceRow> | ||
<Flex> | ||
<Icon src={hardcodedIcons[type]} /> | ||
<Type>{hardcodedNames[type]}</Type> | ||
<Name>{name}</Name> <Dash>-</Dash> <IP>{clusterIP}</IP> | ||
</Flex> | ||
<TagWrapper> | ||
Namespace: <NamespaceTag>{namespace}</NamespaceTag> | ||
</TagWrapper> | ||
</StyledServiceRow> | ||
)} | ||
</> | ||
); | ||
} | ||
} | ||
|
||
ServiceRow.contextType = Context; | ||
|
||
const Flex = styled.div` | ||
display: flex; | ||
align-items: center; | ||
`; | ||
|
||
const TagWrapper = styled.div` | ||
float: right; | ||
height: 20px; | ||
font-size: 13px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
color: #ffffff44; | ||
border-right: 0; | ||
border-radius: 3px; | ||
padding-left: 5px; | ||
`; | ||
|
||
const NamespaceTag = styled.div` | ||
height: 20px; | ||
margin-left: 6px; | ||
color: #aaaabb; | ||
border-radius: 3px; | ||
font-size: 13px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
padding-left: 3px; | ||
border-top-left-radius: 0px; | ||
border-bottom-left-radius: 0px; | ||
`; | ||
|
||
const Dash = styled.div` | ||
margin-right: 10px; | ||
`; | ||
|
||
const Icon = styled.img` | ||
width: 20px; | ||
margin-right: 12px; | ||
`; | ||
|
||
const Type = styled.div` | ||
color: #aaaabb; | ||
margin-right: 15px; | ||
`; | ||
|
||
const Name = styled.div` | ||
margin-right: 10px; | ||
`; | ||
|
||
const IP = styled.div` | ||
user-select: text; | ||
font-weight: 500; | ||
`; | ||
|
||
const StyledServiceRow = styled.div` | ||
width: 100%; | ||
height: 40px; | ||
background: #ffffff11; | ||
margin-bottom: 15px; | ||
border-radius: 5px; | ||
padding: 15px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
`; |
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
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 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
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 @@ | ||
const hardcodedNames: { [key: string]: string } = { | ||
docker: "Docker", | ||
"https-issuer": "HTTPS Issuer", | ||
metabase: "Metabase", | ||
mongodb: "MongoDB", | ||
mysql: "MySQL", | ||
postgresql: "PostgreSQL", | ||
redis: "Redis", | ||
ubuntu: "Ubuntu", | ||
web: "Web Service", | ||
worker: "Worker", | ||
job: "Job", | ||
"cert-manager": "Cert Manager", | ||
elasticsearch: "Elasticsearch", | ||
prometheus: "Prometheus", | ||
rabbitmq: "RabbitMQ", | ||
logdna: "LogDNA", | ||
"tailscale-relay": "Tailscale", | ||
}; | ||
|
||
const hardcodedIcons: { [key: string]: string } = { | ||
"https-issuer": | ||
"https://cdn4.iconfinder.com/data/icons/macster-2/100/https__-512.png", | ||
metabase: | ||
"https://pbs.twimg.com/profile_images/961380992727465985/4unoiuHt.jpg", | ||
mongodb: | ||
"https://bitnami.com/assets/stacks/mongodb/img/mongodb-stack-220x234.png", | ||
mysql: "https://www.mysql.com/common/logos/logo-mysql-170x115.png", | ||
postgresql: | ||
"https://bitnami.com/assets/stacks/postgresql/img/postgresql-stack-110x117.png", | ||
redis: | ||
"https://cdn4.iconfinder.com/data/icons/redis-2/1451/Untitled-2-512.png", | ||
ubuntu: "Ubuntu", | ||
web: | ||
"https://user-images.githubusercontent.com/65516095/111255214-07d3da80-85ed-11eb-99e2-fddcbdb99bdb.png", | ||
worker: | ||
"https://user-images.githubusercontent.com/65516095/111255250-1b7f4100-85ed-11eb-8bd1-7b17be3e0e06.png", | ||
job: | ||
"https://user-images.githubusercontent.com/65516095/111258413-4e2c3800-85f3-11eb-8a6a-88e03460f8fe.png", | ||
"cert-manager": | ||
"https://raw.githubusercontent.com/jetstack/cert-manager/master/logo/logo.png", | ||
elasticsearch: | ||
"https://ria.gallerycdn.vsassets.io/extensions/ria/elastic/0.13.3/1530754501320/Microsoft.VisualStudio.Services.Icons.Default", | ||
prometheus: | ||
"https://raw.githubusercontent.com/prometheus/prometheus.github.io/master/assets/prometheus_logo-cb55bb5c346.png", | ||
rabbitmq: | ||
"https://bitnami.com/assets/stacks/rabbitmq/img/rabbitmq-stack-220x234.png", | ||
logdna: | ||
"https://user-images.githubusercontent.com/65516095/118185526-a2447480-b40a-11eb-9bdb-82aa0a306f26.png", | ||
"tailscale-relay": "Tailscale", | ||
}; | ||
|
||
export { hardcodedNames, hardcodedIcons }; |
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