mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-26 17:24:45 +00:00
[ACA-1078] next/prev navigation for the Viewer (#187)
* basic navigation through the folder * carousel mode for libraries * code polishing * save and restore sorting settings * get user sorting preferences into account * sorting fixes * full test coverage
This commit is contained in:
parent
34e322e9f6
commit
3cff48cac5
package-lock.jsonpackage.json
src/app
app.routes.ts
yarn.lockcomponents
150
package-lock.json
generated
150
package-lock.json
generated
@ -5,11 +5,11 @@
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@alfresco/adf-content-services": {
|
||||
"version": "2.2.0-beta1",
|
||||
"resolved": "https://registry.npmjs.org/@alfresco/adf-content-services/-/adf-content-services-2.2.0-beta1.tgz",
|
||||
"integrity": "sha512-6x0FK+S/aPyd7q+jwbuYAoAt/nOgKk6TtbOfa402DaLN1ZWSw0LqqSqSAPdWXQSz4nFgsyjVKMGu1e68qev5qQ==",
|
||||
"version": "2.2.0-0e512083331b094a1593e9b1f081ff441db01786",
|
||||
"resolved": "https://registry.npmjs.org/@alfresco/adf-content-services/-/adf-content-services-2.2.0-0e512083331b094a1593e9b1f081ff441db01786.tgz",
|
||||
"integrity": "sha512-87pv+A0omOAXU7a8yZG2hsEsAu3Mif5tXu4iR8MNpW7lV9ccVoTFKJUm4ikCc8TjvLwsG38mF0Op9/b2BynMUA==",
|
||||
"requires": {
|
||||
"@alfresco/adf-core": "2.2.0-beta1",
|
||||
"@alfresco/adf-core": "2.2.0-0e512083331b094a1593e9b1f081ff441db01786",
|
||||
"@angular/animations": "5.1.1",
|
||||
"@angular/cdk": "5.0.1",
|
||||
"@angular/common": "5.1.1",
|
||||
@ -24,7 +24,7 @@
|
||||
"@angular/platform-browser-dynamic": "5.1.1",
|
||||
"@angular/router": "5.1.1",
|
||||
"@ngx-translate/core": "8.0.0",
|
||||
"alfresco-js-api": "2.2.0-beta1",
|
||||
"alfresco-js-api": "2.1.0-4c702fe0041642c09f12fb939014cf70671d8ed8",
|
||||
"chart.js": "2.5.0",
|
||||
"core-js": "2.4.1",
|
||||
"hammerjs": "2.0.8",
|
||||
@ -39,6 +39,15 @@
|
||||
"zone.js": "0.8.14"
|
||||
},
|
||||
"dependencies": {
|
||||
"alfresco-js-api": {
|
||||
"version": "2.1.0-4c702fe0041642c09f12fb939014cf70671d8ed8",
|
||||
"resolved": "https://registry.npmjs.org/alfresco-js-api/-/alfresco-js-api-2.1.0-4c702fe0041642c09f12fb939014cf70671d8ed8.tgz",
|
||||
"integrity": "sha512-Di8nhuvUcUNMPA03RxaIhOxsN9rYwPEPQhhLE+iXBG1kiF91EpKpfkaQAo28gOBXalTnA1Rh8B0MI5mEethWCw==",
|
||||
"requires": {
|
||||
"event-emitter": "0.3.4",
|
||||
"superagent": "3.8.2"
|
||||
}
|
||||
},
|
||||
"core-js": {
|
||||
"version": "2.4.1",
|
||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.4.1.tgz",
|
||||
@ -60,9 +69,9 @@
|
||||
}
|
||||
},
|
||||
"@alfresco/adf-core": {
|
||||
"version": "2.2.0-beta1",
|
||||
"resolved": "https://registry.npmjs.org/@alfresco/adf-core/-/adf-core-2.2.0-beta1.tgz",
|
||||
"integrity": "sha512-+0F9iNuzT1a1zboVtuPcZ1Br3sHGCn2lonFly2UfSMZSgtvUYMvrJ/eQin/4LJa43NLBZqZ5HpEr3k8/ZvMPMA==",
|
||||
"version": "2.2.0-0e512083331b094a1593e9b1f081ff441db01786",
|
||||
"resolved": "https://registry.npmjs.org/@alfresco/adf-core/-/adf-core-2.2.0-0e512083331b094a1593e9b1f081ff441db01786.tgz",
|
||||
"integrity": "sha512-Uu9EbUVyiQ4vYOTMTKL0gifs26zDj/cDXXjao+2ogdQqW2ngjsahuo7pf3xD2GR4ZLuIHT2IEnPeOOngNnJTGA==",
|
||||
"requires": {
|
||||
"@angular/animations": "5.1.1",
|
||||
"@angular/cdk": "5.0.1",
|
||||
@ -78,7 +87,7 @@
|
||||
"@angular/platform-browser-dynamic": "5.1.1",
|
||||
"@angular/router": "5.1.1",
|
||||
"@ngx-translate/core": "8.0.0",
|
||||
"alfresco-js-api": "2.2.0-beta1",
|
||||
"alfresco-js-api": "2.1.0-4c702fe0041642c09f12fb939014cf70671d8ed8",
|
||||
"chart.js": "2.5.0",
|
||||
"core-js": "2.4.1",
|
||||
"hammerjs": "2.0.8",
|
||||
@ -93,6 +102,15 @@
|
||||
"zone.js": "0.8.14"
|
||||
},
|
||||
"dependencies": {
|
||||
"alfresco-js-api": {
|
||||
"version": "2.1.0-4c702fe0041642c09f12fb939014cf70671d8ed8",
|
||||
"resolved": "https://registry.npmjs.org/alfresco-js-api/-/alfresco-js-api-2.1.0-4c702fe0041642c09f12fb939014cf70671d8ed8.tgz",
|
||||
"integrity": "sha512-Di8nhuvUcUNMPA03RxaIhOxsN9rYwPEPQhhLE+iXBG1kiF91EpKpfkaQAo28gOBXalTnA1Rh8B0MI5mEethWCw==",
|
||||
"requires": {
|
||||
"event-emitter": "0.3.4",
|
||||
"superagent": "3.8.2"
|
||||
}
|
||||
},
|
||||
"core-js": {
|
||||
"version": "2.4.1",
|
||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.4.1.tgz",
|
||||
@ -239,7 +257,7 @@
|
||||
"less-loader": "4.0.5",
|
||||
"license-webpack-plugin": "1.1.1",
|
||||
"loader-utils": "1.1.0",
|
||||
"lodash": "4.17.4",
|
||||
"lodash": "4.17.5",
|
||||
"memory-fs": "0.4.1",
|
||||
"minimatch": "3.0.4",
|
||||
"node-modules-path": "1.0.1",
|
||||
@ -936,7 +954,7 @@
|
||||
"integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"lodash": "4.17.4"
|
||||
"lodash": "4.17.5"
|
||||
}
|
||||
},
|
||||
"async-each": {
|
||||
@ -976,7 +994,7 @@
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"browserslist": "2.11.3",
|
||||
"caniuse-lite": "1.0.30000792",
|
||||
"caniuse-lite": "1.0.30000803",
|
||||
"normalize-range": "0.1.2",
|
||||
"num2fraction": "1.2.2",
|
||||
"postcss": "6.0.17",
|
||||
@ -1044,9 +1062,9 @@
|
||||
}
|
||||
},
|
||||
"babel-generator": {
|
||||
"version": "6.26.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.0.tgz",
|
||||
"integrity": "sha1-rBriAHC3n248odMmlhMFN3TyDcU=",
|
||||
"version": "6.26.1",
|
||||
"resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz",
|
||||
"integrity": "sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"babel-messages": "6.23.0",
|
||||
@ -1054,7 +1072,7 @@
|
||||
"babel-types": "6.26.0",
|
||||
"detect-indent": "4.0.0",
|
||||
"jsesc": "1.3.0",
|
||||
"lodash": "4.17.4",
|
||||
"lodash": "4.17.5",
|
||||
"source-map": "0.5.7",
|
||||
"trim-right": "1.0.1"
|
||||
},
|
||||
@ -1096,7 +1114,7 @@
|
||||
"babel-traverse": "6.26.0",
|
||||
"babel-types": "6.26.0",
|
||||
"babylon": "6.18.0",
|
||||
"lodash": "4.17.4"
|
||||
"lodash": "4.17.5"
|
||||
}
|
||||
},
|
||||
"babel-traverse": {
|
||||
@ -1113,7 +1131,7 @@
|
||||
"debug": "2.6.9",
|
||||
"globals": "9.18.0",
|
||||
"invariant": "2.2.2",
|
||||
"lodash": "4.17.4"
|
||||
"lodash": "4.17.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
@ -1135,7 +1153,7 @@
|
||||
"requires": {
|
||||
"babel-runtime": "6.26.0",
|
||||
"esutils": "2.0.2",
|
||||
"lodash": "4.17.4",
|
||||
"lodash": "4.17.5",
|
||||
"to-fast-properties": "1.0.3"
|
||||
}
|
||||
},
|
||||
@ -1628,7 +1646,7 @@
|
||||
"integrity": "sha512-yWu5cXT7Av6mVwzWc8lMsJMHWn4xyjSuGYi4IozbVTLUOEYPSagUB8kiMDUHA1fS3zjr8nkxkn9jdvug4BBRmA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"caniuse-lite": "1.0.30000792",
|
||||
"caniuse-lite": "1.0.30000803",
|
||||
"electron-to-chromium": "1.3.32"
|
||||
}
|
||||
},
|
||||
@ -1786,7 +1804,7 @@
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"browserslist": "1.7.7",
|
||||
"caniuse-db": "1.0.30000800",
|
||||
"caniuse-db": "1.0.30000803",
|
||||
"lodash.memoize": "4.1.2",
|
||||
"lodash.uniq": "4.5.0"
|
||||
},
|
||||
@ -1797,22 +1815,22 @@
|
||||
"integrity": "sha1-C9dnBCWL6CmyOYu1Dkti0aFmsLk=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"caniuse-db": "1.0.30000800",
|
||||
"caniuse-db": "1.0.30000803",
|
||||
"electron-to-chromium": "1.3.32"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"caniuse-db": {
|
||||
"version": "1.0.30000800",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30000800.tgz",
|
||||
"integrity": "sha1-qG5rwjvZpwfV30LzPmTQSVz9ohg=",
|
||||
"version": "1.0.30000803",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30000803.tgz",
|
||||
"integrity": "sha1-Po0rr1bC/VpZyC4ieSig3CwmcC0=",
|
||||
"dev": true
|
||||
},
|
||||
"caniuse-lite": {
|
||||
"version": "1.0.30000792",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000792.tgz",
|
||||
"integrity": "sha1-0M6pgfgRjzlhRxr7tDyaHlu/AzI=",
|
||||
"version": "1.0.30000803",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000803.tgz",
|
||||
"integrity": "sha512-AoROHIFLv2iv5CG4nonOfT9ZCQ3JTN0GyEn8LG2sPb2Wc5cIyX/UwLYP0pnVajVF3LWH+mrO/DXBzmte0BK9cQ==",
|
||||
"dev": true
|
||||
},
|
||||
"caseless": {
|
||||
@ -6641,7 +6659,7 @@
|
||||
"integrity": "sha1-RYwH4J4NkA/Ci3Cj/sLazR0st/Y=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"lodash": "4.17.4"
|
||||
"lodash": "4.17.5"
|
||||
}
|
||||
},
|
||||
"combine-source-map": {
|
||||
@ -6898,7 +6916,7 @@
|
||||
"globby": "7.1.1",
|
||||
"is-glob": "4.0.0",
|
||||
"loader-utils": "0.2.17",
|
||||
"lodash": "4.17.4",
|
||||
"lodash": "4.17.5",
|
||||
"minimatch": "3.0.4",
|
||||
"p-limit": "1.2.0",
|
||||
"pify": "3.0.0",
|
||||
@ -7238,7 +7256,7 @@
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"browserslist": "1.7.7",
|
||||
"caniuse-db": "1.0.30000800",
|
||||
"caniuse-db": "1.0.30000803",
|
||||
"normalize-range": "0.1.2",
|
||||
"num2fraction": "1.2.2",
|
||||
"postcss": "5.2.18",
|
||||
@ -7251,7 +7269,7 @@
|
||||
"integrity": "sha1-C9dnBCWL6CmyOYu1Dkti0aFmsLk=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"caniuse-db": "1.0.30000800",
|
||||
"caniuse-db": "1.0.30000803",
|
||||
"electron-to-chromium": "1.3.32"
|
||||
}
|
||||
},
|
||||
@ -9840,7 +9858,7 @@
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"glob": "7.1.2",
|
||||
"lodash": "4.17.4",
|
||||
"lodash": "4.17.5",
|
||||
"minimatch": "3.0.4"
|
||||
}
|
||||
},
|
||||
@ -10128,7 +10146,7 @@
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"lodash": "4.17.4",
|
||||
"lodash": "4.17.5",
|
||||
"request": "2.81.0"
|
||||
}
|
||||
},
|
||||
@ -10213,7 +10231,7 @@
|
||||
"bluebird": "3.5.1",
|
||||
"html-minifier": "3.5.8",
|
||||
"loader-utils": "0.2.17",
|
||||
"lodash": "4.17.4",
|
||||
"lodash": "4.17.5",
|
||||
"pretty-error": "2.1.1",
|
||||
"toposort": "1.0.6"
|
||||
},
|
||||
@ -10318,9 +10336,9 @@
|
||||
}
|
||||
},
|
||||
"http-parser-js": {
|
||||
"version": "0.4.9",
|
||||
"resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.4.9.tgz",
|
||||
"integrity": "sha1-6hoE+2St/wJC6ZdPKX3Uw8rSceE=",
|
||||
"version": "0.4.10",
|
||||
"resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.4.10.tgz",
|
||||
"integrity": "sha1-ksnBN0w1CF912zWexWzCV8u5P6Q=",
|
||||
"dev": true
|
||||
},
|
||||
"http-proxy": {
|
||||
@ -10363,7 +10381,7 @@
|
||||
"requires": {
|
||||
"http-proxy": "1.16.2",
|
||||
"is-glob": "3.1.0",
|
||||
"lodash": "4.17.4",
|
||||
"lodash": "4.17.5",
|
||||
"micromatch": "2.3.11"
|
||||
},
|
||||
"dependencies": {
|
||||
@ -11082,7 +11100,7 @@
|
||||
"integrity": "sha512-RQmXeQ7sphar7k7O1wTNzVczF9igKpaeGQAG9qR2L+BS4DCJNTI9nytRmIVYevwO0bbq+2CXvJmYDuz0gMrywA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"babel-generator": "6.26.0",
|
||||
"babel-generator": "6.26.1",
|
||||
"babel-template": "6.26.0",
|
||||
"babel-traverse": "6.26.0",
|
||||
"babel-types": "6.26.0",
|
||||
@ -11143,20 +11161,20 @@
|
||||
}
|
||||
},
|
||||
"jasmine": {
|
||||
"version": "2.9.0",
|
||||
"resolved": "https://registry.npmjs.org/jasmine/-/jasmine-2.9.0.tgz",
|
||||
"integrity": "sha1-dlcfklyHg0CefGFTVy5aY0HPk+s=",
|
||||
"version": "2.99.0",
|
||||
"resolved": "https://registry.npmjs.org/jasmine/-/jasmine-2.99.0.tgz",
|
||||
"integrity": "sha1-jKctEC5jm4Z8ZImFbg4YqceqQrc=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"exit": "0.1.2",
|
||||
"glob": "7.1.2",
|
||||
"jasmine-core": "2.9.1"
|
||||
"jasmine-core": "2.99.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"jasmine-core": {
|
||||
"version": "2.9.1",
|
||||
"resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.9.1.tgz",
|
||||
"integrity": "sha1-trvB2OZSUNVvWIhGFwXr7uuI8i8=",
|
||||
"version": "2.99.0",
|
||||
"resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.99.0.tgz",
|
||||
"integrity": "sha1-wQWrUiLaRfGwoQWAOD9a27/1bSw=",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
@ -11374,7 +11392,7 @@
|
||||
"graceful-fs": "4.1.11",
|
||||
"http-proxy": "1.16.2",
|
||||
"isbinaryfile": "3.0.2",
|
||||
"lodash": "4.17.4",
|
||||
"lodash": "4.17.5",
|
||||
"log4js": "2.5.2",
|
||||
"mime": "1.6.0",
|
||||
"minimatch": "3.0.4",
|
||||
@ -11657,9 +11675,9 @@
|
||||
}
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.4",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz",
|
||||
"integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=",
|
||||
"version": "4.17.5",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.5.tgz",
|
||||
"integrity": "sha512-svL3uiZf1RwhH+cWrfZn3A4+U58wbP0tGVTLQPbjplZxZ8ROD9VLuNgsRniTlLe7OlSqR79RUehXgpBW/s0IQw==",
|
||||
"dev": true
|
||||
},
|
||||
"lodash.assign": {
|
||||
@ -11688,9 +11706,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"lodash.mergewith": {
|
||||
"version": "4.6.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.0.tgz",
|
||||
"integrity": "sha1-FQzwoWeR9ZA7iJHqsVRgknS96lU=",
|
||||
"version": "4.6.1",
|
||||
"resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.1.tgz",
|
||||
"integrity": "sha512-eWw5r+PYICtEBgrBE5hhlT6aAa75f411bgDz/ZL2KZqYV03USvucsxcHUIlGTDTECs1eunpI7HOV7U+WLDvNdQ==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
@ -11950,7 +11968,7 @@
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"lodash": "4.17.4"
|
||||
"lodash": "4.17.5"
|
||||
}
|
||||
},
|
||||
"debug": {
|
||||
@ -12001,9 +12019,9 @@
|
||||
}
|
||||
},
|
||||
"make-error": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.2.tgz",
|
||||
"integrity": "sha512-l9ra35l5VWLF24y75Tg8XgfGLX0ueRhph118WKM6H5denx4bB5QF59+4UAm9oJ2qsPQZas/CQUDdtDdfvYHBdQ==",
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.3.tgz",
|
||||
"integrity": "sha512-j3dZCri3cCd23wgPqK/0/KvTN8R+W6fXDqQe8BNLbTpONjbA8SPaRr+q0BQq9bx3Q/+g68/gDIh9FW3by702Tg==",
|
||||
"dev": true
|
||||
},
|
||||
"map-cache": {
|
||||
@ -12576,7 +12594,7 @@
|
||||
"in-publish": "2.0.0",
|
||||
"lodash.assign": "4.2.0",
|
||||
"lodash.clonedeep": "4.5.0",
|
||||
"lodash.mergewith": "4.6.0",
|
||||
"lodash.mergewith": "4.6.1",
|
||||
"meow": "3.7.0",
|
||||
"mkdirp": "0.5.1",
|
||||
"nan": "2.8.0",
|
||||
@ -14378,7 +14396,7 @@
|
||||
"integrity": "sha1-C9dnBCWL6CmyOYu1Dkti0aFmsLk=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"caniuse-db": "1.0.30000800",
|
||||
"caniuse-db": "1.0.30000803",
|
||||
"electron-to-chromium": "1.3.32"
|
||||
}
|
||||
},
|
||||
@ -15442,7 +15460,7 @@
|
||||
"blocking-proxy": "0.0.5",
|
||||
"chalk": "1.1.3",
|
||||
"glob": "7.1.2",
|
||||
"jasmine": "2.9.0",
|
||||
"jasmine": "2.99.0",
|
||||
"jasminewd2": "2.2.0",
|
||||
"optimist": "0.6.1",
|
||||
"q": "1.4.1",
|
||||
@ -16156,7 +16174,7 @@
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"extend": "3.0.1",
|
||||
"lodash": "4.17.4",
|
||||
"lodash": "4.17.5",
|
||||
"request": "2.81.0",
|
||||
"when": "3.7.8"
|
||||
}
|
||||
@ -16273,7 +16291,7 @@
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"glob": "7.1.2",
|
||||
"lodash": "4.17.4",
|
||||
"lodash": "4.17.5",
|
||||
"scss-tokenizer": "0.2.3",
|
||||
"yargs": "7.1.0"
|
||||
}
|
||||
@ -17832,7 +17850,7 @@
|
||||
"arrify": "1.0.1",
|
||||
"chalk": "2.3.0",
|
||||
"diff": "3.4.0",
|
||||
"make-error": "1.3.2",
|
||||
"make-error": "1.3.3",
|
||||
"minimist": "1.2.0",
|
||||
"mkdirp": "0.5.1",
|
||||
"source-map-support": "0.5.3",
|
||||
@ -19277,7 +19295,7 @@
|
||||
"integrity": "sha512-geQsZ86YkXOVOjvPC5yv3JSNnL6/X3Kzh935AQ/gJNEYXEfJDQFu/sdFuktS9OW2JcH/SJec8TGfRdrpHshH7A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"lodash": "4.17.4"
|
||||
"lodash": "4.17.5"
|
||||
}
|
||||
},
|
||||
"webpack-sources": {
|
||||
@ -19313,7 +19331,7 @@
|
||||
"integrity": "sha1-DK+dLXVdk67gSdS90NP+LMoqJOs=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"http-parser-js": "0.4.9",
|
||||
"http-parser-js": "0.4.10",
|
||||
"websocket-extensions": "0.1.3"
|
||||
}
|
||||
},
|
||||
|
@ -16,8 +16,8 @@
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@alfresco/adf-content-services": "2.2.0-beta1",
|
||||
"@alfresco/adf-core": "2.2.0-beta1",
|
||||
"@alfresco/adf-content-services": "2.2.0-0e512083331b094a1593e9b1f081ff441db01786",
|
||||
"@alfresco/adf-core": "2.2.0-0e512083331b094a1593e9b1f081ff441db01786",
|
||||
"@angular/animations": "5.1.1",
|
||||
"@angular/cdk": "5.0.1",
|
||||
"@angular/common": "5.1.1",
|
||||
|
@ -71,7 +71,9 @@ export const APP_ROUTES: Routes = [
|
||||
path: 'preview/:nodeId',
|
||||
component: PreviewComponent,
|
||||
data: {
|
||||
i18nTitle: 'APP.PREVIEW.TITLE'
|
||||
i18nTitle: 'APP.PREVIEW.TITLE',
|
||||
navigateMultiple: true,
|
||||
navigateSource: 'favorites'
|
||||
}
|
||||
}
|
||||
]
|
||||
@ -85,17 +87,19 @@ export const APP_ROUTES: Routes = [
|
||||
i18nTitle: 'APP.BROWSE.LIBRARIES.TITLE'
|
||||
}
|
||||
}, {
|
||||
path: ':id',
|
||||
path: ':folderId',
|
||||
component: FilesComponent,
|
||||
data: {
|
||||
i18nTitle: 'APP.BROWSE.LIBRARIES.TITLE'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: ':id/preview/:nodeId',
|
||||
path: ':folderId/preview/:nodeId',
|
||||
component: PreviewComponent,
|
||||
data: {
|
||||
i18nTitle: 'APP.PREVIEW.TITLE'
|
||||
i18nTitle: 'APP.PREVIEW.TITLE',
|
||||
navigateMultiple: true,
|
||||
navigateSource: 'libraries'
|
||||
}
|
||||
}
|
||||
]
|
||||
@ -112,7 +116,7 @@ export const APP_ROUTES: Routes = [
|
||||
}
|
||||
},
|
||||
{
|
||||
path: ':id',
|
||||
path: ':folderId',
|
||||
component: FilesComponent,
|
||||
data: {
|
||||
i18nTitle: 'APP.BROWSE.PERSONAL.TITLE'
|
||||
@ -122,14 +126,18 @@ export const APP_ROUTES: Routes = [
|
||||
path: 'preview/:nodeId',
|
||||
component: PreviewComponent,
|
||||
data: {
|
||||
i18nTitle: 'APP.PREVIEW.TITLE'
|
||||
i18nTitle: 'APP.PREVIEW.TITLE',
|
||||
navigateMultiple: true,
|
||||
navigateSource: 'personal-files'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: ':id/preview/:nodeId',
|
||||
path: ':folderId/preview/:nodeId',
|
||||
component: PreviewComponent,
|
||||
data: {
|
||||
i18nTitle: 'APP.PREVIEW.TITLE'
|
||||
i18nTitle: 'APP.PREVIEW.TITLE',
|
||||
navigateMultiple: true,
|
||||
navigateSource: 'personal-files'
|
||||
}
|
||||
}
|
||||
]
|
||||
@ -148,7 +156,9 @@ export const APP_ROUTES: Routes = [
|
||||
path: 'preview/:nodeId',
|
||||
component: PreviewComponent,
|
||||
data: {
|
||||
i18nTitle: 'APP.PREVIEW.TITLE'
|
||||
i18nTitle: 'APP.PREVIEW.TITLE',
|
||||
navigateMultiple: true,
|
||||
navigateSource: 'recent-files'
|
||||
}
|
||||
}
|
||||
]
|
||||
@ -167,7 +177,9 @@ export const APP_ROUTES: Routes = [
|
||||
path: 'preview/:nodeId',
|
||||
component: PreviewComponent,
|
||||
data: {
|
||||
i18nTitle: 'APP.PREVIEW.TITLE'
|
||||
i18nTitle: 'APP.PREVIEW.TITLE',
|
||||
navigateMultiple: true,
|
||||
navigateSource: 'shared'
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -80,9 +80,10 @@
|
||||
currentFolderId="-favorites-"
|
||||
selectionMode="multiple"
|
||||
[navigate]="false"
|
||||
[sorting]="[ 'modifiedAt', 'desc' ]"
|
||||
[sorting]="sorting"
|
||||
[contextMenuActions]="true"
|
||||
[contentActions]="false"
|
||||
(sorting-changed)="onSortingChanged($event)"
|
||||
(node-dblclick)="onNodeDoubleClick($event.detail?.node?.entry)">
|
||||
|
||||
<empty-folder-content>
|
||||
|
@ -44,14 +44,20 @@ export class FavoritesComponent extends PageComponent implements OnInit, OnDestr
|
||||
|
||||
private subscriptions: Subscription[] = [];
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private nodesApi: NodesApiService,
|
||||
private contentService: ContentService,
|
||||
private content: ContentManagementService,
|
||||
preferences: UserPreferencesService) {
|
||||
sorting = [ 'modifiedAt', 'desc' ];
|
||||
|
||||
constructor(private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private nodesApi: NodesApiService,
|
||||
private contentService: ContentService,
|
||||
private content: ContentManagementService,
|
||||
preferences: UserPreferencesService) {
|
||||
super(preferences);
|
||||
|
||||
const sortingKey = preferences.get('favorites.sorting.key') || 'modifiedAt';
|
||||
const sortingDirection = preferences.get('favorites.sorting.direction') || 'desc';
|
||||
|
||||
this.sorting = [sortingKey, sortingDirection];
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@ -110,4 +116,9 @@ export class FavoritesComponent extends PageComponent implements OnInit, OnDestr
|
||||
this.documentList.reload();
|
||||
}
|
||||
}
|
||||
|
||||
onSortingChanged(event: CustomEvent) {
|
||||
this.preferences.set('favorites.sorting.key', event.detail.key || 'modifiedAt');
|
||||
this.preferences.set('favorites.sorting.direction', event.detail.direction || 'desc');
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,7 @@
|
||||
[attr.class]="documentList.isEmpty() ? 'empty-list' : ''"
|
||||
[loading]="isLoading"
|
||||
[node]="paging"
|
||||
[sorting]="[ 'modifiedAt', 'desc' ]"
|
||||
[sorting]="sorting"
|
||||
[allowDropFiles]="true"
|
||||
|
||||
[contextMenuActions]="true"
|
||||
@ -100,6 +100,7 @@
|
||||
[selectionMode]="'multiple'"
|
||||
[imageResolver]="imageResolver"
|
||||
|
||||
(sorting-changed)="onSortingChanged($event)"
|
||||
(node-dblclick)="onNodeDoubleClick($event)"
|
||||
(node-select)="onNodeSelect($event, documentList)">
|
||||
|
||||
|
@ -49,19 +49,25 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
||||
private nodePath: PathElement[];
|
||||
private subscriptions: Subscription[] = [];
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private zone: NgZone,
|
||||
private route: ActivatedRoute,
|
||||
private nodesApi: NodesApiService,
|
||||
private nodeActionsService: NodeActionsService,
|
||||
private uploadService: UploadService,
|
||||
private contentManagementService: ContentManagementService,
|
||||
private browsingFilesService: BrowsingFilesService,
|
||||
private contentService: ContentService,
|
||||
private apiService: AlfrescoApiService,
|
||||
preferences: UserPreferencesService) {
|
||||
sorting = [ 'modifiedAt', 'desc' ];
|
||||
|
||||
constructor(private router: Router,
|
||||
private zone: NgZone,
|
||||
private route: ActivatedRoute,
|
||||
private nodesApi: NodesApiService,
|
||||
private nodeActionsService: NodeActionsService,
|
||||
private uploadService: UploadService,
|
||||
private contentManagementService: ContentManagementService,
|
||||
private browsingFilesService: BrowsingFilesService,
|
||||
private contentService: ContentService,
|
||||
private apiService: AlfrescoApiService,
|
||||
preferences: UserPreferencesService) {
|
||||
super(preferences);
|
||||
|
||||
const sortingKey = preferences.get('personal-files.sorting.key') || 'modifiedAt';
|
||||
const sortingDirection = preferences.get('personal-files.sorting.direction') || 'desc';
|
||||
|
||||
this.sorting = [sortingKey, sortingDirection];
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@ -71,8 +77,8 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
||||
this.routeData = data;
|
||||
this.title = data.i18nTitle;
|
||||
|
||||
route.params.subscribe(({ id }: Params) => {
|
||||
const nodeId = id || data.defaultNodeId;
|
||||
route.params.subscribe(({ folderId }: Params) => {
|
||||
const nodeId = folderId || data.defaultNodeId;
|
||||
this.isLoading = true;
|
||||
|
||||
this.fetchNode(nodeId)
|
||||
@ -301,4 +307,9 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
onSortingChanged(event: CustomEvent) {
|
||||
this.preferences.set('personal-files.sorting.key', event.detail.key || 'modifiedAt');
|
||||
this.preferences.set('personal-files.sorting.direction', event.detail.direction || 'desc');
|
||||
}
|
||||
}
|
||||
|
@ -13,9 +13,10 @@
|
||||
currentFolderId="-mysites-"
|
||||
selectionMode="none"
|
||||
[navigate]="false"
|
||||
[sorting]="[ 'name', 'asc' ]"
|
||||
[sorting]="sorting"
|
||||
[contextMenuActions]="true"
|
||||
[contentActions]="false"
|
||||
(sorting-changed)="onSortingChanged($event)"
|
||||
(node-dblclick)="onNodeDoubleClick($event)">
|
||||
|
||||
<empty-folder-content>
|
||||
|
@ -38,12 +38,18 @@ export class LibrariesComponent extends PageComponent {
|
||||
@ViewChild(DocumentListComponent)
|
||||
documentList: DocumentListComponent;
|
||||
|
||||
constructor(
|
||||
private nodesApi: NodesApiService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
preferences: UserPreferencesService) {
|
||||
sorting = [ 'title', 'asc' ];
|
||||
|
||||
constructor(private nodesApi: NodesApiService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
preferences: UserPreferencesService) {
|
||||
super(preferences);
|
||||
|
||||
const sortingKey = preferences.get('libraries.sorting.key') || 'title';
|
||||
const sortingDirection = preferences.get('libraries.sorting.direction') || 'desc';
|
||||
|
||||
this.sorting = [sortingKey, sortingDirection];
|
||||
}
|
||||
|
||||
makeLibraryTooltip(library: any): string {
|
||||
@ -90,4 +96,9 @@ export class LibrariesComponent extends PageComponent {
|
||||
fetchNodes(): void {
|
||||
// todo: remove once all views migrate to native data source
|
||||
}
|
||||
|
||||
onSortingChanged(event: CustomEvent) {
|
||||
this.preferences.set('libraries.sorting.key', event.detail.key || 'modifiedAt');
|
||||
this.preferences.set('libraries.sorting.direction', event.detail.direction || 'desc');
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ export abstract class PageComponent {
|
||||
|
||||
abstract fetchNodes(parentNodeId?: string, options?: any): void;
|
||||
|
||||
constructor(private preferences: UserPreferencesService) {
|
||||
constructor(protected preferences: UserPreferencesService) {
|
||||
}
|
||||
|
||||
onFetchError(error: any) {
|
||||
|
@ -1,7 +1,12 @@
|
||||
<ng-container *ngIf="nodeId">
|
||||
<adf-viewer
|
||||
[fileNodeId]="nodeId"
|
||||
[allowNavigate]="navigateMultiple"
|
||||
[canNavigateBefore]="previousNodeId"
|
||||
[canNavigateNext]="nextNodeId"
|
||||
[overlayMode]="true"
|
||||
(showViewerChange)="onShowChange($event)">
|
||||
(showViewerChange)="onVisibilityChanged($event)"
|
||||
(navigateBefore)="onNavigateBefore()"
|
||||
(navigateNext)="onNavigateNext()">
|
||||
</adf-viewer>
|
||||
</ng-container>
|
||||
|
652
src/app/components/preview/preview.component.spec.ts
Normal file
652
src/app/components/preview/preview.component.spec.ts
Normal file
@ -0,0 +1,652 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2017 Alfresco Software Limited
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { TestBed, async, ComponentFixture } from '@angular/core/testing';
|
||||
import { AlfrescoApiService, UserPreferencesService } from '@alfresco/adf-core';
|
||||
|
||||
import { CommonModule } from '../../common/common.module';
|
||||
import { PreviewComponent } from './preview.component';
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
|
||||
describe('PreviewComponent', () => {
|
||||
|
||||
let fixture: ComponentFixture<PreviewComponent>;
|
||||
let component: PreviewComponent;
|
||||
let router: Router;
|
||||
let route: ActivatedRoute;
|
||||
let alfrescoApi: AlfrescoApiService;
|
||||
let preferences: UserPreferencesService;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
RouterTestingModule,
|
||||
CommonModule
|
||||
],
|
||||
declarations: [
|
||||
PreviewComponent
|
||||
]
|
||||
})
|
||||
.compileComponents().then(() => {
|
||||
fixture = TestBed.createComponent(PreviewComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
router = TestBed.get(Router);
|
||||
route = TestBed.get(ActivatedRoute);
|
||||
alfrescoApi = TestBed.get(AlfrescoApiService);
|
||||
preferences = TestBed.get(UserPreferencesService);
|
||||
});
|
||||
}));
|
||||
|
||||
it('should extract the property path root', () => {
|
||||
expect(component.getRootField('some.property.path')).toBe('some');
|
||||
expect(component.getRootField('some')).toBe('some');
|
||||
expect(component.getRootField('')).toBe('');
|
||||
expect(component.getRootField(null)).toBe(null);
|
||||
});
|
||||
|
||||
it('should navigate to previous node in sub-folder', () => {
|
||||
spyOn(router, 'navigate').and.stub();
|
||||
|
||||
component.previewLocation = 'personal-files';
|
||||
component.folderId = 'folder1';
|
||||
component.previousNodeId = 'previous1';
|
||||
component.onNavigateBefore();
|
||||
|
||||
expect(router.navigate).toHaveBeenCalledWith(
|
||||
['personal-files', 'folder1', 'preview', 'previous1']
|
||||
);
|
||||
});
|
||||
|
||||
it('should navigate back to previous node in the root path', () => {
|
||||
spyOn(router, 'navigate').and.stub();
|
||||
|
||||
component.previewLocation = 'personal-files';
|
||||
component.folderId = null;
|
||||
component.previousNodeId = 'previous1';
|
||||
component.onNavigateBefore();
|
||||
|
||||
expect(router.navigate).toHaveBeenCalledWith(
|
||||
['personal-files', 'preview', 'previous1']
|
||||
);
|
||||
});
|
||||
|
||||
it('should not navigate back if node unset', () => {
|
||||
spyOn(router, 'navigate').and.stub();
|
||||
|
||||
component.previousNodeId = null;
|
||||
component.onNavigateBefore();
|
||||
|
||||
expect(router.navigate).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should navigate to next node in sub-folder', () => {
|
||||
spyOn(router, 'navigate').and.stub();
|
||||
|
||||
component.previewLocation = 'personal-files';
|
||||
component.folderId = 'folder1';
|
||||
component.nextNodeId = 'next1';
|
||||
component.onNavigateNext();
|
||||
|
||||
expect(router.navigate).toHaveBeenCalledWith(
|
||||
['personal-files', 'folder1', 'preview', 'next1']
|
||||
);
|
||||
});
|
||||
|
||||
it('should navigate to next node in the root path', () => {
|
||||
spyOn(router, 'navigate').and.stub();
|
||||
|
||||
component.previewLocation = 'personal-files';
|
||||
component.folderId = null;
|
||||
component.nextNodeId = 'next1';
|
||||
component.onNavigateNext();
|
||||
|
||||
expect(router.navigate).toHaveBeenCalledWith(
|
||||
['personal-files', 'preview', 'next1']
|
||||
);
|
||||
});
|
||||
|
||||
it('should not navigate back if node unset', () => {
|
||||
spyOn(router, 'navigate').and.stub();
|
||||
|
||||
component.nextNodeId = null;
|
||||
component.onNavigateNext();
|
||||
|
||||
expect(router.navigate).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should generate preview path for a folder only', () => {
|
||||
component.previewLocation = 'personal-files';
|
||||
|
||||
expect(component.getPreviewPath('folder1', null)).toEqual(
|
||||
['personal-files', 'folder1']
|
||||
);
|
||||
});
|
||||
|
||||
it('should generate preview path for a folder and a node', () => {
|
||||
component.previewLocation = 'personal-files';
|
||||
|
||||
expect(component.getPreviewPath('folder1', 'node1')).toEqual(
|
||||
['personal-files', 'folder1', 'preview', 'node1']
|
||||
);
|
||||
});
|
||||
|
||||
it('should generate preview path for a node only', () => {
|
||||
component.previewLocation = 'personal-files';
|
||||
|
||||
expect(component.getPreviewPath(null, 'node1')).toEqual(
|
||||
['personal-files', 'preview', 'node1']
|
||||
);
|
||||
});
|
||||
|
||||
it('should generate preview for the location only', () => {
|
||||
component.previewLocation = 'personal-files';
|
||||
|
||||
expect(component.getPreviewPath(null, null)).toEqual(
|
||||
['personal-files']
|
||||
);
|
||||
});
|
||||
|
||||
it('should navigate back to root path upon close', () => {
|
||||
spyOn(router, 'navigate').and.stub();
|
||||
|
||||
component.routesSkipNavigation = [];
|
||||
component.previewLocation = 'libraries';
|
||||
component.folderId = null;
|
||||
|
||||
component.onVisibilityChanged(false);
|
||||
|
||||
expect(router.navigate).toHaveBeenCalledWith(
|
||||
['libraries']
|
||||
);
|
||||
});
|
||||
|
||||
it('should navigate back to folder path upon close', () => {
|
||||
spyOn(router, 'navigate').and.stub();
|
||||
|
||||
component.routesSkipNavigation = [];
|
||||
component.previewLocation = 'libraries';
|
||||
component.folderId = 'site1';
|
||||
|
||||
component.onVisibilityChanged(false);
|
||||
|
||||
expect(router.navigate).toHaveBeenCalledWith(
|
||||
['libraries', 'site1']
|
||||
);
|
||||
});
|
||||
|
||||
it('should not navigate to root path for certain routes upon close', () => {
|
||||
spyOn(router, 'navigate').and.stub();
|
||||
|
||||
component.routesSkipNavigation = ['shared'];
|
||||
component.previewLocation = 'shared';
|
||||
component.folderId = 'folder1';
|
||||
|
||||
component.onVisibilityChanged(false);
|
||||
|
||||
expect(router.navigate).toHaveBeenCalledWith(
|
||||
['shared']
|
||||
);
|
||||
});
|
||||
|
||||
it('should not navigate back if viewer is still visible', () => {
|
||||
spyOn(router, 'navigate').and.stub();
|
||||
|
||||
component.routesSkipNavigation = [];
|
||||
component.previewLocation = 'shared';
|
||||
|
||||
component.onVisibilityChanged(true);
|
||||
|
||||
expect(router.navigate).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should enable multiple document navigation from route data', () => {
|
||||
route.snapshot.data = {
|
||||
navigateMultiple: true
|
||||
};
|
||||
|
||||
component.ngOnInit();
|
||||
|
||||
expect(component.navigateMultiple).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should not enable multiple document navigation from route data', () => {
|
||||
route.snapshot.data = {};
|
||||
|
||||
component.ngOnInit();
|
||||
|
||||
expect(component.navigateMultiple).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should fetch navigation source from route', () => {
|
||||
route.snapshot.data = {
|
||||
navigateSource: 'personal-files'
|
||||
};
|
||||
|
||||
component.ngOnInit();
|
||||
|
||||
expect(component.navigateSource).toBe('personal-files');
|
||||
});
|
||||
|
||||
it('should fetch case-insensitive source from route', () => {
|
||||
route.snapshot.data = {
|
||||
navigateSource: 'PERSONAL-FILES'
|
||||
};
|
||||
|
||||
component.navigationSources = ['personal-files'];
|
||||
component.ngOnInit();
|
||||
|
||||
expect(component.navigateSource).toBe('PERSONAL-FILES');
|
||||
});
|
||||
|
||||
it('should fetch only permitted navigation source from route', () => {
|
||||
route.snapshot.data = {
|
||||
navigateSource: 'personal-files'
|
||||
};
|
||||
|
||||
component.navigationSources = ['shared'];
|
||||
component.ngOnInit();
|
||||
|
||||
expect(component.navigateSource).toBeNull();
|
||||
});
|
||||
|
||||
it('should display document upon init', () => {
|
||||
route.params = Observable.of({
|
||||
folderId: 'folder1',
|
||||
nodeId: 'node1'
|
||||
});
|
||||
|
||||
spyOn(component, 'displayNode').and.stub();
|
||||
|
||||
component.ngOnInit();
|
||||
|
||||
expect(component.folderId).toBe('folder1');
|
||||
expect(component.displayNode).toHaveBeenCalledWith('node1');
|
||||
});
|
||||
|
||||
it('should return empty nearest nodes for missing node id', async () => {
|
||||
const nearest = await component.getNearestNodes(null, 'folder1');
|
||||
|
||||
expect(nearest).toEqual({ left: null, right: null });
|
||||
});
|
||||
|
||||
it('should return empty nearest nodes for missing folder id', async () => {
|
||||
const nearest = await component.getNearestNodes('node1', null);
|
||||
|
||||
expect(nearest).toEqual({ left: null, right: null });
|
||||
});
|
||||
|
||||
it('should return empty nearest nodes for crashed fields id request', async () => {
|
||||
spyOn(component, 'getFileIds').and.returnValue(Promise.reject('err'));
|
||||
|
||||
const nearest = await component.getNearestNodes('node1', 'folder1');
|
||||
|
||||
expect(nearest).toEqual({ left: null, right: null });
|
||||
});
|
||||
|
||||
it('should return nearest nodes', async () => {
|
||||
spyOn(component, 'getFileIds').and.returnValue(Promise.resolve(
|
||||
[ 'node1', 'node2', 'node3', 'node4', 'node5' ]
|
||||
));
|
||||
|
||||
let nearest = await component.getNearestNodes('node1', 'folder1');
|
||||
expect(nearest).toEqual({ left: null, right: 'node2' });
|
||||
|
||||
nearest = await component.getNearestNodes('node3', 'folder1');
|
||||
expect(nearest).toEqual({ left: 'node2', right: 'node4' });
|
||||
|
||||
nearest = await component.getNearestNodes('node5', 'folder1');
|
||||
expect(nearest).toEqual({ left: 'node4', right: null });
|
||||
});
|
||||
|
||||
it('should return empty nearest nodes if node is already deleted', async () => {
|
||||
spyOn(component, 'getFileIds').and.returnValue(Promise.resolve(
|
||||
[ 'node1', 'node2', 'node3', 'node4', 'node5' ]
|
||||
));
|
||||
|
||||
const nearest = await component.getNearestNodes('node9', 'folder1');
|
||||
expect(nearest).toEqual({ left: null, right: null });
|
||||
});
|
||||
|
||||
it('should not display node when id is missing', async () => {
|
||||
spyOn(router, 'navigate').and.stub();
|
||||
spyOn(alfrescoApi.nodesApi, 'getNodeInfo').and.returnValue(
|
||||
Promise.resolve(null)
|
||||
);
|
||||
|
||||
await component.displayNode(null);
|
||||
|
||||
expect(alfrescoApi.nodesApi.getNodeInfo).not.toHaveBeenCalled();
|
||||
expect(router.navigate).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should navigate to original location if node not found', async () => {
|
||||
spyOn(router, 'navigate').and.stub();
|
||||
spyOn(alfrescoApi.nodesApi, 'getNodeInfo').and.returnValue(
|
||||
Promise.resolve(null)
|
||||
);
|
||||
|
||||
component.previewLocation = 'personal-files';
|
||||
await component.displayNode('folder1');
|
||||
|
||||
expect(alfrescoApi.nodesApi.getNodeInfo).toHaveBeenCalledWith('folder1');
|
||||
expect(router.navigate).toHaveBeenCalledWith(['personal-files', 'folder1']);
|
||||
});
|
||||
|
||||
it('should navigate to original location if node is not a File', async () => {
|
||||
spyOn(router, 'navigate').and.stub();
|
||||
spyOn(alfrescoApi.nodesApi, 'getNodeInfo').and.returnValue(
|
||||
Promise.resolve({
|
||||
isFile: false
|
||||
})
|
||||
);
|
||||
|
||||
component.previewLocation = 'personal-files';
|
||||
await component.displayNode('folder1');
|
||||
|
||||
expect(alfrescoApi.nodesApi.getNodeInfo).toHaveBeenCalledWith('folder1');
|
||||
expect(router.navigate).toHaveBeenCalledWith(['personal-files', 'folder1']);
|
||||
});
|
||||
|
||||
it('should navigate to original location in case of Alfresco API errors', async () => {
|
||||
spyOn(router, 'navigate').and.stub();
|
||||
spyOn(alfrescoApi.nodesApi, 'getNodeInfo').and.returnValue(
|
||||
Promise.reject('error')
|
||||
);
|
||||
|
||||
component.previewLocation = 'personal-files';
|
||||
await component.displayNode('folder1');
|
||||
|
||||
expect(alfrescoApi.nodesApi.getNodeInfo).toHaveBeenCalledWith('folder1');
|
||||
expect(router.navigate).toHaveBeenCalledWith(['personal-files', 'folder1']);
|
||||
});
|
||||
|
||||
it('should navigate to original location in case of internal errors', async () => {
|
||||
spyOn(router, 'navigate').and.stub();
|
||||
spyOn(alfrescoApi.nodesApi, 'getNodeInfo').and.returnValue(
|
||||
Promise.resolve({
|
||||
isFile: true
|
||||
})
|
||||
);
|
||||
spyOn(component, 'getNearestNodes').and.returnValue(
|
||||
Promise.reject('error')
|
||||
);
|
||||
|
||||
component.previewLocation = 'personal-files';
|
||||
await component.displayNode('folder1');
|
||||
|
||||
expect(alfrescoApi.nodesApi.getNodeInfo).toHaveBeenCalledWith('folder1');
|
||||
expect(router.navigate).toHaveBeenCalledWith(['personal-files', 'folder1']);
|
||||
});
|
||||
|
||||
it('should setup node for displaying', async () => {
|
||||
spyOn(router, 'navigate').and.stub();
|
||||
spyOn(component, 'getNearestNodes').and.returnValue({ left: 'node1', right: 'node3' });
|
||||
spyOn(alfrescoApi.nodesApi, 'getNodeInfo').and.returnValue(
|
||||
Promise.resolve({
|
||||
id: 'node2',
|
||||
parentId: 'parent1',
|
||||
isFile: true
|
||||
})
|
||||
);
|
||||
|
||||
await component.displayNode('node2');
|
||||
|
||||
expect(component.previousNodeId).toBe('node1');
|
||||
expect(component.nextNodeId).toBe('node3');
|
||||
expect(component.nodeId).toBe('node2');
|
||||
expect(router.navigate).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should fetch and sort file ids for personal-files', async () => {
|
||||
preferences.set('personal-files.sorting.key', 'name');
|
||||
preferences.set('personal-files.sorting.direction', 'desc');
|
||||
|
||||
spyOn(alfrescoApi.nodesApi, 'getNodeChildren').and.returnValue(
|
||||
Promise.resolve({
|
||||
list: {
|
||||
entries: [
|
||||
{ entry: { id: 'node1', name: 'node 1' } },
|
||||
{ entry: { id: 'node2', name: 'node 2' } }
|
||||
]
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
const ids = await component.getFileIds('personal-files', 'folder1');
|
||||
expect(ids).toEqual(['node2', 'node1']);
|
||||
});
|
||||
|
||||
it('should fetch file ids for personal-files with default sorting for missing key', async () => {
|
||||
preferences.set('personal-files.sorting.key', 'missing');
|
||||
preferences.set('personal-files.sorting.direction', 'desc');
|
||||
|
||||
spyOn(alfrescoApi.nodesApi, 'getNodeChildren').and.returnValue(
|
||||
Promise.resolve({
|
||||
list: {
|
||||
entries: [
|
||||
{ entry: { id: 'node1', name: 'node 1' } },
|
||||
{ entry: { id: 'node2', name: 'node 2' } }
|
||||
]
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
const ids = await component.getFileIds('personal-files', 'folder1');
|
||||
expect(ids).toEqual(['node1', 'node2']);
|
||||
});
|
||||
|
||||
it('should require folder id to fetch ids for personal-files', async () => {
|
||||
const ids = await component.getFileIds('personal-files', null);
|
||||
expect(ids).toEqual([]);
|
||||
});
|
||||
|
||||
it('should sort file ids for personal-files with [modifiedAt desc]', async () => {
|
||||
spyOn(preferences, 'get').and.returnValue(null);
|
||||
|
||||
spyOn(alfrescoApi.nodesApi, 'getNodeChildren').and.returnValue(
|
||||
Promise.resolve({
|
||||
list: {
|
||||
entries: [
|
||||
{ entry: { id: 'node1', name: 'node 1', modifiedAt: 1 } },
|
||||
{ entry: { id: 'node2', name: 'node 2', modifiedAt: 2 } }
|
||||
]
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
const ids = await component.getFileIds('personal-files', 'folder1');
|
||||
expect(ids).toEqual(['node2', 'node1']);
|
||||
});
|
||||
|
||||
it('should fetch and sort file ids for libraries', async () => {
|
||||
preferences.set('personal-files.sorting.key', 'name');
|
||||
preferences.set('personal-files.sorting.direction', 'desc');
|
||||
|
||||
spyOn(alfrescoApi.nodesApi, 'getNodeChildren').and.returnValue(
|
||||
Promise.resolve({
|
||||
list: {
|
||||
entries: [
|
||||
{ entry: { id: 'node1', name: 'node 1' } },
|
||||
{ entry: { id: 'node2', name: 'node 2' } }
|
||||
]
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
const ids = await component.getFileIds('libraries', 'site1');
|
||||
expect(ids).toEqual(['node2', 'node1']);
|
||||
});
|
||||
|
||||
it('should require folder id to fetch ids for libraries', async () => {
|
||||
const ids = await component.getFileIds('libraries', null);
|
||||
expect(ids).toEqual([]);
|
||||
});
|
||||
|
||||
it('should sort file ids for libraries with [modifiedAt desc]', async () => {
|
||||
spyOn(preferences, 'get').and.returnValue(null);
|
||||
|
||||
spyOn(alfrescoApi.nodesApi, 'getNodeChildren').and.returnValue(
|
||||
Promise.resolve({
|
||||
list: {
|
||||
entries: [
|
||||
{ entry: { id: 'node1', name: 'node 1', modifiedAt: new Date(1) } },
|
||||
{ entry: { id: 'node2', name: 'node 2', modifiedAt: new Date(2) } }
|
||||
]
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
const ids = await component.getFileIds('libraries', 'folder1');
|
||||
expect(ids).toEqual(['node2', 'node1']);
|
||||
});
|
||||
|
||||
it('should fetch and sort ids for favorites', async () => {
|
||||
preferences.set('favorites.sorting.key', 'name');
|
||||
preferences.set('favorites.sorting.direction', 'desc');
|
||||
|
||||
spyOn(alfrescoApi.favoritesApi, 'getFavorites').and.returnValue(
|
||||
Promise.resolve({
|
||||
list: {
|
||||
entries: [
|
||||
{ entry: { target: { file: { id: 'file3', name: 'file 3' } } } },
|
||||
{ entry: { target: { file: { id: 'file1', name: 'file 1' } } } },
|
||||
{ entry: { target: { file: { id: 'file2', name: 'file 2' } } } }
|
||||
]
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
const ids = await component.getFileIds('favorites');
|
||||
expect(ids).toEqual(['file3', 'file2', 'file1']);
|
||||
});
|
||||
|
||||
it('should sort file ids for favorites with [modifiedAt desc]', async () => {
|
||||
spyOn(preferences, 'get').and.returnValue(null);
|
||||
|
||||
spyOn(alfrescoApi.favoritesApi, 'getFavorites').and.returnValue(
|
||||
Promise.resolve({
|
||||
list: {
|
||||
entries: [
|
||||
{ entry: { target: { file: { id: 'file3', modifiedAt: new Date(3) } } } },
|
||||
{ entry: { target: { file: { id: 'file1', modifiedAt: new Date(1) } } } },
|
||||
{ entry: { target: { file: { id: 'file2', modifiedAt: new Date(2) } } } }
|
||||
]
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
const ids = await component.getFileIds('favorites');
|
||||
expect(ids).toEqual(['file3', 'file2', 'file1']);
|
||||
});
|
||||
|
||||
it('should fetch and sort file ids for shared files', async () => {
|
||||
preferences.set('shared.sorting.key', 'name');
|
||||
preferences.set('shared.sorting.direction', 'asc');
|
||||
|
||||
spyOn(alfrescoApi.sharedLinksApi, 'findSharedLinks').and.returnValue(
|
||||
Promise.resolve({
|
||||
list: {
|
||||
entries: [
|
||||
{ entry: { nodeId: 'node2', name: 'node 2', modifiedAt: new Date(2) } },
|
||||
{ entry: { nodeId: 'node1', name: 'node 1', modifiedAt: new Date(1) } }
|
||||
]
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
const ids = await component.getFileIds('shared');
|
||||
expect(ids).toEqual(['node1', 'node2']);
|
||||
});
|
||||
|
||||
it('should sort file ids for favorites with [modifiedAt desc]', async () => {
|
||||
spyOn(preferences, 'get').and.returnValue(null);
|
||||
|
||||
spyOn(alfrescoApi.sharedLinksApi, 'findSharedLinks').and.returnValue(
|
||||
Promise.resolve({
|
||||
list: {
|
||||
entries: [
|
||||
{ entry: { nodeId: 'node2', name: 'node 2', modifiedAt: new Date(2) } },
|
||||
{ entry: { nodeId: 'node1', name: 'node 1', modifiedAt: new Date(1) } }
|
||||
]
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
const ids = await component.getFileIds('shared');
|
||||
expect(ids).toEqual(['node2', 'node1']);
|
||||
});
|
||||
|
||||
it('should fetch and sort ids for recent-files', async () => {
|
||||
preferences.set('recent-files.sorting.key', 'name');
|
||||
preferences.set('recent-files.sorting.direction', 'asc');
|
||||
|
||||
spyOn(alfrescoApi.peopleApi, 'getPerson').and.returnValue(
|
||||
Promise.resolve({
|
||||
entry: { id: 'user' }
|
||||
})
|
||||
);
|
||||
|
||||
spyOn(alfrescoApi.searchApi, 'search').and.returnValue(
|
||||
Promise.resolve({
|
||||
list: {
|
||||
entries: [
|
||||
{ entry: { id: 'node2', name: 'node 2', modifiedAt: new Date(2) } },
|
||||
{ entry: { id: 'node1', name: 'node 1', modifiedAt: new Date(1) } }
|
||||
]
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
const ids = await component.getFileIds('recent-files');
|
||||
expect(ids).toEqual(['node1', 'node2']);
|
||||
});
|
||||
|
||||
it('should sort file ids for favorites with [modifiedAt desc]', async () => {
|
||||
spyOn(preferences, 'get').and.returnValue(null);
|
||||
|
||||
spyOn(alfrescoApi.peopleApi, 'getPerson').and.returnValue(
|
||||
Promise.resolve({
|
||||
entry: { id: 'user' }
|
||||
})
|
||||
);
|
||||
|
||||
spyOn(alfrescoApi.searchApi, 'search').and.returnValue(
|
||||
Promise.resolve({
|
||||
list: {
|
||||
entries: [
|
||||
{ entry: { id: 'node2', name: 'node 2', modifiedAt: new Date(2) } },
|
||||
{ entry: { id: 'node1', name: 'node 1', modifiedAt: new Date(1) } }
|
||||
]
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
const ids = await component.getFileIds('recent-files');
|
||||
expect(ids).toEqual(['node2', 'node1']);
|
||||
});
|
||||
});
|
@ -25,7 +25,7 @@
|
||||
|
||||
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService, UserPreferencesService, ObjectUtils } from '@alfresco/adf-core';
|
||||
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
||||
|
||||
@Component({
|
||||
@ -38,47 +38,281 @@ import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
||||
})
|
||||
export class PreviewComponent implements OnInit {
|
||||
|
||||
private node: MinimalNodeEntryEntity;
|
||||
private previewLocation: string = null;
|
||||
private routesSkipNavigation = [ '/shared', '/recent-files', '/favorites' ];
|
||||
nodeId: string = null;
|
||||
node: MinimalNodeEntryEntity;
|
||||
previewLocation: string = null;
|
||||
routesSkipNavigation = [ 'shared', 'recent-files', 'favorites' ];
|
||||
navigateSource: string = null;
|
||||
navigationSources = ['favorites', 'libraries', 'personal-files', 'recent-files', 'shared'];
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private apiService: AlfrescoApiService) {
|
||||
this.previewLocation = this.router.url.substr(0, this.router.url.indexOf('/', 1));
|
||||
}
|
||||
folderId: string = null;
|
||||
nodeId: string = null;
|
||||
previousNodeId: string;
|
||||
nextNodeId: string;
|
||||
navigateMultiple = false;
|
||||
|
||||
constructor(private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private apiService: AlfrescoApiService,
|
||||
private preferences: UserPreferencesService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.previewLocation = this.router.url
|
||||
.substr(0, this.router.url.indexOf('/', 1))
|
||||
.replace(/\//g, '');
|
||||
|
||||
const routeData = this.route.snapshot.data;
|
||||
|
||||
if (routeData.navigateMultiple) {
|
||||
this.navigateMultiple = true;
|
||||
}
|
||||
|
||||
if (routeData.navigateSource) {
|
||||
const source = routeData.navigateSource.toLowerCase();
|
||||
if (this.navigationSources.includes(source)) {
|
||||
this.navigateSource = routeData.navigateSource;
|
||||
}
|
||||
}
|
||||
|
||||
this.route.params.subscribe(params => {
|
||||
this.folderId = params.folderId;
|
||||
const id = params.nodeId;
|
||||
if (id) {
|
||||
this.apiService.getInstance().nodes.getNodeInfo(id).then(
|
||||
(node) => {
|
||||
this.node = node;
|
||||
|
||||
if (node && node.isFile) {
|
||||
this.nodeId = id;
|
||||
return;
|
||||
}
|
||||
this.router.navigate([this.previewLocation, id]);
|
||||
},
|
||||
() => this.router.navigate([this.previewLocation, id])
|
||||
);
|
||||
this.displayNode(id);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onShowChange(isVisible) {
|
||||
const shouldSkipNavigation = this.routesSkipNavigation.includes(this.previewLocation);
|
||||
/**
|
||||
* Loads the particular node into the Viewer
|
||||
* @param id Unique identifier for the Node to display
|
||||
*/
|
||||
async displayNode(id: string) {
|
||||
if (id) {
|
||||
try {
|
||||
this.node = await this.apiService.nodesApi.getNodeInfo(id);
|
||||
if (this.node && this.node.isFile) {
|
||||
const nearest = await this.getNearestNodes(this.node.id, this.node.parentId);
|
||||
|
||||
if (!isVisible) {
|
||||
if ( !shouldSkipNavigation ) {
|
||||
this.router.navigate([this.previewLocation, this.node.parentId ]);
|
||||
} else {
|
||||
this.router.navigate([this.previewLocation]);
|
||||
this.previousNodeId = nearest.left;
|
||||
this.nextNodeId = nearest.right;
|
||||
this.nodeId = this.node.id;
|
||||
return;
|
||||
}
|
||||
this.router.navigate([this.previewLocation, id]);
|
||||
} catch {
|
||||
this.router.navigate([this.previewLocation, id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the visibility change of the Viewer component.
|
||||
* @param isVisible Indicator whether Viewer is visible or hidden.
|
||||
*/
|
||||
onVisibilityChanged(isVisible: boolean): void {
|
||||
const shouldSkipNavigation = this.routesSkipNavigation.includes(this.previewLocation);
|
||||
|
||||
if (!isVisible) {
|
||||
const route = [this.previewLocation];
|
||||
|
||||
if ( !shouldSkipNavigation && this.folderId ) {
|
||||
route.push(this.folderId);
|
||||
}
|
||||
|
||||
this.router.navigate(route);
|
||||
}
|
||||
}
|
||||
|
||||
/** Handles navigation to a previous document */
|
||||
onNavigateBefore(): void {
|
||||
if (this.previousNodeId) {
|
||||
this.router.navigate(
|
||||
this.getPreviewPath(this.folderId, this.previousNodeId)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/** Handles navigation to a next document */
|
||||
onNavigateNext(): void {
|
||||
if (this.nextNodeId) {
|
||||
this.router.navigate(
|
||||
this.getPreviewPath(this.folderId, this.nextNodeId)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a node preview route based on folder and node IDs.
|
||||
* @param folderId Folder ID
|
||||
* @param nodeId Node ID
|
||||
*/
|
||||
getPreviewPath(folderId: string, nodeId: string): any[] {
|
||||
const route = [this.previewLocation];
|
||||
|
||||
if (folderId) {
|
||||
route.push(folderId);
|
||||
}
|
||||
|
||||
if (nodeId) {
|
||||
route.push('preview', nodeId);
|
||||
}
|
||||
|
||||
return route;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves nearest node information for the given node and folder.
|
||||
* @param nodeId Unique identifier of the document node
|
||||
* @param folderId Unique identifier of the containing folder node.
|
||||
*/
|
||||
async getNearestNodes(nodeId: string, folderId: string): Promise<{ left: string, right: string }> {
|
||||
const empty = {
|
||||
left: null,
|
||||
right: null
|
||||
};
|
||||
|
||||
if (nodeId && folderId) {
|
||||
try {
|
||||
const ids = await this.getFileIds(this.navigateSource, folderId);
|
||||
const idx = ids.indexOf(nodeId);
|
||||
|
||||
if (idx >= 0) {
|
||||
return {
|
||||
left: ids[idx - 1] || null,
|
||||
right: ids[idx + 1] || null
|
||||
};
|
||||
} else {
|
||||
return empty;
|
||||
}
|
||||
} catch {
|
||||
return empty;
|
||||
}
|
||||
} else {
|
||||
return empty;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a list of node identifiers for the folder and data source.
|
||||
* @param source Data source name. Allowed values are: personal-files, libraries, favorites, shared, recent-files.
|
||||
* @param folderId Containing folder node identifier for 'personal-files' and 'libraries' sources.
|
||||
*/
|
||||
async getFileIds(source: string, folderId?: string): Promise<string[]> {
|
||||
if ((source === 'personal-files' || source === 'libraries') && folderId) {
|
||||
const sortKey = this.preferences.get('personal-files.sorting.key') || 'modifiedAt';
|
||||
const sortDirection = this.preferences.get('personal-files.sorting.direction') || 'desc';
|
||||
const nodes = await this.apiService.nodesApi.getNodeChildren(folderId, {
|
||||
// orderBy: `${sortKey} ${sortDirection}`,
|
||||
fields: ['id', this.getRootField(sortKey)],
|
||||
where: '(isFile=true)'
|
||||
});
|
||||
|
||||
const entries = nodes.list.entries.map(obj => obj.entry);
|
||||
this.sort(entries, sortKey, sortDirection);
|
||||
|
||||
return entries.map(obj => obj.id);
|
||||
}
|
||||
|
||||
if (source === 'favorites') {
|
||||
const nodes = await this.apiService.favoritesApi.getFavorites('-me-', {
|
||||
where: '(EXISTS(target/file))',
|
||||
fields: ['target']
|
||||
});
|
||||
|
||||
const sortKey = this.preferences.get('favorites.sorting.key') || 'modifiedAt';
|
||||
const sortDirection = this.preferences.get('favorites.sorting.direction') || 'desc';
|
||||
const files = nodes.list.entries.map(obj => obj.entry.target.file);
|
||||
this.sort(files, sortKey, sortDirection);
|
||||
|
||||
return files.map(f => f.id);
|
||||
}
|
||||
|
||||
if (source === 'shared') {
|
||||
const sortingKey = this.preferences.get('shared.sorting.key') || 'modifiedAt';
|
||||
const sortingDirection = this.preferences.get('shared.sorting.direction') || 'desc';
|
||||
|
||||
const nodes = await this.apiService.sharedLinksApi.findSharedLinks({
|
||||
fields: ['nodeId', this.getRootField(sortingKey)]
|
||||
});
|
||||
|
||||
const entries = nodes.list.entries.map(obj => obj.entry);
|
||||
this.sort(entries, sortingKey, sortingDirection);
|
||||
|
||||
return entries.map(obj => obj.nodeId);
|
||||
}
|
||||
|
||||
if (source === 'recent-files') {
|
||||
const person = await this.apiService.peopleApi.getPerson('-me-');
|
||||
const username = person.entry.id;
|
||||
const sortingKey = this.preferences.get('recent-files.sorting.key') || 'modifiedAt';
|
||||
const sortingDirection = this.preferences.get('recent-files.sorting.direction') || 'desc';
|
||||
|
||||
const nodes = await this.apiService.searchApi.search({
|
||||
query: {
|
||||
query: '*',
|
||||
language: 'afts'
|
||||
},
|
||||
filterQueries: [
|
||||
{ query: `cm:modified:[NOW/DAY-30DAYS TO NOW/DAY+1DAY]` },
|
||||
{ query: `cm:modifier:${username} OR cm:creator:${username}` },
|
||||
{ query: `TYPE:"content" AND -TYPE:"app:filelink" AND -TYPE:"fm:post"` }
|
||||
],
|
||||
fields: ['id', this.getRootField(sortingKey)],
|
||||
sort: [{
|
||||
type: 'FIELD',
|
||||
field: 'cm:modified',
|
||||
ascending: false
|
||||
}]
|
||||
});
|
||||
|
||||
const entries = nodes.list.entries.map(obj => obj.entry);
|
||||
this.sort(entries, sortingKey, sortingDirection);
|
||||
|
||||
return entries.map(obj => obj.id);
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
private sort(items: any[], key: string, direction: string) {
|
||||
const options: Intl.CollatorOptions = {};
|
||||
|
||||
if (key.includes('sizeInBytes') || key === 'name') {
|
||||
options.numeric = true;
|
||||
}
|
||||
|
||||
items.sort((a: any, b: any) => {
|
||||
let left = ObjectUtils.getValue(a, key);
|
||||
if (left) {
|
||||
left = (left instanceof Date) ? left.valueOf().toString() : left.toString();
|
||||
} else {
|
||||
left = '';
|
||||
}
|
||||
|
||||
let right = ObjectUtils.getValue(b, key);
|
||||
if (right) {
|
||||
right = (right instanceof Date) ? right.valueOf().toString() : right.toString();
|
||||
} else {
|
||||
right = '';
|
||||
}
|
||||
|
||||
return direction === 'asc'
|
||||
? left.localeCompare(right, undefined, options)
|
||||
: right.localeCompare(left, undefined, options);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the root field name from the property path.
|
||||
* Example: 'property1.some.child.property' => 'property1'
|
||||
* @param path Property path
|
||||
*/
|
||||
getRootField(path: string) {
|
||||
if (path) {
|
||||
return path.split('.')[0];
|
||||
}
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
@ -74,10 +74,11 @@
|
||||
currentFolderId="-recent-"
|
||||
selectionMode="multiple"
|
||||
[navigate]="false"
|
||||
[sorting]="[ 'modifiedAt', 'desc' ]"
|
||||
[sorting]="sorting"
|
||||
[contextMenuActions]="true"
|
||||
[contentActions]="false"
|
||||
[imageResolver]="imageResolver"
|
||||
(sorting-changed)="onSortingChanged($event)"
|
||||
(node-dblclick)="onNodeDoubleClick($event.detail?.node?.entry)"
|
||||
(node-select)="onNodeSelect($event, documentList)">
|
||||
|
||||
|
@ -43,12 +43,19 @@ export class RecentFilesComponent extends PageComponent implements OnInit, OnDes
|
||||
|
||||
private subscriptions: Subscription[] = [];
|
||||
|
||||
sorting = [ 'modifiedAt', 'desc' ];
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private content: ContentManagementService,
|
||||
preferences: UserPreferencesService) {
|
||||
super(preferences);
|
||||
|
||||
const sortingKey = preferences.get('recent-files.sorting.key') || 'modifiedAt';
|
||||
const sortingDirection = preferences.get('recent-files.sorting.direction') || 'desc';
|
||||
|
||||
this.sorting = [sortingKey, sortingDirection];
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@ -81,4 +88,9 @@ export class RecentFilesComponent extends PageComponent implements OnInit, OnDes
|
||||
this.documentList.reload();
|
||||
}
|
||||
}
|
||||
|
||||
onSortingChanged(event: CustomEvent) {
|
||||
this.preferences.set('recent-files.sorting.key', event.detail.key || 'modifiedAt');
|
||||
this.preferences.set('recent-files.sorting.direction', event.detail.direction || 'desc');
|
||||
}
|
||||
}
|
||||
|
@ -81,9 +81,10 @@
|
||||
[attr.class]="documentList.isEmpty() ? 'empty-list' : ''"
|
||||
currentFolderId="-sharedlinks-"
|
||||
selectionMode="multiple"
|
||||
[sorting]="[ 'modifiedAt', 'desc' ]"
|
||||
[sorting]="sorting"
|
||||
[contextMenuActions]="true"
|
||||
[contentActions]="false"
|
||||
(sorting-changed)="onSortingChanged($event)"
|
||||
(node-dblclick)="onNodeDoubleClick($event.detail?.node?.entry)">
|
||||
|
||||
<empty-folder-content>
|
||||
|
@ -43,13 +43,19 @@ export class SharedFilesComponent extends PageComponent implements OnInit, OnDes
|
||||
|
||||
private subscriptions: Subscription[] = [];
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private content: ContentManagementService,
|
||||
private apiService: AlfrescoApiService,
|
||||
preferences: UserPreferencesService) {
|
||||
sorting = [ 'modifiedAt', 'desc' ];
|
||||
|
||||
constructor(private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private content: ContentManagementService,
|
||||
private apiService: AlfrescoApiService,
|
||||
preferences: UserPreferencesService) {
|
||||
super(preferences);
|
||||
|
||||
const sortingKey = preferences.get('shared.sorting.key') || 'modifiedAt';
|
||||
const sortingDirection = preferences.get('shared.sorting.direction') || 'desc';
|
||||
|
||||
this.sorting = [sortingKey, sortingDirection];
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@ -91,4 +97,9 @@ export class SharedFilesComponent extends PageComponent implements OnInit, OnDes
|
||||
this.documentList.reload();
|
||||
}
|
||||
}
|
||||
|
||||
onSortingChanged(event: CustomEvent) {
|
||||
this.preferences.set('shared-files.sorting.key', event.detail.key || 'modifiedAt');
|
||||
this.preferences.set('shared-files.sorting.direction', event.detail.direction || 'desc');
|
||||
}
|
||||
}
|
||||
|
@ -31,9 +31,10 @@
|
||||
currentFolderId="-trashcan-"
|
||||
selectionMode="multiple"
|
||||
[navigate]="false"
|
||||
[sorting]="[ 'archivedAt', 'desc' ]"
|
||||
[sorting]="sorting"
|
||||
[contextMenuActions]="true"
|
||||
[contentActions]="false">
|
||||
[contentActions]="false"
|
||||
(sorting-changed)="onSortingChanged($event)">
|
||||
|
||||
<empty-folder-content>
|
||||
<ng-template>
|
||||
|
@ -38,9 +38,14 @@ export class TrashcanComponent implements OnInit, OnDestroy {
|
||||
|
||||
@ViewChild(DocumentListComponent) documentList;
|
||||
|
||||
constructor(
|
||||
private contentManagementService: ContentManagementService,
|
||||
private preferences: UserPreferencesService) {}
|
||||
sorting = [ 'archivedAt', 'desc' ];
|
||||
|
||||
constructor(private contentManagementService: ContentManagementService,
|
||||
private preferences: UserPreferencesService) {
|
||||
const sortingKey = preferences.get('trashcan.sorting.key') || 'archivedAt';
|
||||
const sortingDirection = preferences.get('trashcan.sorting.direction') || 'desc';
|
||||
this.sorting = [sortingKey, sortingDirection];
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.subscriptions.push(this.contentManagementService.restoreNode.subscribe(() => this.refresh()));
|
||||
@ -58,4 +63,9 @@ export class TrashcanComponent implements OnInit, OnDestroy {
|
||||
onChangePageSize(event: Pagination): void {
|
||||
this.preferences.paginationSize = event.maxItems;
|
||||
}
|
||||
|
||||
onSortingChanged(event: CustomEvent) {
|
||||
this.preferences.set('trashcan.sorting.key', event.detail.key || 'archivedAt');
|
||||
this.preferences.set('trashcan.sorting.direction', event.detail.direction || 'desc');
|
||||
}
|
||||
}
|
||||
|
75
yarn.lock
75
yarn.lock
@ -2,11 +2,11 @@
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@alfresco/adf-content-services@2.2.0-beta1":
|
||||
version "2.2.0-beta1"
|
||||
resolved "https://registry.yarnpkg.com/@alfresco/adf-content-services/-/adf-content-services-2.2.0-beta1.tgz#d578df1294cd6f9d9df34857b799838307dd905f"
|
||||
"@alfresco/adf-content-services@2.2.0-0e512083331b094a1593e9b1f081ff441db01786":
|
||||
version "2.2.0-0e512083331b094a1593e9b1f081ff441db01786"
|
||||
resolved "https://registry.yarnpkg.com/@alfresco/adf-content-services/-/adf-content-services-2.2.0-0e512083331b094a1593e9b1f081ff441db01786.tgz#694bbb7bdca67c3afd3a011c6d8717f5da287311"
|
||||
dependencies:
|
||||
"@alfresco/adf-core" "2.2.0-beta1"
|
||||
"@alfresco/adf-core" "2.2.0-0e512083331b094a1593e9b1f081ff441db01786"
|
||||
"@angular/animations" "5.1.1"
|
||||
"@angular/cdk" "5.0.1"
|
||||
"@angular/common" "5.1.1"
|
||||
@ -21,7 +21,7 @@
|
||||
"@angular/platform-browser-dynamic" "5.1.1"
|
||||
"@angular/router" "5.1.1"
|
||||
"@ngx-translate/core" "8.0.0"
|
||||
alfresco-js-api "2.2.0-beta1"
|
||||
alfresco-js-api "2.1.0-4c702fe0041642c09f12fb939014cf70671d8ed8"
|
||||
chart.js "2.5.0"
|
||||
core-js "2.4.1"
|
||||
hammerjs "2.0.8"
|
||||
@ -35,9 +35,9 @@
|
||||
systemjs "0.19.27"
|
||||
zone.js "0.8.14"
|
||||
|
||||
"@alfresco/adf-core@2.2.0-beta1":
|
||||
version "2.2.0-beta1"
|
||||
resolved "https://registry.yarnpkg.com/@alfresco/adf-core/-/adf-core-2.2.0-beta1.tgz#e79ded6bee985146ff325c9256e8a70968ea2eb8"
|
||||
"@alfresco/adf-core@2.2.0-0e512083331b094a1593e9b1f081ff441db01786":
|
||||
version "2.2.0-0e512083331b094a1593e9b1f081ff441db01786"
|
||||
resolved "https://registry.yarnpkg.com/@alfresco/adf-core/-/adf-core-2.2.0-0e512083331b094a1593e9b1f081ff441db01786.tgz#d48d80cf9928946cc611d6ebb37312a3c140a3a9"
|
||||
dependencies:
|
||||
"@angular/animations" "5.1.1"
|
||||
"@angular/cdk" "5.0.1"
|
||||
@ -53,7 +53,7 @@
|
||||
"@angular/platform-browser-dynamic" "5.1.1"
|
||||
"@angular/router" "5.1.1"
|
||||
"@ngx-translate/core" "8.0.0"
|
||||
alfresco-js-api "2.2.0-beta1"
|
||||
alfresco-js-api "2.1.0-4c702fe0041642c09f12fb939014cf70671d8ed8"
|
||||
chart.js "2.5.0"
|
||||
core-js "2.4.1"
|
||||
hammerjs "2.0.8"
|
||||
@ -398,6 +398,13 @@ ajv@^5.0.0, ajv@^5.1.0, ajv@^5.1.5, ajv@~5.5.1:
|
||||
fast-json-stable-stringify "^2.0.0"
|
||||
json-schema-traverse "^0.3.0"
|
||||
|
||||
alfresco-js-api@2.1.0-4c702fe0041642c09f12fb939014cf70671d8ed8:
|
||||
version "2.1.0-4c702fe0041642c09f12fb939014cf70671d8ed8"
|
||||
resolved "https://registry.yarnpkg.com/alfresco-js-api/-/alfresco-js-api-2.1.0-4c702fe0041642c09f12fb939014cf70671d8ed8.tgz#1d9add0f5d80ff98ec9d24bc719cd489eb048ff5"
|
||||
dependencies:
|
||||
event-emitter "0.3.4"
|
||||
superagent "3.8.2"
|
||||
|
||||
alfresco-js-api@2.2.0-beta1:
|
||||
version "2.2.0-beta1"
|
||||
resolved "https://registry.yarnpkg.com/alfresco-js-api/-/alfresco-js-api-2.2.0-beta1.tgz#3a380fcc437f51276b96d0a6dd1bf439622d68a6"
|
||||
@ -702,8 +709,8 @@ babel-code-frame@^6.22.0, babel-code-frame@^6.26.0:
|
||||
js-tokens "^3.0.2"
|
||||
|
||||
babel-generator@^6.18.0:
|
||||
version "6.26.0"
|
||||
resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.26.0.tgz#ac1ae20070b79f6e3ca1d3269613053774f20dc5"
|
||||
version "6.26.1"
|
||||
resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.26.1.tgz#1844408d3b8f0d35a404ea7ac180f087a601bd90"
|
||||
dependencies:
|
||||
babel-messages "^6.23.0"
|
||||
babel-runtime "^6.26.0"
|
||||
@ -711,7 +718,7 @@ babel-generator@^6.18.0:
|
||||
detect-indent "^4.0.0"
|
||||
jsesc "^1.3.0"
|
||||
lodash "^4.17.4"
|
||||
source-map "^0.5.6"
|
||||
source-map "^0.5.7"
|
||||
trim-right "^1.0.1"
|
||||
|
||||
babel-messages@^6.23.0:
|
||||
@ -1219,12 +1226,12 @@ caniuse-api@^1.5.2:
|
||||
lodash.uniq "^4.5.0"
|
||||
|
||||
caniuse-db@^1.0.30000529, caniuse-db@^1.0.30000634, caniuse-db@^1.0.30000639:
|
||||
version "1.0.30000800"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000800.tgz#a86e6bc23bd9a707d5df42f33e64d0495cfda218"
|
||||
version "1.0.30000803"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000803.tgz#3e8d2baf56c2fd5a59c82e227928a0dc2c26702d"
|
||||
|
||||
caniuse-lite@^1.0.30000791, caniuse-lite@^1.0.30000792:
|
||||
version "1.0.30000792"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000792.tgz#d0cea981f8118f3961471afbb43c9a1e5bbf0332"
|
||||
version "1.0.30000803"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000803.tgz#9939c37149d38d5f4540430490d240c03106a0f5"
|
||||
|
||||
caseless@~0.11.0:
|
||||
version "0.11.0"
|
||||
@ -1521,7 +1528,11 @@ commander@2.12.x:
|
||||
version "2.12.2"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.12.2.tgz#0f5946c427ed9ec0d91a46bb9def53e54650e555"
|
||||
|
||||
commander@^2.12.1, commander@^2.9.0, commander@^2.x, commander@~2.13.0:
|
||||
commander@^2.12.1, commander@^2.9.0, commander@^2.x:
|
||||
version "2.14.0"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.14.0.tgz#7b25325963e6aace20d3a9285b09379b0c2208b5"
|
||||
|
||||
commander@~2.13.0:
|
||||
version "2.13.0"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c"
|
||||
|
||||
@ -3324,8 +3335,8 @@ http-errors@1.6.2, http-errors@~1.6.2:
|
||||
statuses ">= 1.3.1 < 2"
|
||||
|
||||
http-parser-js@>=0.4.0:
|
||||
version "0.4.9"
|
||||
resolved "https://registry.yarnpkg.com/http-parser-js/-/http-parser-js-0.4.9.tgz#ea1a04fb64adff0242e9974f297dd4c3cad271e1"
|
||||
version "0.4.10"
|
||||
resolved "https://registry.yarnpkg.com/http-parser-js/-/http-parser-js-0.4.10.tgz#92c9c1374c35085f75db359ec56cc257cbb93fa4"
|
||||
|
||||
http-proxy-agent@1:
|
||||
version "1.0.0"
|
||||
@ -3884,9 +3895,9 @@ jasmine-core@~2.8.0:
|
||||
version "2.8.0"
|
||||
resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-2.8.0.tgz#bcc979ae1f9fd05701e45e52e65d3a5d63f1a24e"
|
||||
|
||||
jasmine-core@~2.9.0:
|
||||
version "2.9.1"
|
||||
resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-2.9.1.tgz#b6bbc1d8e65250d56f5888461705ebeeeb88f22f"
|
||||
jasmine-core@~2.99.0:
|
||||
version "2.99.0"
|
||||
resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-2.99.0.tgz#c105ab5222da45f1b0a10580383f5adbbff56d2c"
|
||||
|
||||
jasmine-reporters@^2.2.1:
|
||||
version "2.3.0"
|
||||
@ -3910,12 +3921,12 @@ jasmine2-protractor-utils@^1.3.0:
|
||||
q "^1.4.1"
|
||||
|
||||
jasmine@^2.5.3:
|
||||
version "2.9.0"
|
||||
resolved "https://registry.yarnpkg.com/jasmine/-/jasmine-2.9.0.tgz#76571f925c8783409e7c6153572e5a6341cf93eb"
|
||||
version "2.99.0"
|
||||
resolved "https://registry.yarnpkg.com/jasmine/-/jasmine-2.99.0.tgz#8ca72d102e639b867c6489856e0e18a9c7aa42b7"
|
||||
dependencies:
|
||||
exit "^0.1.2"
|
||||
glob "^7.0.6"
|
||||
jasmine-core "~2.9.0"
|
||||
jasmine-core "~2.99.0"
|
||||
|
||||
jasminewd2@^2.1.0:
|
||||
version "2.2.0"
|
||||
@ -4294,8 +4305,8 @@ lodash.memoize@~3.0.3:
|
||||
resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-3.0.4.tgz#2dcbd2c287cbc0a55cc42328bd0c736150d53e3f"
|
||||
|
||||
lodash.mergewith@^4.6.0:
|
||||
version "4.6.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.0.tgz#150cf0a16791f5903b8891eab154609274bdea55"
|
||||
version "4.6.1"
|
||||
resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.1.tgz#639057e726c3afbdb3e7d42741caa8d6e4335927"
|
||||
|
||||
lodash.tail@^4.1.1:
|
||||
version "4.1.1"
|
||||
@ -4310,8 +4321,8 @@ lodash@^3.10.0:
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6"
|
||||
|
||||
lodash@^4.0.0, lodash@^4.11.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.2, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.3.0, lodash@^4.5.0, lodash@~4.17.4:
|
||||
version "4.17.4"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
|
||||
version "4.17.5"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511"
|
||||
|
||||
log-driver@^1.x:
|
||||
version "1.2.5"
|
||||
@ -4418,8 +4429,8 @@ make-dir@^1.0.0:
|
||||
pify "^3.0.0"
|
||||
|
||||
make-error@^1.1.1:
|
||||
version "1.3.2"
|
||||
resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.2.tgz#8762ffad2444dd8ff1f7c819629fa28e24fea1c4"
|
||||
version "1.3.3"
|
||||
resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.3.tgz#a97ae14ffd98b05f543e83ddc395e1b2b6e4cc6a"
|
||||
|
||||
map-cache@^0.2.2:
|
||||
version "0.2.2"
|
||||
@ -6725,7 +6736,7 @@ source-map@0.1.x:
|
||||
dependencies:
|
||||
amdefine ">=0.0.4"
|
||||
|
||||
source-map@0.5.x, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1, source-map@~0.5.3, source-map@~0.5.6:
|
||||
source-map@0.5.x, source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.1, source-map@~0.5.3, source-map@~0.5.6:
|
||||
version "0.5.7"
|
||||
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user