-
Notifications
You must be signed in to change notification settings - Fork 667
feat(topology): add new service in context #3979
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
feat(topology): add new service in context #3979
Conversation
|
@nemesis09 Could you post a link to your ticket on your PR even if it's a WIP. /kind feature |
2e9d269 to
18fbeaf
Compare
18fbeaf to
f95ae37
Compare
|
putting on hold as it needs PR #3918 to be merged first. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
className or any property in topology package should not bound to odc specific style/attributes, it should be dynamic. you can pass it via props
cc: @christianvogt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've passed it as a prop to withCreateConnector()
PTAL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could simplify it as
if (choice) {
onKebabOptionClick(choice, source);
}
return graphActions(target.getController().getElements());
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. PTAL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
if (choice) {
onKebabOptionClick(choice, source);
}
return groupActions(applicationGroup, true);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. PTAL
f95ae37 to
8f2138f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should not be able to create knative resources using the drag connector, because knative revision can only be a source, it can never be a target. add isKnativeDisabled param here and remove it from other place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added isKnativeDisabled param
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't need this param. The add forms should properly handle this case by identifying there is a contextSource present and therefore remove knative service option.
8f2138f to
08a7ab7
Compare
|
removing hold as dependent PR #3918 is merged |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Topology should not depend on other packages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed KebabItem from topology
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove. accept is only for types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you really supporting moving a connector to a new resource?
Please remove. It looks like you're only supporting the creation use case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| monitor.getOperation() === CREATE_CONNECTOR_OPERATION | |
| monitor.getItemType() === CREATE_CONNECTOR_DROP_TYPE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| monitor.getOperation() === CREATE_CONNECTOR_OPERATION, | |
| monitor.getItemType() === CREATE_CONNECTOR_DROP_TYPE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate code. Move this block up in the function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't need this param. The add forms should properly handle this case by identifying there is a contextSource present and therefore remove knative service option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this here? i see it's copied code. @jeff-phillips-18 why do we need this? Shouldn't we be using the node data directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could use node data directly but that would require modifying the groupContextMenu and groupActions files. so I created this object here.
I've made the necessary modifications to the functions and groupContextMenu is directly used now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot change this to use a KebabItem because this is generic code that shouldn't depend on console.
We'll need to find a way to support the console use case without this dependency.
Doesn't this break the storybook sample?
If it doesn't break it then I suppose we can keep it with a TODO to fix later.
But otherwise we need a way to supply a list of react components that go into the context menu.
Maybe we simply add the ability to supply a react element as a choice instead:
choices: ConnectorChoice[] | React.ReactNode;
{
React.isValidElement(prompt.choices) ? prompt.choices :
prompt.choices.map((c) => (
<ContextMenuItem
key={c.label}
onClick={() => {
onCreate(prompt.element, prompt.target, prompt.event, c);
}}
>
{c.label}
</ContextMenuItem>
))}
Then in your onCreate function instead of returning the list of actions, you actually build the menu items like we already do elsewhere. You'd be able to use the kebab actions handling of the callback / href without duplicating the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nemesis09 Check should be on item, React.isValidElement(prompt.choices?.[0]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this here? We should already have explicit support for each known type already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was overlooked while cleanup.
removed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nemesis09 Please remove this code
8b86ddb to
9d0b56e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this block and add the callback to the existing contextMenu
<ContextMenuItem
key={option.label}
component={
<KebabItem
option={option}
onClick={() => (onOptionClick ? onOptionClick(option) : onKebabOptionClick(option))}
/>
}
/>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
While dropping the connector the whole page flickers, @nemesis09 please confirm if there needs to be a followup bug for this.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use optional chaining here. Also if the sourceObj is null/undefined you will get a TypeError in line 254 255. I will suggest to do this:
const sourceObj = source.getData()?.resources?.obj || {};
const hrefWithContext = `${option.href}&contextSource=${referenceFor(sourceObj)}/${
sourceObj?.metadata?.name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we allow creation of resources through this flow if sourceObj is null or undefined. since it will reduce the flow to a simple add-resource flow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In which case the sourceObj will be undefined though? Dragging sourceObj connector and on releasing we will see the menu to create the service.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only time i saw an error was when component did not yet mount. other than that, I think the source will always be there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated the code with suggested change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have seen the error probably do not allow redirect to create flow if sourceObj is undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the new changes takes care of such a scenario, PTAL
|
@nemesis09 will there be a + icon for a connector within a group, currently it's arrow |
9d0b56e to
86d357b
Compare
388e300 to
f1aed34
Compare
|
@christianvogt |
andrewballantyne
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nemesis09 You have a key issue in the console...
f1aed34 to
a772722
Compare
fixed |
|
Clicking a group white-screens. |
a772722 to
f52a9f1
Compare
Added checks to fix the issue. PTAL |
|
Not sure if this is you or @karthikjeeyar but the action menu that appears in the application group sidebar throws an error:
|
I saw the warning too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnecessary change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cleaned up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a TODO comment for cleanup or a fix now.
We shouldn't have to avoid calling kebabOptionsToMenu. Instead the actions provided should omit including the path when used in this scenario.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is incorrect, leave it. We don't callback with a ReactElement.
It was a mistake in my pseudo code posted earlier attempting to describe a new solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
f52a9f1 to
6c1b246
Compare
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: christianvogt, karthikjeeyar, nemesis09 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/test analyze |
|
/test e2e-gcp-console |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/hold Sam is doing investigations into the e2e, they're not likely to pass atm. |
|
/test e2e-gcp-console |
|
@nemesis09 They are not going to pass right now. PR #4065 is attempting to fix them. |
|
/hold cancel |



This PR-
Screen (demo implementation on top of #3918 (add-resources menu) with changes pulled from #3958 (creating the connection post save) to show complete flow) -
