Merge branch 'main' of http://git.tnsu.kz/timur.gorodetskiy/request-portal
Tests / frontend-test (push) Successful in 2m7s
Tests / frontend-test (push) Successful in 2m7s
This commit is contained in:
@@ -16,6 +16,6 @@
|
||||
"title": { "default": "request-portal" },
|
||||
"description": { "default": "request-portal description" },
|
||||
"officeFabricIconFontName": "Page",
|
||||
"properties": { "notificationsEnabled": true, "edoApiBaseUrl": "https://10.0.1.225:8443" }
|
||||
"properties": { "notificationsEnabled": true, "edoApiBaseUrl": "https://edo.tnsu.kz" }
|
||||
}]
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
APPROVAL_API_BASE_URL_LOCAL,
|
||||
APPROVAL_API_BASE_URL_PROD,
|
||||
EDO_API_BASE_URL_LOCAL,
|
||||
EDO_API_BASE_URL_PROD,
|
||||
EDO_API_BASE_URL_STAGE,
|
||||
setApprovalApiBaseUrl,
|
||||
setEdoApiBaseUrl,
|
||||
@@ -66,7 +67,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.properties.edoApiBaseUrl = this.properties.edoApiBaseUrl || EDO_API_BASE_URL_STAGE;
|
||||
this.properties.edoApiBaseUrl = this.properties.edoApiBaseUrl || EDO_API_BASE_URL_PROD;
|
||||
setEdoApiBaseUrl(this.properties.edoApiBaseUrl);
|
||||
this._applyNotificationSettings();
|
||||
|
||||
@@ -99,7 +100,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.properties.edoApiBaseUrl = this.properties.edoApiBaseUrl || EDO_API_BASE_URL_STAGE;
|
||||
this.properties.edoApiBaseUrl = this.properties.edoApiBaseUrl || EDO_API_BASE_URL_PROD;
|
||||
setEdoApiBaseUrl(this.properties.edoApiBaseUrl);
|
||||
this._applyNotificationSettings();
|
||||
|
||||
@@ -235,8 +236,9 @@ export default class RequestPortalWebPart extends BaseClientSideWebPart<IRequest
|
||||
groupFields: [
|
||||
PropertyPaneDropdown('edoApiBaseUrl', {
|
||||
label: 'С каким ЭДО работать',
|
||||
selectedKey: this.properties.edoApiBaseUrl || EDO_API_BASE_URL_STAGE,
|
||||
selectedKey: this.properties.edoApiBaseUrl || EDO_API_BASE_URL_PROD,
|
||||
options: [
|
||||
{ key: EDO_API_BASE_URL_PROD, text: `Прод (${EDO_API_BASE_URL_PROD})` },
|
||||
{ key: EDO_API_BASE_URL_STAGE, text: `Стейдж (${EDO_API_BASE_URL_STAGE})` },
|
||||
{ key: EDO_API_BASE_URL_LOCAL, text: `Локально (${EDO_API_BASE_URL_LOCAL})` }
|
||||
]
|
||||
|
||||
@@ -64,15 +64,17 @@ export const EDO_API_CLIENT_ID = APPROVAL_API_CLIENT_ID;
|
||||
export const EDO_API_BASE_URL_LOCAL = 'https://localhost:7016';
|
||||
/** Стейджинг ЭДО. Сертификат самоподписанный: браузер должен ему доверять, иначе запрос не уйдёт. */
|
||||
export const EDO_API_BASE_URL_STAGE = 'https://10.0.1.225:8443';
|
||||
/** Прод ЭДО — значение по умолчанию. */
|
||||
export const EDO_API_BASE_URL_PROD = 'https://edo.tnsu.kz';
|
||||
|
||||
// Настраивается свойством веб-части edoApiBaseUrl (селект в панели свойств) — тот же
|
||||
// модульный синглтон, что и approvalApiBaseUrl выше.
|
||||
let _edoApiBaseUrl = EDO_API_BASE_URL_STAGE;
|
||||
let _edoApiBaseUrl = EDO_API_BASE_URL_PROD;
|
||||
|
||||
export function setEdoApiBaseUrl(url: string): void {
|
||||
// Хвостовые слэши отбрасываем: адрес склеивается с путём «/api/...», а в панели
|
||||
// свойств его могли вписать с «/» на конце.
|
||||
_edoApiBaseUrl = (url || EDO_API_BASE_URL_STAGE).trim().replace(/\/+$/, '');
|
||||
_edoApiBaseUrl = (url || EDO_API_BASE_URL_PROD).trim().replace(/\/+$/, '');
|
||||
}
|
||||
|
||||
export function getEdoApiBaseUrl(): string {
|
||||
|
||||
Reference in New Issue
Block a user