private _handleWebviewMsg()

in apps/vs-code-designer/src/app/commands/dataMapper/DataMapperPanel.ts [121:202]


  private _handleWebviewMsg(msg: MessageToVsix) {
    switch (msg.command) {
      case ExtensionCommand.initialize: {
        this.sendMsgToWebview({
          command: ExtensionCommand.initialize_frame,
          data: {
            project: ProjectName.dataMapper,
          },
        });
        break;
      }
      case ExtensionCommand.webviewLoaded: {
        // Send runtime port to webview
        this.sendMsgToWebview({
          command: ExtensionCommand.setRuntimePort,
          data: `${ext.designTimeInstances.get(ext.defaultLogicAppPath)?.port}`,
        });

        // If loading a data map, handle that + xslt filename
        this.handleLoadMapDefinitionIfAny();

        break;
      }
      case ExtensionCommand.webviewRscLoadError: {
        // Handle DM top-level errors (such as loading schemas added from file, or general function manifest fetching issues)
        ext.showError(localize('WebviewRscLoadError', `Error loading Data Mapper resource: "{0}"`, msg.data));
        break;
      }
      case ExtensionCommand.addSchemaFromFile: {
        this.addSchemaFromFile(msg.data);
        break;
      }
      case ExtensionCommand.readLocalSchemaFileOptions: {
        this.handleReadSchemaFileOptions();
        break;
      }
      case ExtensionCommand.readLocalCustomXsltFileOptions: {
        this.handleReadAvailableCustomXsltPaths();
        break;
      }
      case ExtensionCommand.saveDataMapDefinition: {
        this.saveMapDefinition(msg.data);
        break;
      }
      case ExtensionCommand.saveDataMapMetadata: {
        this.saveMapMetadata(msg.data);
        break;
      }
      case ExtensionCommand.saveDataMapXslt: {
        this.saveMapXslt(msg.data);
        break;
      }
      case ExtensionCommand.saveDraftDataMapDefinition: {
        if (this.dataMapStateIsDirty) {
          this.saveDraftDataMapDefinition(msg.data);
        }
        break;
      }
      case ExtensionCommand.setIsMapStateDirty: {
        this.handleUpdateMapDirtyState(msg.data);
        break;
      }
      case ExtensionCommand.getFunctionDisplayExpanded: {
        this.getConfigurationSetting('useExpandedFunctionCards');
        break;
      }

      case ExtensionCommand.getDataMapperVersion: {
        this.handleGetDataMapperVersion();
        break;
      }
      case ExtensionCommand.logTelemetry: {
        const eventName = `${this.telemetryPrefix}/${msg.data.name ?? msg.data.area}`;
        ext.telemetryReporter.sendTelemetryEvent(eventName, { ...msg.data });
        break;
      }
      case ExtensionCommand.sendNotification: {
        this.sendNotification(msg.data.title, msg.data.text, msg.data.level);
        break;
      }
    }
  }