cds-caching 1.3.1 → 1.3.2
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/README.md +16 -0
- package/app/dashboard/controller/App-dbg.controller.js +14 -14
- package/app/dashboard/controller/App-dbg.controller.js.map +1 -1
- package/app/dashboard/controller/App.controller.js +1 -1
- package/app/dashboard/controller/App.controller.js.map +1 -1
- package/app/dashboard/controller/App.controller.ts +14 -14
- package/app/dashboard/controller/BaseController-dbg.js +7 -0
- package/app/dashboard/controller/BaseController-dbg.js.map +1 -1
- package/app/dashboard/controller/BaseController.js +1 -1
- package/app/dashboard/controller/BaseController.js.map +1 -1
- package/app/dashboard/controller/BaseController.ts +10 -0
- package/app/dashboard/controller/Cache-dbg.controller.js +34 -25
- package/app/dashboard/controller/Cache-dbg.controller.js.map +1 -1
- package/app/dashboard/controller/Cache.controller.js +1 -1
- package/app/dashboard/controller/Cache.controller.js.map +1 -1
- package/app/dashboard/controller/Cache.controller.ts +36 -25
- package/app/dashboard/controller/SingleMetric-dbg.controller.js +56 -50
- package/app/dashboard/controller/SingleMetric-dbg.controller.js.map +1 -1
- package/app/dashboard/controller/SingleMetric.controller.js +1 -1
- package/app/dashboard/controller/SingleMetric.controller.js.map +1 -1
- package/app/dashboard/controller/SingleMetric.controller.ts +29 -22
- package/app/dashboard/i18n/i18n.properties +235 -0
- package/app/dashboard/i18n/i18n_de.properties +271 -3
- package/app/dashboard/i18n/i18n_en.properties +295 -2
- package/app/dashboard/resources/sap-ui-custom.js +11 -11
- package/app/dashboard/resources/sap-ui-custom.js.map +1 -1
- package/app/dashboard/view/Cache.view.xml +149 -149
- package/app/dashboard/view/Main.view.xml +7 -7
- package/app/dashboard/view/SingleMetric.view.xml +30 -30
- package/cds-plugin.js +31 -8
- package/lib/util.js +28 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -96,11 +96,16 @@ service MyService {
|
|
|
96
96
|
@cache: { ttl: 10000 }
|
|
97
97
|
entity Products as projection on db.Products;
|
|
98
98
|
|
|
99
|
+
@cache: { ttl: 10000, invalidateOnWrite: true }
|
|
100
|
+
entity Orders as projection on db.Orders;
|
|
101
|
+
|
|
99
102
|
@cache: { ttl: 60000 }
|
|
100
103
|
function getRecommendations() returns array of Products;
|
|
101
104
|
}
|
|
102
105
|
```
|
|
103
106
|
|
|
107
|
+
When `invalidateOnWrite` is set, the cache for that entity is automatically cleared after any CREATE, UPDATE, or DELETE operation, so subsequent reads always return fresh data.
|
|
108
|
+
|
|
104
109
|
## Configuration
|
|
105
110
|
|
|
106
111
|
### Store Types
|
|
@@ -308,6 +313,17 @@ await cache.set("bp-list", bpArray, {
|
|
|
308
313
|
})
|
|
309
314
|
```
|
|
310
315
|
|
|
316
|
+
#### Automatic Invalidation on Write
|
|
317
|
+
|
|
318
|
+
For annotation-based entity caching, use `invalidateOnWrite` to automatically clear all cached queries for an entity whenever its data changes:
|
|
319
|
+
|
|
320
|
+
```cds
|
|
321
|
+
@cache: { ttl: 10000, invalidateOnWrite: true }
|
|
322
|
+
entity CachedProducts as projection on db.Products;
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
This registers `after` handlers for CREATE, UPDATE, and DELETE that call `deleteByTag` with an entity-level tag. All cached variants (filtered, sorted, paginated, single-entity) are invalidated at once.
|
|
326
|
+
|
|
311
327
|
For more usage patterns, error handling details, and TypeScript support, see [Programmatic API](docs/programmatic-api.md).
|
|
312
328
|
|
|
313
329
|
## Statistics & Monitoring
|
|
@@ -48,27 +48,27 @@ sap.ui.define(["sap/m/MessageBox", "./BaseController", "sap/m/MessageToast"], fu
|
|
|
48
48
|
const enabled = oEvent.getParameter("state");
|
|
49
49
|
const cacheName = this.getModel("app").getProperty("/selectedCache");
|
|
50
50
|
if (!cacheName) {
|
|
51
|
-
MessageBox.warning(
|
|
51
|
+
MessageBox.warning(await this.i18nText("msgNoCacheSelected"));
|
|
52
52
|
// Revert the switch
|
|
53
53
|
this.getModel("app").setProperty("/enableStatistics", !enabled);
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
56
|
try {
|
|
57
57
|
// Show loading state
|
|
58
|
-
MessageToast.show(
|
|
58
|
+
MessageToast.show(await this.i18nText("msgUpdatingStatsConfig"));
|
|
59
59
|
const success = await this.statisticsService.setStatisticsEnabled(cacheName, enabled);
|
|
60
60
|
if (success) {
|
|
61
|
-
MessageToast.show(
|
|
61
|
+
MessageToast.show(await this.i18nText(enabled ? "msgStatsEnabled" : "msgStatsDisabled"));
|
|
62
62
|
// Reload the configuration to reflect the change
|
|
63
63
|
await this.loadRuntimeConfiguration(cacheName);
|
|
64
64
|
} else {
|
|
65
|
-
MessageToast.show(
|
|
65
|
+
MessageToast.show(await this.i18nText("msgFailedUpdateStatsConfig"));
|
|
66
66
|
// Revert the switch
|
|
67
67
|
this.getModel("app").setProperty("/enableStatistics", !enabled);
|
|
68
68
|
}
|
|
69
69
|
} catch (error) {
|
|
70
70
|
console.error("Error updating statistics configuration:", error);
|
|
71
|
-
MessageToast.show(
|
|
71
|
+
MessageToast.show(await this.i18nText("msgErrorUpdateStatsConfig"));
|
|
72
72
|
// Revert the switch
|
|
73
73
|
this.getModel("app").setProperty("/enableStatistics", !enabled);
|
|
74
74
|
}
|
|
@@ -80,27 +80,27 @@ sap.ui.define(["sap/m/MessageBox", "./BaseController", "sap/m/MessageToast"], fu
|
|
|
80
80
|
const enabled = oEvent.getParameter("state");
|
|
81
81
|
const cacheName = this.getModel("app").getProperty("/selectedCache");
|
|
82
82
|
if (!cacheName) {
|
|
83
|
-
MessageBox.warning(
|
|
83
|
+
MessageBox.warning(await this.i18nText("msgNoCacheSelected"));
|
|
84
84
|
// Revert the switch
|
|
85
85
|
this.getModel("app").setProperty("/enableKeyTracking", !enabled);
|
|
86
86
|
return;
|
|
87
87
|
}
|
|
88
88
|
try {
|
|
89
89
|
// Show loading state
|
|
90
|
-
MessageToast.show(
|
|
90
|
+
MessageToast.show(await this.i18nText("msgUpdatingKeyTracking"));
|
|
91
91
|
const success = await this.statisticsService.setKeyTrackingEnabled(cacheName, enabled);
|
|
92
92
|
if (success) {
|
|
93
|
-
MessageToast.show(
|
|
93
|
+
MessageToast.show(await this.i18nText(enabled ? "msgKeyTrackingEnabled" : "msgKeyTrackingDisabled"));
|
|
94
94
|
// Reload the configuration to reflect the change
|
|
95
95
|
await this.loadRuntimeConfiguration(cacheName);
|
|
96
96
|
} else {
|
|
97
|
-
MessageToast.show(
|
|
97
|
+
MessageToast.show(await this.i18nText("msgFailedKeyTracking"));
|
|
98
98
|
// Revert the switch
|
|
99
99
|
this.getModel("app").setProperty("/enableKeyTracking", !enabled);
|
|
100
100
|
}
|
|
101
101
|
} catch (error) {
|
|
102
102
|
console.error("Error updating key tracking configuration:", error);
|
|
103
|
-
MessageToast.show(
|
|
103
|
+
MessageToast.show(await this.i18nText("msgErrorKeyTracking"));
|
|
104
104
|
// Revert the switch
|
|
105
105
|
this.getModel("app").setProperty("/enableKeyTracking", !enabled);
|
|
106
106
|
}
|
|
@@ -112,18 +112,18 @@ sap.ui.define(["sap/m/MessageBox", "./BaseController", "sap/m/MessageToast"], fu
|
|
|
112
112
|
try {
|
|
113
113
|
const cacheName = this.getModel("app").getProperty("/selectedCache");
|
|
114
114
|
if (!cacheName) {
|
|
115
|
-
MessageBox.warning(
|
|
115
|
+
MessageBox.warning(await this.i18nText("msgNoCacheSelected"));
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
118
|
const success = await this.statisticsService.persistStatistics(cacheName);
|
|
119
119
|
if (success) {
|
|
120
|
-
MessageToast.show(
|
|
120
|
+
MessageToast.show(await this.i18nText("msgStatsPersisted"));
|
|
121
121
|
} else {
|
|
122
|
-
MessageToast.show(
|
|
122
|
+
MessageToast.show(await this.i18nText("msgFailedPersistStats"));
|
|
123
123
|
}
|
|
124
124
|
} catch (error) {
|
|
125
125
|
console.error("Error persisting statistics:", error);
|
|
126
|
-
MessageToast.show(
|
|
126
|
+
MessageToast.show(await this.i18nText("msgErrorPersistStats"));
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App-dbg.controller.js","names":["BaseController","_interopRequireDefault","__BaseController","App","extend","onInit","_onInit","getView","addStyleClass","getOwnerComponent","getContentDensityClass","onSelectionChange","_onSelectionChange","oEvent","key","getParameter","getRouter","navTo","onCacheChange","_onCacheChange","selectedCache","getModel","getProperty","loadRuntimeConfiguration","_loadRuntimeConfiguration","cacheName","config","statisticsService","getRuntimeConfiguration","setProperty","enableStatistics","enableKeyTracking","error","console","onEnableStatisticsChange","_onEnableStatisticsChange","enabled","MessageBox","warning","MessageToast","show","success","setStatisticsEnabled","onEnableKeyTrackingChange","_onEnableKeyTrackingChange","setKeyTrackingEnabled","onPersistStatistics","_onPersistStatistics","persistStatistics"],"sources":["App.controller.ts"],"sourcesContent":["import MessageBox from \"sap/m/MessageBox\";\nimport BaseController from \"./BaseController\";\nimport { IconTabBar$SelectEvent } from \"sap/m/IconTabBar\";\nimport CacheStatisticsService from \"../service/CacheStatisticsService\";\nimport ODataModel from \"sap/ui/model/odata/v4/ODataModel\";\nimport JSONModel from \"sap/ui/model/json/JSONModel\";\nimport MessageToast from \"sap/m/MessageToast\";\n\n/**\n * @namespace cds.plugin.caching.dashboard.controller\n */\nexport default class App extends BaseController {\n\tprivate statisticsService: CacheStatisticsService;\n\n\n\tpublic onInit(): void {\n\t\t// apply content density mode to root view\n\t\tthis.getView().addStyleClass(this.getOwnerComponent().getContentDensityClass());\n\t}\n\n\tpublic onSelectionChange(oEvent: IconTabBar$SelectEvent): void {\n\t\tconst key = oEvent.getParameter(\"selectedKey\");\n\t\tthis.getRouter().navTo(key);\n\t}\n\n\t/**\n\t * Handle cache selection change\n\t */\n\tpublic async onCacheChange(): Promise<void> {\n\t\tconst selectedCache = this.getModel(\"app\").getProperty(\"/selectedCache\");\n\t\tif (selectedCache) {\n\t\t\tawait this.loadRuntimeConfiguration(selectedCache);\n\t\t}\n\t}\n\n\t/**\n\t * Load runtime configuration for the selected cache\n\t */\n\tprivate async loadRuntimeConfiguration(cacheName: string): Promise<void> {\n\t\ttry {\n\t\t\tconst config = await this.statisticsService.getRuntimeConfiguration(cacheName);\n\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableStatistics\", config.enableStatistics);\n\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableKeyTracking\", config.enableKeyTracking);\n\t\t} catch (error) {\n\t\t\tconsole.error(\"Error loading runtime configuration:\", error);\n\t\t\t// Set defaults if loading fails\n\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableStatistics\", false);\n\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableKeyTracking\", false);\n\t\t}\n\t}\n\n\t/**\n\t * Handle statistics enable/disable switch change\n\t */\n\tpublic async onEnableStatisticsChange(oEvent: any): Promise<void> {\n\t\tconst enabled = oEvent.getParameter(\"state\");\n\t\tconst cacheName = this.getModel(\"app\").getProperty(\"/selectedCache\");\n\t\t\n\t\tif (!cacheName) {\n\t\t\tMessageBox.warning(\"No cache selected\");\n\t\t\t// Revert the switch\n\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableStatistics\", !enabled);\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\t// Show loading state\n\t\t\tMessageToast.show(\"Updating statistics configuration...\");\n\t\t\t\n\t\t\tconst success = await this.statisticsService.setStatisticsEnabled(cacheName, enabled);\n\t\t\tif (success) {\n\t\t\t\tMessageToast.show(`Statistics ${enabled ? 'enabled' : 'disabled'} successfully`);\n\t\t\t\t// Reload the configuration to reflect the change\n\t\t\t\tawait this.loadRuntimeConfiguration(cacheName);\n\t\t\t} else {\n\t\t\t\tMessageToast.show(\"Failed to update statistics configuration\");\n\t\t\t\t// Revert the switch\n\t\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableStatistics\", !enabled);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconsole.error(\"Error updating statistics configuration:\", error);\n\t\t\tMessageToast.show(\"Error updating statistics configuration\");\n\t\t\t// Revert the switch\n\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableStatistics\", !enabled);\n\t\t}\n\t}\n\n\t/**\n\t * Handle key tracking enable/disable switch change\n\t */\n\tpublic async onEnableKeyTrackingChange(oEvent: any): Promise<void> {\n\t\tconst enabled = oEvent.getParameter(\"state\");\n\t\tconst cacheName = this.getModel(\"app\").getProperty(\"/selectedCache\");\n\t\t\n\t\tif (!cacheName) {\n\t\t\tMessageBox.warning(\"No cache selected\");\n\t\t\t// Revert the switch\n\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableKeyTracking\", !enabled);\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\t// Show loading state\n\t\t\tMessageToast.show(\"Updating key tracking configuration...\");\n\t\t\t\n\t\t\tconst success = await this.statisticsService.setKeyTrackingEnabled(cacheName, enabled);\n\t\t\tif (success) {\n\t\t\t\tMessageToast.show(`Key tracking ${enabled ? 'enabled' : 'disabled'} successfully`);\n\t\t\t\t// Reload the configuration to reflect the change\n\t\t\t\tawait this.loadRuntimeConfiguration(cacheName);\n\t\t\t} else {\n\t\t\t\tMessageToast.show(\"Failed to update key tracking configuration\");\n\t\t\t\t// Revert the switch\n\t\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableKeyTracking\", !enabled);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconsole.error(\"Error updating key tracking configuration:\", error);\n\t\t\tMessageToast.show(\"Error updating key tracking configuration\");\n\t\t\t// Revert the switch\n\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableKeyTracking\", !enabled);\n\t\t}\n\t}\n\n\t/**\n\t * Persist statistics to database\n\t */\n\tpublic async onPersistStatistics(): Promise<void> {\n\t\ttry {\n\t\t\tconst cacheName = this.getModel(\"app\").getProperty(\"/selectedCache\");\n\t\t\tif (!cacheName) {\n\t\t\t\tMessageBox.warning(\"No cache selected\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst success = await this.statisticsService.persistStatistics(cacheName);\n\t\t\tif (success) {\n\t\t\t\tMessageToast.show(\"Statistics persisted successfully\");\n\t\t\t} else {\n\t\t\t\tMessageToast.show(\"Failed to persist statistics\");\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconsole.error(\"Error persisting statistics:\", error);\n\t\t\tMessageToast.show(\"Error persisting statistics\");\n\t\t}\n\t}\n\n}\n"],"mappings":";;;;;;QACOA,cAAc,GAAAC,sBAAA,CAAAC,gBAAA;EAOrB;AACA;AACA;EAFA,MAGqBC,GAAG,GAASH,cAAc,CAAAI,MAAA;IAIvCC,MAAM,WAAAC,QAAA,EAAS;MACrB;MACA,IAAI,CAACC,OAAO,CAAC,CAAC,CAACC,aAAa,CAAC,IAAI,CAACC,iBAAiB,CAAC,CAAC,CAACC,sBAAsB,CAAC,CAAC,CAAC;IAChF,CAAC;IAEMC,iBAAiB,WAAAC,mBAACC,MAA8B,EAAQ;MAC9D,MAAMC,GAAG,GAAGD,MAAM,CAACE,YAAY,CAAC,aAAa,CAAC;MAC9C,IAAI,CAACC,SAAS,CAAC,CAAC,CAACC,KAAK,CAACH,GAAG,CAAC;IAC5B,CAAC;IAED;AACD;AACA;IACcI,aAAa,iBAAAC,eAAA,EAAkB;MAC3C,MAAMC,aAAa,GAAG,IAAI,CAACC,QAAQ,CAAC,KAAK,CAAC,CAACC,WAAW,CAAC,gBAAgB,CAAC;MACxE,IAAIF,aAAa,EAAE;QAClB,MAAM,IAAI,CAACG,wBAAwB,CAACH,aAAa,CAAC;MACnD;IACD,CAAC;IAED;AACD;AACA;IACeG,wBAAwB,iBAAAC,0BAACC,SAAiB,EAAiB;MACxE,IAAI;QACH,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACC,iBAAiB,CAACC,uBAAuB,CAACH,SAAS,CAAC;QAC7E,IAAI,CAACJ,QAAQ,CAAC,KAAK,CAAC,CAAeQ,WAA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AAC,KAAK,CAAC,CAAeQ,WAAW,CAAC,oBAAoB,EAAE,CAACO,OAAO,CAAC;QAChF;MACD,CAAC,CAAC,OAAOJ,KAAK,EAAE;QACfC,OAAO,CAACD,KAAK,CAAC,4CAA4C,EAAEA,KAAK,CAAC;QAClEO,YAAY,CAACC,IAAI,CAAC,2CAA2C,CAAC;QAC9D;QACC,IAAI,CAACnB,QAAQ,CAAC,KAAK,CAAC,CAAeQ,WAAW,CAAC,oBAAoB,EAAE,CAACO,OAAO,CAAC;MAChF;IACD,CAAC;IAED;AACD;AACA;IACcU,mBAAmB,iBAAAC,qBAAA,EAAkB;MACjD,IAAI;QACH,MAAMtB,SAAS,GAAG,IAAI,CAACJ,QAAQ,CAAC,KAAK,CAAC,CAACC,WAAW,CAAC,gBAAgB,CAAC;QACpE,IAAI,CAACG,SAAS,EAAE;UACfY,UAAU,CAACC,OAAO,CAAC,mBAAmB,CAAC;UACvC;QACD;QAEA,MAAMG,OAAO,GAAG,MAAM,IAAI,CAACd,iBAAiB,CAACqB,iBAAiB,CAACvB,SAAS,CAAC;QACzE,IAAIgB,OAAO,EAAE;UACZF,YAAY,CAACC,IAAI,CAAC,mCAAmC,CAAC;QACvD,CAAC,MAAM;UACND,YAAY,CAACC,IAAI,CAAC,8BAA8B,CAAC;QAClD;MACD,CAAC,CAAC,OAAOR,KAAK,EAAE;QACfC,OAAO,CAACD,KAAK,CAAC,8BAA8B,EAAEA,KAAK,CAAC;QACpDO,YAAY,CAACC,IAAI,CAAC,6BAA6B,CAAC;MACjD;IACD;EAAC;EAAA,OArImBrC,GAAG;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"App-dbg.controller.js","names":["BaseController","_interopRequireDefault","__BaseController","App","extend","onInit","_onInit","getView","addStyleClass","getOwnerComponent","getContentDensityClass","onSelectionChange","_onSelectionChange","oEvent","key","getParameter","getRouter","navTo","onCacheChange","_onCacheChange","selectedCache","getModel","getProperty","loadRuntimeConfiguration","_loadRuntimeConfiguration","cacheName","config","statisticsService","getRuntimeConfiguration","setProperty","enableStatistics","enableKeyTracking","error","console","onEnableStatisticsChange","_onEnableStatisticsChange","enabled","MessageBox","warning","i18nText","MessageToast","show","success","setStatisticsEnabled","onEnableKeyTrackingChange","_onEnableKeyTrackingChange","setKeyTrackingEnabled","onPersistStatistics","_onPersistStatistics","persistStatistics"],"sources":["App.controller.ts"],"sourcesContent":["import MessageBox from \"sap/m/MessageBox\";\nimport BaseController from \"./BaseController\";\nimport { IconTabBar$SelectEvent } from \"sap/m/IconTabBar\";\nimport CacheStatisticsService from \"../service/CacheStatisticsService\";\nimport ODataModel from \"sap/ui/model/odata/v4/ODataModel\";\nimport JSONModel from \"sap/ui/model/json/JSONModel\";\nimport MessageToast from \"sap/m/MessageToast\";\n\n/**\n * @namespace cds.plugin.caching.dashboard.controller\n */\nexport default class App extends BaseController {\n\tprivate statisticsService: CacheStatisticsService;\n\n\n\tpublic onInit(): void {\n\t\t// apply content density mode to root view\n\t\tthis.getView().addStyleClass(this.getOwnerComponent().getContentDensityClass());\n\t}\n\n\tpublic onSelectionChange(oEvent: IconTabBar$SelectEvent): void {\n\t\tconst key = oEvent.getParameter(\"selectedKey\");\n\t\tthis.getRouter().navTo(key);\n\t}\n\n\t/**\n\t * Handle cache selection change\n\t */\n\tpublic async onCacheChange(): Promise<void> {\n\t\tconst selectedCache = this.getModel(\"app\").getProperty(\"/selectedCache\");\n\t\tif (selectedCache) {\n\t\t\tawait this.loadRuntimeConfiguration(selectedCache);\n\t\t}\n\t}\n\n\t/**\n\t * Load runtime configuration for the selected cache\n\t */\n\tprivate async loadRuntimeConfiguration(cacheName: string): Promise<void> {\n\t\ttry {\n\t\t\tconst config = await this.statisticsService.getRuntimeConfiguration(cacheName);\n\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableStatistics\", config.enableStatistics);\n\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableKeyTracking\", config.enableKeyTracking);\n\t\t} catch (error) {\n\t\t\tconsole.error(\"Error loading runtime configuration:\", error);\n\t\t\t// Set defaults if loading fails\n\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableStatistics\", false);\n\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableKeyTracking\", false);\n\t\t}\n\t}\n\n\t/**\n\t * Handle statistics enable/disable switch change\n\t */\n\tpublic async onEnableStatisticsChange(oEvent: any): Promise<void> {\n\t\tconst enabled = oEvent.getParameter(\"state\");\n\t\tconst cacheName = this.getModel(\"app\").getProperty(\"/selectedCache\");\n\t\t\n\t\tif (!cacheName) {\n\t\t\tMessageBox.warning(await this.i18nText(\"msgNoCacheSelected\"));\n\t\t\t// Revert the switch\n\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableStatistics\", !enabled);\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\t// Show loading state\n\t\t\tMessageToast.show(await this.i18nText(\"msgUpdatingStatsConfig\"));\n\t\t\t\n\t\t\tconst success = await this.statisticsService.setStatisticsEnabled(cacheName, enabled);\n\t\t\tif (success) {\n\t\t\t\tMessageToast.show(await this.i18nText(enabled ? \"msgStatsEnabled\" : \"msgStatsDisabled\"));\n\t\t\t\t// Reload the configuration to reflect the change\n\t\t\t\tawait this.loadRuntimeConfiguration(cacheName);\n\t\t\t} else {\n\t\t\t\tMessageToast.show(await this.i18nText(\"msgFailedUpdateStatsConfig\"));\n\t\t\t\t// Revert the switch\n\t\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableStatistics\", !enabled);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconsole.error(\"Error updating statistics configuration:\", error);\n\t\t\tMessageToast.show(await this.i18nText(\"msgErrorUpdateStatsConfig\"));\n\t\t\t// Revert the switch\n\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableStatistics\", !enabled);\n\t\t}\n\t}\n\n\t/**\n\t * Handle key tracking enable/disable switch change\n\t */\n\tpublic async onEnableKeyTrackingChange(oEvent: any): Promise<void> {\n\t\tconst enabled = oEvent.getParameter(\"state\");\n\t\tconst cacheName = this.getModel(\"app\").getProperty(\"/selectedCache\");\n\t\t\n\t\tif (!cacheName) {\n\t\t\tMessageBox.warning(await this.i18nText(\"msgNoCacheSelected\"));\n\t\t\t// Revert the switch\n\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableKeyTracking\", !enabled);\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\t// Show loading state\n\t\t\tMessageToast.show(await this.i18nText(\"msgUpdatingKeyTracking\"));\n\t\t\t\n\t\t\tconst success = await this.statisticsService.setKeyTrackingEnabled(cacheName, enabled);\n\t\t\tif (success) {\n\t\t\t\tMessageToast.show(await this.i18nText(enabled ? \"msgKeyTrackingEnabled\" : \"msgKeyTrackingDisabled\"));\n\t\t\t\t// Reload the configuration to reflect the change\n\t\t\t\tawait this.loadRuntimeConfiguration(cacheName);\n\t\t\t} else {\n\t\t\t\tMessageToast.show(await this.i18nText(\"msgFailedKeyTracking\"));\n\t\t\t\t// Revert the switch\n\t\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableKeyTracking\", !enabled);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconsole.error(\"Error updating key tracking configuration:\", error);\n\t\t\tMessageToast.show(await this.i18nText(\"msgErrorKeyTracking\"));\n\t\t\t// Revert the switch\n\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableKeyTracking\", !enabled);\n\t\t}\n\t}\n\n\t/**\n\t * Persist statistics to database\n\t */\n\tpublic async onPersistStatistics(): Promise<void> {\n\t\ttry {\n\t\t\tconst cacheName = this.getModel(\"app\").getProperty(\"/selectedCache\");\n\t\t\tif (!cacheName) {\n\t\t\t\tMessageBox.warning(await this.i18nText(\"msgNoCacheSelected\"));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst success = await this.statisticsService.persistStatistics(cacheName);\n\t\t\tif (success) {\n\t\t\t\tMessageToast.show(await this.i18nText(\"msgStatsPersisted\"));\n\t\t\t} else {\n\t\t\t\tMessageToast.show(await this.i18nText(\"msgFailedPersistStats\"));\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconsole.error(\"Error persisting statistics:\", error);\n\t\t\tMessageToast.show(await this.i18nText(\"msgErrorPersistStats\"));\n\t\t}\n\t}\n\n}\n"],"mappings":";;;;;;QACOA,cAAc,GAAAC,sBAAA,CAAAC,gBAAA;EAOrB;AACA;AACA;EAFA,MAGqBC,GAAG,GAASH,cAAc,CAAAI,MAAA;IAIvCC,MAAM,WAAAC,QAAA,EAAS;MACrB;MACA,IAAI,CAACC,OAAO,CAAC,CAAC,CAACC,aAAa,CAAC,IAAI,CAACC,iBAAiB,CAAC,CAAC,CAACC,sBAAsB,CAAC,CAAC,CAAC;IAChF,CAAC;IAEMC,iBAAiB,WAAAC,mBAACC,MAA8B,EAAQ;MAC9D,MAAMC,GAAG,GAAGD,MAAM,CAACE,YAAY,CAAC,aAAa,CAAC;MAC9C,IAAI,CAACC,SAAS,CAAC,CAAC,CAACC,KAAK,CAACH,GAAG,CAAC;IAC5B,CAAC;IAED;AACD;AACA;IACcI,aAAa,iBAAAC,eAAA,EAAkB;MAC3C,MAAMC,aAAa,GAAG,IAAI,CAACC,QAAQ,CAAC,KAAK,CAAC,CAACC,WAAW,CAAC,gBAAgB,CAAC;MACxE,IAAIF,aAAa,EAAE;QAClB,MAAM,IAAI,CAACG,wBAAwB,CAACH,aAAa,CAAC;MACnD;IACD,CAAC;IAED;AACD;AACA;IACeG,wBAAwB,iBAAAC,0BAACC,SAAiB,EAAiB;MACxE,IAAI;QACH,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACC,iBAAiB,CAACC,uBAAuB,CAACH,SAAS,CAAC;QAC7E,IAAI,CAACJ,QAAQ,CAAC,KAAK,CAAC,CAAeQ,WAAW,CAAC,mBAAmB,EAAEH,MAAM,CAACI,gBAAgB,CAAC;QAC5F,IAAI,CAACT,QAAQ,CAAC,KAAK,CAAC,CAA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D,KAAK,CAAC,8BAA8B,EAAEA,KAAK,CAAC;QACpDQ,YAAY,CAACC,IAAI,CAAC,MAAM,IAAI,CAACF,QAAQ,CAAC,sBAAsB,CAAC,CAAC;MAC/D;IACD;EAAC;EAAA,OArImBpC,GAAG;AAAA","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
sap.ui.define(["sap/m/MessageBox","./BaseController","sap/m/MessageToast"],function(t,e,
|
|
1
|
+
sap.ui.define(["sap/m/MessageBox","./BaseController","sap/m/MessageToast"],function(t,e,i){"use strict";function s(t){return t&&t.__esModule&&typeof t.default!=="undefined"?t.default:t}const a=s(e);const n=a.extend("cds.plugin.caching.dashboard.controller.App",{onInit:function t(){this.getView().addStyleClass(this.getOwnerComponent().getContentDensityClass())},onSelectionChange:function t(e){const i=e.getParameter("selectedKey");this.getRouter().navTo(i)},onCacheChange:async function t(){const e=this.getModel("app").getProperty("/selectedCache");if(e){await this.loadRuntimeConfiguration(e)}},loadRuntimeConfiguration:async function t(e){try{const t=await this.statisticsService.getRuntimeConfiguration(e);this.getModel("app").setProperty("/enableStatistics",t.enableStatistics);this.getModel("app").setProperty("/enableKeyTracking",t.enableKeyTracking)}catch(t){console.error("Error loading runtime configuration:",t);this.getModel("app").setProperty("/enableStatistics",false);this.getModel("app").setProperty("/enableKeyTracking",false)}},onEnableStatisticsChange:async function e(s){const a=s.getParameter("state");const n=this.getModel("app").getProperty("/selectedCache");if(!n){t.warning(await this.i18nText("msgNoCacheSelected"));this.getModel("app").setProperty("/enableStatistics",!a);return}try{i.show(await this.i18nText("msgUpdatingStatsConfig"));const t=await this.statisticsService.setStatisticsEnabled(n,a);if(t){i.show(await this.i18nText(a?"msgStatsEnabled":"msgStatsDisabled"));await this.loadRuntimeConfiguration(n)}else{i.show(await this.i18nText("msgFailedUpdateStatsConfig"));this.getModel("app").setProperty("/enableStatistics",!a)}}catch(t){console.error("Error updating statistics configuration:",t);i.show(await this.i18nText("msgErrorUpdateStatsConfig"));this.getModel("app").setProperty("/enableStatistics",!a)}},onEnableKeyTrackingChange:async function e(s){const a=s.getParameter("state");const n=this.getModel("app").getProperty("/selectedCache");if(!n){t.warning(await this.i18nText("msgNoCacheSelected"));this.getModel("app").setProperty("/enableKeyTracking",!a);return}try{i.show(await this.i18nText("msgUpdatingKeyTracking"));const t=await this.statisticsService.setKeyTrackingEnabled(n,a);if(t){i.show(await this.i18nText(a?"msgKeyTrackingEnabled":"msgKeyTrackingDisabled"));await this.loadRuntimeConfiguration(n)}else{i.show(await this.i18nText("msgFailedKeyTracking"));this.getModel("app").setProperty("/enableKeyTracking",!a)}}catch(t){console.error("Error updating key tracking configuration:",t);i.show(await this.i18nText("msgErrorKeyTracking"));this.getModel("app").setProperty("/enableKeyTracking",!a)}},onPersistStatistics:async function e(){try{const e=this.getModel("app").getProperty("/selectedCache");if(!e){t.warning(await this.i18nText("msgNoCacheSelected"));return}const s=await this.statisticsService.persistStatistics(e);if(s){i.show(await this.i18nText("msgStatsPersisted"))}else{i.show(await this.i18nText("msgFailedPersistStats"))}}catch(t){console.error("Error persisting statistics:",t);i.show(await this.i18nText("msgErrorPersistStats"))}}});return n});
|
|
2
2
|
//# sourceMappingURL=App.controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.controller.js","names":["BaseController","_interopRequireDefault","__BaseController","App","extend","onInit","_onInit","this","getView","addStyleClass","getOwnerComponent","getContentDensityClass","onSelectionChange","_onSelectionChange","oEvent","key","getParameter","getRouter","navTo","onCacheChange","async","_onCacheChange","selectedCache","getModel","getProperty","loadRuntimeConfiguration","_loadRuntimeConfiguration","cacheName","config","statisticsService","getRuntimeConfiguration","setProperty","enableStatistics","enableKeyTracking","error","console","onEnableStatisticsChange","_onEnableStatisticsChange","enabled","MessageBox","warning","MessageToast","show","success","setStatisticsEnabled","onEnableKeyTrackingChange","_onEnableKeyTrackingChange","setKeyTrackingEnabled","onPersistStatistics","_onPersistStatistics","persistStatistics"],"sources":["App.controller.ts"],"sourcesContent":["import MessageBox from \"sap/m/MessageBox\";\nimport BaseController from \"./BaseController\";\nimport { IconTabBar$SelectEvent } from \"sap/m/IconTabBar\";\nimport CacheStatisticsService from \"../service/CacheStatisticsService\";\nimport ODataModel from \"sap/ui/model/odata/v4/ODataModel\";\nimport JSONModel from \"sap/ui/model/json/JSONModel\";\nimport MessageToast from \"sap/m/MessageToast\";\n\n/**\n * @namespace cds.plugin.caching.dashboard.controller\n */\nexport default class App extends BaseController {\n\tprivate statisticsService: CacheStatisticsService;\n\n\n\tpublic onInit(): void {\n\t\t// apply content density mode to root view\n\t\tthis.getView().addStyleClass(this.getOwnerComponent().getContentDensityClass());\n\t}\n\n\tpublic onSelectionChange(oEvent: IconTabBar$SelectEvent): void {\n\t\tconst key = oEvent.getParameter(\"selectedKey\");\n\t\tthis.getRouter().navTo(key);\n\t}\n\n\t/**\n\t * Handle cache selection change\n\t */\n\tpublic async onCacheChange(): Promise<void> {\n\t\tconst selectedCache = this.getModel(\"app\").getProperty(\"/selectedCache\");\n\t\tif (selectedCache) {\n\t\t\tawait this.loadRuntimeConfiguration(selectedCache);\n\t\t}\n\t}\n\n\t/**\n\t * Load runtime configuration for the selected cache\n\t */\n\tprivate async loadRuntimeConfiguration(cacheName: string): Promise<void> {\n\t\ttry {\n\t\t\tconst config = await this.statisticsService.getRuntimeConfiguration(cacheName);\n\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableStatistics\", config.enableStatistics);\n\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableKeyTracking\", config.enableKeyTracking);\n\t\t} catch (error) {\n\t\t\tconsole.error(\"Error loading runtime configuration:\", error);\n\t\t\t// Set defaults if loading fails\n\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableStatistics\", false);\n\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableKeyTracking\", false);\n\t\t}\n\t}\n\n\t/**\n\t * Handle statistics enable/disable switch change\n\t */\n\tpublic async onEnableStatisticsChange(oEvent: any): Promise<void> {\n\t\tconst enabled = oEvent.getParameter(\"state\");\n\t\tconst cacheName = this.getModel(\"app\").getProperty(\"/selectedCache\");\n\t\t\n\t\tif (!cacheName) {\n\t\t\tMessageBox.warning(\"
|
|
1
|
+
{"version":3,"file":"App.controller.js","names":["BaseController","_interopRequireDefault","__BaseController","App","extend","onInit","_onInit","this","getView","addStyleClass","getOwnerComponent","getContentDensityClass","onSelectionChange","_onSelectionChange","oEvent","key","getParameter","getRouter","navTo","onCacheChange","async","_onCacheChange","selectedCache","getModel","getProperty","loadRuntimeConfiguration","_loadRuntimeConfiguration","cacheName","config","statisticsService","getRuntimeConfiguration","setProperty","enableStatistics","enableKeyTracking","error","console","onEnableStatisticsChange","_onEnableStatisticsChange","enabled","MessageBox","warning","i18nText","MessageToast","show","success","setStatisticsEnabled","onEnableKeyTrackingChange","_onEnableKeyTrackingChange","setKeyTrackingEnabled","onPersistStatistics","_onPersistStatistics","persistStatistics"],"sources":["App.controller.ts"],"sourcesContent":["import MessageBox from \"sap/m/MessageBox\";\nimport BaseController from \"./BaseController\";\nimport { IconTabBar$SelectEvent } from \"sap/m/IconTabBar\";\nimport CacheStatisticsService from \"../service/CacheStatisticsService\";\nimport ODataModel from \"sap/ui/model/odata/v4/ODataModel\";\nimport JSONModel from \"sap/ui/model/json/JSONModel\";\nimport MessageToast from \"sap/m/MessageToast\";\n\n/**\n * @namespace cds.plugin.caching.dashboard.controller\n */\nexport default class App extends BaseController {\n\tprivate statisticsService: CacheStatisticsService;\n\n\n\tpublic onInit(): void {\n\t\t// apply content density mode to root view\n\t\tthis.getView().addStyleClass(this.getOwnerComponent().getContentDensityClass());\n\t}\n\n\tpublic onSelectionChange(oEvent: IconTabBar$SelectEvent): void {\n\t\tconst key = oEvent.getParameter(\"selectedKey\");\n\t\tthis.getRouter().navTo(key);\n\t}\n\n\t/**\n\t * Handle cache selection change\n\t */\n\tpublic async onCacheChange(): Promise<void> {\n\t\tconst selectedCache = this.getModel(\"app\").getProperty(\"/selectedCache\");\n\t\tif (selectedCache) {\n\t\t\tawait this.loadRuntimeConfiguration(selectedCache);\n\t\t}\n\t}\n\n\t/**\n\t * Load runtime configuration for the selected cache\n\t */\n\tprivate async loadRuntimeConfiguration(cacheName: string): Promise<void> {\n\t\ttry {\n\t\t\tconst config = await this.statisticsService.getRuntimeConfiguration(cacheName);\n\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableStatistics\", config.enableStatistics);\n\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableKeyTracking\", config.enableKeyTracking);\n\t\t} catch (error) {\n\t\t\tconsole.error(\"Error loading runtime configuration:\", error);\n\t\t\t// Set defaults if loading fails\n\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableStatistics\", false);\n\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableKeyTracking\", false);\n\t\t}\n\t}\n\n\t/**\n\t * Handle statistics enable/disable switch change\n\t */\n\tpublic async onEnableStatisticsChange(oEvent: any): Promise<void> {\n\t\tconst enabled = oEvent.getParameter(\"state\");\n\t\tconst cacheName = this.getModel(\"app\").getProperty(\"/selectedCache\");\n\t\t\n\t\tif (!cacheName) {\n\t\t\tMessageBox.warning(await this.i18nText(\"msgNoCacheSelected\"));\n\t\t\t// Revert the switch\n\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableStatistics\", !enabled);\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\t// Show loading state\n\t\t\tMessageToast.show(await this.i18nText(\"msgUpdatingStatsConfig\"));\n\t\t\t\n\t\t\tconst success = await this.statisticsService.setStatisticsEnabled(cacheName, enabled);\n\t\t\tif (success) {\n\t\t\t\tMessageToast.show(await this.i18nText(enabled ? \"msgStatsEnabled\" : \"msgStatsDisabled\"));\n\t\t\t\t// Reload the configuration to reflect the change\n\t\t\t\tawait this.loadRuntimeConfiguration(cacheName);\n\t\t\t} else {\n\t\t\t\tMessageToast.show(await this.i18nText(\"msgFailedUpdateStatsConfig\"));\n\t\t\t\t// Revert the switch\n\t\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableStatistics\", !enabled);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconsole.error(\"Error updating statistics configuration:\", error);\n\t\t\tMessageToast.show(await this.i18nText(\"msgErrorUpdateStatsConfig\"));\n\t\t\t// Revert the switch\n\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableStatistics\", !enabled);\n\t\t}\n\t}\n\n\t/**\n\t * Handle key tracking enable/disable switch change\n\t */\n\tpublic async onEnableKeyTrackingChange(oEvent: any): Promise<void> {\n\t\tconst enabled = oEvent.getParameter(\"state\");\n\t\tconst cacheName = this.getModel(\"app\").getProperty(\"/selectedCache\");\n\t\t\n\t\tif (!cacheName) {\n\t\t\tMessageBox.warning(await this.i18nText(\"msgNoCacheSelected\"));\n\t\t\t// Revert the switch\n\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableKeyTracking\", !enabled);\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\t// Show loading state\n\t\t\tMessageToast.show(await this.i18nText(\"msgUpdatingKeyTracking\"));\n\t\t\t\n\t\t\tconst success = await this.statisticsService.setKeyTrackingEnabled(cacheName, enabled);\n\t\t\tif (success) {\n\t\t\t\tMessageToast.show(await this.i18nText(enabled ? \"msgKeyTrackingEnabled\" : \"msgKeyTrackingDisabled\"));\n\t\t\t\t// Reload the configuration to reflect the change\n\t\t\t\tawait this.loadRuntimeConfiguration(cacheName);\n\t\t\t} else {\n\t\t\t\tMessageToast.show(await this.i18nText(\"msgFailedKeyTracking\"));\n\t\t\t\t// Revert the switch\n\t\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableKeyTracking\", !enabled);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconsole.error(\"Error updating key tracking configuration:\", error);\n\t\t\tMessageToast.show(await this.i18nText(\"msgErrorKeyTracking\"));\n\t\t\t// Revert the switch\n\t\t\t(this.getModel(\"app\") as JSONModel).setProperty(\"/enableKeyTracking\", !enabled);\n\t\t}\n\t}\n\n\t/**\n\t * Persist statistics to database\n\t */\n\tpublic async onPersistStatistics(): Promise<void> {\n\t\ttry {\n\t\t\tconst cacheName = this.getModel(\"app\").getProperty(\"/selectedCache\");\n\t\t\tif (!cacheName) {\n\t\t\t\tMessageBox.warning(await this.i18nText(\"msgNoCacheSelected\"));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst success = await this.statisticsService.persistStatistics(cacheName);\n\t\t\tif (success) {\n\t\t\t\tMessageToast.show(await this.i18nText(\"msgStatsPersisted\"));\n\t\t\t} else {\n\t\t\t\tMessageToast.show(await this.i18nText(\"msgFailedPersistStats\"));\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconsole.error(\"Error persisting statistics:\", error);\n\t\t\tMessageToast.show(await this.i18nText(\"msgErrorPersistStats\"));\n\t\t}\n\t}\n\n}\n"],"mappings":"+LACOA,EAAcC,EAAAC,GAOrB,MAGqBC,EAAYH,EAAcI,OAAA,+CAIvCC,OAAM,SAAAC,IAEZC,KAAKC,UAAUC,cAAcF,KAAKG,oBAAoBC,yBACvD,EAEOC,kBAAiB,SAAAC,EAACC,GACxB,MAAMC,EAAMD,EAAOE,aAAa,eAChCT,KAAKU,YAAYC,MAAMH,EACxB,EAKaI,cAAaC,eAAAC,IACzB,MAAMC,EAAgBf,KAAKgB,SAAS,OAAOC,YAAY,kBACvD,GAAIF,EAAe,OACZf,KAAKkB,yBAAyBH,EACrC,CACD,EAKcG,yBAAwBL,eAAAM,EAACC,GACtC,IACC,MAAMC,QAAerB,KAAKsB,kBAAkBC,wBAAwBH,GACnEpB,KAAKgB,SAAS,OAAqBQ,YAAY,oBAAqBH,EAAOI,kBAC3EzB,KAAKgB,SAAS,OAAqBQ,YAAY,qBAAsBH,EAAOK,kBAC9E,CAAE,MAAOC,GACRC,QAAQD,MAAM,uCAAwCA,GAErD3B,KAAKgB,SAAS,OA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AaC,WAAWpC,KAAKkC,SAAS,yBAErClC,KAAKgB,SAAS,OAAqBQ,YAAY,sBAAuBO,EACxE,CACD,CAAE,MAAOJ,GACRC,QAAQD,MAAM,6CAA8CA,GAC5DQ,EAAaC,WAAWpC,KAAKkC,SAAS,wBAErClC,KAAKgB,SAAS,OAAqBQ,YAAY,sBAAuBO,EACxE,CACD,EAKaW,oBAAmB7B,eAAA8B,IAC/B,IACC,MAAMvB,EAAYpB,KAAKgB,SAAS,OAAOC,YAAY,kBACnD,IAAKG,EAAW,CACfY,EAAWC,cAAcjC,KAAKkC,SAAS,uBACvC,MACD,CAEA,MAAMG,QAAgBrC,KAAKsB,kBAAkBsB,kBAAkBxB,GAC/D,GAAIiB,EAAS,CACZF,EAAaC,WAAWpC,KAAKkC,SAAS,qBACvC,KAAO,CACNC,EAAaC,WAAWpC,KAAKkC,SAAS,yBACvC,CACD,CAAE,MAAOP,GACRC,QAAQD,MAAM,+BAAgCA,GAC9CQ,EAAaC,WAAWpC,KAAKkC,SAAS,wBACvC,CACD,IAAC,OArImBtC,CAAG","ignoreList":[]}
|
|
@@ -57,7 +57,7 @@ export default class App extends BaseController {
|
|
|
57
57
|
const cacheName = this.getModel("app").getProperty("/selectedCache");
|
|
58
58
|
|
|
59
59
|
if (!cacheName) {
|
|
60
|
-
MessageBox.warning(
|
|
60
|
+
MessageBox.warning(await this.i18nText("msgNoCacheSelected"));
|
|
61
61
|
// Revert the switch
|
|
62
62
|
(this.getModel("app") as JSONModel).setProperty("/enableStatistics", !enabled);
|
|
63
63
|
return;
|
|
@@ -65,21 +65,21 @@ export default class App extends BaseController {
|
|
|
65
65
|
|
|
66
66
|
try {
|
|
67
67
|
// Show loading state
|
|
68
|
-
MessageToast.show(
|
|
68
|
+
MessageToast.show(await this.i18nText("msgUpdatingStatsConfig"));
|
|
69
69
|
|
|
70
70
|
const success = await this.statisticsService.setStatisticsEnabled(cacheName, enabled);
|
|
71
71
|
if (success) {
|
|
72
|
-
MessageToast.show(
|
|
72
|
+
MessageToast.show(await this.i18nText(enabled ? "msgStatsEnabled" : "msgStatsDisabled"));
|
|
73
73
|
// Reload the configuration to reflect the change
|
|
74
74
|
await this.loadRuntimeConfiguration(cacheName);
|
|
75
75
|
} else {
|
|
76
|
-
MessageToast.show(
|
|
76
|
+
MessageToast.show(await this.i18nText("msgFailedUpdateStatsConfig"));
|
|
77
77
|
// Revert the switch
|
|
78
78
|
(this.getModel("app") as JSONModel).setProperty("/enableStatistics", !enabled);
|
|
79
79
|
}
|
|
80
80
|
} catch (error) {
|
|
81
81
|
console.error("Error updating statistics configuration:", error);
|
|
82
|
-
MessageToast.show(
|
|
82
|
+
MessageToast.show(await this.i18nText("msgErrorUpdateStatsConfig"));
|
|
83
83
|
// Revert the switch
|
|
84
84
|
(this.getModel("app") as JSONModel).setProperty("/enableStatistics", !enabled);
|
|
85
85
|
}
|
|
@@ -93,7 +93,7 @@ export default class App extends BaseController {
|
|
|
93
93
|
const cacheName = this.getModel("app").getProperty("/selectedCache");
|
|
94
94
|
|
|
95
95
|
if (!cacheName) {
|
|
96
|
-
MessageBox.warning(
|
|
96
|
+
MessageBox.warning(await this.i18nText("msgNoCacheSelected"));
|
|
97
97
|
// Revert the switch
|
|
98
98
|
(this.getModel("app") as JSONModel).setProperty("/enableKeyTracking", !enabled);
|
|
99
99
|
return;
|
|
@@ -101,21 +101,21 @@ export default class App extends BaseController {
|
|
|
101
101
|
|
|
102
102
|
try {
|
|
103
103
|
// Show loading state
|
|
104
|
-
MessageToast.show(
|
|
104
|
+
MessageToast.show(await this.i18nText("msgUpdatingKeyTracking"));
|
|
105
105
|
|
|
106
106
|
const success = await this.statisticsService.setKeyTrackingEnabled(cacheName, enabled);
|
|
107
107
|
if (success) {
|
|
108
|
-
MessageToast.show(
|
|
108
|
+
MessageToast.show(await this.i18nText(enabled ? "msgKeyTrackingEnabled" : "msgKeyTrackingDisabled"));
|
|
109
109
|
// Reload the configuration to reflect the change
|
|
110
110
|
await this.loadRuntimeConfiguration(cacheName);
|
|
111
111
|
} else {
|
|
112
|
-
MessageToast.show(
|
|
112
|
+
MessageToast.show(await this.i18nText("msgFailedKeyTracking"));
|
|
113
113
|
// Revert the switch
|
|
114
114
|
(this.getModel("app") as JSONModel).setProperty("/enableKeyTracking", !enabled);
|
|
115
115
|
}
|
|
116
116
|
} catch (error) {
|
|
117
117
|
console.error("Error updating key tracking configuration:", error);
|
|
118
|
-
MessageToast.show(
|
|
118
|
+
MessageToast.show(await this.i18nText("msgErrorKeyTracking"));
|
|
119
119
|
// Revert the switch
|
|
120
120
|
(this.getModel("app") as JSONModel).setProperty("/enableKeyTracking", !enabled);
|
|
121
121
|
}
|
|
@@ -128,19 +128,19 @@ export default class App extends BaseController {
|
|
|
128
128
|
try {
|
|
129
129
|
const cacheName = this.getModel("app").getProperty("/selectedCache");
|
|
130
130
|
if (!cacheName) {
|
|
131
|
-
MessageBox.warning(
|
|
131
|
+
MessageBox.warning(await this.i18nText("msgNoCacheSelected"));
|
|
132
132
|
return;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
const success = await this.statisticsService.persistStatistics(cacheName);
|
|
136
136
|
if (success) {
|
|
137
|
-
MessageToast.show(
|
|
137
|
+
MessageToast.show(await this.i18nText("msgStatsPersisted"));
|
|
138
138
|
} else {
|
|
139
|
-
MessageToast.show(
|
|
139
|
+
MessageToast.show(await this.i18nText("msgFailedPersistStats"));
|
|
140
140
|
}
|
|
141
141
|
} catch (error) {
|
|
142
142
|
console.error("Error persisting statistics:", error);
|
|
143
|
-
MessageToast.show(
|
|
143
|
+
MessageToast.show(await this.i18nText("msgErrorPersistStats"));
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
@@ -28,6 +28,13 @@ sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/core/UIComponent", "sap/ui/
|
|
|
28
28
|
const oModel = this.getOwnerComponent().getModel("i18n");
|
|
29
29
|
return oModel.getResourceBundle();
|
|
30
30
|
},
|
|
31
|
+
/**
|
|
32
|
+
* Returns a translated string from the i18n bundle (ResourceModel is async).
|
|
33
|
+
*/
|
|
34
|
+
i18nText: async function _i18nText(sKey, aArgs) {
|
|
35
|
+
const oBundle = await this.getResourceBundle();
|
|
36
|
+
return aArgs && aArgs.length ? oBundle.getText(sKey, aArgs) : oBundle.getText(sKey);
|
|
37
|
+
},
|
|
31
38
|
/**
|
|
32
39
|
* Convenience method for getting the view model by name in every controller of the application.
|
|
33
40
|
* @param [sName] The model name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseController-dbg.js","names":["BaseController","Controller","extend","onInit","_onInit","getOwnerComponent","_getOwnerComponent","Controller.prototype.getOwnerComponent.call","getRouter","_getRouter","UIComponent","getRouterFor","getResourceBundle","_getResourceBundle","oModel","getModel","_getModel","sName","getView","setModel","_setModel","navTo","_navTo","oParameters","bReplace","undefined","onNavBack","_onNavBack","sPreviousHash","History","getInstance","getPreviousHash","window","history","go"],"sources":["BaseController.ts"],"sourcesContent":["import Controller from \"sap/ui/core/mvc/Controller\";\nimport UIComponent from \"sap/ui/core/UIComponent\";\nimport AppComponent from \"../Component\";\nimport Model from \"sap/ui/model/Model\";\nimport ResourceModel from \"sap/ui/model/resource/ResourceModel\";\nimport ResourceBundle from \"sap/base/i18n/ResourceBundle\";\nimport Router from \"sap/ui/core/routing/Router\";\nimport History from \"sap/ui/core/routing/History\";\n\n/**\n * @namespace cds.plugin.caching.dashboard.controller\n */\nexport default abstract class BaseController extends Controller {\n\n\tpublic onInit(): void {\n\t\t\n\t}\n\n\t/**\n\t * Convenience method for accessing the component of the controller's view.\n\t * @returns The component of the controller's view\n\t */\n\tpublic getOwnerComponent(): AppComponent {\n\t\treturn super.getOwnerComponent() as AppComponent;\n\t}\n\n\t/**\n\t * Convenience method to get the components' router instance.\n\t * @returns The router instance\n\t */\n\tpublic getRouter(): Router {\n\t\treturn UIComponent.getRouterFor(this);\n\t}\n\n\t/**\n\t * Convenience method for getting the i18n resource bundle of the component.\n\t * @returns {Promise<sap.base.i18n.ResourceBundle>} The i18n resource bundle of the component\n\t */\n\tpublic getResourceBundle(): Promise<ResourceBundle> {\n\t\tconst oModel = this.getOwnerComponent().getModel(\"i18n\") as ResourceModel;\n\t\treturn oModel.getResourceBundle() as Promise<ResourceBundle>;\n\t}\n\n\t/**\n\t * Convenience method for getting the view model by name in every controller of the application.\n\t * @param [sName] The model name\n\t * @returns The model instance\n\t */\n\tpublic getModel(sName?: string): Model {\n\t\treturn this.getView().getModel(sName);\n\t}\n\n\t/**\n\t * Convenience method for setting the view model in every controller of the application.\n\t * @param oModel The model instance\n\t * @param [sName] The model name\n\t * @returns The current base controller instance\n\t */\n\tpublic setModel(oModel: Model, sName?: string): BaseController {\n\t\tthis.getView().setModel(oModel, sName);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Convenience method for triggering the navigation to a specific target.\n\t * @public\n\t * @param sName Target name\n\t * @param [oParameters] Navigation parameters\n\t * @param [bReplace] Defines if the hash should be replaced (no browser history entry) or set (browser history entry)\n\t */\n\tpublic navTo(sName: string, oParameters?: object, bReplace?: boolean): void {\n\t\tthis.getRouter().navTo(sName, oParameters, undefined, bReplace);\n\t}\n\n\t/**\n\t * Convenience event handler for navigating back.\n\t * It there is a history entry we go one step back in the browser history\n\t * If not, it will replace the current entry of the browser history with the main route.\n\t */\n\tpublic onNavBack(): void {\n\t\tconst sPreviousHash = History.getInstance().getPreviousHash();\n\t\tif (sPreviousHash !== undefined) {\n\t\t\twindow.history.go(-1);\n\t\t} else {\n\t\t\tthis.getRouter().navTo(\"main\", {}, undefined, true);\n\t\t}\n\t}\n}\n"],"mappings":";;;EASA;AACA;AACA;EAFA,MAG8BA,cAAc,GAASC,UAAU,CAAAC,MAAA;IAEvDC,MAAM,WAAAC,QAAA,EAAS,CAEtB,CAAC;IAED;AACD;AACA;AACA;IACQC,iBAAiB,WAAAC,mBAAA,EAAiB;MACxC,OAAAC,2CAAA;IACD,CAAC;IAED;AACD;AACA;AACA;IACQC,SAAS,WAAAC,WAAA,EAAW;MAC1B,OAAOC,WAAW,CAACC,YAAY,CAAC,IAAI,CAAC;IACtC,CAAC;IAED;AACD;AACA;AACA;IACQC,iBAAiB,WAAAC,mBAAA,EAA4B;MACnD,MAAMC,MAAM,GAAG,IAAI,CAACT,iBAAiB,CAAC,CAAC,CAACU,QAAQ,CAAC,MAAM,CAAkB;MACzE,OAAOD,MAAM,CAACF,iBAAiB,CAAC,CAAC;IAClC,CAAC;IAED;AACD;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"file":"BaseController-dbg.js","names":["BaseController","Controller","extend","onInit","_onInit","getOwnerComponent","_getOwnerComponent","Controller.prototype.getOwnerComponent.call","getRouter","_getRouter","UIComponent","getRouterFor","getResourceBundle","_getResourceBundle","oModel","getModel","i18nText","_i18nText","sKey","aArgs","oBundle","length","getText","_getModel","sName","getView","setModel","_setModel","navTo","_navTo","oParameters","bReplace","undefined","onNavBack","_onNavBack","sPreviousHash","History","getInstance","getPreviousHash","window","history","go"],"sources":["BaseController.ts"],"sourcesContent":["import Controller from \"sap/ui/core/mvc/Controller\";\nimport UIComponent from \"sap/ui/core/UIComponent\";\nimport AppComponent from \"../Component\";\nimport Model from \"sap/ui/model/Model\";\nimport ResourceModel from \"sap/ui/model/resource/ResourceModel\";\nimport ResourceBundle from \"sap/base/i18n/ResourceBundle\";\nimport Router from \"sap/ui/core/routing/Router\";\nimport History from \"sap/ui/core/routing/History\";\n\n/**\n * @namespace cds.plugin.caching.dashboard.controller\n */\nexport default abstract class BaseController extends Controller {\n\n\tpublic onInit(): void {\n\t\t\n\t}\n\n\t/**\n\t * Convenience method for accessing the component of the controller's view.\n\t * @returns The component of the controller's view\n\t */\n\tpublic getOwnerComponent(): AppComponent {\n\t\treturn super.getOwnerComponent() as AppComponent;\n\t}\n\n\t/**\n\t * Convenience method to get the components' router instance.\n\t * @returns The router instance\n\t */\n\tpublic getRouter(): Router {\n\t\treturn UIComponent.getRouterFor(this);\n\t}\n\n\t/**\n\t * Convenience method for getting the i18n resource bundle of the component.\n\t * @returns {Promise<sap.base.i18n.ResourceBundle>} The i18n resource bundle of the component\n\t */\n\tpublic getResourceBundle(): Promise<ResourceBundle> {\n\t\tconst oModel = this.getOwnerComponent().getModel(\"i18n\") as ResourceModel;\n\t\treturn oModel.getResourceBundle() as Promise<ResourceBundle>;\n\t}\n\n\t/**\n\t * Returns a translated string from the i18n bundle (ResourceModel is async).\n\t */\n\tpublic async i18nText(sKey: string, aArgs?: (string | number)[]): Promise<string> {\n\t\tconst oBundle = await this.getResourceBundle();\n\t\treturn aArgs && aArgs.length\n\t\t\t? oBundle.getText(sKey, aArgs)\n\t\t\t: oBundle.getText(sKey);\n\t}\n\n\t/**\n\t * Convenience method for getting the view model by name in every controller of the application.\n\t * @param [sName] The model name\n\t * @returns The model instance\n\t */\n\tpublic getModel(sName?: string): Model {\n\t\treturn this.getView().getModel(sName);\n\t}\n\n\t/**\n\t * Convenience method for setting the view model in every controller of the application.\n\t * @param oModel The model instance\n\t * @param [sName] The model name\n\t * @returns The current base controller instance\n\t */\n\tpublic setModel(oModel: Model, sName?: string): BaseController {\n\t\tthis.getView().setModel(oModel, sName);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Convenience method for triggering the navigation to a specific target.\n\t * @public\n\t * @param sName Target name\n\t * @param [oParameters] Navigation parameters\n\t * @param [bReplace] Defines if the hash should be replaced (no browser history entry) or set (browser history entry)\n\t */\n\tpublic navTo(sName: string, oParameters?: object, bReplace?: boolean): void {\n\t\tthis.getRouter().navTo(sName, oParameters, undefined, bReplace);\n\t}\n\n\t/**\n\t * Convenience event handler for navigating back.\n\t * It there is a history entry we go one step back in the browser history\n\t * If not, it will replace the current entry of the browser history with the main route.\n\t */\n\tpublic onNavBack(): void {\n\t\tconst sPreviousHash = History.getInstance().getPreviousHash();\n\t\tif (sPreviousHash !== undefined) {\n\t\t\twindow.history.go(-1);\n\t\t} else {\n\t\t\tthis.getRouter().navTo(\"main\", {}, undefined, true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AC,OAACL,KAAa,EAAEM,WAAoB,EAAEC,QAAkB,EAAQ;MAC3E,IAAI,CAACvB,SAAS,CAAC,CAAC,CAACoB,KAAK,CAACJ,KAAK,EAAEM,WAAW,EAAEE,SAAS,EAAED,QAAQ,CAAC;IAChE,CAAC;IAED;AACD;AACA;AACA;AACA;IACQE,SAAS,WAAAC,WAAA,EAAS;MACxB,MAAMC,aAAa,GAAGC,OAAO,CAACC,WAAW,CAAC,CAAC,CAACC,eAAe,CAAC,CAAC;MAC7D,IAAIH,aAAa,KAAKH,SAAS,EAAE;QAChCO,MAAM,CAACC,OAAO,CAACC,EAAE,CAAC,CAAC,CAAC,CAAC;MACtB,CAAC,MAAM;QACN,IAAI,CAACjC,SAAS,CAAC,CAAC,CAACoB,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,EAAEI,SAAS,EAAE,IAAI,CAAC;MACpD;IACD;EAAC;EAAA,OApF4BhC,cAAc;AAAA","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
sap.ui.define(["sap/ui/core/mvc/Controller","sap/ui/core/UIComponent","sap/ui/core/routing/History"],function(e,t,n){"use strict";const o=e.extend("cds.plugin.caching.dashboard.controller.BaseController",{onInit:function e(){},getOwnerComponent:function t(){return e.prototype.getOwnerComponent.call(this)},getRouter:function e(){return t.getRouterFor(this)},getResourceBundle:function e(){const t=this.getOwnerComponent().getModel("i18n");return t.getResourceBundle()},getModel:function e(t){return this.getView().getModel(t)},setModel:function e(t,n){this.getView().setModel(t,n);return this},navTo:function e(t,n,o){this.getRouter().navTo(t,n,undefined,o)},onNavBack:function e(){const t=n.getInstance().getPreviousHash();if(t!==undefined){window.history.go(-1)}else{this.getRouter().navTo("main",{},undefined,true)}}});return o});
|
|
1
|
+
sap.ui.define(["sap/ui/core/mvc/Controller","sap/ui/core/UIComponent","sap/ui/core/routing/History"],function(e,t,n){"use strict";const o=e.extend("cds.plugin.caching.dashboard.controller.BaseController",{onInit:function e(){},getOwnerComponent:function t(){return e.prototype.getOwnerComponent.call(this)},getRouter:function e(){return t.getRouterFor(this)},getResourceBundle:function e(){const t=this.getOwnerComponent().getModel("i18n");return t.getResourceBundle()},i18nText:async function e(t,n){const o=await this.getResourceBundle();return n&&n.length?o.getText(t,n):o.getText(t)},getModel:function e(t){return this.getView().getModel(t)},setModel:function e(t,n){this.getView().setModel(t,n);return this},navTo:function e(t,n,o){this.getRouter().navTo(t,n,undefined,o)},onNavBack:function e(){const t=n.getInstance().getPreviousHash();if(t!==undefined){window.history.go(-1)}else{this.getRouter().navTo("main",{},undefined,true)}}});return o});
|
|
2
2
|
//# sourceMappingURL=BaseController.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseController.js","names":["BaseController","Controller","extend","onInit","_onInit","getOwnerComponent","_getOwnerComponent","Controller.prototype.getOwnerComponent.call","this","getRouter","_getRouter","UIComponent","getRouterFor","getResourceBundle","_getResourceBundle","oModel","getModel","_getModel","sName","getView","setModel","_setModel","navTo","_navTo","oParameters","bReplace","undefined","onNavBack","_onNavBack","sPreviousHash","History","getInstance","getPreviousHash","window","history","go"],"sources":["BaseController.ts"],"sourcesContent":["import Controller from \"sap/ui/core/mvc/Controller\";\nimport UIComponent from \"sap/ui/core/UIComponent\";\nimport AppComponent from \"../Component\";\nimport Model from \"sap/ui/model/Model\";\nimport ResourceModel from \"sap/ui/model/resource/ResourceModel\";\nimport ResourceBundle from \"sap/base/i18n/ResourceBundle\";\nimport Router from \"sap/ui/core/routing/Router\";\nimport History from \"sap/ui/core/routing/History\";\n\n/**\n * @namespace cds.plugin.caching.dashboard.controller\n */\nexport default abstract class BaseController extends Controller {\n\n\tpublic onInit(): void {\n\t\t\n\t}\n\n\t/**\n\t * Convenience method for accessing the component of the controller's view.\n\t * @returns The component of the controller's view\n\t */\n\tpublic getOwnerComponent(): AppComponent {\n\t\treturn super.getOwnerComponent() as AppComponent;\n\t}\n\n\t/**\n\t * Convenience method to get the components' router instance.\n\t * @returns The router instance\n\t */\n\tpublic getRouter(): Router {\n\t\treturn UIComponent.getRouterFor(this);\n\t}\n\n\t/**\n\t * Convenience method for getting the i18n resource bundle of the component.\n\t * @returns {Promise<sap.base.i18n.ResourceBundle>} The i18n resource bundle of the component\n\t */\n\tpublic getResourceBundle(): Promise<ResourceBundle> {\n\t\tconst oModel = this.getOwnerComponent().getModel(\"i18n\") as ResourceModel;\n\t\treturn oModel.getResourceBundle() as Promise<ResourceBundle>;\n\t}\n\n\t/**\n\t * Convenience method for getting the view model by name in every controller of the application.\n\t * @param [sName] The model name\n\t * @returns The model instance\n\t */\n\tpublic getModel(sName?: string): Model {\n\t\treturn this.getView().getModel(sName);\n\t}\n\n\t/**\n\t * Convenience method for setting the view model in every controller of the application.\n\t * @param oModel The model instance\n\t * @param [sName] The model name\n\t * @returns The current base controller instance\n\t */\n\tpublic setModel(oModel: Model, sName?: string): BaseController {\n\t\tthis.getView().setModel(oModel, sName);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Convenience method for triggering the navigation to a specific target.\n\t * @public\n\t * @param sName Target name\n\t * @param [oParameters] Navigation parameters\n\t * @param [bReplace] Defines if the hash should be replaced (no browser history entry) or set (browser history entry)\n\t */\n\tpublic navTo(sName: string, oParameters?: object, bReplace?: boolean): void {\n\t\tthis.getRouter().navTo(sName, oParameters, undefined, bReplace);\n\t}\n\n\t/**\n\t * Convenience event handler for navigating back.\n\t * It there is a history entry we go one step back in the browser history\n\t * If not, it will replace the current entry of the browser history with the main route.\n\t */\n\tpublic onNavBack(): void {\n\t\tconst sPreviousHash = History.getInstance().getPreviousHash();\n\t\tif (sPreviousHash !== undefined) {\n\t\t\twindow.history.go(-1);\n\t\t} else {\n\t\t\tthis.getRouter().navTo(\"main\", {}, undefined, true);\n\t\t}\n\t}\n}\n"],"mappings":"kIASA,MAG8BA,EAAuBC,EAAUC,OAAA,0DAEvDC,OAAM,SAAAC,IAEb,EAMOC,kBAAiB,SAAAC,IACvB,OAAAC,mCAAAC,KACD,EAMOC,UAAS,SAAAC,IACf,OAAOC,EAAYC,aAAaJ,KACjC,EAMOK,kBAAiB,SAAAC,IACvB,MAAMC,EAASP,KAAKH,oBAAoBW,SAAS,QACjD,OAAOD,EAAOF,mBACf,
|
|
1
|
+
{"version":3,"file":"BaseController.js","names":["BaseController","Controller","extend","onInit","_onInit","getOwnerComponent","_getOwnerComponent","Controller.prototype.getOwnerComponent.call","this","getRouter","_getRouter","UIComponent","getRouterFor","getResourceBundle","_getResourceBundle","oModel","getModel","i18nText","async","_i18nText","sKey","aArgs","oBundle","length","getText","_getModel","sName","getView","setModel","_setModel","navTo","_navTo","oParameters","bReplace","undefined","onNavBack","_onNavBack","sPreviousHash","History","getInstance","getPreviousHash","window","history","go"],"sources":["BaseController.ts"],"sourcesContent":["import Controller from \"sap/ui/core/mvc/Controller\";\nimport UIComponent from \"sap/ui/core/UIComponent\";\nimport AppComponent from \"../Component\";\nimport Model from \"sap/ui/model/Model\";\nimport ResourceModel from \"sap/ui/model/resource/ResourceModel\";\nimport ResourceBundle from \"sap/base/i18n/ResourceBundle\";\nimport Router from \"sap/ui/core/routing/Router\";\nimport History from \"sap/ui/core/routing/History\";\n\n/**\n * @namespace cds.plugin.caching.dashboard.controller\n */\nexport default abstract class BaseController extends Controller {\n\n\tpublic onInit(): void {\n\t\t\n\t}\n\n\t/**\n\t * Convenience method for accessing the component of the controller's view.\n\t * @returns The component of the controller's view\n\t */\n\tpublic getOwnerComponent(): AppComponent {\n\t\treturn super.getOwnerComponent() as AppComponent;\n\t}\n\n\t/**\n\t * Convenience method to get the components' router instance.\n\t * @returns The router instance\n\t */\n\tpublic getRouter(): Router {\n\t\treturn UIComponent.getRouterFor(this);\n\t}\n\n\t/**\n\t * Convenience method for getting the i18n resource bundle of the component.\n\t * @returns {Promise<sap.base.i18n.ResourceBundle>} The i18n resource bundle of the component\n\t */\n\tpublic getResourceBundle(): Promise<ResourceBundle> {\n\t\tconst oModel = this.getOwnerComponent().getModel(\"i18n\") as ResourceModel;\n\t\treturn oModel.getResourceBundle() as Promise<ResourceBundle>;\n\t}\n\n\t/**\n\t * Returns a translated string from the i18n bundle (ResourceModel is async).\n\t */\n\tpublic async i18nText(sKey: string, aArgs?: (string | number)[]): Promise<string> {\n\t\tconst oBundle = await this.getResourceBundle();\n\t\treturn aArgs && aArgs.length\n\t\t\t? oBundle.getText(sKey, aArgs)\n\t\t\t: oBundle.getText(sKey);\n\t}\n\n\t/**\n\t * Convenience method for getting the view model by name in every controller of the application.\n\t * @param [sName] The model name\n\t * @returns The model instance\n\t */\n\tpublic getModel(sName?: string): Model {\n\t\treturn this.getView().getModel(sName);\n\t}\n\n\t/**\n\t * Convenience method for setting the view model in every controller of the application.\n\t * @param oModel The model instance\n\t * @param [sName] The model name\n\t * @returns The current base controller instance\n\t */\n\tpublic setModel(oModel: Model, sName?: string): BaseController {\n\t\tthis.getView().setModel(oModel, sName);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Convenience method for triggering the navigation to a specific target.\n\t * @public\n\t * @param sName Target name\n\t * @param [oParameters] Navigation parameters\n\t * @param [bReplace] Defines if the hash should be replaced (no browser history entry) or set (browser history entry)\n\t */\n\tpublic navTo(sName: string, oParameters?: object, bReplace?: boolean): void {\n\t\tthis.getRouter().navTo(sName, oParameters, undefined, bReplace);\n\t}\n\n\t/**\n\t * Convenience event handler for navigating back.\n\t * It there is a history entry we go one step back in the browser history\n\t * If not, it will replace the current entry of the browser history with the main route.\n\t */\n\tpublic onNavBack(): void {\n\t\tconst sPreviousHash = History.getInstance().getPreviousHash();\n\t\tif (sPreviousHash !== undefined) {\n\t\t\twindow.history.go(-1);\n\t\t} else {\n\t\t\tthis.getRouter().navTo(\"main\", {}, undefined, true);\n\t\t}\n\t}\n}\n"],"mappings":"kIASA,MAG8BA,EAAuBC,EAAUC,OAAA,0DAEvDC,OAAM,SAAAC,IAEb,EAMOC,kBAAiB,SAAAC,IACvB,OAAAC,mCAAAC,KACD,EAMOC,UAAS,SAAAC,IACf,OAAOC,EAAYC,aAAaJ,KACjC,EAMOK,kBAAiB,SAAAC,IACvB,MAAMC,EAASP,KAAKH,oBAAoBW,SAAS,QACjD,OAAOD,EAAOF,mBACf,EAKaI,SAAQC,eAAAC,EAACC,EAAcC,GACnC,MAAMC,QAAgBd,KAAKK,oBAC3B,OAAOQ,GAASA,EAAME,OACnBD,EAAQE,QAAQJ,EAAMC,GACtBC,EAAQE,QAAQJ,EACpB,EAOOJ,SAAQ,SAAAS,EAACC,GACf,OAAOlB,KAAKmB,UAAUX,SAASU,EAChC,EAQOE,SAAQ,SAAAC,EAACd,EAAeW,GAC9BlB,KAAKmB,UAAUC,SAASb,EAAQW,GAChC,OAAOlB,IACR,EASOsB,MAAK,SAAAC,EAACL,EAAeM,EAAsBC,GACjDzB,KAAKC,YAAYqB,MAAMJ,EAAOM,EAAaE,UAAWD,EACvD,EAOOE,UAAS,SAAAC,IACf,MAAMC,EAAgBC,EAAQC,cAAcC,kBAC5C,GAAIH,IAAkBH,UAAW,CAChCO,OAAOC,QAAQC,IAAI,EACpB,KAAO,CACNnC,KAAKC,YAAYqB,MAAM,OAAQ,CAAC,EAAGI,UAAW,KAC/C,CACD,IAAC,OApF4BlC,CAAc","ignoreList":[]}
|
|
@@ -41,6 +41,16 @@ export default abstract class BaseController extends Controller {
|
|
|
41
41
|
return oModel.getResourceBundle() as Promise<ResourceBundle>;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
/**
|
|
45
|
+
* Returns a translated string from the i18n bundle (ResourceModel is async).
|
|
46
|
+
*/
|
|
47
|
+
public async i18nText(sKey: string, aArgs?: (string | number)[]): Promise<string> {
|
|
48
|
+
const oBundle = await this.getResourceBundle();
|
|
49
|
+
return aArgs && aArgs.length
|
|
50
|
+
? oBundle.getText(sKey, aArgs)
|
|
51
|
+
: oBundle.getText(sKey);
|
|
52
|
+
}
|
|
53
|
+
|
|
44
54
|
/**
|
|
45
55
|
* Convenience method for getting the view model by name in every controller of the application.
|
|
46
56
|
* @param [sName] The model name
|