-
Notifications
You must be signed in to change notification settings - Fork 710
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fetch chart with HelmRelease * redesigned app view * open service URLs in new tab * use proper type for deployment status * remove unnecessary button-warning class * simplify AppStatus render function, extract logic into functions * add collapse-b-tablet * remove container-fluid
- Loading branch information
1 parent
6043b4f
commit 8c9a9fa
Showing
25 changed files
with
628 additions
and
213 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
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,63 @@ | ||
import * as React from "react"; | ||
import { Redirect } from "react-router"; | ||
|
||
import { IApp } from "../../shared/types"; | ||
import ConfirmDialog from "../ConfirmDialog"; | ||
|
||
interface IAppControlsProps { | ||
app: IApp; | ||
deleteApp: () => Promise<void>; | ||
} | ||
|
||
interface IAppControlsState { | ||
modalIsOpen: boolean; | ||
redirectToAppList: boolean; | ||
} | ||
|
||
class AppControls extends React.Component<IAppControlsProps, IAppControlsState> { | ||
public state: IAppControlsState = { | ||
modalIsOpen: false, | ||
redirectToAppList: false, | ||
}; | ||
|
||
public render() { | ||
return ( | ||
<div className="AppControls"> | ||
<button className="button" disabled={true}> | ||
Upgrade | ||
</button> | ||
<button className="button button-danger" onClick={this.openModel}> | ||
Delete | ||
</button> | ||
<ConfirmDialog | ||
onConfirm={this.handleDeleteClick} | ||
modalIsOpen={this.state.modalIsOpen} | ||
closeModal={this.closeModal} | ||
/> | ||
{this.state.redirectToAppList && <Redirect to="/" />} | ||
</div> | ||
); | ||
} | ||
|
||
public openModel = () => { | ||
this.setState({ | ||
modalIsOpen: true, | ||
}); | ||
}; | ||
|
||
public closeModal = async () => { | ||
this.setState({ | ||
modalIsOpen: false, | ||
}); | ||
}; | ||
|
||
public handleDeleteClick = async () => { | ||
await this.props.deleteApp(); | ||
this.setState({ | ||
modalIsOpen: false, | ||
redirectToAppList: true, | ||
}); | ||
}; | ||
} | ||
|
||
export default AppControls; |
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,54 @@ | ||
import * as React from "react"; | ||
|
||
import { IResource } from "../../shared/types"; | ||
import DeploymentTable from "./DeploymentTable"; | ||
import ServiceTable from "./ServiceTable"; | ||
|
||
interface IAppDetailsProps { | ||
deployments: Map<string, IResource>; | ||
services: Map<string, IResource>; | ||
otherResources: Map<string, IResource>; | ||
} | ||
|
||
class AppDetails extends React.Component<IAppDetailsProps> { | ||
public render() { | ||
return ( | ||
<div className="AppDetails"> | ||
<h2>Details</h2> | ||
<hr /> | ||
<div className="AppDetails__content margin-h-big"> | ||
{Object.keys(this.props.deployments).length > 0 && ( | ||
<div> | ||
<h6>Deployments</h6> | ||
<DeploymentTable deployments={this.props.deployments} /> | ||
</div> | ||
)} | ||
{Object.keys(this.props.services).length > 0 && ( | ||
<div> | ||
<h6>Services</h6> | ||
<ServiceTable services={this.props.services} extended={true} /> | ||
</div> | ||
)} | ||
<h6>Other Resources</h6> | ||
<table> | ||
<tbody> | ||
{this.props.otherResources && | ||
Object.keys(this.props.otherResources).map((k: string) => { | ||
const r = this.props.otherResources[k]; | ||
return ( | ||
<tr key={k}> | ||
<td>{r.kind}</td> | ||
<td>{r.metadata.namespace}</td> | ||
<td>{r.metadata.name}</td> | ||
</tr> | ||
); | ||
})} | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default AppDetails; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import * as React from "react"; | ||
|
||
interface IAppNotesProps { | ||
notes?: string | null; | ||
} | ||
|
||
class AppNotes extends React.PureComponent<IAppNotesProps> { | ||
public render() { | ||
const { notes } = this.props; | ||
return notes ? ( | ||
<section className="AppNotes Terminal elevation-1"> | ||
<div className="Terminal__Top type-small"> | ||
<div className="Terminal__Top__Buttons"> | ||
<span className="Terminal__Top__Button Terminal__Top__Button--red" /> | ||
<span className="Terminal__Top__Button Terminal__Top__Button--yellow" /> | ||
<span className="Terminal__Top__Button Terminal__Top__Button--green" /> | ||
</div> | ||
<div className="Terminal__Top__Title">NOTES</div> | ||
</div> | ||
<div className="Terminal__Tab"> | ||
<pre className="Terminal__Code"> | ||
<code>{notes}</code> | ||
</pre> | ||
</div> | ||
</section> | ||
) : ( | ||
"" | ||
); | ||
} | ||
} | ||
|
||
export default AppNotes; |
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,31 @@ | ||
.AppStatus { | ||
height: 2.5em; | ||
background-color: #f1f1f1; | ||
padding: 0 0.875em; | ||
line-height: 2.5em; | ||
font-size: 1em; | ||
display: inline-block; | ||
} | ||
|
||
.AppStatus--success { | ||
background-color: #1598cb; | ||
color: #fff; | ||
} | ||
|
||
.AppStatus--pending { | ||
background-color: #fdba12; | ||
} | ||
|
||
.AppStatus--pending > .icon { | ||
animation: fadeinout 2s linear infinite; | ||
} | ||
|
||
@keyframes fadeinout { | ||
0%, | ||
100% { | ||
opacity: 0; | ||
} | ||
50% { | ||
opacity: 1; | ||
} | ||
} |
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,49 @@ | ||
import * as React from "react"; | ||
|
||
import Check from "../../icons/Check"; | ||
import Compass from "../../icons/Compass"; | ||
import { IDeploymentStatus, IResource } from "../../shared/types"; | ||
import "./AppStatus.css"; | ||
|
||
interface IAppStatusProps { | ||
deployments: Map<string, IResource>; | ||
} | ||
|
||
class AppStatus extends React.Component<IAppStatusProps> { | ||
public render() { | ||
return this.isReady() ? this.renderSuccessStatus() : this.renderPendingStatus(); | ||
} | ||
|
||
private renderSuccessStatus() { | ||
return ( | ||
<span className="AppStatus AppStatus--success"> | ||
<Check className="icon padding-t-tiny" /> Deployed | ||
</span> | ||
); | ||
} | ||
|
||
private renderPendingStatus() { | ||
return ( | ||
<span className="AppStatus AppStatus--pending"> | ||
<Compass className="icon padding-t-tiny" /> Deploying | ||
</span> | ||
); | ||
} | ||
|
||
private isReady() { | ||
const { deployments } = this.props; | ||
if (Object.keys(deployments).length > 0) { | ||
return Object.keys(deployments).every(k => { | ||
const dStatus: IDeploymentStatus = deployments[k].status; | ||
return dStatus.availableReplicas === dStatus.replicas; | ||
}); | ||
} else { | ||
// if there are no deployments, then the app is considered "ready" | ||
// TODO: this currently does not distinguish between deployments not | ||
// loaded yet and no deployments | ||
return true; | ||
} | ||
} | ||
} | ||
|
||
export default AppStatus; |
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 +1,3 @@ | ||
|
||
.ChartInfo { | ||
width: 100%; | ||
} |
Oops, something went wrong.