New packages org (#2639)

New packages org
This commit is contained in:
Eugenio Romano
2017-11-16 14:12:52 +00:00
committed by GitHub
parent 6a24c6ef75
commit a52bb5600a
1984 changed files with 17179 additions and 40423 deletions

View File

@@ -0,0 +1,59 @@
/*!
* @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 {
ContentInfo,
NodeMinimal,
NodeMinimalEntry,
NodePaging,
NodePagingList,
PathInfoEntity
} from '../document-list';
export class PageNode extends NodePaging {
constructor(entries?: NodeMinimalEntry[]) {
super();
this.list = new NodePagingList();
this.list.entries = entries || [];
}
}
export class FileNode extends NodeMinimalEntry {
constructor(name?: string, mimeType?: string) {
super();
this.entry = new NodeMinimal();
this.entry.id = 'file-id';
this.entry.isFile = true;
this.entry.isFolder = false;
this.entry.name = name;
this.entry.path = new PathInfoEntity();
this.entry.content = new ContentInfo();
this.entry.content.mimeType = mimeType || 'text/plain';
}
}
export class FolderNode extends NodeMinimalEntry {
constructor(name?: string) {
super();
this.entry = new NodeMinimal();
this.entry.id = 'folder-id';
this.entry.isFile = false;
this.entry.isFolder = true;
this.entry.name = name;
this.entry.path = new PathInfoEntity();
}
}

View File

@@ -0,0 +1,117 @@
/*!
* @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.
*/
export const fakeNodeWithCreatePermission = {
isFile: false,
createdByUser: { id: 'admin', displayName: 'Administrator' },
modifiedAt: '2017-06-08T13:53:46.495Z',
nodeType: 'cm:folder',
parentId: '55052317-7e59-4058-8e07-769f41e615e1',
createdAt: '2017-05-22T11:36:11.270Z',
path: {
name: '/Company Home/User Homes',
isComplete: true,
elements: [{
id: '94acfc73-7014-4475-9bd9-93a2162f0f8c',
name: 'Company Home'
}, { id: '55052317-7e59-4058-8e07-769f41e615e1', name: 'User Homes' }]
},
isFolder: true,
modifiedByUser: { id: 'Test', displayName: 'Test' },
name: 'Test',
id: '70e1cc6a-6918-468a-b84a-1048093b06fd',
properties: {},
allowableOperations: ['delete', 'update', 'create']
};
export const fakeNodeWithNoPermission = {
isFile: false,
createdByUser: { id: 'admin', displayName: 'Administrator' },
modifiedAt: '2017-06-08T13:53:46.495Z',
nodeType: 'cm:folder',
parentId: '55052317-7e59-4058-8e07-769f41e615e1',
aspectNames: ['cm:ownable', 'cm:auditable'],
createdAt: '2017-05-22T11:36:11.270Z',
path: {
name: '/Company Home/User Homes',
isComplete: true,
elements: [{
id: '94acfc73-7014-4475-9bd9-93a2162f0f8c',
name: 'Company Home'
}, { id: '55052317-7e59-4058-8e07-769f41e615e1', name: 'User Homes' }]
},
isFolder: true,
modifiedByUser: { id: 'Test', displayName: 'Test' },
name: 'Test',
id: '70e1cc6a-6918-468a-b84a-1048093b06fd',
properties: {}
};
export const fakeNodeAnswerWithEntries = {
'list': {
'pagination': {
'count': 4,
'hasMoreItems': false,
'totalItems': 14,
'skipCount': 10,
'maxItems': 10
},
'entries': [{
'entry': {
'isFile': true,
'createdByUser': { 'id': 'admin', 'displayName': 'Administrator' },
'modifiedAt': '2017-05-24T15:08:55.640Z',
'nodeType': 'cm:content',
'content': {
'mimeType': 'application/rtf',
'mimeTypeName': 'Rich Text Format',
'sizeInBytes': 14530,
'encoding': 'UTF-8'
},
'parentId': 'd124de26-6ba0-4f40-8d98-4907da2d337a',
'createdAt': '2017-05-24T15:08:55.640Z',
'path': {
'name': '/Company Home/Guest Home',
'isComplete': true,
'elements': [{
'id': '94acfc73-7014-4475-9bd9-93a2162f0f8c',
'name': 'Company Home'
}, { 'id': 'd124de26-6ba0-4f40-8d98-4907da2d337a', 'name': 'Guest Home' }]
},
'isFolder': false,
'modifiedByUser': { 'id': 'admin', 'displayName': 'Administrator' },
'name': 'b_txt_file.rtf',
'id': '67b80f77-dbca-4f58-be6c-71b9dd61ea53',
'properties': { 'cm:versionLabel': '1.0', 'cm:versionType': 'MAJOR' },
'allowableOperations': ['delete', 'update']
}
}]
}
};
export const fakeNodeAnswerWithNOEntries = {
'list': {
'pagination': {
'count': 4,
'hasMoreItems': false,
'totalItems': 14,
'skipCount': 10,
'maxItems': 10
},
'entries': []
}
};

View File

@@ -0,0 +1,63 @@
/*!
* @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 {
AlfrescoApiService,
AuthenticationService,
ContentService,
SettingsService,
LogService,
ThumbnailService
} from '@alfresco/core';
import { Observable } from 'rxjs/Rx';
import { NodePaging, DocumentListService } from '../document-list';
import { PageNode } from './document-library.model.mock';
export class DocumentListServiceMock extends DocumentListService {
getFolderResult: NodePaging = new PageNode();
getFolderReject: boolean = false;
getFolderRejectError: string = 'Error';
constructor(
settings?: SettingsService,
authService?: AuthenticationService,
contentService?: ContentService,
apiService?: AlfrescoApiService,
logService?: LogService,
thumbnailService?: ThumbnailService
) {
super(authService, contentService, apiService, logService, thumbnailService);
}
getFolder(folder: string) {
if (this.getFolderReject) {
return Observable.throw(this.getFolderRejectError);
}
return Observable.create(observer => {
observer.next(this.getFolderResult);
observer.complete();
});
}
deleteNode(nodeId: string) {
return Observable.create(observer => {
observer.next();
observer.complete();
});
}
}

View File

@@ -0,0 +1,18 @@
/*!
* @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.
*/
export * from './public-api';

View File

@@ -0,0 +1,22 @@
/*!
* @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.
*/
export * from './document-library.model.mock';
export * from './document-list.component.mock';
export * from './document-list.service.mock';
export * from './search.component.mock';
export * from './search.service.mock';

View File

@@ -0,0 +1,169 @@
/*!
* @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 { Component, ViewChild } from '@angular/core';
import { SearchComponent } from '../search/components/search.component';
const entryItem = {
entry: {
id: '123',
name: 'MyDoc',
isFile : true,
content: {
mimeType: 'text/plain'
},
createdByUser: {
displayName: 'John Doe'
},
modifiedByUser: {
displayName: 'John Doe'
}
}
};
const entryDifferentItem = {
entry: {
id: '999',
name: 'TEST_DOC',
isFile : true,
content: {
mimeType: 'text/plain'
},
createdByUser: {
displayName: 'John TEST'
},
modifiedByUser: {
displayName: 'John TEST'
}
}
};
export let result = {
list: {
entries: [
entryItem
]
}
};
export let differentResult = {
list: {
entries: [
entryDifferentItem
]
}
};
export let results = {
list: {
entries: [
entryItem,
entryItem,
entryItem
]
}
};
export let folderResult = {
list: {
entries: [
{
entry: {
id: '123',
name: 'MyFolder',
isFile : false,
isFolder : true,
createdByUser: {
displayName: 'John Doe'
},
modifiedByUser: {
displayName: 'John Doe'
}
}
}
]
}
};
export let noResult = {
list: {
entries: []
}
};
export let errorJson = {
error: {
errorKey: 'Search failed',
statusCode: 400,
briefSummary: '08220082 search failed',
stackTrace: 'For security reasons the stack trace is no longer displayed, but the property is kept for previous versions.',
descriptionURL: 'https://api-explorer.alfresco.com'
}
};
@Component({
template: `
<adf-search [searchTerm]="searchedWord" [maxResults]="maxResults"
(error)="showSearchResult('ERROR')"
(success)="showSearchResult('success')" #search>
<ng-template let-data>
<ul id="autocomplete-search-result-list">
<li *ngFor="let item of data?.list?.entries; let idx = index" (click)="elementClicked(item)">
<div id="result_option_{{idx}}">
<span>{{ item?.entry.name }}</span>
</div>
</li>
</ul>
</ng-template>
</adf-search>
<span id="component-result-message">{{message}}</span>
`
})
export class SimpleSearchTestComponent {
@ViewChild('search')
search: SearchComponent;
message: string = '';
searchedWord= '';
maxResults: number = 5;
constructor() {
}
showSearchResult(event: any) {
this.message = event;
}
elementClicked(event: any) {
this.message = 'element clicked';
}
setSearchWordTo(str: string) {
this.searchedWord = str;
}
changeMaxResultTo(newMax: number) {
this.maxResults = newMax;
}
forceHidePanel() {
this.search.hidePanel();
}
}

View File

@@ -0,0 +1,63 @@
/*!
* @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.
*/
export let fakeSearch = {
list: {
pagination: {
count: 1,
hasMoreItems: false,
totalItems: 1,
skipCount: 0,
maxItems: 100
},
entries: [
{
entry: {
id: '123',
name: 'MyDoc',
content: {
mimetype: 'text/plain'
},
createdByUser: {
displayName: 'John Doe'
},
modifiedByUser: {
displayName: 'John Doe'
}
}
}
]
}
};
export let fakeError = {
error: {
errorKey: 'Search failed',
statusCode: 400,
briefSummary: '08220082 search failed',
stackTrace: 'For security reasons the stack trace is no longer displayed, but the property is kept for previous versions.',
descriptionURL: 'https://api-explorer.alfresco.com'
}
};
export let fakeApi = {
core: {
queriesApi: {
findNodes: (term, opts) => Promise.resolve(fakeSearch)
}
}
};