text: ﻿// @ts-check
  import {
      modalPanelUsers,
      modalPanelDeleteEngine,
      modalPanelResourceGroup,
      modalPanelDatabricks,
      modalPanelDataFactory
  } from "../modal/index.js";
  
  import { notification } from "../notification.js"
  import { console2 } from "../console2.js"
  
  export class adminEngineRequestDetailsPage {
  
  
      constructor() {
  
      }
  
      async onLoad() {
          modalPanelUsers.initialize("panelDeploymentOwners");
          modalPanelUsers.initialize("panelDeploymentMembers");
          modalPanelUsers.initialize("panelRequestOwners");
          modalPanelUsers.initialize("panelRequestMembers");
  
          modalPanelDeleteEngine.initialize("panelDeleteEngine");
          modalPanelResourceGroup.initialize("panelResourceGroup");
          modalPanelDatabricks.initialize("panelDatabricks");
          modalPanelDataFactory.initialize("panelDataFactory");
  
          this.id = $("#Id");
  
          if ($("#console").length) {
              this.console2 = new console2($("#console"), $('div.docking-form'));
  
              notification.current.on(notification.OnStarted, async () => {
                  await notification.current.connection.invoke('SubscribeDeploymentAsync', this.id.val());
              });
  
              notification.current.on("deploy", this.appendDeployToConsole.bind(this));
          }
      }
  
      async appendDeployToConsole(deploy, value) {
  
          if (!deploy)
              return;
  
          switch (deploy.state) {
              case "Error":
                  this.console2.appendError(deploy.message);
                  break;
              case "Deployed":
                  this.console2.appendLine(deploy.message);
                  break;
              case "Deploying":
                  this.console2.appendLine(deploy.message);
                  break;
              default:
                  this.console2.appendWarning(deploy.message);
          }
  
          if (value)
              this.console2.appendObject(value);
      }
  
  
      onUnload() {
          notification.current.off("deploy", this.appendDeployToConsole.bind(this));
  
      }
  
  }
  