@fluxhub/fluxhub-lib 19.0.67 → 19.0.68
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.
|
@@ -36268,6 +36268,136 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
36268
36268
|
}]
|
|
36269
36269
|
}], ctorParameters: () => [{ type: i3.ToastrService }, { type: i1$1.HttpClient }, { type: AppService }] });
|
|
36270
36270
|
|
|
36271
|
+
class QueryOpenService {
|
|
36272
|
+
http;
|
|
36273
|
+
toastr;
|
|
36274
|
+
app_s;
|
|
36275
|
+
uti_s;
|
|
36276
|
+
headers;
|
|
36277
|
+
url = null;
|
|
36278
|
+
constructor(http, toastr, app_s, uti_s) {
|
|
36279
|
+
this.http = http;
|
|
36280
|
+
this.toastr = toastr;
|
|
36281
|
+
this.app_s = app_s;
|
|
36282
|
+
this.uti_s = uti_s;
|
|
36283
|
+
this.url = this.app_s.API_ENDPOINT + this.app_s.OPEN_QUERY_ENDPOINT; // URL to web API
|
|
36284
|
+
}
|
|
36285
|
+
/**
|
|
36286
|
+
* Perform a query on the server
|
|
36287
|
+
*
|
|
36288
|
+
* @param queryp the query object
|
|
36289
|
+
* @param displayError whether to show a toaster with the error message in the UI
|
|
36290
|
+
* @return Observable with result, throws an error if response invalid or not ok
|
|
36291
|
+
*/
|
|
36292
|
+
doQuery(queryp, displayError = true, url_sec = null) {
|
|
36293
|
+
this.app_s.start();
|
|
36294
|
+
//console.log('queryp before ',queryp);
|
|
36295
|
+
this.headers = new HttpHeaders({
|
|
36296
|
+
"Content-Type": "application/json"
|
|
36297
|
+
});
|
|
36298
|
+
if (url_sec == null)
|
|
36299
|
+
this.url = this.app_s.API_ENDPOINT + this.app_s.QUERY_ENDPOINT;
|
|
36300
|
+
else
|
|
36301
|
+
this.url = url_sec;
|
|
36302
|
+
// console.log('QueryService url: '+ this.url);
|
|
36303
|
+
if (queryp.types != null && queryp.sql.indexOf("_MULTI") == -1)
|
|
36304
|
+
for (let i = 0; i < queryp.types.length; i++) {
|
|
36305
|
+
if (queryp.values[i] == null)
|
|
36306
|
+
queryp.values[i] = "dbnull";
|
|
36307
|
+
else {
|
|
36308
|
+
if (queryp.types[i] == "boolean")
|
|
36309
|
+
if (queryp.values[i])
|
|
36310
|
+
queryp.values[i] = "1";
|
|
36311
|
+
else
|
|
36312
|
+
queryp.values[i] = "0";
|
|
36313
|
+
if (queryp.types[i] == "int") {
|
|
36314
|
+
if (queryp.values[i] + "" == "")
|
|
36315
|
+
queryp.values[i] = "dbnull";
|
|
36316
|
+
else {
|
|
36317
|
+
if (isNaN(queryp.values[i]) || queryp.values[i] === Infinity)
|
|
36318
|
+
queryp.values[i] = "0";
|
|
36319
|
+
else
|
|
36320
|
+
queryp.values[i] = "" + queryp.values[i];
|
|
36321
|
+
}
|
|
36322
|
+
}
|
|
36323
|
+
if (queryp.types[i] == "string")
|
|
36324
|
+
queryp.values[i] = "" + queryp.values[i];
|
|
36325
|
+
if (queryp.types[i] == "date") {
|
|
36326
|
+
queryp.values[i] = this.uti_s.sql_date(queryp.values[i]);
|
|
36327
|
+
if (queryp.values[i].split("0").join("") == "NaN-NaN-NaN")
|
|
36328
|
+
queryp.values[i] = "dbnull";
|
|
36329
|
+
}
|
|
36330
|
+
if (queryp.types[i] == "datetime") {
|
|
36331
|
+
queryp.values[i] = this.uti_s.sql_date_time(queryp.values[i]);
|
|
36332
|
+
if (queryp.values[i].split("0").join("") == "NaN-NaN-NaN NaN:NaN")
|
|
36333
|
+
queryp.values[i] = "dbnull";
|
|
36334
|
+
}
|
|
36335
|
+
if (queryp.types[i] == "string" && queryp.values[i] == null)
|
|
36336
|
+
queryp.values[i] = "dbnull";
|
|
36337
|
+
if (queryp.types[i] == "decimal") {
|
|
36338
|
+
if (queryp.values[i] + "" == "")
|
|
36339
|
+
queryp.values[i] = "dbnull";
|
|
36340
|
+
else {
|
|
36341
|
+
if (isNaN(queryp.values[i]) || queryp.values[i] === Infinity)
|
|
36342
|
+
queryp.values[i] = "0";
|
|
36343
|
+
else
|
|
36344
|
+
queryp.values[i] = "" + queryp.values[i];
|
|
36345
|
+
}
|
|
36346
|
+
}
|
|
36347
|
+
}
|
|
36348
|
+
}
|
|
36349
|
+
//console.log('queryp after ',queryp);
|
|
36350
|
+
let post_v = JSON.stringify(queryp);
|
|
36351
|
+
// Check if running on localhost:4200
|
|
36352
|
+
const isLocalhost = window.location.hostname === 'localhost' && window.location.port === '4200';
|
|
36353
|
+
// se rilevo che sono sono localhost:4200 scrivo su console
|
|
36354
|
+
if (isLocalhost) {
|
|
36355
|
+
console.log("QueryService: " + post_v);
|
|
36356
|
+
}
|
|
36357
|
+
return this.http.post(this.url, post_v, { headers: this.headers }).pipe(map((res) => {
|
|
36358
|
+
this.app_s.complete();
|
|
36359
|
+
// Handle errors, display if enabled
|
|
36360
|
+
let err;
|
|
36361
|
+
if (!res) {
|
|
36362
|
+
err = new Error("Empty server response");
|
|
36363
|
+
}
|
|
36364
|
+
else if (res.result_msg === "KO") {
|
|
36365
|
+
err = new Error(res.msg);
|
|
36366
|
+
}
|
|
36367
|
+
if (err) {
|
|
36368
|
+
console.error(err);
|
|
36369
|
+
if (displayError) {
|
|
36370
|
+
console.error(queryp.sql + ' ' + err.message);
|
|
36371
|
+
if (err.message.indexOf('ORA-50012') == -1)
|
|
36372
|
+
this.toastr.error(queryp.sql + ' ' + err.message);
|
|
36373
|
+
}
|
|
36374
|
+
throw new Error();
|
|
36375
|
+
}
|
|
36376
|
+
if (this.app_s.COMPANY_KEY == 'COCIF_')
|
|
36377
|
+
if (!!res)
|
|
36378
|
+
if (!!res.result_data)
|
|
36379
|
+
res.result_data = this.uti_s.convertKeysToLowerCase(res.result_data);
|
|
36380
|
+
return res || new QGResult();
|
|
36381
|
+
}), catchError((err) => {
|
|
36382
|
+
let errMsg = err.message
|
|
36383
|
+
? err.message
|
|
36384
|
+
: err.status
|
|
36385
|
+
? `${err.status} - ${err.statusText}`
|
|
36386
|
+
: "Server error";
|
|
36387
|
+
console.error(errMsg);
|
|
36388
|
+
throw err;
|
|
36389
|
+
}));
|
|
36390
|
+
}
|
|
36391
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: QueryOpenService, deps: [{ token: i1$1.HttpClient }, { token: i3.ToastrService }, { token: AppService }, { token: UtilityService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
36392
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: QueryOpenService, providedIn: "root" });
|
|
36393
|
+
}
|
|
36394
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: QueryOpenService, decorators: [{
|
|
36395
|
+
type: Injectable,
|
|
36396
|
+
args: [{
|
|
36397
|
+
providedIn: "root",
|
|
36398
|
+
}]
|
|
36399
|
+
}], ctorParameters: () => [{ type: i1$1.HttpClient }, { type: i3.ToastrService }, { type: AppService }, { type: UtilityService }] });
|
|
36400
|
+
|
|
36271
36401
|
/*
|
|
36272
36402
|
* Public API Surface of fluxhublib
|
|
36273
36403
|
*/
|
|
@@ -36276,5 +36406,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
36276
36406
|
* Generated bundle index. Do not edit.
|
|
36277
36407
|
*/
|
|
36278
36408
|
|
|
36279
|
-
export { AppMakerService, AppService, ApprovaGridComponent, AuthHttpRequestInterceptor, AuthenticationService, CheckboxEditorComponent, ComboBoxEditorComponent, CurrencyComponent, FHAutoCompleteComponent, FHCheckBoxComponent, FHColorPickerComponent, FHComboboxComponent, FHConfirmValues, FHCurrencyFormatterDirective, FHCurrencyPipe, FHDatePickerComponent, FHDateRangePickerComponent, FHFieldPickListComponent, FHFilterComboboxComponent, FHFormBuilderComponent, FHFormExecuterComponent, FHFormToolBarComponent, FHGridComponent, FHGridJSONComponent, FHGridToolBarComponent, FHGuard, FHHelpButtonComponent, FHImageViewerComponent, FHListComponent, FHLogPanelComponent, FHMultiComboboxComponent, FHNotesPanelComponent, FHNumericFieldComponent, FHPickFieldComponent, FHPickUsersComponent, FHRichTextComponent, FHRoleManagerComponent, FHTableManagerComponent, FHTextAreaComponent, FHTextInputComponent, FHTimePickerComponent, FHUploadComponent, FHUploadPanelComponent, FHUploadPanelS3Component, FHUploadS3Component, FHUserFieldComponent, FHWinAppLogsComponent, FHWinAskBigTextComponent, FHWinAskButtonsComponent, FHWinAskNumberComponent, FHWinAskRichTextComponent, FHWinAskTextComponent, FHWinAutoComplete, FHWinComboComponent, FHWinConfirmComponent, FHWinErrorComponent, FHWinGridSelection, FHWinInfoComponent, FHWinListComponent, FHWinMappaComponent, FHWinOutputComponent, FHWinPicklistComponent, FHWinSalvaAnnulla, FHWinSelectByGridComponent, FHWinShowEmail, FHWinShowEmailS3, FHWinShowImage, FHWinShowLog, FHWinShowLogDett, FHWinTimeSlider, FHWinUploadComponent, FHWinUserInfo, FHWinUserPickerComponent, FHWinWaitComponent, FHWorkflowForm, FHWorkflowHeaderBar, FHWorkflowView, FSInput, FSResult, FileService, GridService, LocalDBService, MonthYearPickerComponent, NumericEditorComponent, OdbcService, OfficeAutomatorService, OfficeOperation, OfficeResult, QGParam, QGResult, QParam, QResult, QueryService, RegistrationService, ReplaceLineBreaks, SafePipe, TextAreaEditorComponent, UtilityService, WkfService, YearPickerComponent };
|
|
36409
|
+
export { AppMakerService, AppService, ApprovaGridComponent, AuthHttpRequestInterceptor, AuthenticationService, CheckboxEditorComponent, ComboBoxEditorComponent, CurrencyComponent, FHAutoCompleteComponent, FHCheckBoxComponent, FHColorPickerComponent, FHComboboxComponent, FHConfirmValues, FHCurrencyFormatterDirective, FHCurrencyPipe, FHDatePickerComponent, FHDateRangePickerComponent, FHFieldPickListComponent, FHFilterComboboxComponent, FHFormBuilderComponent, FHFormExecuterComponent, FHFormToolBarComponent, FHGridComponent, FHGridJSONComponent, FHGridToolBarComponent, FHGuard, FHHelpButtonComponent, FHImageViewerComponent, FHListComponent, FHLogPanelComponent, FHMultiComboboxComponent, FHNotesPanelComponent, FHNumericFieldComponent, FHPickFieldComponent, FHPickUsersComponent, FHRichTextComponent, FHRoleManagerComponent, FHTableManagerComponent, FHTextAreaComponent, FHTextInputComponent, FHTimePickerComponent, FHUploadComponent, FHUploadPanelComponent, FHUploadPanelS3Component, FHUploadS3Component, FHUserFieldComponent, FHWinAppLogsComponent, FHWinAskBigTextComponent, FHWinAskButtonsComponent, FHWinAskNumberComponent, FHWinAskRichTextComponent, FHWinAskTextComponent, FHWinAutoComplete, FHWinComboComponent, FHWinConfirmComponent, FHWinErrorComponent, FHWinGridSelection, FHWinInfoComponent, FHWinListComponent, FHWinMappaComponent, FHWinOutputComponent, FHWinPicklistComponent, FHWinSalvaAnnulla, FHWinSelectByGridComponent, FHWinShowEmail, FHWinShowEmailS3, FHWinShowImage, FHWinShowLog, FHWinShowLogDett, FHWinTimeSlider, FHWinUploadComponent, FHWinUserInfo, FHWinUserPickerComponent, FHWinWaitComponent, FHWorkflowForm, FHWorkflowHeaderBar, FHWorkflowView, FSInput, FSResult, FileService, GridService, LocalDBService, MonthYearPickerComponent, NumericEditorComponent, OdbcService, OfficeAutomatorService, OfficeOperation, OfficeResult, QGParam, QGResult, QParam, QResult, QueryOpenService, QueryService, RegistrationService, ReplaceLineBreaks, SafePipe, TextAreaEditorComponent, UtilityService, WkfService, YearPickerComponent };
|
|
36280
36410
|
//# sourceMappingURL=fluxhub-fluxhub-lib.mjs.map
|