Co-authored-by: gorbenko.pavel <gorbenko.pavel@tansu.kz> Reviewed-on: http://git.tnsu.kz/timur.gorodetskiy/request-portal/pulls/7
This commit was merged in pull request #7.
This commit is contained in:
@@ -13,10 +13,13 @@ import RequestPortal from './components/RequestPortal';
|
||||
import { IRequestPortalProps } from './components/IRequestPortalProps';
|
||||
import { initSP } from './shared/pnp/pnpjs';
|
||||
import { installErrorLogging } from './shared/diagnostics';
|
||||
import { setImpersonatedEmail } from './shared/impersonation';
|
||||
import { ErrorOverlay } from './shared/ui';
|
||||
|
||||
export interface IRequestPortalWebPartProps {
|
||||
description: string;
|
||||
/** Отладочная подмена личности — см. shared/impersonation.ts. На бою пусто. */
|
||||
debugUserEmail: string;
|
||||
}
|
||||
|
||||
export default class RequestPortalWebPart extends BaseClientSideWebPart<IRequestPortalWebPartProps> {
|
||||
@@ -25,6 +28,10 @@ export default class RequestPortalWebPart extends BaseClientSideWebPart<IRequest
|
||||
private _environmentMessage: string = '';
|
||||
|
||||
public render(): void {
|
||||
// Именно здесь, а не в onInit: свойство меняется в панели без перезапуска
|
||||
// веб-части, и render вызывается на каждое такое изменение.
|
||||
setImpersonatedEmail(this.properties.debugUserEmail);
|
||||
|
||||
const element: React.ReactElement = React.createElement(
|
||||
ErrorOverlay,
|
||||
undefined,
|
||||
@@ -117,6 +124,11 @@ export default class RequestPortalWebPart extends BaseClientSideWebPart<IRequest
|
||||
groupFields: [
|
||||
PropertyPaneTextField('description', {
|
||||
label: strings.DescriptionFieldLabel
|
||||
}),
|
||||
PropertyPaneTextField('debugUserEmail', {
|
||||
label: strings.DebugUserEmailFieldLabel,
|
||||
description: strings.DebugUserEmailFieldDescription,
|
||||
placeholder: 'employee@tnsu.kz'
|
||||
})
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user