селектбокс

This commit is contained in:
gorbenko.pavel
2026-08-17 16:47:48 +05:00
parent 20a54e01f1
commit 2b3de32d3f
3 changed files with 42 additions and 4 deletions
@@ -3,6 +3,7 @@ import * as ReactDom from 'react-dom';
import { Version } from '@microsoft/sp-core-library';
import {
type IPropertyPaneConfiguration,
PropertyPaneDropdown,
PropertyPaneTextField
} from '@microsoft/sp-property-pane';
import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base';
@@ -14,12 +15,15 @@ import { IRequestPortalProps } from './components/IRequestPortalProps';
import { initSP } from './shared/pnp/pnpjs';
import { installErrorLogging } from './shared/diagnostics';
import { setImpersonatedEmail } from './shared/impersonation';
import { APPROVAL_API_BASE_URL_LOCAL, APPROVAL_API_BASE_URL_PROD, setApprovalApiBaseUrl } from './shared/config';
import { ErrorOverlay } from './shared/ui';
export interface IRequestPortalWebPartProps {
description: string;
/** Отладочная подмена личности — см. shared/impersonation.ts. На бою пусто. */
debugUserEmail: string;
/** Куда шлём запросы approval-route (маршруты согласования) — прод или локальный backend. */
approvalApiBaseUrl: string;
}
export default class RequestPortalWebPart extends BaseClientSideWebPart<IRequestPortalWebPartProps> {
@@ -31,6 +35,8 @@ export default class RequestPortalWebPart extends BaseClientSideWebPart<IRequest
// Именно здесь, а не в onInit: свойство меняется в панели без перезапуска
// веб-части, и render вызывается на каждое такое изменение.
setImpersonatedEmail(this.properties.debugUserEmail);
this.properties.approvalApiBaseUrl = this.properties.approvalApiBaseUrl || APPROVAL_API_BASE_URL_PROD;
setApprovalApiBaseUrl(this.properties.approvalApiBaseUrl);
const element: React.ReactElement = React.createElement(
ErrorOverlay,
@@ -131,6 +137,19 @@ export default class RequestPortalWebPart extends BaseClientSideWebPart<IRequest
placeholder: 'employee@tnsu.kz'
})
]
},
{
groupName: 'Approval Route API',
groupFields: [
PropertyPaneDropdown('approvalApiBaseUrl', {
label: 'Api Base Url',
selectedKey: this.properties.approvalApiBaseUrl,
options: [
{ key: APPROVAL_API_BASE_URL_PROD, text: `Прод (${APPROVAL_API_BASE_URL_PROD})` },
{ key: APPROVAL_API_BASE_URL_LOCAL, text: `Локально (${APPROVAL_API_BASE_URL_LOCAL})` }
]
})
]
}
]
}