Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add service images widget #2487

Merged
merged 1 commit into from
May 3, 2017
Merged

Add service images widget #2487

merged 1 commit into from
May 3, 2017

Conversation

jpellizzari
Copy link
Contributor

@jpellizzari jpellizzari commented May 1, 2017

Implements #2478, depends on https://github.com/weaveworks/service-ui/pull/495

Displays information about the status of images for a given kubernetes service. This is an initial proof-of-concept to use a reference for doing more complex integrations between services.
screen shot 2017-05-01 at 10 22 32 am
screen shot 2017-05-01 at 10 24 08 am

The link is clickable and will navigate to Flux using the service-ui router that is passed to it via context.

Introduces a <CloudFeature /> component that changes the context from Scope to service-ui, allowing for components to access any part of the state tree.

@jpellizzari
Copy link
Contributor Author

@fbarl Please review and let me know if you have any questions on how it works. The best way to test is to use PROXY_SCOPE_COMPONENT=true in the service-ui repo with this branch checked out.

@jpellizzari jpellizzari requested a review from fbarl May 1, 2017 17:31
@jpellizzari jpellizzari self-assigned this May 1, 2017
@jpellizzari jpellizzari force-pushed the 2478-flux-integration branch from 0cf02aa to 7dd308f Compare May 1, 2017 17:32
@rade
Copy link
Member

rade commented May 1, 2017

The link is clickable

Where exactly in the flux ui does it go? AFAIK the flux ui only has link destinations for an entire service, not for service + image.

@jpellizzari
Copy link
Contributor Author

jpellizzari commented May 1, 2017

@rade It takes you to the /flux/:orgId/services/:serviceName. The hover effect triggers when the entire list body is moused-over, to indicate that you are clicking on a single entity. The list of container images is not individually clickable.

@rade
Copy link
Member

rade commented May 1, 2017

The list of container images is not individually clickable.

Ah! But you have underlined "authfe" and "logging" items in your example. Do these go to the container detail panels? Or are they not clickable? (which, IMO, would be visually misleading, since every other underlined item is a link). Also, the blue "New image(s) available" text looks clickable since blue is a very commonly used for links. Like here in github :)

@jpellizzari
Copy link
Contributor Author

jpellizzari commented May 1, 2017

But you have underlined "authfe" and "logging" items in your example. Do these go to the container detail panels?

I wrestled with the right way to represent this for a while. We indicate navigation with underlines, but clicking on either container image will take you to the same place in Flux. The compromise I came up with is to indicate that either is clickable, then on mouse-over indicate that they are indistinguishable.

The screenshot in the first comment is the :hover state of the component. The non-hover state is a white background.

I agree its an inconsistency. We could also go for what I call "the big dumb button" approach to indicate navigation:
screen shot 2017-05-01 at 12 08 04 pm

Also, the blue "New image(s) available" text looks clickable since blue is a very commonly used for links. Like here in github :)

Those are clickable as part of the body of the list. The blue text is just to differentiate the text from the normal state.

@rade
Copy link
Member

rade commented May 1, 2017

We could also go for what I call "the big dumb button"

That might be better - it avoids any confusion as to what is/isn't clickable, and what clicking will actually do. We could perhaps make it smaller, and place it on the same level as the heading (but right-aligned), so as to save precious vertical space and be less disruptive to the overall look and function of the details panel.

@jpellizzari jpellizzari force-pushed the 2478-flux-integration branch from 7dd308f to 375fef8 Compare May 1, 2017 23:31
@jpellizzari
Copy link
Contributor Author

jpellizzari commented May 1, 2017

Updated after feedback:
screen shot 2017-05-01 at 4 31 24 pm

Opted for a link instead of a button, since we don't currently use a Button anywhere else.

I also changed the 'New Images available' text to green instead of blue.

@rade
Copy link
Member

rade commented May 2, 2017

On which detail panels is this info displayed? I've looked at the code and can't work it out :(

Flux operates on k8s deployments, of which services can be seen as a specialisation. So the info should be shown in both.

@rade
Copy link
Member

rade commented May 2, 2017

So the info should be shown in both.

We could even additionally show the info on pods and even containers, when these are part of a deployment.

Copy link
Contributor

@fbarl fbarl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice PR and it really paves the path for further integrations I now think will be smoother than I initially thought. :)

I left a few suggestions in the code and would add just one UI comment to them - the spinner seems to overflow the Node Details panel sometimes. You should be able to reproduce it if you keep the viewport height not to big and click around the nodes.
spinner-overflow

I think that the current View in Deploy link looks much better than the initial solution with underlined entries.

@@ -84,6 +84,7 @@ export const initialState = makeMap({
viewport: makeMap(),
websocketClosed: false,
zoomCache: makeMap(),
serviceImages: makeMap({ fetching: false })

This comment was marked as abuse.

This comment was marked as abuse.

return state.setIn(['serviceImages', 'errors'], action.errors);
}

const service = find(action.services, s => s.ID === action.serviceId);

This comment was marked as abuse.

This comment was marked as abuse.

@@ -678,4 +678,33 @@ describe('RootReducer', () => {
constructEdgeId('def456', 'abc123')
]);
});
it('receives images for a service', () => {

This comment was marked as abuse.


componentDidMount() {
if (this.props.serviceName) {
this.props.getImagesForService(this.props.params.orgId, this.props.serviceName);

This comment was marked as abuse.

}

handleServiceClick() {
this.props.router.push(`/flux/${this.props.params.orgId}/services/${encodeURIComponent(this.props.serviceName)}`);

This comment was marked as abuse.


function getNewImages(images, currentId) {
// Assume that the current image is always in the list of all available images.
// Should be a safe assumption...

This comment was marked as abuse.

{fetching && <CircularProgress />}
{!fetching && errors && <p>Error: {JSON.stringify(map(errors, 'message'))}</p>}
{!errors && !fetching && !service && 'No service images found'}
{!errors && !fetching && service &&

This comment was marked as abuse.


import { getImagesForService } from '../../actions/app-actions';

const topologyWhitelist = ['services'];

This comment was marked as abuse.

This comment was marked as abuse.

@fbarl
Copy link
Contributor

fbarl commented May 2, 2017

On which detail panels is this info displayed? I've looked at the code and can't work it out :(

@rade, it should be displayed on the bottom of node details of each node in Services topology. The important thing is to test it in combination with https://github.com/weaveworks/service-ui/pull/495 which hasn't been merged yet. I did it by running SCOPE_PATH=~/Projects/src/github.com/weaveworks/scope SERVICE_HOST=frontend.dev.weave.works PROXY_SCOPE_COMPONENT=true yarn start from that service-ui branch locally (you'd probably want to change SCOPE_PATH though).

@rade
Copy link
Member

rade commented May 2, 2017

it should be displayed on the bottom of node details of each node in Services topology

That's what I guessed. My point was that it should at least also be shown in the Deployment topology.

@jpellizzari
Copy link
Contributor Author

@fbarl I updated this branch with your feedback, PTAL. I also added the image status widget to the 'deployments' view.

Copy link
Contributor

@fbarl fbarl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left one more tiny comment, otherwise LGTM.

return (
<div key={container.Name} className="wrapper">
<div className="node-details-table-node-label">{container.Name}</div>
<div className="node-details-table-node-label">{statusText}</div>

This comment was marked as abuse.

@jpellizzari jpellizzari force-pushed the 2478-flux-integration branch from 94a58b2 to cccfd50 Compare May 3, 2017 17:17
@jpellizzari jpellizzari force-pushed the 2478-flux-integration branch from cccfd50 to 3ec7cc8 Compare May 3, 2017 17:31
@jpellizzari jpellizzari merged commit 54f7904 into master May 3, 2017
@jpellizzari jpellizzari deleted the 2478-flux-integration branch May 3, 2017 17:57
@fbarl fbarl mentioned this pull request May 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants