[ACS-5281] Changed editable state of metadata content based on change o… (#3400)

* ACS-5281 Changed editable state of metadata content based on change of file lock state

* ACS-5281 Updated versions

* ACS-5281 Reverted change

* ACS-5281 Upgrade version

* ACS-5281 Small correction

* ACS-5281 Fixed e2e
This commit is contained in:
AleksanderSklorz 2023-08-27 10:00:35 +02:00 committed by GitHub
parent bc9c58176f
commit aec6852672
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
45 changed files with 455 additions and 364 deletions

View File

@ -23,7 +23,6 @@
*/ */
import { AdminActions, UserActions, LoginPage, BrowsingPage, RepoClient, InfoDrawer, Utils } from '@alfresco/aca-testing-shared'; import { AdminActions, UserActions, LoginPage, BrowsingPage, RepoClient, InfoDrawer, Utils } from '@alfresco/aca-testing-shared';
const moment = require('moment');
import { BrowserActions } from '@alfresco/adf-testing'; import { BrowserActions } from '@alfresco/adf-testing';
describe('Comments', () => { describe('Comments', () => {
@ -215,7 +214,7 @@ describe('Comments', () => {
expect(await commentsTab.isCommentDisplayed()).toBe(true, `Comment is not displayed`); expect(await commentsTab.isCommentDisplayed()).toBe(true, `Comment is not displayed`);
expect(await commentsTab.getCommentText()).toBe(commentFile1Entry.content, 'Incorrect comment text'); expect(await commentsTab.getCommentText()).toBe(commentFile1Entry.content, 'Incorrect comment text');
expect(await commentsTab.getCommentUserName()).toBe(`${username} ${username}`, 'Incorrect comment user'); expect(await commentsTab.getCommentUserName()).toBe(`${username} ${username}`, 'Incorrect comment user');
expect(await commentsTab.getCommentTime()).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time'); expect(await commentsTab.getCommentTime()).toBe('less than a minute ago', 'Incorrect comment created time');
expect(await commentsTab.isCommentUserAvatarDisplayed()).toBe(true, 'User avatar not displayed'); expect(await commentsTab.isCommentUserAvatarDisplayed()).toBe(true, 'User avatar not displayed');
}); });
}); });

203
package-lock.json generated
View File

@ -10,11 +10,11 @@
"hasInstallScript": true, "hasInstallScript": true,
"license": "LGPL-3.0", "license": "LGPL-3.0",
"dependencies": { "dependencies": {
"@alfresco/adf-content-services": "6.3.0-5833590093", "@alfresco/adf-content-services": "6.3.0-5977252204",
"@alfresco/adf-core": "6.3.0-5833590093", "@alfresco/adf-core": "6.3.0-5977252204",
"@alfresco/adf-extensions": "6.3.0-5833590093", "@alfresco/adf-extensions": "6.3.0-5977252204",
"@alfresco/eslint-plugin-eslint-angular": "6.3.0-5833590093", "@alfresco/eslint-plugin-eslint-angular": "6.3.0-5977252204",
"@alfresco/js-api": "6.3.0-1104", "@alfresco/js-api": "6.3.0-1172",
"@angular/animations": "14.1.3", "@angular/animations": "14.1.3",
"@angular/cdk": "14.1.3", "@angular/cdk": "14.1.3",
"@angular/common": "14.1.3", "@angular/common": "14.1.3",
@ -46,8 +46,8 @@
"zone.js": "0.11.8" "zone.js": "0.11.8"
}, },
"devDependencies": { "devDependencies": {
"@alfresco/adf-cli": "6.3.0-5833590093", "@alfresco/adf-cli": "6.3.0-5977252204",
"@alfresco/adf-testing": "6.3.0-5833590093", "@alfresco/adf-testing": "6.3.0-5977252204",
"@angular-devkit/build-angular": "14.2.11", "@angular-devkit/build-angular": "14.2.11",
"@angular-devkit/core": "14.1.2", "@angular-devkit/core": "14.1.2",
"@angular-devkit/schematics": "14.1.2", "@angular-devkit/schematics": "14.1.2",
@ -120,12 +120,12 @@
"dev": true "dev": true
}, },
"node_modules/@alfresco/adf-cli": { "node_modules/@alfresco/adf-cli": {
"version": "6.3.0-5833590093", "version": "6.3.0-5977252204",
"resolved": "https://registry.npmjs.org/@alfresco/adf-cli/-/adf-cli-6.3.0-5833590093.tgz", "resolved": "https://registry.npmjs.org/@alfresco/adf-cli/-/adf-cli-6.3.0-5977252204.tgz",
"integrity": "sha512-X0h8jCF1SZGkr3qgbGbY27Tu2wVJgahyCn/4gyGKYW+10bxt6pC3ESkXdKHd9f7SWfmu/lmMdDpw/9ZUAbIrWg==", "integrity": "sha512-Qx+Qc6tcmdQlubsz0VCpPvsYPOD/w6OLQHMrORFDdjc+Xol5zREsOgEuL0X6rxX5z3cZmxDoAflK1VV2188myA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@alfresco/js-api": ">=6.3.0-1070", "@alfresco/js-api": ">=6.3.0-1108",
"commander": "^6.2.1", "commander": "^6.2.1",
"ejs": "^3.1.9", "ejs": "^3.1.9",
"license-checker": "^25.0.1", "license-checker": "^25.0.1",
@ -140,15 +140,15 @@
} }
}, },
"node_modules/@alfresco/adf-content-services": { "node_modules/@alfresco/adf-content-services": {
"version": "6.3.0-5833590093", "version": "6.3.0-5977252204",
"resolved": "https://registry.npmjs.org/@alfresco/adf-content-services/-/adf-content-services-6.3.0-5833590093.tgz", "resolved": "https://registry.npmjs.org/@alfresco/adf-content-services/-/adf-content-services-6.3.0-5977252204.tgz",
"integrity": "sha512-Lz0vyi1nzlnbxIXlBJwrfDZj81JM806HbVuHgikq/mHMCRT1Q4lA2martf74pMIOCJ820PxN+iTKDdoGgoqPDA==", "integrity": "sha512-fE6wYdeda+m+gYCTy+sE3UVPL2+ZJ+OF1H60SkLj9urKUPjZ7w+kf+PPi0BGmXUGT5eiECBQ8MtN/yxR66HsCg==",
"dependencies": { "dependencies": {
"tslib": "^2.3.0" "tslib": "^2.3.0"
}, },
"peerDependencies": { "peerDependencies": {
"@alfresco/adf-core": ">=6.3.0-5833590093", "@alfresco/adf-core": ">=6.3.0-5977252204",
"@alfresco/js-api": ">=6.3.0-1070", "@alfresco/js-api": ">=6.3.0-1108",
"@angular/animations": ">=14.1.3", "@angular/animations": ">=14.1.3",
"@angular/cdk": ">=14.1.2", "@angular/cdk": ">=14.1.2",
"@angular/common": ">=14.1.3", "@angular/common": ">=14.1.3",
@ -164,9 +164,9 @@
} }
}, },
"node_modules/@alfresco/adf-core": { "node_modules/@alfresco/adf-core": {
"version": "6.3.0-5833590093", "version": "6.3.0-5977252204",
"resolved": "https://registry.npmjs.org/@alfresco/adf-core/-/adf-core-6.3.0-5833590093.tgz", "resolved": "https://registry.npmjs.org/@alfresco/adf-core/-/adf-core-6.3.0-5977252204.tgz",
"integrity": "sha512-KPNNAtttdX+q0g/tUg3zi8nfieY6aRTR9Zp8o4ELjk5tIiS4SusPjcTe9wwZBUFXi85FzNu+/UJyLLgmcls8HQ==", "integrity": "sha512-3Di1lbtzAP2oKdOsR6Eit3DUNhpuAfp+LNegqXVNAofZxwB6aMdmbp1BhoNTQkxnUTk92yuACXBDWQ1xpXmOqA==",
"dependencies": { "dependencies": {
"angular-oauth2-oidc": "^13.0.1", "angular-oauth2-oidc": "^13.0.1",
"angular-oauth2-oidc-jwks": "^13.0.1", "angular-oauth2-oidc-jwks": "^13.0.1",
@ -174,8 +174,8 @@
"tslib": "^2.3.0" "tslib": "^2.3.0"
}, },
"peerDependencies": { "peerDependencies": {
"@alfresco/adf-extensions": ">=6.3.0-5833590093", "@alfresco/adf-extensions": ">=6.3.0-5977252204",
"@alfresco/js-api": ">=6.3.0-1070", "@alfresco/js-api": ">=6.3.0-1108",
"@angular/animations": ">=14.1.3", "@angular/animations": ">=14.1.3",
"@angular/cdk": ">=14.1.2", "@angular/cdk": ">=14.1.2",
"@angular/common": ">=14.1.3", "@angular/common": ">=14.1.3",
@ -193,25 +193,25 @@
} }
}, },
"node_modules/@alfresco/adf-extensions": { "node_modules/@alfresco/adf-extensions": {
"version": "6.3.0-5833590093", "version": "6.3.0-5977252204",
"resolved": "https://registry.npmjs.org/@alfresco/adf-extensions/-/adf-extensions-6.3.0-5833590093.tgz", "resolved": "https://registry.npmjs.org/@alfresco/adf-extensions/-/adf-extensions-6.3.0-5977252204.tgz",
"integrity": "sha512-KzvU9XEaM1C5tImEFoJP4bzQ8OqGqdqqCRuQJzbj3aQMoze1EtQOR3wtRpmEeaDsr9L63pBlJR09W9Hl6fjShg==", "integrity": "sha512-YjF87ZYiBwxlbw1NDzenZAQC9IiBjGs0Z2+7K6wgnDlXDzBAGx8uMyGVZLk0zxXVlhU4iQxs7vGD2nSoqlEgKw==",
"dependencies": { "dependencies": {
"tslib": "^2.3.0" "tslib": "^2.3.0"
}, },
"peerDependencies": { "peerDependencies": {
"@alfresco/js-api": ">=6.3.0-1070", "@alfresco/js-api": ">=6.3.0-1108",
"@angular/common": ">=14.1.3", "@angular/common": ">=14.1.3",
"@angular/core": ">=14.1.3" "@angular/core": ">=14.1.3"
} }
}, },
"node_modules/@alfresco/adf-testing": { "node_modules/@alfresco/adf-testing": {
"version": "6.3.0-5833590093", "version": "6.3.0-5977252204",
"resolved": "https://registry.npmjs.org/@alfresco/adf-testing/-/adf-testing-6.3.0-5833590093.tgz", "resolved": "https://registry.npmjs.org/@alfresco/adf-testing/-/adf-testing-6.3.0-5977252204.tgz",
"integrity": "sha512-6OwB6QPHfuRqoH4lx/37uRGLyobtbTrKtj+FavaMc+6KSZFSZicC3RME+cbBmwbJ2JQ0OSkJv7+WYKVhTNdElw==", "integrity": "sha512-itA2H/FzkNdmFJrwzkPFujWv7KaOCUL+xz86X5Vc7noPdKGbxt01f6h9WrnABXVLPqXZwBed/5xf7asLYtjCkQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@alfresco/js-api": "6.3.0-1070", "@alfresco/js-api": "6.3.0-1108",
"@angular/compiler": "14.1.3", "@angular/compiler": "14.1.3",
"@angular/core": "14.1.3", "@angular/core": "14.1.3",
"rxjs": "6.6.6", "rxjs": "6.6.6",
@ -219,80 +219,33 @@
"zone.js": "~0.11.4" "zone.js": "~0.11.4"
}, },
"peerDependencies": { "peerDependencies": {
"@alfresco/js-api": ">=6.3.0-1070" "@alfresco/js-api": ">=6.3.0-1108"
} }
}, },
"node_modules/@alfresco/adf-testing/node_modules/@alfresco/js-api": { "node_modules/@alfresco/adf-testing/node_modules/@alfresco/js-api": {
"version": "6.3.0-1070", "version": "6.3.0-1108",
"resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-6.3.0-1070.tgz", "resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-6.3.0-1108.tgz",
"integrity": "sha512-5E2TOA3Vsyw+HnAlSLSdXBL23wuOn9wh0+lX6lMqGDEFvbXGXedgxz8artrGFR6WOWy2ql364u6IX474R22e2A==", "integrity": "sha512-U7YlT6HVsO14OdTi4g0l4MckgugioSfHCUnoAk0KVDQWk/j5CKl+GGIq71mf2ram2L3o9XB/oNhbFSo2cfilTA==",
"dev": true, "dev": true,
"dependencies": {
"event-emitter": "^0.3.5",
"superagent": "^6.0.0",
"tslib": "^2.0.0"
}
},
"node_modules/@alfresco/eslint-plugin-eslint-angular": {
"version": "6.3.0-5833590093",
"resolved": "https://registry.npmjs.org/@alfresco/eslint-plugin-eslint-angular/-/eslint-plugin-eslint-angular-6.3.0-5833590093.tgz",
"integrity": "sha512-Pm32JJrLGW1fsJeLWjc4Un+u8mMWb3+UmrgCQEhH269Yxx3ZbB75QyPdc78JsFJRenCgaAUQexISsmn4E+OgcA=="
},
"node_modules/@alfresco/js-api": {
"version": "6.3.0-1104",
"resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-6.3.0-1104.tgz",
"integrity": "sha512-vzotSd8FB9xOCNyeVI6wn6wVlBumA9ku+uJf8CDTaLHEx57OCOWbhGMvf/D7Gkvz2bezyWwSwheND/28I4E7kQ==",
"dependencies": { "dependencies": {
"event-emitter": "^0.3.5", "event-emitter": "^0.3.5",
"superagent": "^8.0.9", "superagent": "^8.0.9",
"tslib": "^2.6.1" "tslib": "^2.6.1"
} }
}, },
"node_modules/@alfresco/js-api/node_modules/form-data": { "node_modules/@alfresco/eslint-plugin-eslint-angular": {
"version": "4.0.0", "version": "6.3.0-5977252204",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", "resolved": "https://registry.npmjs.org/@alfresco/eslint-plugin-eslint-angular/-/eslint-plugin-eslint-angular-6.3.0-5977252204.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", "integrity": "sha512-On5w7ZSYnyOf2NOA9rc3756S0Ms0GNAaIhBUFQkBQ7n5nHm5Y17yI9YpPh3n4Pag8IRH4lQSzZvfhiqocmtv0g=="
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
}, },
"node_modules/@alfresco/js-api/node_modules/formidable": { "node_modules/@alfresco/js-api": {
"version": "2.1.2", "version": "6.3.0-1172",
"resolved": "https://registry.npmjs.org/formidable/-/formidable-2.1.2.tgz", "resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-6.3.0-1172.tgz",
"integrity": "sha512-CM3GuJ57US06mlpQ47YcunuUZ9jpm8Vx+P2CGt2j7HpgkKZO/DJYQ0Bobim8G6PFQmK5lOqOOdUXboU+h73A4g==", "integrity": "sha512-JIf5qTijNp+RfC6R1iav88k2W8Sn0KRdONhN712+cwFRIBBT8Jx8oYHssyWQQdojHdI7dhi8bkaegpUIM1UWxw==",
"dependencies": { "dependencies": {
"dezalgo": "^1.0.4", "event-emitter": "^0.3.5",
"hexoid": "^1.0.0", "superagent": "^8.0.9",
"once": "^1.4.0", "tslib": "^2.6.1"
"qs": "^6.11.0"
},
"funding": {
"url": "https://ko-fi.com/tunnckoCore/commissions"
}
},
"node_modules/@alfresco/js-api/node_modules/superagent": {
"version": "8.0.9",
"resolved": "https://registry.npmjs.org/superagent/-/superagent-8.0.9.tgz",
"integrity": "sha512-4C7Bh5pyHTvU33KpZgwrNKh/VQnvgtCSqPRfJAUdmrtSYePVzVg4E4OzsrbkhJj9O7SO6Bnv75K/F8XVZT8YHA==",
"dependencies": {
"component-emitter": "^1.3.0",
"cookiejar": "^2.1.4",
"debug": "^4.3.4",
"fast-safe-stringify": "^2.1.1",
"form-data": "^4.0.0",
"formidable": "^2.1.2",
"methods": "^1.1.2",
"mime": "2.6.0",
"qs": "^6.11.0",
"semver": "^7.3.8"
},
"engines": {
"node": ">=6.4.0 <13 || >=14"
} }
}, },
"node_modules/@ampproject/remapping": { "node_modules/@ampproject/remapping": {
@ -9766,20 +9719,6 @@
"proxy-from-env": "^1.1.0" "proxy-from-env": "^1.1.0"
} }
}, },
"node_modules/axios/node_modules/form-data": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"dev": true,
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/axobject-query": { "node_modules/axobject-query": {
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-3.1.1.tgz", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-3.1.1.tgz",
@ -11495,9 +11434,9 @@
} }
}, },
"node_modules/cropperjs": { "node_modules/cropperjs": {
"version": "1.5.13", "version": "1.6.0",
"resolved": "https://registry.npmjs.org/cropperjs/-/cropperjs-1.5.13.tgz", "resolved": "https://registry.npmjs.org/cropperjs/-/cropperjs-1.6.0.tgz",
"integrity": "sha512-by7jKAo73y5/Do0K6sxdTKHgndY0NMjG2bEdgeJxycbcmHuCiMXqw8sxy5C5Y5WTOTcDGmbT7Sr5CgKOXR06OA==" "integrity": "sha512-BzLU/ecrfsbflwxgu+o7sQTrTlo52pVRZkTVrugEK5uyj6n8qKwAHP4s6+DWHqlXLqQ5B9+cM2MKeXiNfAsF6Q=="
}, },
"node_modules/cross-spawn": { "node_modules/cross-spawn": {
"version": "7.0.3", "version": "7.0.3",
@ -15424,10 +15363,9 @@
} }
}, },
"node_modules/form-data": { "node_modules/form-data": {
"version": "3.0.1", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"dev": true,
"dependencies": { "dependencies": {
"asynckit": "^0.4.0", "asynckit": "^0.4.0",
"combined-stream": "^1.0.8", "combined-stream": "^1.0.8",
@ -15438,11 +15376,15 @@
} }
}, },
"node_modules/formidable": { "node_modules/formidable": {
"version": "1.2.6", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.6.tgz", "resolved": "https://registry.npmjs.org/formidable/-/formidable-2.1.2.tgz",
"integrity": "sha512-KcpbcpuLNOwrEjnbpMC0gS+X8ciDoZE1kkqzat4a8vrprf+s9pKNQ/QIwWfbfs4ltgmFl3MD177SNTkve3BwGQ==", "integrity": "sha512-CM3GuJ57US06mlpQ47YcunuUZ9jpm8Vx+P2CGt2j7HpgkKZO/DJYQ0Bobim8G6PFQmK5lOqOOdUXboU+h73A4g==",
"deprecated": "Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau", "dependencies": {
"dev": true, "dezalgo": "^1.0.4",
"hexoid": "^1.0.0",
"once": "^1.4.0",
"qs": "^6.11.0"
},
"funding": { "funding": {
"url": "https://ko-fi.com/tunnckoCore/commissions" "url": "https://ko-fi.com/tunnckoCore/commissions"
} }
@ -28756,26 +28698,23 @@
} }
}, },
"node_modules/superagent": { "node_modules/superagent": {
"version": "6.1.0", "version": "8.1.2",
"resolved": "https://registry.npmjs.org/superagent/-/superagent-6.1.0.tgz", "resolved": "https://registry.npmjs.org/superagent/-/superagent-8.1.2.tgz",
"integrity": "sha512-OUDHEssirmplo3F+1HWKUrUjvnQuA+nZI6i/JJBdXb5eq9IyEQwPyPpqND+SSsxf6TygpBEkUjISVRN4/VOpeg==", "integrity": "sha512-6WTxW1EB6yCxV5VFOIPQruWGHqc3yI7hEmZK6h+pyk69Lk/Ut7rLUY6W/ONF2MjBuGjvmMiIpsrVJ2vjrHlslA==",
"deprecated": "Please upgrade to v7.0.2+ of superagent. We have fixed numerous issues with streams, form-data, attach(), filesystem errors not bubbling up (ENOENT on attach()), and all tests are now passing. See the releases tab for more information at <https://github.com/visionmedia/superagent/releases>.",
"dev": true,
"dependencies": { "dependencies": {
"component-emitter": "^1.3.0", "component-emitter": "^1.3.0",
"cookiejar": "^2.1.2", "cookiejar": "^2.1.4",
"debug": "^4.1.1", "debug": "^4.3.4",
"fast-safe-stringify": "^2.0.7", "fast-safe-stringify": "^2.1.1",
"form-data": "^3.0.0", "form-data": "^4.0.0",
"formidable": "^1.2.2", "formidable": "^2.1.2",
"methods": "^1.1.2", "methods": "^1.1.2",
"mime": "^2.4.6", "mime": "2.6.0",
"qs": "^6.9.4", "qs": "^6.11.0",
"readable-stream": "^3.6.0", "semver": "^7.3.8"
"semver": "^7.3.2"
}, },
"engines": { "engines": {
"node": ">= 7.0.0" "node": ">=6.4.0 <13 || >=14"
} }
}, },
"node_modules/supports-color": { "node_modules/supports-color": {

View File

@ -33,11 +33,11 @@
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@alfresco/adf-content-services": "6.3.0-5833590093", "@alfresco/adf-content-services": "6.3.0-5977252204",
"@alfresco/adf-core": "6.3.0-5833590093", "@alfresco/adf-core": "6.3.0-5977252204",
"@alfresco/adf-extensions": "6.3.0-5833590093", "@alfresco/adf-extensions": "6.3.0-5977252204",
"@alfresco/eslint-plugin-eslint-angular": "6.3.0-5833590093", "@alfresco/eslint-plugin-eslint-angular": "6.3.0-5977252204",
"@alfresco/js-api": "6.3.0-1104", "@alfresco/js-api": "6.3.0-1172",
"@angular/animations": "14.1.3", "@angular/animations": "14.1.3",
"@angular/cdk": "14.1.3", "@angular/cdk": "14.1.3",
"@angular/common": "14.1.3", "@angular/common": "14.1.3",
@ -69,8 +69,8 @@
"zone.js": "0.11.8" "zone.js": "0.11.8"
}, },
"devDependencies": { "devDependencies": {
"@alfresco/adf-cli": "6.3.0-5833590093", "@alfresco/adf-cli": "6.3.0-5977252204",
"@alfresco/adf-testing": "6.3.0-5833590093", "@alfresco/adf-testing": "6.3.0-5977252204",
"@angular-devkit/build-angular": "14.2.11", "@angular-devkit/build-angular": "14.2.11",
"@angular-devkit/core": "14.1.2", "@angular-devkit/core": "14.1.2",
"@angular-devkit/schematics": "14.1.2", "@angular-devkit/schematics": "14.1.2",

View File

@ -23,11 +23,11 @@
*/ */
import { Action } from '@ngrx/store'; import { Action } from '@ngrx/store';
import { MinimalNodeEntryEntity } from '@alfresco/js-api'; import { Node } from '@alfresco/js-api';
export const AOS_ACTION = 'AOS_ACTION'; export const AOS_ACTION = 'AOS_ACTION';
export class AosAction implements Action { export class AosAction implements Action {
readonly type = AOS_ACTION; readonly type = AOS_ACTION;
constructor(public payload: MinimalNodeEntryEntity) {} constructor(public payload: Node) {}
} }

View File

@ -25,11 +25,11 @@
/* cspell:disable */ /* cspell:disable */
import { AppConfigService, AuthenticationService, LogService, NotificationService } from '@alfresco/adf-core'; import { AppConfigService, AuthenticationService, LogService, NotificationService } from '@alfresco/adf-core';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { MinimalNodeEntryEntity } from '@alfresco/js-api'; import { Node } from '@alfresco/js-api';
import { getFileExtension, supportedExtensions } from '@alfresco/aca-shared/rules'; import { getFileExtension, supportedExtensions } from '@alfresco/aca-shared/rules';
export interface IAosEditOnlineService { export interface IAosEditOnlineService {
onActionEditOnlineAos(node: MinimalNodeEntryEntity): void; onActionEditOnlineAos(node: Node): void;
} }
@Injectable({ @Injectable({
@ -43,7 +43,7 @@ export class AosEditOnlineService implements IAosEditOnlineService {
private logService: LogService private logService: LogService
) {} ) {}
onActionEditOnlineAos(node: MinimalNodeEntryEntity): void { onActionEditOnlineAos(node: Node): void {
if (node && this.isFile(node) && node.properties) { if (node && this.isFile(node) && node.properties) {
if (node.isLocked) { if (node.isLocked) {
// const checkedOut = node.aspectNames.find( // const checkedOut = node.aspectNames.find(
@ -88,7 +88,7 @@ export class AosEditOnlineService implements IAosEditOnlineService {
return fileExtension && supportedExtensions[fileExtension]; return fileExtension && supportedExtensions[fileExtension];
} }
private triggerEditOnlineAos(node: MinimalNodeEntryEntity): void { private triggerEditOnlineAos(node: Node): void {
const aosHost = this.appConfigService.get('aosHost'); const aosHost = this.appConfigService.get('aosHost');
let url: string; let url: string;
const pathElements = (node.path?.elements || []).map((segment) => segment.name); const pathElements = (node.path?.elements || []).map((segment) => segment.name);
@ -139,13 +139,13 @@ export class AosEditOnlineService implements IAosEditOnlineService {
}, 500); }, 500);
} }
private isFile(node: MinimalNodeEntryEntity): boolean { private isFile(node: Node): boolean {
const implicitFile = (node as any).nodeId || (node as any).guid; const implicitFile = (node as any).nodeId || (node as any).guid;
return !!implicitFile || node.isFile; return !!implicitFile || node.isFile;
} }
private getNodeId(node: MinimalNodeEntryEntity): string { private getNodeId(node: Node): string {
return (node as any).nodeId || (node as any).guid || node.id; return (node as any).nodeId || (node as any).guid || node.id;
} }
} }

View File

@ -22,7 +22,7 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>. * from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { MinimalNodeEntryEntity } from '@alfresco/js-api'; import { Node } from '@alfresco/js-api';
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { provideMockActions } from '@ngrx/effects/testing'; import { provideMockActions } from '@ngrx/effects/testing';
import { Observable, of } from 'rxjs'; import { Observable, of } from 'rxjs';
@ -60,7 +60,7 @@ describe('AosEffects', () => {
it('should call onActionEditOnlineAos on AOS_ACTION', () => { it('should call onActionEditOnlineAos on AOS_ACTION', () => {
const onActionEditOnlineAosSpy = spyOn(aosEditOnlineService, 'onActionEditOnlineAos'); const onActionEditOnlineAosSpy = spyOn(aosEditOnlineService, 'onActionEditOnlineAos');
const payload = new MinimalNodeEntryEntity(); const payload = new Node();
const action = new AosAction(payload); const action = new AosAction(payload);
aosActions$ = of(action); aosActions$ = of(action);

View File

@ -5,10 +5,10 @@
"peerDependencies": { "peerDependencies": {
"@angular/common": "^14.1.0", "@angular/common": "^14.1.0",
"@angular/core": "^14.1.0", "@angular/core": "^14.1.0",
"@alfresco/adf-core": "^6.3.0-5833590093", "@alfresco/adf-core": "^6.3.0-5977252204",
"@alfresco/adf-content-services": "^6.3.0-5833590093", "@alfresco/adf-content-services": "^6.3.0-5977252204",
"@alfresco/adf-extensions": "^6.3.0-5833590093", "@alfresco/adf-extensions": "^6.3.0-5977252204",
"@alfresco/js-api": ">=6.3.0-1104", "@alfresco/js-api": ">=6.3.0-1172",
"@angular/animations": "^14.1.3", "@angular/animations": "^14.1.3",
"@angular/cdk": "^14.1.3", "@angular/cdk": "^14.1.3",
"@angular/forms": "^14.1.3", "@angular/forms": "^14.1.3",

View File

@ -39,7 +39,7 @@ import { PreviewComponent } from './preview.component';
import { BehaviorSubject, Observable, of, throwError } from 'rxjs'; import { BehaviorSubject, Observable, of, throwError } from 'rxjs';
import { ContentApiService, AppHookService, DocumentBasePageService } from '@alfresco/aca-shared'; import { ContentApiService, AppHookService, DocumentBasePageService } from '@alfresco/aca-shared';
import { Store, StoreModule } from '@ngrx/store'; import { Store, StoreModule } from '@ngrx/store';
import { Node, NodePaging, FavoritePaging, SharedLinkPaging, PersonEntry, ResultSetPaging, RepositoryInfo } from '@alfresco/js-api'; import { Node, NodePaging, FavoritePaging, SharedLinkPaging, PersonEntry, ResultSetPaging, RepositoryInfo, VersionInfo } from '@alfresco/js-api';
import { PreviewModule } from '../preview.module'; import { PreviewModule } from '../preview.module';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
@ -134,7 +134,14 @@ describe('PreviewComponent', () => {
provide: DiscoveryApiService, provide: DiscoveryApiService,
useValue: { useValue: {
ecmProductInfo$: new BehaviorSubject<RepositoryInfo | null>(null), ecmProductInfo$: new BehaviorSubject<RepositoryInfo | null>(null),
getEcmProductInfo: (): Observable<RepositoryInfo> => of(new RepositoryInfo({ version: '10.0.0' })) getEcmProductInfo: (): Observable<RepositoryInfo> =>
of(
new RepositoryInfo({
version: {
major: '10.0.0'
} as VersionInfo
})
)
} }
}, },
{ {

View File

@ -23,7 +23,7 @@
*/ */
import { Component, Input, ChangeDetectionStrategy, OnInit, ViewEncapsulation, HostListener, inject } from '@angular/core'; import { Component, Input, ChangeDetectionStrategy, OnInit, ViewEncapsulation, HostListener, inject } from '@angular/core';
import { PathInfo, MinimalNodeEntity } from '@alfresco/js-api'; import { PathInfo, NodeEntry } from '@alfresco/js-api';
import { Observable, BehaviorSubject, of } from 'rxjs'; import { Observable, BehaviorSubject, of } from 'rxjs';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { NavigateToParentFolder } from '@alfresco/aca-shared/store'; import { NavigateToParentFolder } from '@alfresco/aca-shared/store';
@ -75,14 +75,14 @@ export class LocationLinkComponent implements OnInit {
goToLocation() { goToLocation() {
if (this.context) { if (this.context) {
const node: MinimalNodeEntity = this.context.row.node; const node: NodeEntry = this.context.row.node;
this.store.dispatch(new NavigateToParentFolder(node)); this.store.dispatch(new NavigateToParentFolder(node));
} }
} }
ngOnInit() { ngOnInit() {
if (this.context) { if (this.context) {
const node: MinimalNodeEntity = this.context.row.node; const node: NodeEntry = this.context.row.node;
if (node && node.entry && node.entry.path) { if (node && node.entry && node.entry.path) {
const path = node.entry.path; const path = node.entry.path;

View File

@ -31,7 +31,7 @@ import {
PaginationDirective, PaginationDirective,
ToolbarComponent ToolbarComponent
} from '@alfresco/aca-shared'; } from '@alfresco/aca-shared';
import { MinimalNodeEntity, MinimalNodeEntryEntity, PathElementEntity, PathInfo } from '@alfresco/js-api'; import { NodeEntry, Node, PathElement, PathInfo } from '@alfresco/js-api';
import { Component, OnInit, ViewEncapsulation } from '@angular/core'; import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { debounceTime, map } from 'rxjs/operators'; import { debounceTime, map } from 'rxjs/operators';
import { DocumentListPresetRef, ExtensionsModule } from '@alfresco/adf-extensions'; import { DocumentListPresetRef, ExtensionsModule } from '@alfresco/adf-extensions';
@ -79,24 +79,24 @@ export class FavoritesComponent extends PageComponent implements OnInit {
this.columns = this.extensions.documentListPresets.favorites; this.columns = this.extensions.documentListPresets.favorites;
} }
navigate(favorite: MinimalNodeEntryEntity) { navigate(favorite: Node) {
const { isFolder, id } = favorite; const { isFolder, id } = favorite;
// TODO: rework as it will fail on non-English setups // TODO: rework as it will fail on non-English setups
const isSitePath = (path: PathInfo): boolean => path && path.elements && path.elements.some(({ name }: PathElementEntity) => name === 'Sites'); const isSitePath = (path: PathInfo): boolean => path && path.elements && path.elements.some(({ name }: PathElement) => name === 'Sites');
if (isFolder) { if (isFolder) {
this.contentApi this.contentApi
.getNode(id) .getNode(id)
.pipe(map((node) => node.entry)) .pipe(map((node) => node.entry))
.subscribe(({ path }: MinimalNodeEntryEntity) => { .subscribe(({ path }: Node) => {
const routeUrl = isSitePath(path) ? '/libraries' : '/personal-files'; const routeUrl = isSitePath(path) ? '/libraries' : '/personal-files';
this.router.navigate([routeUrl, id]); this.router.navigate([routeUrl, id]);
}); });
} }
} }
onNodeDoubleClick(node: MinimalNodeEntity) { onNodeDoubleClick(node: NodeEntry) {
if (node && node.entry) { if (node && node.entry) {
if (node.entry.isFolder) { if (node.entry.isFolder) {
this.navigate(node.entry); this.navigate(node.entry);

View File

@ -32,7 +32,7 @@ import { AppTestingModule } from '../../testing/app-testing.module';
import { ContentApiService } from '@alfresco/aca-shared'; import { ContentApiService } from '@alfresco/aca-shared';
import { of, Subject, throwError } from 'rxjs'; import { of, Subject, throwError } from 'rxjs';
import { By } from '@angular/platform-browser'; import { By } from '@angular/platform-browser';
import { NodeEntry, NodePaging } from '@alfresco/js-api'; import { NodeEntry, NodePaging, Node } from '@alfresco/js-api';
describe('FilesComponent', () => { describe('FilesComponent', () => {
let node; let node;
@ -424,7 +424,7 @@ describe('FilesComponent', () => {
it('should reset the pagination when navigating to a folder', () => { it('should reset the pagination when navigating to a folder', () => {
const resetNewFolderPaginationSpy = spyOn(component.documentList, 'resetNewFolderPagination'); const resetNewFolderPaginationSpy = spyOn(component.documentList, 'resetNewFolderPagination');
const fakeFolderNode = new NodeEntry({ entry: { id: 'fakeFolderNode', isFolder: true, isFile: false } }); const fakeFolderNode = new NodeEntry({ entry: { id: 'fakeFolderNode', isFolder: true, isFile: false } as Node });
component.navigateTo(fakeFolderNode); component.navigateTo(fakeFolderNode);
expect(resetNewFolderPaginationSpy).toHaveBeenCalled(); expect(resetNewFolderPaginationSpy).toHaveBeenCalled();
@ -432,7 +432,7 @@ describe('FilesComponent', () => {
it('should not reset the pagination when the node to navigate is not a folder', () => { it('should not reset the pagination when the node to navigate is not a folder', () => {
const resetNewFolderPaginationSpy = spyOn(component.documentList, 'resetNewFolderPagination'); const resetNewFolderPaginationSpy = spyOn(component.documentList, 'resetNewFolderPagination');
const fakeFileNode = new NodeEntry({ entry: { id: 'fakeFileNode', isFolder: false, isFile: true } }); const fakeFileNode = new NodeEntry({ entry: { id: 'fakeFileNode', isFolder: false, isFile: true } as Node });
component.navigateTo(fakeFileNode); component.navigateTo(fakeFileNode);
expect(resetNewFolderPaginationSpy).not.toHaveBeenCalled(); expect(resetNewFolderPaginationSpy).not.toHaveBeenCalled();

View File

@ -25,7 +25,7 @@
import { DataTableModule, PaginationModule, ShowHeaderMode } from '@alfresco/adf-core'; import { DataTableModule, PaginationModule, ShowHeaderMode } from '@alfresco/adf-core';
import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core'; import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { ActivatedRoute, Params } from '@angular/router'; import { ActivatedRoute, Params } from '@angular/router';
import { MinimalNodeEntity, MinimalNodeEntryEntity, PathElement, PathElementEntity } from '@alfresco/js-api'; import { NodeEntry, Node, PathElement } from '@alfresco/js-api';
import { NodeActionsService } from '../../services/node-actions.service'; import { NodeActionsService } from '../../services/node-actions.service';
import { import {
ContentApiService, ContentApiService,
@ -72,7 +72,7 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
export class FilesComponent extends PageComponent implements OnInit, OnDestroy { export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
isValidPath = true; isValidPath = true;
isAdmin = false; isAdmin = false;
selectedNode: MinimalNodeEntity; selectedNode: NodeEntry;
queryParams = null; queryParams = null;
showLoader$ = this.store.select(showLoaderSelector); showLoader$ = this.store.select(showLoaderSelector);
@ -186,7 +186,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
this.store.dispatch(new UploadFileVersionAction(ev)); this.store.dispatch(new UploadFileVersionAction(ev));
} }
navigateTo(node: MinimalNodeEntity) { navigateTo(node: NodeEntry) {
if (node && node.entry) { if (node && node.entry) {
this.selectedNode = node; this.selectedNode = node;
const { isFolder } = node.entry; const { isFolder } = node.entry;
@ -213,7 +213,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
this.navigateTo((event as CustomEvent).detail?.node); this.navigateTo((event as CustomEvent).detail?.node);
} }
onBreadcrumbNavigate(route: PathElementEntity) { onBreadcrumbNavigate(route: PathElement) {
this.documentList.resetNewFolderPagination(); this.documentList.resetNewFolderPagination();
// todo: review this approach once 5.2.3 is out // todo: review this approach once 5.2.3 is out
@ -226,7 +226,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
} }
onFileUploadedEvent(event: FileUploadEvent) { onFileUploadedEvent(event: FileUploadEvent) {
const node: MinimalNodeEntity = event.file.data; const node: NodeEntry = event.file.data;
// check root and child nodes // check root and child nodes
if (node && node.entry && node.entry.parentId === this.getParentNodeId()) { if (node && node.entry && node.entry.parentId === this.getParentNodeId()) {
@ -265,7 +265,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
this.reload(this.selectedNode); this.reload(this.selectedNode);
} }
onContentCopied(nodes: MinimalNodeEntity[]) { onContentCopied(nodes: NodeEntry[]) {
const newNode = nodes.find((node) => node && node.entry && node.entry.parentId === this.getParentNodeId()); const newNode = nodes.find((node) => node && node.entry && node.entry.parentId === this.getParentNodeId());
if (newNode) { if (newNode) {
this.reload(this.selectedNode); this.reload(this.selectedNode);
@ -273,7 +273,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
} }
// todo: review this approach once 5.2.3 is out // todo: review this approach once 5.2.3 is out
private async updateCurrentNode(node: MinimalNodeEntryEntity) { private async updateCurrentNode(node: Node) {
this.nodePath = null; this.nodePath = null;
if (node && node.path && node.path.elements) { if (node && node.path && node.path.elements) {
@ -297,7 +297,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
} }
// todo: review this approach once 5.2.3 is out // todo: review this approach once 5.2.3 is out
private async normalizeSitePath(node: MinimalNodeEntryEntity) { private async normalizeSitePath(node: Node) {
const elements = node.path.elements; const elements = node.path.elements;
// remove 'Sites' // remove 'Sites'
@ -325,7 +325,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
} }
} }
isSiteContainer(node: MinimalNodeEntryEntity): boolean { isSiteContainer(node: Node): boolean {
if (node && node.aspectNames && node.aspectNames.length > 0) { if (node && node.aspectNames && node.aspectNames.length > 0) {
return node.aspectNames.indexOf('st:siteContainer') >= 0; return node.aspectNames.indexOf('st:siteContainer') >= 0;
} }

View File

@ -23,7 +23,7 @@
*/ */
import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core'; import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
import { MinimalNodeEntryEntity } from '@alfresco/js-api'; import { Node } from '@alfresco/js-api';
import { NodePermissionService, isLocked } from '@alfresco/aca-shared'; import { NodePermissionService, isLocked } from '@alfresco/aca-shared';
import { MatCardModule } from '@angular/material/card'; import { MatCardModule } from '@angular/material/card';
import { NodeCommentsModule } from '@alfresco/adf-content-services'; import { NodeCommentsModule } from '@alfresco/adf-content-services';
@ -37,7 +37,7 @@ import { NodeCommentsModule } from '@alfresco/adf-content-services';
}) })
export class CommentsTabComponent implements OnInit { export class CommentsTabComponent implements OnInit {
@Input() @Input()
node: MinimalNodeEntryEntity; node: Node;
canUpdateNode = false; canUpdateNode = false;

View File

@ -23,14 +23,16 @@
*/ */
import { MetadataTabComponent } from './metadata-tab.component'; import { MetadataTabComponent } from './metadata-tab.component';
import { MinimalNodeEntryEntity, Node } from '@alfresco/js-api'; import { Node } from '@alfresco/js-api';
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AppTestingModule } from '../../../testing/app-testing.module'; import { AppTestingModule } from '../../../testing/app-testing.module';
import { AppConfigService } from '@alfresco/adf-core'; import { AppConfigService } from '@alfresco/adf-core';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { AppState, SetInfoDrawerMetadataAspectAction } from '@alfresco/aca-shared/store'; import { AppState, EditOfflineAction, SetInfoDrawerMetadataAspectAction } from '@alfresco/aca-shared/store';
import { By } from '@angular/platform-browser'; import { By } from '@angular/platform-browser';
import { AppExtensionService, NodePermissionService } from '@alfresco/aca-shared'; import { AppExtensionService, NodePermissionService } from '@alfresco/aca-shared';
import { Actions } from '@ngrx/effects';
import { Subject } from 'rxjs';
describe('MetadataTabComponent', () => { describe('MetadataTabComponent', () => {
let fixture: ComponentFixture<MetadataTabComponent>; let fixture: ComponentFixture<MetadataTabComponent>;
@ -39,6 +41,7 @@ describe('MetadataTabComponent', () => {
let appConfig: AppConfigService; let appConfig: AppConfigService;
let extensions: AppExtensionService; let extensions: AppExtensionService;
let nodePermissionService: NodePermissionService; let nodePermissionService: NodePermissionService;
let actions$: Subject<EditOfflineAction>;
const presets = { const presets = {
default: { default: {
@ -47,11 +50,18 @@ describe('MetadataTabComponent', () => {
custom: [] custom: []
}; };
beforeEach(() => { beforeEach(() => {
actions$ = new Subject<EditOfflineAction>();
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [AppTestingModule, MetadataTabComponent] imports: [AppTestingModule, MetadataTabComponent],
providers: [
{
provide: Actions,
useValue: actions$
}
]
}); });
nodePermissionService = TestBed.inject(NodePermissionService); nodePermissionService = TestBed.inject(NodePermissionService);
spyOn(nodePermissionService, 'check').and.callFake((source: MinimalNodeEntryEntity, permissions: string[]) => { spyOn(nodePermissionService, 'check').and.callFake((source: Node, permissions: string[]) => {
return permissions.some((permission) => source.allowableOperations.includes(permission)); return permissions.some((permission) => source.allowableOperations.includes(permission));
}); });
}); });
@ -85,7 +95,7 @@ describe('MetadataTabComponent', () => {
}); });
}); });
describe('canUpdateNode()', () => { describe('canUpdateNode', () => {
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(MetadataTabComponent); fixture = TestBed.createComponent(MetadataTabComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
@ -129,6 +139,113 @@ describe('MetadataTabComponent', () => {
component.ngOnInit(); component.ngOnInit();
expect(component.canUpdateNode).toBe(false); expect(component.canUpdateNode).toBe(false);
}); });
describe('set by triggering EditOfflineAction', () => {
let editOfflineAction: EditOfflineAction;
beforeEach(() => {
component.node = {
id: 'some id',
allowableOperations: []
} as Node;
component.ngOnInit();
editOfflineAction = new EditOfflineAction({
entry: {
isLocked: false,
allowableOperations: ['update'],
id: component.node.id
} as Node
});
component.canUpdateNode = true;
});
it('should have set true if node is not locked and has update permission', () => {
component.canUpdateNode = false;
actions$.next(editOfflineAction);
expect(component.canUpdateNode).toBeTrue();
});
it('should not have set false if changed node has different id than original', () => {
editOfflineAction.payload.entry.id = 'some other id';
editOfflineAction.payload.entry.isLocked = true;
actions$.next(editOfflineAction);
expect(component.canUpdateNode).toBeTrue();
});
it('should have set false if node is locked', () => {
editOfflineAction.payload.entry.isLocked = true;
actions$.next(editOfflineAction);
expect(component.canUpdateNode).toBeFalse();
});
it('should have set false if node has no update permission', () => {
editOfflineAction.payload.entry.allowableOperations = ['other'];
actions$.next(editOfflineAction);
expect(component.canUpdateNode).toBeFalse();
});
it('should have set false if node has read only property', () => {
editOfflineAction.payload.entry.properties = {
'cm:lockType': 'WRITE_LOCK'
};
actions$.next(editOfflineAction);
expect(component.canUpdateNode).toBeFalse();
});
});
});
describe('editable', () => {
let editOfflineAction: EditOfflineAction;
beforeEach(() => {
fixture = TestBed.createComponent(MetadataTabComponent);
component = fixture.componentInstance;
component.node = {
id: 'some id',
allowableOperations: []
} as Node;
component.ngOnInit();
editOfflineAction = new EditOfflineAction({
entry: {
isLocked: false,
allowableOperations: ['update'],
id: component.node.id
} as Node
});
component.editable = true;
});
it('should not have set false if node is not locked and has update permission', () => {
actions$.next(editOfflineAction);
expect(component.editable).toBeTrue();
});
it('should not have set false if changed node has different id than original', () => {
editOfflineAction.payload.entry.id = 'some other id';
editOfflineAction.payload.entry.isLocked = true;
actions$.next(editOfflineAction);
expect(component.editable).toBeTrue();
});
it('should have set false if node is locked', () => {
editOfflineAction.payload.entry.isLocked = true;
actions$.next(editOfflineAction);
expect(component.editable).toBeFalse();
});
it('should have set false if node has no update permission', () => {
editOfflineAction.payload.entry.allowableOperations = ['other'];
actions$.next(editOfflineAction);
expect(component.editable).toBeFalse();
});
it('should have set false if node has read only property', () => {
editOfflineAction.payload.entry.properties = {
'cm:lockType': 'WRITE_LOCK'
};
actions$.next(editOfflineAction);
expect(component.editable).toBeFalse();
});
}); });
describe('displayAspect', () => { describe('displayAspect', () => {

View File

@ -23,22 +23,29 @@
*/ */
import { Component, Input, ViewEncapsulation, OnInit, OnDestroy } from '@angular/core'; import { Component, Input, ViewEncapsulation, OnInit, OnDestroy } from '@angular/core';
import { MinimalNodeEntryEntity } from '@alfresco/js-api'; import { Node } from '@alfresco/js-api';
import { NodePermissionService, isLocked, AppExtensionService } from '@alfresco/aca-shared'; import { NodePermissionService, isLocked, AppExtensionService } from '@alfresco/aca-shared';
import { AppStore, infoDrawerMetadataAspect } from '@alfresco/aca-shared/store'; import { AppStore, EditOfflineAction, infoDrawerMetadataAspect, NodeActionTypes } from '@alfresco/aca-shared/store';
import { AppConfigService, NotificationService } from '@alfresco/adf-core'; import { AppConfigService, NotificationService } from '@alfresco/adf-core';
import { Observable, Subject } from 'rxjs'; import { Observable, Subject } from 'rxjs';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { ContentMetadataModule, ContentMetadataService } from '@alfresco/adf-content-services'; import { ContentMetadataModule, ContentMetadataService } from '@alfresco/adf-content-services';
import { takeUntil } from 'rxjs/operators'; import { filter, takeUntil } from 'rxjs/operators';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { Actions, ofType } from '@ngrx/effects';
@Component({ @Component({
standalone: true, standalone: true,
imports: [CommonModule, ContentMetadataModule], imports: [CommonModule, ContentMetadataModule],
selector: 'app-metadata-tab', selector: 'app-metadata-tab',
template: ` template: `
<adf-content-metadata-card [readOnly]="!canUpdateNode" [preset]="'custom'" [node]="node" [displayAspect]="displayAspect$ | async"> <adf-content-metadata-card
[readOnly]="!canUpdateNode"
[preset]="'custom'"
[node]="node"
[displayAspect]="displayAspect$ | async"
[(editable)]="editable"
>
</adf-content-metadata-card> </adf-content-metadata-card>
`, `,
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
@ -48,11 +55,11 @@ export class MetadataTabComponent implements OnInit, OnDestroy {
protected onDestroy$ = new Subject<boolean>(); protected onDestroy$ = new Subject<boolean>();
@Input() @Input()
node: MinimalNodeEntryEntity; node: Node;
displayAspect$: Observable<string>; displayAspect$: Observable<string>;
canUpdateNode = false; canUpdateNode = false;
editable = false;
constructor( constructor(
private permission: NodePermissionService, private permission: NodePermissionService,
@ -60,7 +67,8 @@ export class MetadataTabComponent implements OnInit, OnDestroy {
private appConfig: AppConfigService, private appConfig: AppConfigService,
private store: Store<AppStore>, private store: Store<AppStore>,
private notificationService: NotificationService, private notificationService: NotificationService,
private contentMetadataService: ContentMetadataService private contentMetadataService: ContentMetadataService,
private actions$: Actions
) { ) {
if (this.extensions.contentMetadata) { if (this.extensions.contentMetadata) {
this.appConfig.config['content-metadata'].presets = this.extensions.contentMetadata.presets; this.appConfig.config['content-metadata'].presets = this.extensions.contentMetadata.presets;
@ -72,13 +80,27 @@ export class MetadataTabComponent implements OnInit, OnDestroy {
this.contentMetadataService.error.pipe(takeUntil(this.onDestroy$)).subscribe((err: { message: string }) => { this.contentMetadataService.error.pipe(takeUntil(this.onDestroy$)).subscribe((err: { message: string }) => {
this.notificationService.showError(err.message); this.notificationService.showError(err.message);
}); });
if (this.node && !isLocked({ entry: this.node })) { this.checkIfNodeIsUpdatable(this.node);
this.canUpdateNode = this.permission.check(this.node, ['update']); this.actions$
} .pipe(
ofType<EditOfflineAction>(NodeActionTypes.EditOffline),
filter((updatedNode) => this.node.id === updatedNode.payload.entry.id),
takeUntil(this.onDestroy$)
)
.subscribe((updatedNode) => {
this.checkIfNodeIsUpdatable(updatedNode?.payload.entry);
if (!this.canUpdateNode) {
this.editable = false;
}
});
} }
ngOnDestroy() { ngOnDestroy() {
this.onDestroy$.next(true); this.onDestroy$.next(true);
this.onDestroy$.complete(); this.onDestroy$.complete();
} }
private checkIfNodeIsUpdatable(node: Node) {
this.canUpdateNode = node && !isLocked({ entry: node }) ? this.permission.check(node, ['update']) : false;
}
} }

View File

@ -23,7 +23,7 @@
*/ */
import { Component, Input, OnChanges, OnInit, ViewEncapsulation } from '@angular/core'; import { Component, Input, OnChanges, OnInit, ViewEncapsulation } from '@angular/core';
import { MinimalNodeEntryEntity } from '@alfresco/js-api'; import { Node } from '@alfresco/js-api';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { VersionManagerModule } from '@alfresco/adf-content-services'; import { VersionManagerModule } from '@alfresco/adf-content-services';
import { AppConfigModule } from '@alfresco/adf-core'; import { AppConfigModule } from '@alfresco/adf-core';
@ -55,7 +55,7 @@ import { TranslateModule } from '@ngx-translate/core';
}) })
export class VersionsTabComponent implements OnInit, OnChanges { export class VersionsTabComponent implements OnInit, OnChanges {
@Input() @Input()
node: MinimalNodeEntryEntity; node: Node;
isFileSelected = false; isFileSelected = false;

View File

@ -23,7 +23,7 @@
*/ */
import { Component, OnInit, ViewEncapsulation } from '@angular/core'; import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { MinimalNodeEntity } from '@alfresco/js-api'; import { NodeEntry } from '@alfresco/js-api';
import { debounceTime } from 'rxjs/operators'; import { debounceTime } from 'rxjs/operators';
import { import {
ContextActionsDirective, ContextActionsDirective,
@ -78,7 +78,7 @@ export class RecentFilesComponent extends PageComponent implements OnInit {
this.columns = this.extensions.documentListPresets.recent || []; this.columns = this.extensions.documentListPresets.recent || [];
} }
onNodeDoubleClick(node: MinimalNodeEntity) { onNodeDoubleClick(node: NodeEntry) {
if (node && node.entry) { if (node && node.entry) {
this.showPreview(node, { location: this.router.url }); this.showPreview(node, { location: this.router.url });
} }

View File

@ -23,7 +23,7 @@
*/ */
import { Component, Input, OnInit, ViewEncapsulation, ChangeDetectionStrategy, OnDestroy } from '@angular/core'; import { Component, Input, OnInit, ViewEncapsulation, ChangeDetectionStrategy, OnDestroy } from '@angular/core';
import { MinimalNodeEntity } from '@alfresco/js-api'; import { NodeEntry } from '@alfresco/js-api';
import { ViewNodeAction, NavigateToFolder } from '@alfresco/aca-shared/store'; import { ViewNodeAction, NavigateToFolder } from '@alfresco/aca-shared/store';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { BehaviorSubject, Subject } from 'rxjs'; import { BehaviorSubject, Subject } from 'rxjs';
@ -46,7 +46,7 @@ import { MatDialogModule } from '@angular/material/dialog';
host: { class: 'aca-search-results-row' } host: { class: 'aca-search-results-row' }
}) })
export class SearchResultsRowComponent implements OnInit, OnDestroy { export class SearchResultsRowComponent implements OnInit, OnDestroy {
private node: MinimalNodeEntity; private node: NodeEntry;
private onDestroy$ = new Subject<boolean>(); private onDestroy$ = new Subject<boolean>();
@Input() @Input()

View File

@ -23,7 +23,7 @@
*/ */
import { Component, OnInit, ViewEncapsulation } from '@angular/core'; import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { MinimalNodeEntity, Pagination, ResultSetPaging } from '@alfresco/js-api'; import { NodeEntry, Pagination, ResultSetPaging } from '@alfresco/js-api';
import { ActivatedRoute, Params } from '@angular/router'; import { ActivatedRoute, Params } from '@angular/router';
import { AlfrescoViewerModule, DocumentListModule, SearchModule, SearchQueryBuilderService } from '@alfresco/adf-content-services'; import { AlfrescoViewerModule, DocumentListModule, SearchModule, SearchQueryBuilderService } from '@alfresco/adf-content-services';
import { import {
@ -265,7 +265,7 @@ export class SearchResultsComponent extends PageComponent implements OnInit {
return ['name', 'asc']; return ['name', 'asc'];
} }
onNodeDoubleClick(node: MinimalNodeEntity) { onNodeDoubleClick(node: NodeEntry) {
if (node && node.entry) { if (node && node.entry) {
if (node.entry.isFolder) { if (node.entry.isFolder) {
this.store.dispatch(new NavigateToFolder(node)); this.store.dispatch(new NavigateToFolder(node));

View File

@ -24,7 +24,7 @@
import { Component, OnInit, ViewEncapsulation } from '@angular/core'; import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { debounceTime } from 'rxjs/operators'; import { debounceTime } from 'rxjs/operators';
import { MinimalNodeEntity } from '@alfresco/js-api'; import { NodeEntry } from '@alfresco/js-api';
import { import {
AppHookService, AppHookService,
ContextActionsDirective, ContextActionsDirective,
@ -80,7 +80,7 @@ export class SharedFilesComponent extends PageComponent implements OnInit {
this.columns = this.extensions.documentListPresets.shared || []; this.columns = this.extensions.documentListPresets.shared || [];
} }
preview(node: MinimalNodeEntity) { preview(node: NodeEntry) {
this.showPreview(node, { location: this.router.url }); this.showPreview(node, { location: this.router.url });
} }

View File

@ -23,7 +23,7 @@
*/ */
import { AppStore, DownloadNodesAction, EditOfflineAction, SnackbarErrorAction, getAppSelection } from '@alfresco/aca-shared/store'; import { AppStore, DownloadNodesAction, EditOfflineAction, SnackbarErrorAction, getAppSelection } from '@alfresco/aca-shared/store';
import { MinimalNodeEntity, NodeEntry, SharedLinkEntry, Node, NodesApi } from '@alfresco/js-api'; import { NodeEntry, SharedLinkEntry, Node, NodesApi } from '@alfresco/js-api';
import { Component, OnInit, ViewEncapsulation } from '@angular/core'; import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { isLocked } from '@alfresco/aca-shared'; import { isLocked } from '@alfresco/aca-shared';
@ -55,7 +55,7 @@ import { MatIconModule } from '@angular/material/icon';
}) })
export class ToggleEditOfflineComponent implements OnInit { export class ToggleEditOfflineComponent implements OnInit {
private nodesApi: NodesApi; private nodesApi: NodesApi;
selection: MinimalNodeEntity; selection: NodeEntry;
nodeTitle = ''; nodeTitle = '';
isNodeLocked = false; isNodeLocked = false;

View File

@ -31,7 +31,7 @@ import { Store } from '@ngrx/store';
import { AppHookService } from '@alfresco/aca-shared'; import { AppHookService } from '@alfresco/aca-shared';
import { SetSelectedNodesAction } from '@alfresco/aca-shared/store'; import { SetSelectedNodesAction } from '@alfresco/aca-shared/store';
import { takeUntil, filter } from 'rxjs/operators'; import { takeUntil, filter } from 'rxjs/operators';
import { MinimalNodeEntity } from '@alfresco/js-api'; import { NodeEntry } from '@alfresco/js-api';
@Directive({ @Directive({
standalone: true, standalone: true,
@ -39,7 +39,7 @@ import { MinimalNodeEntity } from '@alfresco/js-api';
}) })
export class DocumentListDirective implements OnInit, OnDestroy { export class DocumentListDirective implements OnInit, OnDestroy {
private isLibrary = false; private isLibrary = false;
selectedNode: MinimalNodeEntity; selectedNode: NodeEntry;
onDestroy$ = new Subject<boolean>(); onDestroy$ = new Subject<boolean>();
@ -132,7 +132,7 @@ export class DocumentListDirective implements OnInit, OnDestroy {
this.store.dispatch(new SetSelectedNodesAction(selection)); this.store.dispatch(new SetSelectedNodesAction(selection));
} }
private reload(selectedNode?: MinimalNodeEntity) { private reload(selectedNode?: NodeEntry) {
this.documentList.resetSelection(); this.documentList.resetSelection();
if (selectedNode) { if (selectedNode) {
this.store.dispatch(new SetSelectedNodesAction([selectedNode])); this.store.dispatch(new SetSelectedNodesAction([selectedNode]));

View File

@ -55,7 +55,7 @@ import { NodeActionsService } from './node-actions.service';
import { TranslationService, NotificationService } from '@alfresco/adf-core'; import { TranslationService, NotificationService } from '@alfresco/adf-core';
import { MatDialog, MatDialogModule, MatDialogRef } from '@angular/material/dialog'; import { MatDialog, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
import { MatSnackBarModule, MatSnackBarRef, SimpleSnackBar } from '@angular/material/snack-bar'; import { MatSnackBarModule, MatSnackBarRef, SimpleSnackBar } from '@angular/material/snack-bar';
import { NodeEntry, Node, VersionPaging, MinimalNodeEntity } from '@alfresco/js-api'; import { NodeEntry, Node, VersionPaging } from '@alfresco/js-api';
import { import {
NewVersionUploaderDataAction, NewVersionUploaderDataAction,
NewVersionUploaderService, NewVersionUploaderService,
@ -1685,7 +1685,7 @@ describe('ContentManagementService', () => {
const elementToFocus = document.createElement(elementToFocusSelector); const elementToFocus = document.createElement(elementToFocusSelector);
spyOn(elementToFocus, 'focus'); spyOn(elementToFocus, 'focus');
spyOn(document, 'querySelector').withArgs(elementToFocusSelector).and.returnValue(elementToFocus); spyOn(document, 'querySelector').withArgs(elementToFocusSelector).and.returnValue(elementToFocus);
contentManagementService.editFolder({} as MinimalNodeEntity, elementToFocusSelector); contentManagementService.editFolder({} as NodeEntry, elementToFocusSelector);
afterClosed$.next(); afterClosed$.next();
expect(elementToFocus.focus).toHaveBeenCalled(); expect(elementToFocus.focus).toHaveBeenCalled();
}); });
@ -1699,7 +1699,7 @@ describe('ContentManagementService', () => {
} }
} as MatDialogRef<any>); } as MatDialogRef<any>);
spyOn(document, 'querySelector'); spyOn(document, 'querySelector');
contentManagementService.editFolder({} as MinimalNodeEntity, ''); contentManagementService.editFolder({} as NodeEntry, '');
afterClosed$.next(); afterClosed$.next();
expect(document.querySelector).not.toHaveBeenCalled(); expect(document.querySelector).not.toHaveBeenCalled();
}); });

View File

@ -57,16 +57,7 @@ import {
NodesApiService NodesApiService
} from '@alfresco/adf-content-services'; } from '@alfresco/adf-content-services';
import { TranslationService, NotificationService } from '@alfresco/adf-core'; import { TranslationService, NotificationService } from '@alfresco/adf-core';
import { import { DeletedNodesPaging, Node, NodeEntry, PathInfo, SiteBodyCreate, SiteEntry } from '@alfresco/js-api';
DeletedNodesPaging,
MinimalNodeEntity,
MinimalNodeEntryEntity,
Node,
NodeEntry,
PathInfoEntity,
SiteBody,
SiteEntry
} from '@alfresco/js-api';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { MatDialog, MatDialogConfig } from '@angular/material/dialog'; import { MatDialog, MatDialogConfig } from '@angular/material/dialog';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
@ -77,7 +68,7 @@ import { Router } from '@angular/router';
interface RestoredNode { interface RestoredNode {
status: number; status: number;
entry: MinimalNodeEntryEntity; entry: Node;
statusCode?: number; statusCode?: number;
} }
@ -102,7 +93,7 @@ export class ContentManagementService {
private router: Router private router: Router
) {} ) {}
addFavorite(nodes: Array<MinimalNodeEntity>) { addFavorite(nodes: Array<NodeEntry>) {
if (nodes && nodes.length > 0) { if (nodes && nodes.length > 0) {
this.contentApi.addFavorite(nodes).subscribe(() => { this.contentApi.addFavorite(nodes).subscribe(() => {
const favoriteNodes = nodes.map((node) => { const favoriteNodes = nodes.map((node) => {
@ -116,7 +107,7 @@ export class ContentManagementService {
} }
} }
removeFavorite(nodes: Array<MinimalNodeEntity>) { removeFavorite(nodes: Array<NodeEntry>) {
if (nodes && nodes.length > 0) { if (nodes && nodes.length > 0) {
this.contentApi.removeFavorite(nodes).subscribe(() => { this.contentApi.removeFavorite(nodes).subscribe(() => {
const favoriteNodes = nodes.map((node) => { const favoriteNodes = nodes.map((node) => {
@ -244,7 +235,7 @@ export class ContentManagementService {
}); });
} }
editFolder(folder: MinimalNodeEntity, focusedElementOnCloseSelector?: string) { editFolder(folder: NodeEntry, focusedElementOnCloseSelector?: string) {
if (!folder) { if (!folder) {
return; return;
} }
@ -332,7 +323,7 @@ export class ContentManagementService {
}); });
} }
updateLibrary(siteId: string, siteBody: SiteBody) { updateLibrary(siteId: string, siteBody: SiteBodyCreate) {
this.contentApi.updateLibrary(siteId, siteBody).subscribe( this.contentApi.updateLibrary(siteId, siteBody).subscribe(
(siteEntry: SiteEntry) => { (siteEntry: SiteEntry) => {
this.appHookService.libraryUpdated.next(siteEntry); this.appHookService.libraryUpdated.next(siteEntry);
@ -344,21 +335,21 @@ export class ContentManagementService {
); );
} }
async unshareNodes(links: Array<MinimalNodeEntity>) { async unshareNodes(links: Array<NodeEntry>) {
const promises = links.map((link) => this.contentApi.deleteSharedLink(link.entry.id).toPromise()); const promises = links.map((link) => this.contentApi.deleteSharedLink(link.entry.id).toPromise());
await Promise.all(promises); await Promise.all(promises);
this.appHookService.linksUnshared.next(); this.appHookService.linksUnshared.next();
} }
canUpdateNode(node: MinimalNodeEntity | Node): boolean { canUpdateNode(node: NodeEntry | Node): boolean {
return this.permission.check(node, ['update']); return this.permission.check(node, ['update']);
} }
canUploadContent(folderNode: MinimalNodeEntity | Node): boolean { canUploadContent(folderNode: NodeEntry | Node): boolean {
return this.permission.check(folderNode, ['create']); return this.permission.check(folderNode, ['create']);
} }
purgeDeletedNodes(nodes: MinimalNodeEntity[]) { purgeDeletedNodes(nodes: NodeEntry[]) {
if (!nodes || nodes.length === 0) { if (!nodes || nodes.length === 0) {
return; return;
} }
@ -389,7 +380,7 @@ export class ContentManagementService {
}); });
} }
restoreDeletedNodes(selection: MinimalNodeEntity[] = []) { restoreDeletedNodes(selection: NodeEntry[] = []) {
if (!selection.length) { if (!selection.length) {
return; return;
} }
@ -426,7 +417,7 @@ export class ContentManagementService {
}); });
} }
copyNodes(nodes: Array<MinimalNodeEntity>, focusedElementOnCloseSelector?: string) { copyNodes(nodes: Array<NodeEntry>, focusedElementOnCloseSelector?: string) {
zip(this.nodeActionsService.copyNodes(nodes, undefined, focusedElementOnCloseSelector), this.nodeActionsService.contentCopied).subscribe( zip(this.nodeActionsService.copyNodes(nodes, undefined, focusedElementOnCloseSelector), this.nodeActionsService.contentCopied).subscribe(
(result) => { (result) => {
const [operationResult, newItems] = result; const [operationResult, newItems] = result;
@ -438,7 +429,7 @@ export class ContentManagementService {
); );
} }
moveNodes(nodes: Array<MinimalNodeEntity>, focusedElementOnCloseSelector?: string) { moveNodes(nodes: Array<NodeEntry>, focusedElementOnCloseSelector?: string) {
const permissionForMove = '!'; const permissionForMove = '!';
zip(this.nodeActionsService.moveNodes(nodes, permissionForMove, focusedElementOnCloseSelector), this.nodeActionsService.contentMoved).subscribe( zip(this.nodeActionsService.moveNodes(nodes, permissionForMove, focusedElementOnCloseSelector), this.nodeActionsService.contentMoved).subscribe(
@ -474,7 +465,7 @@ export class ContentManagementService {
return i18nMessageString; return i18nMessageString;
} }
getNodeInfo(): Observable<MinimalNodeEntryEntity> { getNodeInfo(): Observable<Node> {
return this.store.select(getAppSelection).pipe( return this.store.select(getAppSelection).pipe(
take(1), take(1),
mergeMap(({ file }) => { mergeMap(({ file }) => {
@ -498,7 +489,7 @@ export class ContentManagementService {
}); });
} }
private showCopyMessage(info: any, nodes: Array<MinimalNodeEntity>, newItems?: Array<MinimalNodeEntity>) { private showCopyMessage(info: any, nodes: Array<NodeEntry>, newItems?: Array<NodeEntry>) {
const numberOfCopiedItems = newItems ? newItems.length : 0; const numberOfCopiedItems = newItems ? newItems.length : 0;
const failedItems = nodes.length - numberOfCopiedItems; const failedItems = nodes.length - numberOfCopiedItems;
@ -547,7 +538,7 @@ export class ContentManagementService {
.subscribe(() => this.undoCopyNodes(newItems)); .subscribe(() => this.undoCopyNodes(newItems));
} }
private undoCopyNodes(nodes: MinimalNodeEntity[]) { private undoCopyNodes(nodes: NodeEntry[]) {
const batch = this.nodeActionsService const batch = this.nodeActionsService
.flatten(nodes) .flatten(nodes)
.filter((item) => item.entry) .filter((item) => item.entry)
@ -665,7 +656,7 @@ export class ContentManagementService {
); );
} }
deleteNodes(items: MinimalNodeEntity[]): void { deleteNodes(items: NodeEntry[]): void {
const batch: Observable<DeletedNodeInfo>[] = []; const batch: Observable<DeletedNodeInfo>[] = [];
items.forEach((node) => { items.forEach((node) => {
@ -744,7 +735,7 @@ export class ContentManagementService {
return null; return null;
} }
private restoreNode(node: MinimalNodeEntity): Observable<RestoredNode> { private restoreNode(node: NodeEntry): Observable<RestoredNode> {
const { entry } = node; const { entry } = node;
return this.contentApi.restoreNode(entry.id).pipe( return this.contentApi.restoreNode(entry.id).pipe(
@ -882,7 +873,7 @@ export class ContentManagementService {
if (message) { if (message) {
if (status.oneSucceeded && !status.someFailed) { if (status.oneSucceeded && !status.someFailed) {
const isSite = this.isSite(status.success[0].entry); const isSite = this.isSite(status.success[0].entry);
const path: PathInfoEntity = status.success[0].entry.path; const path: PathInfo = status.success[0].entry.path;
const parent = path.elements[path.elements.length - 1]; const parent = path.elements[path.elements.length - 1];
const route = isSite ? ['/libraries', parent.id] : ['/personal-files', parent.id]; const route = isSite ? ['/libraries', parent.id] : ['/personal-files', parent.id];
@ -901,11 +892,11 @@ export class ContentManagementService {
} }
} }
private isSite(entry: MinimalNodeEntryEntity): boolean { private isSite(entry: Node): boolean {
return entry.nodeType === 'st:site'; return entry.nodeType === 'st:site';
} }
private isLibraryContent(path: PathInfoEntity): boolean { private isLibraryContent(path: PathInfo): boolean {
return path && path.elements.length >= 2 && path.elements[1].name === 'Sites'; return path && path.elements.length >= 2 && path.elements[1].name === 'Sites';
} }
@ -1017,7 +1008,7 @@ export class ContentManagementService {
return null; return null;
} }
private showMoveMessage(nodes: Array<MinimalNodeEntity>, info: any, moveResponse?: any) { private showMoveMessage(nodes: Array<NodeEntry>, info: any, moveResponse?: any) {
const succeeded = moveResponse && moveResponse['succeeded'] ? moveResponse['succeeded'].length : 0; const succeeded = moveResponse && moveResponse['succeeded'] ? moveResponse['succeeded'].length : 0;
const partiallySucceeded = moveResponse && moveResponse['partiallySucceeded'] ? moveResponse['partiallySucceeded'].length : 0; const partiallySucceeded = moveResponse && moveResponse['partiallySucceeded'] ? moveResponse['partiallySucceeded'].length : 0;
const failures = moveResponse && moveResponse['failed'] ? moveResponse['failed'].length : 0; const failures = moveResponse && moveResponse['failed'] ? moveResponse['failed'].length : 0;

View File

@ -28,12 +28,12 @@ import { of, throwError, Subject, Observable } from 'rxjs';
import { AlfrescoApiService, TranslationService } from '@alfresco/adf-core'; import { AlfrescoApiService, TranslationService } from '@alfresco/adf-core';
import { DocumentListService, NodeAction } from '@alfresco/adf-content-services'; import { DocumentListService, NodeAction } from '@alfresco/adf-content-services';
import { NodeActionsService } from './node-actions.service'; import { NodeActionsService } from './node-actions.service';
import { MinimalNodeEntryEntity, NodeChildAssociationEntry, NodeEntry } from '@alfresco/js-api'; import { Node, NodeChildAssociationEntry, NodeEntry } from '@alfresco/js-api';
import { AppTestingModule } from '../testing/app-testing.module'; import { AppTestingModule } from '../testing/app-testing.module';
import { ContentApiService } from '@alfresco/aca-shared'; import { ContentApiService } from '@alfresco/aca-shared';
class TestNode { class TestNode {
entry: MinimalNodeEntryEntity; entry: Node;
constructor(id?: string, isFile?: boolean, name?: string, permission?: string[], nodeType?: string, properties?: any) { constructor(id?: string, isFile?: boolean, name?: string, permission?: string[], nodeType?: string, properties?: any) {
this.entry = {} as any; this.entry = {} as any;
@ -242,7 +242,7 @@ describe('NodeActionsService', () => {
it('should not throw error if entry in "contentEntities" does not have id, but has nodeId property', () => { it('should not throw error if entry in "contentEntities" does not have id, but has nodeId property', () => {
const contentEntities = [new TestNode(), { entry: { nodeId: '1234' } }]; const contentEntities = [new TestNode(), { entry: { nodeId: '1234' } }];
const subject = new Subject<MinimalNodeEntryEntity[]>(); const subject = new Subject<Node[]>();
spyOn(service, 'getContentNodeSelection').and.returnValue(subject); spyOn(service, 'getContentNodeSelection').and.returnValue(subject);
spyOn(service, 'copyNodeAction').and.returnValue(of({})); spyOn(service, 'copyNodeAction').and.returnValue(of({}));
@ -333,7 +333,7 @@ describe('NodeActionsService', () => {
}); });
it('should be called', () => { it('should be called', () => {
const subject = new Subject<MinimalNodeEntryEntity[]>(); const subject = new Subject<Node[]>();
const spyOnBatchOperation = spyOn(service, 'doBatchOperation').and.callThrough(); const spyOnBatchOperation = spyOn(service, 'doBatchOperation').and.callThrough();
spyOn(service, 'getContentNodeSelection').and.returnValue(subject); spyOn(service, 'getContentNodeSelection').and.returnValue(subject);
spyOn(service, 'copyNodeAction').and.returnValue(of({})); spyOn(service, 'copyNodeAction').and.returnValue(of({}));
@ -720,10 +720,10 @@ describe('NodeActionsService', () => {
let destinationFolder: TestNode; let destinationFolder: TestNode;
let spyOnBatchOperation: jasmine.Spy; let spyOnBatchOperation: jasmine.Spy;
let documentListService: DocumentListService; let documentListService: DocumentListService;
let subject: Subject<MinimalNodeEntryEntity[]>; let subject: Subject<Node[]>;
beforeEach(() => { beforeEach(() => {
subject = new Subject<MinimalNodeEntryEntity[]>(); subject = new Subject<Node[]>();
fileToMove = new TestNode('file-to-be-moved', isFile, 'file-name'); fileToMove = new TestNode('file-to-be-moved', isFile, 'file-name');
folderToMove = new TestNode('fid', !isFile, 'folder-name'); folderToMove = new TestNode('fid', !isFile, 'folder-name');
destinationFolder = new TestNode(folderDestinationId); destinationFolder = new TestNode(folderDestinationId);

View File

@ -35,14 +35,7 @@ import {
NodeAction, NodeAction,
ContentService ContentService
} from '@alfresco/adf-content-services'; } from '@alfresco/adf-content-services';
import { import { NodeEntry, Node, SitePaging, NodeChildAssociationPaging, NodeChildAssociationEntry, NodesApi, Site, SitePagingList } from '@alfresco/js-api';
MinimalNodeEntity,
MinimalNodeEntryEntity,
SitePaging,
NodeChildAssociationPaging,
NodeChildAssociationEntry,
NodesApi
} from '@alfresco/js-api';
import { ContentApiService } from '@alfresco/aca-shared'; import { ContentApiService } from '@alfresco/aca-shared';
import { catchError, map, mergeMap } from 'rxjs/operators'; import { catchError, map, mergeMap } from 'rxjs/operators';
@ -52,7 +45,7 @@ type BatchOperationType = Extract<NodeAction, NodeAction.COPY | NodeAction.MOVE>
providedIn: 'root' providedIn: 'root'
}) })
export class NodeActionsService { export class NodeActionsService {
contentCopied: Subject<MinimalNodeEntity[]> = new Subject<MinimalNodeEntity[]>(); contentCopied: Subject<NodeEntry[]> = new Subject<NodeEntry[]>();
contentMoved: Subject<any> = new Subject<any>(); contentMoved: Subject<any> = new Subject<any>();
moveDeletedEntries: any[] = []; moveDeletedEntries: any[] = [];
isSitesDestinationAvailable = false; isSitesDestinationAvailable = false;
@ -110,7 +103,7 @@ export class NodeActionsService {
observable.error(new Error(JSON.stringify({ error: { statusCode: 400 } }))); observable.error(new Error(JSON.stringify({ error: { statusCode: 400 } })));
} else if (this.checkPermission(action, contentEntities, permission)) { } else if (this.checkPermission(action, contentEntities, permission)) {
const destinationSelection = this.getContentNodeSelection(action, contentEntities, focusedElementOnCloseSelector); const destinationSelection = this.getContentNodeSelection(action, contentEntities, focusedElementOnCloseSelector);
destinationSelection.subscribe((selections: MinimalNodeEntryEntity[]) => { destinationSelection.subscribe((selections: Node[]) => {
const contentEntry = contentEntities[0].entry; const contentEntry = contentEntities[0].entry;
// Check if there's nodeId for Shared Files // Check if there's nodeId for Shared Files
const contentEntryId = contentEntry.nodeId || contentEntry.id; const contentEntryId = contentEntry.nodeId || contentEntry.id;
@ -162,7 +155,7 @@ export class NodeActionsService {
return !notAllowedNode; return !notAllowedNode;
} }
getEntryParentId(nodeEntry: MinimalNodeEntryEntity) { getEntryParentId(nodeEntry: Node) {
let entryParentId = ''; let entryParentId = '';
if (nodeEntry.parentId) { if (nodeEntry.parentId) {
@ -174,11 +167,7 @@ export class NodeActionsService {
return entryParentId; return entryParentId;
} }
getContentNodeSelection( getContentNodeSelection(action: NodeAction, contentEntities: NodeEntry[], focusedElementOnCloseSelector?: string): Subject<Node[]> {
action: NodeAction,
contentEntities: MinimalNodeEntity[],
focusedElementOnCloseSelector?: string
): Subject<MinimalNodeEntryEntity[]> {
const currentParentFolderId = this.getEntryParentId(contentEntities[0].entry); const currentParentFolderId = this.getEntryParentId(contentEntities[0].entry);
const customDropdown = new SitePaging({ const customDropdown = new SitePaging({
@ -188,16 +177,16 @@ export class NodeActionsService {
entry: { entry: {
guid: '-my-', guid: '-my-',
title: this.translation.instant('APP.BROWSE.PERSONAL.SIDENAV_LINK.LABEL') title: this.translation.instant('APP.BROWSE.PERSONAL.SIDENAV_LINK.LABEL')
} } as Site
}, },
{ {
entry: { entry: {
guid: '-mysites-', guid: '-mysites-',
title: this.translation.instant('APP.BROWSE.LIBRARIES.MENU.MY_LIBRARIES.SIDENAV_LINK.LABEL') title: this.translation.instant('APP.BROWSE.LIBRARIES.MENU.MY_LIBRARIES.SIDENAV_LINK.LABEL')
} } as Site
} }
] ]
} } as SitePagingList
}); });
const title = this.getTitleTranslation(action, contentEntities); const title = this.getTitleTranslation(action, contentEntities);
@ -214,7 +203,7 @@ export class NodeActionsService {
imageResolver: this.imageResolver.bind(this), imageResolver: this.imageResolver.bind(this),
isSelectionValid: this.canCopyMoveInsideIt.bind(this), isSelectionValid: this.canCopyMoveInsideIt.bind(this),
breadcrumbTransform: this.customizeBreadcrumb.bind(this), breadcrumbTransform: this.customizeBreadcrumb.bind(this),
select: new Subject<MinimalNodeEntryEntity[]>(), select: new Subject<Node[]>(),
excludeSiteContent: ContentNodeDialogService.nonDocumentSiteContent excludeSiteContent: ContentNodeDialogService.nonDocumentSiteContent
}; };
@ -235,7 +224,7 @@ export class NodeActionsService {
return data.select; return data.select;
} }
getTitleTranslation(action: string, nodes: MinimalNodeEntity[] = []): string { getTitleTranslation(action: string, nodes: NodeEntry[] = []): string {
let keyPrefix = 'ITEMS'; let keyPrefix = 'ITEMS';
let name = ''; let name = '';
@ -248,11 +237,11 @@ export class NodeActionsService {
return this.translation.instant(`NODE_SELECTOR.${action.toUpperCase()}_${keyPrefix}`, { name, number }); return this.translation.instant(`NODE_SELECTOR.${action.toUpperCase()}_${keyPrefix}`, { name, number });
} }
private canCopyMoveInsideIt(entry: MinimalNodeEntryEntity): boolean { private canCopyMoveInsideIt(entry: Node): boolean {
return this.hasEntityCreatePermission(entry) && !this.isSite(entry); return this.hasEntityCreatePermission(entry) && !this.isSite(entry);
} }
private hasEntityCreatePermission(entry: MinimalNodeEntryEntity): boolean { private hasEntityCreatePermission(entry: Node): boolean {
return this.contentService.hasAllowableOperations(entry, 'create'); return this.contentService.hasAllowableOperations(entry, 'create');
} }
@ -265,7 +254,7 @@ export class NodeActionsService {
} }
// todo: review this approach once 5.2.3 is out // todo: review this approach once 5.2.3 is out
private customizeBreadcrumb(node: MinimalNodeEntryEntity) { private customizeBreadcrumb(node: Node) {
if (node && node.path && node.path.elements) { if (node && node.path && node.path.elements) {
const elements = node.path.elements; const elements = node.path.elements;
@ -300,7 +289,7 @@ export class NodeActionsService {
} }
// todo: review this approach once 5.2.3 is out // todo: review this approach once 5.2.3 is out
private normalizeSitePath(node: MinimalNodeEntryEntity) { private normalizeSitePath(node: Node) {
const elements = node.path.elements; const elements = node.path.elements;
// remove 'Company Home' // remove 'Company Home'
@ -326,7 +315,7 @@ export class NodeActionsService {
} }
} }
isSiteContainer(node: MinimalNodeEntryEntity): boolean { isSiteContainer(node: Node): boolean {
if (node && node.aspectNames && node.aspectNames.length > 0) { if (node && node.aspectNames && node.aspectNames.length > 0) {
return node.aspectNames.indexOf('st:siteContainer') >= 0; return node.aspectNames.indexOf('st:siteContainer') >= 0;
} }
@ -551,7 +540,7 @@ export class NodeActionsService {
return matchedNodes; return matchedNodes;
} }
private isActionAllowed(action: BatchOperationType, node: MinimalNodeEntryEntity, permission?: string): boolean { private isActionAllowed(action: BatchOperationType, node: Node, permission?: string): boolean {
if (action === NodeAction.COPY) { if (action === NodeAction.COPY) {
return true; return true;
} }
@ -559,14 +548,14 @@ export class NodeActionsService {
} }
private rowFilter(row: ShareDataRow): boolean { private rowFilter(row: ShareDataRow): boolean {
const node: MinimalNodeEntryEntity = row.node.entry; const node: Node = row.node.entry;
this.isSitesDestinationAvailable = !!node['guid']; this.isSitesDestinationAvailable = !!node['guid'];
return !node.isFile && node.nodeType !== 'app:folderlink'; return !node.isFile && node.nodeType !== 'app:folderlink';
} }
private imageResolver(row: ShareDataRow): string | null { private imageResolver(row: ShareDataRow): string | null {
const entry: MinimalNodeEntryEntity = row.node.entry; const entry: Node = row.node.entry;
if (!this.contentService.hasAllowableOperations(entry, 'update')) { if (!this.contentService.hasAllowableOperations(entry, 'update')) {
return this.thumbnailService.getMimeTypeIcon('disable/folder'); return this.thumbnailService.getMimeTypeIcon('disable/folder');
} }

View File

@ -26,7 +26,7 @@ import { Injectable } from '@angular/core';
import { MatDialog, MatDialogRef } from '@angular/material/dialog'; import { MatDialog, MatDialogRef } from '@angular/material/dialog';
import { CreateFromTemplateDialogComponent } from '../dialogs/node-template/create-from-template.dialog'; import { CreateFromTemplateDialogComponent } from '../dialogs/node-template/create-from-template.dialog';
import { Subject, from, of } from 'rxjs'; import { Subject, from, of } from 'rxjs';
import { Node, MinimalNode, MinimalNodeEntryEntity, ResultNode, PathElement, SearchApi } from '@alfresco/js-api'; import { Node, ResultNode, PathElement, SearchApi } from '@alfresco/js-api';
import { AlfrescoApiService, TranslationService } from '@alfresco/adf-core'; import { AlfrescoApiService, TranslationService } from '@alfresco/adf-core';
import { switchMap, catchError } from 'rxjs/operators'; import { switchMap, catchError } from 'rxjs/operators';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
@ -124,7 +124,7 @@ export class NodeTemplateService {
return dialog; return dialog;
} }
private transformNode(node: MinimalNode): MinimalNode { private transformNode(node: Node): Node {
if (node && node.path && node.path && node.path.elements instanceof Array) { if (node && node.path && node.path && node.path.elements instanceof Array) {
node.path.elements = this.getPathElements(node); node.path.elements = this.getPathElements(node);
} }
@ -157,7 +157,7 @@ export class NodeTemplateService {
} }
private rowFilter(row: ShareDataRow): boolean { private rowFilter(row: ShareDataRow): boolean {
const node: MinimalNodeEntryEntity = row.node.entry; const node: Node = row.node.entry;
return node.nodeType !== 'app:filelink' && node.nodeType !== 'app:folderlink'; return node.nodeType !== 'app:filelink' && node.nodeType !== 'app:folderlink';
} }

View File

@ -24,7 +24,7 @@
import { AppStore, DownloadNodesAction, NodeActionTypes, NodeInfo, getAppSelection, getCurrentVersion } from '@alfresco/aca-shared/store'; import { AppStore, DownloadNodesAction, NodeActionTypes, NodeInfo, getAppSelection, getCurrentVersion } from '@alfresco/aca-shared/store';
import { DownloadZipDialogComponent } from '@alfresco/adf-content-services'; import { DownloadZipDialogComponent } from '@alfresco/adf-content-services';
import { MinimalNodeEntity, Version } from '@alfresco/js-api'; import { NodeEntry, Version } from '@alfresco/js-api';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { Actions, ofType, createEffect } from '@ngrx/effects'; import { Actions, ofType, createEffect } from '@ngrx/effects';
@ -74,7 +74,7 @@ export class DownloadEffects {
{ dispatch: false } { dispatch: false }
); );
private downloadNodes(toDownload: Array<MinimalNodeEntity>, focusedElementSelector?: string) { private downloadNodes(toDownload: Array<NodeEntry>, focusedElementSelector?: string) {
const nodes = toDownload.map((node) => { const nodes = toDownload.map((node) => {
const { id, nodeId, name, isFile, isFolder } = node.entry as any; const { id, nodeId, name, isFile, isFolder } = node.entry as any;

View File

@ -39,7 +39,7 @@ import { Store } from '@ngrx/store';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { catchError, map, take } from 'rxjs/operators'; import { catchError, map, take } from 'rxjs/operators';
import { ContentManagementService } from '../../services/content-management.service'; import { ContentManagementService } from '../../services/content-management.service';
import { MinimalNodeEntryEntity } from '@alfresco/js-api'; import { Node } from '@alfresco/js-api';
import { UploadService, FileModel } from '@alfresco/adf-content-services'; import { UploadService, FileModel } from '@alfresco/adf-content-services';
@Injectable() @Injectable()
@ -137,7 +137,7 @@ export class UploadEffects {
return of(null); return of(null);
}) })
) )
.subscribe((node: MinimalNodeEntryEntity) => { .subscribe((node: Node) => {
if (node) { if (node) {
this.contentService.versionUpdateDialog(node, this.fileVersionInput.files[0]); this.contentService.versionUpdateDialog(node, this.fileVersionInput.files[0]);
this.fileVersionInput.value = ''; this.fileVersionInput.value = '';

View File

@ -35,7 +35,7 @@ import {
PageTitleService PageTitleService
} from '@alfresco/adf-core'; } from '@alfresco/adf-core';
import { DiscoveryApiService, SearchQueryBuilderService } from '@alfresco/adf-content-services'; import { DiscoveryApiService, SearchQueryBuilderService } from '@alfresco/adf-content-services';
import { RepositoryInfo } from '@alfresco/js-api'; import { RepositoryInfo, VersionInfo } from '@alfresco/js-api';
import { HttpClientModule } from '@angular/common/http'; import { HttpClientModule } from '@angular/common/http';
import { StoreModule } from '@ngrx/store'; import { StoreModule } from '@ngrx/store';
import { appReducer } from '../store/reducers/app.reducer'; import { appReducer } from '../store/reducers/app.reducer';
@ -76,7 +76,14 @@ import { STORE_INITIAL_APP_DATA } from '@alfresco/aca-shared/store';
provide: DiscoveryApiService, provide: DiscoveryApiService,
useValue: { useValue: {
ecmProductInfo$: new BehaviorSubject<RepositoryInfo | null>(null), ecmProductInfo$: new BehaviorSubject<RepositoryInfo | null>(null),
getEcmProductInfo: (): Observable<RepositoryInfo> => of(new RepositoryInfo({ version: '10.0.0' })) getEcmProductInfo: (): Observable<RepositoryInfo> =>
of(
new RepositoryInfo({
version: {
major: '10.0.0'
} as VersionInfo
})
)
} }
}, },
{ {

View File

@ -43,7 +43,7 @@ import {
ViewNodeAction ViewNodeAction
} from '@alfresco/aca-shared/store'; } from '@alfresco/aca-shared/store';
import { ContentActionRef, SelectionState } from '@alfresco/adf-extensions'; import { ContentActionRef, SelectionState } from '@alfresco/adf-extensions';
import { MinimalNodeEntryEntity, SearchRequest, VersionEntry, VersionsApi } from '@alfresco/js-api'; import { Node, SearchRequest, VersionEntry, VersionsApi } from '@alfresco/js-api';
import { Component, HostListener, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core'; import { Component, HostListener, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { ActivatedRoute, PRIMARY_OUTLET, Router } from '@angular/router'; import { ActivatedRoute, PRIMARY_OUTLET, Router } from '@angular/router';
import { AlfrescoApiService, AppConfigModule, ObjectUtils, UserPreferencesService, ViewerModule } from '@alfresco/adf-core'; import { AlfrescoApiService, AppConfigModule, ObjectUtils, UserPreferencesService, ViewerModule } from '@alfresco/adf-core';
@ -76,7 +76,7 @@ export class AcaViewerComponent implements OnInit, OnDestroy {
folderId: string = null; folderId: string = null;
nodeId: string = null; nodeId: string = null;
versionId: string = null; versionId: string = null;
node: MinimalNodeEntryEntity; node: Node;
selection: SelectionState; selection: SelectionState;
infoDrawerOpened$: Observable<boolean>; infoDrawerOpened$: Observable<boolean>;

View File

@ -5,10 +5,10 @@
"license": "LGPL-3.0", "license": "LGPL-3.0",
"scripts": {}, "scripts": {},
"peerDependencies": { "peerDependencies": {
"@alfresco/adf-content-services": "^6.3.0-5833590093", "@alfresco/adf-content-services": "^6.3.0-5977252204",
"@alfresco/adf-core": "6.3.0-5833590093", "@alfresco/adf-core": "6.3.0-5977252204",
"@alfresco/adf-extensions": "6.3.0-5833590093", "@alfresco/adf-extensions": "6.3.0-5977252204",
"@alfresco/js-api": ">=6.3.0-1104", "@alfresco/js-api": ">=6.3.0-1172",
"@angular/animations": "^14.1.3", "@angular/animations": "^14.1.3",
"@angular/common": "^14.1.3", "@angular/common": "^14.1.3",
"@angular/compiler": "^14.1.3", "@angular/compiler": "^14.1.3",

View File

@ -27,7 +27,7 @@ import { ShowHeaderMode } from '@alfresco/adf-core';
import { ContentActionRef, DocumentListPresetRef, SelectionState } from '@alfresco/adf-extensions'; import { ContentActionRef, DocumentListPresetRef, SelectionState } from '@alfresco/adf-extensions';
import { OnDestroy, OnInit, OnChanges, ViewChild, SimpleChanges, Directive, inject } from '@angular/core'; import { OnDestroy, OnInit, OnChanges, ViewChild, SimpleChanges, Directive, inject } from '@angular/core';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { MinimalNodeEntity, MinimalNodeEntryEntity, NodePaging } from '@alfresco/js-api'; import { NodeEntry, Node, NodePaging } from '@alfresco/js-api';
import { Observable, Subject, Subscription } from 'rxjs'; import { Observable, Subject, Subscription } from 'rxjs';
import { takeUntil, map } from 'rxjs/operators'; import { takeUntil, map } from 'rxjs/operators';
import { DocumentBasePageService } from './document-base-page.service'; import { DocumentBasePageService } from './document-base-page.service';
@ -58,7 +58,7 @@ export abstract class PageComponent implements OnInit, OnDestroy, OnChanges {
title = 'Page'; title = 'Page';
infoDrawerOpened$: Observable<boolean>; infoDrawerOpened$: Observable<boolean>;
node: MinimalNodeEntryEntity; node: Node;
selection: SelectionState; selection: SelectionState;
sharedPreviewUrl$: Observable<string>; sharedPreviewUrl$: Observable<string>;
actions: Array<ContentActionRef> = []; actions: Array<ContentActionRef> = [];
@ -144,7 +144,7 @@ export abstract class PageComponent implements OnInit, OnDestroy, OnChanges {
this.store.dispatch(new SetSelectedNodesAction([])); this.store.dispatch(new SetSelectedNodesAction([]));
} }
showPreview(node: MinimalNodeEntity, extras?: ViewNodeExtras) { showPreview(node: NodeEntry, extras?: ViewNodeExtras) {
if (node && node.entry) { if (node && node.entry) {
if (this.fileAutoDownloadService?.shouldFileAutoDownload(node.entry?.content?.sizeInBytes)) { if (this.fileAutoDownloadService?.shouldFileAutoDownload(node.entry?.content?.sizeInBytes)) {
this.fileAutoDownloadService.autoDownloadFile(node); this.fileAutoDownloadService.autoDownloadFile(node);
@ -180,7 +180,7 @@ export abstract class PageComponent implements OnInit, OnDestroy, OnChanges {
return null; return null;
} }
reload(selectedNode?: MinimalNodeEntity): void { reload(selectedNode?: NodeEntry): void {
if (this.isOutletPreviewUrl()) { if (this.isOutletPreviewUrl()) {
return; return;
} }

View File

@ -22,9 +22,9 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>. * from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { MinimalNodeEntity, MinimalNodeEntryEntity } from '@alfresco/js-api'; import { NodeEntry, Node } from '@alfresco/js-api';
export abstract class DocumentBasePageService { export abstract class DocumentBasePageService {
abstract canUpdateNode(node: MinimalNodeEntity): boolean; abstract canUpdateNode(node: NodeEntry): boolean;
abstract canUploadContent(node: MinimalNodeEntryEntity): boolean; abstract canUploadContent(node: Node): boolean;
} }

View File

@ -26,7 +26,7 @@ import { TestBed, ComponentFixture } from '@angular/core/testing';
import { PageComponent } from './document-base-page.component'; import { PageComponent } from './document-base-page.component';
import { ReloadDocumentListAction, SetSelectedNodesAction, AppState, ViewNodeAction } from '@alfresco/aca-shared/store'; import { ReloadDocumentListAction, SetSelectedNodesAction, AppState, ViewNodeAction } from '@alfresco/aca-shared/store';
import { AppExtensionService } from '@alfresco/aca-shared'; import { AppExtensionService } from '@alfresco/aca-shared';
import { MinimalNodeEntity, NodePaging, RepositoryInfo } from '@alfresco/js-api'; import { NodeEntry, NodePaging, RepositoryInfo, VersionInfo } from '@alfresco/js-api';
import { DocumentBasePageService } from './document-base-page.service'; import { DocumentBasePageService } from './document-base-page.service';
import { Store, StoreModule } from '@ngrx/store'; import { Store, StoreModule } from '@ngrx/store';
import { Component, Injectable } from '@angular/core'; import { Component, Injectable } from '@angular/core';
@ -141,7 +141,14 @@ describe('PageComponent', () => {
provide: DiscoveryApiService, provide: DiscoveryApiService,
useValue: { useValue: {
ecmProductInfo$: new BehaviorSubject<RepositoryInfo | null>(null), ecmProductInfo$: new BehaviorSubject<RepositoryInfo | null>(null),
getEcmProductInfo: (): Observable<RepositoryInfo> => of(new RepositoryInfo({ version: '10.0.0' })) getEcmProductInfo: (): Observable<RepositoryInfo> =>
of(
new RepositoryInfo({
version: {
major: '10.0.0'
} as VersionInfo
})
)
} }
}, },
AppExtensionService AppExtensionService
@ -198,7 +205,7 @@ describe('PageComponent', () => {
entry: { entry: {
id: 'node-id' id: 'node-id'
} }
} as MinimalNodeEntity; } as NodeEntry;
spyOn(store, 'dispatch'); spyOn(store, 'dispatch');
component.reload(node); component.reload(node);
@ -244,7 +251,7 @@ describe('PageComponent', () => {
entry: { entry: {
id: 'node-id' id: 'node-id'
} }
} as MinimalNodeEntity; } as NodeEntry;
component.showPreview(node); component.showPreview(node);
expect(store.dispatch).toHaveBeenCalledWith(new ViewNodeAction(node.entry.id)); expect(store.dispatch).toHaveBeenCalledWith(new ViewNodeAction(node.entry.id));
@ -260,7 +267,7 @@ describe('PageComponent', () => {
'cm:destination': 'original-node-id' 'cm:destination': 'original-node-id'
} }
} }
} as MinimalNodeEntity; } as NodeEntry;
component.showPreview(linkNode); component.showPreview(linkNode);
const id = linkNode.entry.properties['cm:destination']; const id = linkNode.entry.properties['cm:destination'];
@ -298,7 +305,14 @@ describe('Info Drawer state', () => {
provide: DiscoveryApiService, provide: DiscoveryApiService,
useValue: { useValue: {
ecmProductInfo$: new BehaviorSubject<RepositoryInfo | null>(null), ecmProductInfo$: new BehaviorSubject<RepositoryInfo | null>(null),
getEcmProductInfo: (): Observable<RepositoryInfo> => of(new RepositoryInfo({ version: '10.0.0' })) getEcmProductInfo: (): Observable<RepositoryInfo> =>
of(
new RepositoryInfo({
version: {
major: '10.0.0'
} as VersionInfo
})
)
} }
}, },
provideMockStore({ provideMockStore({

View File

@ -23,7 +23,7 @@
*/ */
import { Component, HostListener, Input, OnChanges, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core'; import { Component, HostListener, Input, OnChanges, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { MinimalNodeEntity, MinimalNodeEntryEntity, SiteEntry } from '@alfresco/js-api'; import { NodeEntry, Node, SiteEntry } from '@alfresco/js-api';
import { ContentActionRef, ExtensionsModule, SidebarTabRef } from '@alfresco/adf-extensions'; import { ContentActionRef, ExtensionsModule, SidebarTabRef } from '@alfresco/adf-extensions';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { SetInfoDrawerStateAction, ToggleInfoDrawerAction, infoDrawerPreview } from '@alfresco/aca-shared/store'; import { SetInfoDrawerStateAction, ToggleInfoDrawerAction, infoDrawerPreview } from '@alfresco/aca-shared/store';
@ -50,10 +50,10 @@ export class InfoDrawerComponent implements OnChanges, OnInit, OnDestroy {
nodeId: string; nodeId: string;
@Input() @Input()
node: MinimalNodeEntity; node: NodeEntry;
isLoading = false; isLoading = false;
displayNode: MinimalNodeEntryEntity | SiteEntry; displayNode: Node | SiteEntry;
tabs: Array<SidebarTabRef> = []; tabs: Array<SidebarTabRef> = [];
actions: Array<ContentActionRef> = []; actions: Array<ContentActionRef> = [];
onDestroy$ = new Subject<boolean>(); onDestroy$ = new Subject<boolean>();

View File

@ -48,7 +48,7 @@ import { STORE_INITIAL_APP_DATA } from '../../../store/src/states/app.state';
import { provideMockStore } from '@ngrx/store/testing'; import { provideMockStore } from '@ngrx/store/testing';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import { RepositoryInfo } from '@alfresco/js-api'; import { RepositoryInfo, VersionInfo } from '@alfresco/js-api';
import { MatDialogModule } from '@angular/material/dialog'; import { MatDialogModule } from '@angular/material/dialog';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
@ -81,7 +81,14 @@ describe('AppService', () => {
provide: DiscoveryApiService, provide: DiscoveryApiService,
useValue: { useValue: {
ecmProductInfo$: new BehaviorSubject<RepositoryInfo>(null), ecmProductInfo$: new BehaviorSubject<RepositoryInfo>(null),
getEcmProductInfo: (): Observable<RepositoryInfo> => of(new RepositoryInfo({ version: '10.0.0' })) getEcmProductInfo: (): Observable<RepositoryInfo> =>
of(
new RepositoryInfo({
version: {
major: '10.0.0'
} as VersionInfo
})
)
} }
}, },
{ {

View File

@ -26,7 +26,6 @@ import { Injectable } from '@angular/core';
import { AlfrescoApiService, UserPreferencesService } from '@alfresco/adf-core'; import { AlfrescoApiService, UserPreferencesService } from '@alfresco/adf-core';
import { Observable, from } from 'rxjs'; import { Observable, from } from 'rxjs';
import { import {
MinimalNodeEntity,
NodePaging, NodePaging,
Node, Node,
DeletedNodesPaging, DeletedNodesPaging,
@ -37,9 +36,9 @@ import {
SharedLinkPaging, SharedLinkPaging,
SearchRequest, SearchRequest,
ResultSetPaging, ResultSetPaging,
SiteBody, SiteBodyCreate,
SiteEntry, SiteEntry,
FavoriteBody, FavoriteBodyCreate,
FavoriteEntry, FavoriteEntry,
NodesApi, NodesApi,
TrashcanApi, TrashcanApi,
@ -139,7 +138,7 @@ export class ContentApiService {
* @param options Optional parameters supported by JS-API * @param options Optional parameters supported by JS-API
* @returns Node information * @returns Node information
*/ */
getNode(nodeId: string, options: any = {}): Observable<MinimalNodeEntity> { getNode(nodeId: string, options: any = {}): Observable<NodeEntry> {
const defaults = { const defaults = {
include: ['path', 'properties', 'allowableOperations', 'permissions', 'definition'] include: ['path', 'properties', 'allowableOperations', 'permissions', 'definition']
}; };
@ -199,7 +198,7 @@ export class ContentApiService {
return from(this.trashcanApi.listDeletedNodes(queryOptions)); return from(this.trashcanApi.listDeletedNodes(queryOptions));
} }
restoreNode(nodeId: string): Observable<MinimalNodeEntity> { restoreNode(nodeId: string): Observable<NodeEntry> {
return from(this.trashcanApi.restoreDeletedNode(nodeId)); return from(this.trashcanApi.restoreDeletedNode(nodeId));
} }
@ -299,7 +298,7 @@ export class ContentApiService {
} }
createSite( createSite(
siteBody: SiteBody, siteBody: SiteBodyCreate,
opts?: { opts?: {
fields?: Array<string>; fields?: Array<string>;
skipConfiguration?: boolean; skipConfiguration?: boolean;
@ -313,12 +312,12 @@ export class ContentApiService {
return from(this.sitesApi.getSite(siteId, opts)); return from(this.sitesApi.getSite(siteId, opts));
} }
updateLibrary(siteId: string, siteBody: SiteBody): Observable<SiteEntry> { updateLibrary(siteId: string, siteBody: SiteBodyCreate): Observable<SiteEntry> {
return from(this.sitesApi.updateSite(siteId, siteBody)); return from(this.sitesApi.updateSite(siteId, siteBody));
} }
addFavorite(nodes: Array<MinimalNodeEntity>): Observable<FavoriteEntry> { addFavorite(nodes: Array<NodeEntry>): Observable<FavoriteEntry> {
const payload: FavoriteBody[] = nodes.map((node) => { const payload: FavoriteBodyCreate[] = nodes.map((node) => {
const { isFolder, nodeId, id } = node.entry as any; const { isFolder, nodeId, id } = node.entry as any;
const siteId = node.entry['guid']; const siteId = node.entry['guid'];
const type = siteId ? 'site' : isFolder ? 'folder' : 'file'; const type = siteId ? 'site' : isFolder ? 'folder' : 'file';
@ -336,7 +335,7 @@ export class ContentApiService {
return from(this.favoritesApi.createFavorite('-me-', payload as any)); return from(this.favoritesApi.createFavorite('-me-', payload as any));
} }
removeFavorite(nodes: Array<MinimalNodeEntity>): Observable<any> { removeFavorite(nodes: Array<NodeEntry>): Observable<any> {
return from( return from(
Promise.all( Promise.all(
nodes.map((node: any) => { nodes.map((node: any) => {
@ -347,7 +346,7 @@ export class ContentApiService {
); );
} }
unlockNode(nodeId: string, opts?: any): Promise<MinimalNodeEntity> { unlockNode(nodeId: string, opts?: any): Promise<NodeEntry> {
return this.nodesApi.unlockNode(nodeId, opts); return this.nodesApi.unlockNode(nodeId, opts);
} }

View File

@ -23,7 +23,7 @@
*/ */
import { Action } from '@ngrx/store'; import { Action } from '@ngrx/store';
import { SiteBody } from '@alfresco/js-api'; import { SiteBodyCreate } from '@alfresco/js-api';
import { ModalConfiguration } from '../models/modal-configuration'; import { ModalConfiguration } from '../models/modal-configuration';
export enum LibraryActionTypes { export enum LibraryActionTypes {
@ -53,7 +53,7 @@ export class NavigateLibraryAction implements Action {
export class UpdateLibraryAction implements Action { export class UpdateLibraryAction implements Action {
readonly type = LibraryActionTypes.Update; readonly type = LibraryActionTypes.Update;
constructor(public payload?: SiteBody) {} constructor(public payload?: SiteBodyCreate) {}
} }
export class LeaveLibraryAction implements Action { export class LeaveLibraryAction implements Action {

View File

@ -23,7 +23,7 @@
*/ */
import { Action } from '@ngrx/store'; import { Action } from '@ngrx/store';
import { MinimalNodeEntity } from '@alfresco/js-api'; import { NodeEntry } from '@alfresco/js-api';
import { ModalConfiguration } from '../models/modal-configuration'; import { ModalConfiguration } from '../models/modal-configuration';
export enum NodeActionTypes { export enum NodeActionTypes {
@ -54,13 +54,13 @@ export enum NodeActionTypes {
export class SetSelectedNodesAction implements Action { export class SetSelectedNodesAction implements Action {
readonly type = NodeActionTypes.SetSelection; readonly type = NodeActionTypes.SetSelection;
constructor(public payload: MinimalNodeEntity[] = []) {} constructor(public payload: NodeEntry[] = []) {}
} }
export class DeleteNodesAction implements Action { export class DeleteNodesAction implements Action {
readonly type = NodeActionTypes.Delete; readonly type = NodeActionTypes.Delete;
constructor(public payload: MinimalNodeEntity[] = []) {} constructor(public payload: NodeEntry[] = []) {}
} }
export class UndoDeleteNodesAction implements Action { export class UndoDeleteNodesAction implements Action {
@ -72,19 +72,19 @@ export class UndoDeleteNodesAction implements Action {
export class RestoreDeletedNodesAction implements Action { export class RestoreDeletedNodesAction implements Action {
readonly type = NodeActionTypes.RestoreDeleted; readonly type = NodeActionTypes.RestoreDeleted;
constructor(public payload: Array<MinimalNodeEntity>) {} constructor(public payload: Array<NodeEntry>) {}
} }
export class PurgeDeletedNodesAction implements Action { export class PurgeDeletedNodesAction implements Action {
readonly type = NodeActionTypes.PurgeDeleted; readonly type = NodeActionTypes.PurgeDeleted;
constructor(public payload: Array<MinimalNodeEntity>) {} constructor(public payload: Array<NodeEntry>) {}
} }
export class DownloadNodesAction implements Action { export class DownloadNodesAction implements Action {
readonly type = NodeActionTypes.Download; readonly type = NodeActionTypes.Download;
constructor(public payload: MinimalNodeEntity[] = [], public configuration?: ModalConfiguration) {} constructor(public payload: NodeEntry[] = [], public configuration?: ModalConfiguration) {}
} }
export class CreateFolderAction implements Action { export class CreateFolderAction implements Action {
@ -96,60 +96,60 @@ export class CreateFolderAction implements Action {
export class EditFolderAction implements Action { export class EditFolderAction implements Action {
readonly type = NodeActionTypes.EditFolder; readonly type = NodeActionTypes.EditFolder;
constructor(public payload: MinimalNodeEntity, public configuration?: ModalConfiguration) {} constructor(public payload: NodeEntry, public configuration?: ModalConfiguration) {}
} }
export class ShareNodeAction implements Action { export class ShareNodeAction implements Action {
readonly type = NodeActionTypes.Share; readonly type = NodeActionTypes.Share;
constructor(public payload: MinimalNodeEntity, public configuration?: ModalConfiguration) {} constructor(public payload: NodeEntry, public configuration?: ModalConfiguration) {}
} }
export class UnshareNodesAction implements Action { export class UnshareNodesAction implements Action {
readonly type = NodeActionTypes.Unshare; readonly type = NodeActionTypes.Unshare;
constructor(public payload: Array<MinimalNodeEntity>) {} constructor(public payload: Array<NodeEntry>) {}
} }
export class CopyNodesAction implements Action { export class CopyNodesAction implements Action {
readonly type = NodeActionTypes.Copy; readonly type = NodeActionTypes.Copy;
constructor(public payload: Array<MinimalNodeEntity>, public configuration?: ModalConfiguration) {} constructor(public payload: Array<NodeEntry>, public configuration?: ModalConfiguration) {}
} }
export class MoveNodesAction implements Action { export class MoveNodesAction implements Action {
readonly type = NodeActionTypes.Move; readonly type = NodeActionTypes.Move;
constructor(public payload: Array<MinimalNodeEntity>, public configuration?: ModalConfiguration) {} constructor(public payload: Array<NodeEntry>, public configuration?: ModalConfiguration) {}
} }
export class ManagePermissionsAction implements Action { export class ManagePermissionsAction implements Action {
readonly type = NodeActionTypes.ManagePermissions; readonly type = NodeActionTypes.ManagePermissions;
constructor(public payload: MinimalNodeEntity) {} constructor(public payload: NodeEntry) {}
} }
export class ExpandInfoDrawerAction implements Action { export class ExpandInfoDrawerAction implements Action {
readonly type = NodeActionTypes.ExpandInfoDrawer; readonly type = NodeActionTypes.ExpandInfoDrawer;
constructor(public payload: MinimalNodeEntity) {} constructor(public payload: NodeEntry) {}
} }
export class PrintFileAction implements Action { export class PrintFileAction implements Action {
readonly type = NodeActionTypes.PrintFile; readonly type = NodeActionTypes.PrintFile;
constructor(public payload: MinimalNodeEntity) {} constructor(public payload: NodeEntry) {}
} }
export class ManageVersionsAction implements Action { export class ManageVersionsAction implements Action {
readonly type = NodeActionTypes.ManageVersions; readonly type = NodeActionTypes.ManageVersions;
constructor(public payload: MinimalNodeEntity, public configuration?: ModalConfiguration) {} constructor(public payload: NodeEntry, public configuration?: ModalConfiguration) {}
} }
export class EditOfflineAction implements Action { export class EditOfflineAction implements Action {
readonly type = NodeActionTypes.EditOffline; readonly type = NodeActionTypes.EditOffline;
constructor(public payload: any) {} constructor(public payload: NodeEntry) {}
} }
export class UnlockWriteAction implements Action { export class UnlockWriteAction implements Action {
@ -161,22 +161,22 @@ export class UnlockWriteAction implements Action {
export class AddFavoriteAction implements Action { export class AddFavoriteAction implements Action {
readonly type = NodeActionTypes.AddFavorite; readonly type = NodeActionTypes.AddFavorite;
constructor(public payload: Array<MinimalNodeEntity>) {} constructor(public payload: Array<NodeEntry>) {}
} }
export class RemoveFavoriteAction implements Action { export class RemoveFavoriteAction implements Action {
readonly type = NodeActionTypes.RemoveFavorite; readonly type = NodeActionTypes.RemoveFavorite;
constructor(public payload: Array<MinimalNodeEntity>) {} constructor(public payload: Array<NodeEntry>) {}
} }
export class ManageAspectsAction implements Action { export class ManageAspectsAction implements Action {
readonly type = NodeActionTypes.ChangeAspects; readonly type = NodeActionTypes.ChangeAspects;
constructor(public payload: MinimalNodeEntity, public configuration?: ModalConfiguration) {} constructor(public payload: NodeEntry, public configuration?: ModalConfiguration) {}
} }
export class ManageRulesAction implements Action { export class ManageRulesAction implements Action {
readonly type = NodeActionTypes.ManageRules; readonly type = NodeActionTypes.ManageRules;
constructor(public payload: MinimalNodeEntity) {} constructor(public payload: NodeEntry) {}
} }

View File

@ -23,7 +23,7 @@
*/ */
import { Action } from '@ngrx/store'; import { Action } from '@ngrx/store';
import { MinimalNodeEntity } from '@alfresco/js-api'; import { NodeEntry } from '@alfresco/js-api';
import { RouterActionTypes } from './router-action-types'; import { RouterActionTypes } from './router-action-types';
export class NavigateUrlAction implements Action { export class NavigateUrlAction implements Action {
@ -41,13 +41,13 @@ export class NavigateRouteAction implements Action {
export class NavigateToFolder implements Action { export class NavigateToFolder implements Action {
readonly type = RouterActionTypes.NavigateFolder; readonly type = RouterActionTypes.NavigateFolder;
constructor(public payload: MinimalNodeEntity) {} constructor(public payload: NodeEntry) {}
} }
export class NavigateToParentFolder implements Action { export class NavigateToParentFolder implements Action {
readonly type = RouterActionTypes.NavigateParentFolder; readonly type = RouterActionTypes.NavigateParentFolder;
constructor(public payload: MinimalNodeEntity) {} constructor(public payload: NodeEntry) {}
} }
export class NavigateToPreviousPage implements Action { export class NavigateToPreviousPage implements Action {

View File

@ -23,7 +23,7 @@
*/ */
import { Action } from '@ngrx/store'; import { Action } from '@ngrx/store';
import { MinimalNodeEntity } from '@alfresco/js-api'; import { NodeEntry } from '@alfresco/js-api';
export enum ViewerActionTypes { export enum ViewerActionTypes {
ViewFile = 'VIEW_FILE', ViewFile = 'VIEW_FILE',
@ -43,7 +43,7 @@ export interface ViewNodeExtras {
export class ViewFileAction implements Action { export class ViewFileAction implements Action {
readonly type = ViewerActionTypes.ViewFile; readonly type = ViewerActionTypes.ViewFile;
constructor(public payload?: MinimalNodeEntity, public parentId?: string) {} constructor(public payload?: NodeEntry, public parentId?: string) {}
} }
export class ViewNodeAction implements Action { export class ViewNodeAction implements Action {
@ -61,17 +61,17 @@ export class ViewNodeVersionAction implements Action {
export class FullscreenViewerAction implements Action { export class FullscreenViewerAction implements Action {
readonly type = ViewerActionTypes.FullScreen; readonly type = ViewerActionTypes.FullScreen;
constructor(public payload: MinimalNodeEntity) {} constructor(public payload: NodeEntry) {}
} }
export class ClosePreviewAction implements Action { export class ClosePreviewAction implements Action {
readonly type = ViewerActionTypes.ClosePreview; readonly type = ViewerActionTypes.ClosePreview;
constructor(public payload?: MinimalNodeEntity) {} constructor(public payload?: NodeEntry) {}
} }
export class RefreshPreviewAction implements Action { export class RefreshPreviewAction implements Action {
readonly type = ViewerActionTypes.RefreshPreview; readonly type = ViewerActionTypes.RefreshPreview;
constructor(public payload?: MinimalNodeEntity) {} constructor(public payload?: NodeEntry) {}
} }
export class PluginPreviewAction implements Action { export class PluginPreviewAction implements Action {

View File

@ -25,7 +25,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { Actions, ofType, createEffect } from '@ngrx/effects'; import { Actions, ofType, createEffect } from '@ngrx/effects';
import { MinimalNodeEntryEntity, PathInfoEntity } from '@alfresco/js-api'; import { Node, PathInfo } from '@alfresco/js-api';
import { map } from 'rxjs/operators'; import { map } from 'rxjs/operators';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { AppStore } from '../states/app.state'; import { AppStore } from '../states/app.state';
@ -97,7 +97,7 @@ export class RouterEffects {
{ dispatch: false } { dispatch: false }
); );
private navigateToFolder(node: MinimalNodeEntryEntity) { private navigateToFolder(node: Node) {
let link: any[] = null; let link: any[] = null;
const { path, id } = node; const { path, id } = node;
@ -122,7 +122,7 @@ export class RouterEffects {
} }
} }
private navigateToParentFolder(node: MinimalNodeEntryEntity) { private navigateToParentFolder(node: Node) {
let link: any[] = null; let link: any[] = null;
const { path } = node; const { path } = node;
@ -147,7 +147,7 @@ export class RouterEffects {
} }
} }
private isLibraryContent(path: PathInfoEntity): boolean { private isLibraryContent(path: PathInfo): boolean {
return path && path.elements.length >= 2 && path.elements[1].name === 'Sites'; return path && path.elements.length >= 2 && path.elements[1].name === 'Sites';
} }
} }

View File

@ -25,9 +25,9 @@
import { RepoApi } from '../repo-api'; import { RepoApi } from '../repo-api';
import { Logger } from '@alfresco/adf-testing'; import { Logger } from '@alfresco/adf-testing';
import { import {
SiteBody, SiteBodyCreate,
SiteMemberRoleBody, SiteMembershipBodyUpdate,
SiteMemberBody, SiteMembershipBodyCreate,
SiteEntry, SiteEntry,
SiteMembershipRequestEntry, SiteMembershipRequestEntry,
SitesApi as AdfSiteApi, SitesApi as AdfSiteApi,
@ -69,7 +69,7 @@ export class SitesApi extends RepoApi {
visibility: visibility || SITE_VISIBILITY.PUBLIC, visibility: visibility || SITE_VISIBILITY.PUBLIC,
description: description, description: description,
id: siteId || title id: siteId || title
} as SiteBody; } as SiteBodyCreate;
try { try {
await this.apiAuth(); await this.apiAuth();
@ -136,7 +136,7 @@ export class SitesApi extends RepoApi {
async updateSiteMember(siteId: string, userId: string, role: string) { async updateSiteMember(siteId: string, userId: string, role: string) {
const siteRole = { const siteRole = {
role: role role: role
} as SiteMemberRoleBody; } as SiteMembershipBodyUpdate;
try { try {
await this.apiAuth(); await this.apiAuth();
@ -151,7 +151,7 @@ export class SitesApi extends RepoApi {
const memberBody = { const memberBody = {
id: userId, id: userId,
role: role role: role
} as SiteMemberBody; } as SiteMembershipBodyCreate;
try { try {
await this.apiAuth(); await this.apiAuth();

View File

@ -23,7 +23,7 @@
*/ */
import { RepoApi } from '../repo-api'; import { RepoApi } from '../repo-api';
import { UploadApi as AdfUploadApi } from '@alfresco/js-api'; import { NodeBodyCreate, UploadApi as AdfUploadApi } from '@alfresco/js-api';
import { browser } from 'protractor'; import { browser } from 'protractor';
import * as fs from 'fs'; import * as fs from 'fs';
@ -66,7 +66,7 @@ export class UploadApi extends RepoApi {
try { try {
await this.apiAuth(); await this.apiAuth();
return await this.upload.uploadFile(file, '', parentId, nodeProps, opts); return await this.upload.uploadFile(file, '', parentId, nodeProps as NodeBodyCreate, opts);
} catch (error) { } catch (error) {
this.handleError(`${this.constructor.name} ${this.uploadFileWithRename.name}`, error); this.handleError(`${this.constructor.name} ${this.uploadFileWithRename.name}`, error);
} }