/** Ċ Ġ* ĠCopyright Ġ( c ) ĠMicrosoft ĠCorporation . ĠAll Ġrights Ġreserved . Ċ Ġ* ĠCopyright Ġ( c ) Ġ 2 0 2 0 - 2 0 2 1 ĠJetBrains Ġs . r . o . Ċ Ġ* ĠLicensed Ġunder Ġthe ĠMIT ĠLicense . ĠSee ĠLicense . txt Ġin Ġthe Ġproject Ġroot Ġfor Ġlicense Ġinformation . Ċ Ġ*/ Ċ Ċ package Ġcom . microsoft . tool ing . mss ervices . service explorer . azure . app service . slot Ċ Ċ import Ġcom . microsoft . azure . management . app service . Deployment Slot Base Ċ import Ġcom . microsoft . azure . toolkit . lib . common . operation . Azure Operation Ċ import Ġcom . microsoft . azure tools . Action Constants Ċ import Ġcom . microsoft . azure tools . azure commons . helpers . Nullable Ċ import Ġcom . microsoft . tool ing . mss ervices . components . Default Loader Ċ import Ġcom . microsoft . tool ing . mss ervices . service explorer .* Ċ import Ġcom . microsoft . tool ing . mss ervices . service explorer . azure . Azure Node Action Prompt Listener Ċ import Ġcom . microsoft . tool ing . mss ervices . service explorer . azure . webapp . base . WebApp Base Node Ċ import Ġcom . microsoft . tool ing . mss ervices . service explorer . azure . webapp . base . WebApp Base State Ċ import Ġcom . microsoft . tool ing . mss ervices . service explorer . azure . webapp . deployments lot . Deployment Slot Module Ċ Ċ abstract Ġclass ĠDeployment Slot Node Base < TS lot Ġ: ĠDeployment Slot Base < TS lot >>( ĊĠĠĠ Ġval ĠappId : ĠString , ĊĠĠĠ Ġval ĠappName : ĠString , ĊĠĠĠ Ġparent : ĠDeployment Slot Module Base < TS lot >, ĊĠĠĠ Ġval Ġslot Id : ĠString , ĊĠĠĠ Ġval Ġslot Name : ĠString , ĊĠĠĠ Ġstate : ĠString , ĊĠĠĠ Ġos : ĠString , ĊĠĠĠ Ġsubscription Id : ĠString , ĊĠĠĠ Ġhost Name : ĠString Ċ ) Ġ: ĠWeb App Base Node ( slot Id , Ġslot Name , ĠSLOT _ LABEL , Ġparent , Ġsubscription Id , Ġhost Name , Ġos , Ġstate ), ĊĠĠĠ ĠDeployment Slot Node View Ġ{ ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġprivate Ġconst Ġval ĠSLOT _ LABEL Ġ= Ġ" Slot " ĊĠĠĠĠĠĠĠ Ġprivate Ġconst Ġval ĠACTION _ SWAP _ WITH _ PRO DU CTION _ NAME Ġ= Ġ" Swap Ġwith Ġproduction " ĊĊĠĠĠĠĠĠĠ Ġprivate Ġconst Ġval ĠDELETE _ SLOT _ PROMPT _ MESSAGE Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" This Ġoperation Ġwill Ġdelete Ġthe ĠDeployment ĠSlot : Ġ% s .\ n Are Ġyou Ġsure Ġyou Ġwant Ġto Ġcontinue ?" ĊĊĠĠĠĠĠĠĠ Ġprivate Ġconst Ġval ĠDELETE _ SLOT _ PROGRESS _ MESSAGE Ġ= Ġ" Deleting ĠDeployment ĠSlot " ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġabstract Ġval Ġpresenter : ĠDeployment Slot Node Presenter Base < TS lot , ĠDeployment Slot Node View > ĊĊĠĠĠ Ġinit Ġ{ ĊĠĠĠĠĠĠĠ Ġload Actions () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠgetNode Actions (): ĠList < Node Action ?> ? Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġswap Action Ġ= ĠgetNode Action ByName ( ACTION _ SWAP _ WITH _ PRO DU CTION _ NAME ) ĊĠĠĠĠĠĠĠ Ġif Ġ( swap Action Ġ!= Ġnull ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġswap Action . isEnabled Ġ= Ġstate Ġ== ĠWeb App Base State . RUNNING ĊĊĠĠĠĠĠĠĠ Ġreturn Ġsuper . getNode Actions () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġabstract Ġfun Ġopen Deployment Slot Property Action () ĊĊĠĠĠ Ġoverride Ġfun Ġget Show Properties ActionListener (): ĠNode ActionListener Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġinit Action Builder Ġ{ Ġopen Deployment Slot Property Action () Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. with Action ( Azure Action Enum . SHOW _ PROPERTIES ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. with Back gro ud able ( true ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build ( Azure Action Enum . SHOW _ PROPERTIES . do ing Name ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġget Open In Browser ActionListener (): ĠNode ActionListener Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġinit Action Builder Ġ{ Ġopen In Browser () Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. with Action ( Azure Action Enum . OPEN _ IN _ BROWSER ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. with Back gro ud able ( true ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build ( Azure Action Enum . OPEN _ IN _ BROWSER . do ing Name ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġget Start ActionListener (): ĠNode ActionListener Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġinit Action Builder Ġ{ Ġthis . start () Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. with Action ( Azure Action Enum . START ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. with Back gro ud able ( true ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build ( Azure Action Enum . START . do ing Name ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġget Restart ActionListener (): ĠNode ActionListener Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġinit Action Builder Ġ{ Ġthis . restart () Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. with Action ( Azure Action Enum . RE START ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. with Back gro ud able ( true ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build ( Azure Action Enum . RE START . do ing Name ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġget Stop ActionListener (): ĠNode ActionListener Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġinit Action Builder Ġ{ Ġthis . stop () Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. with Action ( Azure Action Enum . STOP ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. with Back gro ud able ( true ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build ( Azure Action Enum . STOP . do ing Name ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġget Delete ActionListener (): ĠNode ActionListener Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠDelete Deployment Slot Action ( subscriptionId , Ġthis , Ġname ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Azure Operation ( name Ġ= Ġ" webapp | deployment . refresh ", Ġparams Ġ= Ġ[" @ slot Name ", Ġ"@ web AppName "], Ġtype Ġ= ĠAzure Operation . Type . ACTION ) ĊĠĠĠ Ġoverride Ġfun Ġrefresh Items () Ġ{ ĊĠĠĠĠĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġpresenter . on Refresh Node ( subscriptionId , ĠappId , Ġslot Name ) ĊĠĠĠĠĠĠĠ Ġ} Ġcatch Ġ( e : ĠException ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġe . printStackTrace () ĊĠĠĠĠĠĠĠĠĠĠĠ ĠDefault Loader . get UI Helper (). log Error (" Error Ġwhile Ġrefresh ing ĠDeployment ĠSlot Ġ'$ slot Name '", Ġe ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Node Click ( e : ĠNode ActionEvent ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġ// ĠRefresh able Node Ġrefresh Ġitself Ġwhen Ġthe Ġfirst Ġtime Ġbeing Ġclicked . ĊĠĠĠĠĠĠĠ Ġ// ĠThe Ġdeployment Ġslot Ġnode Ġis Ġjust Ġa Ġsingle Ġnode Ġfor Ġthe Ġtime Ġbeing . ĊĠĠĠĠĠĠĠ Ġ// ĠOverride Ġthe Ġfunction Ġto Ġdo Ġnot ing Ġto Ġdisable Ġthe Ġauto Ġrefresh Ġfunctionality . ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġget Icon Symbol (): Ġ@ Nullable ĠAzure Icon Symbol ? Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġis Linux Ġ= ĠOS _ LINUX . equals ( os , Ġignore Case Ġ= Ġtrue ) ĊĠĠĠĠĠĠĠ Ġval Ġrunning Ġ= ĠWeb App Base State . RUNNING Ġ== Ġstate ĊĠĠĠĠĠĠĠ Ġval Ġupdating Ġ= ĠWeb App Base State . UP DAT ING Ġ== Ġstate ĊĠĠĠĠĠĠĠ Ġreturn Ġif Ġ( is Linux ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( running ) ĠAzure Icon Symbol . Deployment Slot . RUNNING _ ON _ LINUX Ġelse Ġif Ġ( updating ) ĠAzure Icon Symbol . Deployment Slot . UP DAT ING _ ON _ LINUX Ġelse ĠAzure Icon Symbol . Deployment Slot . STOP PED _ ON _ LINUX ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( running ) ĠAzure Icon Symbol . Deployment Slot . RUNNING Ġelse Ġif Ġ( updating ) ĠAzure Icon Symbol . Deployment Slot . UP DAT ING Ġelse ĠAzure Icon Symbol . Deployment Slot . STOP PED ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġload Actions () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . load Actions () ĊĠĠĠĠĠĠĠ Ġadd Action ( ACTION _ SWAP _ WITH _ PRO DU CTION _ NAME , Ġinit Action Builder Ġ{ Ġswap () Ġ}. with Back gro ud able ( true ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build (" Sw apping Ġdeployment Ġslot ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġinit Action Builder ( run nable : ĠRunnable ): ĠBasic Action Builder Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠBasic Action Builder ( run nable ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. with ModuleName ( Deployment Slot Module . MODULE _ NAME ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. with Instance Name ( name ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Azure Operation ( name Ġ= ĠAction Constants . WebApp . Deployment Slot . START , Ġtype Ġ= ĠAzure Operation . Type . ACTION ) ĊĠĠĠ Ġprivate Ġfun Ġstart () Ġ{ ĊĠĠĠĠĠĠĠ Ġpresenter . onStart Deployment Slot ( subscriptionId , ĠappId , Ġslot Name ) ĊĠĠĠĠĠĠĠ Ġrender Node ( WebApp Base State . RUNNING ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Azure Operation ( name Ġ= ĠAction Constants . WebApp . Deployment Slot . STOP , Ġtype Ġ= ĠAzure Operation . Type . ACTION ) ĊĠĠĠ Ġprivate Ġfun Ġstop () Ġ{ ĊĠĠĠĠĠĠĠ Ġpresenter . on Stop Deployment Slot ( subscriptionId , ĠappId , Ġslot Name ) ĊĠĠĠĠĠĠĠ Ġrender Node ( WebApp Base State . STOP PED ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Azure Operation ( name Ġ= ĠAction Constants . WebApp . Deployment Slot . RE START , Ġtype Ġ= ĠAzure Operation . Type . ACTION ) ĊĠĠĠ Ġprivate Ġfun Ġrestart () Ġ{ ĊĠĠĠĠĠĠĠ Ġpresenter . on Restart Deployment Slot ( subscriptionId , ĠappId , Ġslot Name ) ĊĠĠĠĠĠĠĠ Ġrender Node ( WebApp Base State . RUNNING ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Azure Operation ( name Ġ= ĠAction Constants . WebApp . Deployment Slot . DELETE , Ġtype Ġ= ĠAzure Operation . Type . ACTION ) ĊĠĠĠ Ġprivate Ġfun Ġdelete () Ġ{ ĊĠĠĠĠĠĠĠ ĠgetParent (). remove Node ( get Subscription Id (), ĠgetName (), Ġthis ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Azure Operation ( name Ġ= ĠAction Constants . WebApp . Deployment Slot . SWAP , Ġtype Ġ= ĠAzure Operation . Type . ACTION ) ĊĠĠĠ Ġprivate Ġfun Ġswap () Ġ{ ĊĠĠĠĠĠĠĠ Ġpresenter . on Swap With Production ( subscriptionId , ĠappId , Ġslot Name ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Azure Operation ( name Ġ= ĠAction Constants . WebApp . Deployment Slot . OPEN _ IN _ BROWSER , Ġtype Ġ= ĠAzure Operation . Type . ACTION ) ĊĠĠĠ Ġprivate Ġfun Ġopen In Browser () Ġ{ ĊĠĠĠĠĠĠĠ ĠDefault Loader . get UI Helper (). open In Browser (" https :// $ host Name ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Azure Operation ( name Ġ= ĠAction Constants . WebApp . Deployment Slot . SHOW _ PROPERTIES , Ġtype Ġ= ĠAzure Operation . Type . ACTION ) ĊĠĠĠ Ġprivate Ġfun Ġshow Properties () Ġ{ ĊĠĠĠĠĠĠĠ Ġopen Deployment Slot Property Action () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġclass ĠDelete Deployment Slot Action ( private Ġval Ġsubscription Id : ĠString , Ġprivate Ġval Ġnode : ĠNode , Ġprivate Ġval Ġname : ĠString ) Ġ: ĠAzure Node Action Prompt Listener ( ĊĠĠĠĠĠĠĠ Ġnode , ĊĠĠĠĠĠĠĠ ĠString . format ( DELETE _ SLOT _ PROMPT _ MESSAGE , Ġname ), ĊĠĠĠĠĠĠĠ ĠDELETE _ SLOT _ PROGRESS _ MESSAGE ) Ġ{ ĊĊĠĠĠĠĠĠĠ Ġoverride Ġfun Ġazure Node Action ( e : ĠNode ActionEvent ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnode . parent . remove Node ( subscriptionId , Ġname , Ġnode ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġoverride Ġfun Ġon Subscriptions Changed ( e : ĠNode ActionEvent ?) Ġ{ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ