(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 colIds = section.viewFields().all().map((f) => f.column().colId());
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
// `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
await newSection.theme.saveOnly(theme);
await newSection.theme.saveOnly(sectionTheme);
await newSection.chartType.saveOnly(chartType);
// 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),
rawDebug: (msg: string, meta: ILogMeta) => origLog.call(log, 'debug', msg, meta),
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) {
const db = await SQLiteDB.openDBRaw(fname, OpenMode.OPEN_READONLY);
const integrityCheckResults = await db.all('PRAGMA integrity_check');
if (integrityCheckResults.length !== 1 || integrityCheckResults[0].integrity_check !== 'ok') {
const uuid = uuidv4();
log.info('Integrity check failure on import', {uuid, integrityCheckResults,
...getLogMetaFromDocSession(docSession)});
throw new Error(`Document failed integrity checks - is it corrupted? Event ID: ${uuid}`);
try {
const integrityCheckResults = await db.all('PRAGMA integrity_check');
if (integrityCheckResults.length !== 1 || integrityCheckResults[0].integrity_check !== 'ok') {
const uuid = uuidv4();
log.info('Integrity check failure on import', {uuid, integrityCheckResults,
...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",
"version": "1.0.8",
"version": "1.0.9",
"license": "Apache-2.0",
"description": "Grist is the evolution of spreadsheets",
"homepage": "https://github.com/gristlabs/grist-core",

View File

@ -407,7 +407,9 @@
"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.",
"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": {
"Access Details": "Access Details",
@ -422,7 +424,8 @@
"Rename": "Rename",
"Trash": "Trash",
"Workspace will be moved to Trash.": "Workspace will be moved to Trash.",
"Workspaces": "Workspaces"
"Workspaces": "Workspaces",
"Tutorial": "Tutorial"
},
"Importer": {
"Merge rows that match these fields:": "Merge rows that match these fields:",
@ -961,7 +964,8 @@
"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.",
"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": {
"DESCRIPTION": "DESCRIPTION"

View File

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

View File

@ -41,14 +41,23 @@ describe("Localization", function() {
const namespaces: Set<string> = new Set();
for (const file of fs.readdirSync(localeDirectory)) {
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 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);
namespaces.add(ns);
}
}
assert.deepEqual(gristConfig.supportedLngs.sort(), [...langs].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.