Files
tnsu-approval-route/frontend/lib-commonjs/webparts/approvalAdmin/ApprovalAdminWebPart.js
T
2026-07-29 13:01:19 +05:00

81 lines
4.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var ReactDom = tslib_1.__importStar(require("react-dom"));
var sp_core_library_1 = require("@microsoft/sp-core-library");
var sp_property_pane_1 = require("@microsoft/sp-property-pane");
var sp_webpart_base_1 = require("@microsoft/sp-webpart-base");
var ApprovalAdmin_1 = tslib_1.__importDefault(require("./components/ApprovalAdmin"));
var ApprovalAdminWebPart = /** @class */ (function (_super) {
tslib_1.__extends(ApprovalAdminWebPart, _super);
function ApprovalAdminWebPart() {
return _super !== null && _super.apply(this, arguments) || this;
}
ApprovalAdminWebPart.prototype.render = function () {
var element = React.createElement(ApprovalAdmin_1.default, {
context: this.context,
apiBaseUrl: this.properties.apiBaseUrl,
useDevAuth: this.properties.useDevAuth,
devUserEmail: this.properties.devUserEmail,
aadResourceId: this.properties.aadResourceId
});
ReactDom.render(element, this.domElement);
};
ApprovalAdminWebPart.prototype.onInit = function () {
var _a;
this.properties.apiBaseUrl = this.properties.apiBaseUrl || 'http://localhost:5080';
this.properties.useDevAuth = (_a = this.properties.useDevAuth) !== null && _a !== void 0 ? _a : true;
this.properties.devUserEmail = this.properties.devUserEmail || 'dev@tnsu.kz';
this.properties.aadResourceId = this.properties.aadResourceId || 'api://9232d9e2-9807-4753-808f-07250e5474b0';
return Promise.resolve();
};
ApprovalAdminWebPart.prototype.onDispose = function () {
ReactDom.unmountComponentAtNode(this.domElement);
};
Object.defineProperty(ApprovalAdminWebPart.prototype, "dataVersion", {
get: function () {
return sp_core_library_1.Version.parse('1.0');
},
enumerable: false,
configurable: true
});
ApprovalAdminWebPart.prototype.getPropertyPaneConfiguration = function () {
return {
pages: [
{
header: {
description: 'Подключение к Tnsu.ApprovalRoute.Api'
},
groups: [
{
groupName: 'API',
groupFields: [
(0, sp_property_pane_1.PropertyPaneTextField)('apiBaseUrl', {
label: 'Api Base Url',
description: 'Например, https://localhost:5443 локально или прод-адрес API.'
}),
(0, sp_property_pane_1.PropertyPaneToggle)('useDevAuth', {
label: 'Локальный Dev-режим (без Azure AD)',
onText: 'Вкл. (заголовок X-Dev-User-Email)',
offText: 'Выкл. (AAD-токен через SPFx)'
}),
(0, sp_property_pane_1.PropertyPaneTextField)('devUserEmail', {
label: 'Dev: email пользователя',
description: 'Используется только при включённом Dev-режиме.'
}),
(0, sp_property_pane_1.PropertyPaneTextField)('aadResourceId', {
label: 'AAD Resource Id (App ID URI)',
description: 'Используется только при выключенном Dev-режиме. Должен совпадать с webApiPermissionRequests в package-solution.json.'
})
]
}
]
}
]
};
};
return ApprovalAdminWebPart;
}(sp_webpart_base_1.BaseClientSideWebPart));
exports.default = ApprovalAdminWebPart;
//# sourceMappingURL=ApprovalAdminWebPart.js.map