Skip to content

Commit

Permalink
Fix sandbox urls and add github url
Browse files Browse the repository at this point in the history
  • Loading branch information
diegobugs committed Sep 10, 2024
1 parent 2b9d6f3 commit 814557e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 14 deletions.
20 changes: 12 additions & 8 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ <h3>Frontend webapps</h3>
const apps = [
{
name: "e-commerce funnel",
repoUrl: "https://github.com/reservamos/platform-funnel",
urls: [
"https://viajes.expresobrasilia.com/version",
"https://viaje.costaline.com.mx/version",
Expand All @@ -42,15 +43,18 @@ <h3>Frontend webapps</h3>
],
},
{
name: "e-commerce funnel (sandbox)",
name: "e-commerce funnel (development)",
repoUrl: "https://github.com/reservamos/platform-funnel",
urls: [
"https://brasilia-funnel-sandbox.herokuapp.com/version",
"https://costaline-funnel-sandbox.herokuapp.com/version",
"https://etn-funnel-sandbox.herokuapp.com/version",
"https://etn-funnel-sandbox-b.herokuapp.com/version",
"https://gfa-funnel-qa.herokuapp.com/version",
"https://gfa.reservamos-saas.com/version",
"https://rollbits-funnel-sandbox.herokuapp.com/version",
"https://smilebus-sbx.resertravel.com/version",
"https://brasilia-sbx.resertravel.com/version",
"https://costaline-sbx.resertravel.com/version",
"https://gho-sbx.resertravel.com/version",
"https://etn-sbx.resertravel.com/version",
"https://gfa-sbx.resertravel.com/version",
"https://gfa-qa.resertravel.com/version",
"https://gfa-staging.resertravel.com/version",
"https://roll-bits-sbx.resertravel.com/version",
],
},
];
Expand Down
22 changes: 16 additions & 6 deletions utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var getJSON = function (url, callback) {
/*
* Generates an html Table tag with data
*/
function loadToTable(id, tableData) {
function loadToTable({ id, tableData }) {
if (tableData.length <= 1) return;
const table = document.createElement("table");
const tableBody = document.createElement("tbody");
Expand All @@ -36,7 +36,13 @@ function loadToTable(id, tableData) {
div = cell.appendChild(document.createElement("div"));
div.className = "active";
} else {
cell.appendChild(document.createTextNode(cellData));
let el = document.createTextNode(cellData);
if (typeof cellData === "object") {
el = document.createElement("a");
el.href = cellData.repoUrl;
el.appendChild(document.createTextNode(cellData.label));
}
cell.appendChild(el);
}
row.appendChild(cell);
});
Expand All @@ -56,9 +62,13 @@ function loadToTable(id, tableData) {
/*
* This function prepares data into an array readable to convert as a Table
*/
const prepareData = (data, versions) => {
const prepareData = (data, versions, repoUrl) => {
let newData = [];
const header = ["APP", ...versions.sort()];
const formattedVersions = versions.sort().map((v) => ({
label: v,
repoUrl: `${repoUrl}/releases/tag/v${v}`,
}));
const header = ["APP", ...formattedVersions];
newData.unshift(header);

data.forEach(({ name, version }) => {
Expand All @@ -78,7 +88,7 @@ const prepareData = (data, versions) => {
};

const requestVersion = async () => {
apps.forEach(async ({ name, urls }) => {
apps.forEach(async ({ name, urls, repoUrl }) => {
let versions = [];
let data = [];

Expand All @@ -99,6 +109,6 @@ const requestVersion = async () => {
.catch((error) => console.error("Fallo", error));
})
);
loadToTable(name, prepareData(data, versions));
loadToTable({ id: name, tableData: prepareData(data, versions, repoUrl) });
});
};

0 comments on commit 814557e

Please sign in to comment.