55
66import { ContainerAppsAPIClient , KnownActiveRevisionsMode , Revision } from "@azure/arm-appcontainers" ;
77import { uiUtils } from "@microsoft/vscode-azext-azureutils" ;
8- import { AzureWizard , AzureWizardExecuteStep , AzureWizardPromptStep , IActionContext , createSubscriptionContext , nonNullProp , nonNullValue , nonNullValueAndProp } from "@microsoft/vscode-azext-utils" ;
8+ import { AzureWizard , AzureWizardExecuteStep , AzureWizardPromptStep , IActionContext , createSubscriptionContext , nonNullProp , nonNullValueAndProp } from "@microsoft/vscode-azext-utils" ;
99import * as deepEqual from "deep-eql" ;
1010import { ext } from "../../../extensionVariables" ;
1111import type { ContainerAppItem , ContainerAppModel } from "../../../tree/ContainerAppItem" ;
@@ -22,10 +22,6 @@ import type { IDeployRevisionDraftContext } from "./IDeployRevisionDraftContext"
2222export async function deployRevisionDraft ( context : IActionContext , node ?: ContainerAppItem | RevisionDraftItem ) : Promise < void > {
2323 const item = node ?? await pickContainerApp ( context ) ;
2424
25- if ( ! ext . revisionDraftFileSystem . doesContainerAppsItemHaveRevisionDraft ( item ) ) {
26- throw new Error ( localize ( 'noDraftExists' , 'No draft changes exist for container app "{0}".' , item . containerApp . name ) ) ;
27- }
28-
2925 const { subscription, containerApp } = item ;
3026
3127 const wizardContext : IDeployRevisionDraftContext = {
@@ -34,7 +30,7 @@ export async function deployRevisionDraft(context: IActionContext, node?: Contai
3430 ...( await createActivityContext ( ) ) ,
3531 subscription,
3632 containerApp,
37- template : nonNullValue ( ext . revisionDraftFileSystem . parseRevisionDraft ( item ) ) ,
33+ template : ext . revisionDraftFileSystem . parseRevisionDraft ( item ) ,
3834 } ;
3935
4036 if ( ! await hasUnsavedChanges ( wizardContext , item ) ) {
@@ -78,14 +74,14 @@ async function hasUnsavedChanges(context: IDeployRevisionDraftContext, item: Con
7874 const containerApp : ContainerAppModel = nonNullProp ( context , 'containerApp' ) ;
7975
8076 if ( context . containerApp ?. revisionsMode === KnownActiveRevisionsMode . Single ) {
81- return ! ! containerApp . template && ! deepEqual ( containerApp . template , context . template ) ;
77+ return ! ! containerApp . template && ! ! context . template && ! deepEqual ( containerApp . template , context . template ) ;
8278 } else {
8379 const client : ContainerAppsAPIClient = await createContainerAppsAPIClient ( context ) ;
8480 const revisions : Revision [ ] = await uiUtils . listAllIterator ( client . containerAppsRevisions . listRevisions ( containerApp . resourceGroup , containerApp . name ) ) ;
8581
8682 const baseRevisionName : string = nonNullValueAndProp ( ext . revisionDraftFileSystem . getRevisionDraftFile ( item ) , 'baseRevisionName' ) ;
8783 const baseRevision : Revision | undefined = revisions . find ( revision => revision . name === baseRevisionName ) ;
8884
89- return ! ! baseRevision ?. template && ! deepEqual ( baseRevision . template , context . template ) ;
85+ return ! ! baseRevision ?. template && ! ! context . template && ! deepEqual ( baseRevision . template , context . template ) ;
9086 }
9187}
0 commit comments