Skip to content

Re-templatize a Deployed Solution#1520

Merged
previnWong merged 13 commits intodevelopfrom
prev8048-deployed-as-solution
Feb 11, 2025
Merged

Re-templatize a Deployed Solution#1520
previnWong merged 13 commits intodevelopfrom
prev8048-deployed-as-solution

Conversation

@previnWong
Copy link
Collaborator

@previnWong previnWong commented Jan 22, 2025

Hey guys,

This is more a review right now than a merge. Can you see if I forgot any gotchas in this work. Idea is that you can re-templatize a solution you deployed. And below is my assumptions

  1. I check if the item is Solution Item and if it has been Deployed
  2. I read the item ids from the Solution Item
  3. I check if those items still exists and only keep those.
  4. I check for new things in the folder that were not in the Solution item and add them to the item id list.
  5. then call create Solution on the item id list.

Also, in the Create JS Demo, I removed (hide) the destination credentials. It causes issues when destination is not the same as source for some items. Since Creation App only has one login, kept it the same way.

https://devtopia.esri.com/WebGIS/solution-deployment-apps/issues/268

delete items no longer valid
add new items in the folder
updated create demo app to only use 1 login.
Copy link

@MikeTschudi MikeTschudi left a comment

Choose a reason for hiding this comment

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

  • Perhaps it would be better to create a new demo, e.g., "recreateSolution" rather than modify "createSolution"?
  • Is the speed for checking for existing items acceptable? For speed, you could push the promise for each item or group fetch into an array, and then use Promise.allSettled() to wait for all of the results.

@jmhauck
Copy link
Collaborator

jmhauck commented Jan 23, 2025

The general approach sounds good to me.

@previnWong
Copy link
Collaborator Author

Ok, let me make a different demo for re-deployed solutions.

I'll try adding a promises.all to the logic.

@MikeTschudi
Copy link

Promise.allSettled is what you'd want here, not Promise.all: the latter "rejects when any of the input's promises rejects", whereas the former waits until all promises have been resolved, whether successfully or with a failure. One then can go through the list of results filtering out the failures by keeping only ones with a status of "fulfilled".

For example,

const itemFetchPromises = solutionData.templates.map((template: any) => {
  return common.getItemBase(template.itemId as string, userSession);
});
const itemFetches = await Promise.allSettled(itemFetchPromises);
const items = itemFetches
  .filter((item: any) => item.status === "fulfilled")
  .map((item: any) => item.value);

change to use promise and then added more parameters to searchItems
made a new demo for recreate workflow.

also reverted create demo.
check for new groups added to the tag
replace tags and keywords
added extra properties to CreateOptions
adding additional information
code refined and tests added.
@codecov
Copy link

codecov bot commented Feb 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (d3142be) to head (e42423b).
Report is 14 commits behind head on develop.

Additional details and impacted files
@@            Coverage Diff            @@
##           develop     #1520   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          153       153           
  Lines         8301      8347   +46     
  Branches      1903      1920   +17     
=========================================
+ Hits          8301      8347   +46     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

clean comment
@previnWong
Copy link
Collaborator Author

@MikeTschudi @jmhauck can you guys review this for merging this time. Added a new demo so there's alot of files around that making it seem a bigger PR than it is.

}
}

export async function _updateCreateOptionForReDeployedTemplate(

Choose a reason for hiding this comment

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

Would you please add function documentation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

right! thanks for the reminder.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added function doc.

jmhauck
jmhauck previously approved these changes Feb 11, 2025
@MikeTschudi MikeTschudi self-requested a review February 11, 2025 20:17
added function documentation
@previnWong previnWong merged commit d20c9e0 into develop Feb 11, 2025
9 checks passed
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