cds-caching 1.2.0 → 1.3.0
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 +195 -1114
- package/app/dashboard/Component-dbg.js +59 -0
- package/app/dashboard/Component-dbg.js.map +1 -0
- package/app/dashboard/Component.js +2 -0
- package/app/dashboard/Component.js.map +1 -0
- package/app/dashboard/Component.ts +59 -0
- package/app/dashboard/controller/App-dbg.controller.js +132 -0
- package/app/dashboard/controller/App-dbg.controller.js.map +1 -0
- package/app/dashboard/controller/App.controller.js +2 -0
- package/app/dashboard/controller/App.controller.js.map +1 -0
- package/app/dashboard/controller/App.controller.ts +147 -0
- package/app/dashboard/controller/BaseController-dbg.js +75 -0
- package/app/dashboard/controller/BaseController-dbg.js.map +1 -0
- package/app/dashboard/controller/BaseController.js +2 -0
- package/app/dashboard/controller/BaseController.js.map +1 -0
- package/app/dashboard/controller/BaseController.ts +88 -0
- package/app/dashboard/controller/Cache-dbg.controller.js +421 -0
- package/app/dashboard/controller/Cache-dbg.controller.js.map +1 -0
- package/app/dashboard/controller/Cache.controller.js +2 -0
- package/app/dashboard/controller/Cache.controller.js.map +1 -0
- package/app/dashboard/controller/Cache.controller.ts +490 -0
- package/app/dashboard/controller/Main-dbg.controller.js +32 -0
- package/app/dashboard/controller/Main-dbg.controller.js.map +1 -0
- package/app/dashboard/controller/Main.controller.js +2 -0
- package/app/dashboard/controller/Main.controller.js.map +1 -0
- package/app/dashboard/controller/Main.controller.ts +31 -0
- package/app/dashboard/controller/SingleMetric-dbg.controller.js +306 -0
- package/app/dashboard/controller/SingleMetric-dbg.controller.js.map +1 -0
- package/app/dashboard/controller/SingleMetric.controller.js +2 -0
- package/app/dashboard/controller/SingleMetric.controller.js.map +1 -0
- package/app/dashboard/controller/SingleMetric.controller.ts +335 -0
- package/app/dashboard/i18n/i18n.properties +61 -0
- package/app/dashboard/i18n/i18n_de.properties +3 -0
- package/app/dashboard/i18n/i18n_en.properties +3 -0
- package/app/dashboard/index-cdn.html +28 -0
- package/app/dashboard/index.html +19 -0
- package/app/dashboard/manifest.json +145 -0
- package/app/dashboard/model/formatter-dbg.js +253 -0
- package/app/dashboard/model/formatter-dbg.js.map +1 -0
- package/app/dashboard/model/formatter.js +2 -0
- package/app/dashboard/model/formatter.js.map +1 -0
- package/app/dashboard/model/formatter.ts +275 -0
- package/app/dashboard/model/models-dbg.js +13 -0
- package/app/dashboard/model/models-dbg.js.map +1 -0
- package/app/dashboard/model/models.js +2 -0
- package/app/dashboard/model/models.js.map +1 -0
- package/app/dashboard/model/models.ts +13 -0
- package/app/dashboard/resources/sap-ui-custom-dbg.js +4695 -0
- package/app/dashboard/resources/sap-ui-custom-dbg.js.map +1 -0
- package/app/dashboard/resources/sap-ui-custom.js +5794 -0
- package/app/dashboard/resources/sap-ui-custom.js.map +1 -0
- package/app/dashboard/service/CacheStatisticsService-dbg.js +267 -0
- package/app/dashboard/service/CacheStatisticsService-dbg.js.map +1 -0
- package/app/dashboard/service/CacheStatisticsService.js +2 -0
- package/app/dashboard/service/CacheStatisticsService.js.map +1 -0
- package/app/dashboard/service/CacheStatisticsService.ts +397 -0
- package/app/dashboard/view/App.view.xml +18 -0
- package/app/dashboard/view/Cache.view.xml +777 -0
- package/app/dashboard/view/Main.view.xml +57 -0
- package/app/dashboard/view/SingleMetric.view.xml +337 -0
- package/cds-plugin.js +52 -0
- package/db/cache-store.cds +12 -0
- package/db/statistics.cds +128 -0
- package/index.cds +2 -128
- package/lib/CachingService.js +13 -0
- package/lib/add.js +17 -0
- package/lib/operations/AsyncOperations.js +162 -111
- package/lib/operations/BasicOperations.js +35 -0
- package/lib/operations/CapOperations.js +92 -40
- package/lib/support/CacheStatisticsHandler.js +35 -10
- package/lib/support/CacheStoreManager.js +29 -0
- package/lib/support/KeyvCDS.js +149 -0
- package/lib/support/MultitenancyDetector.js +25 -0
- package/lib/support/RuntimeConfigurationManager.js +69 -37
- package/lib/support/StatisticsPersistenceManager.js +18 -2
- package/lib/support/Telemetry.js +137 -0
- package/lib/util.js +29 -11
- package/package.json +44 -12
- package/srv/caching-api-service.js +47 -2
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import Controller from "sap/ui/core/mvc/Controller";
|
|
2
|
+
import UIComponent from "sap/ui/core/UIComponent";
|
|
3
|
+
import AppComponent from "../Component";
|
|
4
|
+
import Model from "sap/ui/model/Model";
|
|
5
|
+
import ResourceModel from "sap/ui/model/resource/ResourceModel";
|
|
6
|
+
import ResourceBundle from "sap/base/i18n/ResourceBundle";
|
|
7
|
+
import Router from "sap/ui/core/routing/Router";
|
|
8
|
+
import History from "sap/ui/core/routing/History";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @namespace cds.plugin.caching.dashboard.controller
|
|
12
|
+
*/
|
|
13
|
+
export default abstract class BaseController extends Controller {
|
|
14
|
+
|
|
15
|
+
public onInit(): void {
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Convenience method for accessing the component of the controller's view.
|
|
21
|
+
* @returns The component of the controller's view
|
|
22
|
+
*/
|
|
23
|
+
public getOwnerComponent(): AppComponent {
|
|
24
|
+
return super.getOwnerComponent() as AppComponent;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Convenience method to get the components' router instance.
|
|
29
|
+
* @returns The router instance
|
|
30
|
+
*/
|
|
31
|
+
public getRouter(): Router {
|
|
32
|
+
return UIComponent.getRouterFor(this);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Convenience method for getting the i18n resource bundle of the component.
|
|
37
|
+
* @returns {Promise<sap.base.i18n.ResourceBundle>} The i18n resource bundle of the component
|
|
38
|
+
*/
|
|
39
|
+
public getResourceBundle(): Promise<ResourceBundle> {
|
|
40
|
+
const oModel = this.getOwnerComponent().getModel("i18n") as ResourceModel;
|
|
41
|
+
return oModel.getResourceBundle() as Promise<ResourceBundle>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Convenience method for getting the view model by name in every controller of the application.
|
|
46
|
+
* @param [sName] The model name
|
|
47
|
+
* @returns The model instance
|
|
48
|
+
*/
|
|
49
|
+
public getModel(sName?: string): Model {
|
|
50
|
+
return this.getView().getModel(sName);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Convenience method for setting the view model in every controller of the application.
|
|
55
|
+
* @param oModel The model instance
|
|
56
|
+
* @param [sName] The model name
|
|
57
|
+
* @returns The current base controller instance
|
|
58
|
+
*/
|
|
59
|
+
public setModel(oModel: Model, sName?: string): BaseController {
|
|
60
|
+
this.getView().setModel(oModel, sName);
|
|
61
|
+
return this;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Convenience method for triggering the navigation to a specific target.
|
|
66
|
+
* @public
|
|
67
|
+
* @param sName Target name
|
|
68
|
+
* @param [oParameters] Navigation parameters
|
|
69
|
+
* @param [bReplace] Defines if the hash should be replaced (no browser history entry) or set (browser history entry)
|
|
70
|
+
*/
|
|
71
|
+
public navTo(sName: string, oParameters?: object, bReplace?: boolean): void {
|
|
72
|
+
this.getRouter().navTo(sName, oParameters, undefined, bReplace);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Convenience event handler for navigating back.
|
|
77
|
+
* It there is a history entry we go one step back in the browser history
|
|
78
|
+
* If not, it will replace the current entry of the browser history with the main route.
|
|
79
|
+
*/
|
|
80
|
+
public onNavBack(): void {
|
|
81
|
+
const sPreviousHash = History.getInstance().getPreviousHash();
|
|
82
|
+
if (sPreviousHash !== undefined) {
|
|
83
|
+
window.history.go(-1);
|
|
84
|
+
} else {
|
|
85
|
+
this.getRouter().navTo("main", {}, undefined, true);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
sap.ui.define(["sap/m/MessageBox", "./BaseController", "sap/ui/model/json/JSONModel", "sap/m/MessageToast", "sap/ui/model/Filter", "sap/ui/model/FilterOperator", "sap/ui/core/Fragment"], function (MessageBox, __BaseController, JSONModel, MessageToast, Filter, FilterOperator, Fragment) {
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
function _interopRequireDefault(obj) {
|
|
5
|
+
return obj && obj.__esModule && typeof obj.default !== "undefined" ? obj.default : obj;
|
|
6
|
+
}
|
|
7
|
+
const BaseController = _interopRequireDefault(__BaseController);
|
|
8
|
+
/**
|
|
9
|
+
* @namespace cds.plugin.caching.dashboard.controller
|
|
10
|
+
*/
|
|
11
|
+
const Cache = BaseController.extend("cds.plugin.caching.dashboard.controller.Cache", {
|
|
12
|
+
onInit: function _onInit() {
|
|
13
|
+
BaseController.prototype.onInit.call(this);
|
|
14
|
+
|
|
15
|
+
// Create a JSON model for UI data binding
|
|
16
|
+
this.uiModel = new JSONModel({
|
|
17
|
+
selectedTab: "main",
|
|
18
|
+
statistics: [],
|
|
19
|
+
loading: false,
|
|
20
|
+
loadingEntries: false,
|
|
21
|
+
showEntriesTable: false,
|
|
22
|
+
cacheEntries: [],
|
|
23
|
+
// Create
|
|
24
|
+
createKey: "",
|
|
25
|
+
createValue: "",
|
|
26
|
+
createTtl: 3600,
|
|
27
|
+
// Get
|
|
28
|
+
getKey: "",
|
|
29
|
+
getValue: "",
|
|
30
|
+
// Delete
|
|
31
|
+
deleteKey: "",
|
|
32
|
+
// Metrics
|
|
33
|
+
metricsEnabled: false,
|
|
34
|
+
keyMetricsEnabled: false
|
|
35
|
+
});
|
|
36
|
+
this.getView().setModel(this.uiModel, "ui");
|
|
37
|
+
this.getRouter().getRoute("cache").attachPatternMatched(this.onRouteMatched, this);
|
|
38
|
+
},
|
|
39
|
+
onRouteMatched: function _onRouteMatched(event) {
|
|
40
|
+
const {
|
|
41
|
+
cache
|
|
42
|
+
} = event.getParameter("arguments");
|
|
43
|
+
this.getModel("app").setProperty("/selectedCache", cache);
|
|
44
|
+
this.getModel("app").setProperty("/layout", "TwoColumnsMidExpanded");
|
|
45
|
+
this.getView().bindElement({
|
|
46
|
+
path: "/Caches('" + cache + "')",
|
|
47
|
+
events: {
|
|
48
|
+
change: event => {
|
|
49
|
+
const context = this.getView().getElementBinding().getBoundContext();
|
|
50
|
+
if (context) {
|
|
51
|
+
const cache = context.getProperty("configuration");
|
|
52
|
+
this.uiModel.setProperty("/config", cache);
|
|
53
|
+
this.loadStatistics();
|
|
54
|
+
this.loadKeyMetricsData();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
/**
|
|
61
|
+
* Load statistics based on current filters
|
|
62
|
+
*/
|
|
63
|
+
loadStatistics: async function _loadStatistics(refresh = false) {
|
|
64
|
+
const table = this.getView().byId("metricsTable");
|
|
65
|
+
const filter = new Filter("cache", FilterOperator.EQ, this.getModel("app").getProperty("/selectedCache"));
|
|
66
|
+
if (table.getBinding("rows").isSuspended()) {
|
|
67
|
+
table.getBinding("rows").resume();
|
|
68
|
+
}
|
|
69
|
+
if (refresh) {
|
|
70
|
+
table.getBinding("rows").refresh();
|
|
71
|
+
} else {
|
|
72
|
+
table.getBinding("rows").filter(filter);
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
/**
|
|
76
|
+
* Load key tracking data
|
|
77
|
+
*/
|
|
78
|
+
loadKeyMetricsData: async function _loadKeyMetricsData(refresh = false) {
|
|
79
|
+
const table = this.getView().byId("keyMetricsTable");
|
|
80
|
+
const filter = new Filter("cache", FilterOperator.EQ, this.getModel("app").getProperty("/selectedCache"));
|
|
81
|
+
if (table.getBinding("rows").isSuspended()) {
|
|
82
|
+
table.getBinding("rows").resume();
|
|
83
|
+
}
|
|
84
|
+
if (refresh) {
|
|
85
|
+
table.getBinding("rows").refresh();
|
|
86
|
+
} else {
|
|
87
|
+
table.getBinding("rows").filter(filter);
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
/**
|
|
91
|
+
* Load cache entries
|
|
92
|
+
*/
|
|
93
|
+
onLoadCacheEntries: async function _onLoadCacheEntries() {
|
|
94
|
+
const cacheContext = this.getView().getElementBinding().getBoundContext();
|
|
95
|
+
try {
|
|
96
|
+
this.uiModel.setProperty("/loadingEntries", true);
|
|
97
|
+
this.uiModel.setProperty("/showEntriesTable", true);
|
|
98
|
+
this.uiModel.setSizeLimit(100_000);
|
|
99
|
+
|
|
100
|
+
// Call the backend to get cache entries
|
|
101
|
+
const model = this.getModel();
|
|
102
|
+
const context = model.bindContext(`plugin.cds_caching.CachingApiService.getEntries(...)`, cacheContext);
|
|
103
|
+
await context.invoke();
|
|
104
|
+
const {
|
|
105
|
+
value: entries
|
|
106
|
+
} = await context.requestObject();
|
|
107
|
+
for (const entry of entries) {
|
|
108
|
+
entry.tags = entry.tags.join(", ");
|
|
109
|
+
}
|
|
110
|
+
this.uiModel.setProperty("/cacheEntries", entries);
|
|
111
|
+
} catch (error) {
|
|
112
|
+
console.error("Error loading cache entries:", error);
|
|
113
|
+
MessageBox.error("Failed to load cache entries");
|
|
114
|
+
} finally {
|
|
115
|
+
this.uiModel.setProperty("/loadingEntries", false);
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
/**
|
|
119
|
+
* Handle statistics row selection
|
|
120
|
+
*/
|
|
121
|
+
onMetricsRowSelect: function _onMetricsRowSelect(event) {
|
|
122
|
+
const selectedRow = event.getParameter("rowContext");
|
|
123
|
+
if (selectedRow) {
|
|
124
|
+
const metric = selectedRow.getObject();
|
|
125
|
+
const cacheName = this.getView().getElementBinding().getBoundContext().getProperty("name");
|
|
126
|
+
|
|
127
|
+
// Navigate to single metric view
|
|
128
|
+
this.getRouter().navTo("singleMetric", {
|
|
129
|
+
cache: cacheName,
|
|
130
|
+
metricId: metric.ID
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// Set layout to three columns
|
|
134
|
+
this.getModel("app").setProperty("/layout", "ThreeColumnsEndExpanded");
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
/**
|
|
138
|
+
* Set cache entry
|
|
139
|
+
*/
|
|
140
|
+
onSetKey: async function _onSetKey() {
|
|
141
|
+
const cacheContext = this.getView().getElementBinding().getBoundContext();
|
|
142
|
+
const key = this.uiModel.getProperty("/createKey");
|
|
143
|
+
const value = this.uiModel.getProperty("/createValue");
|
|
144
|
+
const ttl = this.uiModel.getProperty("/createTtl");
|
|
145
|
+
if (!key || !value) {
|
|
146
|
+
MessageBox.error("Please provide both key and value");
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
try {
|
|
150
|
+
const model = this.getModel();
|
|
151
|
+
const context = model.bindContext(`plugin.cds_caching.CachingApiService.setEntry(...)`, cacheContext);
|
|
152
|
+
context.setParameter("key", key);
|
|
153
|
+
context.setParameter("value", value);
|
|
154
|
+
context.setParameter("ttl", ttl);
|
|
155
|
+
await context.invoke();
|
|
156
|
+
MessageToast.show("Cache entry created successfully");
|
|
157
|
+
|
|
158
|
+
// Clear form
|
|
159
|
+
this.uiModel.setProperty("/createKey", "");
|
|
160
|
+
this.uiModel.setProperty("/createValue", "");
|
|
161
|
+
this.uiModel.setProperty("/createTtl", 3600);
|
|
162
|
+
} catch (error) {
|
|
163
|
+
console.error("Error setting cache entry:", error);
|
|
164
|
+
MessageBox.error("Failed to create cache entry");
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
/**
|
|
168
|
+
* Get cache entry
|
|
169
|
+
*/
|
|
170
|
+
onGetKey: async function _onGetKey() {
|
|
171
|
+
const cacheContext = this.getView().getElementBinding().getBoundContext();
|
|
172
|
+
const key = this.uiModel.getProperty("/getKey");
|
|
173
|
+
if (!key) {
|
|
174
|
+
MessageBox.error("Please provide a key");
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
try {
|
|
178
|
+
const model = this.getModel();
|
|
179
|
+
const action = model.bindContext(`plugin.cds_caching.CachingApiService.getEntry(...)`, cacheContext);
|
|
180
|
+
action.setParameter("key", key);
|
|
181
|
+
await action.invoke();
|
|
182
|
+
const result = await action.requestObject();
|
|
183
|
+
this.uiModel.setProperty("/getValue", result.value || "Not found");
|
|
184
|
+
} catch (error) {
|
|
185
|
+
console.error("Error getting cache entry:", error);
|
|
186
|
+
this.uiModel.setProperty("/getValue", "Error: Entry not found or error occurred");
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
/**
|
|
190
|
+
* Delete cache entry
|
|
191
|
+
*/
|
|
192
|
+
onDeleteKey: async function _onDeleteKey() {
|
|
193
|
+
const cacheContext = this.getView().getElementBinding().getBoundContext();
|
|
194
|
+
const key = this.uiModel.getProperty("/deleteKey");
|
|
195
|
+
if (!key) {
|
|
196
|
+
MessageBox.error("Please provide a key");
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
try {
|
|
200
|
+
const model = this.getModel();
|
|
201
|
+
const context = model.bindContext(`plugin.cds_caching.CachingApiService.deleteEntry(...)`, cacheContext);
|
|
202
|
+
context.setParameter("key", key);
|
|
203
|
+
await context.invoke();
|
|
204
|
+
MessageToast.show("Cache entry deleted successfully");
|
|
205
|
+
|
|
206
|
+
// Clear form
|
|
207
|
+
this.uiModel.setProperty("/deleteKey", "");
|
|
208
|
+
} catch (error) {
|
|
209
|
+
console.error("Error deleting cache entry:", error);
|
|
210
|
+
MessageBox.error("Failed to delete cache entry");
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
/**
|
|
214
|
+
* Enable/disable statistics
|
|
215
|
+
*/
|
|
216
|
+
onEnableMetricsChange: async function _onEnableMetricsChange(event) {
|
|
217
|
+
const enabled = event.getParameter("state");
|
|
218
|
+
const cacheContext = this.getView().getElementBinding().getBoundContext();
|
|
219
|
+
try {
|
|
220
|
+
const model = this.getModel();
|
|
221
|
+
const context = model.bindContext(`plugin.cds_caching.CachingApiService.setMetricsEnabled(...)`, cacheContext);
|
|
222
|
+
context.setParameter("enabled", enabled);
|
|
223
|
+
await context.invoke();
|
|
224
|
+
MessageToast.show(`Metrics ${enabled ? 'enabled' : 'disabled'} successfully`);
|
|
225
|
+
} catch (error) {
|
|
226
|
+
console.error("Error setting metrics enabled:", error);
|
|
227
|
+
MessageBox.error("Failed to update metrics setting");
|
|
228
|
+
// Revert the switch
|
|
229
|
+
this.uiModel.setProperty("/enableMetrics", !enabled);
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
/**
|
|
233
|
+
* Enable/disable key tracking
|
|
234
|
+
*/
|
|
235
|
+
onEnableKeyMetricsChange: async function _onEnableKeyMetricsChange(event) {
|
|
236
|
+
const enabled = event.getParameter("state");
|
|
237
|
+
const cacheContext = this.getView().getElementBinding().getBoundContext();
|
|
238
|
+
try {
|
|
239
|
+
const model = this.getModel();
|
|
240
|
+
const context = model.bindContext(`plugin.cds_caching.CachingApiService.setKeyMetricsEnabled(...)`, cacheContext);
|
|
241
|
+
context.setParameter("enabled", enabled);
|
|
242
|
+
await context.invoke();
|
|
243
|
+
MessageToast.show(`Key metrics ${enabled ? 'enabled' : 'disabled'} successfully`);
|
|
244
|
+
} catch (error) {
|
|
245
|
+
console.error("Error setting key metrics enabled:", error);
|
|
246
|
+
MessageBox.error("Failed to update key metrics setting");
|
|
247
|
+
// Revert the switch
|
|
248
|
+
this.uiModel.setProperty("/enableKeyMetrics", !enabled);
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
/**
|
|
252
|
+
* Clear cache
|
|
253
|
+
*/
|
|
254
|
+
onClearCache: async function _onClearCache() {
|
|
255
|
+
const cacheContext = this.getView().getElementBinding().getBoundContext();
|
|
256
|
+
MessageBox.confirm("Are you sure you want to clear this cache? This action cannot be undone.", {
|
|
257
|
+
actions: [MessageBox.Action.OK, MessageBox.Action.CANCEL],
|
|
258
|
+
emphasizedAction: MessageBox.Action.OK,
|
|
259
|
+
onClose: async action => {
|
|
260
|
+
if (action === MessageBox.Action.OK) {
|
|
261
|
+
try {
|
|
262
|
+
const model = this.getModel();
|
|
263
|
+
const context = model.bindContext(`plugin.cds_caching.CachingApiService.clear(...)`, cacheContext);
|
|
264
|
+
await context.invoke();
|
|
265
|
+
MessageBox.success("Cache cleared successfully");
|
|
266
|
+
|
|
267
|
+
// Refresh the data
|
|
268
|
+
await this.onRefresh();
|
|
269
|
+
} catch (error) {
|
|
270
|
+
console.error("Error clearing cache:", error);
|
|
271
|
+
MessageBox.error("Failed to clear cache");
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
},
|
|
277
|
+
/**
|
|
278
|
+
* Handle refresh button press
|
|
279
|
+
*/
|
|
280
|
+
onRefresh: async function _onRefresh() {
|
|
281
|
+
if (this.getView().getElementBinding().getBoundContext()) {
|
|
282
|
+
await this.loadStatistics(true);
|
|
283
|
+
await this.loadKeyMetricsData(true);
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
handleClose: function _handleClose() {
|
|
287
|
+
this.getRouter().navTo("main");
|
|
288
|
+
},
|
|
289
|
+
handleFullScreen: function _handleFullScreen() {
|
|
290
|
+
this.getModel("app").setProperty("/layout", "MidColumnFullScreen");
|
|
291
|
+
},
|
|
292
|
+
handleExitFullScreen: function _handleExitFullScreen() {
|
|
293
|
+
this.getModel("app").setProperty("/layout", "TwoColumnsMidExpanded");
|
|
294
|
+
},
|
|
295
|
+
/**
|
|
296
|
+
* Handle key row selection
|
|
297
|
+
*/
|
|
298
|
+
onKeyMetricsRowSelect: function _onKeyMetricsRowSelect(event) {
|
|
299
|
+
const selectedRow = event.getParameter("rowContext");
|
|
300
|
+
if (selectedRow) {
|
|
301
|
+
const metric = selectedRow.getObject();
|
|
302
|
+
const cacheName = this.getView().getElementBinding().getBoundContext().getProperty("name");
|
|
303
|
+
|
|
304
|
+
// Navigate to single metric view
|
|
305
|
+
this.getRouter().navTo("singleKeyMetric", {
|
|
306
|
+
cache: cacheName,
|
|
307
|
+
keyMetricId: metric.ID
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
// Set layout to three columns
|
|
311
|
+
this.getModel("app").setProperty("/layout", "ThreeColumnsEndExpanded");
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
/**
|
|
315
|
+
* Refresh key data
|
|
316
|
+
*/
|
|
317
|
+
onRefreshKeyMetricsData: async function _onRefreshKeyMetricsData() {
|
|
318
|
+
await this.loadKeyMetricsData(true);
|
|
319
|
+
},
|
|
320
|
+
onRefreshMetricsData: async function _onRefreshMetricsData() {
|
|
321
|
+
await this.loadStatistics(true);
|
|
322
|
+
},
|
|
323
|
+
onShowKeyMetricsMetadata: async function _onShowKeyMetricsMetadata(event) {
|
|
324
|
+
const context = event.getSource().getBindingContext();
|
|
325
|
+
const saveJson = json => {
|
|
326
|
+
try {
|
|
327
|
+
return JSON.stringify(JSON.parse(json), null, 2);
|
|
328
|
+
} catch (error) {
|
|
329
|
+
return json;
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
const localData = new JSONModel({
|
|
333
|
+
metadata: saveJson(context.getProperty("metadata")),
|
|
334
|
+
subject: saveJson(context.getProperty("subject")),
|
|
335
|
+
query: saveJson(context.getProperty("query")),
|
|
336
|
+
cacheOptions: saveJson(context.getProperty("cacheOptions")),
|
|
337
|
+
keyName: context.getProperty("keyName")
|
|
338
|
+
});
|
|
339
|
+
const fragment = await Fragment.load({
|
|
340
|
+
definition: `<core:FragmentDefinition xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:form="sap.ui.layout.form">
|
|
341
|
+
<Popover title="{localData>/keyName}" placement="Bottom" contentWidth="30rem">
|
|
342
|
+
<content>
|
|
343
|
+
<IconTabBar>
|
|
344
|
+
<items>
|
|
345
|
+
<IconTabFilter text="Metadata">
|
|
346
|
+
<content>
|
|
347
|
+
<TextArea value="{localData>/metadata}" rows="20" width="100%" editable="false" />
|
|
348
|
+
</content>
|
|
349
|
+
</IconTabFilter>
|
|
350
|
+
<IconTabFilter text="Subject" >
|
|
351
|
+
<content>
|
|
352
|
+
<TextArea value="{localData>/subject}" rows="20" width="100%" editable="false" />
|
|
353
|
+
</content>
|
|
354
|
+
</IconTabFilter>
|
|
355
|
+
<IconTabFilter text="Query" >
|
|
356
|
+
<content>
|
|
357
|
+
<TextArea value="{localData>/query}" rows="20" width="100%" editable="false" />
|
|
358
|
+
</content>
|
|
359
|
+
</IconTabFilter>
|
|
360
|
+
<IconTabFilter text="Cache Options" >
|
|
361
|
+
<content>
|
|
362
|
+
<TextArea value="{localData>/cacheOptions}" rows="20" width="100%" editable="false" />
|
|
363
|
+
</content>
|
|
364
|
+
</IconTabFilter>
|
|
365
|
+
</items>
|
|
366
|
+
</IconTabBar>
|
|
367
|
+
</content>
|
|
368
|
+
</Popover>
|
|
369
|
+
</core:FragmentDefinition>`,
|
|
370
|
+
controller: this
|
|
371
|
+
});
|
|
372
|
+
const popover = fragment;
|
|
373
|
+
popover.setModel(localData, "localData");
|
|
374
|
+
popover.openBy(event.getSource());
|
|
375
|
+
},
|
|
376
|
+
/**
|
|
377
|
+
* Clear statistics
|
|
378
|
+
*/
|
|
379
|
+
onClearMetrics: async function _onClearMetrics() {
|
|
380
|
+
const cacheContext = this.getView().getElementBinding().getBoundContext();
|
|
381
|
+
if (!cacheContext) {
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
try {
|
|
385
|
+
const model = this.getModel();
|
|
386
|
+
const action = model.bindContext(`plugin.cds_caching.CachingApiService.clearMetrics(...)`, cacheContext);
|
|
387
|
+
await action.invoke();
|
|
388
|
+
MessageToast.show("Metrics cleared successfully");
|
|
389
|
+
|
|
390
|
+
// Refresh the data
|
|
391
|
+
await this.onRefreshMetricsData();
|
|
392
|
+
} catch (error) {
|
|
393
|
+
console.error("Error clearing metrics:", error);
|
|
394
|
+
MessageBox.error("Failed to clear metrics");
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
/**
|
|
398
|
+
* Clear key metrics
|
|
399
|
+
*/
|
|
400
|
+
onClearKeyMetrics: async function _onClearKeyMetrics() {
|
|
401
|
+
const cacheContext = this.getView().getElementBinding().getBoundContext();
|
|
402
|
+
if (!cacheContext) {
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
try {
|
|
406
|
+
const model = this.getModel();
|
|
407
|
+
const action = model.bindContext(`plugin.cds_caching.CachingApiService.clearKeyMetrics(...)`, cacheContext);
|
|
408
|
+
await action.invoke();
|
|
409
|
+
MessageToast.show("Key metrics cleared successfully");
|
|
410
|
+
|
|
411
|
+
// Refresh the data
|
|
412
|
+
await this.onRefreshKeyMetricsData();
|
|
413
|
+
} catch (error) {
|
|
414
|
+
console.error("Error clearing key metrics:", error);
|
|
415
|
+
MessageBox.error("Failed to clear key metrics");
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
return Cache;
|
|
420
|
+
});
|
|
421
|
+
//# sourceMappingURL=Cache-dbg.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Cache-dbg.controller.js","names":["BaseController","_interopRequireDefault","__BaseController","Cache","extend","onInit","_onInit","BaseController.prototype.onInit.call","uiModel","JSONModel","selectedTab","statistics","loading","loadingEntries","showEntriesTable","cacheEntries","createKey","createValue","createTtl","getKey","getValue","deleteKey","metricsEnabled","keyMetricsEnabled","getView","setModel","getRouter","getRoute","attachPatternMatched","onRouteMatched","_onRouteMatched","event","cache","getParameter","getModel","setProperty","bindElement","path","events","change","context","getElementBinding","getBoundContext","getProperty","loadStatistics","loadKeyMetricsData","_loadStatistics","refresh","table","byId","filter","Filter","FilterOperator","EQ","getBinding","isSuspended","resume","_loadKeyMetricsData","onLoadCacheEntries","_onLoadCacheEntries","cacheContext","setSizeLimit","model","bindContext","invoke","value","entries","requestObject","entry","tags","join","error","console","MessageBox","onMetricsRowSelect","_onMetricsRowSelect","selectedRow","metric","getObject","cacheName","navTo","metricId","ID","onSetKey","_onSetKey","key","ttl","setParameter","MessageToast","show","onGetKey","_onGetKey","action","result","onDeleteKey","_onDeleteKey","onEnableMetricsChange","_onEnableMetricsChange","enabled","onEnableKeyMetricsChange","_onEnableKeyMetricsChange","onClearCache","_onClearCache","confirm","actions","Action","OK","CANCEL","emphasizedAction","onClose","success","onRefresh","_onRefresh","handleClose","_handleClose","handleFullScreen","_handleFullScreen","handleExitFullScreen","_handleExitFullScreen","onKeyMetricsRowSelect","_onKeyMetricsRowSelect","keyMetricId","onRefreshKeyMetricsData","_onRefreshKeyMetricsData","onRefreshMetricsData","_onRefreshMetricsData","onShowKeyMetricsMetadata","_onShowKeyMetricsMetadata","getSource","getBindingContext","saveJson","json","JSON","stringify","parse","localData","metadata","subject","query","cacheOptions","keyName","fragment","Fragment","load","definition","controller","popover","openBy","onClearMetrics","_onClearMetrics","onClearKeyMetrics","_onClearKeyMetrics"],"sources":["Cache.controller.ts"],"sourcesContent":["import MessageBox from \"sap/m/MessageBox\";\nimport BaseController from \"./BaseController\";\nimport ODataModel from \"sap/ui/model/odata/v4/ODataModel\";\nimport JSONModel from \"sap/ui/model/json/JSONModel\";\nimport { Route$PatternMatchedEvent } from \"sap/ui/core/routing/Route\";\nimport Table, { Table$RowSelectionChangeEvent } from \"sap/ui/table/Table\";\nimport MessageToast from \"sap/m/MessageToast\";\nimport Context from \"sap/ui/model/odata/v4/Context\";\nimport Filter from \"sap/ui/model/Filter\";\nimport FilterOperator from \"sap/ui/model/FilterOperator\";\nimport ODataListBinding from \"sap/ui/model/odata/v4/ODataListBinding\";\nimport { Button$PressEvent } from \"sap/m/Button\";\nimport Fragment from \"sap/ui/core/Fragment\";\nimport Popover from \"sap/m/Popover\";\n\n/**\n * @namespace cds.plugin.caching.dashboard.controller\n */\nexport default class Cache extends BaseController {\n private uiModel: JSONModel;\n\n public onInit(): void {\n super.onInit();\n\n // Create a JSON model for UI data binding\n this.uiModel = new JSONModel({\n selectedTab: \"main\",\n statistics: [],\n loading: false,\n loadingEntries: false,\n showEntriesTable: false,\n cacheEntries: [],\n\n // Create\n createKey: \"\",\n createValue: \"\",\n createTtl: 3600,\n\n // Get\n getKey: \"\",\n getValue: \"\",\n\n // Delete\n deleteKey: \"\",\n\n // Metrics\n metricsEnabled: false,\n keyMetricsEnabled: false,\n });\n this.getView().setModel(this.uiModel, \"ui\");\n\n\n this.getRouter().getRoute(\"cache\").attachPatternMatched(this.onRouteMatched, this);\n\n }\n\n public onRouteMatched(event: Route$PatternMatchedEvent): void {\n const { cache } = event.getParameter(\"arguments\") as { cache: string };\n (<JSONModel>this.getModel(\"app\")).setProperty(\"/selectedCache\", cache);\n (<JSONModel>this.getModel(\"app\")).setProperty(\"/layout\", \"TwoColumnsMidExpanded\");\n\n this.getView().bindElement({\n path: \"/Caches('\" + cache + \"')\",\n events: {\n change: (event: any) => {\n const context = this.getView().getElementBinding().getBoundContext();\n if (context) {\n const cache = context.getProperty(\"configuration\");\n this.uiModel.setProperty(\"/config\", cache);\n this.loadStatistics();\n this.loadKeyMetricsData();\n }\n }\n }\n });\n }\n\n /**\n * Load statistics based on current filters\n */\n private async loadStatistics(refresh: boolean = false): Promise<void> {\n const table = this.getView().byId(\"metricsTable\") as Table;\n const filter = new Filter(\"cache\", FilterOperator.EQ, (<JSONModel>this.getModel(\"app\")).getProperty(\"/selectedCache\"));\n if (table.getBinding(\"rows\").isSuspended()) {\n table.getBinding(\"rows\").resume();\n }\n if (refresh) {\n (<ODataListBinding>table.getBinding(\"rows\")).refresh();\n } else {\n (<ODataListBinding>table.getBinding(\"rows\")).filter(filter);\n }\n }\n\n /**\n * Load key tracking data\n */\n async loadKeyMetricsData(refresh: boolean = false): Promise<void> {\n const table = this.getView().byId(\"keyMetricsTable\") as Table;\n const filter = new Filter(\"cache\", FilterOperator.EQ, (<JSONModel>this.getModel(\"app\")).getProperty(\"/selectedCache\"));\n if (table.getBinding(\"rows\").isSuspended()) {\n table.getBinding(\"rows\").resume();\n }\n if (refresh) {\n (<ODataListBinding>table.getBinding(\"rows\")).refresh();\n } else {\n (<ODataListBinding>table.getBinding(\"rows\")).filter(filter);\n }\n }\n\n\n /**\n * Load cache entries\n */\n public async onLoadCacheEntries(): Promise<void> {\n const cacheContext = this.getView().getElementBinding().getBoundContext() as Context;\n\n try {\n this.uiModel.setProperty(\"/loadingEntries\", true);\n this.uiModel.setProperty(\"/showEntriesTable\", true);\n this.uiModel.setSizeLimit(100_000);\n\n // Call the backend to get cache entries\n const model = this.getModel() as ODataModel;\n const context = model.bindContext(`plugin.cds_caching.CachingApiService.getEntries(...)`, cacheContext);\n await context.invoke();\n const { value: entries } = await context.requestObject();\n for (const entry of entries) {\n entry.tags = entry.tags.join(\", \");\n }\n\n this.uiModel.setProperty(\"/cacheEntries\", entries);\n\n } catch (error) {\n console.error(\"Error loading cache entries:\", error);\n MessageBox.error(\"Failed to load cache entries\");\n } finally {\n this.uiModel.setProperty(\"/loadingEntries\", false);\n }\n }\n\n /**\n * Handle statistics row selection\n */\n public onMetricsRowSelect(event: Table$RowSelectionChangeEvent): void {\n const selectedRow = event.getParameter(\"rowContext\");\n if (selectedRow) {\n const metric = selectedRow.getObject() as any;\n const cacheName = this.getView().getElementBinding().getBoundContext().getProperty(\"name\");\n\n // Navigate to single metric view\n this.getRouter().navTo(\"singleMetric\", {\n cache: cacheName,\n metricId: metric.ID\n });\n\n // Set layout to three columns\n (<JSONModel>this.getModel(\"app\")).setProperty(\"/layout\", \"ThreeColumnsEndExpanded\");\n }\n }\n\n /**\n * Set cache entry\n */\n public async onSetKey(): Promise<void> {\n const cacheContext = this.getView().getElementBinding().getBoundContext() as Context;\n const key = this.uiModel.getProperty(\"/createKey\");\n const value = this.uiModel.getProperty(\"/createValue\");\n const ttl = this.uiModel.getProperty(\"/createTtl\");\n\n if (!key || !value) {\n MessageBox.error(\"Please provide both key and value\");\n return;\n }\n\n try {\n const model = this.getModel() as ODataModel;\n const context = model.bindContext(`plugin.cds_caching.CachingApiService.setEntry(...)`, cacheContext);\n context.setParameter(\"key\", key);\n context.setParameter(\"value\", value);\n context.setParameter(\"ttl\", ttl);\n await context.invoke();\n\n\n MessageToast.show(\"Cache entry created successfully\");\n\n // Clear form\n this.uiModel.setProperty(\"/createKey\", \"\");\n this.uiModel.setProperty(\"/createValue\", \"\");\n this.uiModel.setProperty(\"/createTtl\", 3600);\n\n } catch (error) {\n console.error(\"Error setting cache entry:\", error);\n MessageBox.error(\"Failed to create cache entry\");\n }\n }\n\n /**\n * Get cache entry\n */\n public async onGetKey(): Promise<void> {\n const cacheContext = this.getView().getElementBinding().getBoundContext() as Context;\n const key = this.uiModel.getProperty(\"/getKey\");\n\n if (!key) {\n MessageBox.error(\"Please provide a key\");\n return;\n }\n\n try {\n const model = this.getModel() as ODataModel;\n const action = model.bindContext(`plugin.cds_caching.CachingApiService.getEntry(...)`, cacheContext);\n action.setParameter(\"key\", key);\n await action.invoke();\n\n const result = await action.requestObject();\n this.uiModel.setProperty(\"/getValue\", result.value || \"Not found\");\n\n } catch (error) {\n console.error(\"Error getting cache entry:\", error);\n this.uiModel.setProperty(\"/getValue\", \"Error: Entry not found or error occurred\");\n }\n }\n\n /**\n * Delete cache entry\n */\n public async onDeleteKey(): Promise<void> {\n const cacheContext = this.getView().getElementBinding().getBoundContext() as Context;\n const key = this.uiModel.getProperty(\"/deleteKey\");\n\n if (!key) {\n MessageBox.error(\"Please provide a key\");\n return;\n }\n\n try {\n const model = this.getModel() as ODataModel;\n const context = model.bindContext(`plugin.cds_caching.CachingApiService.deleteEntry(...)`, cacheContext);\n context.setParameter(\"key\", key);\n await context.invoke();\n\n MessageToast.show(\"Cache entry deleted successfully\");\n\n // Clear form\n this.uiModel.setProperty(\"/deleteKey\", \"\");\n\n } catch (error) {\n console.error(\"Error deleting cache entry:\", error);\n MessageBox.error(\"Failed to delete cache entry\");\n }\n }\n\n /**\n * Enable/disable statistics\n */\n public async onEnableMetricsChange(event: any): Promise<void> {\n const enabled = event.getParameter(\"state\");\n const cacheContext = this.getView().getElementBinding().getBoundContext() as Context;\n\n try {\n const model = this.getModel() as ODataModel;\n const context = model.bindContext(`plugin.cds_caching.CachingApiService.setMetricsEnabled(...)`, cacheContext);\n context.setParameter(\"enabled\", enabled);\n await context.invoke();\n\n MessageToast.show(`Metrics ${enabled ? 'enabled' : 'disabled'} successfully`);\n } catch (error) {\n console.error(\"Error setting metrics enabled:\", error);\n MessageBox.error(\"Failed to update metrics setting\");\n // Revert the switch\n this.uiModel.setProperty(\"/enableMetrics\", !enabled);\n }\n }\n\n /**\n * Enable/disable key tracking\n */\n public async onEnableKeyMetricsChange(event: any): Promise<void> {\n const enabled = event.getParameter(\"state\");\n const cacheContext = this.getView().getElementBinding().getBoundContext() as Context;\n\n try {\n const model = this.getModel() as ODataModel;\n const context = model.bindContext(`plugin.cds_caching.CachingApiService.setKeyMetricsEnabled(...)`, cacheContext);\n context.setParameter(\"enabled\", enabled);\n await context.invoke();\n\n MessageToast.show(`Key metrics ${enabled ? 'enabled' : 'disabled'} successfully`);\n\n } catch (error) {\n console.error(\"Error setting key metrics enabled:\", error);\n MessageBox.error(\"Failed to update key metrics setting\");\n // Revert the switch\n this.uiModel.setProperty(\"/enableKeyMetrics\", !enabled);\n }\n }\n\n /**\n * Clear cache\n */\n public async onClearCache(): Promise<void> {\n const cacheContext = this.getView().getElementBinding().getBoundContext() as Context;\n\n MessageBox.confirm(\"Are you sure you want to clear this cache? This action cannot be undone.\", {\n actions: [MessageBox.Action.OK, MessageBox.Action.CANCEL],\n emphasizedAction: MessageBox.Action.OK,\n onClose: async (action: string) => {\n if (action === MessageBox.Action.OK) {\n try {\n const model = this.getModel() as ODataModel;\n const context = model.bindContext(`plugin.cds_caching.CachingApiService.clear(...)`, cacheContext);\n await context.invoke();\n\n MessageBox.success(\"Cache cleared successfully\");\n\n // Refresh the data\n await this.onRefresh();\n\n } catch (error) {\n console.error(\"Error clearing cache:\", error);\n MessageBox.error(\"Failed to clear cache\");\n }\n }\n }\n });\n }\n\n /**\n * Handle refresh button press\n */\n public async onRefresh(): Promise<void> {\n if (this.getView().getElementBinding().getBoundContext()) {\n await this.loadStatistics(true);\n await this.loadKeyMetricsData(true);\n }\n }\n\n public handleClose(): void {\n this.getRouter().navTo(\"main\");\n }\n\n public handleFullScreen(): void {\n (<JSONModel>this.getModel(\"app\")).setProperty(\"/layout\", \"MidColumnFullScreen\");\n }\n\n public handleExitFullScreen(): void {\n (<JSONModel>this.getModel(\"app\")).setProperty(\"/layout\", \"TwoColumnsMidExpanded\");\n }\n\n /**\n * Handle key row selection\n */\n public onKeyMetricsRowSelect(event: any): void {\n\n const selectedRow = event.getParameter(\"rowContext\");\n if (selectedRow) {\n const metric = selectedRow.getObject() as any;\n const cacheName = this.getView().getElementBinding().getBoundContext().getProperty(\"name\");\n\n // Navigate to single metric view\n this.getRouter().navTo(\"singleKeyMetric\", {\n cache: cacheName,\n keyMetricId: metric.ID\n });\n\n // Set layout to three columns\n (<JSONModel>this.getModel(\"app\")).setProperty(\"/layout\", \"ThreeColumnsEndExpanded\");\n }\n }\n\n /**\n * Refresh key data\n */\n public async onRefreshKeyMetricsData(): Promise<void> {\n await this.loadKeyMetricsData(true);\n }\n\n public async onRefreshMetricsData(): Promise<void> {\n await this.loadStatistics(true);\n }\n\n public async onShowKeyMetricsMetadata(event: Button$PressEvent): Promise<void> {\n const context = event.getSource().getBindingContext() as Context;\n\n const saveJson = (json: string) => {\n try {\n return JSON.stringify(JSON.parse(json), null, 2)\n } catch (error) {\n return json\n }\n }\n\n const localData = new JSONModel({\n metadata: saveJson(context.getProperty(\"metadata\")),\n subject: saveJson(context.getProperty(\"subject\")),\n query: saveJson(context.getProperty(\"query\")),\n cacheOptions: saveJson(context.getProperty(\"cacheOptions\")),\n keyName: context.getProperty(\"keyName\"),\n });\n\n const fragment = await Fragment.load({\n definition: `<core:FragmentDefinition xmlns:core=\"sap.ui.core\" xmlns:mvc=\"sap.ui.core.mvc\" xmlns=\"sap.m\" xmlns:form=\"sap.ui.layout.form\">\n <Popover title=\"{localData>/keyName}\" placement=\"Bottom\" contentWidth=\"30rem\">\n <content>\n <IconTabBar>\n <items>\n <IconTabFilter text=\"Metadata\">\n <content>\n <TextArea value=\"{localData>/metadata}\" rows=\"20\" width=\"100%\" editable=\"false\" />\n </content>\n </IconTabFilter>\n <IconTabFilter text=\"Subject\" >\n <content>\n <TextArea value=\"{localData>/subject}\" rows=\"20\" width=\"100%\" editable=\"false\" />\n </content>\n </IconTabFilter>\n <IconTabFilter text=\"Query\" >\n <content>\n <TextArea value=\"{localData>/query}\" rows=\"20\" width=\"100%\" editable=\"false\" />\n </content>\n </IconTabFilter>\n <IconTabFilter text=\"Cache Options\" >\n <content>\n <TextArea value=\"{localData>/cacheOptions}\" rows=\"20\" width=\"100%\" editable=\"false\" />\n </content>\n </IconTabFilter>\n </items>\n </IconTabBar>\n </content>\n </Popover>\n </core:FragmentDefinition>`,\n controller: this,\n });\n\n const popover = fragment as Popover;\n popover.setModel(localData, \"localData\");\n popover.openBy(event.getSource());\n }\n\n /**\n * Clear statistics\n */\n public async onClearMetrics(): Promise<void> {\n const cacheContext = this.getView().getElementBinding().getBoundContext() as Context;\n if (!cacheContext) {\n return;\n }\n\n try {\n const model = this.getModel() as ODataModel;\n const action = model.bindContext(`plugin.cds_caching.CachingApiService.clearMetrics(...)`, cacheContext);\n await action.invoke();\n\n MessageToast.show(\"Metrics cleared successfully\");\n\n // Refresh the data\n await this.onRefreshMetricsData();\n\n } catch (error) {\n console.error(\"Error clearing metrics:\", error);\n MessageBox.error(\"Failed to clear metrics\");\n }\n }\n\n /**\n * Clear key metrics\n */\n public async onClearKeyMetrics(): Promise<void> {\n const cacheContext = this.getView().getElementBinding().getBoundContext() as Context;\n if (!cacheContext) {\n return;\n }\n\n try {\n const model = this.getModel() as ODataModel;\n const action = model.bindContext(`plugin.cds_caching.CachingApiService.clearKeyMetrics(...)`, cacheContext);\n await action.invoke();\n\n MessageToast.show(\"Key metrics cleared successfully\");\n\n // Refresh the data\n await this.onRefreshKeyMetricsData();\n\n } catch (error) {\n console.error(\"Error clearing key metrics:\", error);\n MessageB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sap/m/MessageToast","sap/ui/model/Filter","sap/ui/model/FilterOperator","sap/ui/core/Fragment"],function(e,t,n,i,o,r,s){"use strict";function a(e){return e&&e.__esModule&&typeof e.default!=="undefined"?e.default:e}const c=a(t);const l=c.extend("cds.plugin.caching.dashboard.controller.Cache",{onInit:function e(){c.prototype.onInit.call(this);this.uiModel=new n({selectedTab:"main",statistics:[],loading:false,loadingEntries:false,showEntriesTable:false,cacheEntries:[],createKey:"",createValue:"",createTtl:3600,getKey:"",getValue:"",deleteKey:"",metricsEnabled:false,keyMetricsEnabled:false});this.getView().setModel(this.uiModel,"ui");this.getRouter().getRoute("cache").attachPatternMatched(this.onRouteMatched,this)},onRouteMatched:function e(t){const{cache:n}=t.getParameter("arguments");this.getModel("app").setProperty("/selectedCache",n);this.getModel("app").setProperty("/layout","TwoColumnsMidExpanded");this.getView().bindElement({path:"/Caches('"+n+"')",events:{change:e=>{const t=this.getView().getElementBinding().getBoundContext();if(t){const e=t.getProperty("configuration");this.uiModel.setProperty("/config",e);this.loadStatistics();this.loadKeyMetricsData()}}}})},loadStatistics:async function e(t=false){const n=this.getView().byId("metricsTable");const i=new o("cache",r.EQ,this.getModel("app").getProperty("/selectedCache"));if(n.getBinding("rows").isSuspended()){n.getBinding("rows").resume()}if(t){n.getBinding("rows").refresh()}else{n.getBinding("rows").filter(i)}},loadKeyMetricsData:async function e(t=false){const n=this.getView().byId("keyMetricsTable");const i=new o("cache",r.EQ,this.getModel("app").getProperty("/selectedCache"));if(n.getBinding("rows").isSuspended()){n.getBinding("rows").resume()}if(t){n.getBinding("rows").refresh()}else{n.getBinding("rows").filter(i)}},onLoadCacheEntries:async function t(){const n=this.getView().getElementBinding().getBoundContext();try{this.uiModel.setProperty("/loadingEntries",true);this.uiModel.setProperty("/showEntriesTable",true);this.uiModel.setSizeLimit(1e5);const e=this.getModel();const t=e.bindContext(`plugin.cds_caching.CachingApiService.getEntries(...)`,n);await t.invoke();const{value:i}=await t.requestObject();for(const e of i){e.tags=e.tags.join(", ")}this.uiModel.setProperty("/cacheEntries",i)}catch(t){console.error("Error loading cache entries:",t);e.error("Failed to load cache entries")}finally{this.uiModel.setProperty("/loadingEntries",false)}},onMetricsRowSelect:function e(t){const n=t.getParameter("rowContext");if(n){const e=n.getObject();const t=this.getView().getElementBinding().getBoundContext().getProperty("name");this.getRouter().navTo("singleMetric",{cache:t,metricId:e.ID});this.getModel("app").setProperty("/layout","ThreeColumnsEndExpanded")}},onSetKey:async function t(){const n=this.getView().getElementBinding().getBoundContext();const o=this.uiModel.getProperty("/createKey");const r=this.uiModel.getProperty("/createValue");const s=this.uiModel.getProperty("/createTtl");if(!o||!r){e.error("Please provide both key and value");return}try{const e=this.getModel();const t=e.bindContext(`plugin.cds_caching.CachingApiService.setEntry(...)`,n);t.setParameter("key",o);t.setParameter("value",r);t.setParameter("ttl",s);await t.invoke();i.show("Cache entry created successfully");this.uiModel.setProperty("/createKey","");this.uiModel.setProperty("/createValue","");this.uiModel.setProperty("/createTtl",3600)}catch(t){console.error("Error setting cache entry:",t);e.error("Failed to create cache entry")}},onGetKey:async function t(){const n=this.getView().getElementBinding().getBoundContext();const i=this.uiModel.getProperty("/getKey");if(!i){e.error("Please provide a key");return}try{const e=this.getModel();const t=e.bindContext(`plugin.cds_caching.CachingApiService.getEntry(...)`,n);t.setParameter("key",i);await t.invoke();const o=await t.requestObject();this.uiModel.setProperty("/getValue",o.value||"Not found")}catch(e){console.error("Error getting cache entry:",e);this.uiModel.setProperty("/getValue","Error: Entry not found or error occurred")}},onDeleteKey:async function t(){const n=this.getView().getElementBinding().getBoundContext();const o=this.uiModel.getProperty("/deleteKey");if(!o){e.error("Please provide a key");return}try{const e=this.getModel();const t=e.bindContext(`plugin.cds_caching.CachingApiService.deleteEntry(...)`,n);t.setParameter("key",o);await t.invoke();i.show("Cache entry deleted successfully");this.uiModel.setProperty("/deleteKey","")}catch(t){console.error("Error deleting cache entry:",t);e.error("Failed to delete cache entry")}},onEnableMetricsChange:async function t(n){const o=n.getParameter("state");const r=this.getView().getElementBinding().getBoundContext();try{const e=this.getModel();const t=e.bindContext(`plugin.cds_caching.CachingApiService.setMetricsEnabled(...)`,r);t.setParameter("enabled",o);await t.invoke();i.show(`Metrics ${o?"enabled":"disabled"} successfully`)}catch(t){console.error("Error setting metrics enabled:",t);e.error("Failed to update metrics setting");this.uiModel.setProperty("/enableMetrics",!o)}},onEnableKeyMetricsChange:async function t(n){const o=n.getParameter("state");const r=this.getView().getElementBinding().getBoundContext();try{const e=this.getModel();const t=e.bindContext(`plugin.cds_caching.CachingApiService.setKeyMetricsEnabled(...)`,r);t.setParameter("enabled",o);await t.invoke();i.show(`Key metrics ${o?"enabled":"disabled"} successfully`)}catch(t){console.error("Error setting key metrics enabled:",t);e.error("Failed to update key metrics setting");this.uiModel.setProperty("/enableKeyMetrics",!o)}},onClearCache:async function t(){const n=this.getView().getElementBinding().getBoundContext();e.confirm("Are you sure you want to clear this cache? This action cannot be undone.",{actions:[e.Action.OK,e.Action.CANCEL],emphasizedAction:e.Action.OK,onClose:async t=>{if(t===e.Action.OK){try{const t=this.getModel();const i=t.bindContext(`plugin.cds_caching.CachingApiService.clear(...)`,n);await i.invoke();e.success("Cache cleared successfully");await this.onRefresh()}catch(t){console.error("Error clearing cache:",t);e.error("Failed to clear cache")}}}})},onRefresh:async function e(){if(this.getView().getElementBinding().getBoundContext()){await this.loadStatistics(true);await this.loadKeyMetricsData(true)}},handleClose:function e(){this.getRouter().navTo("main")},handleFullScreen:function e(){this.getModel("app").setProperty("/layout","MidColumnFullScreen")},handleExitFullScreen:function e(){this.getModel("app").setProperty("/layout","TwoColumnsMidExpanded")},onKeyMetricsRowSelect:function e(t){const n=t.getParameter("rowContext");if(n){const e=n.getObject();const t=this.getView().getElementBinding().getBoundContext().getProperty("name");this.getRouter().navTo("singleKeyMetric",{cache:t,keyMetricId:e.ID});this.getModel("app").setProperty("/layout","ThreeColumnsEndExpanded")}},onRefreshKeyMetricsData:async function e(){await this.loadKeyMetricsData(true)},onRefreshMetricsData:async function e(){await this.loadStatistics(true)},onShowKeyMetricsMetadata:async function e(t){const i=t.getSource().getBindingContext();const o=e=>{try{return JSON.stringify(JSON.parse(e),null,2)}catch(t){return e}};const r=new n({metadata:o(i.getProperty("metadata")),subject:o(i.getProperty("subject")),query:o(i.getProperty("query")),cacheOptions:o(i.getProperty("cacheOptions")),keyName:i.getProperty("keyName")});const a=await s.load({definition:`<core:FragmentDefinition xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:form="sap.ui.layout.form">\n <Popover title="{localData>/keyName}" placement="Bottom" contentWidth="30rem">\n <content>\n <IconTabBar>\n <items>\n <IconTabFilter text="Metadata">\n <content>\n <TextArea value="{localData>/metadata}" rows="20" width="100%" editable="false" />\n </content>\n </IconTabFilter>\n <IconTabFilter text="Subject" >\n <content>\n <TextArea value="{localData>/subject}" rows="20" width="100%" editable="false" />\n </content>\n </IconTabFilter>\n <IconTabFilter text="Query" >\n <content>\n <TextArea value="{localData>/query}" rows="20" width="100%" editable="false" />\n </content>\n </IconTabFilter>\n <IconTabFilter text="Cache Options" >\n <content>\n <TextArea value="{localData>/cacheOptions}" rows="20" width="100%" editable="false" />\n </content>\n </IconTabFilter>\n </items>\n </IconTabBar>\n </content>\n </Popover>\n </core:FragmentDefinition>`,controller:this});const c=a;c.setModel(r,"localData");c.openBy(t.getSource())},onClearMetrics:async function t(){const n=this.getView().getElementBinding().getBoundContext();if(!n){return}try{const e=this.getModel();const t=e.bindContext(`plugin.cds_caching.CachingApiService.clearMetrics(...)`,n);await t.invoke();i.show("Metrics cleared successfully");await this.onRefreshMetricsData()}catch(t){console.error("Error clearing metrics:",t);e.error("Failed to clear metrics")}},onClearKeyMetrics:async function t(){const n=this.getView().getElementBinding().getBoundContext();if(!n){return}try{const e=this.getModel();const t=e.bindContext(`plugin.cds_caching.CachingApiService.clearKeyMetrics(...)`,n);await t.invoke();i.show("Key metrics cleared successfully");await this.onRefreshKeyMetricsData()}catch(t){console.error("Error clearing key metrics:",t);e.error("Failed to clear key metrics")}}});return l});
|
|
2
|
+
//# sourceMappingURL=Cache.controller.js.map
|