Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update locate-reuse-lib.js ui5 linter issues #2334

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
332 changes: 192 additions & 140 deletions packages/fiori-elements-writer/test/__snapshots__/alp.test.ts.snap

Large diffs are not rendered by default.

166 changes: 96 additions & 70 deletions packages/fiori-elements-writer/test/__snapshots__/feop.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3469,32 +3469,35 @@ EntityType=\\"com.sap.gateway.srvd.dmo.sd_travel_mduu.v0001.TravelAgencyType\\">
return libOrCompKeysStringTmp;
}
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);

sap.ui.require([\\"sap/ui/thirdparty/jquery\\"], function (localJQuery) {
localJQuery.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\\"].dependencies.components) {
result = getKeys(manifest[\\"sap.ui5\\"].dependencies.components, result);
if (
manifest[\\"sap.ui5\\"] &&
manifest[\\"sap.ui5\\"].componentUsages
) {
result = getComponentUsageNames(manifest[\\"sap.ui5\\"].componentUsages, result);
}
}
if (
manifest[\\"sap.ui5\\"] &&
manifest[\\"sap.ui5\\"].componentUsages
) {
result = getComponentUsageNames(manifest[\\"sap.ui5\\"].componentUsages, result);
}
}
resolve(result);
})
.fail(function () {
reject(new Error(\\"Could not fetch manifest at '\\" + manifestPath));
});
resolve(result);
})
.fail(function () {
reject(new Error(\\"Could not fetch manifest at '\\" + manifestPath));
});
});
});
};
function registerModules(dataFromAppIndex) {
Expand Down Expand Up @@ -3537,18 +3540,19 @@ EntityType=\\"com.sap.gateway.srvd.dmo.sd_travel_mduu.v0001.TravelAgencyType\\">

return new Promise(
function (resolve) {
sap.ui.require([\\"sap/base/util/UriParameters\\"], function (UriParameters) {
sapClient = UriParameters.fromQuery(window.location.search).get(\\"sap-client\\");
if (sapClient && sapClient.length === 3) {
url = url + \\"&sap-client=\\" + sapClient;
}
resolve(url);
});
sapClient = new URLSearchParams(window.location.search).get(\\"sap-client\\");
if (sapClient && sapClient.length === 3) {
url = url + \\"&sap-client=\\" + sapClient;
}
resolve(url);
}).then(function (url2) {
return $.ajax(url2).done(function (data) {
if (data) {
registerModules(data);
}
sap.ui.require([\\"sap/ui/thirdparty/jquery\\"], function (localJQuery) {
return localJQuery.ajax(url2)
.done(function (data) {
if (data) {
registerModules(data);
}
});
});
});
} else {
Expand Down Expand Up @@ -3586,6 +3590,10 @@ 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\\");

// Patch (KW): resourceRoot is needed to load the correct ResourceBundles
var resourceRoot = manifestUri.substring(0, manifestUri.lastIndexOf('/')+1);


sap.registerComponentDependencyPaths(manifestUri)
.catch(function (error) {
sap.ui.require([\\"sap/base/Log\\"], function (Log) {
Expand All @@ -3595,57 +3603,75 @@ sap.registerComponentDependencyPaths(manifestUri)
.finally(function () {

// setting the app title with internationalization
sap.ui.getCore().attachInit(function () {
var sLocale = sap.ui.getCore().getConfiguration().getLanguage();
sap.ui.require([\\"sap/base/i18n/ResourceBundle\\"], function (ResourceBundle) {
var oResourceBundle = ResourceBundle.create({
url: \\"i18n/i18n.properties\\",
locale: sLocale
sap.ui.require([\\"sap/ui/core/Core\\"], async function(Core) {
Core.ready(() => {
sap.ui.require([\\"sap/base/i18n/Localization\\"], function (Localization) {
sap.ui.require([\\"sap/base/i18n/ResourceBundle\\"], function (ResourceBundle) {
var oResourceBundle = ResourceBundle.create({
// Patch (KW): resourceRoot is needed to load the correct ResourceBundles
url: resourceRoot + \\"i18n/i18n.properties\\",
locale: Localization.getLanguage()
});
document.title = oResourceBundle.getText(\\"appTitle\\");
});
});
document.title = oResourceBundle.getText(\\"appTitle\\");
});
});
});

if (componentName && componentName.length > 0) {
if (componentName && componentName.length > 0) {
if (useMockserver && useMockserver === \\"true\\") {
sap.ui.getCore().attachInit(function () {
registerSAPFonts();
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\\");
});
sap.ui.require([\\"sap/ui/core/Core\\"], async function(Core) {
Core.ready(() => {
registerSAPFonts();
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.ui.require([\\"sap/ushell/Container\\"], async function (Container) {
Container.createRenderer(true).then(function (component) {
component.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 () {
registerSAPFonts();
var sLocale = sap.ui.getCore().getConfiguration().getLanguage();
sap.ui.require([\\"sap/base/i18n/ResourceBundle\\"], function (ResourceBundle) {
var oResourceBundle = ResourceBundle.create({
url: \\"i18n/i18n.properties\\",
locale: sLocale
sap.ui.require([\\"sap/ui/core/Core\\"], async function(Core) {
Core.ready(() => {
registerSAPFonts();
sap.ui.require([\\"sap/base/i18n/Localization\\"], function (Localization) {
sap.ui.require([\\"sap/base/i18n/ResourceBundle\\"], function (ResourceBundle) {
var oResourceBundle = ResourceBundle.create({
// Patch (KW): resourceRoot is needed to load the correct ResourceBundles
url: resourceRoot + \\"i18n/i18n.properties\\",
locale: Localization.getLanguage()
});
document.title = oResourceBundle.getText(\\"appTitle\\");
});
});
document.title = oResourceBundle.getText(\\"appTitle\\");
});
});
});
}
} else {
sap.ui.getCore().attachInit(function () {
registerSAPFonts();
try {
// initialize the ushell sandbox component in ui5 v2
sap.ushell.Container.createRenderer(true).then(function (component) {
component.placeAt(\\"content\\");
sap.ui.require([\\"sap/ui/core/Core\\"], async function(Core) {
Core.ready(() => {
registerSAPFonts();
// initialize the ushell sandbox component
sap.ui.require([\\"sap/ushell/Container\\"], async function (Container) {
try {
Container.createRenderer(true).then(function (component) {
component.placeAt(\\"content\\");
});
} catch (error) {
// support older versions of ui5
Container.createRenderer().placeAt(\\"content\\");
}
});
} catch {
// support older versions of ui5
sap.ushell.Container.createRenderer().placeAt(\\"content\\");
}
});
});
}
});",
Expand Down
Loading
Loading