-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dashboard): implement new overview page
- Loading branch information
Showing
33 changed files
with
636 additions
and
312 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 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 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,80 @@ | ||
/* | ||
* Copyright (C) 2018 Garden Technologies, Inc. <[email protected]> | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
import React from "react" | ||
import styled from "@emotion/styled" | ||
import { ExternalLink } from "./links" | ||
import { ServiceIngress } from "garden-cli/src/types/service" | ||
import { truncateMiddle } from "../util/helpers" | ||
import normalizeUrl from "normalize-url" | ||
import { format } from "url" | ||
|
||
const Ingresses = styled.div` | ||
font-size: 1rem; | ||
line-height: 1.4rem; | ||
color: #4f4f4f; | ||
height: 5rem; | ||
overflow: hidden; | ||
overflow-y: auto; | ||
::-webkit-scrollbar { | ||
-webkit-appearance: none; | ||
width: 7px; | ||
} | ||
::-webkit-scrollbar-thumb { | ||
border-radius: 4px; | ||
background-color: rgba(0, 0, 0, 0.5); | ||
box-shadow: 0 0 1px rgba(255, 255, 255, 0.5); | ||
} | ||
` | ||
const LinkContainer = styled.div` | ||
padding-bottom: 1rem; | ||
font-size: .75rem; | ||
&:last-of-type { | ||
padding-bottom: 0; | ||
} | ||
` | ||
|
||
const NoIngresses = styled.div` | ||
font-style: italic; | ||
font-size: .75rem; | ||
` | ||
|
||
const getIngressUrl = (ingress: ServiceIngress) => { | ||
return normalizeUrl(format({ | ||
protocol: ingress.protocol, | ||
hostname: ingress.hostname, | ||
port: ingress.port, | ||
pathname: ingress.path, | ||
})) | ||
} | ||
|
||
interface IngressesProp { | ||
ingresses: ServiceIngress[] | undefined | ||
} | ||
|
||
export default ({ ingresses }: IngressesProp) => { | ||
return ( | ||
<Ingresses> | ||
{ingresses && ingresses.map(i => { | ||
const url = getIngressUrl(i) | ||
return <LinkContainer key={i.path}> | ||
<ExternalLink href={url} target="_blank"> | ||
{truncateMiddle(url)} | ||
</ExternalLink> | ||
<br /> | ||
</LinkContainer> | ||
})} | ||
{(!ingresses || !ingresses.length) && | ||
<NoIngresses> | ||
No ingresses found | ||
</NoIngresses>} | ||
</Ingresses> | ||
) | ||
} |
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,61 @@ | ||
/* | ||
* Copyright (C) 2018 Garden Technologies, Inc. <[email protected]> | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
import React from "react" | ||
import styled from "@emotion/styled" | ||
import { ServiceModel, ModuleModel } from "../containers/overview" | ||
import Service from "./service" | ||
|
||
const Module = styled.div` | ||
padding: 0rem 2rem 1rem 0rem; | ||
` | ||
|
||
const Services = styled.div` | ||
border-top: solid #bcbcbc 1px; | ||
padding-top: 1rem; | ||
display: flex; | ||
flex-wrap: wrap; | ||
align-items: middle; | ||
` | ||
const Header = styled.div` | ||
display: flex; | ||
align-items: center; | ||
` | ||
|
||
const Label = styled.div` | ||
font-size: .75rem; | ||
display: flex; | ||
align-items: center; | ||
color: #bcbcbc; | ||
` | ||
const Name = styled.div` | ||
padding-right: .5rem; | ||
` | ||
|
||
interface ModuleProp { | ||
module: ModuleModel | ||
} | ||
export default ({ | ||
module: { services = [], name }, | ||
}: ModuleProp) => { | ||
|
||
return ( | ||
<Module key={name}> | ||
<Header> | ||
<Name>{name}</Name> | ||
<Label>MODULE</Label> | ||
|
||
</Header> | ||
<Services> | ||
{services.map(service => ( | ||
<Service key={service.name} service={service as ServiceModel} /> | ||
))} | ||
</Services> | ||
</Module> | ||
) | ||
} |
Oops, something went wrong.