мелкие правки

This commit is contained in:
gorbenko.pavel
2026-08-17 16:46:25 +05:00
parent 8df1b86e1b
commit fa788fa6c0
6 changed files with 41 additions and 8 deletions
+1
View File
@@ -18,3 +18,4 @@ workspace.xml
**/bin/ **/bin/
**/obj/ **/obj/
.DS_Store .DS_Store
logs/
@@ -3,7 +3,9 @@
"MinimumLevel": { "MinimumLevel": {
"Default": "Information", "Default": "Information",
"Override": { "Override": {
"Microsoft.AspNetCore": "Warning" "Microsoft.AspNetCore": "Warning",
"Microsoft.EntityFrameworkCore": "Warning",
"Hangfire": "Warning"
} }
} }
}, },
@@ -1,7 +1,7 @@
import * as React from 'react'; import * as React from 'react';
import * as ReactDom from 'react-dom'; import * as ReactDom from 'react-dom';
import { Version } from '@microsoft/sp-core-library'; import { Version } from '@microsoft/sp-core-library';
import { type IPropertyPaneConfiguration, PropertyPaneTextField } from '@microsoft/sp-property-pane'; import { type IPropertyPaneConfiguration, PropertyPaneDropdown, PropertyPaneTextField } from '@microsoft/sp-property-pane';
import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base'; import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base';
import ApprovalAdmin from './components/ApprovalAdmin'; import ApprovalAdmin from './components/ApprovalAdmin';
@@ -13,6 +13,13 @@ export interface IApprovalAdminWebPartProps {
portalBaseUrl: string; portalBaseUrl: string;
} }
// Единственные два адреса, которыми реально пользуются (прод и локальный backend,
// см. backend/Tnsu.ApprovalRoute.Api/Properties/launchSettings.json) — селект
// вместо текстового поля, чтобы переключаться одним кликом, а не перепечатывать
// url и рисковать опечаткой в проде.
const API_BASE_URL_PROD = 'https://api.tnsu.kz/approval-route';
const API_BASE_URL_LOCAL = 'http://localhost:5080';
export default class ApprovalAdminWebPart extends BaseClientSideWebPart<IApprovalAdminWebPartProps> { export default class ApprovalAdminWebPart extends BaseClientSideWebPart<IApprovalAdminWebPartProps> {
public render(): void { public render(): void {
@@ -28,9 +35,8 @@ export default class ApprovalAdminWebPart extends BaseClientSideWebPart<IApprova
protected onInit(): Promise<void> { protected onInit(): Promise<void> {
// Прод-адрес по умолчанию: пакуем именно под прод (heft package-solution --production). // Прод-адрес по умолчанию: пакуем именно под прод (heft package-solution --production).
// Для локальной разработки переопределите значение в панели свойств веб-части // Для локальной разработки переключите в панели свойств веб-части на «Локально».
// (например, на http://localhost:5080 — порт из backend/.../launchSettings.json). this.properties.apiBaseUrl = this.properties.apiBaseUrl || API_BASE_URL_PROD;
this.properties.apiBaseUrl = this.properties.apiBaseUrl || 'https://api.tnsu.kz/approval-route';
this.properties.aadResourceId = this.properties.aadResourceId || 'api://9232d9e2-9807-4753-808f-07250e5474b0'; this.properties.aadResourceId = this.properties.aadResourceId || 'api://9232d9e2-9807-4753-808f-07250e5474b0';
this.properties.portalBaseUrl = this.properties.portalBaseUrl || 'https://api.tnsu.kz'; this.properties.portalBaseUrl = this.properties.portalBaseUrl || 'https://api.tnsu.kz';
return Promise.resolve(); return Promise.resolve();
@@ -55,9 +61,13 @@ export default class ApprovalAdminWebPart extends BaseClientSideWebPart<IApprova
{ {
groupName: 'API', groupName: 'API',
groupFields: [ groupFields: [
PropertyPaneTextField('apiBaseUrl', { PropertyPaneDropdown('apiBaseUrl', {
label: 'Api Base Url', label: 'Api Base Url',
description: 'По умолчанию — прод (https://api.tnsu.kz/approval-route). Для локальной разработки укажите http://localhost:5080.' selectedKey: this.properties.apiBaseUrl,
options: [
{ key: API_BASE_URL_PROD, text: `Прод (${API_BASE_URL_PROD})` },
{ key: API_BASE_URL_LOCAL, text: `Локально (${API_BASE_URL_LOCAL})` }
]
}), }),
PropertyPaneTextField('aadResourceId', { PropertyPaneTextField('aadResourceId', {
label: 'AAD Resource Id (App ID URI)', label: 'AAD Resource Id (App ID URI)',
@@ -63,6 +63,12 @@ export const DashboardScreen: React.FC<IDashboardScreenProps> = ({ api, onNaviga
description={texts.dashboard.resolveCard.description} description={texts.dashboard.resolveCard.description}
onClick={() => onNavigate('resolve')} onClick={() => onNavigate('resolve')}
/> />
<NavCard
icon="edit"
title={texts.dashboard.manageRequestsCard.title}
description={texts.dashboard.manageRequestsCard.description}
onClick={() => onNavigate('manageRequests')}
/>
</CardGrid> </CardGrid>
</div> </div>
); );
@@ -0,0 +1,10 @@
import * as React from 'react';
import { RequestTypeListSeries } from '../models';
import { ApprovalRouteApi } from '../services/api';
import { AsyncList, useAsyncList } from './useAsyncList';
/** Серии партиций списков сразу по всем типам заявок — сейчас нужен только дашборду (счётчик партиций). */
export function useRequestTypeListsAll(api: ApprovalRouteApi): AsyncList<RequestTypeListSeries> {
const load = React.useCallback(() => api.requestTypes.listsAll(), [api]);
return useAsyncList(load);
}
@@ -102,6 +102,10 @@ export const texts = {
resolveCard: { resolveCard: {
title: 'Проверка маршрута', title: 'Проверка маршрута',
description: 'Как разрешится маршрут для конкретного пользователя' description: 'Как разрешится маршрут для конкретного пользователя'
},
manageRequestsCard: {
title: 'Редактирование заявок',
description: 'Правка маршрута согласования конкретной заявки'
} }
}, },