(core) updates from grist-core

This commit is contained in:
Paul Fitzpatrick 2023-04-06 10:02:41 -04:00
commit 6a4b7d96e8
7 changed files with 33 additions and 14 deletions

View File

@ -1336,7 +1336,7 @@ export class GristDoc extends DisposableWithEvents {
const options = section.options(); const options = section.options();
const colIds = section.viewFields().all().map((f) => f.column().colId()); const colIds = section.viewFields().all().map((f) => f.column().colId());
const chartType = section.chartType(); const chartType = section.chartType();
const theme = section.theme(); const sectionTheme = section.theme();
// we must read the current layout from the view layout because it can override the one in // we must read the current layout from the view layout because it can override the one in
// `section.layoutSpec` (in particular it provides a default layout when missing from the // `section.layoutSpec` (in particular it provides a default layout when missing from the
@ -1370,7 +1370,7 @@ export class GristDoc extends DisposableWithEvents {
} }
// update theme, and chart type // update theme, and chart type
await newSection.theme.saveOnly(theme); await newSection.theme.saveOnly(sectionTheme);
await newSection.chartType.saveOnly(chartType); await newSection.chartType.saveOnly(chartType);
// The newly-added section should be given focus. // The newly-added section should be given focus.

View File

@ -53,6 +53,8 @@ const log: LogWithTimestamp = Object.assign(rawLog, {
rawWarn: (msg: string, meta: ILogMeta) => origLog.call(log, 'warn', msg, meta), rawWarn: (msg: string, meta: ILogMeta) => origLog.call(log, 'warn', msg, meta),
rawDebug: (msg: string, meta: ILogMeta) => origLog.call(log, 'debug', msg, meta), rawDebug: (msg: string, meta: ILogMeta) => origLog.call(log, 'debug', msg, meta),
origLog, origLog,
add: rawLog.add.bind(rawLog), // Explicitly pass add method along - otherwise
// there's an odd glitch under Electron.
}); });
/** /**

View File

@ -136,12 +136,16 @@ export function getDatabaseUrl(options: ConnectionOptions, includeCredentials: b
*/ */
export async function checkAllegedGristDoc(docSession: OptDocSession, fname: string) { export async function checkAllegedGristDoc(docSession: OptDocSession, fname: string) {
const db = await SQLiteDB.openDBRaw(fname, OpenMode.OPEN_READONLY); const db = await SQLiteDB.openDBRaw(fname, OpenMode.OPEN_READONLY);
const integrityCheckResults = await db.all('PRAGMA integrity_check'); try {
if (integrityCheckResults.length !== 1 || integrityCheckResults[0].integrity_check !== 'ok') { const integrityCheckResults = await db.all('PRAGMA integrity_check');
const uuid = uuidv4(); if (integrityCheckResults.length !== 1 || integrityCheckResults[0].integrity_check !== 'ok') {
log.info('Integrity check failure on import', {uuid, integrityCheckResults, const uuid = uuidv4();
...getLogMetaFromDocSession(docSession)}); log.info('Integrity check failure on import', {uuid, integrityCheckResults,
throw new Error(`Document failed integrity checks - is it corrupted? Event ID: ${uuid}`); ...getLogMetaFromDocSession(docSession)});
throw new Error(`Document failed integrity checks - is it corrupted? Event ID: ${uuid}`);
}
} finally {
await db.close();
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "grist-core", "name": "grist-core",
"version": "1.0.8", "version": "1.0.9",
"license": "Apache-2.0", "license": "Apache-2.0",
"description": "Grist is the evolution of spreadsheets", "description": "Grist is the evolution of spreadsheets",
"homepage": "https://github.com/gristlabs/grist-core", "homepage": "https://github.com/gristlabs/grist-core",

View File

@ -407,7 +407,9 @@
"Welcome to {{orgName}}": "Welcome to {{orgName}}", "Welcome to {{orgName}}": "Welcome to {{orgName}}",
"You have read-only access to this site. Currently there are no documents.": "You have read-only access to this site. Currently there are no documents.", "You have read-only access to this site. Currently there are no documents.": "You have read-only access to this site. Currently there are no documents.",
"personal site": "personal site", "personal site": "personal site",
"{{signUp}} to save your work. ": "{{signUp}} to save your work. " "{{signUp}} to save your work. ": "{{signUp}} to save your work. ",
"Welcome to Grist, {{- name}}!": "Welcome to Grist, {{- name}}!",
"Welcome to {{- orgName}}": "Welcome to {{- orgName}}"
}, },
"HomeLeftPane": { "HomeLeftPane": {
"Access Details": "Access Details", "Access Details": "Access Details",
@ -422,7 +424,8 @@
"Rename": "Rename", "Rename": "Rename",
"Trash": "Trash", "Trash": "Trash",
"Workspace will be moved to Trash.": "Workspace will be moved to Trash.", "Workspace will be moved to Trash.": "Workspace will be moved to Trash.",
"Workspaces": "Workspaces" "Workspaces": "Workspaces",
"Tutorial": "Tutorial"
}, },
"Importer": { "Importer": {
"Merge rows that match these fields:": "Merge rows that match these fields:", "Merge rows that match these fields:": "Merge rows that match these fields:",
@ -961,7 +964,8 @@
"Access Rules": "Access Rules", "Access Rules": "Access Rules",
"Access rules give you the power to create nuanced rules to determine who can see or edit which parts of your document.": "Access rules give you the power to create nuanced rules to determine who can see or edit which parts of your document.", "Access rules give you the power to create nuanced rules to determine who can see or edit which parts of your document.": "Access rules give you the power to create nuanced rules to determine who can see or edit which parts of your document.",
"Add New": "Add New", "Add New": "Add New",
"Use the 𝚺 icon to create summary (or pivot) tables, for totals or subtotals.": "Use the 𝚺 icon to create summary (or pivot) tables, for totals or subtotals." "Use the 𝚺 icon to create summary (or pivot) tables, for totals or subtotals.": "Use the 𝚺 icon to create summary (or pivot) tables, for totals or subtotals.",
"Anchor Links": "Anchor Links"
}, },
"DescriptionConfig": { "DescriptionConfig": {
"DESCRIPTION": "DESCRIPTION" "DESCRIPTION": "DESCRIPTION"

View File

@ -767,7 +767,7 @@
"TypeTransform": { "TypeTransform": {
"Cancel": "Anuluj", "Cancel": "Anuluj",
"Preview": "Podgląd", "Preview": "Podgląd",
"Revise": "Zrewidować", "Revise": "Popraw",
"Apply": "Zastosuj", "Apply": "Zastosuj",
"Update formula (Shift+Enter)": "Aktualizuj formułę (Shift+Enter)" "Update formula (Shift+Enter)": "Aktualizuj formułę (Shift+Enter)"
}, },

View File

@ -41,14 +41,23 @@ describe("Localization", function() {
const namespaces: Set<string> = new Set(); const namespaces: Set<string> = new Set();
for (const file of fs.readdirSync(localeDirectory)) { for (const file of fs.readdirSync(localeDirectory)) {
if (file.endsWith(".json")) { if (file.endsWith(".json")) {
const lang = file.split('.')[0]?.replace(/_/g, '-'); const langRaw = file.split('.')[0];
const lang = langRaw?.replace(/_/g, '-');
const ns = file.split('.')[1]; const ns = file.split('.')[1];
const clientFile = path.join(localeDirectory,
`${langRaw}.client.json`);
const clientText = fs.readFileSync(clientFile, { encoding: 'utf8' });
if (!clientText.includes('Translators: please translate this only when')) {
// Translation not ready if this key is not present.
continue;
}
langs.add(lang); langs.add(lang);
namespaces.add(ns); namespaces.add(ns);
} }
} }
assert.deepEqual(gristConfig.supportedLngs.sort(), [...langs].sort()); assert.deepEqual(gristConfig.supportedLngs.sort(), [...langs].sort());
assert.deepEqual(gristConfig.namespaces.sort(), [...namespaces].sort()); assert.deepEqual(gristConfig.namespaces.sort(), [...namespaces].sort());
assert.isAbove(gristConfig.supportedLngs.length, 9);
}); });
// Now make a uz-UZ language file, and test that it is used. // Now make a uz-UZ language file, and test that it is used.