From 2280099ae216f1dfeec8536f43d2ec3daf381af4 Mon Sep 17 00:00:00 2001 From: Nestor Zepeda Date: Wed, 18 Sep 2024 17:14:06 -0400 Subject: [PATCH] Create the smallLegacy ui folder with the new add legacy bookmark to UI folder function --- .../migrate_43_to_50.test.ts.snap | 97 +------ .../legacyDashboardBookmark.ts | 16 ++ .../legacyInvalidDashboardBookmark.ts | 17 ++ .../legacyInvalidFilterBookmark.ts | 17 ++ .../__test_resources__/smallLegacyUIFolder.ts | 245 +----------------- ...smallLegacyUIFolderWithInvalidDashboard.ts | 142 +--------- .../smallLegacyUIFolderWithInvalidFilter.ts | 143 +--------- 7 files changed, 79 insertions(+), 598 deletions(-) create mode 100644 src/4.3_to_5.0/__test_resources__/legacyDashboardBookmark.ts create mode 100644 src/4.3_to_5.0/__test_resources__/legacyInvalidDashboardBookmark.ts create mode 100644 src/4.3_to_5.0/__test_resources__/legacyInvalidFilterBookmark.ts diff --git a/src/4.3_to_5.0/__snapshots__/migrate_43_to_50.test.ts.snap b/src/4.3_to_5.0/__snapshots__/migrate_43_to_50.test.ts.snap index 8d0554a7..43a7bc78 100644 --- a/src/4.3_to_5.0/__snapshots__/migrate_43_to_50.test.ts.snap +++ b/src/4.3_to_5.0/__snapshots__/migrate_43_to_50.test.ts.snap @@ -2247,12 +2247,8 @@ exports[`migrate_43_to_50 returns a valid ActiveUI5 /ui folder on a small input "content": "{"name":"hidden grand totals"}", "isDirectory": true, "lastEditor": "admin", - "owners": [ - "admin", - ], - "readers": [ - "admin", - ], + "owners": [], + "readers": [], "timestamp": 1607879735685, }, }, @@ -2262,12 +2258,8 @@ exports[`migrate_43_to_50 returns a valid ActiveUI5 /ui folder on a small input "canWrite": true, "isDirectory": true, "lastEditor": "admin", - "owners": [ - "admin", - ], - "readers": [ - "admin", - ], + "owners": [], + "readers": [], "timestamp": 1607879735685, }, }, @@ -2357,6 +2349,7 @@ exports[`migrate_43_to_50 returns a valid ActiveUI5 /ui folder on a small input "organization_settings": { "entry": { "content": "{}", + "isDirectory": false, "owners": [ "ROLE_CS_ROOT", ], @@ -2404,86 +2397,6 @@ exports[`migrate_43_to_50 returns a valid ActiveUI5 /ui folder on a small input }, }, "users": { - "children": { - "admin": { - "children": { - "activity": { - "entry": { - "content": "{"userFilters":["[Geography].[City].[ALL].[AllMember].[Berlin]"]}", - "owners": [ - "admin", - ], - "readers": [ - "admin", - ], - }, - }, - "settings": { - "entry": { - "content": "{"theme":"dark-activeviam","search.maxResults":10,"userFilters.areEnabled":true,"drillthrough.defaultSelectedColumns":{"EquityDerivativesCube":["delta","gamma","pnlVega","Desk","Currency","Date","HostName"],"EquityDerivativesCubeDist":["BumpedMtmDown","ProductQtyMultiplier","vega","rho","productId","pnlVega","pnlDelta","pnl","gamma","delta","TradeId","ProductBaseMtm"]}}", - "owners": [ - "admin", - ], - "readers": [ - "admin", - ], - }, - }, - }, - "entry": { - "canRead": true, - "canWrite": true, - "isDirectory": true, - "lastEditor": "admin", - "owners": [ - "admin", - ], - "readers": [ - "admin", - ], - "timestamp": 1607879735685, - }, - }, - "user1": { - "children": { - "activity": { - "entry": { - "content": "{}", - "owners": [ - "user1", - ], - "readers": [ - "user1", - ], - }, - }, - "settings": { - "entry": { - "content": "{}", - "owners": [ - "user1", - ], - "readers": [ - "user1", - ], - }, - }, - }, - "entry": { - "canRead": true, - "canWrite": true, - "isDirectory": true, - "lastEditor": "admin", - "owners": [ - "user1", - ], - "readers": [ - "user1", - ], - "timestamp": 1607879735685, - }, - }, - }, "entry": { "isDirectory": true, "owners": [ diff --git a/src/4.3_to_5.0/__test_resources__/legacyDashboardBookmark.ts b/src/4.3_to_5.0/__test_resources__/legacyDashboardBookmark.ts new file mode 100644 index 00000000..03d601d8 --- /dev/null +++ b/src/4.3_to_5.0/__test_resources__/legacyDashboardBookmark.ts @@ -0,0 +1,16 @@ +/** + * Content entry representing a legacy dashboard containing a single pivot table. + * Useful for unit tests. + */ +export const legacyDashboardBookmark = { + entry: { + content: `{"name":"hidden grand totals","type":"container","value":{"style":{},"showTitleBar":false,"body":{"pages":[{"content":[{"key":"1","bookmark":{"name":"Untitled Pivot Table","type":"container","value":{"style":{},"showTitleBar":true,"body":{"serverUrl":"","mdx":"SELECT NON EMPTY Crossjoin(Hierarchize(DrilldownLevel([Geography].[City].[ALL].[AllMember])), Hierarchize(DrilldownLevel([Currency].[Currency].[ALL].[AllMember]))) ON ROWS, NON EMPTY [Measures].[contributors.COUNT] ON COLUMNS FROM [EquityDerivativesCube] CELL PROPERTIES VALUE, FORMATTED_VALUE, BACK_COLOR, FORE_COLOR, FONT_FLAGS","contextValues":{"mdx.hiddengrandtotals":"1"},"updateMode":"once","ranges":{"row":{"chunkSize":2000,"thresholdPercentage":0.1},"column":{"chunkSize":50,"thresholdPercentage":0.2}},"configuration":{"tabular":{"pinnedHeaderSelector":"member","sortingMode":"non-breaking","addButtonFilter":"numeric","cellRenderers":["tree-layout"],"statisticsShown":true,"columnsGroups":[{"captionProducer":"firstColumn","cellFactory":"kpi-status","selector":"kpi-status"},{"captionProducer":"firstColumn","cellFactory":"lookup","selector":"lookup"},{"captionProducer":"expiry","cellFactory":"expiry","selector":"kpi-expiry"},{"captionProducer":"columnMerge","cellFactory":{"args":{},"key":"treeCells"},"selector":"member"}],"hideAddButton":true,"defaultOptions":{},"expansion":{"automaticExpansion":true}}}},"containerKey":"pivot-table"},"writable":true}},{"key":"2","bookmark":{"name":"Untitled Chart","type":"container","value":{"style":{},"showTitleBar":true,"body":{"configuration":{"type":"plotly-line-chart","mapping":{"xAxis":["[Currency].[Currency].[Currency]"],"values":["[Measures].[pnl.FOREX]"],"splitBy":["[Booking].[Desk].[LegalEntity]"],"horizontalSubplots":[],"verticalSubplots":[]},"switchedTo":"plotly-clustered-column-chart"},"query":{"serverUrl":"","mdx":"SELECT NON EMPTY Crossjoin(Hierarchize(DrilldownLevel([Currency].[Currency])), Hierarchize(DrilldownLevel([Booking].[Desk].[ALL].[AllMember]))) ON ROWS, NON EMPTY [Measures].[pnl.FOREX] ON COLUMNS FROM [EquityDerivativesCube]","contextValues":{},"updateMode":"once"}},"containerKey":"chart"},"writable":true}}],"layout":{"children":{"0":{"ck":"2"},"1":{"ck":"1"}},"direction":"row"},"name":"Page 1","filters":{"EquityDerivativesCube":[]}}]},"containerKey":"dashboard"}}`, + isDirectory: false, + owners: ["admin"], + readers: ["admin"], + timestamp: 1607879735685, + lastEditor: "admin", + canRead: true, + canWrite: true, + }, +}; diff --git a/src/4.3_to_5.0/__test_resources__/legacyInvalidDashboardBookmark.ts b/src/4.3_to_5.0/__test_resources__/legacyInvalidDashboardBookmark.ts new file mode 100644 index 00000000..315ec2b2 --- /dev/null +++ b/src/4.3_to_5.0/__test_resources__/legacyInvalidDashboardBookmark.ts @@ -0,0 +1,17 @@ +/** + * Legacy content entry representing a bookmark of an invalid dashboard. + * Useful for unit tests. + */ +export const legacyInvalidDashboardBookmark = { + entry: { + content: + '{"name":"hidden grand totals","type":"container","value":{"style":{},"showTitleBar":false,"body":{"pages":[{"content":[{"key":"1","bookmark":{"name":"Untitled Pivot Table","type":"container","value":{"style":{},"showTitleBar":true,"body":{"serverUrl":"","mdx":"SELECT NON EMPTY Crossjoin(Hierarchize(DrilldownLevel([Geography].[City].[ALL].[AllMember])), Hierarchize(DrilldownLevel([Currency].[Currency].[ALL].[AllMember]))) ON ROWS, NON EMPTY [Measures].[contributors.COUNT] ON COLUMNS FROM [foo] CELL PROPERTIES VALUE, FORMATTED_VALUE, BACK_COLOR, FORE_COLOR, FONT_FLAGS","contextValues":{"mdx.hiddengrandtotals":"1"},"updateMode":"once","ranges":{"row":{"chunkSize":2000,"thresholdPercentage":0.1},"column":{"chunkSize":50,"thresholdPercentage":0.2}},"configuration":{"tabular":{"pinnedHeaderSelector":"member","sortingMode":"non-breaking","addButtonFilter":"numeric","cellRenderers":["tree-layout"],"statisticsShown":true,"columnsGroups":[{"captionProducer":"firstColumn","cellFactory":"kpi-status","selector":"kpi-status"},{"captionProducer":"firstColumn","cellFactory":"lookup","selector":"lookup"},{"captionProducer":"expiry","cellFactory":"expiry","selector":"kpi-expiry"},{"captionProducer":"columnMerge","cellFactory":{"args":{},"key":"treeCells"},"selector":"member"}],"hideAddButton":true,"defaultOptions":{},"expansion":{"automaticExpansion":true}}}},"containerKey":"pivot-table"},"writable":true}},{"key":"2","bookmark":{"name":"Untitled Chart","type":"container","value":{"style":{},"showTitleBar":true,"body":{"configuration":{"type":"plotly-line-chart","mapping":{"xAxis":["[Currency].[Currency].[Currency]"],"values":["[Measures].[pnl.FOREX]"],"splitBy":["[Booking].[Desk].[LegalEntity]"],"horizontalSubplots":[],"verticalSubplots":[]},"switchedTo":"plotly-clustered-column-chart"},"query":{"serverUrl":"","mdx":"SELECT NON EMPTY Crossjoin(Hierarchize(DrilldownLevel([Currency].[Currency])), Hierarchize(DrilldownLevel([Booking].[Desk].[ALL].[AllMember]))) ON ROWS, NON EMPTY [Measures].[pnl.FOREX] ON COLUMNS FROM [EquityDerivativesCube]","contextValues":{},"updateMode":"once"}},"containerKey":"chart"},"writable":true}}],"layout":{"children":{"0":{"ck":"2"},"1":{"ck":"1"}},"direction":"row"},"name":"Page 1","filters":{"EquityDerivativesCube":[]}}]},"containerKey":"dashboard"}}', + isDirectory: false, + owners: ["admin"], + readers: ["admin"], + timestamp: 1607879735685, + lastEditor: "admin", + canRead: true, + canWrite: true, + }, +}; diff --git a/src/4.3_to_5.0/__test_resources__/legacyInvalidFilterBookmark.ts b/src/4.3_to_5.0/__test_resources__/legacyInvalidFilterBookmark.ts new file mode 100644 index 00000000..086cc0db --- /dev/null +++ b/src/4.3_to_5.0/__test_resources__/legacyInvalidFilterBookmark.ts @@ -0,0 +1,17 @@ +/** + * Content entry representing a legacy filter containing an invalid property + * Useful for unit tests. + */ +export const legacyInvalidFilterBookmark = { + entry: { + content: + '{"name":"AUI4 filter","type":"mdx","invalidvalue":{"shouldReplace":true,"type":"filter","mdx":"{[Geography].[City].[ALL].[AllMember].[Berlin], [Geography].[City].[ALL].[AllMember].[London]}","cube":"EquityDerivativesCube"}}', + isDirectory: false, + owners: ["admin"], + readers: ["admin"], + timestamp: 1607879735685, + lastEditor: "admin", + canRead: true, + canWrite: true, + }, +}; diff --git a/src/4.3_to_5.0/__test_resources__/smallLegacyUIFolder.ts b/src/4.3_to_5.0/__test_resources__/smallLegacyUIFolder.ts index aeb3ad70..e00cc382 100644 --- a/src/4.3_to_5.0/__test_resources__/smallLegacyUIFolder.ts +++ b/src/4.3_to_5.0/__test_resources__/smallLegacyUIFolder.ts @@ -1,240 +1,11 @@ +import { addLegacyBookmarkToUIFolder } from "./addLegacyBookmarkToUIFolder"; +import { emptyLegacyUIFolder } from "./emptyLegacyUIFolder"; +import { legacyDashboardBookmark } from "./legacyDashboardBookmark"; + /** * The shortened version of the content of the /ui folder on a Content Server, useful for unit tests. */ -export const smallLegacyUIFolder = { - entry: { - isDirectory: true, - owners: ["admin"], - readers: ["admin"], - timestamp: 1607879725132, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - children: { - bookmarks: { - entry: { - isDirectory: true, - owners: ["ROLE_CS_ROOT"], - readers: ["ROLE_USER"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - children: { - content: { - entry: { - isDirectory: true, - owners: ["ROLE_USER"], - readers: ["ROLE_USER"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - children: { - "158": { - entry: { - content: - '{"name":"hidden grand totals","type":"container","value":{"style":{},"showTitleBar":false,"body":{"pages":[{"content":[{"key":"1","bookmark":{"name":"Untitled Pivot Table","type":"container","value":{"style":{},"showTitleBar":true,"body":{"serverUrl":"","mdx":"SELECT NON EMPTY Crossjoin(Hierarchize(DrilldownLevel([Geography].[City].[ALL].[AllMember])), Hierarchize(DrilldownLevel([Currency].[Currency].[ALL].[AllMember]))) ON ROWS, NON EMPTY [Measures].[contributors.COUNT] ON COLUMNS FROM [EquityDerivativesCube] CELL PROPERTIES VALUE, FORMATTED_VALUE, BACK_COLOR, FORE_COLOR, FONT_FLAGS","contextValues":{"mdx.hiddengrandtotals":"1"},"updateMode":"once","ranges":{"row":{"chunkSize":2000,"thresholdPercentage":0.1},"column":{"chunkSize":50,"thresholdPercentage":0.2}},"configuration":{"tabular":{"pinnedHeaderSelector":"member","sortingMode":"non-breaking","addButtonFilter":"numeric","cellRenderers":["tree-layout"],"statisticsShown":true,"columnsGroups":[{"captionProducer":"firstColumn","cellFactory":"kpi-status","selector":"kpi-status"},{"captionProducer":"firstColumn","cellFactory":"lookup","selector":"lookup"},{"captionProducer":"expiry","cellFactory":"expiry","selector":"kpi-expiry"},{"captionProducer":"columnMerge","cellFactory":{"args":{},"key":"treeCells"},"selector":"member"}],"hideAddButton":true,"defaultOptions":{},"expansion":{"automaticExpansion":true}}}},"containerKey":"pivot-table"},"writable":true}},{"key":"2","bookmark":{"name":"Untitled Chart","type":"container","value":{"style":{},"showTitleBar":true,"body":{"configuration":{"type":"plotly-line-chart","mapping":{"xAxis":["[Currency].[Currency].[Currency]"],"values":["[Measures].[pnl.FOREX]"],"splitBy":["[Booking].[Desk].[LegalEntity]"],"horizontalSubplots":[],"verticalSubplots":[]},"switchedTo":"plotly-clustered-column-chart"},"query":{"serverUrl":"","mdx":"SELECT NON EMPTY Crossjoin(Hierarchize(DrilldownLevel([Currency].[Currency])), Hierarchize(DrilldownLevel([Booking].[Desk].[ALL].[AllMember]))) ON ROWS, NON EMPTY [Measures].[pnl.FOREX] ON COLUMNS FROM [EquityDerivativesCube]","contextValues":{},"updateMode":"once"}},"containerKey":"chart"},"writable":true}}],"layout":{"children":{"0":{"ck":"2"},"1":{"ck":"1"}},"direction":"row"},"name":"Page 1","filters":{"EquityDerivativesCube":[]}}]},"containerKey":"dashboard"}}', - isDirectory: false, - owners: ["admin"], - readers: ["admin"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - }, - }, - }, - i18n: { - entry: { - isDirectory: true, - owners: ["ROLE_CS_ROOT"], - readers: ["ROLE_USER"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - children: { - "en-US": { - entry: { - isDirectory: true, - owners: ["ROLE_CS_ROOT"], - readers: ["ROLE_USER"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - }, - "fr-FR": { - entry: { - isDirectory: true, - owners: ["ROLE_CS_ROOT"], - readers: ["ROLE_USER"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - }, - }, - }, - structure: { - entry: { - isDirectory: true, - owners: ["ROLE_USER"], - readers: ["ROLE_USER"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - children: { - "158": { - entry: { - isDirectory: true, - owners: ["admin"], - readers: ["admin"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - }, - }, - }, - }, - }, - settings: { - entry: { - isDirectory: true, - owners: ["ROLE_CS_ROOT"], - readers: ["ROLE_USER"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - children: { - default: { - entry: { - isDirectory: true, - owners: ["ROLE_CS_ROOT"], - readers: ["ROLE_USER"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - children: { - preferences: { - entry: { - content: '{\n "allow": [],\n "deny": [],\n "map": {}\n}', - isDirectory: false, - owners: ["ROLE_CS_ROOT"], - readers: ["ROLE_USER"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - }, - }, - }, - roles: { - entry: { - isDirectory: true, - owners: ["ROLE_CS_ROOT"], - readers: ["ROLE_USER"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - }, - users: { - entry: { - isDirectory: true, - owners: ["ROLE_USER"], - readers: ["ROLE_USER"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - children: { - user1: { - entry: { - isDirectory: true, - owners: ["user1"], - readers: ["user1"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - children: { - preferences: { - entry: { - content: - '{\n "map": {\n "defaultPermissions": {\n "owners": [\n "user2"\n ],\n "readers": [\n "user2"\n ]\n }\n }\n}', - isDirectory: false, - owners: ["user1"], - readers: ["user1"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - }, - }, - }, - admin: { - entry: { - isDirectory: true, - owners: ["admin"], - readers: ["admin"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - children: { - preferences: { - entry: { - content: - '{\n "map": {\n "tree.search.maxResults": 10,\n "global.theme": "dark-activeviam",\n "userFilters.enabled": true,\n "showLegacyCharts": true,\n "showLegacyMaps": true,\n "widgets.Tabular.drillthrough.selectedColumns": {\n "https://activepivot-ranch.activeviam.com:5900": {\n "EquityDerivativesCube": [\n {\n "functionName": "MemberValue",\n "columnName": "delta"\n },\n {\n "functionName": "Caption",\n "columnName": "delta"\n },\n {\n "functionName": "MemberValue",\n "columnName": "gamma"\n },\n {\n "functionName": "Caption",\n "columnName": "gamma"\n },\n {\n "functionName": "MemberValue",\n "columnName": "pnlVega"\n },\n {\n "functionName": "Caption",\n "columnName": "pnlVega"\n },\n {\n "functionName": "MemberValue",\n "columnName": "Desk"\n },\n {\n "functionName": "Caption",\n "columnName": "Desk"\n },\n {\n "functionName": "MemberValue",\n "columnName": "Currency"\n },\n {\n "functionName": "Caption",\n "columnName": "Currency"\n },\n {\n "functionName": "MemberValue",\n "columnName": "Date"\n },\n {\n "functionName": "Caption",\n "columnName": "Date"\n },\n {\n "columnName": "HostName",\n "functionName": "MemberValue"\n },\n {\n "columnName": "HostName",\n "functionName": "Caption"\n }\n ],\n "EquityDerivativesCubeDist": [\n {\n "functionName": "MemberValue",\n "columnName": "BumpedMtmDown"\n },\n {\n "functionName": "Caption",\n "columnName": "BumpedMtmDown"\n },\n {\n "functionName": "MemberValue",\n "columnName": "ProductQtyMultiplier"\n },\n {\n "functionName": "Caption",\n "columnName": "ProductQtyMultiplier"\n },\n {\n "functionName": "MemberValue",\n "columnName": "ProductQtyMultiplier"\n },\n {\n "functionName": "Caption",\n "columnName": "ProductQtyMultiplier"\n },\n {\n "functionName": "MemberValue",\n "columnName": "vega"\n },\n {\n "functionName": "Caption",\n "columnName": "vega"\n },\n {\n "functionName": "MemberValue",\n "columnName": "rho"\n },\n {\n "functionName": "Caption",\n "columnName": "rho"\n },\n {\n "functionName": "MemberValue",\n "columnName": "productId"\n },\n {\n "functionName": "Caption",\n "columnName": "productId"\n },\n {\n "functionName": "MemberValue",\n "columnName": "pnlVega"\n },\n {\n "functionName": "Caption",\n "columnName": "pnlVega"\n },\n {\n "functionName": "MemberValue",\n "columnName": "pnlDelta"\n },\n {\n "functionName": "Caption",\n "columnName": "pnlDelta"\n },\n {\n "functionName": "MemberValue",\n "columnName": "pnl"\n },\n {\n "functionName": "Caption",\n "columnName": "pnl"\n },\n {\n "functionName": "MemberValue",\n "columnName": "gamma"\n },\n {\n "functionName": "Caption",\n "columnName": "gamma"\n },\n {\n "functionName": "MemberValue",\n "columnName": "delta"\n },\n {\n "functionName": "Caption",\n "columnName": "delta"\n },\n {\n "functionName": "MemberValue",\n "columnName": "TradeId"\n },\n {\n "functionName": "Caption",\n "columnName": "TradeId"\n },\n {\n "functionName": "MemberValue",\n "columnName": "ProductQtyMultiplier"\n },\n {\n "functionName": "Caption",\n "columnName": "ProductQtyMultiplier"\n },\n {\n "functionName": "MemberValue",\n "columnName": "ProductQtyMultiplier"\n },\n {\n "functionName": "Caption",\n "columnName": "ProductQtyMultiplier"\n },\n {\n "functionName": "MemberValue",\n "columnName": "ProductBaseMtm"\n },\n {\n "functionName": "Caption",\n "columnName": "ProductBaseMtm"\n },\n {\n "columnName": "ProductQtyMultiplier",\n "functionName": "MemberValue"\n },\n {\n "columnName": "ProductQtyMultiplier",\n "functionName": "Caption"\n }\n ]\n }\n },\n "defaultPermissions": {\n "owners": [\n "admin"\n ],\n "readers": [\n "admin"\n ]\n },\n "project.content-editor.configuration": {\n "autoSwitchToFieldsOnEmptyWidget": true,\n "advancedModeDropdownHidden": false,\n "hideFieldsControls": false,\n "mdx-common": {\n "regularModeTab": "filters",\n "advancedModeEnabled": false,\n "advancedModeTab": "mdx"\n }\n },\n "user.contextValues": {\n "EquityDerivativesCube": {},\n "EquityDerivativesCubeDist": {}\n },\n "user.filters": {\n "EquityDerivativesCube": ["[Geography].[City].[ALL].[AllMember].[Berlin]"],\n "EquityDerivativesCubeDist": []\n },\n "filtering.hierarchyToFilterType.[Geography].[City]": "explicit",\n "filtering.hierarchyToFilterType.[Currency].[Currency]": "explicit",\n "filtering.hierarchyToFilterType.[Trades].[Trades]": "topcount",\n "servers.alias": {\n "https://activepivot-ranch.activeviam.com:5900": "http://localhost:8080"\n }\n }\n}', - isDirectory: false, - owners: ["admin"], - readers: ["admin"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - }, - }, - }, - }, - }, - }, - }, - version: { - entry: { - content: '{"package":"4.3.8","contentServerApi":"0.1.0"}', - isDirectory: false, - owners: ["ROLE_CS_ROOT"], - readers: ["ROLE_USER"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - }, - }, -}; +export const smallLegacyUIFolder = addLegacyBookmarkToUIFolder( + emptyLegacyUIFolder, + { "158": legacyDashboardBookmark }, +); diff --git a/src/4.3_to_5.0/__test_resources__/smallLegacyUIFolderWithInvalidDashboard.ts b/src/4.3_to_5.0/__test_resources__/smallLegacyUIFolderWithInvalidDashboard.ts index 713fbb95..e06eacf4 100644 --- a/src/4.3_to_5.0/__test_resources__/smallLegacyUIFolderWithInvalidDashboard.ts +++ b/src/4.3_to_5.0/__test_resources__/smallLegacyUIFolderWithInvalidDashboard.ts @@ -1,138 +1,12 @@ +import { addLegacyBookmarkToUIFolder } from "./addLegacyBookmarkToUIFolder"; +import { emptyLegacyUIFolder } from "./emptyLegacyUIFolder"; +import { legacyInvalidDashboardBookmark } from "./legacyInvalidDashboardBookmark"; + /** * The shortened version of the content of the /ui folder on a Content Server, useful for unit tests. * Contains an invalid dashboard whose id is numerical. */ -export const smallLegacyUIFolderWithInvalidDashboard = { - entry: { - isDirectory: true, - owners: ["admin"], - readers: ["admin"], - timestamp: 1607879725132, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - children: { - bookmarks: { - entry: { - isDirectory: true, - owners: ["ROLE_CS_ROOT"], - readers: ["ROLE_USER"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - children: { - content: { - entry: { - isDirectory: true, - owners: ["ROLE_USER"], - readers: ["ROLE_USER"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - children: { - "158": { - entry: { - content: - '{"name":"hidden grand totals","type":"container","value":{"style":{},"showTitleBar":false,"body":{"pages":[{"content":[{"key":"1","bookmark":{"name":"Untitled Pivot Table","type":"container","value":{"style":{},"showTitleBar":true,"body":{"serverUrl":"","mdx":"SELECT NON EMPTY Crossjoin(Hierarchize(DrilldownLevel([Geography].[City].[ALL].[AllMember])), Hierarchize(DrilldownLevel([Currency].[Currency].[ALL].[AllMember]))) ON ROWS, NON EMPTY [Measures].[contributors.COUNT] ON COLUMNS FROM [foo] CELL PROPERTIES VALUE, FORMATTED_VALUE, BACK_COLOR, FORE_COLOR, FONT_FLAGS","contextValues":{"mdx.hiddengrandtotals":"1"},"updateMode":"once","ranges":{"row":{"chunkSize":2000,"thresholdPercentage":0.1},"column":{"chunkSize":50,"thresholdPercentage":0.2}},"configuration":{"tabular":{"pinnedHeaderSelector":"member","sortingMode":"non-breaking","addButtonFilter":"numeric","cellRenderers":["tree-layout"],"statisticsShown":true,"columnsGroups":[{"captionProducer":"firstColumn","cellFactory":"kpi-status","selector":"kpi-status"},{"captionProducer":"firstColumn","cellFactory":"lookup","selector":"lookup"},{"captionProducer":"expiry","cellFactory":"expiry","selector":"kpi-expiry"},{"captionProducer":"columnMerge","cellFactory":{"args":{},"key":"treeCells"},"selector":"member"}],"hideAddButton":true,"defaultOptions":{},"expansion":{"automaticExpansion":true}}}},"containerKey":"pivot-table"},"writable":true}},{"key":"2","bookmark":{"name":"Untitled Chart","type":"container","value":{"style":{},"showTitleBar":true,"body":{"configuration":{"type":"plotly-line-chart","mapping":{"xAxis":["[Currency].[Currency].[Currency]"],"values":["[Measures].[pnl.FOREX]"],"splitBy":["[Booking].[Desk].[LegalEntity]"],"horizontalSubplots":[],"verticalSubplots":[]},"switchedTo":"plotly-clustered-column-chart"},"query":{"serverUrl":"","mdx":"SELECT NON EMPTY Crossjoin(Hierarchize(DrilldownLevel([Currency].[Currency])), Hierarchize(DrilldownLevel([Booking].[Desk].[ALL].[AllMember]))) ON ROWS, NON EMPTY [Measures].[pnl.FOREX] ON COLUMNS FROM [EquityDerivativesCube]","contextValues":{},"updateMode":"once"}},"containerKey":"chart"},"writable":true}}],"layout":{"children":{"0":{"ck":"2"},"1":{"ck":"1"}},"direction":"row"},"name":"Page 1","filters":{"EquityDerivativesCube":[]}}]},"containerKey":"dashboard"}}', - isDirectory: false, - owners: ["admin"], - readers: ["admin"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - }, - }, - }, - i18n: { - entry: { - isDirectory: true, - owners: ["ROLE_CS_ROOT"], - readers: ["ROLE_USER"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - children: { - "en-US": { - entry: { - isDirectory: true, - owners: ["ROLE_CS_ROOT"], - readers: ["ROLE_USER"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - }, - "fr-FR": { - entry: { - isDirectory: true, - owners: ["ROLE_CS_ROOT"], - readers: ["ROLE_USER"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - }, - }, - }, - structure: { - entry: { - isDirectory: true, - owners: ["ROLE_USER"], - readers: ["ROLE_USER"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - children: { - "158": { - entry: { - isDirectory: true, - owners: ["admin"], - readers: ["admin"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - }, - }, - }, - }, - }, - settings: { - entry: { - isDirectory: true, - owners: ["ROLE_CS_ROOT"], - readers: ["ROLE_USER"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - }, - version: { - entry: { - content: '{"package":"4.3.8","contentServerApi":"0.1.0"}', - isDirectory: false, - owners: ["ROLE_CS_ROOT"], - readers: ["ROLE_USER"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - }, - }, -}; +export const smallLegacyUIFolderWithInvalidDashboard = + addLegacyBookmarkToUIFolder(emptyLegacyUIFolder, { + "158": legacyInvalidDashboardBookmark, + }); diff --git a/src/4.3_to_5.0/__test_resources__/smallLegacyUIFolderWithInvalidFilter.ts b/src/4.3_to_5.0/__test_resources__/smallLegacyUIFolderWithInvalidFilter.ts index 7fee55e3..87fff2c7 100644 --- a/src/4.3_to_5.0/__test_resources__/smallLegacyUIFolderWithInvalidFilter.ts +++ b/src/4.3_to_5.0/__test_resources__/smallLegacyUIFolderWithInvalidFilter.ts @@ -1,139 +1,12 @@ +import { addLegacyBookmarkToUIFolder } from "./addLegacyBookmarkToUIFolder"; +import { emptyLegacyUIFolder } from "./emptyLegacyUIFolder"; +import { legacyInvalidFilterBookmark } from "./legacyInvalidFilterBookmark"; + /** * The shortened version of the content of the /ui folder on a Content Server, useful for unit tests. * Contains an invalid filter. */ -export const smallLegacyUIFolderWithInvalidFilter = { - entry: { - isDirectory: true, - owners: ["admin"], - readers: ["admin"], - timestamp: 1607879725132, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - children: { - bookmarks: { - entry: { - isDirectory: true, - owners: ["ROLE_CS_ROOT"], - readers: ["ROLE_USER"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - children: { - content: { - entry: { - isDirectory: true, - owners: ["ROLE_USER"], - readers: ["ROLE_USER"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - children: { - "158": { - entry: { - content: - '{"name":"AUI4 filter","type":"mdx","invalidvalue":{"shouldReplace":true,"type":"filter","mdx":"{[Geography].[City].[ALL].[AllMember].[Berlin], [Geography].[City].[ALL].[AllMember].[London]}","cube":"EquityDerivativesCube"}}', - isDirectory: false, - owners: ["admin"], - readers: ["admin"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - }, - }, - }, - i18n: { - entry: { - isDirectory: true, - owners: ["ROLE_CS_ROOT"], - readers: ["ROLE_USER"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - children: { - "en-US": { - entry: { - isDirectory: true, - owners: ["ROLE_CS_ROOT"], - readers: ["ROLE_USER"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - }, - "fr-FR": { - entry: { - isDirectory: true, - owners: ["ROLE_CS_ROOT"], - readers: ["ROLE_USER"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - }, - }, - }, - structure: { - entry: { - isDirectory: true, - owners: ["ROLE_USER"], - readers: ["ROLE_USER"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - children: { - "158": { - entry: { - isDirectory: true, - owners: ["admin"], - readers: ["admin"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - }, - }, - }, - }, - }, - settings: { - entry: { - isDirectory: true, - owners: ["ROLE_CS_ROOT"], - readers: ["ROLE_USER"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - children: {}, - }, - version: { - entry: { - content: '{"package":"4.3.8","contentServerApi":"0.1.0"}', - isDirectory: false, - owners: ["ROLE_CS_ROOT"], - readers: ["ROLE_USER"], - timestamp: 1607879735685, - lastEditor: "admin", - canRead: true, - canWrite: true, - }, - }, - }, -}; +export const smallLegacyUIFolderWithInvalidFilter = addLegacyBookmarkToUIFolder( + emptyLegacyUIFolder, + { "158": legacyInvalidFilterBookmark }, +);