Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

workflows:
# Used to protect the main branch: it should block merging into main when failing.
# See https://github.com/activeviam/activeui-migration/settings/branch_protection_rules/15886613
# See https://github.com/activeviam/atoti-ui-migration/settings/branch_protection_rules/15886613
check-pull-request:
jobs:
- build-and-test:
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const extensions = ["js", "jsx", "ts", "tsx", "mjs", "json"];
const esmPackages = ["@activeviam/*", "lodash-es", "monaco-editor"];

// Note that in addition to the config below, there are several mocked modules under the __mocks__ folder.
// They correspond to modules that are UI/browser-related and are transitively pulled by @activeviam dependencies, but are not necessary for `activeui-migration` to work in a Node environment.
// They correspond to modules that are UI/browser-related and are transitively pulled by @activeviam dependencies, but are not necessary for `atoti-ui-migration` to work in a Node environment.
const config = {
// TODO manually mock globals such as window and use the default "node" test environment instead.
testEnvironment: "jsdom",
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "activeui-migration",
"name": "atoti-ui-migration",
"version": "5.1.1-SNAPSHOT",
"description": "Functions useful to migrate content, in order to make it usable with a more recent version of ActiveUI than the one it was saved with.",
"description": "Functions useful to migrate content, in order to make it usable with a more recent version of Atoti UI than the one it was saved with.",
"bugs": {
"url": "https://github.com/activeviam/activeui-migration/issues"
"url": "https://github.com/activeviam/atoti-ui-migration/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/activeviam/activeui-migration"
"url": "https://github.com/activeviam/atoti-ui-migration"
},
"license": "Apache-2.0",
"author": "ActiveViam",
Expand Down
6 changes: 3 additions & 3 deletions release.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ To perform a new release, perform the following steps:

## Versioning

`activeui-migration` major and minor version numbers should be aligned on `activeui-sdk`, but the patch versions are independent.
`atoti-ui-migration` major and minor version numbers should be aligned on `activeui-sdk`, but the patch versions are independent.
Examples:

1. `activeui-migration` and `activeui-sdk` are currently both on 5.0.7, but an internal bugfix is needed on `activeui-migration` => `activeui-migration` 5.0.8 can be released while staying on `activeui-sdk` 5.0.7.
1. `atoti-ui-migration` and `activeui-sdk` are currently both on 5.0.7, but an internal bugfix is needed on `atoti-ui-migration` => `atoti-ui-migration` 5.0.8 can be released while staying on `activeui-sdk` 5.0.7.
2. Same as 1. but vice-versa.
3. `activeui-sdk` 5.1.0 is about to be released. It comes with breaking changes (follows romantic versioning).
To migrate from `activeui-sdk` 5.0.x to `activeui-sdk` 5.1.0, `activeui-migration` 5.1.0 should be released.
To migrate from `activeui-sdk` 5.0.x to `activeui-sdk` 5.1.0, `atoti-ui-migration` 5.1.0 should be released.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ exports[`migrateSettingsFolder returns an empty 'organization_settings' file and
}
`;

exports[`migrateSettingsFolder returns the folders corresponding to the converted ActiveUI 4 settings folder, ready to be used by ActiveUI 5 1`] = `
exports[`migrateSettingsFolder returns the folders corresponding to the converted Atoti UI 4 settings folder, ready to be used by Atoti UI 5 1`] = `
{
"organization_settings": {
"entry": {
Expand Down
12 changes: 6 additions & 6 deletions src/4.3_to_5.0/__snapshots__/migrate_43_to_50.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`migrate_43_to_50 returns a valid ActiveUI5 /ui folder on a real life input 1`] = `
exports[`migrate_43_to_50 returns a valid Atoti UI 5 /ui folder on a real life input 1`] = `
{
"children": {
"calculated_measures": {
Expand Down Expand Up @@ -2072,7 +2072,7 @@ exports[`migrate_43_to_50 returns a valid ActiveUI5 /ui folder on a real life in
}
`;

exports[`migrate_43_to_50 returns a valid ActiveUI5 /ui folder on a real life input 2`] = `
exports[`migrate_43_to_50 returns a valid Atoti UI 5 /ui folder on a real life input 2`] = `
{
"dashboards": {
"eef": {
Expand Down Expand Up @@ -2109,7 +2109,7 @@ exports[`migrate_43_to_50 returns a valid ActiveUI5 /ui folder on a real life in
}
`;

exports[`migrate_43_to_50 returns a valid ActiveUI5 /ui folder on a real life input 3`] = `
exports[`migrate_43_to_50 returns a valid Atoti UI 5 /ui folder on a real life input 3`] = `
{
"dashboards": {
"failed": 0,
Expand Down Expand Up @@ -2138,7 +2138,7 @@ exports[`migrate_43_to_50 returns a valid ActiveUI5 /ui folder on a real life in
}
`;

exports[`migrate_43_to_50 returns a valid ActiveUI5 /ui folder on a small input 1`] = `
exports[`migrate_43_to_50 returns a valid Atoti UI 5 /ui folder on a small input 1`] = `
{
"children": {
"calculated_measures": {
Expand Down Expand Up @@ -2490,7 +2490,7 @@ exports[`migrate_43_to_50 returns a valid ActiveUI5 /ui folder on a small input
}
`;

exports[`migrate_43_to_50 returns a valid ActiveUI5 /ui folder on a small input 2`] = `
exports[`migrate_43_to_50 returns a valid Atoti UI 5 /ui folder on a small input 2`] = `
{
"dashboards": {
"failed": 0,
Expand Down Expand Up @@ -2519,7 +2519,7 @@ exports[`migrate_43_to_50 returns a valid ActiveUI5 /ui folder on a small input
}
`;

exports[`migrate_43_to_50 returns a valid ActiveUI5 /ui folder that includes calculated measures when the input includes a pivotFolder 1`] = `
exports[`migrate_43_to_50 returns a valid Atoti UI 5 /ui folder that includes calculated measures when the input includes a pivotFolder 1`] = `
{
"children": {
"content": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ describe("_doesCrossjoinYieldAllCombinationsOfMembers", () => {
).toBe(true);
});

it("returns true when `crossjoin` represents all combinations of members from several levels, even if polluted by a useless dangling member compound identifier, yielded by a user collapsing then re-expanding it in ActiveUI 4", () => {
it("returns true when `crossjoin` represents all combinations of members from several levels, even if polluted by a useless dangling member compound identifier, yielded by a user collapsing then re-expanding it in Atoti UI 4", () => {
expect(
_doesCrossjoinYieldAllCombinationsOfMembers(
parse<MdxFunction & { name: "Crossjoin" }>(`
Expand Down
10 changes: 5 additions & 5 deletions src/4.3_to_5.0/_fixErroneousExpansionMdx.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { dataModelsForTests } from "@activeviam/data-model-5.0";
const cube = dataModelsForTests.sandbox.catalogs[0].cubes[0];

describe("_fixErroneousExpansionMdx", () => {
it("removes the problematic part of the Mdx of a widget where a user collapsed and then re-expanded a member in ActiveUI 4", () => {
it("removes the problematic part of the Mdx of a widget where a user collapsed and then re-expanded a member in Atoti UI 4", () => {
const mdx = parse<MdxSelect>(`SELECT
NON EMPTY Hierarchize(
Union(
Expand Down Expand Up @@ -60,7 +60,7 @@ describe("_fixErroneousExpansionMdx", () => {
`);
});

it("removes the problematic part of the Mdx of a widget where a user collapsed and then re-expanded a member in ActiveUI 4 - even if one of the involved hierarchies is slicing", () => {
it("removes the problematic part of the Mdx of a widget where a user collapsed and then re-expanded a member in Atoti UI 4 - even if one of the involved hierarchies is slicing", () => {
const mdx = parse<MdxSelect>(`SELECT
NON EMPTY Hierarchize(
Union(
Expand Down Expand Up @@ -109,7 +109,7 @@ describe("_fixErroneousExpansionMdx", () => {
`);
});

it("removes the problematic parts of the Mdx of a widget where a user collapsed and then re-expanded 2 different members in ActiveUI 4 (collapsing all of them, then re-expanding all of them)", () => {
it("removes the problematic parts of the Mdx of a widget where a user collapsed and then re-expanded 2 different members in Atoti UI 4 (collapsing all of them, then re-expanding all of them)", () => {
const mdx = parse<MdxSelect>(`SELECT
NON EMPTY Hierarchize(
Union(
Expand Down Expand Up @@ -181,7 +181,7 @@ describe("_fixErroneousExpansionMdx", () => {
`);
});

it("removes the problematic parts of the Mdx of a widget where a user collapsed and then re-expanded 2 different members in ActiveUI 4 (collapsing and re-expanding each one before moving to the next)", () => {
it("removes the problematic parts of the Mdx of a widget where a user collapsed and then re-expanded 2 different members in Atoti UI 4 (collapsing and re-expanding each one before moving to the next)", () => {
const mdx = parse<MdxSelect>(`SELECT
NON EMPTY Hierarchize(
Union(
Expand Down Expand Up @@ -253,7 +253,7 @@ describe("_fixErroneousExpansionMdx", () => {
`);
});

it("removes the problematic parts of the Mdx of a widget where a user collapsed and then re-expanded 3 different members in ActiveUI 4 (collapsing and re-expanding each one before moving to the next)", () => {
it("removes the problematic parts of the Mdx of a widget where a user collapsed and then re-expanded 3 different members in Atoti UI 4 (collapsing and re-expanding each one before moving to the next)", () => {
const mdx = parse<MdxSelect>(`SELECT
NON EMPTY Hierarchize(
Union(
Expand Down
2 changes: 1 addition & 1 deletion src/4.3_to_5.0/_fixErroneousExpansionMdx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {

/**
* Returns an Mdx which yields the same results as the input `mdx`.
* But the returned mdx does not have the typical useless (and dangerous) parts of queries created by collapsing then re-expanding a member in ActiveUI 4.
* But the returned mdx does not have the typical useless (and dangerous) parts of queries created by collapsing then re-expanding a member in Atoti UI 4.
* See https://support.activeviam.com/jira/browse/UI-6692
*/
export function _fixErroneousExpansionMdx(
Expand Down
2 changes: 1 addition & 1 deletion src/4.3_to_5.0/_getLegacyWidgetPluginKey.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { LegacyWidgetState } from "./migration.types";

/**
* Returns the widget plugin key from an ActiveUI 4 widget state.
* Returns the widget plugin key from an Atoti UI 4 widget state.
*/
export function _getLegacyWidgetPluginKey(
legacyWidgetState: LegacyWidgetState,
Expand Down
2 changes: 1 addition & 1 deletion src/4.3_to_5.0/_migrateQuery.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe("_migrateQuery", () => {
);
});

it("removes the useless (and dangerous) parts of the queries created when users collapse and re-expand a member in ActiveUI 4", () => {
it("removes the useless (and dangerous) parts of the queries created when users collapse and re-expand a member in Atoti UI 4", () => {
const legacyQuery = {
mdx: `SELECT
NON EMPTY Hierarchize(
Expand Down
10 changes: 5 additions & 5 deletions src/4.3_to_5.0/_migrateTableColumnWidths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface LegacyColumn {
}

/**
* Returns the converted table column widths, ready to be used in the widget state of a {@link TableWidgetPlugin} in ActiveUI 5.
* Returns the converted table column widths, ready to be used in the widget state of a {@link TableWidgetPlugin} in Atoti UI 5.
*/
export function _migrateTableColumnWidths({
legacyColumns,
Expand All @@ -39,7 +39,7 @@ export function _migrateTableColumnWidths({
columnKey = "[Measures].[Measures]";
} else if (key === "c-treeCells-member" && mapping?.rows?.[0]) {
// Special handling for the tree table column corresponding to all fields mapped on rows.
// In ActiveUI 5, its column key is the unique id of the first field.
// In Atoti UI 5, its column key is the unique id of the first field.
switch (mapping.rows[0].type) {
case "allMeasures": {
columnKey = "[Measures].[Measures]";
Expand Down Expand Up @@ -82,14 +82,14 @@ export function _migrateTableColumnWidths({
)
) {
// The column key is a tuple.
// In ActiveUI 5, it is stripped from its wrapping parentheses.
// In Atoti UI 5, it is stripped from its wrapping parentheses.
columnKey = key.slice(1, key.length - 1);
}
} catch {
// The column key is not an MDX expression.
// This means that the column does not hold data coming from the widget's MDX query.
// E.g., the ActiveUI 4 line numbers column.
// These columns have no equivalent in ActiveUI 5, so they are ignored.
// E.g., the Atoti UI 4 line numbers column.
// These columns have no equivalent in Atoti UI 5, so they are ignored.
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/4.3_to_5.0/errors/TextEditorWidgetMigrationError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { PartialMigrationError } from "../../PartialMigrationError";

/**
* Thrown after migrating a `rich-text-editor` widget.
* Indicates that for the migrated widget to work in ActiveUI 5, the `text-editor` plugin must be added to the plugin registry.
* Indicates that for the migrated widget to work in Atoti UI 5, the `text-editor` plugin must be added to the plugin registry.
*/
export class TextEditorWidgetMigrationError extends PartialMigrationError {
constructor(migratedWidgetState: TextEditorWidgetState<"serialized">) {
super(
"The `text-editor` widget is not part of the plugin registry in the ActiveUI 5 starter. Make sure to add it in your project, see https://activeviam.com/activeui/documentation/latest/docs/tutorial/your-first-custom-widget#extend-activeui.",
"The `text-editor` widget is not part of the plugin registry in the Atoti UI 5 starter. Make sure to add it in your project, see https://activeviam.com/activeui/documentation/latest/docs/tutorial/your-first-custom-widget#extend-activeui.",
migratedWidgetState,
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/4.3_to_5.0/errors/UnsupportedLegacyChartTypeError.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Thrown when `legacyChartType` cannot be converted to a chart type supported in ActiveUI 5.
* Thrown when `legacyChartType` cannot be converted to a chart type supported in Atoti UI 5.
*/
export class UnsupportedLegacyChartTypeError extends Error {
constructor(legacyChartType: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { PartialMigrationError } from "../../PartialMigrationError";
export class UnsupportedLegacyQueryUpdateModeError extends PartialMigrationError {
constructor(migratedWidgetState: AWidgetState<"serialized">) {
super(
"The 'refresh-periodically' mode for query updates is not supported in ActiveUI 5, falling back to 'once'.",
"The 'refresh-periodically' mode for query updates is not supported in Atoti UI 5, falling back to 'once'.",
migratedWidgetState,
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/4.3_to_5.0/getCalculatedMeasures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const getCalculatedMeasures = async (

if (calculatedMeasuresFolder?.children) {
await Promise.all(
// Legacy calculated measures are grouped by cube in `/pivot/entitlements/cm`. But they are flattened in ActiveUI 5.
// Legacy calculated measures are grouped by cube in `/pivot/entitlements/cm`. But they are flattened in Atoti UI 5.
_flatMap(calculatedMeasuresFolder.children, async ({ children }) => {
if (children) {
const measures = await Promise.all(
Expand Down
2 changes: 1 addition & 1 deletion src/4.3_to_5.0/migrateCalculatedMeasures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface LegacyCalculatedMeasure {
}

/**
* Returns the converted content record tree for the calculted measures, ready to be used in ActiveUI 5.
* Returns the converted content record tree for the calculated measures, ready to be used in Atoti UI 5.
*/
export async function migrateCalculatedMeasures(
legacyPivotFolder: ContentRecord,
Expand Down
12 changes: 6 additions & 6 deletions src/4.3_to_5.0/migrateChart.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { legacyScatterPlot } from "./__test_resources__/legacyScatterPlot";
import { servers } from "./__test_resources__/servers";

describe("migrateChart", () => {
it("returns the ActiveUI5 chart widget state corresponding to the given ActiveUI4 chart widget state", () => {
it("returns the Atoti UI5 chart widget state corresponding to the given Atoti UI4 chart widget state", () => {
expect(migrateChart(legacyChart, servers)).toMatchInlineSnapshot(`
{
"filters": [],
Expand Down Expand Up @@ -284,12 +284,12 @@ describe("migrateChart", () => {
`);
});

it("replaces undefined attributes in the ActiveUI 4 mapping by empty arrays of fields", () => {
// ActiveUI 5 needs every single attribute to be present in the widget's mapping, even if it does not contain any field.
it("replaces undefined attributes in the Atoti UI 4 mapping by empty arrays of fields", () => {
// Atoti UI 5 needs every single attribute to be present in the widget's mapping, even if it does not contain any field.
const partialLegacyChartState = _cloneDeep(legacyChart);

// In this test, the following attributes are omitted instead of having an empty array of fields.
// This type of partial mapping works in ActiveUI 4, but not 5.
// This type of partial mapping works in Atoti UI 4, but not 5.
["splitBy", "horizontalSubplots", "verticalSubplots"].forEach(
(attributeName) => {
delete partialLegacyChartState.value.body.configuration.mapping[
Expand Down Expand Up @@ -327,8 +327,8 @@ describe("migrateChart", () => {
// Some widgets do not support it.
// For instance, the scatter plot does not: each measure on it is dedicated to a specific attribute (x, y or size).
//
// ActiveUI 4 charts did not have this capability: "all measures" could never be moved.
// For this ActiveUI 5 feature to work, charts supporting measures redirection in ActiveUI 5 should see the "ALL_MEASURES" tile added to their mapping during the migration.
// Atoti UI 4 charts did not have this capability: "all measures" could never be moved.
// For this Atoti UI 5 feature to work, charts supporting measures redirection in Atoti UI 5 should see the "ALL_MEASURES" tile added to their mapping during the migration.

const migratedChartState = migrateChart(legacyChart, servers);

Expand Down
10 changes: 5 additions & 5 deletions src/4.3_to_5.0/migrateChart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ const chartPlugins: { [widgetKey: string]: WidgetPlugin<any, any> } = _keyBy(
);

/**
* Returns the key of the ActiveUI 5 widget corresponding to the ActiveUI 4 chart identified by `legacyChartType`.
* Returns undefined if the migration script is not able to determine which ActiveUI 5 widget the legacy chart should be migrated to.
* Returns the key of the Atoti UI 5 widget corresponding to the Atoti UI 4 chart identified by `legacyChartType`.
* Returns undefined if the migration script is not able to determine which Atoti UI 5 widget the legacy chart should be migrated to.
*/
function _getMigratedWidgetKey(legacyChartType: string): string | undefined {
if (legacyChartType.startsWith("plotly-")) {
Expand All @@ -93,8 +93,8 @@ function _getMigratedWidgetKey(legacyChartType: string): string | undefined {
}

/**
* Returns the mapping of the ActiveUI 5 widget, corresponding to `legacyMapping`.
* Returns undefined if the migration script is not able to determine which ActiveUI 5 widget the legacy chart should be migrated to.
* Returns the mapping of the Atoti UI 5 widget, corresponding to `legacyMapping`.
* Returns undefined if the migration script is not able to determine which Atoti UI 5 widget the legacy chart should be migrated to.
* Does not cater for the potentially missing ALL_MEASURES tile.
*/
function _getMigratedChartMapping(
Expand Down Expand Up @@ -225,7 +225,7 @@ function _addAllMeasuresToMapping(
}

/**
* Returns the converted chart widget state, ready to be used by ActiveUI 5.
* Returns the converted chart widget state, ready to be used by Atoti UI 5.
*/
export function migrateChart(
// Legacy widget states are not typed.
Expand Down
Loading