Skip to content

Commit

Permalink
Added Support display for manifest min Versions
Browse files Browse the repository at this point in the history
  • Loading branch information
RubenMuellauer committed Oct 23, 2024
1 parent 33bb039 commit 6fa0d19
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 83 deletions.
47 changes: 12 additions & 35 deletions UI5_Quality_Checks_App/webapp/controller/startpage.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,18 @@ sap.ui.define(["sap/ui/core/mvc/Controller"], function (Controller) {
var minVersion = await SRBGitHub.detectUI5VersionInManifestFile(file);

version.version = minVersion;

if (version.isEvergreenBootstrap === true) {
var versionCheck = SRBGitHub.checkForVersionSupport(undefined, minVersion);
version.eocp = versionCheck.eocp;
version.eom = versionCheck.eom;
} else {
var patchCheck = SRBGitHub.checkForPatchSupport(undefined, minVersion);
if (patchCheck) {
version.eocp = patchCheck.eocp;
version.eom = patchCheck.eom;
}
}
that.setResultData(resultRecord, version, file, true);

that.addRow(resultsModel, resultRecord);
Expand Down Expand Up @@ -170,42 +182,7 @@ sap.ui.define(["sap/ui/core/mvc/Controller"], function (Controller) {
resultsTable.setVisible(true);
loginBox.setVisible(false);

// const repoData = await that.fetchData();

// repoData.forEach((repo) => {
// var tableData = resultsModel.getProperty("/results");
// tableData.push(repo);
// resultsModel.setProperty("/results", tableData);
// sap.ui.core.BusyIndicator.hide();
// });

this.fetchData(resultsModel);

// console.log(resultsModel.getProperty("/results"));

// Promise.allSettled([getVersionData, getLinterstatus]).then(() => {
// addRow(resultRecord);

// responseCounter++;

// if (doneCb && numberOfBootstraps === responseCounter) {
// doneCb();
// }
// });
// });

// Add row to table. A row with all its meta has been loaded successfully
// function (tableRowData) {
// var tableData = resultsModel.getProperty("/results");
// tableData.push(tableRowData);
// resultsModel.setProperty("/results", tableData);
// sap.ui.core.BusyIndicator.hide();
// },
// // Processing done
// function () {
// console.log(resultsModel.getProperty("/results"));
// sap.ui.core.BusyIndicator.hide();
// }
},

showSupportDialogPressed: function () {
Expand Down
84 changes: 36 additions & 48 deletions UI5_Quality_Checks_App/webapp/libs/SRBGitHub.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,6 @@ var SRBGitHub = (function () {
});

return { results: response.data.items, headers: response.headers };

// return new Promise(function (resolve, reject) {
// var cdnAQuery = "/sap-ui-core.js in:file org:SRBConsultingTeam filename:/index.html";
// //var cdnBQuery = "https://ui5.sap.com in:file OR resources/sap-ui-core.js in:file org:SRBConsultingTeam filename:/index.html";
// //var cdnCQuery = "resources/sap-ui-core.js in:file org:SRBConsultingTeam filename:/index.html";

// that.octokit.rest.search
// .code({
// q: cdnAQuery,
// type: "code",
// // eslint-disable-next-line camelcase
// per_page: 15
// })
// .then((response) => {
// var resultsA = response.data.items;
// //var finalResults = resultsA.concat(resultsB);

// resolve(resultsA);
// });
// });
},

getUI5ManifestFile: async function (repos, page) {
Expand Down Expand Up @@ -192,14 +172,10 @@ var SRBGitHub = (function () {
var isMinVersion = false;

for (var i = 0; i < scriptTags.length; i++) {
var tag = scriptTags[i];
var src = tag.getAttribute("src");

if (src !== null) {
// console.log("This is not a UI5 src tag");
var src = scriptTags[i].getAttribute("src");
if (src) {
groups = src.match("https://sapui5.hana.ondemand.com/(.*)(/resources)");
if (groups) {
// console.log(groups);
versionString = groups[1];
detected = true;
} else {
Expand All @@ -213,8 +189,6 @@ var SRBGitHub = (function () {
detected = true;
isMinVersion = true;
}
// console.log(tag);
// console.log(src);
}
}

Expand All @@ -223,27 +197,16 @@ var SRBGitHub = (function () {
}

if (evergreen === true) {
versions.forEach(function (versionEntry) {
var major = versionEntry.version.split(".")[0];
var minor = versionEntry.version.split(".")[1];
var compareVersion = major + "." + minor;

if (versionString === compareVersion) {
eocp = versionEntry.eocp;
eom = versionEntry.eom === true ? "Reached" : versionEntry.eom;
}
});
var { eocp, eom } = that.checkForVersionSupport(versions, versionString);

Check failure on line 200 in UI5_Quality_Checks_App/webapp/libs/SRBGitHub.js

View workflow job for this annotation

GitHub Actions / srb-reuse-linter / js-linter-job

'eocp' is already defined

Check failure on line 200 in UI5_Quality_Checks_App/webapp/libs/SRBGitHub.js

View workflow job for this annotation

GitHub Actions / srb-reuse-linter / js-linter-job

'eom' is already defined
eocp = eocp;

Check failure on line 201 in UI5_Quality_Checks_App/webapp/libs/SRBGitHub.js

View workflow job for this annotation

GitHub Actions / srb-reuse-linter / js-linter-job

'eocp' is assigned to itself
eom = eom;

Check failure on line 202 in UI5_Quality_Checks_App/webapp/libs/SRBGitHub.js

View workflow job for this annotation

GitHub Actions / srb-reuse-linter / js-linter-job

'eom' is assigned to itself
} else {
patches.forEach(function (patch) {
if (patch.version === versionString) {
if (patch.removed === true) {
eocp = "Reached"; // <-- Write true because it has beed removed
eom = "Reached";
} else {
eocp = patch.eocp; // <-- Write the provided eocp date
}
}
});
var checks = that.checkForPatchSupport(patches, versionString);
if (checks) {
var { eocp, eom } = checks;

Check failure on line 206 in UI5_Quality_Checks_App/webapp/libs/SRBGitHub.js

View workflow job for this annotation

GitHub Actions / srb-reuse-linter / js-linter-job

'eocp' is already defined

Check failure on line 206 in UI5_Quality_Checks_App/webapp/libs/SRBGitHub.js

View workflow job for this annotation

GitHub Actions / srb-reuse-linter / js-linter-job

'eom' is already defined
eocp = eocp;
eom = eom;
}
}
}
}
Expand All @@ -257,6 +220,31 @@ var SRBGitHub = (function () {
};
},

checkForVersionSupport: function (versions, currentVersion) {
if (!versions) versions = availableVersionsModel.getData().versions;
var returnValues;
versions.forEach((versionEntry) => {
var splittedVersion = versionEntry.version.split(".");
var compareVersion = `${splittedVersion[0]}.${splittedVersion[1]}`;
if (currentVersion === compareVersion) {
returnValues = { eocp: versionEntry.eocp, eom: versionEntry.eom === true ? "Reached" : versionEntry.eom };
}
});
return returnValues;
},

checkForPatchSupport: function (patches, currentVersion) {
if (!patches) patches = availableVersionsModel.getData().patches;
var returnValues;
patches.forEach((patch) => {
if (patch.version === currentVersion) {
if (patch.removed === true) returnValues = { eocp: "Reached", eom: "Reached" };
else returnValues = { eocp: patch.eocp, eom: "" };
}
});
return returnValues;
},

detectUI5VersionInManifestFile: async function (fileContent) {
var that = this;

Expand Down

0 comments on commit 6fa0d19

Please sign in to comment.