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

CLDR-17662 update Vetting Participation spreadsheet #3762

Merged
merged 11 commits into from
May 30, 2024
5 changes: 4 additions & 1 deletion tools/cldr-apps/js/src/esm/cldrAccount.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import * as cldrAjax from "./cldrAjax.mjs";
import * as cldrDom from "./cldrDom.mjs";
import * as cldrLoad from "./cldrLoad.mjs";
import * as cldrNotify from "./cldrNotify.mjs";
import * as cldrOrganizations from "./cldrOrganizations.mjs";
import * as cldrStatus from "./cldrStatus.mjs";
import * as cldrSurvey from "./cldrSurvey.mjs";
Expand Down Expand Up @@ -194,7 +195,9 @@ function listSingleUser(email) {
}

function reallyLoad() {
getOrgsAndLevels().then(reallyReallyLoad);
getOrgsAndLevels()
.catch((e) => cldrNotify.exception(e, `loading Account Settings page`))
.then(reallyReallyLoad);
}

async function getOrgsAndLevels() {
Expand Down
6 changes: 5 additions & 1 deletion tools/cldr-apps/js/src/esm/cldrLoad.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,11 @@ function shower(itemLoadInfo) {
cldrSurvey.showLoader(cldrText.get("loading"));
const curSpecial = cldrStatus.getCurrentSpecial();
cldrGui.setToptitleVisibility(curSpecial !== "menu");
specialLoad(itemLoadInfo, curSpecial, theDiv);
try {
specialLoad(itemLoadInfo, curSpecial, theDiv);
} catch (e) {
cldrNotify.exception(e, `Showing SurveyTool page ${curSpecial || ""}`);
}
}

function specialLoad(itemLoadInfo, curSpecial, theDiv) {
Expand Down
40 changes: 29 additions & 11 deletions tools/cldr-apps/js/src/esm/cldrOrganizations.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* cldrOrganizations: handle Organization names
*/
import * as cldrAjax from "./cldrAjax.mjs";
import * as cldrClient from "./cldrClient.mjs";

let orgs = null;

Expand All @@ -15,7 +16,7 @@ let orgs = null;
* shortToDisplay - the map from short names to display names
* sortedDisplayNames - the sorted array of display names
*/
async function get() {
export async function get() {
if (orgs) {
return orgs;
}
Expand All @@ -24,11 +25,11 @@ async function get() {
.doFetch(url)
.then(cldrAjax.handleFetchErrors)
.then((r) => r.json())
.then(loadOrgs)
.catch((e) => console.error(`Error: ${e} ...`));
.then(loadOrgs);
}

function loadOrgs(json) {
/** accessible for unit testing only, to set mock data */
export function loadOrgs(json) {
if (!json.map) {
console.error("Organization list not received from server");
return null;
Expand All @@ -45,10 +46,27 @@ function loadOrgs(json) {
return orgs;
}

export {
get,
/*
* The following is meant to be accessible for unit testing only, to set mock data:
*/
loadOrgs,
};
let orgCoverage = null;

/** @internal load the orgCoverage data */
async function loadOrgCoverage() {
if (!orgCoverage) {
const client = await cldrClient.getClient();
orgCoverage = (await client.apis.organizations.getOrgCoverage()).body;
}
return orgCoverage;
}

/**
* @returns {Promise<map<string,map<string,number>>} map from each organization to a map of locale to level
*/
export async function getOrgCoverage() {
const { organization_locale_level } = await loadOrgCoverage();
return organization_locale_level;
}

/** @returns {Promise<string[]>} flat list of organizations */
export async function getTcOrgs() {
const { tc_orgs } = await loadOrgCoverage();
return tc_orgs;
}
Loading
Loading