week 3, unit 1

master
Stefan Haslinger 2022-04-27 10:34:29 +00:00
parent 48423a0e34
commit 04ddac347b
33 changed files with 1243 additions and 2 deletions

4
.gitignore vendored
View File

@ -1,5 +1,5 @@
node_modules/
dist/
# dist/
.scp/
.env
Makefile*.mta
@ -7,4 +7,4 @@ mta_archives
mta-*
resources
archive.zip
.*_mta_build_tmp
.*_mta_build_tmp

71
dist/Component-dbg.js vendored Normal file
View File

@ -0,0 +1,71 @@
sap.ui.define([
"sap/ui/core/UIComponent",
"sap/ui/Device",
"./model/models",
"./controller/ErrorHandler"
], function (UIComponent, Device, models, ErrorHandler) {
"use strict";
return UIComponent.extend("opensap.manageproducts.manageproducts.Component", {
metadata : {
manifest: "json"
},
/**
* The component is initialized by UI5 automatically during the startup of the app and calls the init method once.
* In this function, the device models are set and the router is initialized.
* @public
* @override
*/
init : function () {
// call the base component's init function
UIComponent.prototype.init.apply(this, arguments);
// initialize the error handler with the component
this._oErrorHandler = new ErrorHandler(this);
// set the device model
this.setModel(models.createDeviceModel(), "device");
// create the views based on the url/hash
this.getRouter().initialize();
},
/**
* The component is destroyed by UI5 automatically.
* In this method, the ErrorHandler is destroyed.
* @public
* @override
*/
destroy : function () {
this._oErrorHandler.destroy();
// call the base component's destroy function
UIComponent.prototype.destroy.apply(this, arguments);
},
/**
* This method can be called to determine whether the sapUiSizeCompact or sapUiSizeCozy
* design mode class should be set, which influences the size appearance of some controls.
* @public
* @return {string} css class, either 'sapUiSizeCompact' or 'sapUiSizeCozy' - or an empty string if no css class should be set
*/
getContentDensityClass : function() {
if (this._sContentDensityClass === undefined) {
// check whether FLP has already set the content density class; do nothing in this case
// eslint-disable-next-line sap-no-proprietary-browser-api
if (document.body.classList.contains("sapUiSizeCozy") || document.body.classList.contains("sapUiSizeCompact")) {
this._sContentDensityClass = "";
} else if (!Device.support.touch) { // apply "compact" mode if touch is not supported
this._sContentDensityClass = "sapUiSizeCompact";
} else {
// "cozy" in case of touch support; default for most sap.m controls, but needed for desktop-first controls like sap.ui.table.Table
this._sContentDensityClass = "sapUiSizeCozy";
}
}
return this._sContentDensityClass;
}
});
});

31
dist/Component-preload.js vendored Normal file
View File

@ -0,0 +1,31 @@
//@ui5-bundle opensap/manageproducts/manageproducts/Component-preload.js
jQuery.sap.registerPreloadedModules({
"version":"2.0",
"modules":{
"opensap/manageproducts/manageproducts/Component.js":function(){sap.ui.define(["sap/ui/core/UIComponent","sap/ui/Device","./model/models","./controller/ErrorHandler"],function(t,e,s,i){"use strict";return t.extend("opensap.manageproducts.manageproducts.Component",{metadata:{manifest:"json"},init:function(){t.prototype.init.apply(this,arguments);this._oErrorHandler=new i(this);this.setModel(s.createDeviceModel(),"device");this.getRouter().initialize()},destroy:function(){this._oErrorHandler.destroy();t.prototype.destroy.apply(this,arguments)},getContentDensityClass:function(){if(this._sContentDensityClass===undefined){if(document.body.classList.contains("sapUiSizeCozy")||document.body.classList.contains("sapUiSizeCompact")){this._sContentDensityClass=""}else if(!e.support.touch){this._sContentDensityClass="sapUiSizeCompact"}else{this._sContentDensityClass="sapUiSizeCozy"}}return this._sContentDensityClass}})});
},
"opensap/manageproducts/manageproducts/controller/App.controller.js":function(){sap.ui.define(["./BaseController"],function(e){"use strict";return e.extend("opensap.manageproducts.manageproducts.controller.App",{onInit:function(){this.getView().addStyleClass(this.getOwnerComponent().getContentDensityClass())}})});
},
"opensap/manageproducts/manageproducts/controller/BaseController.js":function(){sap.ui.define(["sap/ui/core/mvc/Controller","sap/ui/core/UIComponent","sap/m/library"],function(e,t,r){"use strict";var o=r.URLHelper;return e.extend("opensap.manageproducts.manageproducts.controller.BaseController",{getRouter:function(){return t.getRouterFor(this)},getModel:function(e){return this.getView().getModel(e)},setModel:function(e,t){return this.getView().setModel(e,t)},getResourceBundle:function(){return this.getOwnerComponent().getModel("i18n").getResourceBundle()},onShareEmailPress:function(){var e=this.getModel("objectView")||this.getModel("worklistView");o.triggerEmail(null,e.getProperty("/shareSendEmailSubject"),e.getProperty("/shareSendEmailMessage"))}})});
},
"opensap/manageproducts/manageproducts/controller/ErrorHandler.js":function(){sap.ui.define(["sap/ui/base/Object","sap/m/MessageBox","sap/ui/model/Filter","sap/ui/model/FilterOperator"],function(e,s,t,n){"use strict";return e.extend("opensap.manageproducts.manageproducts.controller.ErrorHandler",{constructor:function(e){var s=sap.ui.getCore().getMessageManager(),o=s.getMessageModel(),r=e.getModel("i18n").getResourceBundle(),i=r.getText("errorText"),a=r.getText("multipleErrorsText");this._oComponent=e;this._bMessageOpen=false;this.oMessageModelBinding=o.bindList("/",undefined,[],new t("technical",n.EQ,true));this.oMessageModelBinding.attachChange(function(e){var t=e.getSource().getContexts(),n=[],o;if(this._bMessageOpen||!t.length){return}t.forEach(function(e){n.push(e.getObject())});s.removeMessages(n);o=n.length===1?i:a;this._showServiceError(o,n[0].message)},this)},_showServiceError:function(e,t){this._bMessageOpen=true;s.error(e,{id:"serviceErrorMessageBox",details:t,styleClass:this._oComponent.getContentDensityClass(),actions:[s.Action.CLOSE],onClose:function(){this._bMessageOpen=false}.bind(this)})}})});
},
"opensap/manageproducts/manageproducts/controller/NotFound.controller.js":function(){sap.ui.define(["./BaseController"],function(e){"use strict";return e.extend("opensap.manageproducts.manageproducts.controller.NotFound",{onLinkPressed:function(){this.getRouter().navTo("worklist")}})});
},
"opensap/manageproducts/manageproducts/controller/Object.controller.js":function(){sap.ui.define(["./BaseController","sap/ui/model/json/JSONModel","sap/ui/core/routing/History","../model/formatter"],function(e,t,n,o){"use strict";return e.extend("opensap.manageproducts.manageproducts.controller.Object",{formatter:o,onInit:function(){var e=new t({busy:true,delay:0});this.getRouter().getRoute("object").attachPatternMatched(this._onObjectMatched,this);this.setModel(e,"objectView")},onNavBack:function(){var e=n.getInstance().getPreviousHash();if(e!==undefined){history.go(-1)}else{this.getRouter().navTo("worklist",{},true)}},_onObjectMatched:function(e){var t=e.getParameter("arguments").objectId;this._bindView("/ProductSet"+t)},_bindView:function(e){var t=this.getModel("objectView");this.getView().bindElement({path:e,events:{change:this._onBindingChange.bind(this),dataRequested:function(){t.setProperty("/busy",true)},dataReceived:function(){t.setProperty("/busy",false)}}})},_onBindingChange:function(){var e=this.getView(),t=this.getModel("objectView"),n=e.getElementBinding();if(!n.getBoundContext()){this.getRouter().getTargets().display("objectNotFound");return}var o=this.getResourceBundle(),i=e.getBindingContext().getObject(),r=i.ProductID,s=i.ProductSet;t.setProperty("/busy",false);t.setProperty("/shareSendEmailSubject",o.getText("shareSendEmailObjectSubject",[r]));t.setProperty("/shareSendEmailMessage",o.getText("shareSendEmailObjectMessage",[s,r,location.href]))}})});
},
"opensap/manageproducts/manageproducts/controller/Worklist.controller.js":function(){sap.ui.define(["./BaseController","sap/ui/model/json/JSONModel","../model/formatter","sap/ui/model/Filter","sap/ui/model/FilterOperator"],function(e,t,i,o,s){"use strict";return e.extend("opensap.manageproducts.manageproducts.controller.Worklist",{formatter:i,onInit:function(){var e;this._aTableSearchState=[];e=new t({worklistTableTitle:this.getResourceBundle().getText("worklistTableTitle"),shareSendEmailSubject:this.getResourceBundle().getText("shareSendEmailWorklistSubject"),shareSendEmailMessage:this.getResourceBundle().getText("shareSendEmailWorklistMessage",[location.href]),tableNoDataText:this.getResourceBundle().getText("tableNoDataText")});this.setModel(e,"worklistView")},onUpdateFinished:function(e){var t,i=e.getSource(),o=e.getParameter("total");if(o&&i.getBinding("items").isLengthFinal()){t=this.getResourceBundle().getText("worklistTableTitleCount",[o])}else{t=this.getResourceBundle().getText("worklistTableTitle")}this.getModel("worklistView").setProperty("/worklistTableTitle",t)},onPress:function(e){this._showObject(e.getSource())},onNavBack:function(){history.go(-1)},onSearch:function(e){if(e.getParameters().refreshButtonPressed){this.onRefresh()}else{var t=[];var i=e.getParameter("query");if(i&&i.length>0){t=[new o("ProductID",s.Contains,i)]}this._applySearch(t)}},onRefresh:function(){var e=this.byId("table");e.getBinding("items").refresh()},_showObject:function(e){this.getRouter().navTo("object",{objectId:e.getBindingContext().getPath().substring("/ProductSet".length)})},_applySearch:function(e){var t=this.byId("table"),i=this.getModel("worklistView");t.getBinding("items").filter(e,"Application");if(e.length!==0){i.setProperty("/tableNoDataText",this.getResourceBundle().getText("worklistNoDataWithSearchText"))}}})});
},
"opensap/manageproducts/manageproducts/i18n/i18n.properties":'# This is the resource bundle for opensap.manageproducts.manageproducts\n\n#Texts for manifest.json\n\n#XTIT: Application name\nappTitle=Manage Products\n\n#YDES: Application description\nappDescription=A Fiori application.\n#~~~ Worklist View ~~~~~~~~~~~~~~~~~~~~~~~~~~\n#XTIT: Worklist view title\nworklistViewTitle=Manage ProductSet\n\n#XTIT: Worklist page title\nworklistTitle=Manage Products\n\n#XTIT: Table view title\nworklistTableTitle=ProductSet\n\n#XTOL: Tooltip for the search field\nworklistSearchTooltip=Enter an ProductSet name or a part of it.\n\n#XBLI: text for a table with no data with filter or search\nworklistNoDataWithSearchText=No matching ProductSet found\n\n#XTIT: Table view title with placeholder for the number of items\nworklistTableTitleCount=ProductSet ({0})\n\n#XTIT: The title of the column containing the ProductID of ProductSet\ntableNameColumnTitle=ProductID\n\n\n#XTIT: The title of the column containing the Price and the unit of measure\ntableUnitNumberColumnTitle=Price\n\n\n#XBLI: text for a table with no data\ntableNoDataText=No ProductSet are currently available\n\n#XLNK: text for link in \'not found\' pages\nbackToWorklist=Show Manage Products\n\n#~~~ Object View ~~~~~~~~~~~~~~~~~~~~~~~~~~\n#XTIT: Object view title\nobjectViewTitle=ProductSet Details\n\n#XTIT: Object page title\nobjectTitle=ProductSet\n\n#XTIT: Label for the ProductID\nProductIDLabel=ProductID\n\n\n#XTIT: Label for the Price\nPriceLabel=Price\n\n\n#~~~ Share Menu Options ~~~~~~~~~~~~~~~~~~~~~~~\n\n#XTIT: Send E-Mail subject\nshareSendEmailWorklistSubject=<Email subject PLEASE REPLACE ACCORDING TO YOUR USE CASE>\n\n#YMSG: Send E-Mail message\nshareSendEmailWorklistMessage=<Email body PLEASE REPLACE ACCORDING TO YOUR USE CASE>\\r\\n{0}\n\n#XTIT: Send E-Mail subject\nshareSendEmailObjectSubject=<Email subject including object identifier PLEASE REPLACE ACCORDING TO YOUR USE CASE> {0}\n\n#YMSG: Send E-Mail message\nshareSendEmailObjectMessage=<Email body PLEASE REPLACE ACCORDING TO YOUR USE CASE> {0} (id: {1})\\r\\n{2}\n\n#~~~ Not Found View ~~~~~~~~~~~~~~~~~~~~~~~\n\n#XTIT: Not found view title\nnotFoundTitle=Not Found\n\n#YMSG: The ProductSet not found text is displayed when there is no ProductSet with this id\nnoObjectFoundText=This ProductSet is not available\n\n#YMSG: The ProductSet not available text is displayed when there is no data when starting the app\nnoObjectsAvailableText=No ProductSet are currently available\n\n#YMSG: The not found text is displayed when there was an error loading the resource (404 error)\nnotFoundText=The requested resource was not found\n\n#~~~ Error Handling ~~~~~~~~~~~~~~~~~~~~~~~\n\n#YMSG: Error dialog description\nerrorText=Sorry, a technical error occurred! Please try again later.',
"opensap/manageproducts/manageproducts/manifest.json":'{"_version":"1.28.0","sap.app":{"id":"opensap.manageproducts.manageproducts","type":"application","i18n":"i18n/i18n.properties","applicationVersion":{"version":"0.0.1"},"title":"{{appTitle}}","description":"{{appDescription}}","resources":"resources.json","sourceTemplate":{"id":"@sap-ux/fiori-freestyle-writer:worklist","version":"0.11.6"},"dataSources":{"mainService":{"uri":"sap/opu/odata/iwbep/GWSAMPLE_BASIC/","type":"OData","settings":{"annotations":[],"localUri":"localService/metadata.xml","odataVersion":"2.0"}}}},"sap.ui":{"technology":"UI5","icons":{"icon":"","favIcon":"","phone":"","phone@2":"","tablet":"","tablet@2":""},"deviceTypes":{"desktop":true,"tablet":true,"phone":true}},"sap.ui5":{"flexEnabled":true,"dependencies":{"minUI5Version":"1.84.14","libs":{"sap.m":{},"sap.ui.core":{},"sap.f":{},"sap.suite.ui.generic.template":{},"sap.ui.comp":{},"sap.ui.generic.app":{},"sap.ui.table":{},"sap.ushell":{}}},"contentDensities":{"compact":true,"cozy":true},"models":{"i18n":{"type":"sap.ui.model.resource.ResourceModel","settings":{"bundleName":"opensap.manageproducts.manageproducts.i18n.i18n"}},"":{"dataSource":"mainService","preload":true,"settings":{}}},"resources":{"css":[]},"routing":{"config":{"routerClass":"sap.m.routing.Router","viewType":"XML","viewPath":"opensap.manageproducts.manageproducts.view","controlId":"app","controlAggregation":"pages","bypassed":{"target":["notFound"]},"async":true},"routes":[{"pattern":"","name":"worklist","target":["worklist"]},{"pattern":"ProductSet/{objectId}","name":"object","target":["object"]}],"targets":{"worklist":{"viewName":"Worklist","viewId":"worklist","viewLevel":1,"title":"{i18n>worklistViewTitle}"},"object":{"viewName":"Object","viewId":"object","viewLevel":2,"title":"{i18n>objectViewTitle}"},"objectNotFound":{"viewName":"ObjectNotFound","viewId":"objectNotFound"},"notFound":{"viewName":"NotFound","viewId":"notFound"}}},"rootView":{"viewName":"opensap.manageproducts.manageproducts.view.App","type":"XML","async":true,"id":"app"}},"sap.cloud":{"public":true,"service":"opensap-manageproducts-manageproducts"}}',
"opensap/manageproducts/manageproducts/model/formatter.js":function(){sap.ui.define([],function(){"use strict";return{numberUnit:function(n){if(!n){return""}return parseFloat(n).toFixed(2)}}});
},
"opensap/manageproducts/manageproducts/model/models.js":function(){sap.ui.define(["sap/ui/model/json/JSONModel","sap/ui/Device"],function(e,n){"use strict";return{createDeviceModel:function(){var i=new e(n);i.setDefaultBindingMode("OneWay");return i}}});
},
"opensap/manageproducts/manageproducts/utils/locate-reuse-libs.js":'(function(e){var t=function(e){var t=e;var n="";var r=["sap.apf","sap.base","sap.chart","sap.collaboration","sap.f","sap.fe","sap.fileviewer","sap.gantt","sap.landvisz","sap.m","sap.ndc","sap.ovp","sap.rules","sap.suite","sap.tnt","sap.ui","sap.uiext","sap.ushell","sap.uxap","sap.viz","sap.webanalytics","sap.zen"];function a(e,t){Object.keys(e).forEach(function(e){if(!r.some(function(t){return e===t||e.startsWith(t+".")})){if(t.length>0){t=t+","+e}else{t=e}}});return t}return new Promise(function(r,i){$.ajax(t).done(function(e){if(e){if(e["sap.ui5"]&&e["sap.ui5"].dependencies){if(e["sap.ui5"].dependencies.libs){n=a(e["sap.ui5"].dependencies.libs,n)}if(e["sap.ui5"].dependencies.components){n=a(e["sap.ui5"].dependencies.components,n)}}if(e["sap.ui5"]&&e["sap.ui5"].componentUsages){n=a(e["sap.ui5"].componentUsages,n)}}r(n)}).fail(function(t){i(new Error("Could not fetch manifest at \'"+e))})})};e.registerComponentDependencyPaths=function(e){return t(e).then(function(e){if(e&&e.length>0){var t="/sap/bc/ui2/app_index/ui5_app_info?id="+e;var n=jQuery.sap.getUriParameters().get("sap-client");if(n&&n.length===3){t=t+"&sap-client="+n}return $.ajax(t).done(function(e){if(e){Object.keys(e).forEach(function(t){var n=e[t];if(n&&n.dependencies){n.dependencies.forEach(function(e){if(e.url&&e.url.length>0&&e.type==="UI5LIB"){jQuery.sap.log.info("Registering Library "+e.componentId+" from server "+e.url);jQuery.sap.registerModulePath(e.componentId,e.url)}})}})}})}})}})(sap);var scripts=document.getElementsByTagName("script");var currentScript=document.getElementById("locate-reuse-libs");if(!currentScript){currentScript=document.currentScript}var manifestUri=currentScript.getAttribute("data-sap-ui-manifest-uri");var componentName=currentScript.getAttribute("data-sap-ui-componentName");var useMockserver=currentScript.getAttribute("data-sap-ui-use-mockserver");sap.registerComponentDependencyPaths(manifestUri).catch(function(e){jQuery.sap.log.error(e)}).finally(function(){sap.ui.getCore().attachInit(function(){jQuery.sap.require("jquery.sap.resources");var e=sap.ui.getCore().getConfiguration().getLanguage();var t=jQuery.sap.resources({url:"i18n/i18n.properties",locale:e});document.title=t.getText("appTitle")});if(componentName&&componentName.length>0){if(useMockserver&&useMockserver==="true"){sap.ui.getCore().attachInit(function(){sap.ui.require([componentName.replace(/\\./g,"/")+"/localService/mockserver"],function(e){e.init();sap.ushell.Container.createRenderer().placeAt("content")})})}else{sap.ui.require(["sap/ui/core/ComponentSupport"]);sap.ui.getCore().attachInit(function(){jQuery.sap.require("jquery.sap.resources");var e=sap.ui.getCore().getConfiguration().getLanguage();var t=jQuery.sap.resources({url:"i18n/i18n.properties",locale:e});document.title=t.getText("appTitle")})}}else{sap.ui.getCore().attachInit(function(){sap.ushell.Container.createRenderer().placeAt("content")})}});sap.registerComponentDependencyPaths(manifestUri);',
"opensap/manageproducts/manageproducts/view/App.view.xml":'<mvc:View\n controllerName="opensap.manageproducts.manageproducts.controller.App"\n displayBlock="true"\n xmlns="sap.m"\n xmlns:mvc="sap.ui.core.mvc"><Shell><App\n id="app"\n busy="{appView>/busy}"\n busyIndicatorDelay="{appView>/delay}"/></Shell></mvc:View>',
"opensap/manageproducts/manageproducts/view/NotFound.view.xml":'<mvc:View\n controllerName="opensap.manageproducts.manageproducts.controller.NotFound"\n xmlns="sap.m"\n xmlns:mvc="sap.ui.core.mvc"><MessagePage\n title="{i18n>notFoundTitle}"\n text="{i18n>notFoundText}"\n icon="sap-icon://document"\n id="page"\n description=""><customDescription><Link id="link" text="{i18n>backToWorklist}" press=".onLinkPressed"/></customDescription></MessagePage></mvc:View>',
"opensap/manageproducts/manageproducts/view/Object.view.xml":'<mvc:View\n controllerName="opensap.manageproducts.manageproducts.controller.Object"\n xmlns="sap.m"\n xmlns:mvc="sap.ui.core.mvc"\n xmlns:semantic="sap.f.semantic"><semantic:SemanticPage\n id="page"\n headerPinnable="false"\n toggleHeaderOnTitleClick="false"\n busy="{objectView>/busy}"\n busyIndicatorDelay="{objectView>/delay}"><semantic:titleHeading><Title\n text="{ProductID}"\n level="H2"/></semantic:titleHeading><semantic:headerContent><ObjectNumber\n number="{\n path: \'Price\',\n formatter: \'.formatter.numberUnit\'\n }"\n unit="{CurrencyCode}" /></semantic:headerContent><semantic:sendEmailAction><semantic:SendEmailAction id="shareEmail" press=".onShareEmailPress"/></semantic:sendEmailAction></semantic:SemanticPage></mvc:View>',
"opensap/manageproducts/manageproducts/view/ObjectNotFound.view.xml":'<mvc:View\n controllerName="opensap.manageproducts.manageproducts.controller.NotFound"\n xmlns="sap.m"\n xmlns:mvc="sap.ui.core.mvc"><MessagePage\n title="{i18n>objectTitle}"\n text="{i18n>noObjectFoundText}"\n icon="sap-icon://product"\n description=""\n id="page"><customDescription><Link id="link" text="{i18n>backToWorklist}" press=".onLinkPressed" /></customDescription></MessagePage></mvc:View>',
"opensap/manageproducts/manageproducts/view/Worklist.view.xml":'<mvc:View\n controllerName="opensap.manageproducts.manageproducts.controller.Worklist"\n xmlns="sap.m"\n xmlns:mvc="sap.ui.core.mvc"\n xmlns:semantic="sap.f.semantic"><semantic:SemanticPage\n id="page"\n headerPinnable="false"\n toggleHeaderOnTitleClick="false"><semantic:titleHeading><Title\n text="{i18n>worklistTitle}"\n level="H2"/></semantic:titleHeading><semantic:content><Table\n id="table"\n width="auto"\n items="{\n path: \'/ProductSet\',\n sorter: {\n path: \'ProductID\',\n descending: false\n }\n }"\n noDataText="{worklistView>/tableNoDataText}"\n busyIndicatorDelay="{worklistView>/tableBusyDelay}"\n growing="true"\n growingScrollToLoad="true"\n updateFinished=".onUpdateFinished"><headerToolbar><OverflowToolbar><Title\n id="tableHeader"\n text="{worklistView>/worklistTableTitle}"\n level="H3"/><ToolbarSpacer /><SearchField\n id="searchField"\n tooltip="{i18n>worklistSearchTooltip}"\n search=".onSearch"><layoutData><OverflowToolbarLayoutData\n maxWidth="200px"\n priority="NeverOverflow"/></layoutData></SearchField></OverflowToolbar></headerToolbar><columns><Column id="nameColumn"><Text text="{i18n>tableNameColumnTitle}" id="nameColumnTitle"/></Column><Column id="unitNumberColumn" hAlign="End"><Text text="{i18n>tableUnitNumberColumnTitle}" id="unitNumberColumnTitle"/></Column></columns><items><ColumnListItem\n type="Navigation"\n press=".onPress"><cells><ObjectIdentifier\n title="{ProductID}"/><ObjectNumber\n number="{\n path: \'Price\',\n formatter: \'.formatter.numberUnit\'\n }"\n unit="{CurrencyCode}" /></cells></ColumnListItem></items></Table></semantic:content><semantic:sendEmailAction><semantic:SendEmailAction id="shareEmail" press=".onShareEmailPress"/></semantic:sendEmailAction></semantic:SemanticPage></mvc:View>'
}});

1
dist/Component.js vendored Normal file
View File

@ -0,0 +1 @@
sap.ui.define(["sap/ui/core/UIComponent","sap/ui/Device","./model/models","./controller/ErrorHandler"],function(t,e,s,i){"use strict";return t.extend("opensap.manageproducts.manageproducts.Component",{metadata:{manifest:"json"},init:function(){t.prototype.init.apply(this,arguments);this._oErrorHandler=new i(this);this.setModel(s.createDeviceModel(),"device");this.getRouter().initialize()},destroy:function(){this._oErrorHandler.destroy();t.prototype.destroy.apply(this,arguments)},getContentDensityClass:function(){if(this._sContentDensityClass===undefined){if(document.body.classList.contains("sapUiSizeCozy")||document.body.classList.contains("sapUiSizeCompact")){this._sContentDensityClass=""}else if(!e.support.touch){this._sContentDensityClass="sapUiSizeCompact"}else{this._sContentDensityClass="sapUiSizeCozy"}}return this._sContentDensityClass}})});

14
dist/controller/App-dbg.controller.js vendored Normal file
View File

@ -0,0 +1,14 @@
sap.ui.define([
"./BaseController"
], function (BaseController) {
"use strict";
return BaseController.extend("opensap.manageproducts.manageproducts.controller.App", {
onInit : function () {
// apply content density mode to root view
this.getView().addStyleClass(this.getOwnerComponent().getContentDensityClass());
}
});
});

1
dist/controller/App.controller.js vendored Normal file
View File

@ -0,0 +1 @@
sap.ui.define(["./BaseController"],function(e){"use strict";return e.extend("opensap.manageproducts.manageproducts.controller.App",{onInit:function(){this.getView().addStyleClass(this.getOwnerComponent().getContentDensityClass())}})});

65
dist/controller/BaseController-dbg.js vendored Normal file
View File

@ -0,0 +1,65 @@
sap.ui.define([
"sap/ui/core/mvc/Controller",
"sap/ui/core/UIComponent",
"sap/m/library"
], function (Controller, UIComponent, mobileLibrary) {
"use strict";
// shortcut for sap.m.URLHelper
var URLHelper = mobileLibrary.URLHelper;
return Controller.extend("opensap.manageproducts.manageproducts.controller.BaseController", {
/**
* Convenience method for accessing the router.
* @public
* @returns {sap.ui.core.routing.Router} the router for this component
*/
getRouter : function () {
return UIComponent.getRouterFor(this);
},
/**
* Convenience method for getting the view model by name.
* @public
* @param {string} [sName] the model name
* @returns {sap.ui.model.Model} the model instance
*/
getModel : function (sName) {
return this.getView().getModel(sName);
},
/**
* Convenience method for setting the view model.
* @public
* @param {sap.ui.model.Model} oModel the model instance
* @param {string} sName the model name
* @returns {sap.ui.mvc.View} the view instance
*/
setModel : function (oModel, sName) {
return this.getView().setModel(oModel, sName);
},
/**
* Getter for the resource bundle.
* @public
* @returns {sap.ui.model.resource.ResourceModel} the resourceModel of the component
*/
getResourceBundle : function () {
return this.getOwnerComponent().getModel("i18n").getResourceBundle();
},
/**
* Event handler when the share by E-Mail button has been clicked
* @public
*/
onShareEmailPress : function () {
var oViewModel = (this.getModel("objectView") || this.getModel("worklistView"));
URLHelper.triggerEmail(
null,
oViewModel.getProperty("/shareSendEmailSubject"),
oViewModel.getProperty("/shareSendEmailMessage")
);
}
});
});

1
dist/controller/BaseController.js vendored Normal file
View File

@ -0,0 +1 @@
sap.ui.define(["sap/ui/core/mvc/Controller","sap/ui/core/UIComponent","sap/m/library"],function(e,t,r){"use strict";var o=r.URLHelper;return e.extend("opensap.manageproducts.manageproducts.controller.BaseController",{getRouter:function(){return t.getRouterFor(this)},getModel:function(e){return this.getView().getModel(e)},setModel:function(e,t){return this.getView().setModel(e,t)},getResourceBundle:function(){return this.getOwnerComponent().getModel("i18n").getResourceBundle()},onShareEmailPress:function(){var e=this.getModel("objectView")||this.getModel("worklistView");o.triggerEmail(null,e.getProperty("/shareSendEmailSubject"),e.getProperty("/shareSendEmailMessage"))}})});

77
dist/controller/ErrorHandler-dbg.js vendored Normal file
View File

@ -0,0 +1,77 @@
sap.ui.define([
"sap/ui/base/Object",
"sap/m/MessageBox",
"sap/ui/model/Filter",
"sap/ui/model/FilterOperator"
], function (UI5Object, MessageBox, Filter, FilterOperator) {
"use strict";
return UI5Object.extend("opensap.manageproducts.manageproducts.controller.ErrorHandler", {
/**
* Handles application errors by automatically attaching to the model events and displaying errors when needed.
* @class
* @param {sap.ui.core.UIComponent} oComponent reference to the app's component
* @public
* @alias opensap.manageproducts.manageproducts.controller.ErrorHandler
*/
constructor : function (oComponent) {
var oMessageManager = sap.ui.getCore().getMessageManager(),
oMessageModel = oMessageManager.getMessageModel(),
oResourceBundle = oComponent.getModel("i18n").getResourceBundle(),
sErrorText = oResourceBundle.getText("errorText"),
sMultipleErrors = oResourceBundle.getText("multipleErrorsText");
this._oComponent = oComponent;
this._bMessageOpen = false;
this.oMessageModelBinding = oMessageModel.bindList("/", undefined,
[], new Filter("technical", FilterOperator.EQ, true));
this.oMessageModelBinding.attachChange(function (oEvent) {
var aContexts = oEvent.getSource().getContexts(),
aMessages = [],
sErrorTitle;
if (this._bMessageOpen || !aContexts.length) {
return;
}
// Extract and remove the technical messages
aContexts.forEach(function (oContext) {
aMessages.push(oContext.getObject());
});
oMessageManager.removeMessages(aMessages);
// Due to batching there can be more than one technical message. However the UX
// guidelines say "display a single message in a message box" assuming that there
// will be only one at a time.
sErrorTitle = aMessages.length === 1 ? sErrorText : sMultipleErrors;
this._showServiceError(sErrorTitle, aMessages[0].message);
}, this);
},
/**
* Shows a {@link sap.m.MessageBox} when a service call has failed.
* Only the first error message will be displayed.
* @param {string} sErrorTitle A title for the error message
* @param {string} sDetails A technical error to be displayed on request
* @private
*/
_showServiceError : function (sErrorTitle, sDetails) {
this._bMessageOpen = true;
MessageBox.error(
sErrorTitle,
{
id : "serviceErrorMessageBox",
details: sDetails,
styleClass: this._oComponent.getContentDensityClass(),
actions: [MessageBox.Action.CLOSE],
onClose: function () {
this._bMessageOpen = false;
}.bind(this)
}
);
}
});
});

1
dist/controller/ErrorHandler.js vendored Normal file
View File

@ -0,0 +1 @@
sap.ui.define(["sap/ui/base/Object","sap/m/MessageBox","sap/ui/model/Filter","sap/ui/model/FilterOperator"],function(e,s,t,n){"use strict";return e.extend("opensap.manageproducts.manageproducts.controller.ErrorHandler",{constructor:function(e){var s=sap.ui.getCore().getMessageManager(),o=s.getMessageModel(),r=e.getModel("i18n").getResourceBundle(),i=r.getText("errorText"),a=r.getText("multipleErrorsText");this._oComponent=e;this._bMessageOpen=false;this.oMessageModelBinding=o.bindList("/",undefined,[],new t("technical",n.EQ,true));this.oMessageModelBinding.attachChange(function(e){var t=e.getSource().getContexts(),n=[],o;if(this._bMessageOpen||!t.length){return}t.forEach(function(e){n.push(e.getObject())});s.removeMessages(n);o=n.length===1?i:a;this._showServiceError(o,n[0].message)},this)},_showServiceError:function(e,t){this._bMessageOpen=true;s.error(e,{id:"serviceErrorMessageBox",details:t,styleClass:this._oComponent.getContentDensityClass(),actions:[s.Action.CLOSE],onClose:function(){this._bMessageOpen=false}.bind(this)})}})});

View File

@ -0,0 +1,18 @@
sap.ui.define([
"./BaseController"
], function (BaseController) {
"use strict";
return BaseController.extend("opensap.manageproducts.manageproducts.controller.NotFound", {
/**
* Navigates to the worklist when the link is pressed
* @public
*/
onLinkPressed : function () {
this.getRouter().navTo("worklist");
}
});
});

View File

@ -0,0 +1 @@
sap.ui.define(["./BaseController"],function(e){"use strict";return e.extend("opensap.manageproducts.manageproducts.controller.NotFound",{onLinkPressed:function(){this.getRouter().navTo("worklist")}})});

115
dist/controller/Object-dbg.controller.js vendored Normal file
View File

@ -0,0 +1,115 @@
sap.ui.define([
"./BaseController",
"sap/ui/model/json/JSONModel",
"sap/ui/core/routing/History",
"../model/formatter"
], function (BaseController, JSONModel, History, formatter) {
"use strict";
return BaseController.extend("opensap.manageproducts.manageproducts.controller.Object", {
formatter: formatter,
/* =========================================================== */
/* lifecycle methods */
/* =========================================================== */
/**
* Called when the worklist controller is instantiated.
* @public
*/
onInit : function () {
// Model used to manipulate control states. The chosen values make sure,
// detail page shows busy indication immediately so there is no break in
// between the busy indication for loading the view's meta data
var oViewModel = new JSONModel({
busy : true,
delay : 0
});
this.getRouter().getRoute("object").attachPatternMatched(this._onObjectMatched, this);
this.setModel(oViewModel, "objectView");
},
/* =========================================================== */
/* event handlers */
/* =========================================================== */
/**
* Event handler for navigating back.
* It there is a history entry we go one step back in the browser history
* If not, it will replace the current entry of the browser history with the worklist route.
* @public
*/
onNavBack : function() {
var sPreviousHash = History.getInstance().getPreviousHash();
if (sPreviousHash !== undefined) {
// eslint-disable-next-line sap-no-history-manipulation
history.go(-1);
} else {
this.getRouter().navTo("worklist", {}, true);
}
},
/* =========================================================== */
/* internal methods */
/* =========================================================== */
/**
* Binds the view to the object path.
* @function
* @param {sap.ui.base.Event} oEvent pattern match event in route 'object'
* @private
*/
_onObjectMatched : function (oEvent) {
var sObjectId = oEvent.getParameter("arguments").objectId;
this._bindView("/ProductSet" + sObjectId);
},
/**
* Binds the view to the object path.
* @function
* @param {string} sObjectPath path to the object to be bound
* @private
*/
_bindView : function (sObjectPath) {
var oViewModel = this.getModel("objectView");
this.getView().bindElement({
path: sObjectPath,
events: {
change: this._onBindingChange.bind(this),
dataRequested: function () {
oViewModel.setProperty("/busy", true);
},
dataReceived: function () {
oViewModel.setProperty("/busy", false);
}
}
});
},
_onBindingChange : function () {
var oView = this.getView(),
oViewModel = this.getModel("objectView"),
oElementBinding = oView.getElementBinding();
// No data for the binding
if (!oElementBinding.getBoundContext()) {
this.getRouter().getTargets().display("objectNotFound");
return;
}
var oResourceBundle = this.getResourceBundle(),
oObject = oView.getBindingContext().getObject(),
sObjectId = oObject.ProductID,
sObjectName = oObject.ProductSet;
oViewModel.setProperty("/busy", false);
oViewModel.setProperty("/shareSendEmailSubject",
oResourceBundle.getText("shareSendEmailObjectSubject", [sObjectId]));
oViewModel.setProperty("/shareSendEmailMessage",
oResourceBundle.getText("shareSendEmailObjectMessage", [sObjectName, sObjectId, location.href]));
}
});
});

1
dist/controller/Object.controller.js vendored Normal file
View File

@ -0,0 +1 @@
sap.ui.define(["./BaseController","sap/ui/model/json/JSONModel","sap/ui/core/routing/History","../model/formatter"],function(e,t,n,o){"use strict";return e.extend("opensap.manageproducts.manageproducts.controller.Object",{formatter:o,onInit:function(){var e=new t({busy:true,delay:0});this.getRouter().getRoute("object").attachPatternMatched(this._onObjectMatched,this);this.setModel(e,"objectView")},onNavBack:function(){var e=n.getInstance().getPreviousHash();if(e!==undefined){history.go(-1)}else{this.getRouter().navTo("worklist",{},true)}},_onObjectMatched:function(e){var t=e.getParameter("arguments").objectId;this._bindView("/ProductSet"+t)},_bindView:function(e){var t=this.getModel("objectView");this.getView().bindElement({path:e,events:{change:this._onBindingChange.bind(this),dataRequested:function(){t.setProperty("/busy",true)},dataReceived:function(){t.setProperty("/busy",false)}}})},_onBindingChange:function(){var e=this.getView(),t=this.getModel("objectView"),n=e.getElementBinding();if(!n.getBoundContext()){this.getRouter().getTargets().display("objectNotFound");return}var o=this.getResourceBundle(),i=e.getBindingContext().getObject(),r=i.ProductID,s=i.ProductSet;t.setProperty("/busy",false);t.setProperty("/shareSendEmailSubject",o.getText("shareSendEmailObjectSubject",[r]));t.setProperty("/shareSendEmailMessage",o.getText("shareSendEmailObjectMessage",[s,r,location.href]))}})});

View File

@ -0,0 +1,148 @@
sap.ui.define([
"./BaseController",
"sap/ui/model/json/JSONModel",
"../model/formatter",
"sap/ui/model/Filter",
"sap/ui/model/FilterOperator"
], function (BaseController, JSONModel, formatter, Filter, FilterOperator) {
"use strict";
return BaseController.extend("opensap.manageproducts.manageproducts.controller.Worklist", {
formatter: formatter,
/* =========================================================== */
/* lifecycle methods */
/* =========================================================== */
/**
* Called when the worklist controller is instantiated.
* @public
*/
onInit : function () {
var oViewModel;
// keeps the search state
this._aTableSearchState = [];
// Model used to manipulate control states
oViewModel = new JSONModel({
worklistTableTitle : this.getResourceBundle().getText("worklistTableTitle"),
shareSendEmailSubject: this.getResourceBundle().getText("shareSendEmailWorklistSubject"),
shareSendEmailMessage: this.getResourceBundle().getText("shareSendEmailWorklistMessage", [location.href]),
tableNoDataText : this.getResourceBundle().getText("tableNoDataText")
});
this.setModel(oViewModel, "worklistView");
},
/* =========================================================== */
/* event handlers */
/* =========================================================== */
/**
* Triggered by the table's 'updateFinished' event: after new table
* data is available, this handler method updates the table counter.
* This should only happen if the update was successful, which is
* why this handler is attached to 'updateFinished' and not to the
* table's list binding's 'dataReceived' method.
* @param {sap.ui.base.Event} oEvent the update finished event
* @public
*/
onUpdateFinished : function (oEvent) {
// update the worklist's object counter after the table update
var sTitle,
oTable = oEvent.getSource(),
iTotalItems = oEvent.getParameter("total");
// only update the counter if the length is final and
// the table is not empty
if (iTotalItems && oTable.getBinding("items").isLengthFinal()) {
sTitle = this.getResourceBundle().getText("worklistTableTitleCount", [iTotalItems]);
} else {
sTitle = this.getResourceBundle().getText("worklistTableTitle");
}
this.getModel("worklistView").setProperty("/worklistTableTitle", sTitle);
},
/**
* Event handler when a table item gets pressed
* @param {sap.ui.base.Event} oEvent the table selectionChange event
* @public
*/
onPress : function (oEvent) {
// The source is the list item that got pressed
this._showObject(oEvent.getSource());
},
/**
* Event handler for navigating back.
* Navigate back in the browser history
* @public
*/
onNavBack : function() {
// eslint-disable-next-line sap-no-history-manipulation
history.go(-1);
},
onSearch : function (oEvent) {
if (oEvent.getParameters().refreshButtonPressed) {
// Search field's 'refresh' button has been pressed.
// This is visible if you select any main list item.
// In this case no new search is triggered, we only
// refresh the list binding.
this.onRefresh();
} else {
var aTableSearchState = [];
var sQuery = oEvent.getParameter("query");
if (sQuery && sQuery.length > 0) {
aTableSearchState = [new Filter("ProductID", FilterOperator.Contains, sQuery)];
}
this._applySearch(aTableSearchState);
}
},
/**
* Event handler for refresh event. Keeps filter, sort
* and group settings and refreshes the list binding.
* @public
*/
onRefresh : function () {
var oTable = this.byId("table");
oTable.getBinding("items").refresh();
},
/* =========================================================== */
/* internal methods */
/* =========================================================== */
/**
* Shows the selected item on the object page
* @param {sap.m.ObjectListItem} oItem selected Item
* @private
*/
_showObject : function (oItem) {
this.getRouter().navTo("object", {
objectId: oItem.getBindingContext().getPath().substring("/ProductSet".length)
});
},
/**
* Internal helper method to apply both filter and search state together on the list binding
* @param {sap.ui.model.Filter[]} aTableSearchState An array of filters for the search
* @private
*/
_applySearch: function(aTableSearchState) {
var oTable = this.byId("table"),
oViewModel = this.getModel("worklistView");
oTable.getBinding("items").filter(aTableSearchState, "Application");
// changes the noDataText of the list in case there are no filter results
if (aTableSearchState.length !== 0) {
oViewModel.setProperty("/tableNoDataText", this.getResourceBundle().getText("worklistNoDataWithSearchText"));
}
}
});
});

View File

@ -0,0 +1 @@
sap.ui.define(["./BaseController","sap/ui/model/json/JSONModel","../model/formatter","sap/ui/model/Filter","sap/ui/model/FilterOperator"],function(e,t,i,o,s){"use strict";return e.extend("opensap.manageproducts.manageproducts.controller.Worklist",{formatter:i,onInit:function(){var e;this._aTableSearchState=[];e=new t({worklistTableTitle:this.getResourceBundle().getText("worklistTableTitle"),shareSendEmailSubject:this.getResourceBundle().getText("shareSendEmailWorklistSubject"),shareSendEmailMessage:this.getResourceBundle().getText("shareSendEmailWorklistMessage",[location.href]),tableNoDataText:this.getResourceBundle().getText("tableNoDataText")});this.setModel(e,"worklistView")},onUpdateFinished:function(e){var t,i=e.getSource(),o=e.getParameter("total");if(o&&i.getBinding("items").isLengthFinal()){t=this.getResourceBundle().getText("worklistTableTitleCount",[o])}else{t=this.getResourceBundle().getText("worklistTableTitle")}this.getModel("worklistView").setProperty("/worklistTableTitle",t)},onPress:function(e){this._showObject(e.getSource())},onNavBack:function(){history.go(-1)},onSearch:function(e){if(e.getParameters().refreshButtonPressed){this.onRefresh()}else{var t=[];var i=e.getParameter("query");if(i&&i.length>0){t=[new o("ProductID",s.Contains,i)]}this._applySearch(t)}},onRefresh:function(){var e=this.byId("table");e.getBinding("items").refresh()},_showObject:function(e){this.getRouter().navTo("object",{objectId:e.getBindingContext().getPath().substring("/ProductSet".length)})},_applySearch:function(e){var t=this.byId("table"),i=this.getModel("worklistView");t.getBinding("items").filter(e,"Application");if(e.length!==0){i.setProperty("/tableNoDataText",this.getResourceBundle().getText("worklistNoDataWithSearchText"))}}})});

89
dist/i18n/i18n.properties vendored Normal file
View File

@ -0,0 +1,89 @@
# This is the resource bundle for opensap.manageproducts.manageproducts
#Texts for manifest.json
#XTIT: Application name
appTitle=Manage Products
#YDES: Application description
appDescription=A Fiori application.
#~~~ Worklist View ~~~~~~~~~~~~~~~~~~~~~~~~~~
#XTIT: Worklist view title
worklistViewTitle=Manage ProductSet
#XTIT: Worklist page title
worklistTitle=Manage Products
#XTIT: Table view title
worklistTableTitle=ProductSet
#XTOL: Tooltip for the search field
worklistSearchTooltip=Enter an ProductSet name or a part of it.
#XBLI: text for a table with no data with filter or search
worklistNoDataWithSearchText=No matching ProductSet found
#XTIT: Table view title with placeholder for the number of items
worklistTableTitleCount=ProductSet ({0})
#XTIT: The title of the column containing the ProductID of ProductSet
tableNameColumnTitle=ProductID
#XTIT: The title of the column containing the Price and the unit of measure
tableUnitNumberColumnTitle=Price
#XBLI: text for a table with no data
tableNoDataText=No ProductSet are currently available
#XLNK: text for link in 'not found' pages
backToWorklist=Show Manage Products
#~~~ Object View ~~~~~~~~~~~~~~~~~~~~~~~~~~
#XTIT: Object view title
objectViewTitle=ProductSet Details
#XTIT: Object page title
objectTitle=ProductSet
#XTIT: Label for the ProductID
ProductIDLabel=ProductID
#XTIT: Label for the Price
PriceLabel=Price
#~~~ Share Menu Options ~~~~~~~~~~~~~~~~~~~~~~~
#XTIT: Send E-Mail subject
shareSendEmailWorklistSubject=<Email subject PLEASE REPLACE ACCORDING TO YOUR USE CASE>
#YMSG: Send E-Mail message
shareSendEmailWorklistMessage=<Email body PLEASE REPLACE ACCORDING TO YOUR USE CASE>\r\n{0}
#XTIT: Send E-Mail subject
shareSendEmailObjectSubject=<Email subject including object identifier PLEASE REPLACE ACCORDING TO YOUR USE CASE> {0}
#YMSG: Send E-Mail message
shareSendEmailObjectMessage=<Email body PLEASE REPLACE ACCORDING TO YOUR USE CASE> {0} (id: {1})\r\n{2}
#~~~ Not Found View ~~~~~~~~~~~~~~~~~~~~~~~
#XTIT: Not found view title
notFoundTitle=Not Found
#YMSG: The ProductSet not found text is displayed when there is no ProductSet with this id
noObjectFoundText=This ProductSet is not available
#YMSG: The ProductSet not available text is displayed when there is no data when starting the app
noObjectsAvailableText=No ProductSet are currently available
#YMSG: The not found text is displayed when there was an error loading the resource (404 error)
notFoundText=The requested resource was not found
#~~~ Error Handling ~~~~~~~~~~~~~~~~~~~~~~~
#YMSG: Error dialog description
errorText=Sorry, a technical error occurred! Please try again later.

38
dist/index.html vendored Normal file
View File

@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Manage Products</title>
<style>
html, body, body > div, #container, #container-uiarea {
height: 100%;
}
</style>
<script
id="sap-ui-bootstrap"
src="resources/sap-ui-core.js"
data-sap-ui-theme="sap_fiori_3"
data-sap-ui-resourceroots='{
"opensap.manageproducts.manageproducts": "./"
}'
data-sap-ui-compatVersion="edge"
data-sap-ui-async="true"
data-sap-ui-frameOptions="trusted"
></script>
<script id="locate-reuse-libs" src="./utils/locate-reuse-libs.js"
data-sap-ui-manifest-uri="./manifest.json"
data-sap-ui-componentName="opensap.manageproducts.manageproducts">
</script>
</head>
<body class="sapUiBody sapUiSizeCompact" id="content">
<div
data-sap-ui-component
data-name="opensap.manageproducts.manageproducts"
data-id="container"
data-settings='{"id" : "opensap.manageproducts.manageproducts"}'
data-handle-validation="true"
></div>
</body>
</html>

BIN
dist/manifest-bundle.zip vendored Normal file

Binary file not shown.

144
dist/manifest.json vendored Normal file
View File

@ -0,0 +1,144 @@
{
"_version": "1.28.0",
"sap.app": {
"id": "opensap.manageproducts.manageproducts",
"type": "application",
"i18n": "i18n/i18n.properties",
"applicationVersion": {
"version": "0.0.1"
},
"title": "{{appTitle}}",
"description": "{{appDescription}}",
"resources": "resources.json",
"sourceTemplate": {
"id": "@sap-ux/fiori-freestyle-writer:worklist",
"version": "0.11.6"
},
"dataSources": {
"mainService": {
"uri": "sap/opu/odata/iwbep/GWSAMPLE_BASIC/",
"type": "OData",
"settings": {
"annotations": [],
"localUri": "localService/metadata.xml",
"odataVersion": "2.0"
}
}
}
},
"sap.ui": {
"technology": "UI5",
"icons": {
"icon": "",
"favIcon": "",
"phone": "",
"phone@2": "",
"tablet": "",
"tablet@2": ""
},
"deviceTypes": {
"desktop": true,
"tablet": true,
"phone": true
}
},
"sap.ui5": {
"flexEnabled": true,
"dependencies": {
"minUI5Version": "1.84.14",
"libs": {
"sap.m": {},
"sap.ui.core": {},
"sap.f": {},
"sap.suite.ui.generic.template": {},
"sap.ui.comp": {},
"sap.ui.generic.app": {},
"sap.ui.table": {},
"sap.ushell": {}
}
},
"contentDensities": {
"compact": true,
"cozy": true
},
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": {
"bundleName": "opensap.manageproducts.manageproducts.i18n.i18n"
}
},
"": {
"dataSource": "mainService",
"preload": true,
"settings": {}
}
},
"resources": {
"css": []
},
"routing": {
"config": {
"routerClass": "sap.m.routing.Router",
"viewType": "XML",
"viewPath": "opensap.manageproducts.manageproducts.view",
"controlId": "app",
"controlAggregation": "pages",
"bypassed": {
"target": [
"notFound"
]
},
"async": true
},
"routes": [
{
"pattern": "",
"name": "worklist",
"target": [
"worklist"
]
},
{
"pattern": "ProductSet/{objectId}",
"name": "object",
"target": [
"object"
]
}
],
"targets": {
"worklist": {
"viewName": "Worklist",
"viewId": "worklist",
"viewLevel": 1,
"title": "{i18n>worklistViewTitle}"
},
"object": {
"viewName": "Object",
"viewId": "object",
"viewLevel": 2,
"title": "{i18n>objectViewTitle}"
},
"objectNotFound": {
"viewName": "ObjectNotFound",
"viewId": "objectNotFound"
},
"notFound": {
"viewName": "NotFound",
"viewId": "notFound"
}
}
},
"rootView": {
"viewName": "opensap.manageproducts.manageproducts.view.App",
"type": "XML",
"async": true,
"id": "app"
}
},
"sap.cloud": {
"public": true,
"service": "opensap-manageproducts-manageproducts"
}
}

21
dist/model/formatter-dbg.js vendored Normal file
View File

@ -0,0 +1,21 @@
sap.ui.define([], function () {
"use strict";
return {
/**
* Rounds the number unit value to 2 digits
* @public
* @param {string} sValue the number string to be rounded
* @returns {string} sValue with 2 digits rounded
*/
numberUnit : function (sValue) {
if (!sValue) {
return "";
}
return parseFloat(sValue).toFixed(2);
}
};
});

1
dist/model/formatter.js vendored Normal file
View File

@ -0,0 +1 @@
sap.ui.define([],function(){"use strict";return{numberUnit:function(n){if(!n){return""}return parseFloat(n).toFixed(2)}}});

23
dist/model/models-dbg.js vendored Normal file
View File

@ -0,0 +1,23 @@
sap.ui.define([
"sap/ui/model/json/JSONModel",
"sap/ui/Device"
],
/**
* provide app-view type models (as in the first "V" in MVVC)
*
* @param {typeof sap.ui.model.json.JSONModel} JSONModel
* @param {typeof sap.ui.Device} Device
*
* @returns {Function} createDeviceModel() for providing runtime info for the device the UI5 app is running on
*/
function (JSONModel, Device) {
"use strict";
return {
createDeviceModel: function () {
var oModel = new JSONModel(Device);
oModel.setDefaultBindingMode("OneWay");
return oModel;
}
};
});

1
dist/model/models.js vendored Normal file
View File

@ -0,0 +1 @@
sap.ui.define(["sap/ui/model/json/JSONModel","sap/ui/Device"],function(e,n){"use strict";return{createDeviceModel:function(){var i=new e(n);i.setDefaultBindingMode("OneWay");return i}}});

Binary file not shown.

32
dist/sap-ui-cachebuster-info.json vendored Normal file
View File

@ -0,0 +1,32 @@
{
"Component-preload.js": 1651048975737,
"controller/Object.controller.js": 1651045417458,
"utils/locate-reuse-libs.js": 1651045417438,
"model/models.js": 1651045417454,
"model/formatter.js": 1651045417466,
"controller/Worklist.controller.js": 1651045417466,
"manifest.json": 1651048975299,
"controller/NotFound.controller.js": 1651045417458,
"controller/ErrorHandler.js": 1651045417458,
"controller/BaseController.js": 1651045417454,
"controller/App.controller.js": 1651045417454,
"Component.js": 1651045417430,
"manifest-bundle.zip": 1651048975315,
"i18n/i18n.properties": 1651045417438,
"utils/locate-reuse-libs-dbg.js": 1651045417438,
"model/models-dbg.js": 1651045417454,
"model/formatter-dbg.js": 1651045417466,
"controller/Worklist-dbg.controller.js": 1651045417466,
"controller/Object-dbg.controller.js": 1651045417458,
"controller/NotFound-dbg.controller.js": 1651045417458,
"controller/ErrorHandler-dbg.js": 1651045417458,
"controller/BaseController-dbg.js": 1651045417454,
"controller/App-dbg.controller.js": 1651045417454,
"Component-dbg.js": 1651045417430,
"view/Worklist.view.xml": 1651045417474,
"view/ObjectNotFound.view.xml": 1651045417470,
"view/Object.view.xml": 1651045417470,
"view/NotFound.view.xml": 1651045417470,
"view/App.view.xml": 1651045417466,
"index.html": 1651045417434
}

173
dist/utils/locate-reuse-libs-dbg.js vendored Normal file
View File

@ -0,0 +1,173 @@
/*eslint-disable semi, no-console*/
(function (sap) {
var fioriToolsGetManifestLibs = function (manifestPath) {
var url = manifestPath;
var result = "";
// SAPUI5 delivered namespaces from https://ui5.sap.com/#/api/sap
var ui5Libs = [
"sap.apf",
"sap.base",
"sap.chart",
"sap.collaboration",
"sap.f",
"sap.fe",
"sap.fileviewer",
"sap.gantt",
"sap.landvisz",
"sap.m",
"sap.ndc",
"sap.ovp",
"sap.rules",
"sap.suite",
"sap.tnt",
"sap.ui",
"sap.uiext",
"sap.ushell",
"sap.uxap",
"sap.viz",
"sap.webanalytics",
"sap.zen"
];
function getKeys(libOrComp,libOrCompKeysString) {
Object.keys(libOrComp).forEach(function (libOrCompKey) {
// ignore libs or Components that start with SAPUI5 delivered namespaces
if (!ui5Libs.some(function (substring) { return libOrCompKey === substring || libOrCompKey.startsWith(substring + "."); })) {
if (libOrCompKeysString.length > 0) {
libOrCompKeysString = libOrCompKeysString + "," + libOrCompKey;
} else {
libOrCompKeysString = libOrCompKey;
}
}
});
return libOrCompKeysString;
}
return new Promise(function (resolve, reject) {
$.ajax(url)
.done(function (manifest) {
if (manifest) {
if (
manifest["sap.ui5"] &&
manifest["sap.ui5"].dependencies
) {
if (manifest["sap.ui5"].dependencies.libs){
result = getKeys(manifest["sap.ui5"].dependencies.libs, result)
}
if (manifest["sap.ui5"].dependencies.components){
result = getKeys(manifest["sap.ui5"].dependencies.components, result)
}
}
if (
manifest["sap.ui5"] &&
manifest["sap.ui5"].componentUsages
) {
result = getKeys(manifest["sap.ui5"].componentUsages, result)
}
}
resolve(result);
})
.fail(function (error) {
reject(new Error("Could not fetch manifest at '" + manifestPath));
});
});
};
/**
* Registers the module paths for dependencies of the given component.
* @param {string} manifestPath The the path to the app manifest path
* for which the dependencies should be registered.
* @returns {Promise} A promise which is resolved when the ajax request for
* the app-index was successful and the module paths were registered.
*/
sap.registerComponentDependencyPaths = function (manifestPath) {
/*eslint-disable semi, consistent-return*/
return fioriToolsGetManifestLibs(manifestPath).then(function (libs) {
if (libs && libs.length > 0) {
var url = "/sap/bc/ui2/app_index/ui5_app_info?id=" + libs;
var sapClient = jQuery.sap.getUriParameters().get("sap-client");
if (sapClient && sapClient.length === 3) {
url = url + "&sap-client=" + sapClient;
}
return $.ajax(url).done(function (data) {
if (data) {
Object.keys(data).forEach(function (moduleDefinitionKey) {
var moduleDefinition = data[moduleDefinitionKey];
if (moduleDefinition && moduleDefinition.dependencies) {
moduleDefinition.dependencies.forEach(function (dependency) {
if (dependency.url && dependency.url.length > 0 && dependency.type === "UI5LIB") {
jQuery.sap.log.info(
"Registering Library " +
dependency.componentId +
" from server " +
dependency.url
);
jQuery.sap.registerModulePath(dependency.componentId, dependency.url);
}
});
}
});
}
});
}
});
};
})(sap);
/*eslint-disable sap-browser-api-warning, sap-no-dom-access*/
var scripts = document.getElementsByTagName("script");
var currentScript = document.getElementById('locate-reuse-libs');
if(!currentScript){
currentScript = document.currentScript;
};
var manifestUri = currentScript.getAttribute("data-sap-ui-manifest-uri");
var componentName = currentScript.getAttribute("data-sap-ui-componentName");
var useMockserver = currentScript.getAttribute("data-sap-ui-use-mockserver");
sap.registerComponentDependencyPaths(manifestUri)
.catch(function (error) {
jQuery.sap.log.error(error);
})
.finally(function () {
// setting the app title with internationalization
sap.ui.getCore().attachInit(function () {
jQuery.sap.require("jquery.sap.resources");
var sLocale = sap.ui.getCore().getConfiguration().getLanguage();
var oBundle = jQuery.sap.resources({
url: "i18n/i18n.properties",
locale: sLocale
});
document.title = oBundle.getText("appTitle");
});
if (componentName && componentName.length > 0) {
if (useMockserver && useMockserver === "true") {
sap.ui.getCore().attachInit(function () {
sap.ui.require([componentName.replace(/\./g, "/") + "/localService/mockserver"], function (server) {
// set up test service for local testing
server.init();
// initialize the ushell sandbox component
sap.ushell.Container.createRenderer().placeAt("content");
});
});
} else {
// Requiring the ComponentSupport module automatically executes the component initialisation for all declaratively defined components
sap.ui.require(["sap/ui/core/ComponentSupport"]);
// setting the app title with the i18n text
sap.ui.getCore().attachInit(function () {
jQuery.sap.require("jquery.sap.resources");
var sLocale = sap.ui.getCore().getConfiguration().getLanguage();
var oBundle = jQuery.sap.resources({
url: "i18n/i18n.properties",
locale: sLocale
});
document.title = oBundle.getText("appTitle");
});
}
} else {
sap.ui.getCore().attachInit(function () {
// initialize the ushell sandbox component
sap.ushell.Container.createRenderer().placeAt("content");
});
}
});
sap.registerComponentDependencyPaths(manifestUri);

1
dist/utils/locate-reuse-libs.js vendored Normal file
View File

@ -0,0 +1 @@
(function(e){var t=function(e){var t=e;var n="";var r=["sap.apf","sap.base","sap.chart","sap.collaboration","sap.f","sap.fe","sap.fileviewer","sap.gantt","sap.landvisz","sap.m","sap.ndc","sap.ovp","sap.rules","sap.suite","sap.tnt","sap.ui","sap.uiext","sap.ushell","sap.uxap","sap.viz","sap.webanalytics","sap.zen"];function a(e,t){Object.keys(e).forEach(function(e){if(!r.some(function(t){return e===t||e.startsWith(t+".")})){if(t.length>0){t=t+","+e}else{t=e}}});return t}return new Promise(function(r,i){$.ajax(t).done(function(e){if(e){if(e["sap.ui5"]&&e["sap.ui5"].dependencies){if(e["sap.ui5"].dependencies.libs){n=a(e["sap.ui5"].dependencies.libs,n)}if(e["sap.ui5"].dependencies.components){n=a(e["sap.ui5"].dependencies.components,n)}}if(e["sap.ui5"]&&e["sap.ui5"].componentUsages){n=a(e["sap.ui5"].componentUsages,n)}}r(n)}).fail(function(t){i(new Error("Could not fetch manifest at '"+e))})})};e.registerComponentDependencyPaths=function(e){return t(e).then(function(e){if(e&&e.length>0){var t="/sap/bc/ui2/app_index/ui5_app_info?id="+e;var n=jQuery.sap.getUriParameters().get("sap-client");if(n&&n.length===3){t=t+"&sap-client="+n}return $.ajax(t).done(function(e){if(e){Object.keys(e).forEach(function(t){var n=e[t];if(n&&n.dependencies){n.dependencies.forEach(function(e){if(e.url&&e.url.length>0&&e.type==="UI5LIB"){jQuery.sap.log.info("Registering Library "+e.componentId+" from server "+e.url);jQuery.sap.registerModulePath(e.componentId,e.url)}})}})}})}})}})(sap);var scripts=document.getElementsByTagName("script");var currentScript=document.getElementById("locate-reuse-libs");if(!currentScript){currentScript=document.currentScript}var manifestUri=currentScript.getAttribute("data-sap-ui-manifest-uri");var componentName=currentScript.getAttribute("data-sap-ui-componentName");var useMockserver=currentScript.getAttribute("data-sap-ui-use-mockserver");sap.registerComponentDependencyPaths(manifestUri).catch(function(e){jQuery.sap.log.error(e)}).finally(function(){sap.ui.getCore().attachInit(function(){jQuery.sap.require("jquery.sap.resources");var e=sap.ui.getCore().getConfiguration().getLanguage();var t=jQuery.sap.resources({url:"i18n/i18n.properties",locale:e});document.title=t.getText("appTitle")});if(componentName&&componentName.length>0){if(useMockserver&&useMockserver==="true"){sap.ui.getCore().attachInit(function(){sap.ui.require([componentName.replace(/\./g,"/")+"/localService/mockserver"],function(e){e.init();sap.ushell.Container.createRenderer().placeAt("content")})})}else{sap.ui.require(["sap/ui/core/ComponentSupport"]);sap.ui.getCore().attachInit(function(){jQuery.sap.require("jquery.sap.resources");var e=sap.ui.getCore().getConfiguration().getLanguage();var t=jQuery.sap.resources({url:"i18n/i18n.properties",locale:e});document.title=t.getText("appTitle")})}}else{sap.ui.getCore().attachInit(function(){sap.ushell.Container.createRenderer().placeAt("content")})}});sap.registerComponentDependencyPaths(manifestUri);

14
dist/view/App.view.xml vendored Normal file
View File

@ -0,0 +1,14 @@
<mvc:View
controllerName="opensap.manageproducts.manageproducts.controller.App"
displayBlock="true"
xmlns="sap.m"
xmlns:mvc="sap.ui.core.mvc">
<Shell>
<App
id="app"
busy="{appView>/busy}"
busyIndicatorDelay="{appView>/delay}"/>
</Shell>
</mvc:View>

17
dist/view/NotFound.view.xml vendored Normal file
View File

@ -0,0 +1,17 @@
<mvc:View
controllerName="opensap.manageproducts.manageproducts.controller.NotFound"
xmlns="sap.m"
xmlns:mvc="sap.ui.core.mvc">
<MessagePage
title="{i18n>notFoundTitle}"
text="{i18n>notFoundText}"
icon="sap-icon://document"
id="page"
description="">
<customDescription>
<Link id="link" text="{i18n>backToWorklist}" press=".onLinkPressed"/>
</customDescription>
</MessagePage>
</mvc:View>

35
dist/view/Object.view.xml vendored Normal file
View File

@ -0,0 +1,35 @@
<mvc:View
controllerName="opensap.manageproducts.manageproducts.controller.Object"
xmlns="sap.m"
xmlns:mvc="sap.ui.core.mvc"
xmlns:semantic="sap.f.semantic">
<semantic:SemanticPage
id="page"
headerPinnable="false"
toggleHeaderOnTitleClick="false"
busy="{objectView>/busy}"
busyIndicatorDelay="{objectView>/delay}">
<semantic:titleHeading>
<Title
text="{ProductID}"
level="H2"/>
</semantic:titleHeading>
<semantic:headerContent>
<ObjectNumber
number="{
path: 'Price',
formatter: '.formatter.numberUnit'
}"
unit="{CurrencyCode}" />
</semantic:headerContent>
<semantic:sendEmailAction>
<semantic:SendEmailAction id="shareEmail" press=".onShareEmailPress"/>
</semantic:sendEmailAction>
</semantic:SemanticPage>
</mvc:View>

17
dist/view/ObjectNotFound.view.xml vendored Normal file
View File

@ -0,0 +1,17 @@
<mvc:View
controllerName="opensap.manageproducts.manageproducts.controller.NotFound"
xmlns="sap.m"
xmlns:mvc="sap.ui.core.mvc">
<MessagePage
title="{i18n>objectTitle}"
text="{i18n>noObjectFoundText}"
icon="sap-icon://product"
description=""
id="page">
<customDescription>
<Link id="link" text="{i18n>backToWorklist}" press=".onLinkPressed" />
</customDescription>
</MessagePage>
</mvc:View>

89
dist/view/Worklist.view.xml vendored Normal file
View File

@ -0,0 +1,89 @@
<mvc:View
controllerName="opensap.manageproducts.manageproducts.controller.Worklist"
xmlns="sap.m"
xmlns:mvc="sap.ui.core.mvc"
xmlns:semantic="sap.f.semantic">
<semantic:SemanticPage
id="page"
headerPinnable="false"
toggleHeaderOnTitleClick="false">
<semantic:titleHeading>
<Title
text="{i18n>worklistTitle}"
level="H2"/>
</semantic:titleHeading>
<semantic:content>
<Table
id="table"
width="auto"
items="{
path: '/ProductSet',
sorter: {
path: 'ProductID',
descending: false
}
}"
noDataText="{worklistView>/tableNoDataText}"
busyIndicatorDelay="{worklistView>/tableBusyDelay}"
growing="true"
growingScrollToLoad="true"
updateFinished=".onUpdateFinished">
<headerToolbar>