upgrade to latest JS-API and ADF (#896)

* improved update script and latest ADF libs

* upgrade to latest js-api and ADF

* upgrade tests

* update viewer code

* use @alfresco/js-api

* update to latest adf

* fix deprecation issues

* update viewer

* fix copy/move dialog

* change expect

* fix remove site from favorites

* fix unit test

* update adf version

* use ADF upload dialog
This commit is contained in:
Denys Vuika 2019-01-22 14:10:48 +00:00 committed by GitHub
parent afa6de5687
commit f0a3f6f630
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
82 changed files with 360 additions and 1214 deletions

View File

@ -84,7 +84,7 @@ describe('Special permissions', () => {
expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items');
await apis.admin.sites.deleteSiteMember(sitePrivate, username);
await page.refresh();
expect(await dataTable.countRows()).toBe(0, 'Incorrect number of items');
expect(await dataTable.isEmptyList()).toBe(true, 'Items are still displayed');
});
it('on Favorites - [C213227]', async () => {
@ -92,7 +92,7 @@ describe('Special permissions', () => {
expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items');
await apis.admin.sites.deleteSiteMember(sitePrivate, username);
await page.refresh();
expect(await dataTable.countRows()).toBe(0, 'Incorrect number of items');
expect(await dataTable.isEmptyList()).toBe(true, 'Items are still displayed');
});
it('on Shared Files - [C213116]', async () => {
@ -100,7 +100,7 @@ describe('Special permissions', () => {
expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items');
await apis.admin.sites.deleteSiteMember(sitePrivate, username);
await page.refresh();
expect(await dataTable.countRows()).toBe(0, 'Incorrect number of items');
expect(await dataTable.isEmptyList()).toBe(true, 'Items are still displayed');
});
});

View File

@ -26,8 +26,11 @@
import { RepoApi } from '../repo-api';
import { RepoClient } from './../../repo-client';
import { Utils } from '../../../../utilities/utils';
import { FavoritesApi as AdfFavoritesApi, SitesApi as AdfSiteApi } from '@alfresco/js-api';
export class FavoritesApi extends RepoApi {
favoritesApi = new AdfFavoritesApi(this.alfrescoJsApi);
sitesApi = new AdfSiteApi(this.alfrescoJsApi);
constructor(username?, password?) {
super(username, password);
@ -42,7 +45,7 @@ export class FavoritesApi extends RepoApi {
}
}
};
return await this.alfrescoJsApi.core.favoritesApi.addFavorite('-me-', data);
return await this.favoritesApi.createFavorite('-me-', data);
}
async addFavoriteById(nodeType: 'file' | 'folder' | 'site', id: string) {
@ -50,7 +53,7 @@ export class FavoritesApi extends RepoApi {
await this.apiAuth();
if ( nodeType === 'site' ) {
guid = (await this.alfrescoJsApi.core.sitesApi.getSite(id)).entry.guid;
guid = (await this.sitesApi.getSite(id)).entry.guid;
} else {
guid = id;
}
@ -62,7 +65,7 @@ export class FavoritesApi extends RepoApi {
}
};
try {
return await this.alfrescoJsApi.core.favoritesApi.addFavorite('-me-', data);
return await this.favoritesApi.createFavorite('-me-', data);
} catch (error) {
// console.log('--- add favorite by id catch ');
}
@ -77,12 +80,12 @@ export class FavoritesApi extends RepoApi {
async getFavorites() {
await this.apiAuth();
return await this.alfrescoJsApi.core.favoritesApi.getFavorites(this.getUsername());
return await this.favoritesApi.listFavorites(this.getUsername());
}
async getFavoriteById(nodeId: string) {
await this.apiAuth();
return await this.alfrescoJsApi.core.favoritesApi.getFavorite('-me-', nodeId);
return await this.favoritesApi.getFavorite('-me-', nodeId);
}
async isFavorite(nodeId: string) {
@ -111,7 +114,7 @@ export class FavoritesApi extends RepoApi {
async removeFavoriteById(nodeId: string) {
await this.apiAuth();
try {
return await this.alfrescoJsApi.core.peopleApi.removeFavoriteSite('-me-', nodeId);
return await this.favoritesApi.deleteSiteFavorite('-me-', nodeId);
} catch (error) {
// console.log('--- remove favorite by id catch ');
}
@ -139,6 +142,5 @@ export class FavoritesApi extends RepoApi {
} catch (error) {
console.log('-----> catch favorites: ', error);
}
}
}

View File

@ -23,27 +23,26 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { NodeBodyLock } from 'alfresco-js-api-node';
import { RepoApi } from '../repo-api';
import { NodeBodyCreate } from './node-body-create';
import { NodeContentTree, flattenNodeContentTree } from './node-content-tree';
import { NodesApi as AdfNodeApi, NodeBodyLock} from '@alfresco/js-api';
export class NodesApi extends RepoApi {
nodesApi = new AdfNodeApi(this.alfrescoJsApi);
constructor(username?, password?) {
super(username, password);
}
// nodes
async getNodeByPath(relativePath: string = '/') {
await this.apiAuth();
return await this.alfrescoJsApi.core.nodesApi.getNode('-my-', { relativePath });
return await this.nodesApi.getNode('-my-', { relativePath });
}
async getNodeById(id: string) {
await this.apiAuth();
return await this.alfrescoJsApi.core.nodesApi.getNode(id);
return await this.nodesApi.getNode(id);
}
async getNodeDescription(name: string, parentId: string) {
@ -75,7 +74,7 @@ export class NodesApi extends RepoApi {
async deleteNodeById(id: string, permanent: boolean = true) {
await this.apiAuth();
try {
return await this.alfrescoJsApi.core.nodesApi.deleteNode(id, { permanent });
return await this.nodesApi.deleteNode(id, { permanent });
} catch (error) {
console.log('------ deleteNodeById failed ');
}
@ -100,14 +99,12 @@ export class NodesApi extends RepoApi {
}, Promise.resolve());
}
// children
async getNodeChildren(nodeId: string) {
const opts = {
include: [ 'properties' ]
};
await this.apiAuth();
return await this.alfrescoJsApi.core.nodesApi.getNodeChildren(nodeId, opts);
return await this.nodesApi.listNodeChildren(nodeId, opts);
}
async deleteNodeChildren(parentId: string) {
@ -138,7 +135,7 @@ export class NodesApi extends RepoApi {
}
await this.apiAuth();
return await this.alfrescoJsApi.core.nodesApi.addNode(parentId, nodeBody);
return await this.nodesApi.createNode(parentId, nodeBody);
}
async createFile(name: string, parentId: string = '-my-', title: string = '', description: string = '') {
@ -155,7 +152,7 @@ export class NodesApi extends RepoApi {
async createChildren(data: NodeBodyCreate[]): Promise<any> {
await this.apiAuth();
return await this.alfrescoJsApi.core.nodesApi.addNode('-my-', data);
return await this.nodesApi.createNode('-my-', <any>data);
}
async createContent(content: NodeContentTree, relativePath: string = '/') {
@ -173,17 +170,17 @@ export class NodesApi extends RepoApi {
// node content
async getNodeContent(nodeId: string) {
await this.apiAuth();
return await this.alfrescoJsApi.core.nodesApi.getNodeContent(nodeId);
return await this.nodesApi.getNodeContent(nodeId);
}
async editNodeContent(nodeId: string, content: string) {
await this.apiAuth();
return await this.alfrescoJsApi.core.nodesApi.updateNodeContent(nodeId, content);
return await this.nodesApi.updateNodeContent(nodeId, content);
}
async renameNode(nodeId: string, newName: string) {
await this.apiAuth();
return this.alfrescoJsApi.core.nodesApi.updateNode(nodeId, { name: newName });
return this.nodesApi.updateNode(nodeId, { name: newName });
}
// node permissions
@ -201,12 +198,12 @@ export class NodesApi extends RepoApi {
};
await this.apiAuth();
return await this.alfrescoJsApi.core.nodesApi.updateNode(nodeId, data);
return await this.nodesApi.updateNode(nodeId, data);
}
async getNodePermissions(nodeId: string) {
await this.apiAuth();
return await this.alfrescoJsApi.core.nodesApi.getNode(nodeId, { include: ['permissions'] });
return await this.nodesApi.getNode(nodeId, { include: ['permissions'] });
}
// lock node
@ -215,11 +212,11 @@ export class NodesApi extends RepoApi {
type: lockType
};
await this.apiAuth();
return await this.alfrescoJsApi.core.nodesApi.lockNode(nodeId, data );
return await this.nodesApi.lockNode(nodeId, data );
}
async unlockFile(nodeId: string) {
await this.apiAuth();
return await this.alfrescoJsApi.core.nodesApi.unlockNode(nodeId);
return await this.nodesApi.unlockNode(nodeId);
}
}

View File

@ -25,8 +25,10 @@
import { PersonModel, Person } from './people-api-models';
import { RepoApi } from '../repo-api';
import { PeopleApi as AdfPeopleApi} from '@alfresco/js-api';
export class PeopleApi extends RepoApi {
peopleApi = new AdfPeopleApi(this.alfrescoJsApi);
constructor(username?, password?) {
super(username, password);
@ -35,17 +37,17 @@ export class PeopleApi extends RepoApi {
async createUser(user: PersonModel) {
const person = new Person(user);
await this.apiAuth();
return await this.alfrescoJsApi.core.peopleApi.addPerson(person);
return await this.peopleApi.createPerson(person);
}
async getUser(username: string) {
await this.apiAuth();
return await this.alfrescoJsApi.core.peopleApi.getPerson(username);
return await this.peopleApi.getPerson(username);
}
async updateUser(username: string, userDetails?: PersonModel) {
await this.apiAuth();
return this.alfrescoJsApi.core.peopleApi.updatePerson(username, userDetails);
return this.peopleApi.updatePerson(username, userDetails);
}
async disableUser(username: string) {

View File

@ -25,8 +25,10 @@
import { RepoApi } from '../repo-api';
import { Utils } from '../../../../utilities/utils';
import { QueriesApi as AdfQueriesApi } from '@alfresco/js-api';
export class QueriesApi extends RepoApi {
queriesApi = new AdfQueriesApi(this.alfrescoJsApi);
constructor(username?, password?) {
super(username, password);
@ -39,7 +41,7 @@ export class QueriesApi extends RepoApi {
};
await this.apiAuth();
return this.alfrescoJsApi.core.queriesApi.findSites(searchTerm, data);
return this.queriesApi.findSites(searchTerm, data);
}
async findNodes(searchTerm: string) {

View File

@ -23,21 +23,22 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import * as AlfrescoApi from 'alfresco-js-api-node';
import { AlfrescoApi } from '@alfresco/js-api';
import { REPO_API_HOST } from '../../../configs';
import { RepoClientAuth } from '../repo-client-models';
export abstract class RepoApi {
alfrescoJsApi = new AlfrescoApi({
provider: 'ECM',
hostEcm: REPO_API_HOST
});
alfrescoJsApi = new AlfrescoApi();
constructor(
private username: string = RepoClientAuth.DEFAULT_USERNAME,
private password: string = RepoClientAuth.DEFAULT_PASSWORD
) {}
) {
this.alfrescoJsApi.setConfig({
provider: 'ECM',
hostEcm: REPO_API_HOST
});
}
apiAuth() {
return this.alfrescoJsApi.login(this.username, this.password);

View File

@ -25,8 +25,10 @@
import { RepoApi } from '../repo-api';
import { Utils } from '../../../../utilities/utils';
import { SearchApi as AdfSearchApi } from '@alfresco/js-api';
export class SearchApi extends RepoApi {
searchApi = new AdfSearchApi(this.alfrescoJsApi);
constructor(username?, password?) {
super(username, password);
@ -46,7 +48,7 @@ export class SearchApi extends RepoApi {
};
await this.apiAuth();
return this.alfrescoJsApi.search.searchApi.search(data);
return this.searchApi.search(data);
}
async queryNodesNames(searchTerm: string) {
@ -61,7 +63,7 @@ export class SearchApi extends RepoApi {
};
await this.apiAuth();
return this.alfrescoJsApi.search.searchApi.search(data);
return this.searchApi.search(data);
}
async queryNodesExactNames(searchTerm: string) {
@ -76,7 +78,7 @@ export class SearchApi extends RepoApi {
};
await this.apiAuth();
return this.alfrescoJsApi.search.searchApi.search(data);
return this.searchApi.search(data);
}
async waitForApi(username, data) {

View File

@ -25,8 +25,10 @@
import { RepoApi } from '../repo-api';
import { Utils } from '../../../../utilities/utils';
import { SharedlinksApi as AdfSharedlinksApi } from '@alfresco/js-api';
export class SharedLinksApi extends RepoApi {
sharedlinksApi = new AdfSharedlinksApi(this.alfrescoJsApi);
constructor(username?, password?) {
super(username, password);
@ -39,7 +41,7 @@ export class SharedLinksApi extends RepoApi {
nodeId: id,
expiresAt: expireDate
};
return await this.alfrescoJsApi.core.sharedlinksApi.addSharedLink(data);
return await this.sharedlinksApi.createSharedLink(data);
} catch (error) {
console.log('---- shareFileById error: ', error);
}
@ -60,12 +62,12 @@ export class SharedLinksApi extends RepoApi {
async unshareFile(name: string) {
const id = await this.getSharedIdOfNode(name);
return await this.alfrescoJsApi.core.sharedlinksApi.deleteSharedLink(id);
return await this.sharedlinksApi.deleteSharedLink(id);
}
async getSharedLinks() {
await this.apiAuth();
return await this.alfrescoJsApi.core.sharedlinksApi.findSharedLinks();
return await this.sharedlinksApi.listSharedLinks();
}
async waitForApi(data) {

View File

@ -24,11 +24,13 @@
*/
import { RepoApi } from '../repo-api';
import { SiteBody, SiteMemberRoleBody, SiteMemberBody } from 'alfresco-js-api-node';
import { SiteBody, SiteMemberRoleBody, SiteMemberBody } from '@alfresco/js-api';
import { SITE_VISIBILITY } from '../../../../configs';
import { Utils } from '../../../../utilities/utils';
import { SitesApi as AdfSiteApi } from '@alfresco/js-api';
export class SitesApi extends RepoApi {
sitesApi = new AdfSiteApi(this.alfrescoJsApi);
constructor(username?, password?) {
super(username, password);
@ -36,17 +38,17 @@ export class SitesApi extends RepoApi {
async getSite(siteId: string) {
await this.apiAuth();
return await this.alfrescoJsApi.core.sitesApi.getSite(siteId);
return await this.sitesApi.getSite(siteId);
}
async getSites() {
await this.apiAuth();
return await this.alfrescoJsApi.core.peopleApi.getSiteMembership(this.getUsername());
return await this.sitesApi.listSiteMembershipsForPerson(this.getUsername());
}
async getDocLibId(siteId: string) {
await this.apiAuth();
return (await this.alfrescoJsApi.core.sitesApi.getSiteContainers(siteId)).list.entries[0].entry.id;
return (await this.sitesApi.listSiteContainers(siteId)).list.entries[0].entry.id;
}
async getVisibility(siteId: string) {
@ -73,7 +75,7 @@ export class SitesApi extends RepoApi {
};
await this.apiAuth();
return await this.alfrescoJsApi.core.sitesApi.createSite(site);
return await this.sitesApi.createSite(site);
}
async createSites(titles: string[], visibility?: string) {
@ -85,7 +87,7 @@ export class SitesApi extends RepoApi {
async deleteSite(siteId: string, permanent: boolean = true) {
await this.apiAuth();
return await this.alfrescoJsApi.core.sitesApi.deleteSite(siteId, { permanent });
return await this.sitesApi.deleteSite(siteId, { permanent });
}
async deleteSites(siteIds: string[], permanent: boolean = true) {
@ -110,7 +112,7 @@ export class SitesApi extends RepoApi {
};
await this.apiAuth();
return await this.alfrescoJsApi.core.sitesApi.updateSiteMember(siteId, userId, siteRole);
return await this.sitesApi.updateSiteMembership(siteId, userId, siteRole);
}
async addSiteMember(siteId: string, userId: string, role: string) {
@ -120,12 +122,12 @@ export class SitesApi extends RepoApi {
};
await this.apiAuth();
return await this.alfrescoJsApi.core.sitesApi.addSiteMember(siteId, memberBody);
return await this.sitesApi.createSiteMembership(siteId, memberBody);
}
async deleteSiteMember(siteId: string, userId: string) {
await this.apiAuth();
return await this.alfrescoJsApi.core.sitesApi.removeSiteMember(siteId, userId);
return await this.sitesApi.deleteSiteMembership(siteId, userId);
}
async requestToJoin(siteId: string) {
@ -134,7 +136,7 @@ export class SitesApi extends RepoApi {
};
await this.apiAuth();
try {
return await this.alfrescoJsApi.core.peopleApi.addSiteMembershipRequest('-me-', body);
return await this.sitesApi.createSiteMembershipRequestForPerson('-me-', body);
} catch (error) {
console.log('====== requestToJoin catch ', error);
};
@ -142,7 +144,7 @@ export class SitesApi extends RepoApi {
async hasMembershipRequest(siteId: string) {
await this.apiAuth();
const requests = (await this.alfrescoJsApi.core.peopleApi.getSiteMembershipRequests('-me-')).list.entries.map(e => e.entry.id);
const requests = (await this.sitesApi.getSiteMembershipRequests('-me-')).list.entries.map(e => e.entry.id);
return requests.includes(siteId);
}

View File

@ -25,8 +25,10 @@
import { RepoApi } from '../repo-api';
import { Utils } from '../../../../utilities/utils';
import { TrashcanApi as AdfTrashcanApi} from '@alfresco/js-api';
export class TrashcanApi extends RepoApi {
trashcanApi = new AdfTrashcanApi(this.alfrescoJsApi);
constructor(username?, password?) {
super(username, password);
@ -34,12 +36,12 @@ export class TrashcanApi extends RepoApi {
async permanentlyDelete(id: string) {
await this.apiAuth();
return await this.alfrescoJsApi.core.nodesApi.purgeDeletedNode(id);
return await this.trashcanApi.deleteDeletedNode(id);
}
async restore(id: string) {
await this.apiAuth();
return await this.alfrescoJsApi.core.nodesApi.restoreNode(id);
return await this.trashcanApi.restoreDeletedNode(id);
}
async getDeletedNodes() {
@ -47,7 +49,7 @@ export class TrashcanApi extends RepoApi {
maxItems: 1000
};
await this.apiAuth();
return await this.alfrescoJsApi.core.nodesApi.getDeletedNodes(opts);
return await this.trashcanApi.listDeletedNodes(opts);
}
async emptyTrash() {

View File

@ -25,10 +25,12 @@
import { RepoApi } from '../repo-api';
import { E2E_ROOT_PATH } from '../../../../configs';
import { UploadApi as AdfUploadApi } from '@alfresco/js-api';
const fs = require('fs');
export class UploadApi extends RepoApi {
upload = new AdfUploadApi(this.alfrescoJsApi);
constructor(username?, password?) {
super(username, password);
@ -42,7 +44,7 @@ export class UploadApi extends RepoApi {
};
await this.apiAuth();
return await this.alfrescoJsApi.upload.uploadFile(file, '', parentFolderId, null, opts);
return await this.upload.uploadFile(file, '', parentFolderId, null, opts);
}
async uploadFileWithRename(fileName: string, parentFolderId: string = '-my-', newName: string) {
@ -53,7 +55,7 @@ export class UploadApi extends RepoApi {
};
await this.apiAuth();
return await this.alfrescoJsApi.upload.uploadFile(file, '', parentFolderId, null, opts);
return await this.upload.uploadFile(file, '', parentFolderId, null, opts);
}
}

97
package-lock.json generated
View File

@ -5,29 +5,38 @@
"requires": true,
"dependencies": {
"@alfresco/adf-content-services": {
"version": "3.0.0-dd25467a98fad2898a2b71d07fa50bb175cea81c",
"resolved": "https://registry.npmjs.org/@alfresco/adf-content-services/-/adf-content-services-3.0.0-dd25467a98fad2898a2b71d07fa50bb175cea81c.tgz",
"integrity": "sha512-lzR6pL/563J9IcSXR/X6p2lqFVMRADrnDglAHk4a1k58QBypfIFsmbLX8h9acMhAn/DydEgjQ6pXxLRuxoVLFg==",
"version": "3.0.0-7c66589b26e57061a07a8d38bfebc2ee05fb1b83",
"resolved": "https://registry.npmjs.org/@alfresco/adf-content-services/-/adf-content-services-3.0.0-7c66589b26e57061a07a8d38bfebc2ee05fb1b83.tgz",
"integrity": "sha512-1Cca7AG8vH+U15k125PCiKdTRYb6uQd29x4Idle48urDFUpkUXBF3elnR15CWCwBuw+Idl0HVogAIIbbKsP2CQ==",
"requires": {
"tslib": "^1.9.0"
}
},
"@alfresco/adf-core": {
"version": "3.0.0-dd25467a98fad2898a2b71d07fa50bb175cea81c",
"resolved": "https://registry.npmjs.org/@alfresco/adf-core/-/adf-core-3.0.0-dd25467a98fad2898a2b71d07fa50bb175cea81c.tgz",
"integrity": "sha512-Dj+mef9GUpyn1eMM6ZgMDqEH+rAZxGb4Xgw01lbZA40XhW3lRqlkh1SwuTBSlNYN8RwTlNJVKb/nT9hpaR1Kag==",
"version": "3.0.0-7c66589b26e57061a07a8d38bfebc2ee05fb1b83",
"resolved": "https://registry.npmjs.org/@alfresco/adf-core/-/adf-core-3.0.0-7c66589b26e57061a07a8d38bfebc2ee05fb1b83.tgz",
"integrity": "sha512-s5E3dAgb7pkB6JP/EjOTlWvddjuykTqR4WxUsVQahGkPYqg7O2PkvkElIVeeerB/oBjXYW1LY8p5HUCZoIiqGg==",
"requires": {
"tslib": "^1.9.0"
}
},
"@alfresco/adf-extensions": {
"version": "3.0.0-dd25467a98fad2898a2b71d07fa50bb175cea81c",
"resolved": "https://registry.npmjs.org/@alfresco/adf-extensions/-/adf-extensions-3.0.0-dd25467a98fad2898a2b71d07fa50bb175cea81c.tgz",
"integrity": "sha512-gEaOWVUmG9OqmcNXjTJYk/IG7T6As4SGuHc3veCNPnikf41yrkQ86/eS4iIWuCC3z/dv+ejZT7x5PVRhAvuXBw==",
"version": "3.0.0-7c66589b26e57061a07a8d38bfebc2ee05fb1b83",
"resolved": "https://registry.npmjs.org/@alfresco/adf-extensions/-/adf-extensions-3.0.0-7c66589b26e57061a07a8d38bfebc2ee05fb1b83.tgz",
"integrity": "sha512-he7h49WJeEIv2lVNblVDzRvdKoJmvdf33KDpv078r/JAkd7cAbueOtUKJtYSQWsqDs2e041Q2PXJOQz2sfmJew==",
"requires": {
"tslib": "^1.9.0"
}
},
"@alfresco/js-api": {
"version": "3.0.0-e9c8ed80decc71d2fc6833cef22851b64ce4b604",
"resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-3.0.0-e9c8ed80decc71d2fc6833cef22851b64ce4b604.tgz",
"integrity": "sha512-EgCTW+ZOJGvxVUFu5Ul8e0vnW1aITuxTgOKk5AGMFW4JxJoFqEYuo77oqXJITE/1JFsyeuqG63oOjQs2NDjHHw==",
"requires": {
"event-emitter": "0.3.4",
"superagent": "3.8.2"
}
},
"@angular-devkit/architect": {
"version": "0.11.0",
"resolved": "https://registry.npmjs.org/@angular-devkit/architect/-/architect-0.11.0.tgz",
@ -3076,31 +3085,11 @@
"resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.2.0.tgz",
"integrity": "sha1-6GuBnGAs+IIa1jdBNpjx3sAhhHo="
},
"alfresco-js-api": {
"version": "3.0.0-beta7",
"resolved": "https://registry.npmjs.org/alfresco-js-api/-/alfresco-js-api-3.0.0-beta7.tgz",
"integrity": "sha512-gpIi2+zcSkkrccRJDxqFP0HrO525GdylGr3elLysmUQH1NMROWMGjbpcZbmQEsWR0eIunQPPxbvYq2lzwgomog==",
"requires": {
"event-emitter": "0.3.4",
"superagent": "3.8.2"
}
},
"alfresco-js-api-node": {
"version": "3.0.0-beta6",
"resolved": "https://registry.npmjs.org/alfresco-js-api-node/-/alfresco-js-api-node-3.0.0-beta6.tgz",
"integrity": "sha512-tKy+D4feKvtsKb6X/g1SRFmVMBKcJenWCZ6ejPwaQLw1t+jn+iBTnRsrGWJ2bGowhDUIIvB1D+X+Wt/ZbU0R6g==",
"dev": true,
"requires": {
"event-emitter": "0.3.4",
"superagent": "3.8.2"
}
},
"align-text": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz",
"integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=",
"dev": true,
"optional": true,
"requires": {
"kind-of": "^3.0.2",
"longest": "^1.0.1",
@ -5673,9 +5662,9 @@
}
},
"es5-ext": {
"version": "0.10.46",
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.46.tgz",
"integrity": "sha512-24XxRvJXNFwEMpJb3nOkiRJKRoupmjYmOPVlI65Qy2SrtxwOTB+g6ODjBKOtwEHbYrhWRty9xxOWLNdClT2djw==",
"version": "0.10.47",
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.47.tgz",
"integrity": "sha512-/1TItLfj+TTfWoeRcDn/0FbGV6SNo4R+On2GGVucPU/j3BWnXE2Co8h8CTo4Tu34gFJtnmwS9xiScKs4EjZhdw==",
"requires": {
"es6-iterator": "~2.0.3",
"es6-symbol": "~3.1.1",
@ -6444,8 +6433,7 @@
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
"dev": true,
"optional": true
"dev": true
},
"aproba": {
"version": "1.2.0",
@ -6469,15 +6457,13 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
"dev": true,
"optional": true
"dev": true
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -6494,22 +6480,19 @@
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
"dev": true,
"optional": true
"dev": true
},
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true,
"optional": true
"dev": true
},
"console-control-strings": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
"integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=",
"dev": true,
"optional": true
"dev": true
},
"core-util-is": {
"version": "1.0.2",
@ -6640,8 +6623,7 @@
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
"dev": true,
"optional": true
"dev": true
},
"ini": {
"version": "1.3.5",
@ -6655,7 +6637,6 @@
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
"integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@ -6672,7 +6653,6 @@
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@ -6681,15 +6661,13 @@
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
"dev": true,
"optional": true
"dev": true
},
"minipass": {
"version": "2.2.4",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-2.2.4.tgz",
"integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==",
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.1",
"yallist": "^3.0.0"
@ -6710,7 +6688,6 @@
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@ -6799,8 +6776,7 @@
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
"dev": true,
"optional": true
"dev": true
},
"object-assign": {
"version": "4.1.1",
@ -6814,7 +6790,6 @@
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@ -6910,8 +6885,7 @@
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==",
"dev": true,
"optional": true
"dev": true
},
"safer-buffer": {
"version": "2.1.2",
@ -6953,7 +6927,6 @@
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@ -6975,7 +6948,6 @@
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@ -7024,15 +6996,13 @@
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"dev": true,
"optional": true
"dev": true
},
"yallist": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.2.tgz",
"integrity": "sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k=",
"dev": true,
"optional": true
"dev": true
}
}
},
@ -10386,8 +10356,7 @@
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz",
"integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=",
"dev": true,
"optional": true
"dev": true
},
"loose-envify": {
"version": "1.4.0",

View File

@ -32,9 +32,10 @@
},
"private": true,
"dependencies": {
"@alfresco/adf-content-services": "3.0.0-dd25467a98fad2898a2b71d07fa50bb175cea81c",
"@alfresco/adf-core": "3.0.0-dd25467a98fad2898a2b71d07fa50bb175cea81c",
"@alfresco/adf-extensions": "3.0.0-dd25467a98fad2898a2b71d07fa50bb175cea81c",
"@alfresco/adf-content-services": "3.0.0-7c66589b26e57061a07a8d38bfebc2ee05fb1b83",
"@alfresco/adf-core": "3.0.0-7c66589b26e57061a07a8d38bfebc2ee05fb1b83",
"@alfresco/adf-extensions": "3.0.0-7c66589b26e57061a07a8d38bfebc2ee05fb1b83",
"@alfresco/js-api": "3.0.0-e9c8ed80decc71d2fc6833cef22851b64ce4b604",
"@angular/animations": "7.1.4",
"@angular/cdk": "^7.2.0",
"@angular/common": "7.1.4",
@ -55,7 +56,6 @@
"@ngrx/store": "^7.0.0",
"@ngrx/store-devtools": "^7.0.0",
"@ngx-translate/core": "^10.0.2",
"alfresco-js-api": "3.0.0-beta7",
"core-js": "^2.5.7",
"hammerjs": "2.0.8",
"minimatch-browser": "^1.0.0",
@ -75,7 +75,6 @@
"@types/jasminewd2": "^2.0.2",
"@types/node": "9.3.0",
"@types/selenium-webdriver": "^3.0.8",
"alfresco-js-api-node": "3.0.0-beta6",
"chrome-remote-interface": "^0.26.1",
"codelyzer": "^4.5.0",
"cspell": "^3.1.3",

View File

@ -1,104 +1,45 @@
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
eval JS_API=true
eval GNU=false
eval EXEC_COMPONENT=true
eval DIFFERENT_JS_API=false
eval AUTO=false
eval libs=( "core"
"content-services"
"extensions"
#"process-services"
#"insights"
eval libs=( "@alfresco/adf-core"
"@alfresco/adf-content-services"
"@alfresco/adf-extensions"
"@alfresco/js-api"
)
cd ${DIR}/..
prefix="@alfresco/adf-"
show_help() {
echo "Usage: update-version.sh"
echo "Usage: update-version.sh -v latest"
echo ""
echo "-sj or -sjsapi don't update js-api version"
echo "-vj or -versionjsapi to use a different version of js-api"
echo "-v or -version version to update"
echo "-alpha update last alpha version of js-api and lib automatically"
echo "-beta update beta alpha version of js-api and lib automatically"
echo "-v or -version the new version of the libraries, can also be alpha|beta|latest"
echo "-gnu for gnu"
}
skip_js() {
echo "====== Skip JS-API change version $1 ====="
JS_API=false
}
last_alpha_mode() {
echo "====== Auto find last ALPHA version ====="
VERSION=$(npm view @alfresco/adf-core@alpha version)
echo "====== version lib ${VERSION} ====="
DIFFERENT_JS_API=true
VERSION_JS_API=$(npm view alfresco-js-api@alpha version)
echo "====== version js-api ${DIFFERENT_JS_API} ====="
}
last_beta_mode() {
echo "====== Auto find last BETA version ====="
VERSION=$(npm view @alfresco/adf-core@beta version)
echo "====== version lib ${VERSION} ====="
DIFFERENT_JS_API=true
VERSION_JS_API=$(npm view alfresco-js-api@beta version)
echo "====== version js-api ${DIFFERENT_JS_API} ====="
}
gnu_mode() {
echo "====== GNU MODE ====="
set_gnu_mode() {
GNU=true
}
version_change() {
echo "====== New version $1 ====="
set_version() {
VERSION=$1
}
version_js_change() {
echo "====== Alfresco JS-API version $1 ====="
VERSION_JS_API=$1
DIFFERENT_JS_API=true
}
update_component_dependency_version(){
update(){
for (( j=0; j<${libslength}; j++ ));
do
echo "====== UPDATE ${prefix}${libs[$j]} to ${VERSION}======"
EXACT_VERSION="${prefix}${libs[$j]}@${VERSION}"
npm install -E ${EXACT_VERSION}
EXACT_VERSION="${libs[$j]}@${VERSION}"
echo "====== ${EXACT_VERSION} ======"
npm i -E ${EXACT_VERSION}
done
}
update_component_js_version(){
echo "====== UPDATE alfresco-js-api to ${1} ======"
PACKAGETOCHANGE="alfresco-js-api"
EXACT_VERSION="${PACKAGETOCHANGE}@${1}"
npm install -E ${EXACT_VERSION}
}
while [[ $1 == -* ]]; do
case "$1" in
-h|--help|-\?) show_help; exit 0;;
-v|version) version_change $2; shift 2;;
-sj|sjsapi) skip_js; shift;;
-vj|versionjsapi) version_js_change $2; shift 2;;
-gnu) gnu_mode; shift;;
-alpha) last_alpha_mode; shift;;
-beta) last_beta_mode; shift;;
-v|version) set_version $2; shift 2;;
-gnu) set_gnu_mode; shift;;
-*) shift;;
esac
done
@ -111,25 +52,11 @@ fi
if [[ "${VERSION}" == "" ]]
then
echo "Version number required"
echo "Error: version number is required"
exit 1
fi
projectslength=${#projects[@]}
libslength=${#libs[@]}
if $EXEC_COMPONENT == true; then
echo "====== UPDATE ======"
update_component_dependency_version
if $JS_API == true; then
if $DIFFERENT_JS_API == true; then
update_component_js_version ${VERSION_JS_API}
else
update_component_js_version ${VERSION}
fi
fi
fi
echo "====== Updating dependencies ======"
update

View File

@ -50,7 +50,7 @@ import {
} from './store/states/app.state';
import { filter, takeUntil } from 'rxjs/operators';
import { ContentApiService } from './services/content-api.service';
import { DiscoveryEntry } from 'alfresco-js-api';
import { DiscoveryEntry } from '@alfresco/js-api';
import { AppService } from './services/app.service';
import { Subject } from 'rxjs';

View File

@ -25,7 +25,7 @@
import { ExtensionRef } from '@alfresco/adf-extensions';
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { RepositoryInfo } from 'alfresco-js-api';
import { RepositoryInfo } from '@alfresco/js-api';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { AppExtensionService } from '../../extensions/extension.service';

View File

@ -29,7 +29,7 @@ import {
ChangeDetectionStrategy,
Input
} from '@angular/core';
import { ModuleInfo } from 'alfresco-js-api';
import { ModuleInfo } from '@alfresco/js-api';
@Component({
selector: 'app-module-list',

View File

@ -28,7 +28,6 @@ import { CommonModule } from '@angular/common';
import { GenericErrorComponent } from './generic-error/generic-error.component';
import { CoreModule } from '@alfresco/adf-core';
import { LocationLinkComponent } from './location-link/location-link.component';
import { IconComponent } from './icon/icon.component';
import { MatIconModule } from '@angular/material';
import { ExtensionsModule } from '@alfresco/adf-extensions';
@ -39,13 +38,8 @@ import { ExtensionsModule } from '@alfresco/adf-extensions';
MatIconModule,
ExtensionsModule
],
declarations: [GenericErrorComponent, LocationLinkComponent, IconComponent],
exports: [
ExtensionsModule,
GenericErrorComponent,
LocationLinkComponent,
IconComponent
],
declarations: [GenericErrorComponent, LocationLinkComponent],
exports: [ExtensionsModule, GenericErrorComponent, LocationLinkComponent],
entryComponents: [LocationLinkComponent]
})
export class AppCommonModule {}

View File

@ -1,7 +0,0 @@
<ng-container *ngIf="isCustom; else default">
<mat-icon [svgIcon]="value"></mat-icon>
</ng-container>
<ng-template #default>
<mat-icon>{{ value }}</mat-icon>
</ng-template>

View File

@ -1,4 +0,0 @@
.adf-icon {
display: inline-flex;
vertical-align: middle;
}

View File

@ -1,58 +0,0 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 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 {
Component,
Input,
ViewEncapsulation,
ChangeDetectionStrategy
} from '@angular/core';
@Component({
selector: 'adf-icon',
templateUrl: './icon.component.html',
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
host: { class: 'adf-icon' },
styleUrls: ['./icon.component.scss']
})
export class IconComponent {
private _value = '';
private _isCustom = false;
get value(): string {
return this._value;
}
@Input()
set value(value: string) {
this._value = value || 'settings';
this._isCustom = this._value.includes(':');
}
get isCustom(): boolean {
return this._isCustom;
}
}

View File

@ -31,7 +31,7 @@ import {
ViewEncapsulation,
HostListener
} from '@angular/core';
import { PathInfo, MinimalNodeEntity } from 'alfresco-js-api';
import { PathInfo, MinimalNodeEntity } from '@alfresco/js-api';
import { Observable, BehaviorSubject, of } from 'rxjs';
import { Store } from '@ngrx/store';

View File

@ -146,7 +146,7 @@ describe('FavoriteLibrariesComponent', () => {
it('does not navigate when id is not passed', () => {
spyOn(router, 'navigate').and.stub();
component.navigateTo({ entry: { guid: 'guid' } });
component.navigateTo(<any>{ entry: { guid: 'guid' } });
expect(router.navigate).toHaveBeenCalledWith(['libraries', 'libraryId']);
});

View File

@ -26,7 +26,7 @@
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
import { Component, OnInit } from '@angular/core';
import { Store } from '@ngrx/store';
import { SiteEntry, FavoritePaging, Pagination } from 'alfresco-js-api';
import { SiteEntry, FavoritePaging, Pagination } from '@alfresco/js-api';
import { AppExtensionService } from '../../extensions/extension.service';
import { ContentManagementService } from '../../services/content-management.service';
import { ContentApiService } from '../../services/content-api.service';

View File

@ -32,7 +32,7 @@ import {
MinimalNodeEntryEntity,
PathElementEntity,
PathInfo
} from 'alfresco-js-api';
} from '@alfresco/js-api';
import { ContentManagementService } from '../../services/content-management.service';
import { AppStore } from '../../store/states/app.state';
import { PageComponent } from '../page.component';

View File

@ -20,7 +20,7 @@
<app-page-layout-content>
<div class="main-content">
<adf-upload-drag-area [parentId]="node?.id" [disabled]="!canUpload">
<adf-upload-drag-area [rootFolderId]="node?.id" [disabled]="!canUpload">
<adf-document-list
#documentList
acaDocumentList

View File

@ -154,11 +154,11 @@ describe('FilesComponent', () => {
it('should call refresh onContentCopied event if parent is the same', () => {
const nodes = [
{ entry: { parentId: '1' } },
{ entry: { parentId: '2' } }
<any>{ entry: { parentId: '1' } },
<any>{ entry: { parentId: '2' } }
];
component.node = { id: '1' };
component.node = <any>{ id: '1' };
nodeActionsService.contentCopied.next(nodes);
@ -167,11 +167,11 @@ describe('FilesComponent', () => {
it('should not call refresh onContentCopied event when parent mismatch', () => {
const nodes = [
{ entry: { parentId: '1' } },
{ entry: { parentId: '2' } }
<any>{ entry: { parentId: '1' } },
<any>{ entry: { parentId: '2' } }
];
component.node = { id: '3' };
component.node = <any>{ id: '3' };
nodeActionsService.contentCopied.next(nodes);
@ -210,7 +210,7 @@ describe('FilesComponent', () => {
it('should call refresh on fileUploadComplete event if parent node match', fakeAsync(() => {
const file = { file: { options: { parentId: 'parentId' } } };
component.node = { id: 'parentId' };
component.node = <any>{ id: 'parentId' };
uploadService.fileUploadComplete.next(<any>file);
@ -221,7 +221,7 @@ describe('FilesComponent', () => {
it('should not call refresh on fileUploadComplete event if parent mismatch', fakeAsync(() => {
const file = { file: { options: { parentId: 'otherId' } } };
component.node = { id: 'parentId' };
component.node = <any>{ id: 'parentId' };
uploadService.fileUploadComplete.next(<any>file);
@ -232,7 +232,7 @@ describe('FilesComponent', () => {
it('should call refresh on fileUploadDeleted event if parent node match', fakeAsync(() => {
const file = { file: { options: { parentId: 'parentId' } } };
component.node = { id: 'parentId' };
component.node = <any>{ id: 'parentId' };
uploadService.fileUploadDeleted.next(<any>file);
@ -243,7 +243,7 @@ describe('FilesComponent', () => {
it('should not call refresh on fileUploadDeleted event if parent mismatch', fakeAsync(() => {
const file: any = { file: { options: { parentId: 'otherId' } } };
component.node = { id: 'parentId' };
component.node = <any>{ id: 'parentId' };
uploadService.fileUploadDeleted.next(file);
@ -293,7 +293,7 @@ describe('FilesComponent', () => {
});
it('should navigate home if node is root', () => {
component.node = {
component.node = <any>{
path: {
elements: [{ id: 'node-id' }]
}
@ -307,19 +307,19 @@ describe('FilesComponent', () => {
describe('isSiteContainer', () => {
it('should return false if node has no aspectNames', () => {
const mock = { aspectNames: [] };
const mock = <any>{ aspectNames: [] };
expect(component.isSiteContainer(mock)).toBe(false);
});
it('should return false if node is not site container', () => {
const mock = { aspectNames: ['something-else'] };
const mock = <any>{ aspectNames: ['something-else'] };
expect(component.isSiteContainer(mock)).toBe(false);
});
it('should return true if node is a site container', () => {
const mock = { aspectNames: ['st:siteContainer'] };
const mock = <any>{ aspectNames: ['st:siteContainer'] };
expect(component.isSiteContainer(mock)).toBe(true);
});

View File

@ -32,7 +32,7 @@ import {
MinimalNodeEntryEntity,
PathElement,
PathElementEntity
} from 'alfresco-js-api';
} from '@alfresco/js-api';
import { ContentManagementService } from '../../services/content-management.service';
import { NodeActionsService } from '../../services/node-actions.service';
import { AppStore } from '../../store/states/app.state';

View File

@ -24,7 +24,7 @@
*/
import { Component, Input } from '@angular/core';
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
import { MinimalNodeEntryEntity } from '@alfresco/js-api';
import { NodePermissionService } from '../../../services/node-permission.service';
@Component({

View File

@ -83,7 +83,7 @@ describe('InfoDrawerComponent', () => {
it('should set displayNode when node is from personal list', () => {
spyOn(contentApiService, 'getNodeInfo');
const nodeMock = { entry: { id: 'nodeId' } };
const nodeMock = <any>{ entry: { id: 'nodeId' } };
component.node = nodeMock;
fixture.detectChanges();
@ -109,9 +109,9 @@ describe('InfoDrawerComponent', () => {
}));
it('should call getNodeInfo() when node is a shared file', async(() => {
const response = { entry: { id: 'nodeId' } };
const response = <any>{ entry: { id: 'nodeId' } };
spyOn(contentApiService, 'getNodeInfo').and.returnValue(of(response));
const nodeMock = { entry: { nodeId: 'nodeId' }, isLibrary: false };
const nodeMock = <any>{ entry: { nodeId: 'nodeId' }, isLibrary: false };
component.node = nodeMock;
fixture.detectChanges();
@ -122,7 +122,7 @@ describe('InfoDrawerComponent', () => {
}));
it('should call getNodeInfo() when node is a favorite file', async(() => {
const response = { entry: { id: 'nodeId' } };
const response = <any>{ entry: { id: 'nodeId' } };
spyOn(contentApiService, 'getNodeInfo').and.returnValue(of(response));
const nodeMock = <any>{
entry: { id: 'nodeId', guid: 'guidId' },
@ -138,7 +138,7 @@ describe('InfoDrawerComponent', () => {
}));
it('should call getNodeInfo() when node is a recent file', async(() => {
const response = { entry: { id: 'nodeId' } };
const response = <any>{ entry: { id: 'nodeId' } };
spyOn(contentApiService, 'getNodeInfo').and.returnValue(of(response));
const nodeMock = <any>{
entry: {

View File

@ -28,7 +28,7 @@ import {
MinimalNodeEntity,
MinimalNodeEntryEntity,
SiteEntry
} from 'alfresco-js-api';
} from '@alfresco/js-api';
import { ContentApiService } from '../../services/content-api.service';
import { AppExtensionService } from '../../extensions/extension.service';
import { SidebarTabRef } from '@alfresco/adf-extensions';
@ -66,7 +66,7 @@ export class InfoDrawerComponent implements OnChanges, OnInit, OnDestroy {
ngOnChanges() {
if (this.node) {
const entry = this.node.entry;
const entry: any = this.node.entry;
if (this.isLibraryListNode(this.node)) {
return this.setDisplayNode(this.node);
@ -113,19 +113,19 @@ export class InfoDrawerComponent implements OnChanges, OnInit, OnDestroy {
}
}
private setDisplayNode(node: MinimalNodeEntryEntity | SiteEntry) {
private setDisplayNode(node: any) {
this.displayNode = node;
}
private isLibraryListNode(node: SiteEntry): boolean {
return (<any>node).isLibrary;
private isLibraryListNode(node: any): boolean {
return node.isLibrary;
}
private isFavoriteListNode(node: MinimalNodeEntity): boolean {
return !this.isLibraryListNode(node) && (<any>node).entry.guid;
}
private isSharedFilesNode(node: MinimalNodeEntity): boolean {
private isSharedFilesNode(node: any): boolean {
return !!node.entry.nodeId;
}

View File

@ -33,7 +33,7 @@ import { Store } from '@ngrx/store';
import { UpdateLibraryAction } from '../../../store/actions';
import { AppTestingModule } from '../../../testing/app-testing.module';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { Site, SiteBody } from 'alfresco-js-api';
import { Site, SiteBody } from '@alfresco/js-api';
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-core';
describe('LibraryMetadataFormComponent', () => {

View File

@ -25,7 +25,7 @@
import { Component, Input, OnInit, OnChanges, OnDestroy } from '@angular/core';
import { FormGroup, FormControl, Validators } from '@angular/forms';
import { SiteEntry, SitePaging } from 'alfresco-js-api';
import { SiteEntry, SitePaging } from '@alfresco/js-api';
import { Store } from '@ngrx/store';
import { UpdateLibraryAction } from '../../../store/actions';
import { AppStore } from '../../../store/states/app.state';
@ -138,7 +138,9 @@ export class LibraryMetadataFormComponent
});
}
private findLibraryByTitle(libraryTitle: string): Observable<SitePaging> {
private findLibraryByTitle(
libraryTitle: string
): Observable<SitePaging | { list: { entries: any[] } }> {
return from(
this.alfrescoApiService
.getInstance()

View File

@ -24,7 +24,7 @@
*/
import { Component, Input } from '@angular/core';
import { SiteEntry } from 'alfresco-js-api';
import { SiteEntry } from '@alfresco/js-api';
@Component({
selector: 'app-metadata-tab',

View File

@ -24,7 +24,7 @@
*/
import { Component, Input, ViewEncapsulation } from '@angular/core';
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
import { MinimalNodeEntryEntity } from '@alfresco/js-api';
import { NodePermissionService } from '../../../services/node-permission.service';
import { AppExtensionService } from '../../../extensions/extension.service';
import { AppConfigService } from '@alfresco/adf-core';

View File

@ -24,7 +24,7 @@
*/
import { Component, Input, OnChanges, OnInit } from '@angular/core';
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
import { MinimalNodeEntryEntity } from '@alfresco/js-api';
@Component({
selector: 'app-versions-tab',
@ -65,7 +65,7 @@ export class VersionsTabComponent implements OnInit, OnChanges {
}
private updateState() {
if (this.node && this.node.nodeId) {
if (this.node && (<any>this.node).nodeId) {
// workaround for shared files type.
this.isFileSelected = true;
} else {

View File

@ -1,4 +1,4 @@
<adf-upload-drag-area [parentId]="currentFolderId" [disabled]="!canUpload">
<adf-upload-drag-area [rootFolderId]="currentFolderId" [disabled]="!canUpload">
<adf-sidenav-layout
#layout
[sidenavMin]="70"
@ -29,5 +29,5 @@
</adf-sidenav-layout-content>
</adf-sidenav-layout>
<app-file-uploading-dialog position="left"></app-file-uploading-dialog>
<adf-file-uploading-dialog position="left"></adf-file-uploading-dialog>
</adf-upload-drag-area>

View File

@ -140,7 +140,7 @@ describe('AppLayoutComponent', () => {
it('should reset selection before navigation', done => {
fixture.detectChanges();
const selection = [{ entry: { id: 'nodeId', name: 'name' } }];
const selection = [<any>{ entry: { id: 'nodeId', name: 'name' } }];
store.dispatch(new SetSelectedNodesAction(selection));
router.navigateByUrl('somewhere/over/the/rainbow');
@ -153,7 +153,7 @@ describe('AppLayoutComponent', () => {
it('should not reset selection if route is `/search`', done => {
fixture.detectChanges();
const selection = [{ entry: { id: 'nodeId', name: 'name' } }];
const selection = [<any>{ entry: { id: 'nodeId', name: 'name' } }];
store.dispatch(new SetSelectedNodesAction(selection));
router.navigateByUrl('/search;q=');

View File

@ -32,7 +32,6 @@ import { RouterModule } from '@angular/router';
import { AppSidenavModule } from '../sidenav/sidenav.module';
import { AppCommonModule } from '../common/common.module';
import { AppHeaderModule } from '../header/header.module';
import { AppUploadingDialogModule } from '../upload-dialog/upload-dialog.module';
import { PageLayoutComponent } from './page-layout/page-layout.component';
import { PageLayoutHeaderComponent } from './page-layout/page-layout-header.component';
import { PageLayoutContentComponent } from './page-layout/page-layout-content.component';
@ -48,8 +47,7 @@ import { HttpClientModule } from '@angular/common/http';
AppCommonModule,
AppSidenavModule,
AppHeaderModule,
HttpClientModule,
AppUploadingDialogModule
HttpClientModule
],
declarations: [
AppLayoutComponent,

View File

@ -26,7 +26,7 @@
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
import { Component, OnInit } from '@angular/core';
import { Store } from '@ngrx/store';
import { SiteEntry } from 'alfresco-js-api';
import { SiteEntry } from '@alfresco/js-api';
import { AppExtensionService } from '../../extensions/extension.service';
import { ContentManagementService } from '../../services/content-management.service';
import { NavigateLibraryAction } from '../../store/actions';

View File

@ -30,7 +30,7 @@ import {
import { ContentActionRef, SelectionState } from '@alfresco/adf-extensions';
import { OnDestroy, OnInit, ViewChild } from '@angular/core';
import { Store } from '@ngrx/store';
import { MinimalNodeEntity, MinimalNodeEntryEntity } from 'alfresco-js-api';
import { MinimalNodeEntity, MinimalNodeEntryEntity } from '@alfresco/js-api';
import { Observable, Subject, Subscription } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { AppExtensionService } from '../extensions/extension.service';

View File

@ -30,7 +30,7 @@ import {
import { Component, Input, OnInit, ViewChild } from '@angular/core';
import { MatDialog } from '@angular/material';
import { Store } from '@ngrx/store';
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
import { MinimalNodeEntryEntity } from '@alfresco/js-api';
import { ContentApiService } from '../../../services/content-api.service';
import { SnackbarErrorAction } from '../../../store/actions/snackbar.actions';
import { AppStore } from '../../../store/states/app.state';

View File

@ -35,7 +35,7 @@ import {
OnChanges
} from '@angular/core';
import { AppExtensionService } from '../../extensions/extension.service';
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
import { MinimalNodeEntryEntity } from '@alfresco/js-api';
@Component({
selector: 'app-preview-extension',

View File

@ -1,8 +1,8 @@
<ng-container *ngIf="nodeId">
<adf-viewer
[fileNodeId]="nodeId"
[nodeId]="nodeId"
[allowNavigate]="navigateMultiple"
[allowSidebar]="hasRightSidebar"
[allowRightSidebar]="hasRightSidebar"
[allowPrint]="false"
[allowDownload]="false"
[allowFullScreen]="false"

View File

@ -47,7 +47,7 @@ import { ContentApiService } from '../../services/content-api.service';
import { AppExtensionService } from '../../extensions/extension.service';
import { ContentManagementService } from '../../services/content-management.service';
import { ContentActionRef, ViewerExtensionRef } from '@alfresco/adf-extensions';
import { SearchRequest } from 'alfresco-js-api';
import { SearchRequest } from '@alfresco/js-api';
import { AppDataService } from '../../services/data.service';
@Component({

View File

@ -25,7 +25,7 @@
import { Component, OnInit } from '@angular/core';
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
import { MinimalNodeEntity } from 'alfresco-js-api';
import { MinimalNodeEntity } from '@alfresco/js-api';
import { ContentManagementService } from '../../services/content-management.service';
import { PageComponent } from '../page.component';
import { Store } from '@ngrx/store';

View File

@ -25,7 +25,7 @@
import { AlfrescoApiService } from '@alfresco/adf-core';
import { Injectable } from '@angular/core';
import { SitePaging } from 'alfresco-js-api';
import { SitePaging } from '@alfresco/js-api';
import { Subject } from 'rxjs';
@Injectable({

View File

@ -24,7 +24,7 @@
*/
import { Component, OnInit } from '@angular/core';
import { NodePaging, Pagination, SiteEntry } from 'alfresco-js-api';
import { NodePaging, Pagination, SiteEntry } from '@alfresco/js-api';
import { ActivatedRoute, Params } from '@angular/router';
import { PageComponent } from '../../page.component';
import { Store } from '@ngrx/store';

View File

@ -30,7 +30,7 @@ import {
ViewEncapsulation,
ChangeDetectionStrategy
} from '@angular/core';
import { MinimalNodeEntity } from 'alfresco-js-api';
import { MinimalNodeEntity } from '@alfresco/js-api';
import { ViewFileAction } from '../../../store/actions';
import { Store } from '@ngrx/store';
import { AppStore } from '../../../store/states/app.state';

View File

@ -24,7 +24,7 @@
*/
import { Component, OnInit, ViewChild } from '@angular/core';
import { NodePaging, Pagination, MinimalNodeEntity } from 'alfresco-js-api';
import { NodePaging, Pagination, MinimalNodeEntity } from '@alfresco/js-api';
import { ActivatedRoute, Params } from '@angular/router';
import {
SearchQueryBuilderService,

View File

@ -24,11 +24,7 @@
*/
import { Component, ViewEncapsulation, OnInit } from '@angular/core';
import {
AppConfigService,
StorageService,
SettingsService
} from '@alfresco/adf-core';
import { AppConfigService, StorageService } from '@alfresco/adf-core';
import { Validators, FormGroup, FormBuilder } from '@angular/forms';
import { Observable } from 'rxjs';
import { Store } from '@ngrx/store';
@ -63,7 +59,6 @@ export class SettingsComponent implements OnInit {
constructor(
private store: Store<AppStore>,
private appConfig: AppConfigService,
private settingsService: SettingsService,
private storage: StorageService,
private fb: FormBuilder
) {
@ -106,7 +101,8 @@ export class SettingsComponent implements OnInit {
reset() {
this.form.reset({
ecmHost: this.storage.getItem('ecmHost') || this.settingsService.ecmHost
ecmHost:
this.storage.getItem('ecmHost') || this.appConfig.get<string>('ecmHost')
});
}

View File

@ -36,7 +36,7 @@ import {
distinctUntilChanged
} from 'rxjs/operators';
import { SharedLinksApiService, NodesApiService } from '@alfresco/adf-core';
import { SharedLinkEntry, MinimalNodeEntryEntity } from 'alfresco-js-api';
import { SharedLinkEntry, MinimalNodeEntryEntity } from '@alfresco/js-api';
import { ConfirmDialogComponent } from '@alfresco/adf-content-services';
import * as moment from 'moment';

View File

@ -1,134 +0,0 @@
<div
*ngIf="isDialogActive"
class="adf-upload-dialog"
id="upload-dialog"
[class.adf-upload-dialog--minimized]="isDialogMinimized"
[class.adf-upload-dialog--position-left]="position === 'left'"
[class.adf-upload-dialog--position-right]="position === 'right'"
>
<header class="adf-upload-dialog__header">
<button
mat-button
color="secondary"
[disabled]="isConfirmation"
(click)="toggleMinimized()"
>
<mat-icon
mat-list-icon
title="{{
(isDialogMinimized
? 'ADF_FILE_UPLOAD.BUTTON.MAXIMIZE'
: 'ADF_FILE_UPLOAD.BUTTON.MINIMIZE') | translate
}}"
>
{{ isDialogMinimized ? 'keyboard_arrow_up' : 'keyboard_arrow_down' }}
</mat-icon>
</button>
<span
class="adf-upload-dialog__title"
*ngIf="!uploadList.isUploadCancelled()"
>
{{
'FILE_UPLOAD.MESSAGES.UPLOAD_COMPLETED'
| translate
: {
completed: totalCompleted,
total: filesUploadingList.length
}
}}
</span>
<span
class="adf-upload-dialog__title"
*ngIf="uploadList.isUploadCancelled()"
>
{{ 'FILE_UPLOAD.MESSAGES.UPLOAD_CANCELED' | translate }}
</span>
</header>
<section class="adf-upload-dialog__info" *ngIf="totalErrors">
{{
(totalErrors > 1
? 'FILE_UPLOAD.MESSAGES.UPLOAD_ERRORS'
: 'FILE_UPLOAD.MESSAGES.UPLOAD_ERROR')
| translate: { total: totalErrors }
}}
</section>
<section
class="adf-upload-dialog__content"
[class.adf-upload-dialog--padding]="isConfirmation"
>
<app-file-uploading-list
[class.adf-upload-dialog--hide]="isConfirmation"
#uploadList
[files]="filesUploadingList"
>
<ng-template let-file="$implicit">
<app-file-uploading-list-row
[file]="file"
[error]="getFileUploadError(file)"
(remove)="uploadList.removeFile(file)"
(cancel)="uploadList.cancelFile(file)"
>
</app-file-uploading-list-row>
</ng-template>
</app-file-uploading-list>
<div
class="adf-upload-dialog__confirmation"
[class.adf-upload-dialog--hide]="!isConfirmation"
>
<p class="adf-upload-dialog__confirmation--title">
{{ 'ADF_FILE_UPLOAD.CONFIRMATION.MESSAGE.TITLE' | translate }}
</p>
<p class="adf-upload-dialog__confirmation--text">
{{ 'ADF_FILE_UPLOAD.CONFIRMATION.MESSAGE.TEXT' | translate }}
</p>
</div>
</section>
<footer class="adf-upload-dialog__actions" *ngIf="!isConfirmation">
<button
id="adf-upload-dialog-cancel-all"
color="primary"
mat-button
*ngIf="!uploadList.isUploadCompleted() && !uploadList.isUploadCancelled()"
(click)="toggleConfirmation()"
>
{{ 'ADF_FILE_UPLOAD.BUTTON.CANCEL_ALL' | translate }}
</button>
<button
id="adf-upload-dialog-close"
*ngIf="uploadList.isUploadCompleted() || uploadList.isUploadCancelled()"
mat-button
color="primary"
(click)="close()"
>
{{ 'ADF_FILE_UPLOAD.BUTTON.CLOSE' | translate }}
</button>
</footer>
<footer class="adf-upload-dialog__actions" *ngIf="isConfirmation">
<button
id="adf-upload-dialog-cancel"
color="secondary"
mat-button
(click)="cancelAllUploads()"
>
{{ 'ADF_FILE_UPLOAD.CONFIRMATION.BUTTON.CANCEL' | translate }}
</button>
<button
id="adf-upload-dialog-confirm"
mat-button
color="primary"
(click)="toggleConfirmation()"
>
{{ 'ADF_FILE_UPLOAD.CONFIRMATION.BUTTON.CONTINUE' | translate }}
</button>
</footer>
</div>

View File

@ -1,195 +0,0 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
FileModel,
FileUploadCompleteEvent,
FileUploadDeleteEvent,
FileUploadErrorEvent,
FileUploadStatus,
UploadService
} from '@alfresco/adf-core';
import {
ChangeDetectorRef,
Component,
Input,
Output,
EventEmitter,
OnDestroy,
OnInit,
ViewChild
} from '@angular/core';
import { Subscription, merge } from 'rxjs';
import { FileUploadingListComponent } from './file-uploading-list.component';
// @deprecated file-uploading-dialog TODO remove in 3.0.0
@Component({
selector: 'app-file-uploading-dialog',
templateUrl: './file-uploading-dialog.component.html'
})
export class FileUploadingDialogComponent implements OnInit, OnDestroy {
@ViewChild('uploadList')
uploadList: FileUploadingListComponent;
/** Dialog position. Can be 'left' or 'right'. */
@Input()
position = 'right';
/** Emitted when a file in the list has an error. */
@Output()
error: EventEmitter<any> = new EventEmitter();
filesUploadingList: FileModel[] = [];
isDialogActive = false;
totalCompleted = 0;
totalErrors = 0;
isDialogMinimized = false;
isConfirmation = false;
private listSubscription: Subscription;
private counterSubscription: Subscription;
private fileUploadSubscription: Subscription;
private errorSubscription: Subscription;
private errors = [];
constructor(
private uploadService: UploadService,
private changeDetector: ChangeDetectorRef
) {}
ngOnInit() {
this.listSubscription = this.uploadService.queueChanged.subscribe(
(fileList: FileModel[]) => {
this.filesUploadingList = fileList;
if (this.filesUploadingList.length) {
this.isDialogActive = true;
}
}
);
this.counterSubscription = merge(
this.uploadService.fileUploadComplete,
this.uploadService.fileUploadDeleted
).subscribe((event: FileUploadDeleteEvent | FileUploadCompleteEvent) => {
this.totalCompleted = event.totalComplete;
this.changeDetector.detectChanges();
});
// todo: move to ADF ACA-2051
this.errorSubscription = this.uploadService.fileUploadError.subscribe(
(event: FileUploadErrorEvent) => {
const statusCode = (event.error || {}).response
? event.error.response.statusCode
: null;
this.errors.push({
fileName: event.file.name,
status: statusCode,
message: this.getUploadErrorMessage(statusCode)
});
this.totalErrors = event.totalError;
this.changeDetector.detectChanges();
}
);
this.fileUploadSubscription = this.uploadService.fileUpload.subscribe(
event => {
this.changeDetector.detectChanges();
}
);
this.uploadService.fileDeleted.subscribe(objId => {
if (this.filesUploadingList) {
const file = this.filesUploadingList.find(item => {
return item.data.entry.id === objId;
});
if (file) {
file.status = FileUploadStatus.Cancelled;
this.changeDetector.detectChanges();
}
}
});
}
getFileUploadError(file) {
return this.errors.find(error => (error.fileName = file.name));
}
/**
* Toggle confirmation message.
*/
toggleConfirmation() {
this.isConfirmation = !this.isConfirmation;
if (this.isDialogMinimized) {
this.isDialogMinimized = false;
}
}
/**
* Cancel uploads and hide confirmation
*/
cancelAllUploads() {
this.toggleConfirmation();
this.uploadList.cancelAllFiles();
}
/**
* Toggle dialog minimized state.
*/
toggleMinimized(): void {
this.isDialogMinimized = !this.isDialogMinimized;
this.changeDetector.detectChanges();
}
/**
* Dismiss dialog
*/
close(): void {
this.isConfirmation = false;
this.totalCompleted = 0;
this.totalErrors = 0;
this.filesUploadingList = [];
this.isDialogActive = false;
this.isDialogMinimized = false;
this.uploadService.clearQueue();
this.changeDetector.detectChanges();
this.errors = [];
}
ngOnDestroy() {
this.uploadService.clearQueue();
this.listSubscription.unsubscribe();
this.counterSubscription.unsubscribe();
this.fileUploadSubscription.unsubscribe();
this.errorSubscription.unsubscribe();
}
// todo: move to ADF ACA-2051
private getUploadErrorMessage(status) {
const messages = {
500: 'APP.MESSAGES.UPLOAD.ERROR.500',
504: 'APP.MESSAGES.UPLOAD.ERROR.504',
403: 'APP.MESSAGES.UPLOAD.ERROR.403',
404: 'APP.MESSAGES.UPLOAD.ERROR.404',
generic: 'APP.MESSAGES.UPLOAD.ERROR.GENERIC'
};
return messages[status] || messages['generic'];
}
}

View File

@ -1,94 +0,0 @@
<div class="adf-file-uploading-row">
<mat-icon mat-list-icon class="adf-file-uploading-row__type">
insert_drive_file
</mat-icon>
<span class="adf-file-uploading-row__name" title="{{ file.name }}">
{{ file.name }}
</span>
<div
*ngIf="
file.status === FileUploadStatus.Progress ||
file.status === FileUploadStatus.Starting
"
(click)="onCancel(file)"
class="adf-file-uploading-row__group adf-file-uploading-row__group--toggle"
title="{{ 'ADF_FILE_UPLOAD.BUTTON.CANCEL_FILE' | translate }}"
>
<span class="adf-file-uploading-row__status">
{{ file.progress.loaded | adfFileSize }} /
{{ file.progress.total | adfFileSize }}
</span>
<mat-icon
mat-list-icon
class="adf-file-uploading-row__action adf-file-uploading-row__action--cancel"
>
clear
</mat-icon>
</div>
<div
*ngIf="file.status === FileUploadStatus.Complete"
(click)="onRemove(file)"
class="adf-file-uploading-row__group adf-file-uploading-row__group--toggle"
title="{{ 'ADF_FILE_UPLOAD.BUTTON.REMOVE_FILE' | translate }}"
>
<mat-icon
mat-list-icon
class="adf-file-uploading-row__status adf-file-uploading-row__status--done"
>
check_circle
</mat-icon>
<mat-icon
mat-list-icon
class="adf-file-uploading-row__action adf-file-uploading-row__action--remove"
>
remove_circle
</mat-icon>
</div>
<div
*ngIf="file.status === FileUploadStatus.Pending"
(click)="onCancel(file)"
class="adf-file-uploading-row__group adf-file-uploading-row__group--toggle"
>
<mat-icon
mat-list-icon
class="adf-file-uploading-row__status adf-file-uploading-row__status--pending"
>
schedule
</mat-icon>
<mat-icon
mat-list-icon
class="adf-file-uploading-row__action adf-file-uploading-row__action--remove"
>
remove_circle
</mat-icon>
</div>
<!--todo: move to ADF ACA-2051 -->
<div
*ngIf="file.status === FileUploadStatus.Error"
class="adf-file-uploading-row__block adf-file-uploading-row__status--error"
>
<mat-icon mat-list-icon [attr.title]="error?.message | translate">
report_problem
</mat-icon>
</div>
<div
*ngIf="
file.status === FileUploadStatus.Cancelled ||
file.status === FileUploadStatus.Aborted ||
file.status === FileUploadStatus.Deleted
"
class="adf-file-uploading-row__block adf-file-uploading-row__status--cancelled"
>
{{ 'ADF_FILE_UPLOAD.STATUS.FILE_CANCELED_STATUS' | translate }}
</div>
<div></div>
</div>

View File

@ -1,47 +0,0 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FileModel, FileUploadStatus } from '@alfresco/adf-core';
import { Component, EventEmitter, Input, Output } from '@angular/core';
@Component({
selector: 'app-file-uploading-list-row',
templateUrl: './file-uploading-list-row.component.html'
})
export class FileUploadingListRowComponent {
@Input()
file: FileModel;
@Input()
error: any;
@Output()
cancel: EventEmitter<FileModel> = new EventEmitter<FileModel>();
@Output()
remove: EventEmitter<FileModel> = new EventEmitter<FileModel>();
FileUploadStatus = FileUploadStatus;
onCancel(file: FileModel): void {
this.cancel.emit(file);
}
onRemove(file: FileModel): void {
this.remove.emit(file);
}
}

View File

@ -1,4 +0,0 @@
<div class="upload-list">
<ng-template ngFor [ngForOf]="files" [ngForTemplate]="template">
</ng-template>
</div>

View File

@ -1,180 +0,0 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
FileModel,
FileUploadStatus,
NodesApiService,
TranslationService,
UploadService
} from '@alfresco/adf-core';
import {
Component,
ContentChild,
Input,
Output,
TemplateRef,
EventEmitter
} from '@angular/core';
import { Observable, forkJoin, of } from 'rxjs';
import { map, catchError } from 'rxjs/operators';
@Component({
selector: 'app-file-uploading-list',
templateUrl: './file-uploading-list.component.html'
})
export class FileUploadingListComponent {
FileUploadStatus = FileUploadStatus;
@ContentChild(TemplateRef)
template: any;
@Input()
files: FileModel[] = [];
/** Emitted when a file in the list has an error. */
@Output()
error: EventEmitter<any> = new EventEmitter();
constructor(
private uploadService: UploadService,
private nodesApi: NodesApiService,
private translateService: TranslationService
) {}
/**
* Cancel file upload
*
* @param file File model to cancel upload for.
*
* @memberOf FileUploadingListComponent
*/
cancelFile(file: FileModel): void {
this.uploadService.cancelUpload(file);
}
removeFile(file: FileModel): void {
this.deleteNode(file).subscribe(() => {
if (file.status === FileUploadStatus.Error) {
this.notifyError(file);
}
this.uploadService.cancelUpload(file);
});
}
/**
* Call the appropriate method for each file, depending on state
*/
cancelAllFiles(): void {
this.getUploadingFiles().forEach(file =>
this.uploadService.cancelUpload(file)
);
const deletedFiles = this.files
.filter(file => file.status === FileUploadStatus.Complete)
.map(file => this.deleteNode(file));
forkJoin(...deletedFiles).subscribe((files: FileModel[]) => {
const errors = files.filter(
file => file.status === FileUploadStatus.Error
);
if (errors.length) {
this.notifyError(...errors);
}
this.uploadService.cancelUpload(...files);
});
}
/**
* Checks if all the files are uploaded false if there is at least one file in Progress | Starting | Pending
*/
isUploadCompleted(): boolean {
return (
!this.isUploadCancelled() &&
Boolean(this.files.length) &&
!this.files.some(
({ status }) =>
status === FileUploadStatus.Starting ||
status === FileUploadStatus.Progress ||
status === FileUploadStatus.Pending
)
);
}
/**
* Check if all the files are Cancelled | Aborted | Error. false if there is at least one file in uploading states
*/
isUploadCancelled(): boolean {
return (
!!this.files.length &&
this.files.every(
({ status }) =>
status === FileUploadStatus.Aborted ||
status === FileUploadStatus.Cancelled ||
status === FileUploadStatus.Deleted
)
);
}
private deleteNode(file: FileModel): Observable<FileModel> {
const { id } = file.data.entry;
return this.nodesApi.deleteNode(id, { permanent: true }).pipe(
map(() => {
file.status = FileUploadStatus.Deleted;
return file;
}),
catchError(() => {
file.status = FileUploadStatus.Error;
return of(file);
})
);
}
private notifyError(...files: FileModel[]) {
let messageError: string = null;
if (files.length === 1) {
messageError = this.translateService.instant(
'FILE_UPLOAD.MESSAGES.REMOVE_FILE_ERROR',
{ fileName: files[0].name }
);
} else {
messageError = this.translateService.instant(
'FILE_UPLOAD.MESSAGES.REMOVE_FILES_ERROR',
{ total: files.length }
);
}
this.error.emit(messageError);
}
private getUploadingFiles() {
return this.files.filter(item => {
if (
item.status === FileUploadStatus.Pending ||
item.status === FileUploadStatus.Progress ||
item.status === FileUploadStatus.Starting
) {
return item;
}
});
}
}

View File

@ -1,46 +0,0 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 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 { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { CoreModule } from '@alfresco/adf-core';
import { FileUploadingDialogComponent } from './file-uploading-dialog.component';
import { FileUploadingListRowComponent } from './file-uploading-list-row.component';
import { FileUploadingListComponent } from './file-uploading-list.component';
@NgModule({
imports: [CommonModule, CoreModule.forChild()],
declarations: [
FileUploadingDialogComponent,
FileUploadingListRowComponent,
FileUploadingListComponent
],
exports: [
FileUploadingDialogComponent,
FileUploadingListRowComponent,
FileUploadingListComponent
]
})
export class AppUploadingDialogModule {}

View File

@ -25,7 +25,7 @@
import { Component, Inject, ViewEncapsulation } from '@angular/core';
import { MAT_DIALOG_DATA } from '@angular/material';
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
import { MinimalNodeEntryEntity } from '@alfresco/js-api';
import { Store } from '@ngrx/store';
import { AppStore } from '../../store/states/app.state';
import { SnackbarErrorAction } from '../../store/actions';

View File

@ -31,7 +31,7 @@ import { Subscription } from 'rxjs';
import { Store } from '@ngrx/store';
import { AppStore } from '../store/states/app.state';
import { SetSelectedNodesAction } from '../store/actions';
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
import { MinimalNodeEntryEntity } from '@alfresco/js-api';
@Directive({
selector: '[acaDocumentList]'

View File

@ -123,7 +123,7 @@ describe('LibraryFavoriteDirective', () => {
it('should call removeFavoriteSite() on click event when selection is not a favorite', async(() => {
spyOn(api.peopleApi, 'getFavoriteSite').and.returnValue(Promise.resolve());
spyOn(api.peopleApi, 'removeFavoriteSite').and.returnValue(
spyOn(api.favoritesApi, 'removeFavoriteSite').and.returnValue(
Promise.resolve()
);
component.selection = selection;
@ -138,7 +138,7 @@ describe('LibraryFavoriteDirective', () => {
fixture.detectChanges();
expect(api.peopleApi.removeFavoriteSite).toHaveBeenCalled();
expect(api.favoritesApi.removeFavoriteSite).toHaveBeenCalled();
});
}));
});

View File

@ -31,7 +31,7 @@ import {
Output,
EventEmitter
} from '@angular/core';
import { SiteBody, FavoriteBody, FavoriteEntry, Site } from 'alfresco-js-api';
import { SiteBody, FavoriteBody, FavoriteEntry, Site } from '@alfresco/js-api';
import { AlfrescoApiService } from '@alfresco/adf-core';
interface LibraryEntity {
@ -119,7 +119,7 @@ export class LibraryFavoriteDirective implements OnChanges {
}
private removeFavorite(favoriteId: string) {
this.alfrescoApiService.peopleApi
this.alfrescoApiService.favoritesApi
.removeFavoriteSite('-me-', favoriteId)
.then((libraryBody: SiteBody) => {
this.targetLibrary.isFavorite = false;

View File

@ -31,7 +31,7 @@ import {
OnChanges,
Output
} from '@angular/core';
import { SiteEntry, SiteMembershipRequestBody } from 'alfresco-js-api';
import { SiteEntry, SiteMembershipRequestBody } from '@alfresco/js-api';
import { AlfrescoApiService } from '@alfresco/adf-core';
import { BehaviorSubject, from } from 'rxjs';

View File

@ -178,7 +178,7 @@ export function canDownloadSelection(
...args: RuleParameter[]
): boolean {
if (!context.selection.isEmpty) {
return context.selection.nodes.every(node => {
return context.selection.nodes.every((node: any) => {
return (
node.entry &&
(node.entry.isFile || node.entry.isFolder || !!node.entry.nodeId)

View File

@ -41,7 +41,7 @@ import {
SiteBody,
SiteEntry,
FavoriteBody
} from 'alfresco-js-api';
} from '@alfresco/js-api';
import { map } from 'rxjs/operators';
@Injectable({
@ -81,13 +81,13 @@ export class ContentApiService {
return from(this.api.nodesApi.getNode(nodeId, queryOptions));
}
getNodeInfo(nodeId: string, options: any = {}): Observable<Node> {
getNodeInfo(nodeId: string, options?: any): Observable<Node> {
const defaults = {
include: ['isFavorite', 'allowableOperations']
};
const queryOptions = Object.assign(defaults, options);
const queryOptions = Object.assign(defaults, options || {});
return from(this.api.nodesApi.getNodeInfo(nodeId, queryOptions));
return from((<any>this.api.nodesApi).getNodeInfo(nodeId, queryOptions));
}
/**
@ -254,7 +254,7 @@ export class ContentApiService {
addFavorite(nodes: Array<MinimalNodeEntity>): Observable<any> {
const payload: FavoriteBody[] = nodes.map(node => {
const { isFolder, nodeId, id } = node.entry;
const { isFolder, nodeId, id } = <any>node.entry;
const siteId = node.entry['guid'];
const type = siteId ? 'site' : isFolder ? 'folder' : 'file';
const guid = siteId || nodeId || id;
@ -274,7 +274,7 @@ export class ContentApiService {
removeFavorite(nodes: Array<MinimalNodeEntity>): Observable<any> {
return from(
Promise.all(
nodes.map(node => {
nodes.map((node: any) => {
const id = node.entry.nodeId || node.entry.id;
return this.api.favoritesApi.removeFavoriteSite('-me-', id);
})

View File

@ -91,7 +91,9 @@ describe('ContentManagementService', () => {
of('OPERATION.SUCCES.CONTENT.COPY')
);
const selection = [{ entry: { id: 'node-to-copy-id', name: 'name' } }];
const selection = [
<any>{ entry: { id: 'node-to-copy-id', name: 'name' } }
];
const createdItems = [{ entry: { id: 'copy-id', name: 'name' } }];
store.dispatch(new CopyNodesAction(selection));
@ -109,16 +111,16 @@ describe('ContentManagementService', () => {
);
const selection = [
{ entry: { id: 'node-to-copy-1', name: 'name1' } },
{ entry: { id: 'node-to-copy-2', name: 'name2' } }
<any>{ entry: { id: 'node-to-copy-1', name: 'name1' } },
<any>{ entry: { id: 'node-to-copy-2', name: 'name2' } }
];
const createdItems = [
{ entry: { id: 'copy-of-node-1', name: 'name1' } },
{ entry: { id: 'copy-of-node-2', name: 'name2' } }
<any>{ entry: { id: 'copy-of-node-1', name: 'name1' } },
<any>{ entry: { id: 'copy-of-node-2', name: 'name2' } }
];
store.dispatch(new CopyNodesAction(selection));
nodeActions.contentCopied.next(<any>createdItems);
nodeActions.contentCopied.next(createdItems);
expect(nodeActions.copyNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe(
@ -132,13 +134,15 @@ describe('ContentManagementService', () => {
);
const selection = [
{ entry: { id: 'node-to-copy-1', name: 'name1' } },
{ entry: { id: 'node-to-copy-2', name: 'name2' } }
<any>{ entry: { id: 'node-to-copy-1', name: 'name1' } },
<any>{ entry: { id: 'node-to-copy-2', name: 'name2' } }
];
const createdItems = [
<any>{ entry: { id: 'copy-of-node-1', name: 'name1' } }
];
const createdItems = [{ entry: { id: 'copy-of-node-1', name: 'name1' } }];
store.dispatch(new CopyNodesAction(selection));
nodeActions.contentCopied.next(<any>createdItems);
nodeActions.contentCopied.next(createdItems);
expect(nodeActions.copyNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe(
@ -152,17 +156,17 @@ describe('ContentManagementService', () => {
);
const selection = [
{ entry: { id: 'node-to-copy-0', name: 'name0' } },
{ entry: { id: 'node-to-copy-1', name: 'name1' } },
{ entry: { id: 'node-to-copy-2', name: 'name2' } }
<any>{ entry: { id: 'node-to-copy-0', name: 'name0' } },
<any>{ entry: { id: 'node-to-copy-1', name: 'name1' } },
<any>{ entry: { id: 'node-to-copy-2', name: 'name2' } }
];
const createdItems = [
{ entry: { id: 'copy-of-node-0', name: 'name0' } },
{ entry: { id: 'copy-of-node-1', name: 'name1' } }
<any>{ entry: { id: 'copy-of-node-0', name: 'name0' } },
<any>{ entry: { id: 'copy-of-node-1', name: 'name1' } }
];
store.dispatch(new CopyNodesAction(selection));
nodeActions.contentCopied.next(<any>createdItems);
nodeActions.contentCopied.next(createdItems);
expect(nodeActions.copyNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe(
@ -176,9 +180,9 @@ describe('ContentManagementService', () => {
);
const selection = [
{ entry: { id: 'node-to-copy-0', name: 'name0' } },
{ entry: { id: 'node-to-copy-1', name: 'name1' } },
{ entry: { id: 'node-to-copy-2', name: 'name2' } }
<any>{ entry: { id: 'node-to-copy-0', name: 'name0' } },
<any>{ entry: { id: 'node-to-copy-1', name: 'name1' } },
<any>{ entry: { id: 'node-to-copy-2', name: 'name2' } }
];
const createdItems = [];
@ -196,7 +200,7 @@ describe('ContentManagementService', () => {
of('OPERATION.SUCCES.CONTENT.COPY')
);
const selection = [{ entry: { id: 'node-to-copy', name: 'name' } }];
const selection = [<any>{ entry: { id: 'node-to-copy', name: 'name' } }];
const createdItems = [];
store.dispatch(new CopyNodesAction(selection));
@ -211,7 +215,9 @@ describe('ContentManagementService', () => {
it('notifies error if success message was not emitted', () => {
spyOn(nodeActions, 'copyNodes').and.returnValue(of(''));
const selection = [{ entry: { id: 'node-to-copy-id', name: 'name' } }];
const selection = [
<any>{ entry: { id: 'node-to-copy-id', name: 'name' } }
];
store.dispatch(new CopyNodesAction(selection));
nodeActions.contentCopied.next();
@ -227,7 +233,7 @@ describe('ContentManagementService', () => {
throwError(new Error(JSON.stringify({ error: { statusCode: 403 } })))
);
const selection = [{ entry: { id: '1', name: 'name' } }];
const selection = [<any>{ entry: { id: '1', name: 'name' } }];
store.dispatch(new CopyNodesAction(selection));
expect(nodeActions.copyNodes).toHaveBeenCalled();
@ -241,7 +247,7 @@ describe('ContentManagementService', () => {
throwError(new Error(JSON.stringify({ error: { statusCode: 404 } })))
);
const selection = [{ entry: { id: '1', name: 'name' } }];
const selection = [<any>{ entry: { id: '1', name: 'name' } }];
store.dispatch(new CopyNodesAction(selection));
@ -266,7 +272,9 @@ describe('ContentManagementService', () => {
it('should delete the newly created node on Undo action', () => {
spyOn(contentApi, 'deleteNode').and.returnValue(of(null));
const selection = [{ entry: { id: 'node-to-copy-id', name: 'name' } }];
const selection = [
<any>{ entry: { id: 'node-to-copy-id', name: 'name' } }
];
const createdItems = [{ entry: { id: 'copy-id', name: 'name' } }];
store.dispatch(new CopyNodesAction(selection));
@ -289,8 +297,8 @@ describe('ContentManagementService', () => {
);
const selection = [
{ entry: { id: 'node-to-copy-1', name: 'name1' } },
{
<any>{ entry: { id: 'node-to-copy-1', name: 'name1' } },
<any>{
entry: {
id: 'node-to-copy-2',
name: 'folder-with-name-already-existing-on-destination'
@ -330,11 +338,13 @@ describe('ContentManagementService', () => {
it('notifies when error occurs on Undo action', () => {
spyOn(contentApi, 'deleteNode').and.returnValue(throwError(null));
const selection = [{ entry: { id: 'node-to-copy-id', name: 'name' } }];
const createdItems = [{ entry: { id: 'copy-id', name: 'name' } }];
const selection = [
<any>{ entry: { id: 'node-to-copy-id', name: 'name' } }
];
const createdItems = [<any>{ entry: { id: 'copy-id', name: 'name' } }];
store.dispatch(new CopyNodesAction(selection));
nodeActions.contentCopied.next(<any>createdItems);
nodeActions.contentCopied.next(createdItems);
expect(nodeActions.copyNodes).toHaveBeenCalled();
expect(contentApi.deleteNode).toHaveBeenCalled();
@ -348,11 +358,13 @@ describe('ContentManagementService', () => {
throwError(new Error('oops!'))
);
const selection = [{ entry: { id: 'node-to-copy-id', name: 'name' } }];
const createdItems = [{ entry: { id: 'copy-id', name: 'name' } }];
const selection = [
<any>{ entry: { id: 'node-to-copy-id', name: 'name' } }
];
const createdItems = [<any>{ entry: { id: 'copy-id', name: 'name' } }];
store.dispatch(new CopyNodesAction(selection));
nodeActions.contentCopied.next(<any>createdItems);
nodeActions.contentCopied.next(createdItems);
expect(nodeActions.copyNodes).toHaveBeenCalled();
expect(contentApi.deleteNode).toHaveBeenCalled();
@ -366,11 +378,13 @@ describe('ContentManagementService', () => {
throwError(new Error(JSON.stringify({ error: { statusCode: 403 } })))
);
const selection = [{ entry: { id: 'node-to-copy-id', name: 'name' } }];
const createdItems = [{ entry: { id: 'copy-id', name: 'name' } }];
const selection = [
<any>{ entry: { id: 'node-to-copy-id', name: 'name' } }
];
const createdItems = [<any>{ entry: { id: 'copy-id', name: 'name' } }];
store.dispatch(new CopyNodesAction(selection));
nodeActions.contentCopied.next(<any>createdItems);
nodeActions.contentCopied.next(createdItems);
expect(nodeActions.copyNodes).toHaveBeenCalled();
expect(contentApi.deleteNode).toHaveBeenCalled();
@ -412,7 +426,7 @@ describe('ContentManagementService', () => {
);
spyOn(nodeActions, 'processResponse').and.returnValue(moveResponse);
const selection = node;
const selection: any = node;
store.dispatch(new MoveNodesAction(selection));
nodeActions.contentMoved.next(moveResponse);
@ -439,7 +453,7 @@ describe('ContentManagementService', () => {
);
spyOn(nodeActions, 'processResponse').and.returnValue(moveResponse);
const selection = nodes;
const selection: any = nodes;
store.dispatch(new MoveNodesAction(selection));
nodeActions.contentMoved.next(moveResponse);
@ -451,7 +465,7 @@ describe('ContentManagementService', () => {
});
it('notifies partial move of a node', () => {
const nodes = [{ entry: { id: '1', name: 'name' } }];
const nodes = [<any>{ entry: { id: '1', name: 'name' } }];
const moveResponse = {
succeeded: [],
failed: [],
@ -476,8 +490,8 @@ describe('ContentManagementService', () => {
it('notifies partial move of multiple nodes', () => {
const nodes = [
{ entry: { id: '1', name: 'name' } },
{ entry: { id: '2', name: 'name2' } }
<any>{ entry: { id: '1', name: 'name' } },
<any>{ entry: { id: '2', name: 'name2' } }
];
const moveResponse = {
succeeded: [],
@ -503,8 +517,8 @@ describe('ContentManagementService', () => {
it('notifies successful move and the number of nodes that could not be moved', () => {
const nodes = [
{ entry: { id: '1', name: 'name' } },
{ entry: { id: '2', name: 'name2' } }
<any>{ entry: { id: '1', name: 'name' } },
<any>{ entry: { id: '2', name: 'name2' } }
];
const moveResponse = {
succeeded: [nodes[0]],
@ -529,8 +543,8 @@ describe('ContentManagementService', () => {
it('notifies successful move and the number of partially moved ones', () => {
const nodes = [
{ entry: { id: '1', name: 'name' } },
{ entry: { id: '2', name: 'name2' } }
<any>{ entry: { id: '1', name: 'name' } },
<any>{ entry: { id: '2', name: 'name2' } }
];
const moveResponse = {
succeeded: [nodes[0]],
@ -553,7 +567,7 @@ describe('ContentManagementService', () => {
});
it('notifies error if success message was not emitted', () => {
const nodes = [{ entry: { id: 'node-to-move-id', name: 'name' } }];
const nodes = [<any>{ entry: { id: 'node-to-move-id', name: 'name' } }];
const moveResponse = {
succeeded: [],
failed: [],
@ -576,7 +590,7 @@ describe('ContentManagementService', () => {
throwError(new Error(JSON.stringify({ error: { statusCode: 403 } })))
);
const selection = [{ entry: { id: '1', name: 'name' } }];
const selection = [<any>{ entry: { id: '1', name: 'name' } }];
store.dispatch(new MoveNodesAction(selection));
expect(nodeActions.moveNodes).toHaveBeenCalled();
@ -590,7 +604,7 @@ describe('ContentManagementService', () => {
throwError(new Error(JSON.stringify({ error: { statusCode: 404 } })))
);
const selection = [{ entry: { id: '1', name: 'name' } }];
const selection = [<any>{ entry: { id: '1', name: 'name' } }];
store.dispatch(new MoveNodesAction(selection));
expect(nodeActions.moveNodes).toHaveBeenCalled();
@ -604,7 +618,7 @@ describe('ContentManagementService', () => {
throwError(new Error(JSON.stringify({ error: { statusCode: 409 } })))
);
const selection = [{ entry: { id: '1', name: 'name' } }];
const selection = [<any>{ entry: { id: '1', name: 'name' } }];
store.dispatch(new MoveNodesAction(selection));
expect(nodeActions.moveNodes).toHaveBeenCalled();
@ -614,7 +628,7 @@ describe('ContentManagementService', () => {
});
it('notifies error if move response has only failed items', () => {
const nodes = [{ entry: { id: '1', name: 'name' } }];
const nodes = [<any>{ entry: { id: '1', name: 'name' } }];
const moveResponse = {
succeeded: [],
failed: [{}],
@ -668,7 +682,7 @@ describe('ContentManagementService', () => {
const node = {
entry: { id: 'node-to-move-id', name: 'name', parentId: initialParent }
};
const selection = [node];
const selection = [<any>node];
spyOn(nodeActions, 'moveNodeAction').and.returnValue(of({}));
@ -699,7 +713,7 @@ describe('ContentManagementService', () => {
parentId: initialParent
}
};
const selection = [node];
const selection = [<any>node];
spyOn(nodeActions, 'moveNodeAction').and.returnValue(of({}));
@ -734,7 +748,7 @@ describe('ContentManagementService', () => {
isFolder: true
}
};
const selection = [node];
const selection = [<any>node];
const itemMoved = {}; // folder was empty
nodeActions.moveDeletedEntries = [node]; // folder got deleted
@ -770,7 +784,7 @@ describe('ContentManagementService', () => {
parentId: initialParent
}
};
const selection = [node];
const selection = [<any>node];
const afterMoveParentId = 'parent-id-1';
const childMoved = {
@ -805,7 +819,7 @@ describe('ContentManagementService', () => {
);
const initialParent = 'parent-id-0';
const node = {
const node: any = {
entry: { id: 'node-to-move-id', name: 'name', parentId: initialParent }
};
const selection = [node];
@ -841,7 +855,7 @@ describe('ContentManagementService', () => {
const node = {
entry: { id: 'node-to-move-id', name: 'name', parentId: initialParent }
};
const selection = [node];
const selection = [<any>node];
const childMoved = {
entry: { id: 'child-of-node-to-move-id', name: 'child-name' }
@ -873,7 +887,7 @@ describe('ContentManagementService', () => {
})
);
const selection = [{ entry: { id: '1', name: 'name1' } }];
const selection = [<any>{ entry: { id: '1', name: 'name1' } }];
store.dispatch(new DeleteNodesAction(selection));
}));
@ -888,7 +902,7 @@ describe('ContentManagementService', () => {
})
);
const selection = [{ entry: { id: '1', name: 'name1' } }];
const selection = [<any>{ entry: { id: '1', name: 'name1' } }];
store.dispatch(new DeleteNodesAction(selection));
}));
@ -904,8 +918,8 @@ describe('ContentManagementService', () => {
);
const selection = [
{ entry: { id: '1', name: 'name1' } },
{ entry: { id: '2', name: 'name2' } }
<any>{ entry: { id: '1', name: 'name1' } },
<any>{ entry: { id: '2', name: 'name2' } }
];
store.dispatch(new DeleteNodesAction(selection));
@ -922,8 +936,8 @@ describe('ContentManagementService', () => {
);
const selection = [
{ entry: { id: '1', name: 'name1' } },
{ entry: { id: '2', name: 'name2' } }
<any>{ entry: { id: '1', name: 'name1' } },
<any>{ entry: { id: '2', name: 'name2' } }
];
store.dispatch(new DeleteNodesAction(selection));
@ -946,8 +960,8 @@ describe('ContentManagementService', () => {
);
const selection = [
{ entry: { id: '1', name: 'name1' } },
{ entry: { id: '2', name: 'name2' } }
<any>{ entry: { id: '1', name: 'name1' } },
<any>{ entry: { id: '2', name: 'name2' } }
];
store.dispatch(new DeleteNodesAction(selection));
@ -976,9 +990,9 @@ describe('ContentManagementService', () => {
);
const selection = [
{ entry: { id: '1', name: 'name1' } },
{ entry: { id: '2', name: 'name2' } },
{ entry: { id: '3', name: 'name3' } }
<any>{ entry: { id: '1', name: 'name1' } },
<any>{ entry: { id: '2', name: 'name2' } },
<any>{ entry: { id: '3', name: 'name3' } }
];
store.dispatch(new DeleteNodesAction(selection));
@ -1004,7 +1018,7 @@ describe('ContentManagementService', () => {
it('call purge nodes if selection is not empty', fakeAsync(() => {
spyOn(contentApi, 'purgeDeletedNode').and.returnValue(of({}));
const selection = [{ entry: { id: '1' } }];
const selection = [<any>{ entry: { id: '1' } }];
store.dispatch(new PurgeDeletedNodesAction(selection));
expect(contentApi.purgeDeletedNode).toHaveBeenCalled();
@ -1034,9 +1048,9 @@ describe('ContentManagementService', () => {
});
const selection = [
{ entry: { id: '1', name: 'name1' } },
{ entry: { id: '2', name: 'name2' } },
{ entry: { id: '3', name: 'name3' } }
<any>{ entry: { id: '1', name: 'name1' } },
<any>{ entry: { id: '2', name: 'name2' } },
<any>{ entry: { id: '3', name: 'name3' } }
];
store.dispatch(new PurgeDeletedNodesAction(selection));
@ -1069,10 +1083,10 @@ describe('ContentManagementService', () => {
});
const selection = [
{ entry: { id: '1', name: 'name1' } },
{ entry: { id: '2', name: 'name2' } },
{ entry: { id: '3', name: 'name3' } },
{ entry: { id: '4', name: 'name4' } }
<any>{ entry: { id: '1', name: 'name1' } },
<any>{ entry: { id: '2', name: 'name2' } },
<any>{ entry: { id: '3', name: 'name3' } },
<any>{ entry: { id: '4', name: 'name4' } }
];
store.dispatch(new PurgeDeletedNodesAction(selection));
@ -1088,7 +1102,7 @@ describe('ContentManagementService', () => {
spyOn(contentApi, 'purgeDeletedNode').and.returnValue(of({}));
const selection = [{ entry: { id: '1', name: 'name1' } }];
const selection = [<any>{ entry: { id: '1', name: 'name1' } }];
store.dispatch(new PurgeDeletedNodesAction(selection));
}));
@ -1103,7 +1117,7 @@ describe('ContentManagementService', () => {
spyOn(contentApi, 'purgeDeletedNode').and.returnValue(throwError({}));
const selection = [{ entry: { id: '1', name: 'name1' } }];
const selection = [<any>{ entry: { id: '1', name: 'name1' } }];
store.dispatch(new PurgeDeletedNodesAction(selection));
}));
@ -1126,8 +1140,8 @@ describe('ContentManagementService', () => {
});
const selection = [
{ entry: { id: '1', name: 'name1' } },
{ entry: { id: '2', name: 'name2' } }
<any>{ entry: { id: '1', name: 'name1' } },
<any>{ entry: { id: '2', name: 'name2' } }
];
store.dispatch(new PurgeDeletedNodesAction(selection));
@ -1151,8 +1165,8 @@ describe('ContentManagementService', () => {
});
const selection = [
{ entry: { id: '1', name: 'name1' } },
{ entry: { id: '2', name: 'name2' } }
<any>{ entry: { id: '1', name: 'name1' } },
<any>{ entry: { id: '2', name: 'name2' } }
];
store.dispatch(new PurgeDeletedNodesAction(selection));
@ -1173,7 +1187,7 @@ describe('ContentManagementService', () => {
it('does not restore nodes if selection has nodes without path', () => {
spyOn(contentApi, 'restoreNode');
const selection = [{ entry: { id: '1' } }];
const selection = [<any>{ entry: { id: '1' } }];
store.dispatch(new RestoreDeletedNodesAction(selection));
@ -1198,7 +1212,7 @@ describe('ContentManagementService', () => {
};
const selection = [
{
<any>{
entry: {
id: '1',
path
@ -1234,7 +1248,7 @@ describe('ContentManagementService', () => {
};
const selection = [
{
<any>{
entry: {
id: '1',
path
@ -1269,7 +1283,7 @@ describe('ContentManagementService', () => {
};
const selection = [
{
<any>{
entry: {
id: '1',
path
@ -1324,9 +1338,9 @@ describe('ContentManagementService', () => {
};
const selection = [
{ entry: { id: '1', name: 'name1', path } },
{ entry: { id: '2', name: 'name2', path } },
{ entry: { id: '3', name: 'name3', path } }
<any>{ entry: { id: '1', name: 'name1', path } },
<any>{ entry: { id: '2', name: 'name2', path } },
<any>{ entry: { id: '3', name: 'name3', path } }
];
store.dispatch(new RestoreDeletedNodesAction(selection));
@ -1350,7 +1364,7 @@ describe('ContentManagementService', () => {
]
};
const selection = [{ entry: { id: '1', name: 'name1', path } }];
const selection = [<any>{ entry: { id: '1', name: 'name1', path } }];
store.dispatch(new RestoreDeletedNodesAction(selection));
}));
@ -1374,7 +1388,7 @@ describe('ContentManagementService', () => {
]
};
const selection = [{ entry: { id: '1', name: 'name1', path } }];
const selection = [<any>{ entry: { id: '1', name: 'name1', path } }];
store.dispatch(new RestoreDeletedNodesAction(selection));
}));
@ -1398,7 +1412,7 @@ describe('ContentManagementService', () => {
]
};
const selection = [{ entry: { id: '1', name: 'name1', path } }];
const selection = [<any>{ entry: { id: '1', name: 'name1', path } }];
store.dispatch(new RestoreDeletedNodesAction(selection));
}));
@ -1429,8 +1443,8 @@ describe('ContentManagementService', () => {
};
const selection = [
{ entry: { id: '1', name: 'name1', path } },
{ entry: { id: '2', name: 'name2', path } }
<any>{ entry: { id: '1', name: 'name1', path } },
<any>{ entry: { id: '2', name: 'name2', path } }
];
store.dispatch(new RestoreDeletedNodesAction(selection));
@ -1453,7 +1467,7 @@ describe('ContentManagementService', () => {
]
};
const selection = [{ entry: { id: '1', name: 'name1', path } }];
const selection = [<any>{ entry: { id: '1', name: 'name1', path } }];
store.dispatch(new RestoreDeletedNodesAction(selection));
}));
@ -1476,7 +1490,7 @@ describe('ContentManagementService', () => {
};
const selection = [
{
<any>{
entry: {
id: '1',
name: 'name1',
@ -1492,7 +1506,7 @@ describe('ContentManagementService', () => {
describe('Share Node', () => {
it('should open dialog for nodes without requesting getNodeInfo', fakeAsync(() => {
const node = { entry: { id: '1', name: 'name1' } };
const node = <any>{ entry: { id: '1', name: 'name1' } };
spyOn(contentApi, 'getNodeInfo').and.returnValue(of({}));
spyOn(dialog, 'open').and.returnValue({
afterClosed() {
@ -1507,7 +1521,7 @@ describe('ContentManagementService', () => {
}));
it('should open dialog with getNodeInfo data when `id` property is missing', fakeAsync(() => {
const node = { entry: { nodeId: '1', name: 'name1' } };
const node = <any>{ entry: { nodeId: '1', name: 'name1' } };
spyOn(contentApi, 'getNodeInfo').and.returnValue(of({}));
spyOn(dialog, 'open').and.returnValue({
afterClosed() {
@ -1522,7 +1536,7 @@ describe('ContentManagementService', () => {
}));
it('should update node selection after dialog is closed', fakeAsync(() => {
const node = { entry: { id: '1', name: 'name1' } };
const node = <any>{ entry: { id: '1', name: 'name1' } };
spyOn(store, 'dispatch').and.callThrough();
spyOn(dialog, 'open').and.returnValue({
afterClosed() {
@ -1538,7 +1552,7 @@ describe('ContentManagementService', () => {
}));
it('should emit event when node is un-shared', fakeAsync(() => {
const node = { entry: { id: '1', name: 'name1' } };
const node = <any>{ entry: { id: '1', name: 'name1' } };
spyOn(contentManagementService.linksUnshared, 'next').and.callThrough();
spyOn(dialog, 'open').and.returnValue({
afterClosed: () => of(node)

View File

@ -52,7 +52,7 @@ import {
DeletedNodesPaging,
PathInfoEntity,
SiteBody
} from 'alfresco-js-api';
} from '@alfresco/js-api';
import { NodePermissionService } from './node-permission.service';
import { NodeInfo, DeletedNodeInfo, DeleteStatus } from '../store/models';
import { ContentApiService } from './content-api.service';
@ -132,7 +132,7 @@ export class ContentManagementService {
managePermissions(node: MinimalNodeEntity): void {
if (node && node.entry) {
const { nodeId, id } = node.entry;
const { nodeId, id } = <any>node.entry;
const siteId = node.entry['guid'];
const targetId = siteId || nodeId || id;
@ -150,7 +150,7 @@ export class ContentManagementService {
}
}
manageVersions(node: MinimalNodeEntity) {
manageVersions(node: any) {
if (node && node.entry) {
// shared and favorite
const id = node.entry.nodeId || (<any>node).entry.guid;
@ -165,7 +165,7 @@ export class ContentManagementService {
}
}
private openVersionManagerDialog(node: MinimalNodeEntryEntity) {
private openVersionManagerDialog(node: any) {
// workaround Shared
if (node.isFile || node.nodeId) {
this.dialogRef.open(NodeVersionsDialogComponent, {
@ -180,7 +180,7 @@ export class ContentManagementService {
}
}
shareNode(node: MinimalNodeEntity): void {
shareNode(node: any): void {
if (node && node.entry) {
// shared and favorite
const id = node.entry.nodeId || (<any>node).entry.guid;
@ -389,7 +389,7 @@ export class ContentManagementService {
if (result === true) {
const nodesToDelete: NodeInfo[] = nodes.map(node => {
const { name } = node.entry;
const id = node.entry.nodeId || node.entry.id;
const id = (<any>node).entry.nodeId || node.entry.id;
return {
id,
@ -973,7 +973,7 @@ export class ContentManagementService {
});
}
private deleteNode(node: MinimalNodeEntity): Observable<DeletedNodeInfo> {
private deleteNode(node: any): Observable<DeletedNodeInfo> {
const { name } = node.entry;
const id = node.entry.nodeId || node.entry.id;
@ -1162,10 +1162,10 @@ export class ContentManagementService {
return i18nMessageString;
}
printFile(node: MinimalNodeEntity) {
printFile(node: any) {
if (node && node.entry) {
// shared and favorite
const id = node.entry.nodeId || (<any>node).entry.guid || node.entry.id;
const id = node.entry.nodeId || node.entry.guid || node.entry.id;
const mimeType = node.entry.content.mimeType;
if (id) {

View File

@ -31,7 +31,7 @@ import {
AlfrescoApiService
} from '@alfresco/adf-core';
import { Observable } from 'rxjs';
import { PersonEntry, SearchRequest, ResultSetPaging } from 'alfresco-js-api';
import { PersonEntry, SearchRequest, ResultSetPaging } from '@alfresco/js-api';
@Injectable({
providedIn: 'root'

View File

@ -29,7 +29,7 @@ import { of, throwError } from 'rxjs';
import { AlfrescoApiService, TranslationService } from '@alfresco/adf-core';
import { DocumentListService } from '@alfresco/adf-content-services';
import { NodeActionsService } from './node-actions.service';
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
import { MinimalNodeEntryEntity } from '@alfresco/js-api';
import { AppTestingModule } from '../testing/app-testing.module';
import { ContentApiService } from '../services/content-api.service';
@ -44,7 +44,7 @@ class TestNode {
nodeType?: string,
properties?: any
) {
this.entry = {};
this.entry = <any>{};
this.entry.id = id || 'node-id';
this.entry.isFile = isFile;
this.entry.isFolder = !isFile;
@ -241,14 +241,14 @@ describe('NodeActionsService', () => {
describe('getEntryParentId', () => {
it('should return the parentId, if that exists on the node entry', () => {
const parentID = 'parent-id';
const entry = { nodeId: '1234', parentId: parentID };
const entry = <any>{ nodeId: '1234', parentId: parentID };
expect(service.getEntryParentId(entry)).toBe(parentID);
});
it('should give the last element in path property, if parentId is missing and path exists on the node entry', () => {
const firstParentId = 'parent-0-id';
const entry = {
const entry = <any>{
nodeId: '1234',
path: { elements: [{ id: 'parent-1-id' }, { id: firstParentId }] }
};

View File

@ -41,8 +41,9 @@ import {
import {
MinimalNodeEntity,
MinimalNodeEntryEntity,
SitePaging
} from 'alfresco-js-api';
SitePaging,
Site
} from '@alfresco/js-api';
import { ContentApiService } from '../services/content-api.service';
import { catchError, map, mergeMap } from 'rxjs/operators';
@ -217,24 +218,24 @@ export class NodeActionsService {
contentEntities[0].entry
);
const customDropdown: SitePaging = {
const customDropdown = new SitePaging({
list: {
entries: [
{
entry: {
entry: <Site>{
guid: '-my-',
title: 'APP.BROWSE.PERSONAL.SIDENAV_LINK.LABEL'
}
},
{
entry: {
entry: <Site>{
guid: '-mysites-',
title: 'APP.BROWSE.LIBRARIES.SIDENAV_LINK.LABEL'
}
}
]
}
};
});
const title = this.getTitleTranslation(action, contentEntities);
@ -340,7 +341,7 @@ export class NodeActionsService {
}
}
} else if (node === null && this.isSitesDestinationAvailable) {
node = {
node = <any>{
name: this.translation.instant('APP.BROWSE.LIBRARIES.TITLE'),
path: { elements: [] }
};

View File

@ -24,7 +24,7 @@
*/
import { Action } from '@ngrx/store';
import { Node, Person } from 'alfresco-js-api';
import { Node, Person } from '@alfresco/js-api';
import { AppState } from '../states';
export const SET_INITIAL_STATE = 'SET_INITIAL_STATE';

View File

@ -24,7 +24,7 @@
*/
import { Action } from '@ngrx/store';
import { MinimalNodeEntity } from 'alfresco-js-api';
import { MinimalNodeEntity } from '@alfresco/js-api';
export const ADD_FAVORITE = 'ADD_FAVORITE';
export const REMOVE_FAVORITE = 'REMOVE_FAVORITE';

View File

@ -24,7 +24,7 @@
*/
import { Action } from '@ngrx/store';
import { SiteBody } from 'alfresco-js-api';
import { SiteBody } from '@alfresco/js-api';
export const DELETE_LIBRARY = 'DELETE_LIBRARY';
export const CREATE_LIBRARY = 'CREATE_LIBRARY';

View File

@ -24,7 +24,7 @@
*/
import { Action } from '@ngrx/store';
import { MinimalNodeEntity } from 'alfresco-js-api';
import { MinimalNodeEntity } from '@alfresco/js-api';
export const SET_SELECTED_NODES = 'SET_SELECTED_NODES';
export const DELETE_NODES = 'DELETE_NODES';

View File

@ -24,7 +24,7 @@
*/
import { Action } from '@ngrx/store';
import { MinimalNodeEntity } from 'alfresco-js-api';
import { MinimalNodeEntity } from '@alfresco/js-api';
export const NAVIGATE_URL = 'NAVIGATE_URL';
export const NAVIGATE_ROUTE = 'NAVIGATE_ROUTE';

View File

@ -24,7 +24,7 @@
*/
import { Action } from '@ngrx/store';
import { MinimalNodeEntity } from 'alfresco-js-api';
import { MinimalNodeEntity } from '@alfresco/js-api';
export const VIEW_FILE = 'VIEW_FILE';

View File

@ -31,7 +31,7 @@ import { map, take } from 'rxjs/operators';
import { DownloadNodesAction, DOWNLOAD_NODES } from '../actions';
import { NodeInfo } from '../models';
import { ContentApiService } from '../../services/content-api.service';
import { MinimalNodeEntity } from 'alfresco-js-api';
import { MinimalNodeEntity } from '@alfresco/js-api';
import { Store } from '@ngrx/store';
import { AppStore } from '../states';
import { appSelection } from '../selectors/app.selectors';
@ -66,7 +66,7 @@ export class DownloadEffects {
private downloadNodes(toDownload: Array<MinimalNodeEntity>) {
const nodes = toDownload.map(node => {
const { id, nodeId, name, isFile, isFolder } = node.entry;
const { id, nodeId, name, isFile, isFolder } = <any>node.entry;
return {
id: nodeId || id,

View File

@ -44,7 +44,6 @@ import { Store } from '@ngrx/store';
import { AppStore } from '../states';
import { appSelection } from '../selectors/app.selectors';
import { ContentApiService } from '../../services/content-api.service';
import { SiteBody } from 'alfresco-js-api-node';
import { SnackbarErrorAction } from '../actions/snackbar.actions';
@Injectable()
@ -136,7 +135,7 @@ export class LibraryEffects {
const { id } = selection.library.entry;
const { title, description, visibility } = action.payload;
const siteBody = <SiteBody>{
const siteBody = {
title,
description,
visibility

View File

@ -26,7 +26,7 @@
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { Actions, Effect, ofType } from '@ngrx/effects';
import { MinimalNodeEntryEntity, PathInfoEntity } from 'alfresco-js-api';
import { MinimalNodeEntryEntity, PathInfoEntity } from '@alfresco/js-api';
import { map } from 'rxjs/operators';
import {
NavigateRouteAction,

View File

@ -56,7 +56,7 @@ export class ViewerEffects {
ofType<ViewFileAction>(VIEW_FILE),
map(action => {
if (action.payload && action.payload.entry) {
const { id, nodeId, isFile } = action.payload.entry;
const { id, nodeId, isFile } = <any>action.payload.entry;
if (isFile || nodeId) {
this.displayPreview(nodeId || id, action.parentId);
@ -67,7 +67,7 @@ export class ViewerEffects {
.pipe(take(1))
.subscribe(result => {
if (result.selection && result.selection.file) {
const { id, nodeId, isFile } = result.selection.file.entry;
const { id, nodeId, isFile } = <any>result.selection.file.entry;
if (isFile || nodeId) {
const parentId = result.folder ? result.folder.id : null;

View File

@ -189,7 +189,7 @@ function updateSelectedNodes(
last = nodes[nodes.length - 1];
if (nodes.length === 1) {
file = nodes.find(entity => {
file = nodes.find((entity: any) => {
// workaround Shared
return entity.entry.isFile || entity.entry.nodeId ? true : false;
});
@ -197,7 +197,9 @@ function updateSelectedNodes(
}
}
const libraries = [...action.payload].filter((node: any) => node.isLibrary);
const libraries: any[] = [...action.payload].filter(
(node: any) => node.isLibrary
);
if (libraries.length === 1) {
library = libraries[0];
}