-
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.
* service instances view * updating class list view * moving provision button * renaming instance list view container
- Loading branch information
Showing
8 changed files
with
136 additions
and
169 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
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,85 @@ | ||
import * as React from "react"; | ||
|
||
import { Link } from "react-router-dom"; | ||
import { IClusterServiceClass } from "../../shared/ClusterServiceClass"; | ||
import { IServiceBroker, IServicePlan } from "../../shared/ServiceCatalog"; | ||
import { IServiceInstance } from "../../shared/ServiceInstance"; | ||
import { Card, CardContainer } from "../Card"; | ||
|
||
export interface InstanceListViewProps { | ||
brokers: IServiceBroker[]; | ||
classes: IClusterServiceClass[]; | ||
getCatalog: () => Promise<any>; | ||
instances: IServiceInstance[]; | ||
plans: IServicePlan[]; | ||
} | ||
|
||
export class InstanceListView extends React.PureComponent<InstanceListViewProps> { | ||
public async componentDidMount() { | ||
this.props.getCatalog(); | ||
} | ||
|
||
public render() { | ||
const { brokers, instances, classes } = this.props; | ||
|
||
return ( | ||
<div className="InstanceList"> | ||
{brokers && ( | ||
<div> | ||
<div className="row"> | ||
<div className="col-8"> | ||
<h3>Service Instances</h3> | ||
<p>Service instances from your brokers:</p> | ||
</div> | ||
<div className="col-2 margin-normal"> | ||
<Link to={`/services/classes`}> | ||
<button className="button button-primary">Provision New Service</button> | ||
</Link> | ||
</div> | ||
</div> | ||
<table> | ||
<tbody> | ||
<CardContainer> | ||
{instances.length > 0 && | ||
instances.map(instance => { | ||
const conditions = [...instance.status.conditions]; | ||
const status = conditions.shift(); // first in list is most recent | ||
const message = status ? status.message : ""; | ||
const svcClass = classes.find( | ||
potential => | ||
potential.metadata.name === instance.spec.clusterServiceClassRef.name, | ||
); | ||
const broker = svcClass && svcClass.spec.clusterServiceBrokerName; | ||
const icon = | ||
svcClass && | ||
svcClass.spec.externalMetadata && | ||
svcClass.spec.externalMetadata.imageUrl; | ||
|
||
const card = ( | ||
<Card | ||
key={instance.metadata.uid} | ||
header={ | ||
<span> | ||
{instance.metadata.namespace}/{instance.metadata.name} | ||
</span> | ||
} | ||
icon={icon} | ||
body={message} | ||
buttonText="Details" | ||
linkTo={`/services/brokers/${broker}/instances/${ | ||
instance.metadata.namespace | ||
}/${instance.metadata.name}/`} | ||
notes={<span>{instance.spec.clusterServicePlanExternalName}</span>} | ||
/> | ||
); | ||
return card; | ||
})} | ||
</CardContainer> | ||
</tbody> | ||
</table> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
} | ||
} |
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,37 @@ | ||
import { connect } from "react-redux"; | ||
import { Dispatch } from "redux"; | ||
|
||
import actions from "../actions"; | ||
import { InstanceListView } from "../components/InstanceListView"; | ||
import { IStoreState } from "../shared/types"; | ||
|
||
interface IRouteProps { | ||
match: { | ||
params: { | ||
brokerName: string; | ||
}; | ||
}; | ||
} | ||
|
||
function mapStateToProps({ catalog }: IStoreState, { match: { params } }: IRouteProps) { | ||
const brokers = catalog.brokers; | ||
const plans = catalog.plans; | ||
const classes = catalog.classes; | ||
const instances = catalog.instances; | ||
return { | ||
brokers, | ||
classes, | ||
instances, | ||
plans, | ||
}; | ||
} | ||
|
||
function mapDispatchToProps(dispatch: Dispatch<IStoreState>) { | ||
return { | ||
getCatalog: async () => { | ||
dispatch(actions.catalog.getCatalog()); | ||
}, | ||
}; | ||
} | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(InstanceListView); |
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