spitfirepm 23.8582.1 → 23.8582.3
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/dist/globals.d.ts +7 -0
- package/dist/sfRESTClient.d.ts +1 -0
- package/dist/sfRESTClient.js +169 -15
- package/dist/sfRESTClient.js.map +1 -1
- package/package.json +1 -1
package/dist/globals.d.ts
CHANGED
|
@@ -10,6 +10,9 @@ declare global {
|
|
|
10
10
|
interface DashboardRefreshPartByName {
|
|
11
11
|
(partName: string): void;
|
|
12
12
|
}
|
|
13
|
+
interface DocumentWindowOpen {
|
|
14
|
+
(id: string, DocSessionKey: string, dsCacheKey: string, DWONotificationCount: number, DataLockFlag: number, WatchedFileKeys: string[]): Promise<string>;
|
|
15
|
+
}
|
|
13
16
|
interface DMKMethod {
|
|
14
17
|
(dmk: GUID): void;
|
|
15
18
|
}
|
|
@@ -81,8 +84,12 @@ declare global {
|
|
|
81
84
|
activateExchangeToken: StringThenBooleanPromise;
|
|
82
85
|
dashboardHeartbeat: HeartbeatMonitor;
|
|
83
86
|
dashboardOpenLink: DashboardOpenLink;
|
|
87
|
+
documentWindowOpen: DocumentWindowOpen;
|
|
84
88
|
sessionAlive: SimpleBooleanPromise;
|
|
85
89
|
subscribeToDocument: DMKMethod;
|
|
90
|
+
writeToServerLog: {
|
|
91
|
+
(msg: string): void;
|
|
92
|
+
};
|
|
86
93
|
};
|
|
87
94
|
}
|
|
88
95
|
export interface iWebixObjectSkeleton {
|
package/dist/sfRESTClient.d.ts
CHANGED
|
@@ -220,6 +220,7 @@ export type PagePartList = {
|
|
|
220
220
|
export interface iDocumentModel extends iDocumentModelBase {
|
|
221
221
|
DocHeaderData: _SwaggerClientExports.DocMasterDetail;
|
|
222
222
|
CurrentRouteRow: _SwaggerClientExports.DocRoute;
|
|
223
|
+
CurrentAttachments: _SwaggerClientExports.DocAttachment[];
|
|
223
224
|
[key: string]: any;
|
|
224
225
|
}
|
|
225
226
|
/** Spitfire PM Client
|
package/dist/sfRESTClient.js
CHANGED
|
@@ -8,7 +8,7 @@ const BrowserExtensionChecker_1 = require("./BrowserExtensionChecker");
|
|
|
8
8
|
const RESTClientBase = require("./APIClientBase"); // avoid conflict with same in SwaggerClient when loaded by classic UI
|
|
9
9
|
const string_extensions_1 = require("./string.extensions");
|
|
10
10
|
//import {dialog} from "jquery-ui";
|
|
11
|
-
const ClientPackageVersion = "23.8582.
|
|
11
|
+
const ClientPackageVersion = "23.8582.3";
|
|
12
12
|
// originally modified for typescript and linter requirements by Uladzislau Kumakou
|
|
13
13
|
var LoggingLevels;
|
|
14
14
|
(function (LoggingLevels) {
|
|
@@ -2824,6 +2824,8 @@ class sfRestClient {
|
|
|
2824
2824
|
let result = "";
|
|
2825
2825
|
if (this.IsDocumentPage())
|
|
2826
2826
|
result = sfRestClient._WCC.DataPK;
|
|
2827
|
+
if (result === this.EmptyKey)
|
|
2828
|
+
result = this.GetPageDocumentModel()?._DMK;
|
|
2827
2829
|
else if (this.IsProjectPage())
|
|
2828
2830
|
result = sfRestClient._WCC.Project;
|
|
2829
2831
|
if (!result)
|
|
@@ -4755,13 +4757,14 @@ class sfRestClient {
|
|
|
4755
4757
|
static StartSignalRClientHub() {
|
|
4756
4758
|
if (self !== top)
|
|
4757
4759
|
return;
|
|
4758
|
-
if (!$.connection || !$.connection.sfPMSHub) {
|
|
4760
|
+
if (!$.connection || !$.connection.sfPMSHub || !top.sfClient) {
|
|
4759
4761
|
setTimeout("top.sfClient.exports.sfRestClient.StartSignalRClientHub(); // retry", 234);
|
|
4760
4762
|
return;
|
|
4761
4763
|
}
|
|
4762
|
-
|
|
4764
|
+
let RESTClient = top.sfClient;
|
|
4765
|
+
if (sfRestClient.IsPowerUXPage() && !RESTClient.IsPageOfType(RESTClient.PageTypeNames.Document)) {
|
|
4763
4766
|
if (!sfRestClient._NextPingTimerID)
|
|
4764
|
-
sfRestClient._NextPingTimerID = setTimeout("
|
|
4767
|
+
sfRestClient._NextPingTimerID = setTimeout("RESTClient.pingServer();", 234);
|
|
4765
4768
|
}
|
|
4766
4769
|
if ($.connection) {
|
|
4767
4770
|
var sfHub = $.connection.sfPMSHub;
|
|
@@ -4842,7 +4845,7 @@ class sfRestClient {
|
|
|
4842
4845
|
if (HubEvent.isDefaultPrevented())
|
|
4843
4846
|
return;
|
|
4844
4847
|
if (top) {
|
|
4845
|
-
var RESTClient = top.sfClient;
|
|
4848
|
+
//var RESTClient = top.sfClient;
|
|
4846
4849
|
var TopName = top.name;
|
|
4847
4850
|
if (TopName && TopName === 'v/LibView.aspx')
|
|
4848
4851
|
TopName = "Dashboard";
|
|
@@ -4857,7 +4860,7 @@ class sfRestClient {
|
|
|
4857
4860
|
}
|
|
4858
4861
|
else {
|
|
4859
4862
|
if (request.startsWith("PopDoc") && typeof top?.sfClient.PopDoc === "function")
|
|
4860
|
-
request = `
|
|
4863
|
+
request = `RESTClient.${request}`;
|
|
4861
4864
|
try {
|
|
4862
4865
|
eval(request);
|
|
4863
4866
|
}
|
|
@@ -4993,8 +4996,9 @@ class sfRestClient {
|
|
|
4993
4996
|
setTimeout(function () {
|
|
4994
4997
|
$.connection.hub.start().done(function hubReStart() {
|
|
4995
4998
|
console.log(`${new Date().toLocaleTimeString()} sfPMSHub Hub has been re-started...`);
|
|
4996
|
-
if (
|
|
4997
|
-
|
|
4999
|
+
if (RESTClient.IsDocumentPage()) {
|
|
5000
|
+
const DMK = RESTClient.GetPagePK();
|
|
5001
|
+
sfHub.server.subscribeToDocument(DMK);
|
|
4998
5002
|
}
|
|
4999
5003
|
});
|
|
5000
5004
|
}, sfHub.client.ReConnectDelay); // Restart connection after 5 seconds.
|
|
@@ -5004,8 +5008,18 @@ class sfRestClient {
|
|
|
5004
5008
|
$.connection.hub.start().done(function () {
|
|
5005
5009
|
console.log(`${new Date().toSFLogTimeString()} sfPMSHub: started...`);
|
|
5006
5010
|
//if (typeof top.sfPMSHub === "undefined") top.sfPMSHub = $.connection.sfPMSHub; // $.connection.hub.proxies.sfpmshub;
|
|
5007
|
-
if (
|
|
5008
|
-
|
|
5011
|
+
if (RESTClient.IsDocumentPage()) {
|
|
5012
|
+
const WaitAndSubscribe = () => {
|
|
5013
|
+
const DMK = RESTClient.GetPagePK();
|
|
5014
|
+
if (DMK === RESTClient.EmptyKey) {
|
|
5015
|
+
setTimeout(() => { WaitAndSubscribe(); }, 222);
|
|
5016
|
+
console.log(`${new Date().toSFLogTimeString()} sfPMSHub: waiting for DMK to resolve...`);
|
|
5017
|
+
return;
|
|
5018
|
+
}
|
|
5019
|
+
sfHub.server.subscribeToDocument(DMK);
|
|
5020
|
+
console.log(`${new Date().toSFLogTimeString()} sfPMSHub: subscribedToDocument...`);
|
|
5021
|
+
};
|
|
5022
|
+
setTimeout(() => { WaitAndSubscribe(); }, 222);
|
|
5009
5023
|
}
|
|
5010
5024
|
});
|
|
5011
5025
|
}
|
|
@@ -5045,14 +5059,14 @@ class sfRestClient {
|
|
|
5045
5059
|
try {
|
|
5046
5060
|
var RESTClient = this;
|
|
5047
5061
|
if (!top?.sfPMSHub || top.sfPMSHub.connection.state !== $.signalR.connectionState.connected) {
|
|
5048
|
-
sfRestClient._NextPingTimerID = setTimeout("
|
|
5062
|
+
sfRestClient._NextPingTimerID = setTimeout("RESTClient.pingServer(); // wait for hub ", 123);
|
|
5049
5063
|
return;
|
|
5050
5064
|
}
|
|
5051
5065
|
if (this.IsPageOfType(this.PageTypeNames.Login)) {
|
|
5052
5066
|
if (sfRestClient._Options.LogLevel >= LoggingLevels.Verbose)
|
|
5053
5067
|
console.log("pingServer() Log in pending (ignored)");
|
|
5054
5068
|
this.CheckForSystemNotification();
|
|
5055
|
-
sfRestClient._NextPingTimerID = setTimeout("
|
|
5069
|
+
sfRestClient._NextPingTimerID = setTimeout("RESTClient.pingServer(); // wait for login ", 2345);
|
|
5056
5070
|
return;
|
|
5057
5071
|
}
|
|
5058
5072
|
var retryInterval = (sfRestClient._Options.BasicPingServerInterval * (1.1 + Math.random()));
|
|
@@ -5064,8 +5078,148 @@ class sfRestClient {
|
|
|
5064
5078
|
return;
|
|
5065
5079
|
sfRestClient.PageServerPingAttempts++;
|
|
5066
5080
|
top.sfPMSHub.server.sessionAlive();
|
|
5067
|
-
|
|
5068
|
-
|
|
5081
|
+
if (RESTClient.IsDocumentPage()) {
|
|
5082
|
+
try {
|
|
5083
|
+
let $DocUI = RESTClient.GetPowerUXDocumentUI();
|
|
5084
|
+
let DocModel = RESTClient.GetPageDocumentModel();
|
|
5085
|
+
// var $DocBar = top.$("DIV.clsPartRowRight");
|
|
5086
|
+
// var $DocBarSignal = $DocBar.find(".clsSignalR");
|
|
5087
|
+
// if ($DocBarSignal.length === 0 && $DocBar.find("img").length > 0) $DocBarSignal = $DocBar.prepend('<i class="fa-duotone fa-signal-stream-slash clsSignalR" ></i>').find(".clsSignalR");
|
|
5088
|
+
let WatchedFileKeys = [];
|
|
5089
|
+
if (DocModel.CurrentAttachments)
|
|
5090
|
+
WatchedFileKeys = DocModel.CurrentAttachments.map((el) => el.DocKey);
|
|
5091
|
+
self.sfPMSHub.server.documentWindowOpen(id, RESTClient.GetPageContextValue("DocSessionKey "), RESTClient.GetPageContextValue("dsCacheKey"), sfRestClient.PageNotificationCount, RESTClient.GetPageContextValue("DataLockFlag"), WatchedFileKeys)
|
|
5092
|
+
.then((responseText) => {
|
|
5093
|
+
let msgText = "";
|
|
5094
|
+
try {
|
|
5095
|
+
if (responseText) {
|
|
5096
|
+
var isOK = (responseText.startsWith("OK"));
|
|
5097
|
+
$("SPAN#spnIdleTime.sfPingHealthTip").detach();
|
|
5098
|
+
//$(jqSelector).html(responseText);
|
|
5099
|
+
//$sfModalDialog.dialog('option', 'width', 'auto');
|
|
5100
|
+
var RecentIdleMS = Date.now() - sfRestClient.LastActivityAt;
|
|
5101
|
+
var CanAutoSave = isOK;
|
|
5102
|
+
if (isOK) {
|
|
5103
|
+
var d = new Date();
|
|
5104
|
+
var hourNow = d.getHours();
|
|
5105
|
+
if (((sfRestClient.PageNotificationCount > 33) && (hourNow < 2)) || (((sfRestClient.PageNotificationCount * retryInterval) > MaxIdleTime))) {
|
|
5106
|
+
$ALERT = RESTClient.jqAlert("This window has been idle and will close in 1 minute. Close this dialog to keep working!");
|
|
5107
|
+
var autoClose = setTimeout('top.ResetUnsavedChangesAndCloseThisWindow();', 66000);
|
|
5108
|
+
$ALERT.on('dialogclose', function (event) {
|
|
5109
|
+
clearTimeout(autoClose);
|
|
5110
|
+
//top.SaveThisDoc("IDLE");
|
|
5111
|
+
});
|
|
5112
|
+
retryInterval = 99000;
|
|
5113
|
+
}
|
|
5114
|
+
}
|
|
5115
|
+
else {
|
|
5116
|
+
if (responseText == "NAK: Not Authenticated") {
|
|
5117
|
+
msgText = "You are no longer logged into this server. This window will close when you click OK";
|
|
5118
|
+
retryInterval = -1;
|
|
5119
|
+
ActionAfterAlert = "Close";
|
|
5120
|
+
//darnSoon.resolve(); //makes msgReady be ready
|
|
5121
|
+
}
|
|
5122
|
+
else if (responseText.startsWith("NAK:")) {
|
|
5123
|
+
msgText = responseText.substring(5).trim();
|
|
5124
|
+
retryInterval = -1;
|
|
5125
|
+
ActionAfterAlert = "Reload";
|
|
5126
|
+
self.sfPMSHub.server.writeToServerLog(`SendDocWindowOpenNotification(${id}) - auto-reload ${msgText}`);
|
|
5127
|
+
self.location.reload();
|
|
5128
|
+
}
|
|
5129
|
+
else if (responseText.startsWith("FAIL:")) {
|
|
5130
|
+
msgText = responseText.substring(5).trim();
|
|
5131
|
+
retryInterval = -1;
|
|
5132
|
+
ActionAfterAlert = "Close";
|
|
5133
|
+
}
|
|
5134
|
+
// else if ((responseText.startsWith('[{"FileDocKey":')) &&
|
|
5135
|
+
// ((typeof $sfModalDialog != "object") || ($sfModalDialog.length != "number") || (!$sfModalDialog.is(":visible")))) {
|
|
5136
|
+
// var ldata = $.parseJSON(responseText);
|
|
5137
|
+
// var AIRContext = FrameContext($AIRFrame);
|
|
5138
|
+
// $.each(ldata, function (index, watchedFile) {
|
|
5139
|
+
// var tform = "";
|
|
5140
|
+
// var dform = "";
|
|
5141
|
+
// var fkey = watchedFile.FileDocKey;
|
|
5142
|
+
// var $FVC = AIRContext.$('IMG[DATA-fk="{0}"]'.format(fkey));
|
|
5143
|
+
// if ($FVC.length > 0) {
|
|
5144
|
+
// var newIconSrc = $FVC.attr('src');
|
|
5145
|
+
// // warning: fragile
|
|
5146
|
+
// newIconSrc = newIconSrc.substring(0, newIconSrc.lastIndexOf("/") + 1);
|
|
5147
|
+
// if (watchedFile.Status == "locked") newIconSrc = newIconSrc + "fileLocked.gif"
|
|
5148
|
+
// else if (watchedFile.Status == "unlocked" || watchedFile.Status == "checked in") newIconSrc = newIconSrc + "fileUnLocked.gif"
|
|
5149
|
+
// else if (watchedFile.Status == "checked out") newIconSrc = newIconSrc + "fileOut.gif"
|
|
5150
|
+
// $FVC.attr("src", newIconSrc);
|
|
5151
|
+
// }
|
|
5152
|
+
// });
|
|
5153
|
+
// msgText = "FYI: " // was The file share status has changed for
|
|
5154
|
+
// if (ldata.length == 1) {
|
|
5155
|
+
// var $FVC = AIRContext.$('IMG[DATA-fk="{0}"]'.format(ldata[0].FileDocKey));
|
|
5156
|
+
// msgText = msgText + $FVC.closest('TR').find('span[id$="lblFileTitle"]').text();
|
|
5157
|
+
// msgText = `${msgText} was ${ldata[0].Status} by ${ldata[0].UserName}`;
|
|
5158
|
+
// }
|
|
5159
|
+
// else {
|
|
5160
|
+
// msgText = msgText + "{0} files have been modified by other user(s)".format(ldata.length);
|
|
5161
|
+
// }
|
|
5162
|
+
// ActionAfterAlert = "";
|
|
5163
|
+
// if ($("DIV.sfUIjqPDL, SPAN.sfUICrtMsgTarget").length > 0) {
|
|
5164
|
+
// // we have found a PDF viewer or "Processing" dialog open...
|
|
5165
|
+
// // future: we could perhaps just ignore our own template files changing status
|
|
5166
|
+
// console.log(msgText);
|
|
5167
|
+
// msgText = "";
|
|
5168
|
+
// }
|
|
5169
|
+
// if (msgText) DisplayUserNotification(msgText,9876);
|
|
5170
|
+
// console.log(msgText);
|
|
5171
|
+
// msgText = "";
|
|
5172
|
+
// //darnSoon.resolve(); //makes msgReady be ready
|
|
5173
|
+
// }
|
|
5174
|
+
// changed by another now via SignalR
|
|
5175
|
+
// SysNotification are now via SignalR
|
|
5176
|
+
else if (responseText === "[]") {
|
|
5177
|
+
console.log("DWO: Empty response.");
|
|
5178
|
+
}
|
|
5179
|
+
else {
|
|
5180
|
+
msgText = responseText;
|
|
5181
|
+
retryInterval = -1;
|
|
5182
|
+
//darnSoon.resolve(); //makes msgReady be ready
|
|
5183
|
+
}
|
|
5184
|
+
if (msgText) {
|
|
5185
|
+
$ALERT = RESTClient.jqAlert(msgText);
|
|
5186
|
+
//if (DialogButtons) $ALERT.dialog('option', 'buttons', DialogButtons);
|
|
5187
|
+
}
|
|
5188
|
+
if (ActionAfterAlert.length > 0) {
|
|
5189
|
+
retryInterval = -1;
|
|
5190
|
+
$ALERT.on('dialogclose', function (event) {
|
|
5191
|
+
//if (ActionAfterAlert === "Close") self.ResetUnsavedChangesAndCloseThisWindow();
|
|
5192
|
+
if (ActionAfterAlert === "Reload")
|
|
5193
|
+
self.location.reload();
|
|
5194
|
+
//if (ActionAfterAlert) DotNetPostBack(ActionAfterAlert);
|
|
5195
|
+
});
|
|
5196
|
+
}
|
|
5197
|
+
}
|
|
5198
|
+
}
|
|
5199
|
+
}
|
|
5200
|
+
catch (rxx) {
|
|
5201
|
+
console.warn('SendDocWindowOpenNotification(' + id + ') - ', rxx);
|
|
5202
|
+
self.sfPMSHub.server.writeToServerLog(`SendDocWindowOpenNotification(${id}) - ${rxx}`);
|
|
5203
|
+
RESTClient.jqAlert('Problem processing heartbeat response; cause: ' + rxx.message);
|
|
5204
|
+
self.location.reload();
|
|
5205
|
+
}
|
|
5206
|
+
})
|
|
5207
|
+
.catch((rxx) => {
|
|
5208
|
+
console.warn('documentWindowOpen failed!', rxx);
|
|
5209
|
+
//var retryNow = PageServerPingBackFailed("dwo", id, failMessage, retryInterval / 2, "SendDocWindowOpenNotification");
|
|
5210
|
+
//if (retryNow) NextDWOEventID = setTimeout('SendDocWindowOpenNotification("' + id + '"); // dwo retry', retryInterval);
|
|
5211
|
+
});
|
|
5212
|
+
}
|
|
5213
|
+
catch (error) {
|
|
5214
|
+
if (error && error.message) {
|
|
5215
|
+
console.log('SendDocWindowOpenNotification(' + id + ') - ' + error.message);
|
|
5216
|
+
RESTClient.jqAlert('The server could not be contacted to reserve the resources for this document window: ' + error.message);
|
|
5217
|
+
}
|
|
5218
|
+
// how to recover??
|
|
5219
|
+
}
|
|
5220
|
+
}
|
|
5221
|
+
self.sfPMSHub.server.dashboardHeartbeat(id, sfRestClient.PageNotificationCount)
|
|
5222
|
+
.then(async (responseText) => {
|
|
5069
5223
|
if (responseText > "") {
|
|
5070
5224
|
var isOK = (responseText.startsWith("OK"));
|
|
5071
5225
|
//$(jqSelector).html(responseText);
|
|
@@ -5080,7 +5234,7 @@ class sfRestClient {
|
|
|
5080
5234
|
var TimeSinceLastActivity = Date.now() - sfRestClient.LastActivityAt;
|
|
5081
5235
|
if (((TimeSinceLastActivity > 525600) && (hourNow < 2)) || ((TimeSinceLastActivity > MaxIdleTime))) {
|
|
5082
5236
|
RESTClient.DisplayUserNotification("This window has been idle and will logoff in 1 minute. ", 60000);
|
|
5083
|
-
setTimeout(`location="${sfRestClient.LogoutPageURL('idle')}";`, 66000);
|
|
5237
|
+
setTimeout(`top.location="${sfRestClient.LogoutPageURL('idle')}";`, 66000);
|
|
5084
5238
|
retryInterval = 99000;
|
|
5085
5239
|
}
|
|
5086
5240
|
}
|