@yomotech/view-toolkit 0.0.80 → 0.0.82
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.
|
@@ -1035,9 +1035,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.2", ngImpor
|
|
|
1035
1035
|
|
|
1036
1036
|
class Couchdb {
|
|
1037
1037
|
utilityService;
|
|
1038
|
+
platform;
|
|
1038
1039
|
couchDbBaseUrl = 'https://couchdb.yomotech.de';
|
|
1039
|
-
constructor(utilityService) {
|
|
1040
|
+
constructor(utilityService, platform) {
|
|
1040
1041
|
this.utilityService = utilityService;
|
|
1042
|
+
this.platform = platform;
|
|
1041
1043
|
}
|
|
1042
1044
|
async getTenantDatabases(tenantKey) {
|
|
1043
1045
|
if (!tenantKey || !tenantKey.trim()) {
|
|
@@ -1219,25 +1221,27 @@ class Couchdb {
|
|
|
1219
1221
|
};
|
|
1220
1222
|
}
|
|
1221
1223
|
async buildTenantHeaders() {
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
throw new Error('Missing tenantKey');
|
|
1228
|
-
}
|
|
1229
|
-
return {
|
|
1230
|
-
'X-Tenant-Key': tenantKey.trim(),
|
|
1231
|
-
};
|
|
1224
|
+
let tenantKey = "";
|
|
1225
|
+
let tenantName = "";
|
|
1226
|
+
if (this.platform.ANDROID || this.platform.IOS) {
|
|
1227
|
+
tenantKey = await this.utilityService.getLocalStorage('tenantKey');
|
|
1228
|
+
tenantName = await this.utilityService.getLocalStorage('tenantName');
|
|
1232
1229
|
}
|
|
1233
1230
|
else {
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
};
|
|
1231
|
+
tenantKey = await this.utilityService.getStorage('tenantKey');
|
|
1232
|
+
tenantName = await this.utilityService.getStorage('tenantName');
|
|
1233
|
+
}
|
|
1234
|
+
const selectedTenant = await this.utilityService.getLocalStorage('selectedTenant');
|
|
1235
|
+
if (typeof tenantKey === 'string' && tenantKey.trim()) {
|
|
1236
|
+
return { 'X-Tenant-Key': tenantKey.trim() };
|
|
1237
|
+
}
|
|
1238
|
+
const normalizedTenantName = typeof tenantName === 'string' ? tenantName.trim() : '';
|
|
1239
|
+
const normalizedSelectedTenant = typeof selectedTenant === 'string' ? selectedTenant.trim() : '';
|
|
1240
|
+
const tenant = normalizedTenantName || normalizedSelectedTenant;
|
|
1241
|
+
if (!tenant) {
|
|
1242
|
+
throw new Error('Missing tenantKey, tenantName, ' + 'or selectedTenant');
|
|
1240
1243
|
}
|
|
1244
|
+
return { 'X-Tenant': tenant, };
|
|
1241
1245
|
}
|
|
1242
1246
|
async getImageSrcFromCouchDb(couchDbName, filePath) {
|
|
1243
1247
|
const dbName = couchDbName?.toLowerCase();
|
|
@@ -1259,7 +1263,7 @@ class Couchdb {
|
|
|
1259
1263
|
const mimeType = doc.contentType || 'image/png';
|
|
1260
1264
|
return `data:${mimeType};base64,${doc.data}`;
|
|
1261
1265
|
}
|
|
1262
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.2", ngImport: i0, type: Couchdb, deps: [{ token: UtilityService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1266
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.2", ngImport: i0, type: Couchdb, deps: [{ token: UtilityService }, { token: i1.Platform }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1263
1267
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.2", ngImport: i0, type: Couchdb, providedIn: 'root' });
|
|
1264
1268
|
}
|
|
1265
1269
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.2", ngImport: i0, type: Couchdb, decorators: [{
|
|
@@ -1267,7 +1271,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.2", ngImpor
|
|
|
1267
1271
|
args: [{
|
|
1268
1272
|
providedIn: 'root',
|
|
1269
1273
|
}]
|
|
1270
|
-
}], ctorParameters: () => [{ type: UtilityService }] });
|
|
1274
|
+
}], ctorParameters: () => [{ type: UtilityService }, { type: i1.Platform }] });
|
|
1271
1275
|
|
|
1272
1276
|
class ConfigService {
|
|
1273
1277
|
couchdbService;
|
|
@@ -1903,17 +1907,17 @@ class CardComponent {
|
|
|
1903
1907
|
}
|
|
1904
1908
|
showConfirm(option, recordIndex) {
|
|
1905
1909
|
this.modalService.confirm({
|
|
1906
|
-
nzTitle: this.selectedLanguageInfo && this.selectedLanguageInfo?.selectedLanguage['Confirm']
|
|
1910
|
+
nzTitle: this.selectedLanguageInfo && this.selectedLanguageInfo?.selectedLanguage && this.selectedLanguageInfo?.selectedLanguage['Confirm']
|
|
1907
1911
|
? this.selectedLanguageInfo.selectedLanguage['Confirm']
|
|
1908
1912
|
: 'Confirm',
|
|
1909
|
-
nzContent: this.selectedLanguageInfo &&
|
|
1913
|
+
nzContent: this.selectedLanguageInfo && this.selectedLanguageInfo?.selectedLanguage &&
|
|
1910
1914
|
this.selectedLanguageInfo?.selectedLanguage[option.deleteMessage]
|
|
1911
1915
|
? this.selectedLanguageInfo.selectedLanguage[option.deleteMessage]
|
|
1912
1916
|
: option.deleteMessage,
|
|
1913
|
-
nzOkText: this.selectedLanguageInfo && this.selectedLanguageInfo?.selectedLanguage['Delete']
|
|
1917
|
+
nzOkText: this.selectedLanguageInfo && this.selectedLanguageInfo?.selectedLanguage && this.selectedLanguageInfo?.selectedLanguage['Delete']
|
|
1914
1918
|
? this.selectedLanguageInfo.selectedLanguage['Delete']
|
|
1915
1919
|
: 'Delete',
|
|
1916
|
-
nzCancelText: this.selectedLanguageInfo && this.selectedLanguageInfo?.selectedLanguage['Cancel']
|
|
1920
|
+
nzCancelText: this.selectedLanguageInfo && this.selectedLanguageInfo?.selectedLanguage && this.selectedLanguageInfo?.selectedLanguage['Cancel']
|
|
1917
1921
|
? this.selectedLanguageInfo.selectedLanguage['Cancel']
|
|
1918
1922
|
: 'Cancel',
|
|
1919
1923
|
nzOnOk: () => this.deleteRecord(recordIndex),
|