diff --git a/.github/workflows/publish-alpha.yml b/.github/workflows/publish-alpha.yml index 8a7cdc3c984..4c7d869559e 100644 --- a/.github/workflows/publish-alpha.yml +++ b/.github/workflows/publish-alpha.yml @@ -4,22 +4,11 @@ name: Release ~ Publish alpha on: workflow_dispatch: jobs: - bump-version: - uses: ./.github/workflows/rw-bump-version.yml + publish-pre-release: + uses: ./.github/workflows/rw-publish-prerelase.yml permissions: contents: write + id-token: write secrets: inherit with: source-branch: "master" - bump: "prerelease" - prerelease-id: "alpha" - - publish-alpha: - needs: [bump-version] - uses: ./.github/workflows/rw-publish-version.yml - permissions: - contents: write - secrets: inherit - with: - source-branch: "master" - release-tag: "prerelease" diff --git a/.github/workflows/pull-request-prerelease.yml b/.github/workflows/pull-request-prerelease.yml new file mode 100644 index 00000000000..52181628f22 --- /dev/null +++ b/.github/workflows/pull-request-prerelease.yml @@ -0,0 +1,17 @@ +name: Pull request ~ Prerelease +on: + pull_request: + types: [closed] + branches: + - master + - release + +jobs: + publish-pre-release: + name: Publish pre-release + if: > + github.event.pull_request.merged == true && + any(github.event.pull_request.labels.*.name, '==', 'publish pre-release') + uses: ./.github/workflows/rw-publish-prerelase.yml + with: + source-branch: ${{ github.event.pull_request.base.ref }} diff --git a/.github/workflows/rw-bump-version.yml b/.github/workflows/rw-bump-version.yml index 0a7ea73648a..6b4a6e92fbe 100644 --- a/.github/workflows/rw-bump-version.yml +++ b/.github/workflows/rw-bump-version.yml @@ -40,7 +40,7 @@ jobs: - name: Add repository to git safe directories to avoid dubious ownership issue run: git config --global --add safe.directory $GITHUB_WORKSPACE - - name: Create and push branch + - name: Bum rush version and commit to source branch env: BUMP: ${{ inputs.bump }} PRERELEASE_ID: ${{ inputs.prerelease-id }} @@ -51,7 +51,8 @@ jobs: # it needs git configured already user.email/name rush version --bump --override-bump $BUMP --override-prerelease-id $PRERELEASE_ID git add -A - git commit -m "Bump versions" + VERSION=$(node -p "require('./libs/sdk-ui/package.json').version") + git commit -m "Bump versions to $VERSION" git push origin ${{ inputs.source-branch }} - name: Get version id: version diff --git a/.github/workflows/rw-publish-prerelase.yml b/.github/workflows/rw-publish-prerelase.yml new file mode 100644 index 00000000000..cd379e21ded --- /dev/null +++ b/.github/workflows/rw-publish-prerelase.yml @@ -0,0 +1,74 @@ +# (C) 2024 GoodData Corporation + +name: rw ~ Release ~ Publish prerelease +on: + workflow_call: + inputs: + source-branch: + required: true + description: "The name of the source branch" + type: string + +# limit concurrency to one run per branch at a time +# so that we can run this from master and a release branch at the same time +# When a concurrent job or workflow is queued, +# if another job or workflow using the same concurrency group in the repository is in progress, +# the queued job or workflow will be pending. Any previously pending job or workflow in the concurrency group will be canceled. +concurrency: + group: prerelease-${{ github.event.inputs.source-branch }} + cancel-in-progress: false + +jobs: + setup-params: + runs-on: [infra-small] + outputs: + prerelease-id: ${{ steps.validate-params.outputs.prerelease-id }} + + steps: + - name: validate params + id: validate-params + run: | + if [ "${{ inputs.source-branch }}" = "master" ]; then + echo "prerelease-id=alpha" >> $GITHUB_OUTPUT + elif [ "${{ inputs.source-branch }}" = "release" ]; then + echo "prerelease-id=beta" >> $GITHUB_OUTPUT + else + echo "Invalid branch provided. Please provide either 'master' or 'release'." + exit 1 + fi + + bump-version: + needs: [setup-params] + uses: ./.github/workflows/rw-bump-version.yml + permissions: + contents: write + id-token: write + secrets: inherit + with: + source-branch: ${{ github.event.inputs.source-branch }} + bump: "prerelease" + prerelease-id: ${{ needs.setup-params.outputs.prerelease-id }} + + publish-prerelease: + needs: [bump-version] + uses: ./.github/workflows/rw-publish-version.yml + permissions: + contents: read + id-token: write + secrets: inherit + with: + source-branch: ${{ github.event.inputs.source-branch }} + release-tag: "prerelease" + + slack-notification: + runs-on: [infra1-small] + needs: [bump-version, publish-prerelease] + steps: + - name: Notify to slack + uses: slackapi/slack-github-action@v1.23.0 + with: + channel-id: "#javascript-notifications" + slack-message: "SDK-UI versions *${{ env.RELEASE_VERSION }}* has been successfully published to NPM." + env: + RELEASE_VERSION: ${{ needs.bump-version.outputs.version }} + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} diff --git a/.github/workflows/rw-publish-version.yml b/.github/workflows/rw-publish-version.yml index 136d3e15ccd..6d66fd14d33 100644 --- a/.github/workflows/rw-publish-version.yml +++ b/.github/workflows/rw-publish-version.yml @@ -18,20 +18,25 @@ jobs: runs-on: [infra1-medium] container: image: 020413372491.dkr.ecr.us-east-1.amazonaws.com/3rdparty/library/node:18.17.0-bullseye + permissions: + contents: read + id-token: write steps: - name: Checkout code uses: actions/checkout@v4 with: ref: ${{ inputs.source-branch }} + - name: Add repository to git safe directories to avoid dubious ownership issue + run: git config --global --add safe.directory $GITHUB_WORKSPACE - name: Get NPM_PUBLISH_TOKEN from Vault and set it as env variable uses: hashicorp/vault-action@v2 with: url: "https://vault.ord1.infra.intgdc.com" method: jwt path: jwt/github - role: ecr-push + role: front-end secrets: | - secret/v3/int/npm/rw-token secret | NPM_PUBLISH_TOKEN + secret/data/v3/int/npm/rw-token secret | NPM_PUBLISH_TOKEN ; - name: Install rush run: | npm install -g @microsoft/rush diff --git a/common/config/rush/version-policies.json b/common/config/rush/version-policies.json index 0f70ac29a8b..af2908e4336 100644 --- a/common/config/rush/version-policies.json +++ b/common/config/rush/version-policies.json @@ -12,14 +12,14 @@ { "definitionName": "lockStepVersion", "policyName": "sdk", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "nextBump": "prerelease", "mainProject": "@gooddata/sdk-ui-all" }, { "definitionName": "lockStepVersion", "policyName": "sdk-examples", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "nextBump": "prerelease", "mainProject": "@gooddata/sdk-interactive-examples" } diff --git a/examples/sdk-interactive-examples/examples-template/package.json b/examples/sdk-interactive-examples/examples-template/package.json index fbbd25b1b4c..1d5648cc555 100644 --- a/examples/sdk-interactive-examples/examples-template/package.json +++ b/examples/sdk-interactive-examples/examples-template/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-interactive-examples-template", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "title": "GoodData interactive example template", "description": "GoodData interactive example template", "author": "GoodData Corporation", diff --git a/examples/sdk-interactive-examples/examples/example-attributefilter/package.json b/examples/sdk-interactive-examples/examples/example-attributefilter/package.json index 4af8566b975..8913ac05f72 100644 --- a/examples/sdk-interactive-examples/examples/example-attributefilter/package.json +++ b/examples/sdk-interactive-examples/examples/example-attributefilter/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-interactive-example-attributefilter", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "title": "Attribute Filter Example", "description": "This example demonstrates how to use the AttributeFilter component to filter data in a visualization.", "author": "GoodData Corporation", diff --git a/examples/sdk-interactive-examples/examples/example-chartconfig/package.json b/examples/sdk-interactive-examples/examples/example-chartconfig/package.json index 5e162f3cf3b..545956882d7 100644 --- a/examples/sdk-interactive-examples/examples/example-chartconfig/package.json +++ b/examples/sdk-interactive-examples/examples/example-chartconfig/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-interactive-example-chartconfig", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "title": "Chart config manipulation", "description": "This interactive example demonstrates how to manipulate the chart config.", "author": "GoodData Corporation", diff --git a/examples/sdk-interactive-examples/examples/example-columnchart/package.json b/examples/sdk-interactive-examples/examples/example-columnchart/package.json index 528c4cb314b..cacee505bfd 100644 --- a/examples/sdk-interactive-examples/examples/example-columnchart/package.json +++ b/examples/sdk-interactive-examples/examples/example-columnchart/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-interactive-example-columnchart", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "title": "ColumnChart", "description": "This example demonstrates the usage of the ColumnChart component with the viewBy and stackBy properties.", "author": "GoodData Corporation", diff --git a/examples/sdk-interactive-examples/examples/example-combochart/package.json b/examples/sdk-interactive-examples/examples/example-combochart/package.json index c8f8a535ce1..ae86cc5904e 100644 --- a/examples/sdk-interactive-examples/examples/example-combochart/package.json +++ b/examples/sdk-interactive-examples/examples/example-combochart/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-interactive-example-combochart", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "title": "ComboChart", "description": "Example demonstrates ComboChart secondaryMeasures definition. ", "author": "GoodData Corporation", diff --git a/examples/sdk-interactive-examples/examples/example-dashboard/package.json b/examples/sdk-interactive-examples/examples/example-dashboard/package.json index 9778b9e38b2..bec38bd9540 100644 --- a/examples/sdk-interactive-examples/examples/example-dashboard/package.json +++ b/examples/sdk-interactive-examples/examples/example-dashboard/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-interactive-example-dashboard", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "title": "Dashboard component", "description": "This example shows how to use the Dashboard component.", "author": "GoodData Corporation", diff --git a/examples/sdk-interactive-examples/examples/example-datefilter/package.json b/examples/sdk-interactive-examples/examples/example-datefilter/package.json index b20cfc6a820..00e4ad61672 100644 --- a/examples/sdk-interactive-examples/examples/example-datefilter/package.json +++ b/examples/sdk-interactive-examples/examples/example-datefilter/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-interactive-example-datefilter", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "title": "DateFilter", "description": "Example demonstrates usage of Date Filter component.", "author": "GoodData Corporation", diff --git a/examples/sdk-interactive-examples/examples/example-dependentfilters/package.json b/examples/sdk-interactive-examples/examples/example-dependentfilters/package.json index ff012a3da44..2cfecac2160 100644 --- a/examples/sdk-interactive-examples/examples/example-dependentfilters/package.json +++ b/examples/sdk-interactive-examples/examples/example-dependentfilters/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-interactive-example-dependentfilters", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "title": "Dependent Filters Example", "description": "This example demonstrates how to use multiple attribute filters linked together to filter data in a visualization.", "author": "GoodData Corporation", diff --git a/examples/sdk-interactive-examples/examples/example-execute/package.json b/examples/sdk-interactive-examples/examples/example-execute/package.json index b91887fcf33..f7b0cfbd4f3 100644 --- a/examples/sdk-interactive-examples/examples/example-execute/package.json +++ b/examples/sdk-interactive-examples/examples/example-execute/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-interactive-example-execute", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "title": "Execute", "description": "This example demonstrates using Execute component and build custom visualization.", "author": "GoodData Corporation", diff --git a/examples/sdk-interactive-examples/examples/example-granularity/package.json b/examples/sdk-interactive-examples/examples/example-granularity/package.json index 8c98f0e4840..226978e1965 100644 --- a/examples/sdk-interactive-examples/examples/example-granularity/package.json +++ b/examples/sdk-interactive-examples/examples/example-granularity/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-interactive-example-granularity", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "title": "Granularity", "description": "This example exmplains DateFilter granularity ", "author": "GoodData Corporation", diff --git a/examples/sdk-interactive-examples/examples/example-headline/package.json b/examples/sdk-interactive-examples/examples/example-headline/package.json index 3a22a730334..70f27dd9e02 100644 --- a/examples/sdk-interactive-examples/examples/example-headline/package.json +++ b/examples/sdk-interactive-examples/examples/example-headline/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-interactive-example-headline", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "title": "Headline", "description": "This example shows how to use the Headline component.", "author": "GoodData Corporation", diff --git a/examples/sdk-interactive-examples/examples/example-pivottable/package.json b/examples/sdk-interactive-examples/examples/example-pivottable/package.json index e042c791c2f..64db002021f 100644 --- a/examples/sdk-interactive-examples/examples/example-pivottable/package.json +++ b/examples/sdk-interactive-examples/examples/example-pivottable/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-interactive-example-pivottable", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "title": "PivotTable", "description": "Basic PivotTable manipulation.", "author": "GoodData Corporation", diff --git a/examples/sdk-interactive-examples/examples/example-relativedatefilter/package.json b/examples/sdk-interactive-examples/examples/example-relativedatefilter/package.json index 372121121a6..ed037a53493 100644 --- a/examples/sdk-interactive-examples/examples/example-relativedatefilter/package.json +++ b/examples/sdk-interactive-examples/examples/example-relativedatefilter/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-interactive-example-relativedatefilter", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "title": "RelativeDateFilter", "description": "Example demonstrates how to set relative DateFilter for visualization.", "author": "GoodData Corporation", diff --git a/examples/sdk-interactive-examples/package.json b/examples/sdk-interactive-examples/package.json index 56ba64e2f23..ea0da8c1e81 100644 --- a/examples/sdk-interactive-examples/package.json +++ b/examples/sdk-interactive-examples/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-interactive-examples", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "description": "GoodData React interactive examples", "license": "LicenseRef-LICENSE", "author": "GoodData Corporation", diff --git a/libs/api-client-bear/package.json b/libs/api-client-bear/package.json index 975b5bc71d3..1787715a57f 100644 --- a/libs/api-client-bear/package.json +++ b/libs/api-client-bear/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/api-client-bear", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "author": "GoodData", "description": "API Client for the GoodData platform", "repository": { diff --git a/libs/api-client-tiger/package.json b/libs/api-client-tiger/package.json index 0e329ee0ed0..8784d9c1e86 100644 --- a/libs/api-client-tiger/package.json +++ b/libs/api-client-tiger/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/api-client-tiger", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "author": "GoodData", "description": "API Client for GoodData Cloud and GoodData.CN", "repository": { diff --git a/libs/api-model-bear/package.json b/libs/api-model-bear/package.json index 2fee538b9e3..bcf4f4c31a5 100644 --- a/libs/api-model-bear/package.json +++ b/libs/api-model-bear/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/api-model-bear", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "description": "TypeScript definition files for GoodData platform", "repository": { "type": "git", diff --git a/libs/sdk-backend-base/package.json b/libs/sdk-backend-base/package.json index 9958cc44e05..c08779ae45f 100644 --- a/libs/sdk-backend-base/package.json +++ b/libs/sdk-backend-base/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-backend-base", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "author": "GoodData", "description": "GoodData.UI SDK - Base for backend implementations", "repository": { diff --git a/libs/sdk-backend-bear/package.json b/libs/sdk-backend-bear/package.json index 7c9d627e902..9366d48ed96 100644 --- a/libs/sdk-backend-bear/package.json +++ b/libs/sdk-backend-bear/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-backend-bear", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "author": "GoodData", "description": "GoodData Backend SPI implementation for the GoodData platform", "repository": { diff --git a/libs/sdk-backend-mockingbird/package.json b/libs/sdk-backend-mockingbird/package.json index f59a39aace1..35b36843f9e 100644 --- a/libs/sdk-backend-mockingbird/package.json +++ b/libs/sdk-backend-mockingbird/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-backend-mockingbird", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "author": "GoodData", "description": "Mock GoodData Backend SPI implementation", "repository": { diff --git a/libs/sdk-backend-spi/package.json b/libs/sdk-backend-spi/package.json index 0f6af80484c..9fbf90a2f2a 100644 --- a/libs/sdk-backend-spi/package.json +++ b/libs/sdk-backend-spi/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-backend-spi", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "author": "GoodData", "description": "GoodData Backend SPI abstraction interfaces", "repository": { diff --git a/libs/sdk-backend-tiger/package.json b/libs/sdk-backend-tiger/package.json index 15e84429744..8ee29e6b658 100644 --- a/libs/sdk-backend-tiger/package.json +++ b/libs/sdk-backend-tiger/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-backend-tiger", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "author": "GoodData", "description": "GoodData Backend SPI implementation for GoodData Cloud and GoodData.CN", "repository": { diff --git a/libs/sdk-embedding/package.json b/libs/sdk-embedding/package.json index 34a8b181e8a..e60b322f50a 100644 --- a/libs/sdk-embedding/package.json +++ b/libs/sdk-embedding/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-embedding", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "author": "GoodData", "description": "GoodData Embedding APIs", "repository": { diff --git a/libs/sdk-model/package.json b/libs/sdk-model/package.json index ae46fd997be..65cd3e0316b 100644 --- a/libs/sdk-model/package.json +++ b/libs/sdk-model/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-model", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "author": "GoodData", "description": "GoodData Model definitions used by UI components and Backend SPI and its implementations", "repository": { diff --git a/libs/sdk-ui-all/package.json b/libs/sdk-ui-all/package.json index c993cf82c8d..0814eb0b7de 100644 --- a/libs/sdk-ui-all/package.json +++ b/libs/sdk-ui-all/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-ui-all", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "author": "GoodData", "description": "GoodData SDK - All-In-One", "repository": { diff --git a/libs/sdk-ui-charts/package.json b/libs/sdk-ui-charts/package.json index 00ad0cc467f..6d2d18a728e 100644 --- a/libs/sdk-ui-charts/package.json +++ b/libs/sdk-ui-charts/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-ui-charts", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "description": "GoodData.UI SDK - Charts", "repository": { "type": "git", diff --git a/libs/sdk-ui-dashboard/package.json b/libs/sdk-ui-dashboard/package.json index 942c2416ac1..6479aa4b2a2 100644 --- a/libs/sdk-ui-dashboard/package.json +++ b/libs/sdk-ui-dashboard/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-ui-dashboard", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "description": "GoodData SDK - Dashboard Component", "repository": { "type": "git", diff --git a/libs/sdk-ui-dashboard/src/presentation/dragAndDrop/draggableWidget/AddRichTextWidgetButton.tsx b/libs/sdk-ui-dashboard/src/presentation/dragAndDrop/draggableWidget/AddRichTextWidgetButton.tsx index a863e4f05b9..7ae53f6e13c 100644 --- a/libs/sdk-ui-dashboard/src/presentation/dragAndDrop/draggableWidget/AddRichTextWidgetButton.tsx +++ b/libs/sdk-ui-dashboard/src/presentation/dragAndDrop/draggableWidget/AddRichTextWidgetButton.tsx @@ -2,17 +2,10 @@ import { Icon } from "@gooddata/sdk-ui-kit"; import React from "react"; import { FormattedMessage } from "react-intl"; -import cx from "classnames"; export const AddRichTextWidgetButton: React.FC = () => { return ( -
+
diff --git a/libs/sdk-ui-dashboard/src/presentation/widget/insight/configuration/InsightDateDataSetFilter.tsx b/libs/sdk-ui-dashboard/src/presentation/widget/insight/configuration/InsightDateDataSetFilter.tsx index ce98350c0dd..becd81d19bf 100644 --- a/libs/sdk-ui-dashboard/src/presentation/widget/insight/configuration/InsightDateDataSetFilter.tsx +++ b/libs/sdk-ui-dashboard/src/presentation/widget/insight/configuration/InsightDateDataSetFilter.tsx @@ -1,15 +1,7 @@ -// (C) 2007-2023 GoodData Corporation -import React, { useEffect, useMemo } from "react"; +// (C) 2007-2024 GoodData Corporation +import React, { useEffect } from "react"; import { DateDatasetFilter } from "../../common/index.js"; -import { - IInsightWidget, - IMeasure, - insightMeasures, - isDateFilter, - isSimpleMeasure, - measureFilters, - widgetRef, -} from "@gooddata/sdk-model"; +import { IInsightWidget, widgetRef } from "@gooddata/sdk-model"; import { invariant } from "ts-invariant"; import { MeasureDateDatasets, @@ -21,7 +13,6 @@ import { useDashboardSelector, } from "../../../../model/index.js"; import { useDateDatasetFilter } from "../../common/configuration/useDateDatasetFilter.js"; -import isEmpty from "lodash/isEmpty.js"; export interface IConfigurationPanelProps { widget: IInsightWidget; @@ -56,15 +47,10 @@ export default function InsightDateDataSetFilter({ widget }: IConfigurationPanel result?.dateDatasets, ); - const dateOptionsDisabled = useMemo(() => { - const measures = insightMeasures(insight); - return isEmpty(measures) ? false : measures.every(isDateFiltered); - }, [insight]); - return ( ); } - -function isDateFiltered(measure: IMeasure) { - if (isSimpleMeasure(measure)) { - const filters = measureFilters(measure) ?? []; - return filters.some(isDateFilter); - } - return true; -} diff --git a/libs/sdk-ui-dashboard/styles/scss/richText.scss b/libs/sdk-ui-dashboard/styles/scss/richText.scss index b35f2845218..e1ee995a419 100644 --- a/libs/sdk-ui-dashboard/styles/scss/richText.scss +++ b/libs/sdk-ui-dashboard/styles/scss/richText.scss @@ -1,6 +1,8 @@ // (C) 2024 GoodData Corporation @use "@gooddata/sdk-ui-kit/styles/scss/variables" as kit-variables; +@use "@gooddata/sdk-ui-kit/styles/scss/Button/_variables" as button-variables; +@use "variables"; .gd-rich-text-wrapper { width: 100%; @@ -8,7 +10,7 @@ display: flex; flex-direction: column; overflow-x: hidden; - overflow-y: scroll; + overflow-y: auto; position: absolute; left: 0; top: 0; @@ -18,6 +20,7 @@ width: 100%; height: 100%; padding: 5px; + border-radius: variables.$gd-dashboards-content-widget-borderRadius; textarea { width: 100%; @@ -31,6 +34,7 @@ border: none; resize: none; outline: none; + overflow: hidden; } .gd-rich-text-content-empty { @@ -40,12 +44,51 @@ justify-content: center; align-items: center; } + + // styles for markdown elements + :first-child { + margin-top: 0; + } + + h1 { + font-size: 17px; + font-weight: 700; + line-height: 23px; + letter-spacing: 0; + text-align: left; + } + + h2 { + font-size: 15px; + font-weight: 700; + line-height: 20px; + letter-spacing: 0; + text-align: left; + } + + h3 { + font-size: 14px; + font-weight: 700; + line-height: 19px; + letter-spacing: 0; + text-align: left; + } + + p, + ul, + ol { + font-size: 14px; + font-weight: 400; + line-height: 19px; + letter-spacing: 0; + text-align: left; + } } $row-height: 50px; .gd-rich-text-footer { - padding-top: 10px; + padding-top: 8px; padding-right: 4px; display: flex; justify-content: space-between; @@ -72,7 +115,11 @@ $row-height: 50px; } .gd-button-link-dimmed::before { - top: 5px; + top: 6px; + } + + .gd-button-link-dimmed:focus { + color: button-variables.$button-normal-color; } .gd-button-link-dimmed:hover { diff --git a/libs/sdk-ui-ext/package.json b/libs/sdk-ui-ext/package.json index b345216d72c..a5ee51b7329 100644 --- a/libs/sdk-ui-ext/package.json +++ b/libs/sdk-ui-ext/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-ui-ext", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "description": "GoodData.UI SDK - Extensions", "repository": { "type": "git", diff --git a/libs/sdk-ui-filters/package.json b/libs/sdk-ui-filters/package.json index b17160aba23..cb577fbff49 100644 --- a/libs/sdk-ui-filters/package.json +++ b/libs/sdk-ui-filters/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-ui-filters", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "description": "GoodData.UI SDK - Filter Components", "repository": { "type": "git", diff --git a/libs/sdk-ui-geo/package.json b/libs/sdk-ui-geo/package.json index 442c3125cb2..fb1c9c6ee07 100644 --- a/libs/sdk-ui-geo/package.json +++ b/libs/sdk-ui-geo/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-ui-geo", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "description": "GoodData.UI SDK - Geo Charts", "repository": { "type": "git", diff --git a/libs/sdk-ui-kit/package.json b/libs/sdk-ui-kit/package.json index 3bd9c96bd67..3b418356114 100644 --- a/libs/sdk-ui-kit/package.json +++ b/libs/sdk-ui-kit/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-ui-kit", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "description": "GoodData SDK - UI Building Components", "repository": { "type": "git", diff --git a/libs/sdk-ui-loaders/package.json b/libs/sdk-ui-loaders/package.json index 47e18cace23..a136e3d3e22 100644 --- a/libs/sdk-ui-loaders/package.json +++ b/libs/sdk-ui-loaders/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-ui-loaders", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "description": "GoodData SDK Runtime Component Loaders", "repository": { "type": "git", diff --git a/libs/sdk-ui-loaders/src/dashboard/loadingStrategies/dynamicComponentLoaders.ts b/libs/sdk-ui-loaders/src/dashboard/loadingStrategies/dynamicComponentLoaders.ts index fe737d0b379..5c1e20efe4c 100644 --- a/libs/sdk-ui-loaders/src/dashboard/loadingStrategies/dynamicComponentLoaders.ts +++ b/libs/sdk-ui-loaders/src/dashboard/loadingStrategies/dynamicComponentLoaders.ts @@ -1,4 +1,4 @@ -// (C) 2021-2023 GoodData Corporation +// (C) 2021-2024 GoodData Corporation import { IDashboardWithReferences } from "@gooddata/sdk-backend-spi"; import { DashboardContext, IDashboardEngine, IDashboardPluginContract_V1 } from "@gooddata/sdk-ui-dashboard"; import { areObjRefsEqual, objRefToString } from "@gooddata/sdk-model"; @@ -8,6 +8,12 @@ import isEmpty from "lodash/isEmpty.js"; import { determineDashboardEngine } from "./determineDashboardEngine.js"; import { DynamicScriptLoadSdkError } from "@gooddata/sdk-ui"; +interface EntryPoint { + pluginKey: string; + engineKey: string; + version: string; +} + /** * @internal */ @@ -21,10 +27,7 @@ export async function dynamicDashboardEngineLoader( const loadedEngines: IDashboardEngine[] = await Promise.all( plugins.map(async (plugin) => { - const loadedEngineModule = await loadEngine( - moduleNameFromUrl(plugin.url), - moduleFederationIntegration, - )(); + const loadedEngineModule = await loadEngine(plugin.url, moduleFederationIntegration)(); const engineFactory = loadedEngineModule.default; return engineFactory(); @@ -63,10 +66,7 @@ export async function dynamicDashboardPluginLoader( )}`, ); - const loadedModule = await loadPlugin( - moduleNameFromUrl(pluginMeta.url), - moduleFederationIntegration, - )(); + const loadedModule = await loadPlugin(pluginMeta.url, moduleFederationIntegration)(); const pluginFactory = loadedModule.default; let plugin: IDashboardPluginContract_V1 = pluginFactory(); @@ -77,10 +77,7 @@ export async function dynamicDashboardPluginLoader( !plugin.compatibility && (plugin.maxEngineVersion === "bundled" || plugin.minEngineVersion === "bundled") ) { - const loadedEngineModule = await loadEngine( - moduleNameFromUrl(pluginMeta.url), - moduleFederationIntegration, - )(); + const loadedEngineModule = await loadEngine(pluginMeta.url, moduleFederationIntegration)(); const engineFactory = loadedEngineModule.default; const engine: IDashboardEngine = engineFactory(); @@ -170,7 +167,7 @@ function loadEntry( moduleName: string, { __webpack_init_sharing__, __webpack_share_scopes__ }: ModuleFederationIntegration, ) { - return async (): Promise<{ pluginKey: string; engineKey: string }> => { + return async (): Promise => { // Initializes the share scope. This fills it with known provided modules from this build and all remotes await __webpack_init_sharing__("default"); @@ -184,22 +181,55 @@ function loadEntry( }; } -function loadPlugin(moduleName: string, moduleFederationIntegration: ModuleFederationIntegration) { +function loadPlugin(url: string, moduleFederationIntegration: ModuleFederationIntegration) { + const moduleName = moduleNameFromUrl(url); return async () => { const entry = await loadEntry(moduleName, moduleFederationIntegration)(); + + const cache = getWindowPluginCache(moduleName); + if (cache.plugin) { + if (cache.pluginUrl !== url) { + // eslint-disable-next-line no-console + console.warn( + `Trying to initialize plugin ${moduleName} that is already initialized from different url. +Returning instance that is already initialized. + +Initialized plugin url: ${cache.pluginUrl} +Initialized plugin version: ${cache.entry?.version ?? "not specified"} + +Trying to initialize plugin url: ${url} +Trying to initialize plugin version: ${entry.version ?? "not specified"} +`, + ); + } + + return cache.plugin; + } + const factory = await (window)[moduleName].get(entry.pluginKey); - return factory(); + const plugin = factory(); + cachePlugin(moduleName, url, entry, plugin); + return plugin; }; } -function loadEngine(moduleName: string, moduleFederationIntegration: ModuleFederationIntegration) { +function loadEngine(url: string, moduleFederationIntegration: ModuleFederationIntegration) { + const moduleName = moduleNameFromUrl(url); return async () => { const entry = await loadEntry(moduleName, moduleFederationIntegration)(); + + const cache = getWindowPluginCache(moduleName); + if (cache.engine) { + return cache.engine; + } + const factory = await (window)[moduleName].get(entry.engineKey); try { - return factory(); + const engine = factory(); + cacheEngine(moduleName, url, entry, engine); + return engine; } catch (ex) { console.error( `Initialization of ${moduleName} failed. This can happen if you deploy the same plugin multiple times each with the different GoodData.UI version or ${moduleName} is not unique in workspace`, @@ -208,3 +238,50 @@ function loadEngine(moduleName: string, moduleFederationIntegration: ModuleFeder } }; } + +// +// When there are different plugins versions of the same dashboard plugin +// loaded in the same browser window context, the plugin initialization fails. +// (because the plugin is scoped only by its name, not by the version or url) +// See related module federation issue: https://github.com/module-federation/module-federation-examples/issues/1142 +// +// If we cache initialized plugins, +// we can avoid initialization of the another plugin from different url and following failure +// and rather write warning about it into the console. +// + +function moduleNameToCacheKey(moduleName: string) { + return `${moduleName}_cache`; +} + +function initializeWindowPluginCacheIfNotFound(moduleName: string) { + const cacheKey = moduleNameToCacheKey(moduleName); + if (!(window)[cacheKey]) { + (window)[cacheKey] = {}; + } +} + +function getWindowPluginCache(moduleName: string): { + plugin?: any; + engine?: any; + entry?: EntryPoint; + pluginUrl?: string; +} { + initializeWindowPluginCacheIfNotFound(moduleName); + const cacheKey = moduleNameToCacheKey(moduleName); + return (window)[cacheKey]; +} + +function cacheEngine(moduleName: string, url: string, entry: EntryPoint, engine: any) { + const cache = getWindowPluginCache(moduleName); + cache.engine = engine; + cache.pluginUrl = url; + cache.entry = entry; +} + +function cachePlugin(moduleName: string, url: string, entry: EntryPoint, plugin: any) { + const cache = getWindowPluginCache(moduleName); + cache.plugin = plugin; + cache.pluginUrl = url; + cache.entry = entry; +} diff --git a/libs/sdk-ui-pivot/package.json b/libs/sdk-ui-pivot/package.json index 88b49119aec..f5c83fbfa59 100644 --- a/libs/sdk-ui-pivot/package.json +++ b/libs/sdk-ui-pivot/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-ui-pivot", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "description": "GoodData.UI SDK - Pivot Table", "repository": { "type": "git", diff --git a/libs/sdk-ui-theme-provider/package.json b/libs/sdk-ui-theme-provider/package.json index c526c37525c..8f3948ce355 100644 --- a/libs/sdk-ui-theme-provider/package.json +++ b/libs/sdk-ui-theme-provider/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-ui-theme-provider", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "description": "GoodData SDK - Theme provider", "repository": { "type": "git", diff --git a/libs/sdk-ui-vis-commons/package.json b/libs/sdk-ui-vis-commons/package.json index a718045310e..6f6650b5df1 100644 --- a/libs/sdk-ui-vis-commons/package.json +++ b/libs/sdk-ui-vis-commons/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-ui-vis-commons", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "description": "GoodData.UI SDK - common functionality for different types of visualizations", "repository": { "type": "git", diff --git a/libs/sdk-ui/package.json b/libs/sdk-ui/package.json index 48588444972..4449e133368 100644 --- a/libs/sdk-ui/package.json +++ b/libs/sdk-ui/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/sdk-ui", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "description": "GoodData.UI SDK - Core", "repository": { "type": "git", diff --git a/libs/util/package.json b/libs/util/package.json index 1518ecadebe..6a565c4f45e 100644 --- a/libs/util/package.json +++ b/libs/util/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/util", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "author": "GoodData", "description": "GoodData Utility Functions", "repository": { diff --git a/tools/app-toolkit/package.json b/tools/app-toolkit/package.json index c2781f6c655..c744f7acc12 100644 --- a/tools/app-toolkit/package.json +++ b/tools/app-toolkit/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/app-toolkit", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "author": "GoodData", "description": "CLI with useful tools for creating and maintaining GoodData web applications.", "repository": { diff --git a/tools/catalog-export/package.json b/tools/catalog-export/package.json index 74a6bfa2d03..e45abd74064 100644 --- a/tools/catalog-export/package.json +++ b/tools/catalog-export/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/catalog-export", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "author": "GoodData", "description": "GoodData SDK Catalog Export tooling", "repository": { diff --git a/tools/experimental-workspace/package.json b/tools/experimental-workspace/package.json index 21d1f3c07d1..3bd4270bc49 100644 --- a/tools/experimental-workspace/package.json +++ b/tools/experimental-workspace/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/experimental-workspace", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "author": "GoodData", "description": "GoodData SDK - Experimental workspace for features in dev", "repository": { diff --git a/tools/i18n-toolkit/package.json b/tools/i18n-toolkit/package.json index 475264772c7..4dcf935f11f 100644 --- a/tools/i18n-toolkit/package.json +++ b/tools/i18n-toolkit/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/i18n-toolkit", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "author": "GoodData", "description": "Localization validator to validate localization complexity and intl and html format.", "repository": { diff --git a/tools/live-examples-workspace/package.json b/tools/live-examples-workspace/package.json index 822760e3c99..1fa9c279d8e 100644 --- a/tools/live-examples-workspace/package.json +++ b/tools/live-examples-workspace/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/live-examples-workspace", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "author": "GoodData", "description": "GoodData SDK - Live examples workspace for tests", "repository": { diff --git a/tools/mock-handling/package.json b/tools/mock-handling/package.json index 9919e0e2d6a..2ffc2a4cb55 100644 --- a/tools/mock-handling/package.json +++ b/tools/mock-handling/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/mock-handling", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "author": "GoodData", "description": "GoodData SDK Mock data capture and management tool", "repository": { diff --git a/tools/plugin-toolkit/package.json b/tools/plugin-toolkit/package.json index 6f2c77a38a3..04c57e00e47 100644 --- a/tools/plugin-toolkit/package.json +++ b/tools/plugin-toolkit/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/plugin-toolkit", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "author": "GoodData", "description": "GoodData Set of Tools for working with Plugins", "repository": { diff --git a/tools/reference-workspace/package.json b/tools/reference-workspace/package.json index cbe8f41a33a..3916be2d619 100644 --- a/tools/reference-workspace/package.json +++ b/tools/reference-workspace/package.json @@ -1,6 +1,6 @@ { "name": "@gooddata/reference-workspace", - "version": "9.7.0-alpha.15", + "version": "9.7.0-alpha.17", "author": "GoodData", "description": "GoodData SDK - Reference Workspace for tests", "repository": {