dbeck121 / CPI-Helper-Chrome-Extension

58 stars 20 forks source link

Unlock Plugin #163

Closed DevGregor closed 6 months ago

DevGregor commented 6 months ago

Description This little Plugin adds a button to the message sidebar and unlocks the viewed artifact when clicked.

Steps When the button is clicked the following is executed:

  1. We get all the locked artifacts with the CPI API -> /api/v1/IntegrationDesigntimeLocks (filtering seems to be ignored and we always get every locked artifact)
  2. We find the resourceid of the locked artifact matching the artifactid of the api and pluginhelper
  3. We delete the lock -> DELETE /api/v1/IntegrationDesigntimeLocks(ResourceId='resourceId')

INFO Step 3 includes a toast message that is shown in both cases (locked or already unlocked)

ISSUE When I tried this with a CPI on the Neo environment the response was 403 Forbidden. Seems to be related to the makeCallPromise function in Tools.

dbeck121 commented 6 months ago

Super nice, I will check the next days :)

dbeck121 commented 6 months ago

Maybe one question: What do you mean with "We refresh the page because it has issues when switching between multiple CPI Tenants" You mean when you have multiple tenants with CPI-Helper open?

dbeck121 commented 6 months ago

btw: just in case it is interesting for you for example to indicate that artifact was not locked or it was unlocked successful.

showToast("Download complete.");

creates a small toast message.

DevGregor commented 6 months ago

Maybe one question: What do you mean with "We refresh the page because it has issues when switching between multiple CPI Tenants" You mean when you have multiple tenants with CPI-Helper open?

Yes, I had 2 tenants open (development and quality) where one was Neo and the other CF. When I tested the plugin it didn't execute the DELETE and when I refreshed the tenant I was trying to unlock an artifact in, it worked. Maybe it's related to the cache but I'll check on this again.

DevGregor commented 6 months ago

btw: just in case it is interesting for you for example to indicate that artifact was not locked or it was unlocked successful.

showToast("Download complete.");

creates a small toast message.

I will take a look at this. Thanks for the hint with the toast message! I will add this . :)

DevGregor commented 6 months ago

Maybe one question: What do you mean with "We refresh the page because it has issues when switching between multiple CPI Tenants" You mean when you have multiple tenants with CPI-Helper open?

Yes, I had 2 tenants open (development and quality) where one was Neo and the other CF. When I tested the plugin it didn't execute the DELETE and when I refreshed the tenant I was trying to unlock an artifact in, it worked. Maybe it's related to the cache but I'll check on this again.

I tested it again and it worked without a refresh, thus I removed it.

Added the toast messages but I also tried to do something with an icon or text where it shows that it is already locked or unlocked and for that I need to make the onRender function async but when I tried to do this, it wouldn't load the plugin on the message sidebar. Is that not possible or can you maybe take a look at this?

dbeck121 commented 6 months ago

Thanks for the improvements. That was really fast. Will be released with 3.13.0

DevGregor commented 6 months ago

Thanks for the improvements. That was really fast. Will be released with 3.13.0

Are you taking a look at the issue mentioned? I'm trying to figure out what's wrong but haven't gotten far. For some reason on the Neo environment I get 403 Forbidden.