Skip to content

Commit

Permalink
(core) updates from grist-core
Browse files Browse the repository at this point in the history
  • Loading branch information
paulfitz committed Sep 18, 2023
2 parents d13a75a + 2df1b2d commit ffbf93b
Show file tree
Hide file tree
Showing 12 changed files with 751 additions and 85 deletions.
10 changes: 10 additions & 0 deletions app/client/ui/RightPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,11 @@ export class RightPanel extends Disposable {
const srcSec = use(tgtSec.linkSrcSection); //might be the empty section
const srcCol = use(tgtSec.linkSrcCol);
const srcColId = use(use(tgtSec.linkSrcCol).colId); // if srcCol is the empty col, colId will be undefined

if (srcSec.isDisposed()) { // can happen when deleting srcSection with rightpanel open
return cssLinkInfoPanel("");
}

//const tgtColId = use(use(tgtSec.linkTargetCol).colId);
const srcTable = use(srcSec.table);
const tgtTable = use(tgtSec.table);
Expand Down Expand Up @@ -616,6 +621,11 @@ export class RightPanel extends Disposable {
// but the fact that it's all observables makes that trickier to do correctly, so let's leave it here
const srcSec = use(activeSection.linkSrcSection); //might be the empty section
const tgtSec = activeSection;

if (srcSec.isDisposed()) { // can happen when deleting srcSection with rightpanel open
return cssRow("");
}

const srcCol = use(activeSection.linkSrcCol); // might be the empty column
const tgtCol = use(activeSection.linkTargetCol);
// columns might be the empty column
Expand Down
12 changes: 12 additions & 0 deletions app/common/Telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,11 @@ export function buildTelemetryEventChecker(telemetryLevel: TelemetryLevel) {
`but received a value of type ${typeof value}`
);
}
if (typeof value === 'string' && !hasTimezone(value)) {
throw new Error(
`Telemetry metadata ${key} of event ${event} has an ambiguous date string`
);
}
} else if (dataType !== typeof value) {
throw new Error(
`Telemetry metadata ${key} of event ${event} expected a value of type ${dataType} ` +
Expand All @@ -1056,4 +1061,11 @@ export function buildTelemetryEventChecker(telemetryLevel: TelemetryLevel) {
};
}

// Check that datetime looks like it has a timezone in it. If not,
// that could be a problem for whatever ingests the data.
function hasTimezone(isoDateString: string) {
// Use a regular expression to check for a timezone offset or 'Z'
return /([+-]\d{2}:\d{2}|Z)$/.test(isoDateString);
}

export type TelemetryEventChecker = (event: TelemetryEvent, metadata?: TelemetryMetadata) => void;
31 changes: 29 additions & 2 deletions app/gen-server/lib/Housekeeper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import log from 'app/server/lib/log';
import { IPermitStore } from 'app/server/lib/Permit';
import { optStringParam, stringParam } from 'app/server/lib/requestUtils';
import * as express from 'express';
import moment from 'moment';
import fetch from 'node-fetch';
import * as Fetch from 'node-fetch';
import { EntityManager } from 'typeorm';
Expand Down Expand Up @@ -185,8 +186,8 @@ export class Housekeeper {
numDocs: Number(summary.num_docs),
numWorkspaces: Number(summary.num_workspaces),
numMembers: Number(summary.num_members),
lastActivity: summary.last_activity,
earliestDocCreatedAt: summary.earliest_doc_created_at,
lastActivity: normalizedDateTimeString(summary.last_activity),
earliestDocCreatedAt: normalizedDateTimeString(summary.earliest_doc_created_at),
},
full: {
stripePlanId: summary.stripe_plan_id,
Expand Down Expand Up @@ -398,3 +399,29 @@ export class Housekeeper {
});
}
}

/**
* Output an ISO8601 format datetime string, with timezone.
* Any string fed in without timezone is expected to be in UTC.
*
* When connected to postgres, dates will be extracted as Date objects,
* with timezone information. The normalization done here is not
* really needed in this case.
*
* Timestamps in SQLite are stored as UTC, and read as strings
* (without timezone information). The normalization here is
* pretty important in this case.
*/
function normalizedDateTimeString(dateTime: any): string {
if (!dateTime) { return dateTime; }
if (dateTime instanceof Date) {
return moment(dateTime).toISOString();
}
if (typeof dateTime === 'string') {
// When SQLite returns a string, it will be in UTC.
// Need to make sure it actually have timezone info in it
// (will not by default).
return moment.utc(dateTime).toISOString();
}
throw new Error(`normalizedDateTimeString cannot handle ${dateTime}`);
}
13 changes: 11 additions & 2 deletions static/locales/de.client.json
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,10 @@
"personal site": "persönliche Seite",
"{{signUp}} to save your work. ": "{{signUp}} um Ihre Arbeit zu speichern. ",
"Welcome to Grist, {{- name}}!": "Willkommen bei Grist, {{-name}}!",
"Welcome to {{- orgName}}": "Willkommen bei {{-orgName}}"
"Welcome to {{- orgName}}": "Willkommen bei {{-orgName}}",
"Visit our {{link}} to learn more about Grist.": "Besuchen Sie unsere {{link}}, um mehr über Grist zu erfahren.",
"Sign in": "Anmelden",
"To use Grist, please either sign up or sign in.": "Um Grist zu nutzen, melden Sie sich bitte an oder registrieren Sie sich."
},
"HomeLeftPane": {
"Access Details": "Zugangsdetails",
Expand Down Expand Up @@ -1146,7 +1149,13 @@
"Sign up for a free Grist account to start using the Formula AI Assistant.": "Melden Sie sich für ein kostenloses Grist-Konto an, um den KI Formel Assistenten zu verwenden.",
"There are some things you should know when working with me:": "Es gibt einige Dinge, die Sie wissen sollten, wenn Sie mit mir arbeiten:",
"What do you need help with?": "Womit brauchen Sie Hilfe?",
"Formula AI Assistant is only available for logged in users.": "Der Formel-KI-Assistent ist nur für eingeloggte Benutzer verfügbar."
"Formula AI Assistant is only available for logged in users.": "Der Formel-KI-Assistent ist nur für eingeloggte Benutzer verfügbar.",
"For higher limits, contact the site owner.": "Für höhere Grenzwerte wenden Sie sich bitte an den Eigentümer der Website.",
"upgrade to the Pro Team plan": "Upgrade auf den Pro Team Plan",
"You have used all available credits.": "Sie haben alle verfügbaren Kredite aufgebraucht.",
"upgrade your plan": "aktualisieren Sie Ihren Plan",
"You have {{numCredits}} remaining credits.": "Sie haben {{numCredits}} verbleibende Credits.",
"For higher limits, {{upgradeNudge}}.": "Für höhere Grenzwerte: {{upgradeNudge}}."
},
"GridView": {
"Click to insert": "Zum Einfügen klicken"
Expand Down
13 changes: 11 additions & 2 deletions static/locales/es.client.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,10 @@
"personal site": "sitio personal",
"{{signUp}} to save your work. ": "{{signUp}} para guardar tu trabajo. ",
"Welcome to Grist, {{- name}}!": "¡Bienvenido a Grist, {{- name}}!",
"Welcome to {{- orgName}}": "Bienvenido a {{- orgName}}"
"Welcome to {{- orgName}}": "Bienvenido a {{- orgName}}",
"Visit our {{link}} to learn more about Grist.": "Visita nuestra {{link}} para obtener más información sobre Grist.",
"Sign in": "Iniciar sesión",
"To use Grist, please either sign up or sign in.": "Para utilizar Grist, regístrate o inicia sesión."
},
"HomeLeftPane": {
"Access Details": "Detalles de Acceso",
Expand Down Expand Up @@ -1136,7 +1139,13 @@
"I can only help with formulas. I cannot build tables, columns, and views, or write access rules.": "Sólo puedo ayudar con fórmulas. No puedo construir tablas, columnas y vistas, ni escribir reglas de acceso.",
"Sign Up for Free": "Regístrate gratis",
"There are some things you should know when working with me:": "Hay algunas cosas que debes saber cuando trabajes conmigo:",
"Formula AI Assistant is only available for logged in users.": "Asistente de Fórmula de IA sólo está disponible para usuarios registrados."
"Formula AI Assistant is only available for logged in users.": "Asistente de Fórmula de IA sólo está disponible para usuarios registrados.",
"For higher limits, contact the site owner.": "Para límites superiores, ponte en contacto con el propietario del sitio.",
"upgrade to the Pro Team plan": "actualiza al plan Pro de Team",
"You have used all available credits.": "Has utilizado todos los créditos disponibles.",
"upgrade your plan": "amplía tu plan",
"You have {{numCredits}} remaining credits.": "Te quedan {{numCredits}} créditos.",
"For higher limits, {{upgradeNudge}}.": "Para límites superiores, {{upgradeNudge}}."
},
"GridView": {
"Click to insert": "Haga clic para insertar"
Expand Down
43 changes: 35 additions & 8 deletions static/locales/fr.client.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"Add Account": "Ajouter un compte",
"Sign Out": "Se déconnecter",
"Upgrade Plan": "Version Premium",
"Support Grist": "Centre d'aide",
"Support Grist": "Centre d'aide Grist",
"Billing Account": "Facturation",
"Activation": "Activer",
"Sign In": "Se connecter",
Expand Down Expand Up @@ -423,7 +423,10 @@
"Visit our {{link}} to learn more.": "Consulter le {{link}} pour en savoir plus.",
"{{signUp}} to save your work. ": "{{signUp}} pour enregistrer votre travail. ",
"Welcome to Grist, {{- name}}!": "Bienvenue sur Grist, {{- name}} !",
"Welcome to {{- orgName}}": "Bienvenue sur {{- orgName}}"
"Welcome to {{- orgName}}": "Bienvenue sur {{- orgName}}",
"Visit our {{link}} to learn more about Grist.": "Visitez notre {{link}} pour en savoir plus sur Grist.",
"Sign in": "Connexion",
"To use Grist, please either sign up or sign in.": "Pour utiliser Grist, connectez-vous ou créez-vous un compte."
},
"HomeLeftPane": {
"All Documents": "Tous les documents",
Expand All @@ -448,7 +451,18 @@
"{{count}} unmatched field in import_one": "{{count}} champ non apparié dans l'importation",
"{{count}} unmatched field in import_other": "{{count}} champs non appariés dans l'importation",
"{{count}} unmatched field_one": "{{count}} champ non apparié",
"{{count}} unmatched field_other": "{{count}} champs non appariés"
"{{count}} unmatched field_other": "{{count}} champs non appariés",
"Column mapping": "Cartographie de colonne",
"Grist column": "Colonne Grist",
"Revert": "Annuler",
"Skip Import": "Ignorer l'import",
"New Table": "Nouvelle table",
"Skip": "Passer",
"Column Mapping": "Cartographie de Colonne",
"Destination table": "Table de destination",
"Skip Table on Import": "Ignorer la table à l'import",
"Import from file": "Importer depuis un fichier",
"Source column": "Colonne source"
},
"LeftPanelCommon": {
"Help Center": "Centre d'aide"
Expand Down Expand Up @@ -476,7 +490,10 @@
"Organization": "Organisation",
"You do not have write access to this site": "Vous n’avez pas d'accès en écriture à cet espace",
"Workspace": "Dossier",
"You do not have write access to the selected workspace": "Vous n’avez pas accès en écriture à ce dossier"
"You do not have write access to the selected workspace": "Vous n’avez pas accès en écriture à ce dossier",
"Remove all data but keep the structure to use as a template": "Supprimer toutes les données mais garder la structure comme modèle",
"Remove document history (can significantly reduce file size)": "Supprimer l'historique du document (peut réduire sensiblement la taille du fichier)",
"Download full document and history": "Télécharger le document complet et l'historique"
},
"NotifyUI": {
"Upgrade Plan": "Améliorer votre abonnement",
Expand Down Expand Up @@ -598,7 +615,8 @@
"Export CSV": "Exporter en CSV",
"Export XLSX": "Exporter en XLSX",
"Send to Google Drive": "Envoyer vers Google Drive",
"Share": "Partager"
"Share": "Partager",
"Download...": "Télécharger..."
},
"SiteSwitcher": {
"Switch Sites": "Changer d’espace",
Expand Down Expand Up @@ -832,7 +850,8 @@
"Default cell style": "Style par défaut",
"Mixed style": "Style composite",
"Header Style": "Style de l'entête",
"Default header style": "Style par défaut"
"Default header style": "Style par défaut",
"HEADER STYLE": "STYLE DE l'EN-TÊTE"
},
"DiscussionEditor": {
"Comment": "Commentaire",
Expand Down Expand Up @@ -1067,7 +1086,14 @@
"Capabilities": "Capacités",
"Community": "Communauté",
"Formula Help. ": "Aide pour les formules. ",
"What do you need help with?": "Quel est votre besoin d'aide ?"
"What do you need help with?": "Quel est votre besoin d'aide ?",
"For higher limits, contact the site owner.": "Pour un plafond supérieur, contactez le propriétaire du site.",
"Formula AI Assistant is only available for logged in users.": "L'Assistant de Formule IA n'est disponible que pour les utilisateurs connectés.",
"upgrade to the Pro Team plan": "passer au plan Pro Team",
"You have used all available credits.": "Vous avez utiliser tout vos crédits disponibles.",
"upgrade your plan": "mettez à niveau",
"You have {{numCredits}} remaining credits.": "Vous avez {{numCredits}} crédits restants.",
"For higher limits, {{upgradeNudge}}.": "Pour augmenter le plafond, {{upgradeNudge}}."
},
"SupportGristNudge": {
"Help Center": "Centre d'aide",
Expand Down Expand Up @@ -1140,7 +1166,8 @@
"No default access allows access to be granted to individual documents or workspaces, rather than the full team site.": "L'absence d'accès par défaut permet d'accorder l'accès à des documents ou à des espaces de travail spécifiques, plutôt qu'à l'ensemble de l'espace d'équipe.",
"Once you have removed your own access, you will not be able to get it back without assistance from someone else with sufficient access to the {{resourceType}}.": "Une fois que vous avez supprimé votre propre accès, vous ne pourrez pas le récupérer sans l'aide d'une autre personne disposant d'un accès suffisant au {{resourceType}}.",
"User has view access to {{resource}} resulting from manually-set access to resources inside. If removed here, this user will lose access to resources inside.": "L'utilisateur a un accès visuel à {{resource}} résultant d'un accès manuel aux ressources internes. S'il est supprimé ici, cet utilisateur perdra l'accès aux ressources internes.",
"You are about to remove your own access to this {{resourceType}}": "Vous êtes sur le point de supprimer votre propre accès à {{resourceType}}"
"You are about to remove your own access to this {{resourceType}}": "Vous êtes sur le point de supprimer votre propre accès à {{resourceType}}",
"User inherits permissions from {{parent})}. To remove, set 'Inherit access' option to 'None'.": "L'utilisateur hérite ses permissions de {{parent})}. Pour supprimer cela, paramétrez 'Héritage d'accès à 'Aucun'."
},
"SearchModel": {
"Search all tables": "Rechercher toutes les tables",
Expand Down
21 changes: 17 additions & 4 deletions static/locales/it.client.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
"You have read-only access to this site. Currently there are no documents.": "Hai accesso a questo sito in sola lettura. Attualmente non ci sono documenti.",
"{{signUp}} to save your work. ": "{{signUp}} per salvare il tuo lavoro. ",
"Welcome to Grist, {{- name}}!": "Benvenuto in Grist, {{- name}}!",
"Welcome to {{- orgName}}": "Benvenuto, {{- orgName}}"
"Welcome to {{- orgName}}": "Benvenuto, {{- orgName}}",
"Visit our {{link}} to learn more about Grist.": "Vai a {{link}} per saperne di più su Grist.",
"Sign in": "Accedi",
"To use Grist, please either sign up or sign in.": "Per usare Grist, iscriviti o accedi."
},
"HomeLeftPane": {
"Manage Users": "Gestisci gli utenti",
Expand Down Expand Up @@ -62,7 +65,10 @@
"Update Original": "Aggiorna l'originale",
"Workspace": "Spazio di lavoro",
"You do not have write access to the selected workspace": "Non hai accesso in scrittura allo spazio di lavoro selezionato",
"You do not have write access to this site": "Non hai accesso in scrittura a questo sito"
"You do not have write access to this site": "Non hai accesso in scrittura a questo sito",
"Remove all data but keep the structure to use as a template": "Rimuovi tutti i dati, mantieni la struttura per usarla come template",
"Remove document history (can significantly reduce file size)": "Rimuovi la storia del documento (può ridurre molto le dimensioni del file)",
"Download full document and history": "Scarica tutto il documento e la storia"
},
"Importer": {
"Update existing records": "Aggiorna i record esistenti",
Expand Down Expand Up @@ -815,7 +821,8 @@
"Show in folder": "Mostra nella cartella",
"Unsaved": "Non salvato",
"Work on a Copy": "Lavora su una copia",
"Share": "Condividi"
"Share": "Condividi",
"Download...": "Scarica..."
},
"SiteSwitcher": {
"Create new team site": "Crea un nuovo sito per il team",
Expand Down Expand Up @@ -1078,7 +1085,13 @@
"There are some things you should know when working with me:": "Ecco alcune cose da sapere quando lavori con me:",
"What do you need help with?": "In che cosa posso aiutarti?",
"Sign up for a free Grist account to start using the Formula AI Assistant.": "Iscriviti a un account gratuito di Grist per usare l'Assistente IA per le formule.",
"Formula AI Assistant is only available for logged in users.": "L'assistente IA per le formule è disponibile solo dopo aver effettuato l'accesso."
"Formula AI Assistant is only available for logged in users.": "L'assistente IA per le formule è disponibile solo dopo aver effettuato l'accesso.",
"For higher limits, contact the site owner.": "Per limiti più alti, contatta il proprietario del sito.",
"upgrade to the Pro Team plan": "aggiorna al piano Pro Team",
"You have used all available credits.": "Hai usato tutti i crediti disponibili.",
"upgrade your plan": "aggiorna il tuo piano",
"You have {{numCredits}} remaining credits.": "Hai {{numCredits}} crediti rimanenti.",
"For higher limits, {{upgradeNudge}}.": "Per limiti più alti, {{upgradeNudge}}."
},
"GridView": {
"Click to insert": "Clicca per inserire"
Expand Down
13 changes: 11 additions & 2 deletions static/locales/pt_BR.client.json
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,10 @@
"personal site": "Site pessoal",
"{{signUp}} to save your work. ": "{{signUp}} para salvar seu trabalho. ",
"Welcome to Grist, {{- name}}!": "Bem-vindo ao Grist, {{-name}}!",
"Welcome to {{- orgName}}": "Bem-vindo a {{-orgName}}"
"Welcome to {{- orgName}}": "Bem-vindo a {{-orgName}}",
"Visit our {{link}} to learn more about Grist.": "Visite nosso site {{link}} para saber mais sobre o Grist.",
"Sign in": "Entrar",
"To use Grist, please either sign up or sign in.": "Para usar o Grist, inscreva-se ou faça login."
},
"HomeLeftPane": {
"Access Details": "Detalhes de Acesso",
Expand Down Expand Up @@ -1146,7 +1149,13 @@
"What do you need help with?": "Em que você precisa de ajuda?",
"There are some things you should know when working with me:": "Há algumas coisas que você deve saber ao trabalhar comigo:",
"Learn more": "Saiba mais",
"Formula AI Assistant is only available for logged in users.": "O Assistente de Fórmula de IA só está disponível para usuários registrados."
"Formula AI Assistant is only available for logged in users.": "O Assistente de Fórmula de IA só está disponível para usuários registrados.",
"For higher limits, contact the site owner.": "Para limites maiores, entre em contato com o proprietário do site.",
"upgrade to the Pro Team plan": "atualize para o plano Pro Team",
"You have used all available credits.": "Você utilizou todos os créditos disponíveis.",
"upgrade your plan": "Atualize seu plano",
"You have {{numCredits}} remaining credits.": "Você tem {{numCredits}} créditos restantes.",
"For higher limits, {{upgradeNudge}}.": "Para limites maiores, {{upgradeNudge}}."
},
"GridView": {
"Click to insert": "Clique para inserir"
Expand Down
Loading

0 comments on commit ffbf93b

Please sign in to comment.