Skip to content

Commit

Permalink
Merge branch 'gristlabs:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
atropos112 authored Jul 10, 2024
2 parents c616fc7 + d336293 commit 3b4ed21
Show file tree
Hide file tree
Showing 36 changed files with 668 additions and 131 deletions.
80 changes: 64 additions & 16 deletions .github/workflows/docker_latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,36 @@ on:
- cron: '41 5 * * *'
workflow_dispatch:
inputs:
latest_branch:
branch:
description: "Branch from which to create the latest Docker image (default: latest_candidate)"
type: string
required: true
default_value: latest_candidate
default: latest_candidate
disable_tests:
description: "Should the tests be skipped?"
type: boolean
required: True
default: False
platforms:
description: "Platforms to build"
type: choice
required: True
options:
- linux/amd64
- linux/arm64/v8
- linux/amd64,linux/arm64/v8
default: linux/amd64,linux/arm64/v8
tag:
description: "Tag for the resulting images"
type: string
required: True
default: 'experimental'

env:
BRANCH: ${{ inputs.branch || 'latest_candidate' }}
PLATFORMS: ${{ inputs.platforms || 'linux/amd64,linux/arm64/v8' }}
TAG: ${{ inputs.tag || 'experimental' }}
DOCKER_HUB_OWNER: ${{ vars.DOCKER_HUB_OWNER || github.repository_owner }}

jobs:
push_to_registry:
Expand All @@ -32,21 +57,23 @@ jobs:
repo: "grist-core"
- name: "grist"
repo: "grist-ee"
# For now, we build it twice, with `grist-ee` being a
# backwards-compatible synonym for `grist`.
- name: "grist-ee"
repo: "grist-ee"
steps:
- name: Build settings
run: |
echo "Branch: $BRANCH"
echo "Platforms: $PLATFORMS"
echo "Docker Hub Owner: $DOCKER_HUB_OWNER"
echo "Tag: $TAG"
- name: Check out the repo
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
ref: ${{ inputs.latest_branch }}
ref: ${{ env.BRANCH }}

- name: Check out the ext/ directory
if: matrix.image.name != 'grist-oss'
run: buildtools/checkout-ext-directory.sh ${{ matrix.image.repo }}


- name: Set up QEMU
uses: docker/setup-qemu-action@v1

Expand All @@ -58,38 +85,44 @@ jobs:
with:
context: .
load: true
tags: ${{ github.repository_owner }}/${{ matrix.image.name }}:experimental
tags: ${{ env.DOCKER_HUB_OWNER }}/${{ matrix.image.name }}:${{ env.TAG }}
cache-from: type=gha
build-contexts: ${{ matrix.image.name != 'grist-oss' && 'ext=ext' || '' }}
build-contexts: ext=ext

- name: Use Node.js ${{ matrix.node-version }} for testing
if: ${{ !inputs.disable_tests }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Set up Python ${{ matrix.python-version }} for testing - maybe not needed
if: ${{ !inputs.disable_tests }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install Python packages
if: ${{ !inputs.disable_tests }}
run: |
pip install virtualenv
yarn run install:python
- name: Install Node.js packages
if: ${{ !inputs.disable_tests }}
run: yarn install

- name: Build Node.js code
if: ${{ !inputs.disable_tests }}
run: |
rm -rf ext
yarn run build:prod
- name: Run tests
run: TEST_IMAGE=${{ github.repository_owner }}/${{ matrix.image.name }}:experimental VERBOSE=1 DEBUG=1 MOCHA_WEBDRIVER_HEADLESS=1 yarn run test:docker
if: ${{ !inputs.disable_tests }}
run: TEST_IMAGE=${{ env.DOCKER_HUB_OWNER }}/${{ matrix.image.name }}:${{ env.TAG }} VERBOSE=1 DEBUG=1 MOCHA_WEBDRIVER_HEADLESS=1 yarn run test:docker

- name: Restore the ext/ directory
if: matrix.image.name != 'grist-oss'
if: ${{ matrix.image.name != 'grist-oss' && !inputs.disable_tests }}
run: buildtools/checkout-ext-directory.sh ${{ matrix.image.repo }}

- name: Log in to Docker Hub
Expand All @@ -102,12 +135,27 @@ jobs:
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64/v8
platforms: ${{ env.PLATFORMS }}
push: true
tags: ${{ env.DOCKER_HUB_OWNER }}/${{ matrix.image.name }}:${{ env.TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-contexts: ext=ext

- name: Push Enterprise to Docker Hub
if: ${{ matrix.image.name == 'grist' }}
uses: docker/build-push-action@v2
with:
context: .
build-args: |
BASE_IMAGE=${{ env.DOCKER_HUB_OWNER }}/${{ matrix.image.name}}
BASE_VERSION=${{ env.TAG }}
file: ext/Dockerfile
platforms: ${{ env.PLATFORMS }}
push: true
tags: ${{ github.repository_owner }}/${{ matrix.image.name }}:experimental
tags: ${{ env.DOCKER_HUB_OWNER }}/grist-ee:${{ env.TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-contexts: ${{ matrix.image.name != 'grist-oss' && 'ext=ext' || '' }}

update_latest_branch:
name: Update latest branch
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,6 @@ xunit.xml
.clipboard.lock

**/_build

# ext directory can be overwritten
ext/**
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ and Google/Microsoft sign-ins via [Dex](https://dexidp.io/).

We use [Weblate](https://hosted.weblate.org/engage/grist/) to manage translations.
Thanks to everyone who is pitching in. Thanks especially to the ANCT developers who
did the hard work of making a good chunk of the application localizable. Merci bien!
did the hard work of making a good chunk of the application localizable. Merci beaucoup !

<a href="https://hosted.weblate.org/engage/grist/">
<img src="https://hosted.weblate.org/widgets/grist/-/open-graph.png" alt="Translation status" width=480 />
Expand Down
5 changes: 2 additions & 3 deletions app/client/ui/HomeIntro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ function makeViewerTeamSiteIntro(homeModel: HomeModel) {
}

function makeTeamSiteIntro(homeModel: HomeModel) {
const sproutsProgram = cssLink({href: commonUrls.sproutsProgram, target: '_blank'}, t("Sprouts Program"));
return [
css.docListHeader(
t("Welcome to {{- orgName}}", {orgName: homeModel.app.currentOrgName}),
Expand All @@ -94,8 +93,8 @@ function makeTeamSiteIntro(homeModel: HomeModel) {
(!isFeatureEnabled('helpCenter') ? null :
cssIntroLine(
t(
'Learn more in our {{helpCenterLink}}, or find an expert via our {{sproutsProgram}}.',
{helpCenterLink: helpCenterLink(), sproutsProgram}
'Learn more in our {{helpCenterLink}}.',
{helpCenterLink: helpCenterLink()}
),
testId('welcome-text')
)
Expand Down
97 changes: 49 additions & 48 deletions app/client/widgets/FieldEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,59 +380,60 @@ export class FieldEditor extends Disposable {
if (!editor) { return false; }
// Make sure the editor is save ready
const saveIndex = this._cursor.rowIndex();
await editor.prepForSave();
if (this.isDisposed()) {
// We shouldn't normally get disposed here, but if we do, avoid confusing JS errors.
console.warn(t("Unable to finish saving edited cell")); // tslint:disable-line:no-console
return false;
}

// Then save the value the appropriate way
// TODO: this isFormula value doesn't actually reflect if editing the formula, since
// editingFormula() is used for toggling column headers, and this is deferred to start of
// typing (a double-click or Enter) does not immediately set it. (This can cause a
// console.warn below, although harmless.)
const isFormula = this._field.editingFormula();
const col = this._field.column();
let waitPromise: Promise<unknown>|null = null;

if (isFormula) {
const formula = String(editor.getCellValue() ?? '');
// Bundle multiple changes so that we can undo them in one step.
if (isFormula !== col.isFormula.peek() || formula !== col.formula.peek()) {
waitPromise = this._gristDoc.docData.bundleActions(null, () => Promise.all([
col.updateColValues({isFormula, formula}),
// If we're saving a non-empty formula, then also add an empty record to the table
// so that the formula calculation is visible to the user.
(!this._detached.get() && this._editRow._isAddRow.peek() && formula !== "" ?
this._editRow.updateColValues({}) : undefined),
]));
return await this._gristDoc.docData.bundleActions(null, async () => {
await editor.prepForSave();
if (this.isDisposed()) {
// We shouldn't normally get disposed here, but if we do, avoid confusing JS errors.
console.warn(t("Unable to finish saving edited cell")); // tslint:disable-line:no-console
return false;
}
} else {
const value = editor.getCellValue();
if (col.isRealFormula()) {
// tslint:disable-next-line:no-console
console.warn(t("It should be impossible to save a plain data value into a formula column"));
// Then save the value the appropriate way
// TODO: this isFormula value doesn't actually reflect if editing the formula, since
// editingFormula() is used for toggling column headers, and this is deferred to start of
// typing (a double-click or Enter) does not immediately set it. (This can cause a
// console.warn below, although harmless.)
const isFormula = this._field.editingFormula();
const col = this._field.column();
let waitPromise: Promise<unknown>|null = null;

if (isFormula) {
const formula = String(editor.getCellValue() ?? '');
// Bundle multiple changes so that we can undo them in one step.
if (isFormula !== col.isFormula.peek() || formula !== col.formula.peek()) {
waitPromise = Promise.all([
col.updateColValues({isFormula, formula}),
// If we're saving a non-empty formula, then also add an empty record to the table
// so that the formula calculation is visible to the user.
(!this._detached.get() && this._editRow._isAddRow.peek() && formula !== "" ?
this._editRow.updateColValues({}) : undefined),
]);
}
} else {
// This could still be an isFormula column if it's empty (isEmpty is true), but we don't
// need to toggle isFormula in that case, since the data engine takes care of that.
waitPromise = setAndSave(this._editRow, this._field, value);
const value = editor.getCellValue();
if (col.isRealFormula()) {
// tslint:disable-next-line:no-console
console.warn(t("It should be impossible to save a plain data value into a formula column"));
} else {
// This could still be an isFormula column if it's empty (isEmpty is true), but we don't
// need to toggle isFormula in that case, since the data engine takes care of that.
waitPromise = setAndSave(this._editRow, this._field, value);
}
}
}

const event: FieldEditorStateEvent = {
position : this.cellPosition(),
wasModified : this._editorHasChanged,
currentState : this._editorHolder.get()?.editorState?.get(),
type : this._field.column.peek().pureType.peek()
};
this.saveEmitter.emit(event);
const event: FieldEditorStateEvent = {
position : this.cellPosition(),
wasModified : this._editorHasChanged,
currentState : this._editorHolder.get()?.editorState?.get(),
type : this._field.column.peek().pureType.peek()
};
this.saveEmitter.emit(event);

const cursor = this._cursor;
// Deactivate the editor. We are careful to avoid using `this` afterwards.
this.dispose();
await waitPromise;
return isFormula || (saveIndex !== cursor.rowIndex());
const cursor = this._cursor;
// Deactivate the editor. We are careful to avoid using `this` afterwards.
this.dispose();
await waitPromise;
return isFormula || (saveIndex !== cursor.rowIndex());
});
}
}

Expand Down
1 change: 0 additions & 1 deletion app/common/gristUrls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ export const commonUrls = {
contactSupport: getContactSupportUrl(),
termsOfService: getTermsOfServiceUrl(),
plans: "https://www.getgrist.com/pricing",
sproutsProgram: "https://www.getgrist.com/sprouts-program",
contact: "https://www.getgrist.com/contact",
templates: 'https://www.getgrist.com/templates',
community: 'https://community.getgrist.com',
Expand Down
11 changes: 2 additions & 9 deletions app/server/lib/DocStorageManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import * as gutil from 'app/common/gutil';
import {Comm} from 'app/server/lib/Comm';
import * as docUtils from 'app/server/lib/docUtils';
import {GristServer} from 'app/server/lib/GristServer';
import {IDocStorageManager, SnapshotProgress} from 'app/server/lib/IDocStorageManager';
import {EmptySnapshotProgress, IDocStorageManager, SnapshotProgress} from 'app/server/lib/IDocStorageManager';
import {IShell} from 'app/server/lib/IShell';
import log from 'app/server/lib/log';
import uuidv4 from "uuid/v4";
Expand Down Expand Up @@ -258,14 +258,7 @@ export class DocStorageManager implements IDocStorageManager {
}

public getSnapshotProgress(): SnapshotProgress {
return {
pushes: 0,
skippedPushes: 0,
errors: 0,
changes: 0,
windowsStarted: 0,
windowsDone: 0,
};
return new EmptySnapshotProgress();
}

public async replace(docName: string, options: any): Promise<void> {
Expand Down
Loading

0 comments on commit 3b4ed21

Please sign in to comment.