|
1 | 1 | sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/model/json/JSONModel",
|
2 | 2 | "sap/ui/core/BusyIndicator", "sap/m/MessageBox", "sap/m/MessageToast", "sap/ui/core/Fragment", "sap/m/BusyDialog",
|
3 |
| - "sap/ui/VersionInfo", "z2ui5/cc/Server", "sap/ui/model/odata/v2/ODataModel", "sap/m/library", "sap/ui/core/routing/HashChanger" |
| 3 | + "sap/ui/VersionInfo", "z2ui5/cc/Server", "sap/ui/model/odata/v2/ODataModel", "sap/m/library", "sap/ui/core/routing/HashChanger", "sap/ui/util/Storage" |
4 | 4 | ],
|
5 | 5 | function (Controller, XMLView, JSONModel, BusyIndicator, MessageBox, MessageToast, Fragment, mBusyDialog, VersionInfo,
|
6 |
| - Server, ODataModel, mobileLibrary, HashChanger) { |
| 6 | + Server, ODataModel, mobileLibrary, HashChanger, Storage) { |
7 | 7 | "use strict";
|
8 | 8 | return Controller.extend("z2ui5.controller.View1", {
|
9 | 9 |
|
@@ -313,6 +313,24 @@ sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/
|
313 | 313 | var oModel = new ODataModel({ serviceUrl: args[1], annotationURI: (args.length > 3 ? args[3] : '') });
|
314 | 314 | z2ui5.oView.setModel(oModel, args[2] ? args[2] : undefined);
|
315 | 315 | break;
|
| 316 | + case 'STORE_DATA': |
| 317 | + let storageParams = args[1]; |
| 318 | + let storageType = Storage.Type.session; |
| 319 | + switch (storageParams.TYPE) { |
| 320 | + case 'session': |
| 321 | + storageType = Storage.Type.session; |
| 322 | + break; |
| 323 | + case 'local': |
| 324 | + storageType = Storage.Type.local; |
| 325 | + break; |
| 326 | + } |
| 327 | + let oStorage = new Storage(storageType, storageParams.PREFIX); |
| 328 | + if (storageParams.VALUE == "" || storageParams.VALUE == null) { |
| 329 | + oStorage.remove(storageParams.KEY); |
| 330 | + } else { |
| 331 | + oStorage.put(storageParams.KEY, storageParams.VALUE); |
| 332 | + } |
| 333 | + break; |
316 | 334 | case 'DOWNLOAD_B64_FILE':
|
317 | 335 | var a = document.createElement("a");
|
318 | 336 | a.href = args[1];
|
|
0 commit comments