[ADF-1873] Remove all deprecated code from ADF (#4145)

* remove deprecated code part 1

* remove deprecation step 2

* fix spellcheck

* fix

* fix lint

* fix not used import

* remove deprecation

* fix test first part after remove deprecation

* fix test

* fix sidebar demo shell
This commit is contained in:
Eugenio Romano
2019-01-15 15:36:01 +00:00
committed by GitHub
parent 24a7c939e6
commit 7d061b2c11
109 changed files with 351 additions and 1106 deletions
@@ -212,8 +212,8 @@
<mat-slide-toggle <mat-slide-toggle
id="adf-switch-allowsidebar" id="adf-switch-allowsidebar"
[color]="'primary'" [color]="'primary'"
(change)="toggleAllowSidebar()" (change)="toggleAllowRightSidebar()"
[checked]="allowSidebar"> [checked]="allowRightSidebar">
Allow Right Sidebar Allow Right Sidebar
</mat-slide-toggle> </mat-slide-toggle>
</p> </p>
@@ -255,22 +255,20 @@
</adf-info-drawer> </adf-info-drawer>
</ng-template> </ng-template>
<ng-template let-node="node" #sidebarTemplate> <adf-info-drawer-layout> <div info-drawer-content> <mat-card> My info </mat-card> </div> </adf-info-drawer-layout> </ng-template>
<adf-viewer <adf-viewer
[nodeId]="nodeId" [nodeId]="nodeId"
[showSidebar]="showRightSidebar" [showRightSidebar]="showRightSidebar"
[showLeftSidebar]="showLeftSidebar" [showLeftSidebar]="showLeftSidebar"
[allowGoBack]="allowGoBack" [allowGoBack]="allowGoBack"
[displayName]="displayName" [displayName]="displayName"
[showToolbar]="showToolbar" [showToolbar]="showToolbar"
[allowPrint]="allowPrint" [allowPrint]="allowPrint"
[allowDownload]="allowDownload" [allowDownload]="allowDownload"
[allowSidebar]="allowSidebar" [allowRightSidebar]="allowRightSidebar"
[allowLeftSidebar]="allowLeftSidebar" [allowLeftSidebar]="allowLeftSidebar"
[urlFile]="urlFile" [urlFile]="urlFile"
[sidebarLeftTemplate]="sidebarLeftTemplate" [sidebarLeftTemplate]="sidebarLeftTemplate"
[sidebarTemplate]="sidebarRightTemplate"> [sidebarRightTemplate]="sidebarRightTemplate">
<adf-viewer-toolbar *ngIf="customToolbar" data-automation-id="adf-viewer-custom-toolbar"> <adf-viewer-toolbar *ngIf="customToolbar" data-automation-id="adf-viewer-custom-toolbar">
<h1>My custom toolbar</h1> <h1>My custom toolbar</h1>
@@ -43,7 +43,7 @@ export class FileViewComponent implements OnInit {
openWith = false; openWith = false;
allowDownload = true; allowDownload = true;
allowPrint = true; allowPrint = true;
allowSidebar = true; allowRightSidebar = true;
allowLeftSidebar = true; allowLeftSidebar = true;
moreActions = true; moreActions = true;
customName = false; customName = false;
@@ -131,8 +131,8 @@ export class FileViewComponent implements OnInit {
this.showLeftSidebar = false; this.showLeftSidebar = false;
} }
toggleAllowSidebar() { toggleAllowRightSidebar() {
this.allowSidebar = !this.allowSidebar; this.allowRightSidebar = !this.allowRightSidebar;
} }
toggleAllowLeftSidebar() { toggleAllowLeftSidebar() {
@@ -81,7 +81,6 @@
[successRoute]="customSuccessRouteURI" [successRoute]="customSuccessRouteURI"
[logoImageUrl]="customLogoImageURL" [logoImageUrl]="customLogoImageURL"
[fieldsValidation]="customValidation" [fieldsValidation]="customValidation"
[disableCsrf]="disableCsrf"
[showLoginActions]="showFooter" [showLoginActions]="showFooter"
[showRememberMe]="showFooter && showRememberMe" [showRememberMe]="showFooter && showRememberMe"
(executeSubmit)="checkForm($event)" (executeSubmit)="checkForm($event)"
@@ -2,7 +2,7 @@
<div class="adf-no-form-container"> <div class="adf-no-form-container">
<adf-upload-drag-area <adf-upload-drag-area
[parentId]="processInstanceId" [rootFolderId]="processInstanceId"
[disabled]="isCompletedProcess()"> [disabled]="isCompletedProcess()">
<adf-process-attachment-list #processAttachList <adf-process-attachment-list #processAttachList
@@ -12,7 +12,7 @@
(attachmentClick)="onAttachmentClick($event)"> (attachmentClick)="onAttachmentClick($event)">
<adf-empty-list> <adf-empty-list>
<div adf-empty-list-header class="adf-empty-list-header"> <div adf-empty-list-header class="adf-empty-list-header">
{{'ADF_PROCESS_LIST.PROCESS-ATTACHMENT.EMPTY.HEADER' | translate}} {{'ADF_PROCESS_LIST.PROCESS-ATTACHMENT.EMPTY.HEADER' | translate}}
</div> </div>
<div adf-empty-list-body> <div adf-empty-list-body>
<div fxHide.lt-md="true" class="adf-empty-list-drag_drop"> <div fxHide.lt-md="true" class="adf-empty-list-drag_drop">
@@ -22,7 +22,7 @@
{{'ADF_PROCESS_LIST.PROCESS-ATTACHMENT.EMPTY.DRAG-AND-DROP.SUBTITLE' | translate}} {{'ADF_PROCESS_LIST.PROCESS-ATTACHMENT.EMPTY.DRAG-AND-DROP.SUBTITLE' | translate}}
</div> </div>
</div> </div>
</adf-empty-list> </adf-empty-list>
</adf-process-attachment-list> </adf-process-attachment-list>
@@ -35,4 +35,4 @@
</adf-create-process-attachment> </adf-create-process-attachment>
</div> </div>
</div> </div>
@@ -42,7 +42,6 @@
[page]="taskPage" [page]="taskPage"
[size]="paginationPageSize" [size]="paginationPageSize"
[selectionMode]="selectionMode" [selectionMode]="selectionMode"
[processDefinitionKey]="taskFilter?.filter?.processDefinitionKey"
[name]="taskFilter?.filter?.name" [name]="taskFilter?.filter?.name"
[assignment]="taskFilter?.filter?.assignment" [assignment]="taskFilter?.filter?.assignment"
[state]="taskFilter?.filter?.state" [state]="taskFilter?.filter?.state"
@@ -157,7 +156,6 @@
#processList #processList
*ngIf="processFilter?.filter" [appId]="processFilter?.appId" *ngIf="processFilter?.filter" [appId]="processFilter?.appId"
[selectionMode]="selectionMode" [selectionMode]="selectionMode"
[processDefinitionKey]="processFilter?.filter?.processDefinitionKey"
[presetColumn]="presetColumn" [presetColumn]="presetColumn"
[state]="processFilter?.filter?.state" [state]="processFilter?.filter?.state"
[page]="processPage" [page]="processPage"
@@ -231,12 +229,12 @@
<div class="adf-grid-item adf-reports-menu" fxFlex.gt-md="300px"> <div class="adf-grid-item adf-reports-menu" fxFlex.gt-md="300px">
<span><h5>Report List</h5></span> <span><h5>Report List</h5></span>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<analytics-report-list <adf-analytics-report-list
[appId]="appId" [appId]="appId"
[selectFirst]="selectFirstReport" [selectFirst]="selectFirstReport"
(reportClick)="onReportClick($event)" (reportClick)="onReportClick($event)"
#analyticsReportList> #analyticsReportList>
</analytics-report-list> </adf-analytics-report-list>
</div> </div>
<div class="adf-grid-item adf-reports-details" fxFlex.gt-md="1 1 auto"> <div class="adf-grid-item adf-reports-details" fxFlex.gt-md="1 1 auto">
<adf-analytics <adf-analytics
@@ -2,7 +2,7 @@
<div class="adf-no-form-container"> <div class="adf-no-form-container">
<adf-upload-drag-area <adf-upload-drag-area
[parentId]="taskId"> [rootFolderId]="taskId">
<adf-task-attachment-list #taskAttachList <adf-task-attachment-list #taskAttachList
[disabled]="isCompletedTask()" [disabled]="isCompletedTask()"
@@ -1,9 +1,4 @@
<div> <div>
<h3>{{'APP_LAYOUT.EXTENDED_SEARCH_QUERY_BODY' | translate}}</h3>
<mat-checkbox [(ngModel)]="useServiceApproach">
{{'APP_LAYOUT.SEARCH_SERVICE_APPROACH' | translate}}
</mat-checkbox>
<div id="container-for-custom-input" class="adf-search-extended-input-containers"> <div id="container-for-custom-input" class="adf-search-extended-input-containers">
<mat-form-field> <mat-form-field>
<label>{{'APP_LAYOUT.WORD_TO_SEARCH' | translate}}</label> <label>{{'APP_LAYOUT.WORD_TO_SEARCH' | translate}}</label>
@@ -13,7 +8,6 @@
</div> </div>
<div> <div>
<adf-search #auto="searchAutocomplete" <adf-search #auto="searchAutocomplete"
[queryBody]="generateQueryBody(searchedWord)"
class="adf-example-card-search-container"> class="adf-example-card-search-container">
<ng-template let-data> <ng-template let-data>
<mat-card class="adf-example-card" <mat-card class="adf-example-card"
@@ -16,7 +16,7 @@
*/ */
import { Component, ViewChild, ViewEncapsulation } from '@angular/core'; import { Component, ViewChild, ViewEncapsulation } from '@angular/core';
import { NodePaging, Pagination, QueryBody, MinimalNodeEntity } from '@alfresco/js-api'; import { Pagination, QueryBody, MinimalNodeEntity } from '@alfresco/js-api';
import { SearchComponent } from '@alfresco/adf-content-services'; import { SearchComponent } from '@alfresco/adf-content-services';
import { ThumbnailService } from '@alfresco/adf-core'; import { ThumbnailService } from '@alfresco/adf-core';
import { SearchService, SearchConfigurationService } from '@alfresco/adf-core'; import { SearchService, SearchConfigurationService } from '@alfresco/adf-core';
@@ -41,12 +41,10 @@ export class SearchExtendedComponent {
searchedWord = ''; searchedWord = '';
queryBodyString = ''; queryBodyString = '';
errorMessage = ''; errorMessage = '';
resultNodePageList: NodePaging;
maxItems: number; maxItems: number;
skipCount = 0; skipCount = 0;
pagination: Pagination; pagination: Pagination;
queryBody: QueryBody; queryBody: QueryBody;
useServiceApproach = false;
constructor(public thumbnailService: ThumbnailService) { constructor(public thumbnailService: ThumbnailService) {
@@ -65,20 +63,4 @@ export class SearchExtendedComponent {
return this.thumbnailService.getMimeTypeIcon(mimeType); return this.thumbnailService.getMimeTypeIcon(mimeType);
} }
generateQueryBody(searchTerm: string): QueryBody {
if (this.useServiceApproach) {
return null;
} else {
return {
query: {
query: searchTerm ? `${searchTerm}* OR name:${searchTerm}*` : searchTerm
},
include: ['path', 'allowableOperations'],
filterQueries: [
/*tslint:disable-next-line */
{ query: "TYPE:'cm:folder' OR TYPE:'cm:content'" },
{ query: 'NOT cm:creator:System' }]
};
}
}
} }
@@ -63,8 +63,6 @@ Displays the documents from a repository.
| currentFolderId | `string` | null | The ID of the folder node to display or a reserved string alias for special sources | | currentFolderId | `string` | null | The ID of the folder node to display or a reserved string alias for special sources |
| display | `string` | DisplayMode.List | Change the display mode of the table. Can be "list" or "gallery". | | display | `string` | DisplayMode.List | Change the display mode of the table. Can be "list" or "gallery". |
| emptyFolderImageUrl | `string` | | Custom image for empty folder. Default value: './assets/images/empty_doc_lib.svg' | | emptyFolderImageUrl | `string` | | Custom image for empty folder. Default value: './assets/images/empty_doc_lib.svg' |
| enableInfiniteScrolling | `boolean` | false | (**Deprecated:** 2.3.0) Set document list to work in infinite scrolling mode |
| folderNode | [`MinimalNodeEntryEntity`](../content-services/document-library.model.md) | null | (**Deprecated:** 2.3.0 - use currentFolderId or node) Currently displayed folder node |
| imageResolver | `any \| null` | null | Custom image resolver | | imageResolver | `any \| null` | null | Custom image resolver |
| includeFields | `string[]` | | Include additional information about the node in the server request. For example: association, isLink, isLocked and others. | | includeFields | `string[]` | | Include additional information about the node in the server request. For example: association, isLink, isLocked and others. |
| loading | `boolean` | false | Toggles the loading state and animated spinners for the component. Used in combination with `navigate=false` to perform custom navigation and loading state indication. | | loading | `boolean` | false | Toggles the loading state and animated spinners for the component. Used in combination with `navigate=false` to perform custom navigation and loading state indication. |
@@ -80,7 +78,6 @@ Displays the documents from a repository.
| rowStyleClass | `string` | | The CSS class to apply to every row | | rowStyleClass | `string` | | The CSS class to apply to every row |
| selectionMode | `string` | "single" | Row selection mode. Can be null, `single` or `multiple`. For `multiple` mode, you can use Cmd (macOS) or Ctrl (Win) modifier key to toggle selection for multiple rows. | | selectionMode | `string` | "single" | Row selection mode. Can be null, `single` or `multiple`. For `multiple` mode, you can use Cmd (macOS) or Ctrl (Win) modifier key to toggle selection for multiple rows. |
| showHeader | `boolean` | true | Toggles the header | | showHeader | `boolean` | true | Toggles the header |
| skipCount | `number` | 0 | (**Deprecated:** 2.3.0 - define it in pagination) Number of elements to skip over for pagination purposes |
| sorting | `string[]` | ['name', 'asc'] | Defines default sorting. The format is an array of 2 strings `[key, direction]` i.e. `['name', 'desc']` or `['name', 'asc']`. Set this value only if you want to override the default sorting detected by the component based on columns. | | sorting | `string[]` | ['name', 'asc'] | Defines default sorting. The format is an array of 2 strings `[key, direction]` i.e. `['name', 'desc']` or `['name', 'asc']`. Set this value only if you want to override the default sorting detected by the component based on columns. |
| sortingMode | `string` | "client" | Defines sorting mode. Can be either `client` (items in the list are sorted client-side) or `server` (the ordering supplied by the server is used without further client-side sorting). Note that the `server` option _does not_ request the server to sort the data before delivering it. | | sortingMode | `string` | "client" | Defines sorting mode. Can be either `client` (items in the list are sorted client-side) or `server` (the ordering supplied by the server is used without further client-side sorting). Note that the `server` option _does not_ request the server to sort the data before delivering it. |
| thumbnails | `boolean` | false | Show document thumbnails rather than icons | | thumbnails | `boolean` | false | Show document thumbnails rather than icons |
@@ -98,7 +95,7 @@ Displays the documents from a repository.
## Details ## Details
The properties `currentFolderId`, `folderNode` and `node` set the initial folder shown by The properties `currentFolderId` and `node` set the initial folder shown by
the Document List. They cannot be used together, so choose the one that suits your use case the Document List. They cannot be used together, so choose the one that suits your use case
best. best.
Document list will automatically show special icons for : `Smart Folder`, `Link to a Folder` and `Folder with rules` as showed in the picture below : Document list will automatically show special icons for : `Smart Folder`, `Link to a Folder` and `Folder with rules` as showed in the picture below :
@@ -175,12 +172,28 @@ Set the `[display]` property to "gallery" to enable card view mode:
### Pagination strategy ### Pagination strategy
The Document List by default supports 2 types of pagination: **finite** and **infinite**: The Document List by default supports 2 types of pagination: [Pagination component](../core/pagination.component.md) and [Infinite pagination component](../core/infinite-pagination.component.md)
- With **finite** pagination, the Document List needs 2 parameters: `maxItems` and `skipCount`. These set the maximum number of items shown in a single page and the start #### Pagination component
offset of the first item in the page (ie, the number of items you need to skip to get there).
- You can enable **infinite** pagination by setting the same parameters plus an extra third ```html
parameter: `enableInfiniteScrolling`. <adf-document-list #documentList ...></adf-document-list>
<adf-pagination
[target]="documentList"">
</adf-pagination>
```
#### Infinite pagination component
```html
<adf-document-list #documentList ...></adf-document-list>
<adf-infinite-pagination
[target]="documentList"
[loading]="documentList.infiniteLoading">
</adf-infinite-pagination>
```
### Data Sources ### Data Sources
@@ -447,7 +460,7 @@ Now you can access Document List properties or call methods directly:
```ts ```ts
// print currently displayed folder node object to console // print currently displayed folder node object to console
console.log(documentList.folderNode); console.log(documentList.currentFolderId);
``` ```
**Important note**: **Important note**:
@@ -660,7 +673,7 @@ actions you have defined in a context menu:
selector: 'my-view', selector: 'my-view',
template: ` template: `
<adf-document-list [contextMenuActions]="true">...</adf-document-list> <adf-document-list [contextMenuActions]="true">...</adf-document-list>
<context-menu-holder></context-menu-holder> <adf-context-menu-holder></context-menu-holder>
` `
}) })
export class MyView { export class MyView {
@@ -54,11 +54,6 @@ Implements node operations used by the [Document List component](../content-serv
- _nodeId:_ `string` - ID of the target node - _nodeId:_ `string` - ID of the target node
- _includeFields:_ `string[]` - Extra information to include (available options are "aspectNames", "isLink" and "association") - _includeFields:_ `string[]` - Extra information to include (available options are "aspectNames", "isLink" and "association")
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md)`>` - Details of the folder - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`NodeEntry`](https://github.com/Alfresco/alfresco-js-api/blob/master/src/alfresco-core-rest-api/docs/NodeEntry.md)`>` - Details of the folder
- **hasPermission**(node: `any`, permission: [`PermissionsEnum`](../../lib/core/models/permissions.enum.ts)`|string`): `boolean`<br/>
(**Deprecated:** 2.3.0 - use the equivalent in the content service) Checks if a node has the specified permission.
- _node:_ `any` - Target node
- _permission:_ [`PermissionsEnum`](../../lib/core/models/permissions.enum.ts)`|string` - Permission level to query
- **Returns** `boolean` - True if the node has the permission, false otherwise
- **moveNode**(nodeId: `string`, targetParentId: `string`): `any`<br/> - **moveNode**(nodeId: `string`, targetParentId: `string`): `any`<br/>
Moves a node to destination node. Moves a node to destination node.
- _nodeId:_ `string` - The id of the node to be moved - _nodeId:_ `string` - The id of the node to be moved
@@ -47,7 +47,6 @@ Some sample CSS to show the drag and drop area:
| Name | Type | Description | | Name | Type | Description |
| ---- | ---- | ----------- | | ---- | ---- | ----------- |
| filesDropped | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<File[]>` | Emitted when one or more files are dragged and dropped onto the draggable element. | | filesDropped | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<File[]>` | Emitted when one or more files are dragged and dropped onto the draggable element. |
| filesEntityDropped | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | (**Deprecated:** in 2.4.0: use `filesDropped` instead) Emitted when one or more files are dragged and dropped onto the draggable element. |
| folderEntityDropped | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when a directory is dragged and dropped onto the draggable element. | | folderEntityDropped | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when a directory is dragged and dropped onto the draggable element. |
## Details ## Details
@@ -43,7 +43,6 @@ You can show your own custom template when no results are found for the search:
| Name | Type | Default value | Description | | Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- | | ---- | ---- | ------------- | ----------- |
| autocomplete | `boolean` | false | Toggles auto-completion of the search input field. | | autocomplete | `boolean` | false | Toggles auto-completion of the search input field. |
| customQueryBody | `QueryBody` | | (**Deprecated:** in 2.1.0) |
| expandable | `boolean` | true | Toggles whether to use an expanding search control. If false then a regular input is used. | | expandable | `boolean` | true | Toggles whether to use an expanding search control. If false then a regular input is used. |
| highlight | `boolean` | false | Toggles highlighting of the search term in the results. | | highlight | `boolean` | false | Toggles highlighting of the search term in the results. |
| inputType | `string` | "text" | Type of the input field to render, e.g. "search" or "text" (default). | | inputType | `string` | "text" | Type of the input field to render, e.g. "search" or "text" (default). |
+1 -2
View File
@@ -38,7 +38,6 @@ Searches items for supplied search terms.
| ---- | ---- | ------------- | ----------- | | ---- | ---- | ------------- | ----------- |
| displayWith | `Function \| null` | null | Function that maps an option's value to its display value in the trigger. | | displayWith | `Function \| null` | null | Function that maps an option's value to its display value in the trigger. |
| maxResults | `number` | 20 | Maximum number of results to show in the search. | | maxResults | `number` | 20 | Maximum number of results to show in the search. |
| queryBody | `QueryBody` | | (**Deprecated:** in 2.1.0) |
| searchTerm | `string` | "" | Search term to use when executing the search. Updating this value will run a new search and update the results. | | searchTerm | `string` | "" | Search term to use when executing the search. Updating this value will run a new search and update the results. |
| skipResults | `number` | 0 | Number of results to skip from the results pagination. | | skipResults | `number` | 0 | Number of results to skip from the results pagination. |
@@ -153,7 +152,7 @@ By doing this, you can get the results as the user types into the input text.
You can get finer control over the parameters of a search by defining them in a custom You can get finer control over the parameters of a search by defining them in a custom
[QueryBody](https://github.com/Alfresco/alfresco-js-api/blob/1.6.0/src/alfresco-search-rest-api/docs/QueryBody.md) [QueryBody](https://github.com/Alfresco/alfresco-js-api/blob/1.6.0/src/alfresco-search-rest-api/docs/QueryBody.md)
object. The recommended way to do this is with a custom implementation of the object. The recommended way to do this is with a custom implementation of the
[Search Configuration interface](../core/search-configuration.interface.md) (the `queryBody` parameter of the [`Search component`](../content-services/search.component.md) is now deprecated). The ADF source provides a standard implementation of this . The ADF source provides a standard implementation of this
interface, [`SearchConfigurationService`](../core/search-configuration.service.md) that you can use as a base to adapt to your needs. See the interface, [`SearchConfigurationService`](../core/search-configuration.service.md) that you can use as a base to adapt to your needs. See the
[Search Configuration interface](../core/search-configuration.interface.md) page for full details of how to [Search Configuration interface](../core/search-configuration.interface.md) page for full details of how to
customize your search. customize your search.
@@ -68,14 +68,13 @@ as the drag/drop target:
| nodeType | `string` | "cm:content" | Custom node type for uploaded file | | nodeType | `string` | "cm:content" | Custom node type for uploaded file |
| rootFolderId | `string` | "-root-" | The ID of the root. Use the nodeId for Content Services or the taskId/processId for Process Services. | | rootFolderId | `string` | "-root-" | The ID of the root. Use the nodeId for Content Services or the taskId/processId for Process Services. |
| versioning | `boolean` | false | Toggles versioning. | | versioning | `boolean` | false | Toggles versioning. |
| parentId | `void` | | (**Deprecated:** 2.4.0 - use rootFolderId ID of parent folder node) ID of parent folder node |
### Events ### Events
| Name | Type | Description | | Name | Type | Description |
| ---- | ---- | ----------- | | ---- | ---- | ----------- |
| beginUpload | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`UploadFilesEvent`](../../lib/content-services/upload/components/upload-files.event.ts)`>` | Emitted when the upload begins. | | beginUpload | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`UploadFilesEvent`](../../lib/content-services/upload/components/upload-files.event.ts)`>` | Emitted when the upload begins. |
| createFolder | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<Object>` | (**Deprecated:** 2.4.0 No longer used by the framework) Emitted when a folder is created. |
| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<Object>` | Emitted when an error occurs. | | error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<Object>` | Emitted when an error occurs. |
| success | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<Object>` | Emitted when the file is uploaded successfully. | | success | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<Object>` | Emitted when the file is uploaded successfully. |
@@ -22,7 +22,6 @@ Displays the version history of a node in a [Version Manager component](../conte
| Name | Type | Default value | Description | | Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- | | ---- | ---- | ------------- | ----------- |
| allowDownload | `boolean` | true | Enable/disable downloading a version of the current node. | | allowDownload | `boolean` | true | Enable/disable downloading a version of the current node. |
| id | `string` | | (**Deprecated:** in 2.3.0) |
| node | [`MinimalNodeEntryEntity`](../content-services/document-library.model.md) | | The target node. | | node | [`MinimalNodeEntryEntity`](../content-services/document-library.model.md) | | The target node. |
| showActions | `boolean` | true | Toggles showing/hiding of version actions | | showActions | `boolean` | true | Toggles showing/hiding of version actions |
| showComments | `boolean` | true | Toggles showing/hiding of comments | | showComments | `boolean` | true | Toggles showing/hiding of comments |
+1 -1
View File
@@ -13,7 +13,7 @@ Adds a context menu to a component.
```html ```html
<my-component [context-menu]="menuItems"></my-component> <my-component [context-menu]="menuItems"></my-component>
<context-menu-holder></context-menu-holder> <adf-context-menu-holder></context-menu-holder>
``` ```
```ts ```ts
+1 -1
View File
@@ -84,7 +84,7 @@ Any content in the body of `<adf-form>` will be shown when no form definition is
| formError | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FormFieldModel`](../core/form-field.model.md)`[]>` | Emitted when the supplied form values have a validation error. | | formError | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FormFieldModel`](../core/form-field.model.md)`[]>` | Emitted when the supplied form values have a validation error. |
| formLoaded | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FormModel`](../../lib/core/form/components/widgets/core/form.model.ts)`>` | Emitted when the form is loaded or reloaded. | | formLoaded | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FormModel`](../../lib/core/form/components/widgets/core/form.model.ts)`>` | Emitted when the form is loaded or reloaded. |
| formSaved | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FormModel`](../../lib/core/form/components/widgets/core/form.model.ts)`>` | Emitted when the form is submitted with the `Save` or custom outcomes. | | formSaved | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FormModel`](../../lib/core/form/components/widgets/core/form.model.ts)`>` | Emitted when the form is submitted with the `Save` or custom outcomes. |
| onError | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | (**Deprecated:** in 2.4.0, will be renamed as "error" in 3.x.x) Emitted when any error occurs. | | error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when any error occurs. |
## Details ## Details
-3
View File
@@ -67,9 +67,6 @@ class MyComponent {
Saves a form. Saves a form.
- `formId` - ID of the form to save - `formId` - ID of the form to save
- `formModel` - Model data for the form - `formModel` - Model data for the form
- `addFieldsToAForm(formId: string, formModel: FormDefinitionModel):`[`Observable`](http://reactivex.io/documentation/observable.html)`<any>`
- `formId` - ID of the form
- `formModel` - [`Form`](../../lib/process-services/task-list/models/form.model.ts) definition
- `searchFrom(name: string):`[`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - `searchFrom(name: string):`[`Observable`](http://reactivex.io/documentation/observable.html)`<any>`
Search for a form by name. Search for a form by name.
- `name` - The form name to search for - `name` - The form name to search for
-2
View File
@@ -40,8 +40,6 @@ Validates the URLs for ACS and APS and saves them in the user's local storage
| Name | Type | Description | | Name | Type | Description |
| ---- | ---- | ----------- | | ---- | ---- | ----------- |
| bpmHostChange | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<string>` | (**Deprecated:** in 2.4.0) Emitted when the bpm host URL is changed. |
| cancel | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<boolean>` | Emitted when the user cancels the changes. | | cancel | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<boolean>` | Emitted when the user cancels the changes. |
| ecmHostChange | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<string>` | (**Deprecated:** in 2.4.0) Emitted when the ecm host URL is changed. |
| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<string>` | Emitted when the URL is invalid. | | error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<string>` | Emitted when the URL is invalid. |
| success | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<boolean>` | Emitted when the changes are successfully applied. | | success | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<boolean>` | Emitted when the changes are successfully applied. |
@@ -40,7 +40,6 @@ Adds "infinite" pagination to the component it is used with.
| ---- | ---- | ------------- | ----------- | | ---- | ---- | ------------- | ----------- |
| isLoading | `boolean` | false | Is a new page loading? | | isLoading | `boolean` | false | Is a new page loading? |
| pageSize | `number` | | Number of items that are added with each "load more" event. | | pageSize | `number` | | Number of items that are added with each "load more" event. |
| pagination | [`PaginationModel`](../../lib/core/models/pagination.model.ts) | | (**Deprecated:** 2.3.0) [Pagination](../../lib/content-services/document-list/models/document-library.model.ts) object. |
| target | [`PaginatedComponent`](../../lib/core/pagination/paginated-component.interface.ts) | | Component that provides custom pagination support. | | target | [`PaginatedComponent`](../../lib/core/pagination/paginated-component.interface.ts) | | Component that provides custom pagination support. |
### Events ### Events
-2
View File
@@ -78,11 +78,9 @@ with custom input fields handled by your application or parent component:
| ---- | ---- | ------------- | ----------- | | ---- | ---- | ------------- | ----------- |
| backgroundImageUrl | `string` | | Path to a custom background image. | | backgroundImageUrl | `string` | | Path to a custom background image. |
| copyrightText | `string` | | The copyright text below the login box. | | copyrightText | `string` | | The copyright text below the login box. |
| disableCsrf | `boolean` | | (**Deprecated:** 3.0.0) Prevents the CSRF Token from being submitted. Only valid for Alfresco Process Services. |
| fieldsValidation | `any` | | Custom validation rules for the login form. | | fieldsValidation | `any` | | Custom validation rules for the login form. |
| logoImageUrl | `string` | | Path to a custom logo image. | | logoImageUrl | `string` | | Path to a custom logo image. |
| needHelpLink | `string` | "" | Sets the URL of the NEED HELP link in the footer. | | needHelpLink | `string` | "" | Sets the URL of the NEED HELP link in the footer. |
| providers | `string` | | (**Deprecated:** 3.0.0 - use the providers property in the the app.config.json) Possible valid values are ECM, BPM or ALL. |
| registerLink | `string` | "" | Sets the URL of the REGISTER link in the footer. | | registerLink | `string` | "" | Sets the URL of the REGISTER link in the footer. |
| showLoginActions | `boolean` | true | Should the extra actions (`Need Help`, `Register`, etc) be shown? | | showLoginActions | `boolean` | true | Should the extra actions (`Need Help`, `Register`, etc) be shown? |
| showRememberMe | `boolean` | true | Should the `Remember me` checkbox be shown? When selected, this option will remember the logged-in user after the browser is closed to avoid logging in repeatedly. | | showRememberMe | `boolean` | true | Should the `Remember me` checkbox be shown? When selected, this option will remember the logged-in user after the browser is closed to avoid logging in repeatedly. |
+1 -1
View File
@@ -87,7 +87,7 @@ for example). You can also use it in much the same way as you would with an HTML
```html ```html
<alfresco-upload-drag-area <alfresco-upload-drag-area
[parentId]="..." [rootFolderId]="..."
[versioning]="..." [versioning]="..."
[adf-node-permission]="'create'" [adf-node-permission]="'create'"
[adf-nodes]="getCurrentDocumentListNode()"> [adf-nodes]="getCurrentDocumentListNode()">
-2
View File
@@ -14,7 +14,6 @@ Restores deleted nodes to their original location.
```html ```html
<adf-toolbar title="toolbar example"> <adf-toolbar title="toolbar example">
<button mat-icon-button <button mat-icon-button
location="/files"
[adf-restore]="documentList.selection" [adf-restore]="documentList.selection"
(restore)="onRestore($event)"> (restore)="onRestore($event)">
<mat-icon>restore</mat-icon> <mat-icon>restore</mat-icon>
@@ -51,7 +50,6 @@ Restores deleted nodes to their original location.
| Name | Type | Default value | Description | | Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- | | ---- | ---- | ------------- | ----------- |
| location | `string` | "" | (**Deprecated:** 2.4.0) Path to restored node. |
| selection | `DeletedNodeEntry[]` | | Array of deleted nodes to restore. | | selection | `DeletedNodeEntry[]` | | Array of deleted nodes to restore. |
### Events ### Events
+1 -4
View File
@@ -1,7 +1,7 @@
--- ---
Title: Renditions service Title: Renditions service
Added: v2.0.0 Added: v2.0.0
Status: Deprecated Status: Active
--- ---
# [Renditions service](../../lib/core/services/renditions.service.ts "Defined in renditions.service.ts") # [Renditions service](../../lib/core/services/renditions.service.ts "Defined in renditions.service.ts")
@@ -27,9 +27,6 @@ Performs a format conversion on an item directly.
## Details ## Details
**Note:** This service is deprecated from v2.2.0 and may be removed in a future
version of ADF.
ACS allows content items to be converted to other formats for display or delivery. ACS allows content items to be converted to other formats for display or delivery.
For example, a raw text file might be converted to HTML to enable better formatting For example, a raw text file might be converted to HTML to enable better formatting
in a web browser or a PDF might be converted to an equivalent bitmap image. A in a web browser or a PDF might be converted to an equivalent bitmap image. A
+1 -1
View File
@@ -61,7 +61,7 @@ Displays the Start [`Form`](../../lib/process-services/task-list/models/form.mod
| formError | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FormFieldModel`](../core/form-field.model.md)`[]>` | Emitted when the supplied form values have a validation error. | | formError | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FormFieldModel`](../core/form-field.model.md)`[]>` | Emitted when the supplied form values have a validation error. |
| formLoaded | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FormModel`](../../lib/core/form/components/widgets/core/form.model.ts)`>` | Emitted when the form is loaded or reloaded. | | formLoaded | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FormModel`](../../lib/core/form/components/widgets/core/form.model.ts)`>` | Emitted when the form is loaded or reloaded. |
| formSaved | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FormModel`](../../lib/core/form/components/widgets/core/form.model.ts)`>` | Emitted when the form is submitted with the `Save` or custom outcomes. | | formSaved | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FormModel`](../../lib/core/form/components/widgets/core/form.model.ts)`>` | Emitted when the form is submitted with the `Save` or custom outcomes. |
| onError | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | (**Deprecated:** in 2.4.0, will be renamed as "error" in 3.x.x) Emitted when any error occurs. | | error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when any error occurs. |
| outcomeClick | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when the user clicks one of the outcome buttons that completes the form. | | outcomeClick | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when the user clicks one of the outcome buttons that completes the form. |
## Details ## Details
+1 -1
View File
@@ -34,7 +34,7 @@ Provides access to various APIs related to file upload features.
- **Returns** `boolean` - True if a file is uploading, false otherwise - **Returns** `boolean` - True if a file is uploading, false otherwise
- **uploadFilesInTheQueue**(emitter?: [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>`)<br/> - **uploadFilesInTheQueue**(emitter?: [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>`)<br/>
Finds all the files in the queue that are not yet uploaded and uploads them into the directory folder. Finds all the files in the queue that are not yet uploaded and uploads them into the directory folder.
- _emitter:_ [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` - (Optional) (Deprecated) Emitter to invoke on file status change - _emitter:_ [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` - (Optional) Emitter to invoke on file status change
## Events ## Events
+7 -9
View File
@@ -80,10 +80,9 @@ See the [Custom layout](#custom-layout) section for full details of all availabl
| allowFullScreen | `boolean` | true | Toggles the 'Full Screen' feature. | | allowFullScreen | `boolean` | true | Toggles the 'Full Screen' feature. |
| allowGoBack | `boolean` | true | Allows `back` navigation | | allowGoBack | `boolean` | true | Allows `back` navigation |
| allowLeftSidebar | `boolean` | false | Allow the left the sidebar. | | allowLeftSidebar | `boolean` | false | Allow the left the sidebar. |
| allowRightSidebar | `boolean` | false | Allow the right sidebar. |
| allowNavigate | `boolean` | false | Toggles before/next navigation. You can use the arrow buttons to navigate between documents in the collection. | | allowNavigate | `boolean` | false | Toggles before/next navigation. You can use the arrow buttons to navigate between documents in the collection. |
| allowPrint | `boolean` | false | Toggles printing. | | allowPrint | `boolean` | false | Toggles printing. |
| allowShare | `boolean` | false | (**Deprecated:** 2.5.0 - inject the share button directive as custom button) Toggles sharing. |
| allowSidebar | `boolean` | false | (**Deprecated:** 2.5.0 - will be renamed allowRightSidebar in 3.0.0) Allow the right sidebar. |
| allowThumbnails | `boolean` | true | Toggles PDF thumbnails. | | allowThumbnails | `boolean` | true | Toggles PDF thumbnails. |
| blobFile | [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) | | Loads a [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) File | | blobFile | [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) | | Loads a [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) File |
| canNavigateBefore | `boolean` | true | Toggles the "before" ("&lt;") button. Requires `allowNavigate` to be enabled. | | canNavigateBefore | `boolean` | true | Toggles the "before" ("&lt;") button. Requires `allowNavigate` to be enabled. |
@@ -96,13 +95,12 @@ See the [Custom layout](#custom-layout) section for full details of all availabl
| nodeId | `string` | null | Node Id of the file to load. | | nodeId | `string` | null | Node Id of the file to load. |
| overlayMode | `boolean` | false | If `true` then show the Viewer as a full page over the current content. Otherwise fit inside the parent div. | | overlayMode | `boolean` | false | If `true` then show the Viewer as a full page over the current content. Otherwise fit inside the parent div. |
| sharedLinkId | `string` | null | Shared link id (to display shared file). | | sharedLinkId | `string` | null | Shared link id (to display shared file). |
| showLeftSidebar | `boolean` | false | Toggles left sidebar visibility. Requires `allowSidebar` to be set to `true`. | | showLeftSidebar | `boolean` | false | Toggles left sidebar visibility. Requires `allowLeftSidebar` to be set to `true`. |
| showSidebar | `boolean` | false | (**Deprecated:** 2.5.0 - will be renamed showRightSidebar in 3.0.0) Toggles sidebar visibility. Requires `allowSidebar` to be set to `true`. | | showRightSidebar | `boolean` | false |Toggles Right sidebar visibility. Requires `allowRightSidebar` to be set to `true`. |
| showToolbar | `boolean` | true | Hide or show the toolbar | | showToolbar | `boolean` | true | Hide or show the toolbar |
| showViewer | `boolean` | true | Hide or show the viewer | | showViewer | `boolean` | true | Hide or show the viewer |
| sidebarLeftTemplate | [`TemplateRef`](https://angular.io/api/core/TemplateRef)`<any>` | null | The template for the left sidebar. The template context contains the loaded node data. | | sidebarLeftTemplate | [`TemplateRef`](https://angular.io/api/core/TemplateRef)`<any>` | null | The template for the left sidebar. The template context contains the loaded node data. |
| sidebarPosition | `string` | "right" | (**Deprecated:** 2.5.0 use sidebarTemplateLeft) The position of the sidebar. Can be `left` or `right`. | | sidebarRightTemplate | [`TemplateRef`](https://angular.io/api/core/TemplateRef)`<any>` | null | The template for right sidebar. The template context contains the loaded node data. |
| sidebarTemplate | [`TemplateRef`](https://angular.io/api/core/TemplateRef)`<any>` | null | (**Deprecated:** 2.5.0 renamed as sidebarRight) The template for the sidebar. The template context contains the loaded node data. |
| thumbnailsTemplate | [`TemplateRef`](https://angular.io/api/core/TemplateRef)`<any>` | null | The template for the pdf thumbnails. | | thumbnailsTemplate | [`TemplateRef`](https://angular.io/api/core/TemplateRef)`<any>` | null | The template for the pdf thumbnails. |
| urlFile | `string` | "" | If you want to load an external file that does not come from ACS you can use this URL to specify where to load the file from. | | urlFile | `string` | "" | If you want to load an external file that does not come from ACS you can use this URL to specify where to load the file from. |
| urlFileViewer | `string` | null | Viewer to use with the `urlFile` address (`pdf`, `image`, `media`, `text`). Used when `urlFile` has no filename and extension. | | urlFileViewer | `string` | null | Viewer to use with the `urlFile` address (`pdf`, `image`, `media`, `text`). Used when `urlFile` has no filename and extension. |
@@ -362,13 +360,13 @@ The result should look like this:
#### Custom sidebar #### Custom sidebar
The [Viewer component](../core/viewer.component.md) also supports custom sidebar components and layouts. The [Viewer component](../core/viewer.component.md) also supports custom sidebar components and layouts.
Set the `allowSidebar` property to `true` to enable this feature. Set the `allowRightSidebar` property to `true` to enable this feature.
The custom sidebar can be injected in two different ways. The first way is to use The custom sidebar can be injected in two different ways. The first way is to use
transclusion, which will display all content placed inside the `<adf-viewer-sidebar>` element: transclusion, which will display all content placed inside the `<adf-viewer-sidebar>` element:
```html ```html
<adf-viewer [allowSidebar]="true"> <adf-viewer [allowRightSidebar]="true">
<adf-viewer-sidebar> <adf-viewer-sidebar>
<h1>My info</h1> <h1>My info</h1>
</adf-viewer-sidebar> </adf-viewer-sidebar>
@@ -382,7 +380,7 @@ when using the viewer with `nodeId`.
<ng-template let-node="node" #sidebarTemplate> <ng-template let-node="node" #sidebarTemplate>
<adf-content-metadata-card [node]="node"></adf-content-metadata-card> <adf-content-metadata-card [node]="node"></adf-content-metadata-card>
</ng-template> </ng-template>
<adf-viewer [allowSidebar]="true" [sidebarTemplate]="sidebarTemplate"></adf-viewer> <adf-viewer [allowRightSidebar]="true" [sidebarRightTemplate]="sidebarTemplate"></adf-viewer>
``` ```
#### Custom thumbnails #### Custom thumbnails
@@ -84,7 +84,7 @@ a custom _no content template_ (using &lt;adf-empty-list>) to invite the user to
```html ```html
<adf-upload-drag-area <adf-upload-drag-area
[parentId]="YOUR_PROCESS_ID" [rootFolderId]="YOUR_PROCESS_ID"
[showNotificationBar]="BOOLEAN"> [showNotificationBar]="BOOLEAN">
<adf-process-attachment-list <adf-process-attachment-list
[processId]="YOUR_PROCESS_ID" [processId]="YOUR_PROCESS_ID"
@@ -56,8 +56,7 @@ when the process list is empty:
| multiselect | `boolean` | false | Toggles multiple row selection, which renders checkboxes at the beginning of each row | | multiselect | `boolean` | false | Toggles multiple row selection, which renders checkboxes at the beginning of each row |
| page | `number` | 0 | The page number of the processes to fetch. | | page | `number` | 0 | The page number of the processes to fetch. |
| processDefinitionId | `string` | | The Definition Id of the process. | | processDefinitionId | `string` | | The Definition Id of the process. |
| processDefinitionKey | `string` | | (**Deprecated:** 2.4.0) The Definition Key of the process. | | processInstanceId | `number` | | | The id of the process instance. |
| processInstanceId | `number \| string` | | The id of the process instance. |
| selectFirstRow | `boolean` | true | Toggles default selection of the first row | | selectFirstRow | `boolean` | true | Toggles default selection of the first row |
| selectionMode | `string` | "single" | Row selection mode. Can be none, `single` or `multiple`. For `multiple` mode, you can use Cmd (macOS) or Ctrl (Win) modifier key to toggle selection for multiple rows. | | selectionMode | `string` | "single" | Row selection mode. Can be none, `single` or `multiple`. For `multiple` mode, you can use Cmd (macOS) or Ctrl (Win) modifier key to toggle selection for multiple rows. |
| size | `number` | | The number of processes to fetch in each page. | | size | `number` | | The number of processes to fetch in each page. |
@@ -67,7 +67,7 @@ upload whenever the list is empty.
```html ```html
<adf-upload-drag-area <adf-upload-drag-area
[parentId]="YOUR_TASK_ID" [rootFolderId]="YOUR_TASK_ID"
[showNotificationBar]="BOOLEAN"> [showNotificationBar]="BOOLEAN">
<adf-task-attachment-list <adf-task-attachment-list
[taskId]="YOUR_TASK_ID" [taskId]="YOUR_TASK_ID"
@@ -64,7 +64,6 @@ when the task list is empty:
| name | `string` | | Name of the tasklist. | | name | `string` | | Name of the tasklist. |
| page | `number` | 0 | The page number of the tasks to fetch. | | page | `number` | 0 | The page number of the tasks to fetch. |
| processDefinitionId | `string` | | The Definition Id of the process. | | processDefinitionId | `string` | | The Definition Id of the process. |
| processDefinitionKey | `string` | | (**Deprecated:** 2.4.0) The Definition Key of the process. |
| processInstanceId | `string` | | The Instance Id of the process. | | processInstanceId | `string` | | The Instance Id of the process. |
| selectFirstRow | `boolean` | true | Toggles default selection of the first row | | selectFirstRow | `boolean` | true | Toggles default selection of the first row |
| selectionMode | `string` | "single" | Row selection mode. Can be none, `single` or `multiple`. For `multiple` mode, you can use Cmd (macOS) or Ctrl (Win) modifier key to toggle selection for multiple rows. | | selectionMode | `string` | "single" | Row selection mode. Can be none, `single` or `multiple`. For `multiple` mode, you can use Cmd (macOS) or Ctrl (Win) modifier key to toggle selection for multiple rows. |
@@ -28,4 +28,4 @@
[nodeId]="nodeId" [nodeId]="nodeId"
(goBack)="onGoBack($event)"> (goBack)="onGoBack($event)">
</adf-viewer> </adf-viewer>
<file-uploading-dialog></file-uploading-dialog> <adf-file-uploading-dialog></adf-file-uploading-dialog>
@@ -1,15 +1,15 @@
<header <header
mat-dialog-title mat-dialog-title
data-automation-id="content-node-selector-title">{{title || data?.title}} data-automation-id="content-node-selector-title">{{data?.title}}
</header> </header>
<mat-dialog-content> <mat-dialog-content>
<adf-content-node-selector-panel <adf-content-node-selector-panel
[currentFolderId]="currentFolderId || data?.currentFolderId" [currentFolderId]="data?.currentFolderId"
[dropdownHideMyFiles]="dropdownHideMyFiles || data?.dropdownHideMyFiles" [dropdownHideMyFiles]="data?.dropdownHideMyFiles"
[dropdownSiteList]="dropdownSiteList || data?.dropdownSiteList" [dropdownSiteList]="data?.dropdownSiteList"
[rowFilter]="rowFilter || data?.rowFilter" [rowFilter]="data?.rowFilter"
[imageResolver]="imageResolver || data?.imageResolver" [imageResolver]="data?.imageResolver"
[isSelectionValid]="data?.isSelectionValid" [isSelectionValid]="data?.isSelectionValid"
[breadcrumbTransform]="data?.breadcrumbTransform" [breadcrumbTransform]="data?.breadcrumbTransform"
[excludeSiteContent]="data?.excludeSiteContent" [excludeSiteContent]="data?.excludeSiteContent"
@@ -15,12 +15,10 @@
* limitations under the License. * limitations under the License.
*/ */
import { Component, Inject, ViewEncapsulation, Input } from '@angular/core'; import { Component, Inject, ViewEncapsulation } from '@angular/core';
import { MAT_DIALOG_DATA } from '@angular/material'; import { MAT_DIALOG_DATA } from '@angular/material';
import { Node, SitePaging } from '@alfresco/js-api'; import { Node } from '@alfresco/js-api';
import { ContentNodeSelectorComponentData } from './content-node-selector.component-data.interface'; import { ContentNodeSelectorComponentData } from './content-node-selector.component-data.interface';
import { RowFilter } from '../document-list/data/row-filter.model';
import { ImageResolver } from '../document-list/data/image-resolver.model';
@Component({ @Component({
selector: 'adf-content-node-selector', selector: 'adf-content-node-selector',
@@ -30,48 +28,6 @@ import { ImageResolver } from '../document-list/data/image-resolver.model';
}) })
export class ContentNodeSelectorComponent { export class ContentNodeSelectorComponent {
/**
* @deprecated in 2.1.0
*/
@Input()
title: string = null;
/**
* @deprecated in 2.1.0
*/
@Input()
currentFolderId: string = null;
/**
* @deprecated in 2.1.0
*/
@Input()
dropdownHideMyFiles: boolean = false;
/**
* @deprecated in 2.1.0
*/
@Input()
dropdownSiteList: SitePaging = null;
/**
* @deprecated in 2.1.0
*/
@Input()
rowFilter: RowFilter = null;
/**
* @deprecated in 2.1.0
*/
@Input()
imageResolver: ImageResolver = null;
/**
* @deprecated in 2.1.0
*/
@Input()
pageSize: number;
buttonActionName: string; buttonActionName: string;
chosenNode: Node[]; chosenNode: Node[];
@@ -147,7 +147,7 @@ describe('ShareDialogComponent', () => {
it('should open a confirmation dialog when unshare button is triggered', () => { it('should open a confirmation dialog when unshare button is triggered', () => {
spyOn(matDialog, 'open').and.returnValue({ beforeClose: () => of(false) }); spyOn(matDialog, 'open').and.returnValue({ beforeClose: () => of(false) });
spyOn(sharedLinksApiService, 'deleteSharedLink'); spyOn(sharedLinksApiService, 'deleteSharedLink').and.callThrough();
node.entry.properties['qshare:sharedId'] = 'sharedId'; node.entry.properties['qshare:sharedId'] = 'sharedId';
component.data = { component.data = {
@@ -167,7 +167,7 @@ describe('ShareDialogComponent', () => {
it('should unshare file when confirmation dialog returns true', fakeAsync(() => { it('should unshare file when confirmation dialog returns true', fakeAsync(() => {
spyOn(matDialog, 'open').and.returnValue({ beforeClose: () => of(true) }); spyOn(matDialog, 'open').and.returnValue({ beforeClose: () => of(true) });
spyOn(sharedLinksApiService, 'deleteSharedLink'); spyOn(sharedLinksApiService, 'deleteSharedLink').and.callThrough();
node.entry.properties['qshare:sharedId'] = 'sharedId'; node.entry.properties['qshare:sharedId'] = 'sharedId';
component.data = { component.data = {
@@ -187,7 +187,7 @@ describe('ShareDialogComponent', () => {
it('should not unshare file when confirmation dialog returns false', fakeAsync(() => { it('should not unshare file when confirmation dialog returns false', fakeAsync(() => {
spyOn(matDialog, 'open').and.returnValue({ beforeClose: () => of(false) }); spyOn(matDialog, 'open').and.returnValue({ beforeClose: () => of(false) });
spyOn(sharedLinksApiService, 'deleteSharedLink'); spyOn(sharedLinksApiService, 'deleteSharedLink').and.callThrough();
node.entry.properties['qshare:sharedId'] = 'sharedId'; node.entry.properties['qshare:sharedId'] = 'sharedId';
component.data = { component.data = {
@@ -72,6 +72,7 @@ describe('DocumentList', () => {
customResourcesService = TestBed.get(CustomResourcesService); customResourcesService = TestBed.get(CustomResourcesService);
documentList.ngOnInit(); documentList.ngOnInit();
documentList.currentFolderId = 'no-node';
spyGetSites = spyOn(apiService.sitesApi, 'getSites').and.returnValue(Promise.resolve(fakeGetSitesAnswer)); spyGetSites = spyOn(apiService.sitesApi, 'getSites').and.returnValue(Promise.resolve(fakeGetSitesAnswer));
spyFavorite = spyOn(apiService.favoritesApi, 'getFavorites').and.returnValue(Promise.resolve({ list: [] })); spyFavorite = spyOn(apiService.favoritesApi, 'getFavorites').and.returnValue(Promise.resolve({ list: [] }));
@@ -246,20 +247,17 @@ describe('DocumentList', () => {
expect(documentList.dataTable.resetSelection).toHaveBeenCalled(); expect(documentList.dataTable.resetSelection).toHaveBeenCalled();
}); });
it('should empty template be present when no element are present', (done) => { it('should empty template be present when no element are present', () => {
fixture.detectChanges(); spyOn(documentList, 'loadFolderNodesByFolderNodeId').and.returnValue(Promise.resolve(''));
documentList.folderNode = new NodeMinimal(); spyOn(documentList, 'loadFolder').and.callThrough();
documentList.folderNode.id = '1d26e465-dea3-42f3-b415-faa8364b9692'; spyOn(documentListService, 'getFolderNode').and.returnValue(of({ entry: { id: 'fake-node' } }));
spyOn(documentListService, 'getFolder').and.returnValue(of(fakeNodeAnswerWithNOEntries)); spyOn(documentListService, 'getFolder').and.returnValue(of(fakeNodeAnswerWithNOEntries));
let disposableReady = documentList.ready.subscribe(() => { documentList.currentFolderId = '1d26e465-dea3-42f3-b415-faa8364b9692';
expect(element.querySelector('#adf-document-list-empty')).toBeDefined(); fixture.detectChanges();
disposableReady.unsubscribe();
done();
});
documentList.reload(); documentList.reload();
expect(element.querySelector('#adf-document-list-empty')).toBeDefined();
}); });
it('should not execute action without node provided', () => { it('should not execute action without node provided', () => {
@@ -959,10 +957,9 @@ describe('DocumentList', () => {
}); });
it('should load folder by ID on init', () => { it('should load folder by ID on init', () => {
documentList.currentFolderId = '1d26e465-dea3-42f3-b415-faa8364b9692';
spyOn(documentList, 'loadFolder').and.returnValue(Promise.resolve()); spyOn(documentList, 'loadFolder').and.returnValue(Promise.resolve());
documentList.ngOnChanges({ folderNode: new SimpleChange(null, documentList.currentFolderId, true) }); documentList.ngOnChanges({ currentFolderId: new SimpleChange(null, '1d26e465-dea3-42f3-b415-faa8364b9692', true) });
expect(documentList.loadFolder).toHaveBeenCalled(); expect(documentList.loadFolder).toHaveBeenCalled();
}); });
@@ -1294,7 +1291,6 @@ describe('DocumentList', () => {
spyOn(documentList, 'reload').and.stub(); spyOn(documentList, 'reload').and.stub();
documentList.maxItems = 0; documentList.maxItems = 0;
documentList.skipCount = 0;
documentList.updatePagination({ documentList.updatePagination({
maxItems: 10, maxItems: 10,
@@ -1313,32 +1309,6 @@ describe('DocumentList', () => {
expect(documentList.reload).not.toHaveBeenCalled(); expect(documentList.reload).not.toHaveBeenCalled();
}); });
it('should NOT reload data on ngOnChanges upon reset of skipCount to 0', () => {
spyOn(documentList, 'reload').and.stub();
documentList.maxItems = 10;
documentList.skipCount = 10;
const firstChange = true;
documentList.ngOnChanges({ skipCount: new SimpleChange(undefined, 0, !firstChange) });
expect(documentList.reload).not.toHaveBeenCalled();
});
it('should reload data upon changing pagination setting skipCount to 0', () => {
spyOn(documentList, 'reload').and.stub();
documentList.maxItems = 5;
documentList.skipCount = 5;
documentList.updatePagination({
maxItems: 5,
skipCount: 0
});
expect(documentList.reload).toHaveBeenCalled();
});
it('should add includeFields in the server request when present', () => { it('should add includeFields in the server request when present', () => {
fixture.detectChanges(); fixture.detectChanges();
documentList.currentFolderId = 'fake-id'; documentList.currentFolderId = 'fake-id';
@@ -173,13 +173,6 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
@Input() @Input()
currentFolderId: string = null; currentFolderId: string = null;
/**
* Currently displayed folder node
* @deprecated 2.3.0 - use currentFolderId or node
*/
@Input()
folderNode: Node = null;
/** The Document list will show all the nodes contained in the NodePaging entity */ /** The Document list will show all the nodes contained in the NodePaging entity */
@Input() @Input()
node: NodePaging = null; node: NodePaging = null;
@@ -188,20 +181,6 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
@Input() @Input()
maxItems: number; maxItems: number;
/**
* Number of elements to skip over for pagination purposes
* @deprecated 2.3.0 - define it in pagination
*/
@Input()
skipCount: number = 0;
/**
* Set document list to work in infinite scrolling mode
* @deprecated 2.3.0
*/
@Input()
enableInfiniteScrolling: boolean = false;
/** Emitted when the user clicks a list node */ /** Emitted when the user clicks a list node */
@Output() @Output()
nodeClick: EventEmitter<NodeEntityEvent> = new EventEmitter<NodeEntityEvent>(); nodeClick: EventEmitter<NodeEntityEvent> = new EventEmitter<NodeEntityEvent>();
@@ -239,6 +218,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
data: ShareDataTableAdapter; data: ShareDataTableAdapter;
noPermission: boolean = false; noPermission: boolean = false;
selection = new Array<NodeEntry>(); selection = new Array<NodeEntry>();
folderNode: Node = null;
private _pagination: BehaviorSubject<PaginationModel>; private _pagination: BehaviorSubject<PaginationModel>;
private layoutPresets = {}; private layoutPresets = {};
@@ -272,11 +252,6 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
return null; return null;
} }
/** @deprecated 2.3.0 define it in pagination */
get supportedPageSizes(): number[] {
return this.preferences.getDefaultPageSizes();
}
get hasCustomLayout(): boolean { get hasCustomLayout(): boolean {
return this.columnList && this.columnList.columns && this.columnList.columns.length > 0; return this.columnList && this.columnList.columns && this.columnList.columns.length > 0;
} }
@@ -296,7 +271,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
get pagination(): BehaviorSubject<PaginationModel> { get pagination(): BehaviorSubject<PaginationModel> {
if (!this._pagination) { if (!this._pagination) {
let maxItems = this.maxItems || this.preferences.paginationSize; let maxItems = this.maxItems || this.preferences.paginationSize;
let defaultPagination = <PaginationModel> { let defaultPagination = <PaginationModel> {
maxItems: maxItems, maxItems: maxItems,
skipCount: 0, skipCount: 0,
@@ -337,7 +312,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
ngOnInit() { ngOnInit() {
this.rowMenuCache = {}; this.rowMenuCache = {};
this.loadLayoutPresets(); this.loadLayoutPresets();
this.data = new ShareDataTableAdapter(this.documentListService, this.thumbnailService, null, this.getDefaultSorting(), this.sortingMode); this.data = new ShareDataTableAdapter(this.documentListService, this.thumbnailService, this.contentService, null, this.getDefaultSorting(), this.sortingMode);
this.data.thumbnails = this.thumbnails; this.data.thumbnails = this.thumbnails;
this.data.permissionsStyle = this.permissionsStyle; this.data.permissionsStyle = this.permissionsStyle;
@@ -375,7 +350,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
} }
if (!this.data) { if (!this.data) {
this.data = new ShareDataTableAdapter(this.documentListService, this.thumbnailService, schema, this.getDefaultSorting(), this.sortingMode); this.data = new ShareDataTableAdapter(this.documentListService, this.thumbnailService, this.contentService, schema, this.getDefaultSorting(), this.sortingMode);
} else if (schema && schema.length > 0) { } else if (schema && schema.length > 0) {
this.data.setColumns(schema); this.data.setColumns(schema);
} }
@@ -404,11 +379,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
} }
} }
if (changes.folderNode && changes.folderNode.currentValue) { if (changes.currentFolderId &&
this.currentFolderId = changes.folderNode.currentValue.id;
this.resetNewFolderPagination();
this.loadFolder();
} else if (changes.currentFolderId &&
changes.currentFolderId.currentValue && changes.currentFolderId.currentValue &&
changes.currentFolderId.currentValue !== changes.currentFolderId.previousValue) { changes.currentFolderId.currentValue !== changes.currentFolderId.previousValue) {
this.resetNewFolderPagination(); this.resetNewFolderPagination();
@@ -600,12 +571,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
this.setupDefaultColumns(this.currentFolderId); this.setupDefaultColumns(this.currentFolderId);
} }
if (this.folderNode) { this.loadFolderByNodeId(this.currentFolderId);
return this.loadFolderNodesByFolderNodeId(this.folderNode.id, this.pagination.getValue())
.catch((err) => this.handleError(err));
} else {
this.loadFolderByNodeId(this.currentFolderId);
}
} }
loadFolderByNodeId(nodeId: string) { loadFolderByNodeId(nodeId: string) {
@@ -15,10 +15,9 @@
* limitations under the License. * limitations under the License.
*/ */
import { DataRow, ObjectUtils, ThumbnailService } from '@alfresco/adf-core'; import { DataRow, ObjectUtils, ThumbnailService, ContentService } from '@alfresco/adf-core';
import { MinimalNode, NodeEntry } from '@alfresco/js-api'; import { MinimalNode, NodeEntry } from '@alfresco/js-api';
import { PermissionStyleModel } from './../models/permissions-style.model'; import { PermissionStyleModel } from './../models/permissions-style.model';
import { DocumentListService } from './../services/document-list.service';
export class ShareDataRow implements DataRow { export class ShareDataRow implements DataRow {
@@ -34,7 +33,7 @@ export class ShareDataRow implements DataRow {
} }
constructor(private obj: NodeEntry, constructor(private obj: NodeEntry,
private documentListService: DocumentListService, private contentService: ContentService,
private permissionsStyle: PermissionStyleModel[], private permissionsStyle: PermissionStyleModel[],
private thumbnailService?: ThumbnailService) { private thumbnailService?: ThumbnailService) {
if (!obj) { if (!obj) {
@@ -55,7 +54,7 @@ export class ShareDataRow implements DataRow {
if (this.applyPermissionStyleToFolder(nodeEntity.entry, currentPermissionsStyle) || this.applyPermissionStyleToFile(nodeEntity.entry, currentPermissionsStyle)) { if (this.applyPermissionStyleToFolder(nodeEntity.entry, currentPermissionsStyle) || this.applyPermissionStyleToFile(nodeEntity.entry, currentPermissionsStyle)) {
if (this.documentListService.hasPermission(nodeEntity.entry, currentPermissionsStyle.permission)) { if (this.contentService.hasPermission(nodeEntity.entry, currentPermissionsStyle.permission)) {
permissionsClasses += ` ${currentPermissionsStyle.css}`; permissionsClasses += ` ${currentPermissionsStyle.css}`;
} }
} }
@@ -74,7 +73,7 @@ export class ShareDataRow implements DataRow {
} }
isFolderAndHasPermissionToUpload(nodeEntry: NodeEntry): boolean { isFolderAndHasPermissionToUpload(nodeEntry: NodeEntry): boolean {
return this.isFolder(nodeEntry) && this.documentListService.hasPermission(nodeEntry.entry, 'create'); return this.isFolder(nodeEntry) && this.contentService.hasPermission(nodeEntry.entry, 'create');
} }
isFolder(nodeEntry: NodeEntry): boolean { isFolder(nodeEntry: NodeEntry): boolean {
@@ -24,21 +24,22 @@ import { ShareDataTableAdapter } from './share-datatable-adapter';
describe('ShareDataTableAdapter', () => { describe('ShareDataTableAdapter', () => {
let documentListService: DocumentListService; let documentListService: DocumentListService;
let contentService: ContentService;
beforeEach(() => { beforeEach(() => {
let imageUrl: string = 'http://<addresss>'; let imageUrl: string = 'http://<addresss>';
let contentService = new ContentService(null, null, null, null); contentService = new ContentService(null, null, null, null);
documentListService = new DocumentListService(null, contentService, null, null, null); documentListService = new DocumentListService(null, contentService, null, null, null);
spyOn(documentListService, 'getDocumentThumbnailUrl').and.returnValue(imageUrl); spyOn(documentListService, 'getDocumentThumbnailUrl').and.returnValue(imageUrl);
}); });
it('should use client sorting by default', () => { it('should use client sorting by default', () => {
const adapter = new ShareDataTableAdapter(documentListService, null, []); const adapter = new ShareDataTableAdapter(documentListService, null, contentService, []);
expect(adapter.sortingMode).toBe('client'); expect(adapter.sortingMode).toBe('client');
}); });
it('should not be case sensitive for sorting mode value', () => { it('should not be case sensitive for sorting mode value', () => {
const adapter = new ShareDataTableAdapter(documentListService, null, []); const adapter = new ShareDataTableAdapter(documentListService, null, contentService, []);
adapter.sortingMode = 'CLIENT'; adapter.sortingMode = 'CLIENT';
expect(adapter.sortingMode).toBe('client'); expect(adapter.sortingMode).toBe('client');
@@ -48,7 +49,7 @@ describe('ShareDataTableAdapter', () => {
}); });
it('should fallback to client sorting for unknown values', () => { it('should fallback to client sorting for unknown values', () => {
const adapter = new ShareDataTableAdapter(documentListService, null, []); const adapter = new ShareDataTableAdapter(documentListService, null, contentService, []);
adapter.sortingMode = 'SeRvEr'; adapter.sortingMode = 'SeRvEr';
expect(adapter.sortingMode).toBe('server'); expect(adapter.sortingMode).toBe('server');
@@ -59,27 +60,27 @@ describe('ShareDataTableAdapter', () => {
it('should setup rows and columns with constructor', () => { it('should setup rows and columns with constructor', () => {
let schema = [<DataColumn> {}]; let schema = [<DataColumn> {}];
let adapter = new ShareDataTableAdapter(documentListService, null, schema); let adapter = new ShareDataTableAdapter(documentListService, null, contentService, schema);
expect(adapter.getRows()).toEqual([]); expect(adapter.getRows()).toEqual([]);
expect(adapter.getColumns()).toEqual(schema); expect(adapter.getColumns()).toEqual(schema);
}); });
it('should setup columns when constructor is missing schema', () => { it('should setup columns when constructor is missing schema', () => {
const adapter = new ShareDataTableAdapter(documentListService, null, null); const adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
expect(adapter.getColumns()).toEqual([]); expect(adapter.getColumns()).toEqual([]);
}); });
it('should set new columns', () => { it('should set new columns', () => {
let columns = [<DataColumn> {}, <DataColumn> {}]; let columns = [<DataColumn> {}, <DataColumn> {}];
let adapter = new ShareDataTableAdapter(documentListService, null, null); let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
adapter.setColumns(columns); adapter.setColumns(columns);
expect(adapter.getColumns()).toEqual(columns); expect(adapter.getColumns()).toEqual(columns);
}); });
it('should reset columns', () => { it('should reset columns', () => {
let columns = [<DataColumn> {}, <DataColumn> {}]; let columns = [<DataColumn> {}, <DataColumn> {}];
let adapter = new ShareDataTableAdapter(documentListService, null, columns); let adapter = new ShareDataTableAdapter(documentListService, null, contentService, columns);
expect(adapter.getColumns()).toEqual(columns); expect(adapter.getColumns()).toEqual(columns);
adapter.setColumns(null); adapter.setColumns(null);
@@ -88,7 +89,7 @@ describe('ShareDataTableAdapter', () => {
it('should set new rows', () => { it('should set new rows', () => {
let rows = [<DataRow> {}, <DataRow> {}]; let rows = [<DataRow> {}, <DataRow> {}];
let adapter = new ShareDataTableAdapter(documentListService, null, null); let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
expect(adapter.getRows()).toEqual([]); expect(adapter.getRows()).toEqual([]);
adapter.setRows(rows); adapter.setRows(rows);
@@ -97,7 +98,7 @@ describe('ShareDataTableAdapter', () => {
it('should reset rows', () => { it('should reset rows', () => {
let rows = [<DataRow> {}, <DataRow> {}]; let rows = [<DataRow> {}, <DataRow> {}];
let adapter = new ShareDataTableAdapter(documentListService, null, null); let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
adapter.setRows(rows); adapter.setRows(rows);
expect(adapter.getRows()).toEqual(rows); expect(adapter.getRows()).toEqual(rows);
@@ -107,7 +108,7 @@ describe('ShareDataTableAdapter', () => {
}); });
it('should sort new rows', () => { it('should sort new rows', () => {
let adapter = new ShareDataTableAdapter(documentListService, null, null); let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
spyOn(adapter, 'sort').and.callThrough(); spyOn(adapter, 'sort').and.callThrough();
let rows = [<DataRow> {}]; let rows = [<DataRow> {}];
@@ -117,7 +118,7 @@ describe('ShareDataTableAdapter', () => {
}); });
it('should fail when getting value for missing row', () => { it('should fail when getting value for missing row', () => {
let adapter = new ShareDataTableAdapter(documentListService, null, null); let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
let check = () => { let check = () => {
return adapter.getValue(null, <DataColumn> {}); return adapter.getValue(null, <DataColumn> {});
}; };
@@ -125,7 +126,7 @@ describe('ShareDataTableAdapter', () => {
}); });
it('should fail when getting value for missing column', () => { it('should fail when getting value for missing column', () => {
let adapter = new ShareDataTableAdapter(documentListService, null, null); let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
let check = () => { let check = () => {
return adapter.getValue(<DataRow> {}, null); return adapter.getValue(<DataRow> {}, null);
}; };
@@ -143,8 +144,8 @@ describe('ShareDataTableAdapter', () => {
type: 'string' type: 'string'
}; };
let row = new ShareDataRow(file, documentListService, null); let row = new ShareDataRow(file, contentService, null);
let adapter = new ShareDataTableAdapter(documentListService, null, null); let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
let value = adapter.getValue(row, col); let value = adapter.getValue(row, col);
expect(value).toBe(rawValue); expect(value).toBe(rawValue);
@@ -153,12 +154,12 @@ describe('ShareDataTableAdapter', () => {
it('should generate fallback icon for a file thumbnail with missing mime type', () => { it('should generate fallback icon for a file thumbnail with missing mime type', () => {
spyOn(documentListService, 'getDefaultMimeTypeIcon').and.returnValue(`assets/images/ft_ic_miscellaneous.svg`); spyOn(documentListService, 'getDefaultMimeTypeIcon').and.returnValue(`assets/images/ft_ic_miscellaneous.svg`);
let adapter = new ShareDataTableAdapter(documentListService, null, null); let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
let file = new FileNode(); let file = new FileNode();
file.entry.content.mimeType = null; file.entry.content.mimeType = null;
let row = new ShareDataRow(file, documentListService, null); let row = new ShareDataRow(file, contentService, null);
let col = <DataColumn> { type: 'image', key: '$thumbnail' }; let col = <DataColumn> { type: 'image', key: '$thumbnail' };
let value = adapter.getValue(row, col); let value = adapter.getValue(row, col);
@@ -169,12 +170,12 @@ describe('ShareDataTableAdapter', () => {
it('should generate fallback icon for a file with no content entry', () => { it('should generate fallback icon for a file with no content entry', () => {
spyOn(documentListService, 'getDefaultMimeTypeIcon').and.returnValue(`assets/images/ft_ic_miscellaneous.svg`); spyOn(documentListService, 'getDefaultMimeTypeIcon').and.returnValue(`assets/images/ft_ic_miscellaneous.svg`);
let adapter = new ShareDataTableAdapter(documentListService, null, null); let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
let file = new FileNode(); let file = new FileNode();
file.entry.content = null; file.entry.content = null;
let row = new ShareDataRow(file, documentListService, null); let row = new ShareDataRow(file, contentService, null);
let col = <DataColumn> { type: 'image', key: '$thumbnail' }; let col = <DataColumn> { type: 'image', key: '$thumbnail' };
let value = adapter.getValue(row, col); let value = adapter.getValue(row, col);
@@ -188,8 +189,8 @@ describe('ShareDataTableAdapter', () => {
let file = new FileNode(); let file = new FileNode();
file.entry['icon'] = imageUrl; file.entry['icon'] = imageUrl;
let adapter = new ShareDataTableAdapter(documentListService, null, null); let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
let row = new ShareDataRow(file, documentListService, null); let row = new ShareDataRow(file, contentService, null);
let col = <DataColumn> { type: 'image', key: 'icon' }; let col = <DataColumn> { type: 'image', key: 'icon' };
let value = adapter.getValue(row, col); let value = adapter.getValue(row, col);
@@ -199,9 +200,9 @@ describe('ShareDataTableAdapter', () => {
it('should resolve folder icon', () => { it('should resolve folder icon', () => {
spyOn(documentListService, 'getMimeTypeIcon').and.returnValue(`assets/images/ft_ic_folder.svg`); spyOn(documentListService, 'getMimeTypeIcon').and.returnValue(`assets/images/ft_ic_folder.svg`);
let adapter = new ShareDataTableAdapter(documentListService, null, null); let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
let row = new ShareDataRow(new FolderNode(), documentListService, null); let row = new ShareDataRow(new FolderNode(), contentService, null);
let col = <DataColumn> { type: 'image', key: '$thumbnail' }; let col = <DataColumn> { type: 'image', key: '$thumbnail' };
let value = adapter.getValue(row, col); let value = adapter.getValue(row, col);
@@ -212,9 +213,9 @@ describe('ShareDataTableAdapter', () => {
it('should resolve smart folder icon', () => { it('should resolve smart folder icon', () => {
spyOn(documentListService, 'getMimeTypeIcon').and.returnValue(`assets/images/ft_ic_smart_folder.svg`); spyOn(documentListService, 'getMimeTypeIcon').and.returnValue(`assets/images/ft_ic_smart_folder.svg`);
let adapter = new ShareDataTableAdapter(documentListService, null, null); let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
let row = new ShareDataRow(new SmartFolderNode(), documentListService, null); let row = new ShareDataRow(new SmartFolderNode(), contentService, null);
let col = <DataColumn> { type: 'folder', key: '$thumbnail' }; let col = <DataColumn> { type: 'folder', key: '$thumbnail' };
let value = adapter.getValue(row, col); let value = adapter.getValue(row, col);
@@ -225,9 +226,9 @@ describe('ShareDataTableAdapter', () => {
it('should resolve link folder icon', () => { it('should resolve link folder icon', () => {
spyOn(documentListService, 'getMimeTypeIcon').and.returnValue(`assets/images/ft_ic_folder_shortcut_link.svg`); spyOn(documentListService, 'getMimeTypeIcon').and.returnValue(`assets/images/ft_ic_folder_shortcut_link.svg`);
let adapter = new ShareDataTableAdapter(documentListService, null, null); let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
let row = new ShareDataRow(new LinkFolderNode(), documentListService, null); let row = new ShareDataRow(new LinkFolderNode(), contentService, null);
let col = <DataColumn> { type: 'folder', key: '$thumbnail' }; let col = <DataColumn> { type: 'folder', key: '$thumbnail' };
let value = adapter.getValue(row, col); let value = adapter.getValue(row, col);
@@ -238,9 +239,9 @@ describe('ShareDataTableAdapter', () => {
it('should resolve rule folder icon', () => { it('should resolve rule folder icon', () => {
spyOn(documentListService, 'getMimeTypeIcon').and.returnValue(`assets/images/ft_ic_folder_rule.svg`); spyOn(documentListService, 'getMimeTypeIcon').and.returnValue(`assets/images/ft_ic_folder_rule.svg`);
let adapter = new ShareDataTableAdapter(documentListService, null, null); let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
let row = new ShareDataRow(new RuleFolderNode(), documentListService, null); let row = new ShareDataRow(new RuleFolderNode(), contentService, null);
let col = <DataColumn> { type: 'folder', key: '$thumbnail' }; let col = <DataColumn> { type: 'folder', key: '$thumbnail' };
let value = adapter.getValue(row, col); let value = adapter.getValue(row, col);
@@ -250,11 +251,11 @@ describe('ShareDataTableAdapter', () => {
it('should resolve file thumbnail', () => { it('should resolve file thumbnail', () => {
let imageUrl = 'http://<addresss>'; let imageUrl = 'http://<addresss>';
let adapter = new ShareDataTableAdapter(documentListService, null, null); let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
adapter.thumbnails = true; adapter.thumbnails = true;
let file = new FileNode(); let file = new FileNode();
let row = new ShareDataRow(file, documentListService, null); let row = new ShareDataRow(file, contentService, null);
let col = <DataColumn> { type: 'image', key: '$thumbnail' }; let col = <DataColumn> { type: 'image', key: '$thumbnail' };
let value = adapter.getValue(row, col); let value = adapter.getValue(row, col);
@@ -265,14 +266,14 @@ describe('ShareDataTableAdapter', () => {
it('should resolve fallback file icon for unknown node', () => { it('should resolve fallback file icon for unknown node', () => {
spyOn(documentListService, 'getDefaultMimeTypeIcon').and.returnValue(`assets/images/ft_ic_miscellaneous.svg`); spyOn(documentListService, 'getDefaultMimeTypeIcon').and.returnValue(`assets/images/ft_ic_miscellaneous.svg`);
let adapter = new ShareDataTableAdapter(documentListService, null, null); let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
let file = new FileNode(); let file = new FileNode();
file.entry.isFile = false; file.entry.isFile = false;
file.entry.isFolder = false; file.entry.isFolder = false;
file.entry.content = null; file.entry.content = null;
let row = new ShareDataRow(file, documentListService, null); let row = new ShareDataRow(file, contentService, null);
let col = <DataColumn> { type: 'image', key: '$thumbnail' }; let col = <DataColumn> { type: 'image', key: '$thumbnail' };
let value = adapter.getValue(row, col); let value = adapter.getValue(row, col);
@@ -282,14 +283,14 @@ describe('ShareDataTableAdapter', () => {
it('should resolve file icon for content type', () => { it('should resolve file icon for content type', () => {
spyOn(documentListService, 'getMimeTypeIcon').and.returnValue(`assets/images/ft_ic_raster_image.svg`); spyOn(documentListService, 'getMimeTypeIcon').and.returnValue(`assets/images/ft_ic_raster_image.svg`);
let adapter = new ShareDataTableAdapter(documentListService, null, null); let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
let file = new FileNode(); let file = new FileNode();
file.entry.isFile = false; file.entry.isFile = false;
file.entry.isFolder = false; file.entry.isFolder = false;
file.entry.content.mimeType = 'image/png'; file.entry.content.mimeType = 'image/png';
let row = new ShareDataRow(file, documentListService, null); let row = new ShareDataRow(file, contentService, null);
let col = <DataColumn> { type: 'image', key: '$thumbnail' }; let col = <DataColumn> { type: 'image', key: '$thumbnail' };
let value = adapter.getValue(row, col); let value = adapter.getValue(row, col);
@@ -303,13 +304,13 @@ describe('ShareDataTableAdapter', () => {
let folder = new FolderNode(); let folder = new FolderNode();
let col = <DataColumn> { key: 'name' }; let col = <DataColumn> { key: 'name' };
let adapter = new ShareDataTableAdapter(documentListService, null, [col]); let adapter = new ShareDataTableAdapter(documentListService, null, contentService, [col]);
adapter.setSorting(new DataSorting('name', 'asc')); adapter.setSorting(new DataSorting('name', 'asc'));
adapter.setRows([ adapter.setRows([
new ShareDataRow(file2, documentListService, null), new ShareDataRow(file2, contentService, null),
new ShareDataRow(file1, documentListService, null), new ShareDataRow(file1, contentService, null),
new ShareDataRow(folder, documentListService, null) new ShareDataRow(folder, contentService, null)
]); ]);
let sorted = adapter.getRows(); let sorted = adapter.getRows();
@@ -326,11 +327,11 @@ describe('ShareDataTableAdapter', () => {
file2.entry['dateProp'] = new Date(2016, 6, 30, 13, 14, 2); file2.entry['dateProp'] = new Date(2016, 6, 30, 13, 14, 2);
let col = <DataColumn> { key: 'dateProp' }; let col = <DataColumn> { key: 'dateProp' };
let adapter = new ShareDataTableAdapter(documentListService, null, [col]); let adapter = new ShareDataTableAdapter(documentListService, null, contentService, [col]);
adapter.setRows([ adapter.setRows([
new ShareDataRow(file2, documentListService, null), new ShareDataRow(file2, contentService, null),
new ShareDataRow(file1, documentListService, null) new ShareDataRow(file1, contentService, null)
]); ]);
adapter.sort('dateProp', 'asc'); adapter.sort('dateProp', 'asc');
@@ -356,13 +357,13 @@ describe('ShareDataTableAdapter', () => {
file4.entry.content.sizeInBytes = 2852791665; // 2.66 GB file4.entry.content.sizeInBytes = 2852791665; // 2.66 GB
let col = <DataColumn> { key: 'content.sizeInBytes' }; let col = <DataColumn> { key: 'content.sizeInBytes' };
let adapter = new ShareDataTableAdapter(documentListService, null, [col]); let adapter = new ShareDataTableAdapter(documentListService, null, contentService, [col]);
adapter.setRows([ adapter.setRows([
new ShareDataRow(file3, documentListService, null), new ShareDataRow(file3, contentService, null),
new ShareDataRow(file4, documentListService, null), new ShareDataRow(file4, contentService, null),
new ShareDataRow(file1, documentListService, null), new ShareDataRow(file1, contentService, null),
new ShareDataRow(file2, documentListService, null) new ShareDataRow(file2, contentService, null)
]); ]);
adapter.sort('content.sizeInBytes', 'asc'); adapter.sort('content.sizeInBytes', 'asc');
@@ -389,15 +390,15 @@ describe('ShareDataTableAdapter', () => {
let file6 = new FileNode('b'); let file6 = new FileNode('b');
let col = <DataColumn> { key: 'name' }; let col = <DataColumn> { key: 'name' };
let adapter = new ShareDataTableAdapter(documentListService, null, [col]); let adapter = new ShareDataTableAdapter(documentListService, null, contentService, [col]);
adapter.setRows([ adapter.setRows([
new ShareDataRow(file4, documentListService, null), new ShareDataRow(file4, contentService, null),
new ShareDataRow(file6, documentListService, null), new ShareDataRow(file6, contentService, null),
new ShareDataRow(file3, documentListService, null), new ShareDataRow(file3, contentService, null),
new ShareDataRow(file1, documentListService, null), new ShareDataRow(file1, contentService, null),
new ShareDataRow(file2, documentListService, null), new ShareDataRow(file2, contentService, null),
new ShareDataRow(file5, documentListService, null) new ShareDataRow(file5, contentService, null)
]); ]);
adapter.sort('name', 'asc'); adapter.sort('name', 'asc');
@@ -423,25 +424,25 @@ describe('ShareDataTableAdapter', () => {
it('should wrap node', () => { it('should wrap node', () => {
let file = new FileNode(); let file = new FileNode();
let row = new ShareDataRow(file, documentListService, null); let row = new ShareDataRow(file, contentService, null);
expect(row.node).toBe(file); expect(row.node).toBe(file);
}); });
it('should require object source', () => { it('should require object source', () => {
expect(() => { expect(() => {
return new ShareDataRow(null, documentListService, null); return new ShareDataRow(null, contentService, null);
}).toThrowError(ShareDataRow.ERR_OBJECT_NOT_FOUND); }).toThrowError(ShareDataRow.ERR_OBJECT_NOT_FOUND);
}); });
it('should resolve value from node entry', () => { it('should resolve value from node entry', () => {
let file = new FileNode('test'); let file = new FileNode('test');
let row = new ShareDataRow(file, documentListService, null); let row = new ShareDataRow(file, contentService, null);
expect(row.getValue('name')).toBe('test'); expect(row.getValue('name')).toBe('test');
}); });
it('should check value', () => { it('should check value', () => {
let file = new FileNode('test'); let file = new FileNode('test');
let row = new ShareDataRow(file, documentListService, null); let row = new ShareDataRow(file, contentService, null);
expect(row.hasValue('name')).toBeTruthy(); expect(row.hasValue('name')).toBeTruthy();
expect(row.hasValue('missing')).toBeFalsy(); expect(row.hasValue('missing')).toBeFalsy();
@@ -450,21 +451,21 @@ describe('ShareDataTableAdapter', () => {
it('should be set as drop target when user has permission for that node', () => { it('should be set as drop target when user has permission for that node', () => {
let file = new FolderNode('test'); let file = new FolderNode('test');
file.entry['allowableOperations'] = ['create']; file.entry['allowableOperations'] = ['create'];
let row = new ShareDataRow(file, documentListService, null); let row = new ShareDataRow(file, contentService, null);
expect(row.isDropTarget).toBeTruthy(); expect(row.isDropTarget).toBeTruthy();
}); });
it('should not be set as drop target when user has permission for that node', () => { it('should not be set as drop target when user has permission for that node', () => {
let file = new FolderNode('test'); let file = new FolderNode('test');
let row = new ShareDataRow(file, documentListService, null); let row = new ShareDataRow(file, contentService, null);
expect(row.isDropTarget).toBeFalsy(); expect(row.isDropTarget).toBeFalsy();
}); });
it('should not be set as drop target when element is not a Folder', () => { it('should not be set as drop target when element is not a Folder', () => {
let file = new FileNode('test'); let file = new FileNode('test');
let row = new ShareDataRow(file, documentListService, null); let row = new ShareDataRow(file, contentService, null);
expect(row.isDropTarget).toBeFalsy(); expect(row.isDropTarget).toBeFalsy();
}); });
@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { DataColumn, DataRow, DataSorting, DataTableAdapter, ThumbnailService } from '@alfresco/adf-core'; import { DataColumn, DataRow, DataSorting, DataTableAdapter, ThumbnailService, ContentService } from '@alfresco/adf-core';
import { NodePaging } from '@alfresco/js-api'; import { NodePaging } from '@alfresco/js-api';
import { PermissionStyleModel } from './../models/permissions-style.model'; import { PermissionStyleModel } from './../models/permissions-style.model';
import { DocumentListService } from './../services/document-list.service'; import { DocumentListService } from './../services/document-list.service';
@@ -52,6 +52,7 @@ export class ShareDataTableAdapter implements DataTableAdapter {
constructor(private documentListService: DocumentListService, constructor(private documentListService: DocumentListService,
private thumbnailService: ThumbnailService, private thumbnailService: ThumbnailService,
private contentService: ContentService,
schema: DataColumn[] = [], schema: DataColumn[] = [],
sorting?: DataSorting, sorting?: DataSorting,
sortingMode: string = 'client') { sortingMode: string = 'client') {
@@ -241,7 +242,7 @@ export class ShareDataTableAdapter implements DataTableAdapter {
if (page && page.list) { if (page && page.list) {
let data = page.list.entries; let data = page.list.entries;
if (data && data.length > 0) { if (data && data.length > 0) {
rows = data.map((item) => new ShareDataRow(item, this.documentListService, this.permissionsStyle, this.thumbnailService)); rows = data.map((item) => new ShareDataRow(item, this.contentService, this.permissionsStyle, this.thumbnailService));
if (this.filter) { if (this.filter) {
rows = rows.filter(this.filter); rows = rows.filter(this.filter);
@@ -16,8 +16,7 @@
*/ */
import { import {
AlfrescoApiService, AuthenticationService, ContentService, LogService, AlfrescoApiService, AuthenticationService, ContentService, LogService, ThumbnailService
PermissionsEnum, ThumbnailService
} from '@alfresco/adf-core'; } from '@alfresco/adf-core';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
@@ -179,17 +178,6 @@ export class DocumentListService {
return this.thumbnailService.getDefaultMimeTypeIcon(); return this.thumbnailService.getDefaultMimeTypeIcon();
} }
/**
* Checks if a node has the specified permission.
* @deprecated 2.3.0 - use the equivalent in the content service
* @param node Target node
* @param permission Permission level to query
* @returns True if the node has the permission, false otherwise
*/
hasPermission(node: any, permission: PermissionsEnum | string): boolean {
return this.contentService.hasPermission(node, permission);
}
private handleError(error: any) { private handleError(error: any) {
this.logService.error(error); this.logService.error(error);
return throwError(error || 'Server error'); return throwError(error || 'Server error');
@@ -1,57 +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 {
AlfrescoApiService, AuthenticationService, ContentService,
SettingsService, LogService, ThumbnailService
} from '@alfresco/adf-core';
import { Observable, throwError } from 'rxjs';
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 throwError(this.getFolderRejectError);
}
return new Observable((observer) => {
observer.next(this.getFolderResult);
observer.complete();
});
}
deleteNode(nodeId: string) {
return new Observable((observer) => {
observer.next();
observer.complete();
});
}
}
-1
View File
@@ -17,6 +17,5 @@
export * from './document-library.model.mock'; export * from './document-library.model.mock';
export * from './document-list.component.mock'; export * from './document-list.component.mock';
export * from './document-list.service.mock';
export * from './search.component.mock'; export * from './search.component.mock';
export * from './search.service.mock'; export * from './search.service.mock';
@@ -118,7 +118,7 @@ export let errorJson = {
@Component({ @Component({
template: ` template: `
<adf-search [searchTerm]="searchedWord" [queryBody]="searchNode" [maxResults]="maxResults" <adf-search [searchTerm]="searchedWord" [maxResults]="maxResults"
(error)="showSearchResult('ERROR')" (error)="showSearchResult('ERROR')"
(success)="showSearchResult('success')" #search> (success)="showSearchResult('success')" #search>
<ng-template let-data> <ng-template let-data>
@@ -32,8 +32,7 @@
<adf-search #search <adf-search #search
#auto="searchAutocomplete" #auto="searchAutocomplete"
class="adf-search-result-autocomplete" class="adf-search-result-autocomplete"
[maxResults]="liveSearchMaxResults" [maxResults]="liveSearchMaxResults">
[queryBody]="customQueryBody">
<ng-template let-data> <ng-template let-data>
<mat-list *ngIf="isSearchBarActive()" id="autocomplete-search-result-list"> <mat-list *ngIf="isSearchBarActive()" id="autocomplete-search-result-list">
<mat-list-item <mat-list-item
@@ -19,7 +19,7 @@ import { AuthenticationService, ThumbnailService } from '@alfresco/adf-core';
import { animate, state, style, transition, trigger } from '@angular/animations'; import { animate, state, style, transition, trigger } from '@angular/animations';
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output, import { Component, EventEmitter, Input, OnDestroy, OnInit, Output,
QueryList, ViewEncapsulation, ViewChild, ViewChildren, ElementRef, TemplateRef, ContentChild } from '@angular/core'; QueryList, ViewEncapsulation, ViewChild, ViewChildren, ElementRef, TemplateRef, ContentChild } from '@angular/core';
import { NodeEntry, QueryBody } from '@alfresco/js-api'; import { NodeEntry } from '@alfresco/js-api';
import { Observable, Subject } from 'rxjs'; import { Observable, Subject } from 'rxjs';
import { SearchComponent } from './search.component'; import { SearchComponent } from './search.component';
import { MatListItem } from '@angular/material'; import { MatListItem } from '@angular/material';
@@ -72,10 +72,6 @@ export class SearchControlComponent implements OnInit, OnDestroy {
@Input() @Input()
liveSearchMaxResults: number = 5; liveSearchMaxResults: number = 5;
/** @deprecated in 2.1.0 */
@Input()
customQueryBody: QueryBody;
/** Emitted when the search is submitted by pressing the ENTER key. /** Emitted when the search is submitted by pressing the ENTER key.
* The search term is provided as the value of the event. * The search term is provided as the value of the event.
*/ */
@@ -17,22 +17,10 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { SearchService, setupTestBed, CoreModule } from '@alfresco/adf-core'; import { SearchService, setupTestBed, CoreModule } from '@alfresco/adf-core';
import { QueryBody } from '@alfresco/js-api'; import { differentResult, result, SimpleSearchTestComponent } from '../../mock';
import { differentResult, folderResult, result, SimpleSearchTestComponent } from '../../mock'; import { of, throwError } from 'rxjs';
import { Observable, of, throwError } from 'rxjs';
import { SearchModule } from '../search.module'; import { SearchModule } from '../search.module';
function fakeNodeResultSearch(searchNode: QueryBody): Observable<any> {
if (searchNode && searchNode.query.query === 'FAKE_SEARCH_EXMPL') {
return of(differentResult);
}
if (searchNode && searchNode.filterQueries.length === 1 &&
searchNode.filterQueries[0].query === "TYPE:'cm:folder'") {
return of(folderResult);
}
return of(result);
}
describe('SearchComponent', () => { describe('SearchComponent', () => {
let fixture: ComponentFixture<SimpleSearchTestComponent>, element: HTMLElement; let fixture: ComponentFixture<SimpleSearchTestComponent>, element: HTMLElement;
@@ -131,30 +119,6 @@ describe('SearchComponent', () => {
describe('search node', () => { describe('search node', () => {
it('should perform a search based on the query node given', (done) => {
spyOn(searchService, 'searchByQueryBody')
.and.callFake((searchObj) => fakeNodeResultSearch(searchObj));
let fakeSearchNode: QueryBody = {
query: {
query: 'TEST-FAKE-NODE'
},
filterQueries: [
{ 'query': "TYPE:'cm:folder'" }
]
};
component.setSearchWordTo('searchTerm');
component.setSearchNodeTo(fakeSearchNode);
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
let optionShowed = element.querySelectorAll('#autocomplete-search-result-list > li').length;
expect(optionShowed).toBe(1);
let folderOption: HTMLElement = <HTMLElement> element.querySelector('#result_option_0');
expect(folderOption.textContent.trim()).toBe('MyFolder');
done();
});
});
it('should perform a search with a defaultNode if no search node is given', (done) => { it('should perform a search with a defaultNode if no search node is given', (done) => {
spyOn(searchService, 'search').and.returnValue(of(result)); spyOn(searchService, 'search').and.returnValue(of(result));
component.setSearchWordTo('searchTerm'); component.setSearchWordTo('searchTerm');
@@ -168,29 +132,5 @@ describe('SearchComponent', () => {
done(); done();
}); });
}); });
it('should perform a search with the searchNode given', (done) => {
spyOn(searchService, 'searchByQueryBody')
.and.callFake((searchObj) => fakeNodeResultSearch(searchObj));
let fakeSearchNode: QueryBody = {
query: {
query: 'FAKE_SEARCH_EXMPL'
},
filterQueries: [
{ 'query': "TYPE:'cm:folder'" }
]
};
component.setSearchWordTo('searchTerm');
component.setSearchNodeTo(fakeSearchNode);
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
let optionShowed = element.querySelectorAll('#autocomplete-search-result-list > li').length;
expect(optionShowed).toBe(1);
let folderOption: HTMLElement = <HTMLElement> element.querySelector('#result_option_0');
expect(folderOption.textContent.trim()).toBe('TEST_DOC');
done();
});
});
}); });
}); });
@@ -29,7 +29,7 @@ import {
ViewChild, ViewChild,
ViewEncapsulation ViewEncapsulation
} from '@angular/core'; } from '@angular/core';
import { NodePaging, QueryBody } from '@alfresco/js-api'; import { NodePaging } from '@alfresco/js-api';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { debounceTime } from 'rxjs/operators'; import { debounceTime } from 'rxjs/operators';
@@ -64,10 +64,6 @@ export class SearchComponent implements AfterContentInit, OnChanges {
@Input() @Input()
skipResults: number = 0; skipResults: number = 0;
/** @deprecated in 2.1.0 */
@Input()
queryBody: QueryBody;
/** Search term to use when executing the search. Updating this value will /** Search term to use when executing the search. Updating this value will
* run a new search and update the results. * run a new search and update the results.
*/ */
@@ -129,10 +125,6 @@ export class SearchComponent implements AfterContentInit, OnChanges {
} }
ngOnChanges(changes) { ngOnChanges(changes) {
if (changes.queryBody &&
this.hasDifferentQueryBody(changes.queryBody.previousValue, changes.queryBody.currentValue)) {
this.loadSearchResults();
}
if (changes.searchTerm && changes.searchTerm.currentValue) { if (changes.searchTerm && changes.searchTerm.currentValue) {
this.loadSearchResults(changes.searchTerm.currentValue); this.loadSearchResults(changes.searchTerm.currentValue);
} }
@@ -147,10 +139,6 @@ export class SearchComponent implements AfterContentInit, OnChanges {
this.loadSearchResults(this.searchTerm); this.loadSearchResults(this.searchTerm);
} }
private hasDifferentQueryBody(previousQueryBody: QueryBody, currentQueryBody: QueryBody) {
return JSON.stringify(previousQueryBody) !== JSON.stringify(currentQueryBody);
}
private cleanResults() { private cleanResults() {
if (this.results) { if (this.results) {
this.results = {}; this.results = {};
@@ -160,17 +148,10 @@ export class SearchComponent implements AfterContentInit, OnChanges {
private loadSearchResults(searchTerm?: string) { private loadSearchResults(searchTerm?: string) {
this.resetResults(); this.resetResults();
if (searchTerm) { if (searchTerm) {
if (this.queryBody) { this.searchService.search(searchTerm, this.maxResults, this.skipResults).subscribe(
this.searchService.searchByQueryBody(this.queryBody).subscribe( (result) => this.onSearchDataLoaded(result),
(result) => this.onSearchDataLoaded(result), (err) => this.onSearchDataError(err)
(err) => this.onSearchDataError(err) );
);
} else {
this.searchService.search(searchTerm, this.maxResults, this.skipResults).subscribe(
(result) => this.onSearchDataLoaded(result),
(err) => this.onSearchDataError(err)
);
}
} else { } else {
this.cleanResults(); this.cleanResults();
} }
@@ -63,13 +63,6 @@ export abstract class UploadBase implements OnInit, OnDestroy {
@Output() @Output()
success = new EventEmitter(); success = new EventEmitter();
/**
* Emitted when a folder is created.
* @deprecated 2.4.0 No longer used by the framework
*/
@Output()
createFolder = new EventEmitter();
/** Emitted when an error occurs. */ /** Emitted when an error occurs. */
@Output() @Output()
error = new EventEmitter(); error = new EventEmitter();
@@ -23,9 +23,8 @@ import { ChangeDetectorRef, Component, Input, Output, EventEmitter, OnDestroy, O
import { Subscription, merge } from 'rxjs'; import { Subscription, merge } from 'rxjs';
import { FileUploadingListComponent } from './file-uploading-list.component'; import { FileUploadingListComponent } from './file-uploading-list.component';
// @deprecated file-uploading-dialog TODO remove in 3.0.0
@Component({ @Component({
selector: 'adf-file-uploading-dialog, file-uploading-dialog', selector: 'adf-file-uploading-dialog',
templateUrl: './file-uploading-dialog.component.html', templateUrl: './file-uploading-dialog.component.html',
styleUrls: ['./file-uploading-dialog.component.scss'] styleUrls: ['./file-uploading-dialog.component.scss']
}) })
@@ -151,18 +151,7 @@ describe('UploadDragAreaComponent', () => {
spyOn(uploadService, 'uploadFilesInTheQueue'); spyOn(uploadService, 'uploadFilesInTheQueue');
fixture.detectChanges(); fixture.detectChanges();
let itemEntity = { component.onFilesDropped([new File(['fakefake'], 'file-fake.png', { type: 'image/png' })]);
fullPath: '/folder-fake/file-fake.png',
isDirectory: false,
isFile: true,
relativeFolder: '/',
name: 'file-fake.png',
file: (callbackFile) => {
let fileFake = new File(['fakefake'], 'file-fake.png', { type: 'image/png' });
callbackFile(fileFake);
}
};
component.onFilesEntityDropped(itemEntity);
expect(uploadService.addToQueue).not.toHaveBeenCalled(); expect(uploadService.addToQueue).not.toHaveBeenCalled();
expect(uploadService.uploadFilesInTheQueue).not.toHaveBeenCalled(); expect(uploadService.uploadFilesInTheQueue).not.toHaveBeenCalled();
@@ -270,19 +259,9 @@ describe('UploadDragAreaComponent', () => {
component.success = null; component.success = null;
component.acceptedFilesType = '.png'; component.acceptedFilesType = '.png';
fixture.detectChanges(); fixture.detectChanges();
let itemEntity = {
fullPath: '/folder-fake/file-fake.png',
isDirectory: false,
isFile: true,
name: 'file-fake.png',
relativeFolder: '/',
file: (callbackFile) => {
let fileFake = new File(['fakefake'], 'file-fake.png', { type: 'image/png' });
callbackFile(fileFake);
}
};
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
component.onFilesEntityDropped(itemEntity); component.onFilesDropped([new File(['fakefake'], 'file-fake.png', { type: 'image/png' })]);
expect(uploadService.uploadFilesInTheQueue).toHaveBeenCalledWith(null); expect(uploadService.uploadFilesInTheQueue).toHaveBeenCalledWith(null);
}); });
})); }));
@@ -293,19 +272,8 @@ describe('UploadDragAreaComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
spyOn(uploadService, 'uploadFilesInTheQueue'); spyOn(uploadService, 'uploadFilesInTheQueue');
let itemEntity = {
fullPath: '/folder-fake/file-fake.png',
isDirectory: false,
isFile: true,
relativeFolder: '/',
name: 'file-fake.png',
file: (callbackFile) => {
let fileFake = new File(['fakefake'], 'file-fake.png', { type: 'image/png' });
callbackFile(fileFake);
}
};
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
component.onFilesEntityDropped(itemEntity); component.onFilesDropped([new File(['fakefake'], 'file-fake.png', { type: 'image/png' })]);
expect(uploadService.uploadFilesInTheQueue).not.toHaveBeenCalledWith(null); expect(uploadService.uploadFilesInTheQueue).not.toHaveBeenCalledWith(null);
}); });
})); }));
@@ -315,18 +283,7 @@ describe('UploadDragAreaComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
spyOn(uploadService, 'uploadFilesInTheQueue'); spyOn(uploadService, 'uploadFilesInTheQueue');
let itemEntity = { component.onFilesDropped([new File(['fakefake'], 'file-fake.png', { type: 'image/png' })]);
fullPath: '/folder-fake/file-fake.png',
isDirectory: false,
isFile: true,
name: 'file-fake.png',
relativeFolder: '/',
file: (callbackFile) => {
let fileFake = new File(['fakefake'], 'file-fake.png', { type: 'image/png' });
callbackFile(fileFake);
}
};
component.onFilesEntityDropped(itemEntity);
expect(uploadService.uploadFilesInTheQueue).toHaveBeenCalledWith(null); expect(uploadService.uploadFilesInTheQueue).toHaveBeenCalledWith(null);
})); }));
@@ -19,7 +19,7 @@ import {
EXTENDIBLE_COMPONENT, FileInfo, FileModel, FileUtils, NodePermissionSubject, EXTENDIBLE_COMPONENT, FileInfo, FileModel, FileUtils, NodePermissionSubject,
NotificationService, TranslationService, UploadService, ContentService, PermissionsEnum NotificationService, TranslationService, UploadService, ContentService, PermissionsEnum
} from '@alfresco/adf-core'; } from '@alfresco/adf-core';
import { Component, forwardRef, Input, ViewEncapsulation, NgZone } from '@angular/core'; import { Component, forwardRef, ViewEncapsulation, NgZone } from '@angular/core';
import { UploadBase } from './base-upload/upload-base'; import { UploadBase } from './base-upload/upload-base';
@Component({ @Component({
@@ -34,15 +34,6 @@ import { UploadBase } from './base-upload/upload-base';
}) })
export class UploadDragAreaComponent extends UploadBase implements NodePermissionSubject { export class UploadDragAreaComponent extends UploadBase implements NodePermissionSubject {
/**
* ID of parent folder node
* @deprecated 2.4.0 - use rootFolderId ID of parent folder node
*/
@Input()
set parentId(nodeId: string) {
this.rootFolderId = nodeId;
}
constructor(protected uploadService: UploadService, constructor(protected uploadService: UploadService,
protected translationService: TranslationService, protected translationService: TranslationService,
private notificationService: NotificationService, private notificationService: NotificationService,
@@ -62,21 +53,6 @@ export class UploadDragAreaComponent extends UploadBase implements NodePermissio
} }
} }
/**
* Called when the file are dropped in the drag area.
* @deprecated in 2.4.0: use `onFilesDropped` instead
* @param item - FileEntity
*/
onFilesEntityDropped(item: any): void {
if (!this.disabled) {
item.file((file: File) => {
// const fileModel = this.createFileModel(file, this.rootFolderId, item.fullPath.replace(item.name, ''));
this.uploadFiles([file]);
});
}
}
/** /**
* Called when a folder are dropped in the drag area * Called when a folder are dropped in the drag area
* *
@@ -35,13 +35,6 @@ export class FileDraggableDirective implements OnInit, OnDestroy {
@Output() @Output()
filesDropped: EventEmitter<File[]> = new EventEmitter<File[]>(); filesDropped: EventEmitter<File[]> = new EventEmitter<File[]>();
/**
* Emitted when one or more files are dragged and dropped onto the draggable element.
* @deprecated in 2.4.0: use `filesDropped` instead
*/
@Output()
filesEntityDropped: EventEmitter<any> = new EventEmitter();
/** Emitted when a directory is dragged and dropped onto the draggable element. */ /** Emitted when a directory is dragged and dropped onto the draggable element. */
@Output() @Output()
folderEntityDropped: EventEmitter<any> = new EventEmitter(); folderEntityDropped: EventEmitter<any> = new EventEmitter();
@@ -36,10 +36,6 @@ export class VersionListComponent implements OnChanges {
versions: VersionEntry[] = []; versions: VersionEntry[] = [];
isLoading = true; isLoading = true;
/** @deprecated in 2.3.0 */
@Input()
id: string;
/** The target node. */ /** The target node. */
@Input() @Input()
node: Node; node: Node;
@@ -23,7 +23,7 @@ import moment from 'moment-es6';
import { Moment } from 'moment'; import { Moment } from 'moment';
import { CardViewDateItemModel } from '../../models/card-view-dateitem.model'; import { CardViewDateItemModel } from '../../models/card-view-dateitem.model';
import { CardViewUpdateService } from '../../services/card-view-update.service'; import { CardViewUpdateService } from '../../services/card-view-update.service';
import { UserPreferencesService } from '../../../services/user-preferences.service'; import { UserPreferencesService, UserPreferenceValues } from '../../../services/user-preferences.service';
import { MomentDateAdapter } from '../../../utils/momentDateAdapter'; import { MomentDateAdapter } from '../../../utils/momentDateAdapter';
import { MOMENT_DATE_FORMATS } from '../../../utils/moment-date-formats.model'; import { MOMENT_DATE_FORMATS } from '../../../utils/moment-date-formats.model';
@@ -58,13 +58,14 @@ export class CardViewDateItemComponent implements OnInit {
constructor(private cardViewUpdateService: CardViewUpdateService, constructor(private cardViewUpdateService: CardViewUpdateService,
private dateAdapter: DateAdapter<Moment>, private dateAdapter: DateAdapter<Moment>,
private preferences: UserPreferencesService) { private userPreferencesService: UserPreferencesService) {
} }
ngOnInit() { ngOnInit() {
this.preferences.locale$.subscribe((locale) => { this.userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.dateAdapter.setLocale(locale); this.dateAdapter.setLocale(locale);
}); });
(<MomentDateAdapter> this.dateAdapter).overrideDisplayFormat = this.SHOW_FORMAT; (<MomentDateAdapter> this.dateAdapter).overrideDisplayFormat = this.SHOW_FORMAT;
if (this.property.value) { if (this.property.value) {
@@ -22,11 +22,8 @@ import { MatMenuTrigger } from '@angular/material';
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
import { ContextMenuService } from './context-menu.service'; import { ContextMenuService } from './context-menu.service';
/**
* @deprecated: context-menu-holder is deprecated, use adf-context-menu-holder instead.
*/
@Component({ @Component({
selector: 'adf-context-menu-holder, context-menu-holder', selector: 'adf-context-menu-holder',
template: ` template: `
<button mat-button [matMenuTriggerFor]="contextMenu"></button> <button mat-button [matMenuTriggerFor]="contextMenu"></button>
<mat-menu #contextMenu="matMenu" class="context-menu"> <mat-menu #contextMenu="matMenu" class="context-menu">
@@ -20,9 +20,8 @@
import { Directive, HostListener, Input } from '@angular/core'; import { Directive, HostListener, Input } from '@angular/core';
import { ContextMenuOverlayService } from './context-menu-overlay.service'; import { ContextMenuOverlayService } from './context-menu-overlay.service';
// @deprecated 2.3.0 context-menu tag removed
@Directive({ @Directive({
selector: '[adf-context-menu], [context-menu]' selector: '[context-menu]'
}) })
export class ContextMenuDirective { export class ContextMenuDirective {
/** Items for the menu. */ /** Items for the menu. */
@@ -40,13 +40,6 @@ export class NodeRestoreDirective {
@Input('adf-restore') @Input('adf-restore')
selection: DeletedNodeEntry[]; selection: DeletedNodeEntry[];
/**
* Path to restored node.
* @deprecated 2.4.0
*/
@Input()
location: string = '';
/** Emitted when restoration is complete. */ /** Emitted when restoration is complete. */
@Output() @Output()
restore: EventEmitter<RestoreMessageModel> = new EventEmitter(); restore: EventEmitter<RestoreMessageModel> = new EventEmitter();
+2 -3
View File
@@ -158,10 +158,9 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
/** /**
* Emitted when any error occurs. * Emitted when any error occurs.
* @deprecated in 2.4.0, will be renamed as "error" in 3.x.x
*/ */
@Output() @Output()
onError: EventEmitter<any> = new EventEmitter<any>(); error: EventEmitter<any> = new EventEmitter<any>();
debugMode: boolean = false; debugMode: boolean = false;
@@ -458,7 +457,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
} }
handleError(err: any): any { handleError(err: any): any {
this.onError.emit(err); this.error.emit(err);
} }
parseForm(json: any): FormModel { parseForm(json: any): FormModel {
@@ -23,7 +23,7 @@ import { DatetimeAdapter, MAT_DATETIME_FORMATS } from '@mat-datetimepicker/core'
import { MomentDatetimeAdapter, MAT_MOMENT_DATETIME_FORMATS } from '@mat-datetimepicker/moment'; import { MomentDatetimeAdapter, MAT_MOMENT_DATETIME_FORMATS } from '@mat-datetimepicker/moment';
import moment from 'moment-es6'; import moment from 'moment-es6';
import { Moment } from 'moment'; import { Moment } from 'moment';
import { UserPreferencesService } from '../../../../services/user-preferences.service'; import { UserPreferencesService, UserPreferenceValues } from '../../../../services/user-preferences.service';
import { MomentDateAdapter } from '../../../../utils/momentDateAdapter'; import { MomentDateAdapter } from '../../../../utils/momentDateAdapter';
import { MOMENT_DATE_FORMATS } from '../../../../utils/moment-date-formats.model'; import { MOMENT_DATE_FORMATS } from '../../../../utils/moment-date-formats.model';
import { FormService } from './../../../services/form.service'; import { FormService } from './../../../services/form.service';
@@ -49,14 +49,15 @@ export class DateTimeWidgetComponent extends WidgetComponent implements OnInit {
constructor(public formService: FormService, constructor(public formService: FormService,
private dateAdapter: DateAdapter<Moment>, private dateAdapter: DateAdapter<Moment>,
private preferences: UserPreferencesService) { private userPreferencesService: UserPreferencesService) {
super(formService); super(formService);
} }
ngOnInit() { ngOnInit() {
this.preferences.locale$.subscribe((locale) => { this.userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.dateAdapter.setLocale(locale); this.dateAdapter.setLocale(locale);
}); });
let momentDateAdapter = <MomentDateAdapter> this.dateAdapter; let momentDateAdapter = <MomentDateAdapter> this.dateAdapter;
momentDateAdapter.overrideDisplayFormat = this.field.dateDisplayFormat; momentDateAdapter.overrideDisplayFormat = this.field.dateDisplayFormat;
@@ -17,7 +17,7 @@
/* tslint:disable:component-selector */ /* tslint:disable:component-selector */
import { UserPreferencesService } from '../../../../services/user-preferences.service'; import { UserPreferencesService, UserPreferenceValues } from '../../../../services/user-preferences.service';
import { MomentDateAdapter } from '../../../../utils/momentDateAdapter'; import { MomentDateAdapter } from '../../../../utils/momentDateAdapter';
import { MOMENT_DATE_FORMATS } from '../../../../utils/moment-date-formats.model'; import { MOMENT_DATE_FORMATS } from '../../../../utils/moment-date-formats.model';
import { Component, OnInit, ViewEncapsulation } from '@angular/core'; import { Component, OnInit, ViewEncapsulation } from '@angular/core';
@@ -46,14 +46,15 @@ export class DateWidgetComponent extends WidgetComponent implements OnInit {
constructor(public formService: FormService, constructor(public formService: FormService,
private dateAdapter: DateAdapter<Moment>, private dateAdapter: DateAdapter<Moment>,
private preferences: UserPreferencesService) { private userPreferencesService: UserPreferencesService) {
super(formService); super(formService);
} }
ngOnInit() { ngOnInit() {
this.preferences.locale$.subscribe((locale) => { this.userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.dateAdapter.setLocale(locale); this.dateAdapter.setLocale(locale);
}); });
let momentDateAdapter = <MomentDateAdapter> this.dateAdapter; let momentDateAdapter = <MomentDateAdapter> this.dateAdapter;
momentDateAdapter.overrideDisplayFormat = this.field.dateDisplayFormat; momentDateAdapter.overrideDisplayFormat = this.field.dateDisplayFormat;
@@ -17,7 +17,7 @@
/* tslint:disable:component-selector */ /* tslint:disable:component-selector */
import { UserPreferencesService } from '../../../../../../services/user-preferences.service'; import { UserPreferencesService, UserPreferenceValues } from '../../../../../../services/user-preferences.service';
import { MomentDateAdapter } from '../../../../../../utils/momentDateAdapter'; import { MomentDateAdapter } from '../../../../../../utils/momentDateAdapter';
import { MOMENT_DATE_FORMATS } from '../../../../../../utils/moment-date-formats.model'; import { MOMENT_DATE_FORMATS } from '../../../../../../utils/moment-date-formats.model';
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input, OnInit } from '@angular/core';
@@ -55,13 +55,14 @@ export class DateEditorComponent implements OnInit {
maxDate: Moment; maxDate: Moment;
constructor(private dateAdapter: DateAdapter<Moment>, constructor(private dateAdapter: DateAdapter<Moment>,
private preferences: UserPreferencesService) { private userPreferencesService: UserPreferencesService) {
} }
ngOnInit() { ngOnInit() {
this.preferences.locale$.subscribe((locale) => { this.userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.dateAdapter.setLocale(locale); this.dateAdapter.setLocale(locale);
}); });
let momentDateAdapter = <MomentDateAdapter> this.dateAdapter; let momentDateAdapter = <MomentDateAdapter> this.dateAdapter;
momentDateAdapter.overrideDisplayFormat = this.DATE_FORMAT; momentDateAdapter.overrideDisplayFormat = this.DATE_FORMAT;
@@ -17,7 +17,7 @@
/* tslint:disable:component-selector */ /* tslint:disable:component-selector */
import { UserPreferencesService } from '../../../../../../services/user-preferences.service'; import { UserPreferencesService, UserPreferenceValues } from '../../../../../../services/user-preferences.service';
import { MomentDateAdapter } from '../../../../../../utils/momentDateAdapter'; import { MomentDateAdapter } from '../../../../../../utils/momentDateAdapter';
import { MOMENT_DATE_FORMATS } from '../../../../../../utils/moment-date-formats.model'; import { MOMENT_DATE_FORMATS } from '../../../../../../utils/moment-date-formats.model';
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input, OnInit } from '@angular/core';
@@ -60,13 +60,14 @@ export class DateTimeEditorComponent implements OnInit {
maxDate: Moment; maxDate: Moment;
constructor(private dateAdapter: DateAdapter<Moment>, constructor(private dateAdapter: DateAdapter<Moment>,
private preferences: UserPreferencesService) { private userPreferencesService: UserPreferencesService) {
} }
ngOnInit() { ngOnInit() {
this.preferences.locale$.subscribe((locale) => { this.userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.dateAdapter.setLocale(locale); this.dateAdapter.setLocale(locale);
}); });
let momentDateAdapter = <MomentDateAdapter> this.dateAdapter; let momentDateAdapter = <MomentDateAdapter> this.dateAdapter;
momentDateAdapter.overrideDisplayFormat = this.DATE_FORMAT; momentDateAdapter.overrideDisplayFormat = this.DATE_FORMAT;
@@ -57,7 +57,6 @@ export class WidgetComponent implements AfterViewInit {
/** /**
* Emitted when a field value changes. * Emitted when a field value changes.
* @deprecated Used only to trigger visibility engine; components should do that internally if needed.
*/ */
@Output() @Output()
fieldChanged: EventEmitter<FormFieldModel> = new EventEmitter<FormFieldModel>(); fieldChanged: EventEmitter<FormFieldModel> = new EventEmitter<FormFieldModel>();
@@ -96,12 +95,10 @@ export class WidgetComponent implements AfterViewInit {
this.fieldChanged.emit(this.field); this.fieldChanged.emit(this.field);
} }
/** @deprecated used only to trigger visibility engine, components should do that internally if needed */
checkVisibility(field: FormFieldModel) { checkVisibility(field: FormFieldModel) {
this.fieldChanged.emit(field); this.fieldChanged.emit(field);
} }
/** @deprecated used only to trigger visibility engine, components should do that internally if needed */
onFieldChanged(field: FormFieldModel) { onFieldChanged(field: FormFieldModel) {
this.fieldChanged.emit(field); this.fieldChanged.emit(field);
} }
@@ -18,7 +18,6 @@
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { Response, ResponseOptions } from '@angular/http'; import { Response, ResponseOptions } from '@angular/http';
import { AlfrescoApiService } from '../../services/alfresco-api.service'; import { AlfrescoApiService } from '../../services/alfresco-api.service';
import { FormDefinitionModel } from '../models/form-definition.model';
import { formModelTabs, AlfrescoApiServiceMock } from '../../mock'; import { formModelTabs, AlfrescoApiServiceMock } from '../../mock';
import { FormService } from './form.service'; import { FormService } from './form.service';
import { setupTestBed } from '../../testing/setupTestBed'; import { setupTestBed } from '../../testing/setupTestBed';
@@ -359,25 +358,6 @@ describe('Form service', () => {
}); });
}); });
it('should add form fields to a form', (done) => {
let formId = 100;
let name = 'testName';
let data = [{ name: 'name' }, { name: 'email' }];
let formDefinitionModel = new FormDefinitionModel(formId.toString(), name, 'testUserName', '2016-09-05T14:41:19.049Z', data);
service.addFieldsToAForm(formId, formDefinitionModel).subscribe((result) => {
expect(jasmine.Ajax.requests.mostRecent().url.endsWith('/form-models/' + formId)).toBeTruthy();
expect(JSON.parse(jasmine.Ajax.requests.mostRecent().params).formRepresentation.name).toEqual(name);
done();
});
jasmine.Ajax.requests.mostRecent().respondWith({
'status': 200,
contentType: 'application/json',
responseText: JSON.stringify(simpleResponseBody)
});
});
it('should return list of people', (done) => { it('should return list of people', (done) => {
spyOn(service, 'getUserProfileImageApi').and.returnValue('/app/rest/users/2002/picture'); spyOn(service, 'getUserProfileImageApi').and.returnValue('/app/rest/users/2002/picture');
let fakeFilter: string = 'whatever'; let fakeFilter: string = 'whatever';
+3 -14
View File
@@ -129,7 +129,9 @@ export class FormService {
this.ecmModelService.searchEcmType(formName, EcmModelService.MODEL_NAME).subscribe( this.ecmModelService.searchEcmType(formName, EcmModelService.MODEL_NAME).subscribe(
(customType) => { (customType) => {
let formDefinitionModel = new FormDefinitionModel(form.id, form.name, form.lastUpdatedByFullName, form.lastUpdated, customType.entry.properties); let formDefinitionModel = new FormDefinitionModel(form.id, form.name, form.lastUpdatedByFullName, form.lastUpdated, customType.entry.properties);
this.addFieldsToAForm(form.id, formDefinitionModel).subscribe((formData) => { from(
this.editorApi.saveForm(form.id, formDefinitionModel)
).subscribe((formData) => {
observer.next(formData); observer.next(formData);
observer.complete(); observer.complete();
}, (err) => this.handleError(err)); }, (err) => this.handleError(err));
@@ -170,19 +172,6 @@ export class FormService {
); );
} }
/**
* Add Fields to a form
* @deprecated in 1.7.0, use saveForm API instead
* @param formId ID of the form
* @param formModel Form definition
*/
addFieldsToAForm(formId: number, formModel: FormDefinitionModel): Observable<any> {
this.logService.log('addFieldsToAForm is deprecated in 1.7.0, use saveForm API instead');
return from(
this.editorApi.saveForm(formId, formModel)
);
}
/** /**
* Searches for a form by name. * Searches for a form by name.
* @param name The form name to search for * @param name The form name to search for
@@ -90,7 +90,6 @@ describe('LoginComponent', () => {
}); });
function loginWithCredentials(username, password, providers: string = 'ECM') { function loginWithCredentials(username, password, providers: string = 'ECM') {
component.providers = providers;
usernameInput.value = username; usernameInput.value = username;
passwordInput.value = password; passwordInput.value = password;
@@ -116,6 +115,8 @@ describe('LoginComponent', () => {
}); });
it('should redirect to previous route state on successful login', () => { it('should redirect to previous route state on successful login', () => {
appConfigService.config.providers = 'ECM';
spyOn(authService, 'login').and.returnValue(of({ type: 'type', ticket: 'ticket' })); spyOn(authService, 'login').and.returnValue(of({ type: 'type', ticket: 'ticket' }));
const redirect = '/home'; const redirect = '/home';
component.successRoute = redirect; component.successRoute = redirect;
@@ -393,7 +394,6 @@ describe('LoginComponent', () => {
it('should return success event after the login have succeeded', (done) => { it('should return success event after the login have succeeded', (done) => {
spyOn(authService, 'login').and.returnValue(of({ type: 'type', ticket: 'ticket' })); spyOn(authService, 'login').and.returnValue(of({ type: 'type', ticket: 'ticket' }));
component.providers = 'ECM';
expect(component.isError).toBe(false); expect(component.isError).toBe(false);
component.success.subscribe(() => { component.success.subscribe(() => {
@@ -409,7 +409,6 @@ describe('LoginComponent', () => {
}); });
it('should return error with a wrong username', (done) => { it('should return error with a wrong username', (done) => {
component.providers = 'ECM';
component.error.subscribe(() => { component.error.subscribe(() => {
fixture.detectChanges(); fixture.detectChanges();
@@ -424,8 +423,6 @@ describe('LoginComponent', () => {
}); });
it('should return error with a wrong password', (done) => { it('should return error with a wrong password', (done) => {
component.providers = 'ECM';
component.error.subscribe(() => { component.error.subscribe(() => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
@@ -440,8 +437,6 @@ describe('LoginComponent', () => {
}); });
it('should return error with a wrong username and password', (done) => { it('should return error with a wrong username and password', (done) => {
component.providers = 'ECM';
component.error.subscribe(() => { component.error.subscribe(() => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
@@ -462,7 +457,6 @@ describe('LoginComponent', () => {
message: 'ERROR: the network is offline, Origin is not allowed by Access-Control-Allow-Origin' message: 'ERROR: the network is offline, Origin is not allowed by Access-Control-Allow-Origin'
} }
})); }));
component.providers = 'ECM';
component.error.subscribe(() => { component.error.subscribe(() => {
fixture.detectChanges(); fixture.detectChanges();
@@ -480,7 +474,6 @@ describe('LoginComponent', () => {
it('should return CSRF error when server CSRF error occurs', async(() => { it('should return CSRF error when server CSRF error occurs', async(() => {
spyOn(authService, 'login') spyOn(authService, 'login')
.and.returnValue(throwError({ message: 'ERROR: Invalid CSRF-token', status: 403 })); .and.returnValue(throwError({ message: 'ERROR: Invalid CSRF-token', status: 403 }));
component.providers = 'ECM';
component.error.subscribe(() => { component.error.subscribe(() => {
fixture.detectChanges(); fixture.detectChanges();
@@ -502,7 +495,6 @@ describe('LoginComponent', () => {
status: 403 status: 403
} }
)); ));
component.providers = 'ECM';
component.error.subscribe(() => { component.error.subscribe(() => {
fixture.detectChanges(); fixture.detectChanges();
@@ -516,8 +508,6 @@ describe('LoginComponent', () => {
})); }));
it('should emit success event after the login has succeeded and discard password', async(() => { it('should emit success event after the login has succeeded and discard password', async(() => {
component.providers = 'ECM';
component.success.subscribe((event) => { component.success.subscribe((event) => {
fixture.detectChanges(); fixture.detectChanges();
@@ -532,7 +522,6 @@ describe('LoginComponent', () => {
it('should emit error event after the login has failed', async(() => { it('should emit error event after the login has failed', async(() => {
spyOn(authService, 'login').and.returnValue(throwError('Fake server error')); spyOn(authService, 'login').and.returnValue(throwError('Fake server error'));
component.providers = 'ECM';
component.error.subscribe((error) => { component.error.subscribe((error) => {
fixture.detectChanges(); fixture.detectChanges();
+2 -23
View File
@@ -25,7 +25,6 @@ import { AuthenticationService } from '../../services/authentication.service';
import { LogService } from '../../services/log.service'; import { LogService } from '../../services/log.service';
import { TranslationService } from '../../services/translation.service'; import { TranslationService } from '../../services/translation.service';
import { UserPreferencesService } from '../../services/user-preferences.service'; import { UserPreferencesService } from '../../services/user-preferences.service';
import { SettingsService } from '../../services/settings.service';
import { LoginErrorEvent } from '../models/login-error.event'; import { LoginErrorEvent } from '../models/login-error.event';
import { LoginSubmitEvent } from '../models/login-submit.event'; import { LoginSubmitEvent } from '../models/login-submit.event';
@@ -91,24 +90,10 @@ export class LoginComponent implements OnInit {
@Input() @Input()
copyrightText: string = '\u00A9 2016 Alfresco Software, Inc. All Rights Reserved.'; copyrightText: string = '\u00A9 2016 Alfresco Software, Inc. All Rights Reserved.';
/**
* Possible valid values are ECM, BPM or ALL.
* @deprecated 3.0.0 - use the providers property in the the app.config.json
*/
@Input()
providers: string;
/** Custom validation rules for the login form. */ /** Custom validation rules for the login form. */
@Input() @Input()
fieldsValidation: any; fieldsValidation: any;
/**
* Prevents the CSRF Token from being submitted. Only valid for Alfresco Process Services.
* @deprecated 3.0.0
*/
@Input()
disableCsrf: boolean;
/** Route to redirect to on successful login. */ /** Route to redirect to on successful login. */
@Input() @Input()
successRoute: string = null; successRoute: string = null;
@@ -154,8 +139,7 @@ export class LoginComponent implements OnInit {
private logService: LogService, private logService: LogService,
private router: Router, private router: Router,
private appConfig: AppConfigService, private appConfig: AppConfigService,
private userPreferences: UserPreferencesService, private userPreferences: UserPreferencesService
private settingsService: SettingsService
) { ) {
this.initFormError(); this.initFormError();
this.initFormFieldsMessages(); this.initFormFieldsMessages();
@@ -188,9 +172,6 @@ export class LoginComponent implements OnInit {
* @param event * @param event
*/ */
onSubmit(values: any) { onSubmit(values: any) {
this.settingsService.setProviders(this.providers);
this.settingsService.csrfDisabled = this.disableCsrf;
this.disableError(); this.disableError();
const args = new LoginSubmitEvent({ const args = new LoginSubmitEvent({
controls: { username: this.form.controls.username } controls: { username: this.form.controls.username }
@@ -242,9 +223,7 @@ export class LoginComponent implements OnInit {
.login(values.username, values.password, this.rememberMe) .login(values.username, values.password, this.rememberMe)
.subscribe( .subscribe(
(token: any) => { (token: any) => {
const redirectUrl = this.authService.getRedirect( const redirectUrl = this.authService.getRedirect();
this.providers
);
this.actualLoginStep = LoginSteps.Welcome; this.actualLoginStep = LoginSteps.Welcome;
this.userPreferences.setStoragePrefix(values.username); this.userPreferences.setStoragePrefix(values.username);
-41
View File
@@ -1,41 +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 { CommentRepresentation, LightUserRepresentation } from '@alfresco/js-api';
/**
* @deprecated
* CommentProcessModel
* (this model is deprecated in 2.3.0 in favour of CommentModel and will be removed in future revisions)
*/
export class CommentProcessModel implements CommentRepresentation {
id: number;
message: string;
created: Date;
createdBy: LightUserRepresentation;
isSelected: boolean;
constructor(obj?: any) {
if (obj) {
this.id = obj.id;
this.message = obj.message;
this.created = obj.created;
this.createdBy = obj.createdBy;
this.isSelected = obj.isSelected ? obj.isSelected : false;
}
}
}
-1
View File
@@ -22,6 +22,5 @@ export * from './user-process.model';
export * from './comment.model'; export * from './comment.model';
export * from './ecm-company.model'; export * from './ecm-company.model';
export * from './redirection.model'; export * from './redirection.model';
export * from './comment-process.model';
export * from './pagination.model'; export * from './pagination.model';
export * from './oauth-config.model'; export * from './oauth-config.model';
@@ -1,4 +1,5 @@
<div *ngIf="pagination?.hasMoreItems || isLoading" class="adf-infinite-pagination"> <div *ngIf="pagination?.hasMoreItems || isLoading" class="adf-infinite-pagination">
isLoading : {{isLoading}}
<button mat-button <button mat-button
*ngIf="!isLoading" *ngIf="!isLoading"
class="adf-infinite-pagination-load-more" class="adf-infinite-pagination-load-more"
@@ -23,6 +23,33 @@ import { PaginatedComponent } from './paginated-component.interface';
import { BehaviorSubject } from 'rxjs'; import { BehaviorSubject } from 'rxjs';
import { setupTestBed } from '../testing/setupTestBed'; import { setupTestBed } from '../testing/setupTestBed';
import { CoreTestingModule } from '../testing/core.testing.module'; import { CoreTestingModule } from '../testing/core.testing.module';
import { Component } from '@angular/core';
import { PaginationModel } from '../models/pagination.model';
@Component({
template: ``
})
class TestPaginatedComponent implements PaginatedComponent {
private _pagination: BehaviorSubject<PaginationModel>;
get pagination(): BehaviorSubject<PaginationModel> {
if (!this._pagination) {
let defaultPagination = <PaginationModel> {
maxItems: 10,
skipCount: 0,
totalItems: 0,
hasMoreItems: false
};
this._pagination = new BehaviorSubject<PaginationModel>(defaultPagination);
}
return this._pagination;
}
updatePagination(pagination: PaginationModel) {
this.pagination.next(pagination);
}
}
describe('InfinitePaginationComponent', () => { describe('InfinitePaginationComponent', () => {
@@ -31,13 +58,17 @@ describe('InfinitePaginationComponent', () => {
let pagination: Pagination; let pagination: Pagination;
setupTestBed({ setupTestBed({
imports: [CoreTestingModule] imports: [CoreTestingModule],
declarations: [
TestPaginatedComponent
]
}); });
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(InfinitePaginationComponent); fixture = TestBed.createComponent(InfinitePaginationComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
component.target = TestBed.createComponent(TestPaginatedComponent).componentInstance;
pagination = { pagination = {
skipCount: 0, skipCount: 0,
hasMoreItems: false hasMoreItems: false
@@ -48,12 +79,12 @@ describe('InfinitePaginationComponent', () => {
fixture.destroy(); fixture.destroy();
}); });
describe('Standalone', () => { describe('View', () => {
it('should show the loading spinner if loading', () => { it('should show the loading spinner if loading', () => {
pagination.hasMoreItems = true; pagination.hasMoreItems = true;
component.pagination = pagination;
component.isLoading = true; component.isLoading = true;
component.target = null;
fixture.detectChanges(); fixture.detectChanges();
let loadingSpinner = fixture.debugElement.query(By.css('[data-automation-id="adf-infinite-pagination-spinner"]')); let loadingSpinner = fixture.debugElement.query(By.css('[data-automation-id="adf-infinite-pagination-spinner"]'));
@@ -62,7 +93,7 @@ describe('InfinitePaginationComponent', () => {
it('should NOT show the loading spinner if NOT loading', () => { it('should NOT show the loading spinner if NOT loading', () => {
pagination.hasMoreItems = true; pagination.hasMoreItems = true;
component.pagination = pagination; component.target.updatePagination(pagination);
component.isLoading = false; component.isLoading = false;
fixture.detectChanges(); fixture.detectChanges();
@@ -72,7 +103,7 @@ describe('InfinitePaginationComponent', () => {
it('should show the load more button if NOT loading and has more items', () => { it('should show the load more button if NOT loading and has more items', () => {
pagination.hasMoreItems = true; pagination.hasMoreItems = true;
component.pagination = pagination; component.target.updatePagination(pagination);
component.isLoading = false; component.isLoading = false;
fixture.detectChanges(); fixture.detectChanges();
@@ -82,7 +113,7 @@ describe('InfinitePaginationComponent', () => {
it('should NOT show anything if pagination has NO more items', () => { it('should NOT show anything if pagination has NO more items', () => {
pagination.hasMoreItems = false; pagination.hasMoreItems = false;
component.pagination = pagination; component.target.updatePagination(pagination);
fixture.detectChanges(); fixture.detectChanges();
let loadMoreButton = fixture.debugElement.query(By.css('[data-automation-id="adf-infinite-pagination-button"]')); let loadMoreButton = fixture.debugElement.query(By.css('[data-automation-id="adf-infinite-pagination-button"]'));
@@ -94,7 +125,7 @@ describe('InfinitePaginationComponent', () => {
it('should trigger the loadMore event with the proper pagination object', (done) => { it('should trigger the loadMore event with the proper pagination object', (done) => {
pagination.hasMoreItems = true; pagination.hasMoreItems = true;
pagination.skipCount = 5; pagination.skipCount = 5;
component.pagination = pagination; component.target.updatePagination(pagination);
component.isLoading = false; component.isLoading = false;
component.pageSize = 5; component.pageSize = 5;
fixture.detectChanges(); fixture.detectChanges();
@@ -111,22 +142,16 @@ describe('InfinitePaginationComponent', () => {
describe('Target', () => { describe('Target', () => {
let testTarget: PaginatedComponent; let spyTarget;
beforeEach(() => { beforeEach(() => {
pagination = { maxItems: 444, skipCount: 0, totalItems: 888, hasMoreItems: true }; pagination = { maxItems: 444, skipCount: 0, totalItems: 888, hasMoreItems: true };
testTarget = {
pagination: new BehaviorSubject<Pagination>(pagination),
supportedPageSizes: [],
updatePagination() {}
};
spyOn(testTarget, 'updatePagination'); spyTarget = spyOn(component.target, 'updatePagination').and.callThrough();
}); });
it('should subscribe to target\'s pagination observable to update pagination and pagesize correctly', () => { it('should subscribe to target\'s pagination observable to update pagination and pagesize correctly', () => {
component.target = testTarget; component.target.updatePagination(pagination);
fixture.detectChanges(); fixture.detectChanges();
expect(component.pagination).toBe(pagination); expect(component.pagination).toBe(pagination);
@@ -134,32 +159,44 @@ describe('InfinitePaginationComponent', () => {
}); });
it('should call the target\'s updatePagination on invoking the onLoadMore', () => { it('should call the target\'s updatePagination on invoking the onLoadMore', () => {
component.target = testTarget; component.target.updatePagination(pagination);
fixture.detectChanges(); fixture.detectChanges();
component.onLoadMore(); component.onLoadMore();
expect(testTarget.updatePagination).toHaveBeenCalledWith({ maxItems: 444 + 25, skipCount: 0, totalItems: 888, hasMoreItems: true, merge: true }); expect(spyTarget).toHaveBeenCalledWith({
maxItems: 444 + 25,
skipCount: 0,
totalItems: 888,
hasMoreItems: true,
merge: true
});
}); });
it('should call the target\'s updatePagination on invoking the onLoadMore with a specific pageSize', () => { it('should call the target\'s updatePagination on invoking the onLoadMore with a specific pageSize', () => {
component.target = testTarget;
component.pageSize = 7; component.pageSize = 7;
component.target.updatePagination(pagination);
fixture.detectChanges(); fixture.detectChanges();
component.onLoadMore(); component.onLoadMore();
expect(testTarget.updatePagination).toHaveBeenCalledWith({ maxItems: 444 + component.pageSize, skipCount: 0, totalItems: 888, hasMoreItems: true, merge: true }); expect(spyTarget).toHaveBeenCalledWith({
maxItems: 444 + component.pageSize,
skipCount: 0,
totalItems: 888,
hasMoreItems: true,
merge: true
});
}); });
it('should unsubscribe from the target\'s pagination on onDestroy', () => { it('should unsubscribe from the target\'s pagination on onDestroy', () => {
component.target = testTarget;
fixture.detectChanges(); fixture.detectChanges();
fixture.destroy(); fixture.destroy();
const emitNewPaginationEvent = () => { const emitNewPaginationEvent = () => {
let newPagination = { maxItems: 1, skipCount: 0, totalItems: 2, hasMoreItems: true }; let newPagination = { maxItems: 1, skipCount: 0, totalItems: 2, hasMoreItems: true };
testTarget.pagination.next(newPagination); component.target.pagination.next(newPagination);
}; };
expect(emitNewPaginationEvent).not.toThrow(); expect(emitNewPaginationEvent).not.toThrow();
@@ -39,24 +39,12 @@ import { UserPreferencesService } from '../services/user-preferences.service';
}) })
export class InfinitePaginationComponent implements OnInit, OnDestroy, PaginationComponentInterface { export class InfinitePaginationComponent implements OnInit, OnDestroy, PaginationComponentInterface {
/**
* @deprecated 3.0.0 - uses paginationSize's default in UserPreferencesService
*/
static DEFAULT_PAGE_SIZE: number = 25;
static DEFAULT_PAGINATION: PaginationModel = { static DEFAULT_PAGINATION: PaginationModel = {
skipCount: 0, skipCount: 0,
hasMoreItems: false, hasMoreItems: false,
merge: true merge: true
}; };
/**
* Pagination object.
* @deprecated 2.3.0
*/
@Input()
pagination: PaginationModel;
/** Component that provides custom pagination support. */ /** Component that provides custom pagination support. */
@Input() @Input()
target: PaginatedComponent; target: PaginatedComponent;
@@ -73,6 +61,8 @@ export class InfinitePaginationComponent implements OnInit, OnDestroy, Paginatio
@Output() @Output()
loadMore: EventEmitter<PaginationModel> = new EventEmitter<PaginationModel>(); loadMore: EventEmitter<PaginationModel> = new EventEmitter<PaginationModel>();
pagination: PaginationModel;
private paginationSubscription: Subscription; private paginationSubscription: Subscription;
constructor(private cdr: ChangeDetectorRef, private userPreferencesService: UserPreferencesService) { constructor(private cdr: ChangeDetectorRef, private userPreferencesService: UserPreferencesService) {
@@ -20,10 +20,5 @@ import { BehaviorSubject } from 'rxjs';
export interface PaginatedComponent { export interface PaginatedComponent {
pagination: BehaviorSubject<PaginationModel>; pagination: BehaviorSubject<PaginationModel>;
/**
* @deprecated 2.3.0 : the supported page size should be retrieved via the user preferences
* and given to the pagination component, and not retrieved by the paginated object
*/
supportedPageSizes?: number[];
updatePagination(pagination: PaginationModel); updatePagination(pagination: PaginationModel);
} }
+2 -19
View File
@@ -50,10 +50,6 @@ export class AlfrescoApiService {
return this.getInstance().activiti.taskApi; return this.getInstance().activiti.taskApi;
} }
// get modelsApi(): Core.ModelsApi {
// return this.getInstance().activiti.modelsApi;
// }
get contentApi(): ContentApi { get contentApi(): ContentApi {
return this.getInstance().content; return this.getInstance().content;
} }
@@ -120,13 +116,13 @@ export class AlfrescoApiService {
} }
const config = { const config = {
provider: this.getProvider(), provider: this.appConfig.get<string>(AppConfigValues.PROVIDERS),
hostEcm: this.appConfig.get<string>(AppConfigValues.ECMHOST), hostEcm: this.appConfig.get<string>(AppConfigValues.ECMHOST),
hostBpm: this.appConfig.get<string>(AppConfigValues.BPMHOST), hostBpm: this.appConfig.get<string>(AppConfigValues.BPMHOST),
authType: this.appConfig.get<string>(AppConfigValues.AUTHTYPE, 'BASIC'), authType: this.appConfig.get<string>(AppConfigValues.AUTHTYPE, 'BASIC'),
contextRootBpm: this.appConfig.get<string>(AppConfigValues.CONTEXTROOTBPM), contextRootBpm: this.appConfig.get<string>(AppConfigValues.CONTEXTROOTBPM),
contextRoot: this.appConfig.get<string>(AppConfigValues.CONTEXTROOTECM), contextRoot: this.appConfig.get<string>(AppConfigValues.CONTEXTROOTECM),
disableCsrf: this.getDisableCSRF(), disableCsrf: this.appConfig.get<boolean>(AppConfigValues.DISABLECSRF),
oauth2: oauth oauth2: oauth
}; };
@@ -137,17 +133,4 @@ export class AlfrescoApiService {
} }
} }
// @deprecated 3.0.0 get only from app config
private getDisableCSRF(): boolean {
if (this.storage.getItem(AppConfigValues.DISABLECSRF) === 'true') {
return true;
} else {
return this.appConfig.get<boolean>(AppConfigValues.DISABLECSRF);
}
}
// @deprecated 3.0.0 get only from app config
private getProvider() {
return this.storage.getItem(AppConfigValues.PROVIDERS) || this.appConfig.get<string>(AppConfigValues.PROVIDERS);
}
} }
@@ -40,6 +40,8 @@ describe('AuthGuardService BPM', () => {
authGuard = TestBed.get(AuthGuardBpm); authGuard = TestBed.get(AuthGuardBpm);
routerService = TestBed.get(Router); routerService = TestBed.get(Router);
appConfigService = TestBed.get(AppConfigService); appConfigService = TestBed.get(AppConfigService);
appConfigService.config.providers = 'BPM';
}); });
it('if the alfresco js api is logged in should canActivate be true', async(() => { it('if the alfresco js api is logged in should canActivate be true', async(() => {
@@ -78,7 +80,7 @@ describe('AuthGuardService BPM', () => {
expect(authService.setRedirect).toHaveBeenCalledWith({ expect(authService.setRedirect).toHaveBeenCalledWith({
provider: 'BPM', url: 'some-url' provider: 'BPM', url: 'some-url'
}); });
expect(authService.getRedirect('BPM')).toEqual('some-url'); expect(authService.getRedirect()).toEqual('some-url');
})); }));
it('should set redirect navigation commands with query params', async(() => { it('should set redirect navigation commands with query params', async(() => {
@@ -91,7 +93,7 @@ describe('AuthGuardService BPM', () => {
expect(authService.setRedirect).toHaveBeenCalledWith({ expect(authService.setRedirect).toHaveBeenCalledWith({
provider: 'BPM', url: 'some-url;q=123' provider: 'BPM', url: 'some-url;q=123'
}); });
expect(authService.getRedirect('BPM')).toEqual('some-url;q=123'); expect(authService.getRedirect()).toEqual('some-url;q=123');
})); }));
it('should set redirect navigation commands with query params', async(() => { it('should set redirect navigation commands with query params', async(() => {
@@ -104,7 +106,7 @@ describe('AuthGuardService BPM', () => {
expect(authService.setRedirect).toHaveBeenCalledWith({ expect(authService.setRedirect).toHaveBeenCalledWith({
provider: 'BPM', url: '/' provider: 'BPM', url: '/'
}); });
expect(authService.getRedirect('BPM')).toEqual('/'); expect(authService.getRedirect()).toEqual('/');
})); }));
it('should get redirect url from config if there is one configured', async(() => { it('should get redirect url from config if there is one configured', async(() => {
@@ -40,6 +40,8 @@ describe('AuthGuardService ECM', () => {
authGuard = TestBed.get(AuthGuardEcm); authGuard = TestBed.get(AuthGuardEcm);
routerService = TestBed.get(Router); routerService = TestBed.get(Router);
appConfigService = TestBed.get(AppConfigService); appConfigService = TestBed.get(AppConfigService);
appConfigService.config.providers = 'ECM';
}); });
it('if the alfresco js api is logged in should canActivate be true', async(() => { it('if the alfresco js api is logged in should canActivate be true', async(() => {
@@ -78,7 +80,7 @@ describe('AuthGuardService ECM', () => {
expect(authService.setRedirect).toHaveBeenCalledWith({ expect(authService.setRedirect).toHaveBeenCalledWith({
provider: 'ECM', url: 'some-url' provider: 'ECM', url: 'some-url'
}); });
expect(authService.getRedirect('ECM')).toEqual('some-url'); expect(authService.getRedirect()).toEqual('some-url');
})); }));
it('should set redirect navigation commands with query params', async(() => { it('should set redirect navigation commands with query params', async(() => {
@@ -91,7 +93,7 @@ describe('AuthGuardService ECM', () => {
expect(authService.setRedirect).toHaveBeenCalledWith({ expect(authService.setRedirect).toHaveBeenCalledWith({
provider: 'ECM', url: 'some-url;q=123' provider: 'ECM', url: 'some-url;q=123'
}); });
expect(authService.getRedirect('ECM')).toEqual('some-url;q=123'); expect(authService.getRedirect()).toEqual('some-url;q=123');
})); }));
it('should set redirect navigation commands with query params', async(() => { it('should set redirect navigation commands with query params', async(() => {
@@ -104,7 +106,7 @@ describe('AuthGuardService ECM', () => {
expect(authService.setRedirect).toHaveBeenCalledWith({ expect(authService.setRedirect).toHaveBeenCalledWith({
provider: 'ECM', url: '/' provider: 'ECM', url: '/'
}); });
expect(authService.getRedirect('ECM')).toEqual('/'); expect(authService.getRedirect()).toEqual('/');
})); }));
it('should get redirect url from config if there is one configured', async(() => { it('should get redirect url from config if there is one configured', async(() => {
@@ -144,19 +144,19 @@ describe('AuthenticationService', () => {
it('[ECM] should set/get redirectUrl when provider is ECM', () => { it('[ECM] should set/get redirectUrl when provider is ECM', () => {
authService.setRedirect({ provider: 'ECM', url: 'some-url' }); authService.setRedirect({ provider: 'ECM', url: 'some-url' });
expect(authService.getRedirect(appConfigService.config.providers)).toEqual('some-url'); expect(authService.getRedirect()).toEqual('some-url');
}); });
it('[ECM] should set/get redirectUrl when provider is BPM', () => { it('[ECM] should set/get redirectUrl when provider is BPM', () => {
authService.setRedirect({ provider: 'BPM', url: 'some-url' }); authService.setRedirect({ provider: 'BPM', url: 'some-url' });
expect(authService.getRedirect(appConfigService.config.providers)).toBeNull(); expect(authService.getRedirect()).toBeNull();
}); });
it('[ECM] should return null as redirectUrl when redirectUrl field is not set', () => { it('[ECM] should return null as redirectUrl when redirectUrl field is not set', () => {
authService.setRedirect(null); authService.setRedirect(null);
expect(authService.getRedirect(appConfigService.config.providers)).toBeNull(); expect(authService.getRedirect()).toBeNull();
}); });
it('[ECM] should return isECMProvider true', () => { it('[ECM] should return isECMProvider true', () => {
@@ -260,19 +260,19 @@ describe('AuthenticationService', () => {
it('[BPM] should set/get redirectUrl when provider is BPM', () => { it('[BPM] should set/get redirectUrl when provider is BPM', () => {
authService.setRedirect({ provider: 'BPM', url: 'some-url' }); authService.setRedirect({ provider: 'BPM', url: 'some-url' });
expect(authService.getRedirect(appConfigService.config.providers)).toEqual('some-url'); expect(authService.getRedirect()).toEqual('some-url');
}); });
it('[BPM] should set/get redirectUrl when provider is ECM', () => { it('[BPM] should set/get redirectUrl when provider is ECM', () => {
authService.setRedirect({ provider: 'ECM', url: 'some-url' }); authService.setRedirect({ provider: 'ECM', url: 'some-url' });
expect(authService.getRedirect(appConfigService.config.providers)).toBeNull(); expect(authService.getRedirect()).toBeNull();
}); });
it('[BPM] should return null as redirectUrl when redirectUrl field is not set', () => { it('[BPM] should return null as redirectUrl when redirectUrl field is not set', () => {
authService.setRedirect(null); authService.setRedirect(null);
expect(authService.getRedirect(appConfigService.config.providers)).toBeNull(); expect(authService.getRedirect()).toBeNull();
}); });
it('[BPM] should return isECMProvider false', () => { it('[BPM] should return isECMProvider false', () => {
@@ -469,25 +469,25 @@ describe('AuthenticationService', () => {
it('[ALL] should set/get redirectUrl when provider is ALL', () => { it('[ALL] should set/get redirectUrl when provider is ALL', () => {
authService.setRedirect({ provider: 'ALL', url: 'some-url' }); authService.setRedirect({ provider: 'ALL', url: 'some-url' });
expect(authService.getRedirect(appConfigService.config.providers)).toEqual('some-url'); expect(authService.getRedirect()).toEqual('some-url');
}); });
it('[ALL] should set/get redirectUrl when provider is BPM', () => { it('[ALL] should set/get redirectUrl when provider is BPM', () => {
authService.setRedirect({ provider: 'BPM', url: 'some-url' }); authService.setRedirect({ provider: 'BPM', url: 'some-url' });
expect(authService.getRedirect(appConfigService.config.providers)).toEqual('some-url'); expect(authService.getRedirect()).toEqual('some-url');
}); });
it('[ALL] should set/get redirectUrl when provider is ECM', () => { it('[ALL] should set/get redirectUrl when provider is ECM', () => {
authService.setRedirect({ provider: 'ECM', url: 'some-url' }); authService.setRedirect({ provider: 'ECM', url: 'some-url' });
expect(authService.getRedirect(appConfigService.config.providers)).toEqual('some-url'); expect(authService.getRedirect()).toEqual('some-url');
}); });
it('[ALL] should return null as redirectUrl when redirectUrl field is not set', () => { it('[ALL] should return null as redirectUrl when redirectUrl field is not set', () => {
authService.setRedirect(null); authService.setRedirect(null);
expect(authService.getRedirect(appConfigService.config.providers)).toBeNull(); expect(authService.getRedirect()).toBeNull();
}); });
it('[ALL] should return isECMProvider false', () => { it('[ALL] should return isECMProvider false', () => {
+2 -2
View File
@@ -244,10 +244,10 @@ export class AuthenticationService {
} }
/** Gets the URL to redirect to after login. /** Gets the URL to redirect to after login.
* @param provider Service provider. Can be "ECM", "BPM" or "ALL".
* @returns The redirect URL * @returns The redirect URL
*/ */
getRedirect(provider: string): string { getRedirect(): string {
let provider = <string> this.appConfig.get(AppConfigValues.PROVIDERS);
return this.hasValidRedirection(provider) ? this.redirectUrl.url : null; return this.hasValidRedirection(provider) ? this.redirectUrl.url : null;
} }
+2 -8
View File
@@ -18,7 +18,6 @@
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { CookieServiceMock } from '../mock/cookie.service.mock'; import { CookieServiceMock } from '../mock/cookie.service.mock';
import { ContentService } from './content.service'; import { ContentService } from './content.service';
import { SettingsService } from './settings.service';
import { AppConfigService } from '../app-config/app-config.service'; import { AppConfigService } from '../app-config/app-config.service';
import { AuthenticationService } from './authentication.service'; import { AuthenticationService } from './authentication.service';
import { CookieService } from './cookie.service'; import { CookieService } from './cookie.service';
@@ -37,7 +36,6 @@ describe('ContentService', () => {
let contentService: ContentService; let contentService: ContentService;
let authService: AuthenticationService; let authService: AuthenticationService;
let settingsService: SettingsService;
let storage: StorageService; let storage: StorageService;
let node: any; let node: any;
@@ -56,7 +54,6 @@ describe('ContentService', () => {
beforeEach(() => { beforeEach(() => {
authService = TestBed.get(AuthenticationService); authService = TestBed.get(AuthenticationService);
settingsService = TestBed.get(SettingsService);
contentService = TestBed.get(ContentService); contentService = TestBed.get(ContentService);
storage = TestBed.get(StorageService); storage = TestBed.get(StorageService);
storage.clear(); storage.clear();
@@ -71,7 +68,8 @@ describe('ContentService', () => {
let appConfig: AppConfigService = TestBed.get(AppConfigService); let appConfig: AppConfigService = TestBed.get(AppConfigService);
appConfig.config = { appConfig.config = {
ecmHost: 'http://localhost:9876/ecm' ecmHost: 'http://localhost:9876/ecm',
provider: 'ECM'
}; };
}); });
@@ -79,10 +77,6 @@ describe('ContentService', () => {
jasmine.Ajax.uninstall(); jasmine.Ajax.uninstall();
}); });
beforeEach(() => {
settingsService.setProviders('ECM');
});
it('should return a valid content URL', (done) => { it('should return a valid content URL', (done) => {
authService.login('fake-username', 'fake-password').subscribe(() => { authService.login('fake-username', 'fake-password').subscribe(() => {
expect(contentService.getContentUrl(node)).toBe('http://localhost:9876/ecm/alfresco/api/' + expect(contentService.getContentUrl(node)).toBe('http://localhost:9876/ecm/alfresco/api/' +
-1
View File
@@ -17,7 +17,6 @@
export * from './authentication.service'; export * from './authentication.service';
export * from './alfresco-api.service'; export * from './alfresco-api.service';
export * from './settings.service';
export * from './content.service'; export * from './content.service';
export * from './auth-guard.service'; export * from './auth-guard.service';
export * from './auth-guard-ecm.service'; export * from './auth-guard-ecm.service';
-8
View File
@@ -51,7 +51,6 @@ export class RenditionsService {
); );
} }
/** @deprecated */
isRenditionAvailable(nodeId: string, encoding: string): Observable<boolean> { isRenditionAvailable(nodeId: string, encoding: string): Observable<boolean> {
return new Observable((observer) => { return new Observable((observer) => {
this.getRendition(nodeId, encoding).subscribe( this.getRendition(nodeId, encoding).subscribe(
@@ -71,7 +70,6 @@ export class RenditionsService {
}); });
} }
/** @deprecated */
isConversionPossible(nodeId: string, encoding: string): Observable<boolean> { isConversionPossible(nodeId: string, encoding: string): Observable<boolean> {
return new Observable((observer) => { return new Observable((observer) => {
this.getRendition(nodeId, encoding).subscribe( this.getRendition(nodeId, encoding).subscribe(
@@ -87,27 +85,22 @@ export class RenditionsService {
}); });
} }
/** @deprecated */
getRenditionUrl(nodeId: string, encoding: string): string { getRenditionUrl(nodeId: string, encoding: string): string {
return this.apiService.contentApi.getRenditionUrl(nodeId, encoding); return this.apiService.contentApi.getRenditionUrl(nodeId, encoding);
} }
/** @deprecated */
getRendition(nodeId: string, encoding: string): Observable<RenditionEntry> { getRendition(nodeId: string, encoding: string): Observable<RenditionEntry> {
return from(this.apiService.renditionsApi.getRendition(nodeId, encoding)); return from(this.apiService.renditionsApi.getRendition(nodeId, encoding));
} }
/** @deprecated */
getRenditionsListByNodeId(nodeId: string): Observable<RenditionPaging> { getRenditionsListByNodeId(nodeId: string): Observable<RenditionPaging> {
return from(this.apiService.renditionsApi.getRenditions(nodeId)); return from(this.apiService.renditionsApi.getRenditions(nodeId));
} }
/** @deprecated */
createRendition(nodeId: string, encoding: string): Observable<{}> { createRendition(nodeId: string, encoding: string): Observable<{}> {
return from(this.apiService.renditionsApi.createRendition(nodeId, { id: encoding })); return from(this.apiService.renditionsApi.createRendition(nodeId, { id: encoding }));
} }
/** @deprecated */
convert(nodeId: string, encoding: string, pollingInterval: number = 1000, retries: number = 5) { convert(nodeId: string, encoding: string, pollingInterval: number = 1000, retries: number = 5) {
return this.createRendition(nodeId, encoding) return this.createRendition(nodeId, encoding)
.pipe( .pipe(
@@ -115,7 +108,6 @@ export class RenditionsService {
); );
} }
/** @deprecated */
private pollRendition(nodeId: string, encoding: string, intervalSize: number = 1000, retries: number = 5) { private pollRendition(nodeId: string, encoding: string, intervalSize: number = 1000, retries: number = 5) {
let attempts = 0; let attempts = 0;
return interval(intervalSize) return interval(intervalSize)
@@ -1,38 +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 { TestBed } from '@angular/core/testing';
import { SettingsService } from './settings.service';
import { setupTestBed } from '../testing/setupTestBed';
import { CoreTestingModule } from '../testing/core.testing.module';
describe('SettingsService', () => {
let service: SettingsService;
setupTestBed({
imports: [CoreTestingModule]
});
beforeEach(() => {
service = TestBed.get(SettingsService);
});
it('should be exposed by the module', () => {
expect(service).toBeDefined();
});
});
-82
View File
@@ -1,82 +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 { Injectable } from '@angular/core';
import { AppConfigService, AppConfigValues } from '../app-config/app-config.service';
import { LogService } from './log.service';
import { StorageService } from './storage.service';
@Injectable({
providedIn: 'root'
})
export class SettingsService {
constructor(private appConfig: AppConfigService,
private logService: LogService,
private storage: StorageService) {
}
/** @deprecated in 1.6.0 */
public get ecmHost(): string {
this.logService.log('SettingsService.ecmHost is deprecated. Use AppConfigService instead.');
return this.appConfig.get<string>(AppConfigValues.ECMHOST);
}
/** @deprecated in 1.7.0 */
public set csrfDisabled(csrfDisabled: boolean) {
this.logService.log(`SettingsService.csrfDisabled is deprecated. Use UserPreferencesService.disableCSRF instead.`);
if (csrfDisabled !== null && csrfDisabled !== undefined) {
this.storage.setItem(AppConfigValues.DISABLECSRF, csrfDisabled.toString());
}
}
/** @deprecated in 1.6.0 */
public set ecmHost(ecmHostUrl: string) {
this.logService.log('SettingsService.ecmHost is deprecated. Use AppConfigService instead.');
}
/** @deprecated in 1.6.0 */
public get bpmHost(): string {
this.logService.log('SettingsService.bpmHost is deprecated. Use AppConfigService instead.');
return this.appConfig.get<string>(AppConfigValues.BPMHOST);
}
/** @deprecated in 1.6.0 */
public set bpmHost(bpmHostUrl: string) {
this.logService.log('SettingsService.bpmHost is deprecated. Use AppConfigService instead.');
}
/** @deprecated in 1.6.0 */
public getBPMApiBaseUrl(): string {
this.logService.log('SettingsService.getBPMApiBaseUrl is deprecated.');
return this.bpmHost + '/activiti-app';
}
/** @deprecated in 1.7.0 */
public getProviders(): string {
this.logService.log(`SettingsService.getProviders is deprecated. Use UserPreferencesService.authType instead.`);
return this.storage.getItem(AppConfigValues.PROVIDERS) || this.appConfig.get<string>(AppConfigValues.PROVIDERS);
}
/** @deprecated in 1.7.0 */
public setProviders(providers: string) {
this.logService.log(`SettingsService.setProviders is deprecated. Use the app-config.json`);
if (providers) {
this.storage.setItem(AppConfigValues.PROVIDERS, providers);
}
}
}
+4 -5
View File
@@ -19,7 +19,7 @@ import { Inject, Injectable, InjectionToken, Optional } from '@angular/core';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { TranslateLoaderService } from './translate-loader.service'; import { TranslateLoaderService } from './translate-loader.service';
import { UserPreferencesService } from './user-preferences.service'; import { UserPreferencesService, UserPreferenceValues } from './user-preferences.service';
export const TRANSLATION_PROVIDER = new InjectionToken('Injection token for translation providers.'); export const TRANSLATION_PROVIDER = new InjectionToken('Injection token for translation providers.');
@@ -37,7 +37,7 @@ export class TranslationService {
customLoader: TranslateLoaderService; customLoader: TranslateLoaderService;
constructor(public translate: TranslateService, constructor(public translate: TranslateService,
userPreference: UserPreferencesService, userPreferencesService: UserPreferencesService,
@Optional() @Inject(TRANSLATION_PROVIDER) providers: TranslationProvider[]) { @Optional() @Inject(TRANSLATION_PROVIDER) providers: TranslationProvider[]) {
this.customLoader = <TranslateLoaderService> this.translate.currentLoader; this.customLoader = <TranslateLoaderService> this.translate.currentLoader;
@@ -51,10 +51,9 @@ export class TranslationService {
} }
} }
userPreference.locale$.subscribe((locale) => { userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.userLang = locale; this.userLang = locale;
this.use(this.userLang); this.use(this.userLang); });
});
} }
/** /**
+2 -2
View File
@@ -103,7 +103,7 @@ export class UploadService {
/** /**
* Finds all the files in the queue that are not yet uploaded and uploads them into the directory folder. * Finds all the files in the queue that are not yet uploaded and uploads them into the directory folder.
* @param emitter (Deprecated) Emitter to invoke on file status change * @param emitter Emitter to invoke on file status change
*/ */
uploadFilesInTheQueue(emitter?: EventEmitter<any>): void { uploadFilesInTheQueue(emitter?: EventEmitter<any>): void {
if (!this.activeTask) { if (!this.activeTask) {
@@ -197,7 +197,7 @@ export class UploadService {
} }
} }
private beginUpload(file: FileModel, /* @deprecated */emitter: EventEmitter<any>): any { private beginUpload(file: FileModel, emitter: EventEmitter<any>): any {
let promise = this.getUploadPromise(file); let promise = this.getUploadPromise(file);
+1 -12
View File
@@ -40,13 +40,6 @@ export class UserPreferencesService {
}; };
private userPreferenceStatus: any = this.defaults; private userPreferenceStatus: any = this.defaults;
/**
* @deprecated we are grouping every value changed on the user preference in a single stream : userPreferenceValue$
*/
locale$: Observable<string>;
private localeSubject: BehaviorSubject<string>;
private onChangeSubject: BehaviorSubject<any>; private onChangeSubject: BehaviorSubject<any>;
onChange: Observable<any>; onChange: Observable<any>;
@@ -54,8 +47,6 @@ export class UserPreferencesService {
private appConfig: AppConfigService, private appConfig: AppConfigService,
private storage: StorageService) { private storage: StorageService) {
this.appConfig.onLoad.subscribe(this.initUserPreferenceStatus.bind(this)); this.appConfig.onLoad.subscribe(this.initUserPreferenceStatus.bind(this));
this.localeSubject = new BehaviorSubject(this.get(UserPreferenceValues.Locale, this.getDefaultLocale()));
this.locale$ = this.localeSubject.asObservable();
this.onChangeSubject = new BehaviorSubject(this.userPreferenceStatus); this.onChangeSubject = new BehaviorSubject(this.userPreferenceStatus);
this.onChange = this.onChangeSubject.asObservable(); this.onChange = this.onChangeSubject.asObservable();
} }
@@ -169,12 +160,10 @@ export class UserPreferencesService {
/** Current locale setting. */ /** Current locale setting. */
get locale(): string { get locale(): string {
const locale = this.get(UserPreferenceValues.Locale, this.userPreferenceStatus[UserPreferenceValues.Locale]); return this.get(UserPreferenceValues.Locale, this.userPreferenceStatus[UserPreferenceValues.Locale]);
return locale;
} }
set locale(value: string) { set locale(value: string) {
this.localeSubject.next(value);
this.set(UserPreferenceValues.Locale, value); this.set(UserPreferenceValues.Locale, value);
} }
@@ -50,12 +50,6 @@ export class HostSettingsComponent implements OnInit {
@Output() @Output()
error = new EventEmitter<string>(); error = new EventEmitter<string>();
/** Emitted when the ecm host URL is changed.
* @deprecated in 2.4.0
*/
@Output()
ecmHostChange = new EventEmitter<string>();
/** Emitted when the user cancels the changes. */ /** Emitted when the user cancels the changes. */
@Output() @Output()
cancel = new EventEmitter<boolean>(); cancel = new EventEmitter<boolean>();
@@ -64,12 +58,6 @@ export class HostSettingsComponent implements OnInit {
@Output() @Output()
success = new EventEmitter<boolean>(); success = new EventEmitter<boolean>();
/** Emitted when the bpm host URL is changed.
* @deprecated in 2.4.0
*/
@Output()
bpmHostChange = new EventEmitter<string>();
constructor(private formBuilder: FormBuilder, constructor(private formBuilder: FormBuilder,
private storageService: StorageService, private storageService: StorageService,
private alfrescoApiService: AlfrescoApiService, private alfrescoApiService: AlfrescoApiService,
@@ -114,14 +114,14 @@
</mat-menu> </mat-menu>
</ng-container> </ng-container>
<ng-container *ngIf="allowSidebar"> <ng-container *ngIf="allowRightSidebar">
<adf-toolbar-divider></adf-toolbar-divider> <adf-toolbar-divider></adf-toolbar-divider>
<button <button
mat-icon-button mat-icon-button
title="{{ 'ADF_VIEWER.ACTIONS.INFO' | translate }}" title="{{ 'ADF_VIEWER.ACTIONS.INFO' | translate }}"
data-automation-id="adf-toolbar-sidebar" data-automation-id="adf-toolbar-sidebar"
[color]="showSidebar ? 'accent' : 'default'" [color]="showRightSidebar ? 'accent' : 'default'"
(click)="toggleSidebar()"> (click)="toggleSidebar()">
<mat-icon>info_outline</mat-icon> <mat-icon>info_outline</mat-icon>
</button> </button>
@@ -132,12 +132,12 @@
</ng-container> </ng-container>
<div fxLayout="row" fxFlex="1 1 auto"> <div fxLayout="row" fxFlex="1 1 auto">
<ng-container *ngIf="allowSidebar && showSidebar"> <ng-container *ngIf="allowRightSidebar && showRightSidebar">
<div class="adf-viewer__sidebar" [ngClass]="'adf-viewer__sidebar__right'" fxFlexOrder="4" id="adf-right-sidebar" > <div class="adf-viewer__sidebar" [ngClass]="'adf-viewer__sidebar__right'" fxFlexOrder="4" id="adf-right-sidebar" >
<ng-container *ngIf="sidebarTemplate"> <ng-container *ngIf="sidebarRightTemplate">
<ng-container *ngTemplateOutlet="sidebarTemplate;context:sidebarTemplateContext"></ng-container> <ng-container *ngTemplateOutlet="sidebarRightTemplate;context:sidebarRightTemplateContext"></ng-container>
</ng-container> </ng-container>
<ng-content *ngIf="!sidebarTemplate" select="adf-viewer-sidebar"></ng-content> <ng-content *ngIf="!sidebarRightTemplate" select="adf-viewer-sidebar"></ng-content>
</div> </div>
</ng-container> </ng-container>
@@ -150,7 +150,7 @@
</div> </div>
</ng-container> </ng-container>
<div *ngIf="isLoading" class="adf-viewer-main" fxFlexOrder="{{sidebarPosition !== 'left'? 1 : 4}}" fxFlex="1 1 auto"> <div *ngIf="isLoading" class="adf-viewer-main" fxFlexOrder="1" fxFlex="1 1 auto">
<div class="adf-viewer-layout-content adf-viewer__fullscreen-container"> <div class="adf-viewer-layout-content adf-viewer__fullscreen-container">
<div class="adf-viewer-content-container"> <div class="adf-viewer-content-container">
<ng-container *ngIf="isLoading"> <ng-container *ngIf="isLoading">
@@ -166,7 +166,7 @@
</div> </div>
</div> </div>
<div *ngIf="!isLoading" class="adf-viewer-main" fxFlexOrder="{{sidebarPosition !== 'left'? 1 : 4}}" fxFlex="1 1 auto"> <div *ngIf="!isLoading" class="adf-viewer-main" fxFlexOrder="1" fxFlex="1 1 auto">
<div class="adf-viewer-layout-content adf-viewer__fullscreen-container"> <div class="adf-viewer-layout-content adf-viewer__fullscreen-container">
<div class="adf-viewer-content-container" [ngSwitch]="viewerType"> <div class="adf-viewer-content-container" [ngSwitch]="viewerType">
<ng-container *ngSwitchCase="'pdf'"> <ng-container *ngSwitchCase="'pdf'">
@@ -467,8 +467,8 @@ describe('ViewerComponent', () => {
describe('SideBar Test', () => { describe('SideBar Test', () => {
it('should NOT display sidebar if is not allowed', (done) => { it('should NOT display sidebar if is not allowed', (done) => {
component.showSidebar = true; component.showRightSidebar = true;
component.allowSidebar = false; component.allowRightSidebar = false;
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
@@ -479,8 +479,8 @@ describe('ViewerComponent', () => {
}); });
it('should display sidebar on the right side', (done) => { it('should display sidebar on the right side', (done) => {
component.allowSidebar = true; component.allowRightSidebar = true;
component.showSidebar = true; component.showRightSidebar = true;
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
+13 -28
View File
@@ -129,40 +129,25 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
@Input() @Input()
allowLeftSidebar = false; allowLeftSidebar = false;
/** Allow the right sidebar. /** Allow the right sidebar. */
* @deprecated 2.5.0 - will be renamed allowRightSidebar in 3.0.0
*/
@Input() @Input()
allowSidebar = false; allowRightSidebar = false;
/** Toggles PDF thumbnails. */ /** Toggles PDF thumbnails. */
@Input() @Input()
allowThumbnails = true; allowThumbnails = true;
/** /** Toggles right sidebar visibility. Requires `allowRightSidebar` to be set to `true`. */
* Toggles sidebar visibility. Requires `allowSidebar` to be set to `true`.
* @deprecated 2.5.0 - will be renamed showRightSidebar in 3.0.0
*/
@Input() @Input()
showSidebar = false; showRightSidebar = false;
/** Toggles left sidebar visibility. Requires `allowSidebar` to be set to `true`. */ /** Toggles left sidebar visibility. Requires `allowLeftSidebar` to be set to `true`. */
@Input() @Input()
showLeftSidebar = false; showLeftSidebar = false;
/** /** The template for the right sidebar. The template context contains the loaded node data. */
* The position of the sidebar. Can be `left` or `right`.
* @deprecated 2.5.0 use sidebarTemplateLeft
*/
@Input() @Input()
sidebarPosition = 'right'; sidebarRightTemplate: TemplateRef<any> = null;
/**
* The template for the sidebar. The template context contains the loaded node data.
* @deprecated 2.5.0 renamed as sidebarRight
*/
@Input()
sidebarTemplate: TemplateRef<any> = null;
/** The template for the left sidebar. The template context contains the loaded node data. */ /** The template for the left sidebar. The template context contains the loaded node data. */
@Input() @Input()
@@ -223,7 +208,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
urlFileContent: string; urlFileContent: string;
otherMenu: any; otherMenu: any;
extension: string; extension: string;
sidebarTemplateContext: { node: Node } = { node: null }; sidebarRightTemplateContext: { node: Node } = { node: null };
sidebarLeftTemplateContext: { node: Node } = { node: null }; sidebarLeftTemplateContext: { node: Node } = { node: null };
fileTitle: string; fileTitle: string;
@@ -376,7 +361,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
} }
this.extensionChange.emit(this.extension); this.extensionChange.emit(this.extension);
this.sidebarTemplateContext.node = data; this.sidebarRightTemplateContext.node = data;
this.sidebarLeftTemplateContext.node = data; this.sidebarLeftTemplateContext.node = data;
this.scrollTop(); this.scrollTop();
@@ -404,18 +389,18 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
} }
toggleSidebar() { toggleSidebar() {
this.showSidebar = !this.showSidebar; this.showRightSidebar = !this.showRightSidebar;
if (this.showSidebar && this.nodeId) { if (this.showRightSidebar && this.nodeId) {
this.apiService.getInstance().nodes.getNode(this.nodeId, { include: ['allowableOperations'] }) this.apiService.getInstance().nodes.getNode(this.nodeId, { include: ['allowableOperations'] })
.then((nodeEntry: NodeEntry) => { .then((nodeEntry: NodeEntry) => {
this.sidebarTemplateContext.node = nodeEntry.entry; this.sidebarRightTemplateContext.node = nodeEntry.entry;
}); });
} }
} }
toggleLeftSidebar() { toggleLeftSidebar() {
this.showLeftSidebar = !this.showLeftSidebar; this.showLeftSidebar = !this.showLeftSidebar;
if (this.showSidebar && this.nodeId) { if (this.showRightSidebar && this.nodeId) {
this.apiService.getInstance().nodes.getNode(this.nodeId, { include: ['allowableOperations'] }) this.apiService.getInstance().nodes.getNode(this.nodeId, { include: ['allowableOperations'] })
.then((nodeEntry: NodeEntry) => { .then((nodeEntry: NodeEntry) => {
this.sidebarLeftTemplateContext.node = nodeEntry.entry; this.sidebarLeftTemplateContext.node = nodeEntry.entry;
@@ -21,9 +21,8 @@ import { ReportParametersModel } from '../../diagram/models/report/reportParamet
import { AnalyticsService } from '../services/analytics.service'; import { AnalyticsService } from '../services/analytics.service';
import { share } from 'rxjs/operators'; import { share } from 'rxjs/operators';
// @deprecated 2.3.0 analytics-report-list tag removed
@Component({ @Component({
selector: 'adf-analytics-report-list, analytics-report-list', selector: 'adf-analytics-report-list',
templateUrl: './analytics-report-list.component.html', templateUrl: './analytics-report-list.component.html',
styleUrls: ['./analytics-report-list.component.scss'], styleUrls: ['./analytics-report-list.component.scss'],
encapsulation: ViewEncapsulation.None encapsulation: ViewEncapsulation.None
@@ -38,9 +38,8 @@ import { ReportParametersModel } from '../../diagram/models/report/reportParamet
import { ReportQuery } from '../../diagram/models/report/reportQuery.model'; import { ReportQuery } from '../../diagram/models/report/reportQuery.model';
import { AnalyticsService } from '../services/analytics.service'; import { AnalyticsService } from '../services/analytics.service';
// @deprecated 2.3.0 analytics-report-parameters tag removed
@Component({ @Component({
selector: 'adf-analytics-report-parameters, analytics-report-parameters', selector: 'adf-analytics-report-parameters',
templateUrl: './analytics-report-parameters.component.html', templateUrl: './analytics-report-parameters.component.html',
styleUrls: ['./analytics-report-parameters.component.scss'], styleUrls: ['./analytics-report-parameters.component.scss'],
encapsulation: ViewEncapsulation.None encapsulation: ViewEncapsulation.None
@@ -1,12 +1,12 @@
<div class="adf-analytics-container"> <div class="adf-analytics-container">
<analytics-report-parameters [appId]="appId" [reportId]="reportId" <adf-analytics-report-parameters [appId]="appId" [reportId]="reportId"
[hideComponent]="hideParameters" [hideComponent]="hideParameters"
(formValueChanged)="reset()" (formValueChanged)="reset()"
(success)="showReport($event)" (success)="showReport($event)"
(saveReportSuccess)="onSaveReportSuccess($event)" (saveReportSuccess)="onSaveReportSuccess($event)"
(deleteReportSuccess)="onDeleteReportSuccess()" (deleteReportSuccess)="onDeleteReportSuccess()"
(edit)="onEditReport($event)"> (edit)="onEditReport($event)">
</analytics-report-parameters> </adf-analytics-report-parameters>
<adf-analytics-generator [reportId]="reportId" <adf-analytics-generator [reportId]="reportId"
[reportParamQuery]="reportParamQuery" [reportParamQuery]="reportParamQuery"
@@ -17,7 +17,7 @@
/* tslint:disable:no-input-rename */ /* tslint:disable:no-input-rename */
import { MOMENT_DATE_FORMATS, MomentDateAdapter, UserPreferencesService } from '@alfresco/adf-core'; import { MOMENT_DATE_FORMATS, MomentDateAdapter, UserPreferencesService, UserPreferenceValues } from '@alfresco/adf-core';
import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation } from '@angular/core'; import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation } from '@angular/core';
import { AbstractControl, FormControl, FormGroup, Validators } from '@angular/forms'; import { AbstractControl, FormControl, FormGroup, Validators } from '@angular/forms';
import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material'; import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material';
@@ -54,13 +54,14 @@ export class DateRangeWidgetComponent implements OnInit {
constructor( constructor(
private dateAdapter: DateAdapter<Moment>, private dateAdapter: DateAdapter<Moment>,
private preferences: UserPreferencesService) { private userPreferencesService: UserPreferencesService) {
} }
ngOnInit() { ngOnInit() {
this.preferences.locale$.subscribe( (locale) => { this.userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.dateAdapter.setLocale(locale); this.dateAdapter.setLocale(locale);
}); });
let momentDateAdapter = <MomentDateAdapter> this.dateAdapter; let momentDateAdapter = <MomentDateAdapter> this.dateAdapter;
momentDateAdapter.overrideDisplayFormat = this.SHOW_FORMAT; momentDateAdapter.overrideDisplayFormat = this.SHOW_FORMAT;
@@ -17,9 +17,8 @@
import { Component, ElementRef, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { Component, ElementRef, EventEmitter, Input, OnInit, Output } from '@angular/core';
// @deprecated 2.3.0 diagram-alfresco-publish-task tag removed
@Component({ @Component({
selector: 'adf-diagram-publish-task, diagram-alfresco-publish-task', selector: 'adf-diagram-publish-task',
templateUrl: './diagram-alfresco-publish-task.component.html' templateUrl: './diagram-alfresco-publish-task.component.html'
}) })
export class DiagramAlfrescoPublishTaskComponent implements OnInit { export class DiagramAlfrescoPublishTaskComponent implements OnInit {
@@ -17,9 +17,8 @@
import { Component, ElementRef, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { Component, ElementRef, EventEmitter, Input, OnInit, Output } from '@angular/core';
// @deprecated 2.3.0 diagram-sequence-flow tag removed
@Component({ @Component({
selector: 'adf-diagram-sequence-flow, diagram-sequence-flow', selector: 'adf-diagram-sequence-flow',
templateUrl: './diagram-sequence-flow.component.html' templateUrl: './diagram-sequence-flow.component.html'
}) })
export class DiagramSequenceFlowComponent implements OnInit { export class DiagramSequenceFlowComponent implements OnInit {
@@ -69,7 +69,7 @@ describe('Diagrams flows', () => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
expect(res).not.toBeNull(); expect(res).not.toBeNull();
let shape: any = element.querySelector('diagram-sequence-flow > raphael-flow-arrow'); let shape: any = element.querySelector('adf-diagram-sequence-flow > raphael-flow-arrow');
expect(shape).not.toBeNull(); expect(shape).not.toBeNull();
let tooltip: any = element.querySelector('diagram-tooltip > div'); let tooltip: any = element.querySelector('diagram-tooltip > div');
@@ -90,7 +90,7 @@ describe('Diagrams flows', () => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
expect(res).not.toBeNull(); expect(res).not.toBeNull();
let shape: any = element.querySelector('diagram-sequence-flow > raphael-flow-arrow'); let shape: any = element.querySelector('adf-diagram-sequence-flow > raphael-flow-arrow');
expect(shape).not.toBeNull(); expect(shape).not.toBeNull();
let tooltip: any = element.querySelector('diagram-tooltip > div'); let tooltip: any = element.querySelector('diagram-tooltip > div');
@@ -57,7 +57,7 @@
<div *ngFor="let flow of diagram.flows"> <div *ngFor="let flow of diagram.flows">
<div [ngSwitch]="flow.type"> <div [ngSwitch]="flow.type">
<div *ngSwitchCase="'sequenceFlow'"> <div *ngSwitchCase="'sequenceFlow'">
<diagram-sequence-flow [flow]="flow"></diagram-sequence-flow> <adf-diagram-sequence-flow [flow]="flow"></adf-diagram-sequence-flow>
</div> </div>
</div> </div>
</div> </div>
@@ -27,7 +27,8 @@ import {
LogService, LogService,
UserPreferencesService, UserPreferencesService,
IdentityUserService, IdentityUserService,
IdentityUserModel IdentityUserModel,
UserPreferenceValues
} from '@alfresco/adf-core'; } from '@alfresco/adf-core';
import { PeopleCloudComponent } from './people-cloud/people-cloud.component'; import { PeopleCloudComponent } from './people-cloud/people-cloud.component';
@@ -95,16 +96,17 @@ export class StartTaskCloudComponent implements OnInit, OnDestroy {
constructor(private taskService: StartTaskCloudService, constructor(private taskService: StartTaskCloudService,
private dateAdapter: DateAdapter<Moment>, private dateAdapter: DateAdapter<Moment>,
private preferences: UserPreferencesService, private userPreferencesService: UserPreferencesService,
private formBuilder: FormBuilder, private formBuilder: FormBuilder,
private identityUserService: IdentityUserService, private identityUserService: IdentityUserService,
private logService: LogService) { private logService: LogService) {
} }
ngOnInit() { ngOnInit() {
this.localeSub = this.preferences.locale$.subscribe((locale) => { this.userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.dateAdapter.setLocale(locale); this.dateAdapter.setLocale(locale);
}); });
this.loadCurrentUser(); this.loadCurrentUser();
this.buildForm(); this.buildForm();
} }

Some files were not shown because too many files have changed in this diff Show More