Feat/selection title reports access (#21)
Tests / frontend-test (push) Successful in 1m19s

Co-authored-by: gorbenko.pavel <gorbenko.pavel@tansu.kz>
Reviewed-on: http://git.tnsu.kz/timur.gorodetskiy/request-portal/pulls/21
This commit was merged in pull request #21.
This commit is contained in:
2026-09-25 04:43:37 +00:00
parent ab21683377
commit ec94de3c1b
10 changed files with 144 additions and 8372 deletions
@@ -1,7 +1,12 @@
import * as React from 'react';
import * as ReactDom from 'react-dom';
import { Version } from '@microsoft/sp-core-library';
import { type IPropertyPaneConfiguration, PropertyPaneDropdown } from '@microsoft/sp-property-pane';
import {
type IPropertyPaneConfiguration,
PropertyPaneDropdown,
PropertyPaneTextField,
PropertyPaneToggle
} from '@microsoft/sp-property-pane';
import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base';
import { IReadonlyTheme } from '@microsoft/sp-component-base';
@@ -11,7 +16,12 @@ import { IRequestPortalProps } from './components/IRequestPortalProps';
import { initSP } from './shared/pnp/pnpjs';
import { installErrorLogging } from './shared/diagnostics';
import { setImpersonatedIdentity } from './shared/impersonation';
import { APPROVAL_API_BASE_URL_LOCAL, APPROVAL_API_BASE_URL_PROD, setApprovalApiBaseUrl } from './shared/config';
import {
APPROVAL_API_BASE_URL_LOCAL,
APPROVAL_API_BASE_URL_PROD,
setApprovalApiBaseUrl,
setNotificationSettings
} from './shared/config';
import { initListPartitions } from './shared/approval';
import { ErrorOverlay } from './shared/ui';
import { PropertyPaneDebugUser } from './propertyPane/PropertyPaneDebugUser';
@@ -28,6 +38,13 @@ export interface IRequestPortalWebPartProps {
debugUserDisplayName: string;
/** Куда шлём запросы approval-route (маршруты согласования) — прод или локальный backend. */
approvalApiBaseUrl: string;
/**
* Уведомления согласующим (поток Power Automate). По умолчанию включены:
* у веб-частей, добавленных до появления свойства, оно undefined — это тоже «вкл».
*/
notificationsEnabled?: boolean;
/** Непустой адрес — письма только если активный шаг назначен на него (обкатка). Пусто — всем. */
notifyOnlyTo?: string;
}
export default class RequestPortalWebPart extends BaseClientSideWebPart<IRequestPortalWebPartProps> {
@@ -41,6 +58,7 @@ export default class RequestPortalWebPart extends BaseClientSideWebPart<IRequest
setImpersonatedIdentity(this.properties.debugUserQuery, this.properties.debugUserDisplayName);
this.properties.approvalApiBaseUrl = this.properties.approvalApiBaseUrl || APPROVAL_API_BASE_URL_PROD;
setApprovalApiBaseUrl(this.properties.approvalApiBaseUrl);
this._applyNotificationSettings();
const element: React.ReactElement = React.createElement(
ErrorOverlay,
@@ -71,6 +89,7 @@ export default class RequestPortalWebPart extends BaseClientSideWebPart<IRequest
// панели без перезапуска), но render случается позже onInit.
this.properties.approvalApiBaseUrl = this.properties.approvalApiBaseUrl || APPROVAL_API_BASE_URL_PROD;
setApprovalApiBaseUrl(this.properties.approvalApiBaseUrl);
this._applyNotificationSettings();
// Партиции грузим здесь, а не по требованию из форм: имена списков нужны
// формам синхронно (см. shared/listTitles.ts), а формы — лениво подгружаемые
@@ -92,7 +111,9 @@ export default class RequestPortalWebPart extends BaseClientSideWebPart<IRequest
});
}
private _applyNotificationSettings(): void {
setNotificationSettings(this.properties.notificationsEnabled !== false, this.properties.notifyOnlyTo || '');
}
private _getEnvironmentMessage(): Promise<string> {
if (!!this.context.sdks.microsoftTeams) { // running in Teams, office.com or Outlook
@@ -196,6 +217,23 @@ export default class RequestPortalWebPart extends BaseClientSideWebPart<IRequest
]
})
]
},
{
groupName: 'Уведомления',
groupFields: [
PropertyPaneToggle('notificationsEnabled', {
label: 'Уведомления согласующим',
onText: 'Включены',
offText: 'Выключены',
checked: this.properties.notificationsEnabled !== false
}),
PropertyPaneTextField('notifyOnlyTo', {
label: 'Слать только на адрес',
description: 'Для обкатки: письмо уходит, только если шаг назначен на этот e-mail. Пусто — всем.',
placeholder: 'user@tnsu.kz',
disabled: this.properties.notificationsEnabled === false
})
]
}
]
}