barsa-novin-ray-core 2.0.77 → 2.0.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/lib/abstract-classes/barsa-api.mjs +4 -1
- package/esm2022/lib/barsa-novin-ray-core.module.mjs +43 -51
- package/esm2022/lib/services/barsa-storage.service.mjs +1 -4
- package/esm2022/lib/services/portal.service.mjs +34 -25
- package/fesm2022/barsa-novin-ray-core.mjs +78 -77
- package/fesm2022/barsa-novin-ray-core.mjs.map +1 -1
- package/lib/abstract-classes/barsa-api.d.ts +2 -0
- package/lib/services/portal.service.d.ts +1 -0
- package/package.json +1 -1
|
@@ -25,6 +25,9 @@ class BarsaApi {
|
|
|
25
25
|
static get GanttChartHelper() {
|
|
26
26
|
return GanttChartHelper;
|
|
27
27
|
}
|
|
28
|
+
static get Offline() {
|
|
29
|
+
return Offline;
|
|
30
|
+
}
|
|
28
31
|
static get Ext() {
|
|
29
32
|
return Ext;
|
|
30
33
|
}
|
|
@@ -3708,32 +3711,41 @@ class PortalService {
|
|
|
3708
3711
|
}
|
|
3709
3712
|
loadServerStartupData() {
|
|
3710
3713
|
return new Promise((resolve, reject) => {
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3714
|
+
if (!BarsaApi.Offline.hasInit) {
|
|
3715
|
+
BarsaApi.Offline.afterInitCallback = () => {
|
|
3716
|
+
this._loadServerStartupData(resolve, reject);
|
|
3717
|
+
};
|
|
3718
|
+
}
|
|
3719
|
+
else
|
|
3720
|
+
this._loadServerStartupData(resolve, reject);
|
|
3721
|
+
});
|
|
3722
|
+
}
|
|
3723
|
+
_loadServerStartupData(resolve, reject) {
|
|
3724
|
+
const ajaxHelper = typeof AjaxHelper2 === 'undefined' ? AjaxHelper : AjaxHelper2;
|
|
3725
|
+
ajaxHelper.AjaxRequest('/api/base/ServerStartupData', {}, false, (response) => {
|
|
3726
|
+
let dataText = response.responseText;
|
|
3727
|
+
dataText = dataText.replace(/'/g, '"');
|
|
3728
|
+
dataText = BarsaApi.Common.Util.ReplaceArabicCharchter(dataText);
|
|
3729
|
+
BarsaApi.LoginForm.PortalInitialize(dataText);
|
|
3730
|
+
if (typeof BarsaApi.LoginFormData.IsAnonymous === 'undefined') {
|
|
3731
|
+
if (BarsaApi.LoginFormData?.error?.userMessage) {
|
|
3732
|
+
BarsaApi.Bw.Msg.Error(BarsaApi.LoginFormData?.error?.userMessage);
|
|
3724
3733
|
}
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
config[0].redirectTo = 'servicedesk';
|
|
3728
|
-
this._router.resetConfig(config);
|
|
3734
|
+
else {
|
|
3735
|
+
BarsaApi.Bw.Msg.Error('امکان ورود با کاربر پورتال وجود ندارد.');
|
|
3729
3736
|
}
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
}
|
|
3736
|
-
|
|
3737
|
+
}
|
|
3738
|
+
if (BarsaApi.LoginFormData.IsServiceDesk) {
|
|
3739
|
+
const config = this._router.config;
|
|
3740
|
+
config[0].redirectTo = 'servicedesk';
|
|
3741
|
+
this._router.resetConfig(config);
|
|
3742
|
+
}
|
|
3743
|
+
this._initAfterLoginFormData();
|
|
3744
|
+
resolve(BarsaApi.LoginFormData);
|
|
3745
|
+
}, () => {
|
|
3746
|
+
alert('error in get server startup data.');
|
|
3747
|
+
reject(null);
|
|
3748
|
+
}, null);
|
|
3737
3749
|
}
|
|
3738
3750
|
ShowFormPanelControl(formpanelCtrlr, router, activatedRoute, dialogComponent, isPage, vcr, isReload = false) {
|
|
3739
3751
|
if (!formpanelCtrlr) {
|
|
@@ -6389,9 +6401,6 @@ class BarsaStorageService {
|
|
|
6389
6401
|
init() {
|
|
6390
6402
|
this.interceptXhr();
|
|
6391
6403
|
const localStorage = this._localStorageService;
|
|
6392
|
-
// we set runtime structure version in localstorage
|
|
6393
|
-
// in indexdb service we can read current version and cached version and
|
|
6394
|
-
// if they are different we need to to add version to indexdb database
|
|
6395
6404
|
const db_version = localStorage.getItem(this.DBNAME_VERSION_KEY);
|
|
6396
6405
|
const bazavari_version = localStorage.getItem(this.BAZAVARI_VERSION_KEY);
|
|
6397
6406
|
let dbVer = 0;
|
|
@@ -13733,6 +13742,34 @@ const pipes = [
|
|
|
13733
13742
|
IsExpandedNodePipe,
|
|
13734
13743
|
ThImageOrIconePipe
|
|
13735
13744
|
];
|
|
13745
|
+
const functionL1 = function () {
|
|
13746
|
+
if (BarsaApi.LoginFormData.Culture === 'fa-IR') {
|
|
13747
|
+
return Promise.resolve();
|
|
13748
|
+
}
|
|
13749
|
+
return fetch(`/Localization/Translation/data_${BarsaApi.LoginFormData.Culture}.json`)
|
|
13750
|
+
.then(function (res) {
|
|
13751
|
+
return res.json();
|
|
13752
|
+
})
|
|
13753
|
+
.then(function (res) {
|
|
13754
|
+
if (BBB) {
|
|
13755
|
+
// eslint-disable
|
|
13756
|
+
BBB = { ...BarsaApi.BBB, ...res };
|
|
13757
|
+
}
|
|
13758
|
+
});
|
|
13759
|
+
};
|
|
13760
|
+
const functionL2 = function (portalService, titleService) {
|
|
13761
|
+
portalService.loadUserPortalSetting();
|
|
13762
|
+
portalService.loadPortalDataSync();
|
|
13763
|
+
if (portalService.portalData?.Title) {
|
|
13764
|
+
titleService.setTitle(portalService.portalData?.Title);
|
|
13765
|
+
}
|
|
13766
|
+
if (BarsaApi.LoginFormData.IsAnonymous && !BarsaApi.LoginFormData.IsServiceDesk) {
|
|
13767
|
+
return portalService.loadSystem(BarsaApi.LoginFormData.PortalSystemId); // login form need just portal system
|
|
13768
|
+
}
|
|
13769
|
+
else {
|
|
13770
|
+
return portalService.loadSystem(); // load all systems if user is logged in
|
|
13771
|
+
}
|
|
13772
|
+
};
|
|
13736
13773
|
class BarsaNovinRayCoreModule extends BaseModule {
|
|
13737
13774
|
constructor(dcm, componentFactoryResolver) {
|
|
13738
13775
|
super(dcm, componentFactoryResolver, 'BarsaNovinRayCoreModule');
|
|
@@ -13746,8 +13783,20 @@ class BarsaNovinRayCoreModule extends BaseModule {
|
|
|
13746
13783
|
providers: [
|
|
13747
13784
|
{
|
|
13748
13785
|
provide: APP_INITIALIZER,
|
|
13749
|
-
useFactory: (portalService) => () => portalService.loadServerStartupData()
|
|
13750
|
-
|
|
13786
|
+
useFactory: (portalService, titleService, promptUpdateService, barsaStorageService, swCommunication) => () => portalService.loadServerStartupData().then(() => {
|
|
13787
|
+
Promise.all([functionL1(), functionL2(portalService, titleService)]).finally(() => {
|
|
13788
|
+
promptUpdateService.checkForUpdate();
|
|
13789
|
+
barsaStorageService.init();
|
|
13790
|
+
swCommunication.init();
|
|
13791
|
+
});
|
|
13792
|
+
}),
|
|
13793
|
+
deps: [
|
|
13794
|
+
PortalService,
|
|
13795
|
+
Title,
|
|
13796
|
+
PromptUpdateService,
|
|
13797
|
+
BarsaStorageService,
|
|
13798
|
+
ServiceWorkerCommuncationService
|
|
13799
|
+
],
|
|
13751
13800
|
multi: true
|
|
13752
13801
|
},
|
|
13753
13802
|
{
|
|
@@ -13765,54 +13814,6 @@ class BarsaNovinRayCoreModule extends BaseModule {
|
|
|
13765
13814
|
deps: [NotificationService],
|
|
13766
13815
|
multi: true
|
|
13767
13816
|
},
|
|
13768
|
-
{
|
|
13769
|
-
provide: APP_INITIALIZER,
|
|
13770
|
-
useFactory: (promptUpdateService, barsaStorageService, swCommunication) => () => {
|
|
13771
|
-
promptUpdateService.checkForUpdate();
|
|
13772
|
-
barsaStorageService.init();
|
|
13773
|
-
swCommunication.init();
|
|
13774
|
-
},
|
|
13775
|
-
deps: [PromptUpdateService, BarsaStorageService, ServiceWorkerCommuncationService],
|
|
13776
|
-
multi: true
|
|
13777
|
-
},
|
|
13778
|
-
{
|
|
13779
|
-
provide: APP_INITIALIZER,
|
|
13780
|
-
useFactory: () => () => {
|
|
13781
|
-
if (BarsaApi.LoginFormData.Culture === 'fa-IR') {
|
|
13782
|
-
return Promise.resolve();
|
|
13783
|
-
}
|
|
13784
|
-
return fetch(`/Localization/Translation/data_${BarsaApi.LoginFormData.Culture}.json`)
|
|
13785
|
-
.then(function (res) {
|
|
13786
|
-
return res.json();
|
|
13787
|
-
})
|
|
13788
|
-
.then(function (res) {
|
|
13789
|
-
if (BBB) {
|
|
13790
|
-
// eslint-disable
|
|
13791
|
-
BBB = { ...BarsaApi.BBB, ...res };
|
|
13792
|
-
}
|
|
13793
|
-
});
|
|
13794
|
-
},
|
|
13795
|
-
deps: [],
|
|
13796
|
-
multi: true
|
|
13797
|
-
},
|
|
13798
|
-
{
|
|
13799
|
-
provide: APP_INITIALIZER,
|
|
13800
|
-
useFactory: (portalService, titleService) => () => {
|
|
13801
|
-
portalService.loadUserPortalSetting();
|
|
13802
|
-
portalService.loadPortalDataSync();
|
|
13803
|
-
if (portalService.portalData?.Title) {
|
|
13804
|
-
titleService.setTitle(portalService.portalData?.Title);
|
|
13805
|
-
}
|
|
13806
|
-
if (BarsaApi.LoginFormData.IsAnonymous && !BarsaApi.LoginFormData.IsServiceDesk) {
|
|
13807
|
-
return portalService.loadSystem(BarsaApi.LoginFormData.PortalSystemId); // login form need just portal system
|
|
13808
|
-
}
|
|
13809
|
-
else {
|
|
13810
|
-
return portalService.loadSystem(); // load all systems if user is logged in
|
|
13811
|
-
}
|
|
13812
|
-
},
|
|
13813
|
-
deps: [PortalService, Title],
|
|
13814
|
-
multi: true
|
|
13815
|
-
},
|
|
13816
13817
|
...pipes,
|
|
13817
13818
|
PortalService,
|
|
13818
13819
|
UploadService,
|