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

dynamic cockpit link resolution via well known endpoint #4297

Merged
merged 20 commits into from
Sep 30, 2024

Conversation

AlexanderSkrock
Copy link
Contributor

@AlexanderSkrock AlexanderSkrock commented May 18, 2024

Aims to fix: #4261

Requirements for this functionality were discussed here: #4261 (comment)

@AlexanderSkrock
Copy link
Contributor Author

AlexanderSkrock commented May 21, 2024

Open tasks

  • write tests for the link resolution logic
  • fix tests for both tool components, i expect failure because of the asynchronous call to set the link
  • update/extend documentation

@nikku
Copy link
Member

nikku commented Jun 13, 2024

@AlexanderSkrock Any blockers that you encountered working on this solution? We're happy to assist where needed.

@AlexanderSkrock
Copy link
Contributor Author

AlexanderSkrock commented Jun 16, 2024

Hi @nikku ,

thank you for asking! I appreciate your assistance as always! Right now, there are no blockers except that I currently have no spare time due to private circumstances. Tho, I think I'll be able to follow up in a couple weeks. As this did not appear to be a priority topic, I did not give a sign myself.

Kind regards
Adagatiya

@AlexanderSkrock
Copy link
Contributor Author

Hi @nikku ,

finally, I was able to come back to this topic!

From the implementation side, I would say it is complete and working. I would like to extend the documentation now, but I am not quite sure where to put it. I was able to locate the Camunda Desktop Modeler documentation within the camunda-docs repo . I could add it below the start instance picture here, but it would not be as obvious for someone specifically looking for such a feature.

Do you have any ideas? Maybe I overlooked a section.

Kind regards
Adagatiya

@AlexanderSkrock AlexanderSkrock marked this pull request as ready for review July 12, 2024 08:06
@AlexanderSkrock AlexanderSkrock force-pushed the 4261 branch 3 times, most recently from cf5293a to eaf2653 Compare July 12, 2024 16:08
@barmac barmac self-requested a review July 16, 2024 09:33
@barmac
Copy link
Collaborator

barmac commented Aug 2, 2024

Hi @AlexanderSkrock,

Thanks for your contribution, and sorry for a delay in review. I noticed that the PR is failing on CI due to a linting problem. Can you please fix it so that we can verify the tests pass?

@AlexanderSkrock
Copy link
Contributor Author

AlexanderSkrock commented Aug 2, 2024

Hi @barmac ,

thank you for the response! I was on vacation the previous week anyways.
I am not sure how I overlooked that linting error, sorry for that!

Did you see my question / thoughts about documentation changes?

Kind regards
Adagatiya

@AlexanderSkrock AlexanderSkrock force-pushed the 4261 branch 2 times, most recently from 8c6c3ca to 344b6c3 Compare August 11, 2024 16:16
@AlexanderSkrock
Copy link
Contributor Author

I rebased my branch once again onto the current development branch, so feel free to review now, @barmac . Also, all tests passed on my fork's actions.

@barmac
Copy link
Collaborator

barmac commented Aug 12, 2024

I am going to look into this today.

Copy link
Collaborator

@barmac barmac left a comment

Choose a reason for hiding this comment

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

Hi, this PR is bigger than what I'd expect because of the refactorings included. Please have a look at the comments that I left, and hopefully we should be able to merge this soon. Thanks again for your contribution.

async getAdminUrl() {
const {
admin
} = await this.getWellKnownWebAppUrls();
Copy link
Collaborator

Choose a reason for hiding this comment

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

If I understand it correctly, we request the well known API each time we try to check each of the application's url. Is this necessary?

Copy link
Contributor Author

@AlexanderSkrock AlexanderSkrock Aug 12, 2024

Choose a reason for hiding this comment

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

Yes, this is correct. Of course, we could cache the response, but then again, we need to think about when to clear the cache. Because it should not change except for development purposes I could think of a internal map structure within the WellKnownApi file. This "cache" would be evicted on a reload via dev tools or on restarting the Camunda Desktop Modeler.

How important would caching be for you? And if it was preferred, would cache evict on restart be sufficient?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's OK if it does not slow down the flow too much. The deployment does not happen all the time anyway...

instance.isOnBeforeSubmit = true;

wrapper.update();
setTimeout(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I understand that the current test suite for the deployment tool is in bad shape, but I'd rather expect us to properly make use of act and waitFor instead of introducing more setTimeout calls. Let's not make the tests depend on the time.

Copy link
Contributor Author

@AlexanderSkrock AlexanderSkrock Aug 12, 2024

Choose a reason for hiding this comment

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

I am not sure about the Formik workaround with the isOnBeforeSubmit flag which seems to stop working as soon as I replace setTimeout.

Copy link
Contributor Author

@AlexanderSkrock AlexanderSkrock Aug 22, 2024

Choose a reason for hiding this comment

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

I managed to get this working now, but I had to introduce a new dependency @testing-library/react so we have those calls available.

const cockpitUrl = await forEngineRestUrl(engineUrl).getCockpitUrl();

if (cockpitUrl) {
console.debug(`Using cockpit url from well known endpoint: ${engineUrl}`);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd rather use debug dependency consistently instead of console.debug which is the same as console.log.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I exchanged those calls.

@barmac
Copy link
Collaborator

barmac commented Aug 12, 2024

Please don't mind the failing CI job for ubuntu/pull_request. This is happening because a community PR does not have access to the secrets.

@AlexanderSkrock
Copy link
Contributor Author

Hi, this PR is bigger than what I'd expect because of the refactorings included. Please have a look at the comments that I left, and hopefully we should be able to merge this soon. Thanks again for your contribution.

Hi @barmac ,
should I try to minimize the changes? Then I'd revert the refactorings.

@AlexanderSkrock
Copy link
Contributor Author

Hi @barmac ,

could you please have a look on the changes / my answers to the open discussion again? It's been some time and I'd personally love to know whether there are any open tasks for me.

Kind regards
Alexander Skrock

@barmac
Copy link
Collaborator

barmac commented Sep 17, 2024

Sorry, I was off when you wrote this. I will have a look this week.

@barmac barmac self-requested a review September 17, 2024 07:17
@barmac barmac added this to the M81 milestone Sep 17, 2024
@barmac barmac added the needs review Review pending label Sep 17, 2024 — with bpmn-io-tasks
@nikku nikku modified the milestones: M81, M82 Sep 20, 2024
@barmac
Copy link
Collaborator

barmac commented Sep 20, 2024

Unfortunately, this is now failing on the CI. Can you please have a look @AlexanderSkrock?

@AlexanderSkrock
Copy link
Contributor Author

AlexanderSkrock commented Sep 20, 2024

Good catch about the missing await keywords!

Unfortunately, this is now failing on the CI. Can you please have a look @AlexanderSkrock?

I am not entirely sure about the reasons, but the submit simulation was wrapped inside setTimeout before as well with a comment about it. I reverted it back to use setTimeout for the submit. I think this setTimeout call should be fine, because we do not wait static 200ms afterwards anymore, but instead make use of the waitFor utility.

Kind regards
Adagatiya

@barmac
Copy link
Collaborator

barmac commented Sep 23, 2024

Thanks, let's check if it works again on CI. I am aware that we may experience some flakiness in the deployment component, but it should not always fail until we fix it.

@barmac
Copy link
Collaborator

barmac commented Sep 23, 2024

OK it works (ignore the import secrets failure). We will merge this within a couple of days as we are now in the code freeze. Thank you for your PR!

@barmac barmac merged commit 6ff1d3e into camunda:develop Sep 30, 2024
6 of 7 checks passed
@bpmn-io-tasks bpmn-io-tasks bot removed the needs review Review pending label Sep 30, 2024
@barmac
Copy link
Collaborator

barmac commented Sep 30, 2024

I just squashed and merged this contribution. Thank you @AlexanderSkrock!

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.

Discover custom location for cockpit links
3 participants