private openAllPlansDialog()

in src/PortfolioPlanning/AddToPlanAction.tsx [72:131]


    private openAllPlansDialog(workItemIds: number[], directory: PortfolioPlanningDirectory): void {
        const telemetryService = PortfolioTelemetry.getInstance();
        const telemetryData = {
            ["WorkItemCount"]: workItemIds.length
        };
        PortfolioTelemetry.getInstance().TrackAction("AddToPlanAction/openAllPlansDialog", telemetryData);

        let onOkClickHandler: () => Promise<void> = null;

        const dialogInput: IDialogInputData = {
            workItemIds,
            directory,
            setOnOkClickHandler: (onOkClickHandlerInstance: () => Promise<void>) => {
                onOkClickHandler = onOkClickHandlerInstance;
            },
            telemetryService
        };

        VSS.getService(VSS.ServiceIds.Dialog).then((hostDialogService: IHostDialogService) => {
            const extensionContext = VSS.getExtensionContext();
            hostDialogService
                .openDialog(
                    `${extensionContext.publisherId}.${
                    extensionContext.extensionId
                    }.workitem-portfolio-planning-show-all-plans-action`,
                    {
                        title: "Select Portfolio Plan",
                        width: 400,
                        height: 200,
                        modal: true,
                        buttons: {
                            add: {
                                id: "Add",
                                text: "Add",
                                click: () => {
                                    if (this._externalDialog && onOkClickHandler) {
                                        this._externalDialog.updateOkButton(false);

                                        return onOkClickHandler().then(
                                            () => {
                                                this._externalDialog.close();
                                            },
                                            (error: Error | string) => {
                                                if (typeof error === "string") {
                                                    this._externalDialog.setTitle(error);
                                                } else {
                                                    this._externalDialog.setTitle(error.message);
                                                }
                                            }
                                        );
                                    }
                                }
                            }
                        }
                    },
                    dialogInput
                )
                .then(externalDialog => (this._externalDialog = externalDialog));
        });
    }