Skip to content

Add revision draft support (single revision mode)#405

Merged
MicroFish91 merged 22 commits intomainfrom
mwf/revision-draft-alt-2
Jul 18, 2023
Merged

Add revision draft support (single revision mode)#405
MicroFish91 merged 22 commits intomainfrom
mwf/revision-draft-alt-2

Conversation

@MicroFish91
Copy link
Copy Markdown
Contributor

@MicroFish91 MicroFish91 commented Jul 7, 2023

Background:

Based on team feedback surrounding the initial revision draft PR (v1), here is the new and improved v2! Major changes include:

  • Removal of the "Latest" node in single revisions mode. We now try to hide the concept of revisions a little more in single revisions mode. The children of the "Latest" node have now come up one level (right now that's really mainly the scaleItem ("Scaling")
  • Instead of creating a draft node in single revisions mode, we now show "unsaved changes" indicators
  • The edit container app json no longer opens up by default and is less easily found, now labeled as an advanced editing feature
  • No longer persist revision drafts in Memento storage (in-memory only)

Purpose:

What is covered in this PR:

  • Revision draft support for single revision mode

What is coming down the line:

  • Deploy revision draft command
  • Revision draft support for multiple revisions mode

Demo of the full feature:

  • Demo (Not a super polished demo, but good enough to give some context)

I had to include a little bit of the multiple revisions mode code (for example, RevisionDraftItem) because of some loose coupling, but overall I tried to split it up so it's a little bit less code to review overall.

If you see missing command spots in the package.json, you can see here for what the full thing will eventually look like: a58ee13

@MicroFish91 MicroFish91 changed the title Introduce revision draft FS and revision draft CRUD operations (v2) Add revision draft support (Single Revision Mode) Jul 7, 2023
@MicroFish91 MicroFish91 changed the title Add revision draft support (Single Revision Mode) Add revision draft support (single revision mode) Jul 7, 2023
@MicroFish91 MicroFish91 marked this pull request as ready for review July 7, 2023 19:58
@MicroFish91 MicroFish91 requested a review from a team as a code owner July 7, 2023 19:58
if (this.containerApp.revisionsMode === KnownActiveRevisionsMode.Single) {
return !!this.containerApp.template?.scale && !isDeepEqual(this.containerApp.template.scale, scaleDraftTemplate);
} else {
// We only care about showing changes to descendants of the revision draft item when in multiple revisions mode
Copy link
Copy Markdown
Contributor Author

@MicroFish91 MicroFish91 Jul 10, 2023

Choose a reason for hiding this comment

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

This else code segment will be introduced in the multiple revisions PR, commented out for now with a return placeholder

Comment thread src/commands/revisionDraft/RevisionDraftFileSystem.ts
Comment thread src/commands/revisionDraft/RevisionDraftFileSystem.ts Outdated
Comment thread src/constants.ts Outdated
Comment thread src/constants.ts Outdated
Comment thread src/tree/revisionManagement/RevisionDraftItem.ts Outdated
Comment thread src/tree/revisionManagement/RevisionDraftItem.ts
};
}

getChildren(): TreeElementBase[] {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This being the same as the ContainerAppItem kind of makes me want this class to be extended from or based off of a an abstract ContainerAppItemBase. I think it'll be kind of annoying when we change/add children or the container app item itself.

Copy link
Copy Markdown
Contributor Author

@MicroFish91 MicroFish91 Jul 12, 2023

Choose a reason for hiding this comment

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

Yeah, technically you'd probably have the ContainerAppItem, the RevisionItem, and the RevisionDraftItem all extend from this then. I'm open to some base class that has maybe a private method that you would call within getChildren to obtain the shared children.

Copy link
Copy Markdown
Contributor Author

@MicroFish91 MicroFish91 Jul 12, 2023

Choose a reason for hiding this comment

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

Actually, instead of enforcing inheritance for this, how do you feel about providing the children through a static method on the RevisionItem. That feels simpler to me and we can still manage the children in one place. It also could make sense to keep it on that item because the template changes are analogous to the concept of revisions anyway.

getChildren(): TreeElementBase[] {
let scale: Scale | undefined;

if (this.hasUnsavedChanges()) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Don't need it now, but maybe just a side-note. Anytime we have an item that is part of the "batch changes", we could have a base model for it that has the same implementation for how to get the value/children and check for unsavedChanges, etc.

Copy link
Copy Markdown
Contributor Author

@MicroFish91 MicroFish91 Jul 12, 2023

Choose a reason for hiding this comment

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

Yeah, I totally get what you mean, I was thinking about doing something like this eventually as well further down the line when we have a better vision for how all the batch revision work will tie together.

I'm not sure if I prefer extending from a base here or just implementing an interface (leaning towards the latter). If we ever decide we want to implement discard changes on the item level, that would also be a good candidate to include as well.

Comment thread src/commands/editContainerApp.ts Outdated
Comment thread src/tree/ContainerAppItem.ts Outdated
Comment thread src/utils/isDeepEqual.ts Outdated
Comment thread src/utils/isDeepEqual.ts Outdated
Comment thread src/commands/editContainerApp.ts Outdated
@MicroFish91 MicroFish91 force-pushed the mwf/revision-draft-alt-2 branch from bff2eff to 2fed691 Compare July 14, 2023 00:34
@MicroFish91
Copy link
Copy Markdown
Contributor Author

MicroFish91 commented Jul 14, 2023

Just a heads up, I think this is ready for review again!

@MicroFish91 MicroFish91 force-pushed the mwf/revision-draft-alt-2 branch from 116d22f to 0b07f91 Compare July 14, 2023 19:02
@MicroFish91 MicroFish91 force-pushed the mwf/revision-draft-alt-2 branch from babd790 to 242b6ad Compare July 14, 2023 22:30
Comment thread src/tree/ContainerAppItem.ts
Comment thread package.json
Comment thread package.nls.json Outdated
Comment thread package.nls.json
"containerApps.createContainerApp": "Create Container App...",
"containerApps.deployImage": "Update Container App Image......",
"containerApps.editContainerApp": "Edit Container App (Advanced)",
"containerApps.deployImage": "Update Container App Image...",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm wondering if we should call this: "Update Container..." or "Edit Container..." after our conversation offline. The image is just a part of the overall container, after all.

It's annoying and confusing, but Container =/= Container App.

Copy link
Copy Markdown
Contributor Author

@MicroFish91 MicroFish91 Jul 18, 2023

Choose a reason for hiding this comment

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

Yeah it's 😵‍💫

Comment thread src/tree/revisionManagement/RevisionDraftItem.ts
@MicroFish91 MicroFish91 merged commit 48644c2 into main Jul 18, 2023
@MicroFish91 MicroFish91 deleted the mwf/revision-draft-alt-2 branch July 18, 2023 19:03
@microsoft microsoft locked and limited conversation to collaborators Mar 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants