Skip to content

Commit

Permalink
updated at 2024-09-03T10:01:40-04:00
Browse files Browse the repository at this point in the history
  • Loading branch information
paulfitz committed Sep 3, 2024
1 parent 3f3e592 commit c00e279
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion core
Submodule core updated 52 files
+1 −1 CONTRIBUTING.md
+2 −0 README.md
+9 −8 app/client/components/DocumentUsage.ts
+3 −1 app/client/components/FormRenderer.ts
+1 −1 app/client/components/Forms/styles.ts
+1 −1 app/client/lib/markdown.ts
+5 −5 app/client/ui/DocTutorial.ts
+2 −2 app/client/ui/DocTutorialRenderer.ts
+12 −0 app/client/ui/MarkdownCellRenderer.ts
+5 −3 app/client/ui/PageWidgetPicker.ts
+23 −13 app/client/ui/sanitizeHTML.ts
+2 −0 app/client/ui2018/IconList.ts
+7 −0 app/client/ui2018/cssVars.ts
+22 −11 app/client/ui2018/icons.ts
+19 −16 app/client/ui2018/links.ts
+20 −11 app/client/widgets/FormulaAssistant.ts
+3 −3 app/client/widgets/HyperLinkTextBox.ts
+176 −0 app/client/widgets/MarkdownTextBox.ts
+9 −3 app/client/widgets/NTextBox.ts
+9 −0 app/client/widgets/UserType.ts
+2 −0 app/client/widgets/UserTypeImpl.ts
+12 −9 app/common/DocLimits.ts
+6 −2 app/common/DocUsage.ts
+3 −0 app/common/ThemePrefs-ti.ts
+5 −0 app/common/ThemePrefs.ts
+5 −0 app/common/themes/GristDark.ts
+5 −0 app/common/themes/GristLight.ts
+2 −2 app/gen-server/lib/homedb/HomeDBManager.ts
+36 −13 app/server/lib/ActiveDoc.ts
+39 −3 app/server/lib/FlexServer.ts
+1 −1 app/server/lib/GranularAccess.ts
+1 −0 app/server/lib/ISandbox.ts
+4 −0 app/server/lib/NSandbox.ts
+2 −0 app/server/lib/NullSandbox.ts
+1 −1 buildtools/.grist-ee-version
+8 −1 docker-compose-examples/grist-local-testing/README.md
+1 −1 docker-compose-examples/grist-local-testing/docker-compose.yml
+0 −0 docker-compose-examples/grist-local-testing/persist/.gitkeep
+3 −2 package.json
+0 −56 sandbox/grist/test_useractions.py
+6 −54 sandbox/grist/useractions.py
+1 −0 static/icons/icons.css
+19 −1 static/locales/ca.client.json
+1 −1 static/locales/eu.client.json
+1 −1 static/locales/fr.client.json
+16 −1 static/locales/sk.client.json
+1 −0 static/ui-icons/Fields/FieldMarkdown.svg
+0 −1 stubs/app/server/server.ts
+2 −0 test/gen-server/ApiServer.ts
+3 −6 test/nbrowser/CellColor.ts
+4 −1 test/test_under_docker.sh
+34 −9 yarn.lock
18 changes: 10 additions & 8 deletions ext/app/client/components/DocUsageBanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {sessionStorageBoolObs} from 'app/client/lib/localStorageObs';
import {DocPageModel} from 'app/client/models/DocPageModel';
import {isFreePlan} from 'app/common/Features';
import {canUpgradeOrg} from 'app/common/roles';
import {DataLimitInfo} from 'app/common/DocUsage';
import {Computed, Disposable, dom, DomComputed, makeTestId, Observable} from 'grainjs';

const testId = makeTestId('test-doc-usage-banner-');
Expand All @@ -13,8 +14,8 @@ export class DocUsageBanner extends Disposable {
private readonly _currentDocUsage = this._docPageModel.currentDocUsage;
private readonly _currentOrg = this._docPageModel.currentOrg;

private readonly _dataLimitStatus = Computed.create(this, this._currentDocUsage, (_use, usage) => {
return usage?.dataLimitStatus ?? null;
private readonly _dataLimitInfo = Computed.create(this, this._currentDocUsage, (_use, usage) => {
return usage?.dataLimitInfo;
});

private readonly _shouldShowBanner: Computed<boolean> =
Expand All @@ -40,11 +41,12 @@ export class DocUsageBanner extends Disposable {
}

public buildDom() {
return dom.maybe(this._dataLimitStatus, (status): DomComputed => {
return dom.maybe(this._dataLimitInfo, (dataLimitInfo): DomComputed|undefined => {
const status = dataLimitInfo.status;
switch (status) {
case 'approachingLimit': { return this._buildApproachingLimitBanner(); }
case 'gracePeriod':
case 'deleteOnly': { return this._buildExceedingLimitBanner(status); }
case 'deleteOnly': { return this._buildExceedingLimitBanner(dataLimitInfo); }
}
});
}
Expand All @@ -62,7 +64,7 @@ export class DocUsageBanner extends Disposable {
const product = org.billingAccount?.product;
return dom.create(Banner, {
content: buildBannerMessage(
buildLimitStatusMessage('approachingLimit', product?.features),
buildLimitStatusMessage({status: 'approachingLimit'}, product?.features),
(product && isFreePlan(product.name)
? [' ', buildUpgradeMessage(
canUpgradeOrg(org),
Expand All @@ -81,14 +83,14 @@ export class DocUsageBanner extends Disposable {
});
}

private _buildExceedingLimitBanner(status: 'gracePeriod' | 'deleteOnly') {
private _buildExceedingLimitBanner(dataLimitInfo: DataLimitInfo) {
return dom.maybe(this._shouldShowBanner, () => {
return dom.maybe(this._currentOrg, org => {
const canUpgrade = canUpgradeOrg(org);
const product = org.billingAccount?.product;
return dom.create(Banner, {
content: buildBannerMessage(
buildLimitStatusMessage(status, product?.features),
buildLimitStatusMessage(dataLimitInfo, product?.features),
(product && isFreePlan(product.name)
? [' ', buildUpgradeMessage(
canUpgrade,
Expand All @@ -106,7 +108,7 @@ export class DocUsageBanner extends Disposable {
'short',
() => this._docPageModel.appModel.showUpgradeModal()
)
: buildLimitStatusMessage(status, product?.features)
: buildLimitStatusMessage(dataLimitInfo, product?.features)
),
testId('text'),
),
Expand Down

0 comments on commit c00e279

Please sign in to comment.