mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) updates from grist-core
This commit is contained in:
@@ -9,8 +9,11 @@ import {icon} from 'app/client/ui2018/icons';
|
||||
import {cssModalTooltip, modalTooltip} from 'app/client/ui2018/modals';
|
||||
import {dom, DomContents, keyframes, observable, styled, svg} from 'grainjs';
|
||||
import {IPopupOptions} from 'popweasel';
|
||||
import {makeT} from 'app/client/lib/localization';
|
||||
import merge = require('lodash/merge');
|
||||
|
||||
const t = makeT('modals');
|
||||
|
||||
/**
|
||||
* This is a file for all custom and pre-configured popups, modals, toasts and tooltips, used
|
||||
* in more then one component.
|
||||
@@ -35,19 +38,21 @@ export function buildConfirmDelete(
|
||||
Escape: () => ctl.close(),
|
||||
Enter: () => { onSave(remember.get()); ctl.close(); },
|
||||
}),
|
||||
dom('div', `Are you sure you want to delete ${single ? 'this' : 'these'} record${single ? '' : 's'}?`,
|
||||
dom('div', single ?
|
||||
t(`Are you sure you want to delete this record?`)
|
||||
: t(`Are you sure you want to delete these records?`),
|
||||
dom.style('margin-bottom', '10px'),
|
||||
),
|
||||
dom('div',
|
||||
labeledSquareCheckbox(remember, "Don't ask again.", testId('confirm-remember')),
|
||||
labeledSquareCheckbox(remember, t("Don't ask again."), testId('confirm-remember')),
|
||||
dom.style('margin-bottom', '10px'),
|
||||
),
|
||||
cssButtons(
|
||||
primaryButton('Delete', testId('confirm-save'), dom.on('click', () => {
|
||||
primaryButton(t('Delete'), testId('confirm-save'), dom.on('click', () => {
|
||||
onSave(remember.get());
|
||||
ctl.close();
|
||||
})),
|
||||
basicButton('Cancel', testId('confirm-cancel'), dom.on('click', () => ctl.close()))
|
||||
basicButton(t('Cancel'), testId('confirm-cancel'), dom.on('click', () => ctl.close()))
|
||||
)
|
||||
), {}
|
||||
);
|
||||
@@ -81,9 +86,9 @@ export function showDeprecatedWarning(
|
||||
dom.style('justify-content', 'space-between'),
|
||||
dom.style('align-items', 'center'),
|
||||
dom('div',
|
||||
labeledSquareCheckbox(remember, "Don't show again.", testId('confirm-remember')),
|
||||
labeledSquareCheckbox(remember, t("Don't show again."), testId('confirm-remember')),
|
||||
),
|
||||
basicButton('Dismiss', testId('confirm-save'),
|
||||
basicButton(t('Dismiss'), testId('confirm-save'),
|
||||
dom.on('click', () => { ctl.close(); onClose(remember.get()); })
|
||||
)
|
||||
),
|
||||
@@ -105,7 +110,7 @@ export function showDeprecatedWarning(
|
||||
export function reportUndo(
|
||||
doc: GristDoc,
|
||||
messageLabel: string,
|
||||
buttonLabel = 'Undo to restore'
|
||||
buttonLabel = t('Undo to restore')
|
||||
) {
|
||||
// First create a notification with a button to undo the delete.
|
||||
let notification = reportSuccess(messageLabel, {
|
||||
@@ -179,12 +184,12 @@ export function showBehavioralPrompt(
|
||||
dom.style('align-items', 'center'),
|
||||
dom('div',
|
||||
cssSkipTipsCheckbox(dontShowTips,
|
||||
cssSkipTipsCheckboxLabel("Don't show tips"),
|
||||
cssSkipTipsCheckboxLabel(t("Don't show tips")),
|
||||
testId('behavioral-prompt-dont-show-tips')
|
||||
),
|
||||
dom.style('visibility', hideDontShowTips ? 'hidden' : ''),
|
||||
),
|
||||
cssDismissPromptButton('Got it', testId('behavioral-prompt-dismiss'),
|
||||
cssDismissPromptButton(t('Got it'), testId('behavioral-prompt-dismiss'),
|
||||
dom.on('click', () => { onClose(dontShowTips.get()); ctl.close(); })
|
||||
),
|
||||
),
|
||||
|
||||
@@ -526,11 +526,19 @@ export class Client {
|
||||
}
|
||||
}
|
||||
|
||||
private async _onMessage(message: string): Promise<void> {
|
||||
try {
|
||||
await this._onMessageImpl(message);
|
||||
} catch (err) {
|
||||
this._log.warn(null, 'onMessage error received for message "%s": %s', shortDesc(message), err.stack);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes a request from a client. All requests from a client get a response, at least to
|
||||
* indicate success or failure.
|
||||
*/
|
||||
private async _onMessage(message: string): Promise<void> {
|
||||
private async _onMessageImpl(message: string): Promise<void> {
|
||||
const request = JSON.parse(message);
|
||||
if (request.beat) {
|
||||
// this is a heart beat, to keep the websocket alive. No need to reply.
|
||||
|
||||
Reference in New Issue
Block a user