[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

View File

@@ -212,8 +212,8 @@
<mat-slide-toggle
id="adf-switch-allowsidebar"
[color]="'primary'"
(change)="toggleAllowSidebar()"
[checked]="allowSidebar">
(change)="toggleAllowRightSidebar()"
[checked]="allowRightSidebar">
Allow Right Sidebar
</mat-slide-toggle>
</p>
@@ -255,22 +255,20 @@
</adf-info-drawer>
</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
[nodeId]="nodeId"
[showSidebar]="showRightSidebar"
[showRightSidebar]="showRightSidebar"
[showLeftSidebar]="showLeftSidebar"
[allowGoBack]="allowGoBack"
[displayName]="displayName"
[showToolbar]="showToolbar"
[allowPrint]="allowPrint"
[allowDownload]="allowDownload"
[allowSidebar]="allowSidebar"
[allowRightSidebar]="allowRightSidebar"
[allowLeftSidebar]="allowLeftSidebar"
[urlFile]="urlFile"
[sidebarLeftTemplate]="sidebarLeftTemplate"
[sidebarTemplate]="sidebarRightTemplate">
[sidebarRightTemplate]="sidebarRightTemplate">
<adf-viewer-toolbar *ngIf="customToolbar" data-automation-id="adf-viewer-custom-toolbar">
<h1>My custom toolbar</h1>

View File

@@ -43,7 +43,7 @@ export class FileViewComponent implements OnInit {
openWith = false;
allowDownload = true;
allowPrint = true;
allowSidebar = true;
allowRightSidebar = true;
allowLeftSidebar = true;
moreActions = true;
customName = false;
@@ -131,8 +131,8 @@ export class FileViewComponent implements OnInit {
this.showLeftSidebar = false;
}
toggleAllowSidebar() {
this.allowSidebar = !this.allowSidebar;
toggleAllowRightSidebar() {
this.allowRightSidebar = !this.allowRightSidebar;
}
toggleAllowLeftSidebar() {

View File

@@ -81,7 +81,6 @@
[successRoute]="customSuccessRouteURI"
[logoImageUrl]="customLogoImageURL"
[fieldsValidation]="customValidation"
[disableCsrf]="disableCsrf"
[showLoginActions]="showFooter"
[showRememberMe]="showFooter && showRememberMe"
(executeSubmit)="checkForm($event)"

View File

@@ -2,7 +2,7 @@
<div class="adf-no-form-container">
<adf-upload-drag-area
[parentId]="processInstanceId"
[rootFolderId]="processInstanceId"
[disabled]="isCompletedProcess()">
<adf-process-attachment-list #processAttachList

View File

@@ -42,7 +42,6 @@
[page]="taskPage"
[size]="paginationPageSize"
[selectionMode]="selectionMode"
[processDefinitionKey]="taskFilter?.filter?.processDefinitionKey"
[name]="taskFilter?.filter?.name"
[assignment]="taskFilter?.filter?.assignment"
[state]="taskFilter?.filter?.state"
@@ -157,7 +156,6 @@
#processList
*ngIf="processFilter?.filter" [appId]="processFilter?.appId"
[selectionMode]="selectionMode"
[processDefinitionKey]="processFilter?.filter?.processDefinitionKey"
[presetColumn]="presetColumn"
[state]="processFilter?.filter?.state"
[page]="processPage"
@@ -231,12 +229,12 @@
<div class="adf-grid-item adf-reports-menu" fxFlex.gt-md="300px">
<span><h5>Report List</h5></span>
<mat-divider></mat-divider>
<analytics-report-list
<adf-analytics-report-list
[appId]="appId"
[selectFirst]="selectFirstReport"
(reportClick)="onReportClick($event)"
#analyticsReportList>
</analytics-report-list>
</adf-analytics-report-list>
</div>
<div class="adf-grid-item adf-reports-details" fxFlex.gt-md="1 1 auto">
<adf-analytics

View File

@@ -2,7 +2,7 @@
<div class="adf-no-form-container">
<adf-upload-drag-area
[parentId]="taskId">
[rootFolderId]="taskId">
<adf-task-attachment-list #taskAttachList
[disabled]="isCompletedTask()"

View File

@@ -1,9 +1,4 @@
<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">
<mat-form-field>
<label>{{'APP_LAYOUT.WORD_TO_SEARCH' | translate}}</label>
@@ -13,7 +8,6 @@
</div>
<div>
<adf-search #auto="searchAutocomplete"
[queryBody]="generateQueryBody(searchedWord)"
class="adf-example-card-search-container">
<ng-template let-data>
<mat-card class="adf-example-card"

View File

@@ -16,7 +16,7 @@
*/
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 { ThumbnailService } from '@alfresco/adf-core';
import { SearchService, SearchConfigurationService } from '@alfresco/adf-core';
@@ -41,12 +41,10 @@ export class SearchExtendedComponent {
searchedWord = '';
queryBodyString = '';
errorMessage = '';
resultNodePageList: NodePaging;
maxItems: number;
skipCount = 0;
pagination: Pagination;
queryBody: QueryBody;
useServiceApproach = false;
constructor(public thumbnailService: ThumbnailService) {
@@ -65,20 +63,4 @@ export class SearchExtendedComponent {
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' }]
};
}
}
}

View File

@@ -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 |
| 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' |
| 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 |
| 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. |
@@ -80,7 +78,6 @@ Displays the documents from a repository.
| 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. |
| 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. |
| 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 |
@@ -98,7 +95,7 @@ Displays the documents from a repository.
## 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
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 :
@@ -175,12 +172,28 @@ Set the `[display]` property to "gallery" to enable card view mode:
### 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
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
parameter: `enableInfiniteScrolling`.
#### Pagination component
```html
<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
@@ -447,7 +460,7 @@ Now you can access Document List properties or call methods directly:
```ts
// print currently displayed folder node object to console
console.log(documentList.folderNode);
console.log(documentList.currentFolderId);
```
**Important note**:
@@ -660,7 +673,7 @@ actions you have defined in a context menu:
selector: 'my-view',
template: `
<adf-document-list [contextMenuActions]="true">...</adf-document-list>
<context-menu-holder></context-menu-holder>
<adf-context-menu-holder></context-menu-holder>
`
})
export class MyView {

View File

@@ -54,11 +54,6 @@ Implements node operations used by the [Document List component](../content-serv
- _nodeId:_ `string` - ID of the target node
- _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
- **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/>
Moves a node to destination node.
- _nodeId:_ `string` - The id of the node to be moved

View File

@@ -47,7 +47,6 @@ Some sample CSS to show the drag and drop area:
| 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. |
| 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. |
## Details

View File

@@ -43,7 +43,6 @@ You can show your own custom template when no results are found for the search:
| Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- |
| 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. |
| 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). |

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. |
| 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. |
| 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
[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
[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
[Search Configuration interface](../core/search-configuration.interface.md) page for full details of how to
customize your search.

View File

@@ -68,14 +68,13 @@ as the drag/drop target:
| 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. |
| versioning | `boolean` | false | Toggles versioning. |
| parentId | `void` | | (**Deprecated:** 2.4.0 - use rootFolderId ID of parent folder node) ID of parent folder node |
### Events
| 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. |
| 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. |
| success | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<Object>` | Emitted when the file is uploaded successfully. |

View File

@@ -22,7 +22,6 @@ Displays the version history of a node in a [Version Manager component](../conte
| Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- |
| 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. |
| showActions | `boolean` | true | Toggles showing/hiding of version actions |
| showComments | `boolean` | true | Toggles showing/hiding of comments |

View File

@@ -13,7 +13,7 @@ Adds a context menu to a component.
```html
<my-component [context-menu]="menuItems"></my-component>
<context-menu-holder></context-menu-holder>
<adf-context-menu-holder></context-menu-holder>
```
```ts

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. |
| 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. |
| 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

View File

@@ -67,9 +67,6 @@ class MyComponent {
Saves a form.
- `formId` - ID of the form to save
- `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>`
Search for a form by name.
- `name` - The form name to search for

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 |
| ---- | ---- | ----------- |
| 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. |
| 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. |
| success | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<boolean>` | Emitted when the changes are successfully applied. |

View File

@@ -40,7 +40,6 @@ Adds "infinite" pagination to the component it is used with.
| ---- | ---- | ------------- | ----------- |
| isLoading | `boolean` | false | Is a new page loading? |
| 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. |
### Events

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. |
| 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. |
| logoImageUrl | `string` | | Path to a custom logo image. |
| 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. |
| 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. |

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
<alfresco-upload-drag-area
[parentId]="..."
[rootFolderId]="..."
[versioning]="..."
[adf-node-permission]="'create'"
[adf-nodes]="getCurrentDocumentListNode()">

View File

@@ -14,7 +14,6 @@ Restores deleted nodes to their original location.
```html
<adf-toolbar title="toolbar example">
<button mat-icon-button
location="/files"
[adf-restore]="documentList.selection"
(restore)="onRestore($event)">
<mat-icon>restore</mat-icon>
@@ -51,7 +50,6 @@ Restores deleted nodes to their original location.
| Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- |
| location | `string` | "" | (**Deprecated:** 2.4.0) Path to restored node. |
| selection | `DeletedNodeEntry[]` | | Array of deleted nodes to restore. |
### Events

View File

@@ -1,7 +1,7 @@
---
Title: Renditions service
Added: v2.0.0
Status: Deprecated
Status: Active
---
# [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
**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.
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

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. |
| 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. |
| 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. |
## Details

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
- **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.
- _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

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. |
| allowGoBack | `boolean` | true | Allows `back` navigation |
| 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. |
| 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. |
| 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. |
@@ -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. |
| 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). |
| showLeftSidebar | `boolean` | false | Toggles left sidebar visibility. Requires `allowSidebar` 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`. |
| showLeftSidebar | `boolean` | false | Toggles left sidebar visibility. Requires `allowLeftSidebar` 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 |
| 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. |
| sidebarPosition | `string` | "right" | (**Deprecated:** 2.5.0 use sidebarTemplateLeft) The position of the sidebar. Can be `left` or `right`. |
| 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. |
| sidebarRightTemplate | [`TemplateRef`](https://angular.io/api/core/TemplateRef)`<any>` | null | The template for right 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. |
| 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. |
@@ -362,13 +360,13 @@ The result should look like this:
#### Custom sidebar
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
transclusion, which will display all content placed inside the `<adf-viewer-sidebar>` element:
```html
<adf-viewer [allowSidebar]="true">
<adf-viewer [allowRightSidebar]="true">
<adf-viewer-sidebar>
<h1>My info</h1>
</adf-viewer-sidebar>
@@ -382,7 +380,7 @@ when using the viewer with `nodeId`.
<ng-template let-node="node" #sidebarTemplate>
<adf-content-metadata-card [node]="node"></adf-content-metadata-card>
</ng-template>
<adf-viewer [allowSidebar]="true" [sidebarTemplate]="sidebarTemplate"></adf-viewer>
<adf-viewer [allowRightSidebar]="true" [sidebarRightTemplate]="sidebarTemplate"></adf-viewer>
```
#### Custom thumbnails

View File

@@ -84,7 +84,7 @@ a custom _no content template_ (using &lt;adf-empty-list>) to invite the user to
```html
<adf-upload-drag-area
[parentId]="YOUR_PROCESS_ID"
[rootFolderId]="YOUR_PROCESS_ID"
[showNotificationBar]="BOOLEAN">
<adf-process-attachment-list
[processId]="YOUR_PROCESS_ID"

View File

@@ -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 |
| page | `number` | 0 | The page number of the processes to fetch. |
| processDefinitionId | `string` | | The Definition Id of the process. |
| processDefinitionKey | `string` | | (**Deprecated:** 2.4.0) The Definition Key of the process. |
| processInstanceId | `number \| string` | | The id of the process instance. |
| processInstanceId | `number` | | | The id of the process instance. |
| 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. |
| size | `number` | | The number of processes to fetch in each page. |

View File

@@ -67,7 +67,7 @@ upload whenever the list is empty.
```html
<adf-upload-drag-area
[parentId]="YOUR_TASK_ID"
[rootFolderId]="YOUR_TASK_ID"
[showNotificationBar]="BOOLEAN">
<adf-task-attachment-list
[taskId]="YOUR_TASK_ID"

View File

@@ -64,7 +64,6 @@ when the task list is empty:
| name | `string` | | Name of the tasklist. |
| page | `number` | 0 | The page number of the tasks to fetch. |
| 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. |
| 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. |

View File

@@ -28,4 +28,4 @@
[nodeId]="nodeId"
(goBack)="onGoBack($event)">
</adf-viewer>
<file-uploading-dialog></file-uploading-dialog>
<adf-file-uploading-dialog></adf-file-uploading-dialog>

View File

@@ -1,15 +1,15 @@
<header
mat-dialog-title
data-automation-id="content-node-selector-title">{{title || data?.title}}
data-automation-id="content-node-selector-title">{{data?.title}}
</header>
<mat-dialog-content>
<adf-content-node-selector-panel
[currentFolderId]="currentFolderId || data?.currentFolderId"
[dropdownHideMyFiles]="dropdownHideMyFiles || data?.dropdownHideMyFiles"
[dropdownSiteList]="dropdownSiteList || data?.dropdownSiteList"
[rowFilter]="rowFilter || data?.rowFilter"
[imageResolver]="imageResolver || data?.imageResolver"
[currentFolderId]="data?.currentFolderId"
[dropdownHideMyFiles]="data?.dropdownHideMyFiles"
[dropdownSiteList]="data?.dropdownSiteList"
[rowFilter]="data?.rowFilter"
[imageResolver]="data?.imageResolver"
[isSelectionValid]="data?.isSelectionValid"
[breadcrumbTransform]="data?.breadcrumbTransform"
[excludeSiteContent]="data?.excludeSiteContent"

View File

@@ -15,12 +15,10 @@
* 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 { Node, SitePaging } from '@alfresco/js-api';
import { Node } from '@alfresco/js-api';
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({
selector: 'adf-content-node-selector',
@@ -30,48 +28,6 @@ import { ImageResolver } from '../document-list/data/image-resolver.model';
})
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;
chosenNode: Node[];

View File

@@ -147,7 +147,7 @@ describe('ShareDialogComponent', () => {
it('should open a confirmation dialog when unshare button is triggered', () => {
spyOn(matDialog, 'open').and.returnValue({ beforeClose: () => of(false) });
spyOn(sharedLinksApiService, 'deleteSharedLink');
spyOn(sharedLinksApiService, 'deleteSharedLink').and.callThrough();
node.entry.properties['qshare:sharedId'] = 'sharedId';
component.data = {
@@ -167,7 +167,7 @@ describe('ShareDialogComponent', () => {
it('should unshare file when confirmation dialog returns true', fakeAsync(() => {
spyOn(matDialog, 'open').and.returnValue({ beforeClose: () => of(true) });
spyOn(sharedLinksApiService, 'deleteSharedLink');
spyOn(sharedLinksApiService, 'deleteSharedLink').and.callThrough();
node.entry.properties['qshare:sharedId'] = 'sharedId';
component.data = {
@@ -187,7 +187,7 @@ describe('ShareDialogComponent', () => {
it('should not unshare file when confirmation dialog returns false', fakeAsync(() => {
spyOn(matDialog, 'open').and.returnValue({ beforeClose: () => of(false) });
spyOn(sharedLinksApiService, 'deleteSharedLink');
spyOn(sharedLinksApiService, 'deleteSharedLink').and.callThrough();
node.entry.properties['qshare:sharedId'] = 'sharedId';
component.data = {

View File

@@ -72,6 +72,7 @@ describe('DocumentList', () => {
customResourcesService = TestBed.get(CustomResourcesService);
documentList.ngOnInit();
documentList.currentFolderId = 'no-node';
spyGetSites = spyOn(apiService.sitesApi, 'getSites').and.returnValue(Promise.resolve(fakeGetSitesAnswer));
spyFavorite = spyOn(apiService.favoritesApi, 'getFavorites').and.returnValue(Promise.resolve({ list: [] }));
@@ -246,20 +247,17 @@ describe('DocumentList', () => {
expect(documentList.dataTable.resetSelection).toHaveBeenCalled();
});
it('should empty template be present when no element are present', (done) => {
fixture.detectChanges();
documentList.folderNode = new NodeMinimal();
documentList.folderNode.id = '1d26e465-dea3-42f3-b415-faa8364b9692';
it('should empty template be present when no element are present', () => {
spyOn(documentList, 'loadFolderNodesByFolderNodeId').and.returnValue(Promise.resolve(''));
spyOn(documentList, 'loadFolder').and.callThrough();
spyOn(documentListService, 'getFolderNode').and.returnValue(of({ entry: { id: 'fake-node' } }));
spyOn(documentListService, 'getFolder').and.returnValue(of(fakeNodeAnswerWithNOEntries));
let disposableReady = documentList.ready.subscribe(() => {
expect(element.querySelector('#adf-document-list-empty')).toBeDefined();
disposableReady.unsubscribe();
done();
});
documentList.currentFolderId = '1d26e465-dea3-42f3-b415-faa8364b9692';
fixture.detectChanges();
documentList.reload();
expect(element.querySelector('#adf-document-list-empty')).toBeDefined();
});
it('should not execute action without node provided', () => {
@@ -959,10 +957,9 @@ describe('DocumentList', () => {
});
it('should load folder by ID on init', () => {
documentList.currentFolderId = '1d26e465-dea3-42f3-b415-faa8364b9692';
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();
});
@@ -1294,7 +1291,6 @@ describe('DocumentList', () => {
spyOn(documentList, 'reload').and.stub();
documentList.maxItems = 0;
documentList.skipCount = 0;
documentList.updatePagination({
maxItems: 10,
@@ -1313,32 +1309,6 @@ describe('DocumentList', () => {
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', () => {
fixture.detectChanges();
documentList.currentFolderId = 'fake-id';

View File

@@ -173,13 +173,6 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
@Input()
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 */
@Input()
node: NodePaging = null;
@@ -188,20 +181,6 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
@Input()
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 */
@Output()
nodeClick: EventEmitter<NodeEntityEvent> = new EventEmitter<NodeEntityEvent>();
@@ -239,6 +218,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
data: ShareDataTableAdapter;
noPermission: boolean = false;
selection = new Array<NodeEntry>();
folderNode: Node = null;
private _pagination: BehaviorSubject<PaginationModel>;
private layoutPresets = {};
@@ -272,11 +252,6 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
return null;
}
/** @deprecated 2.3.0 define it in pagination */
get supportedPageSizes(): number[] {
return this.preferences.getDefaultPageSizes();
}
get hasCustomLayout(): boolean {
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> {
if (!this._pagination) {
let maxItems = this.maxItems || this.preferences.paginationSize;
let maxItems = this.maxItems || this.preferences.paginationSize;
let defaultPagination = <PaginationModel> {
maxItems: maxItems,
skipCount: 0,
@@ -337,7 +312,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
ngOnInit() {
this.rowMenuCache = {};
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.permissionsStyle = this.permissionsStyle;
@@ -375,7 +350,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
}
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) {
this.data.setColumns(schema);
}
@@ -404,11 +379,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
}
}
if (changes.folderNode && changes.folderNode.currentValue) {
this.currentFolderId = changes.folderNode.currentValue.id;
this.resetNewFolderPagination();
this.loadFolder();
} else if (changes.currentFolderId &&
if (changes.currentFolderId &&
changes.currentFolderId.currentValue &&
changes.currentFolderId.currentValue !== changes.currentFolderId.previousValue) {
this.resetNewFolderPagination();
@@ -600,13 +571,8 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
this.setupDefaultColumns(this.currentFolderId);
}
if (this.folderNode) {
return this.loadFolderNodesByFolderNodeId(this.folderNode.id, this.pagination.getValue())
.catch((err) => this.handleError(err));
} else {
this.loadFolderByNodeId(this.currentFolderId);
}
}
loadFolderByNodeId(nodeId: string) {
if (this.customResourcesService.isCustomSource(nodeId)) {

View File

@@ -15,10 +15,9 @@
* 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 { PermissionStyleModel } from './../models/permissions-style.model';
import { DocumentListService } from './../services/document-list.service';
export class ShareDataRow implements DataRow {
@@ -34,7 +33,7 @@ export class ShareDataRow implements DataRow {
}
constructor(private obj: NodeEntry,
private documentListService: DocumentListService,
private contentService: ContentService,
private permissionsStyle: PermissionStyleModel[],
private thumbnailService?: ThumbnailService) {
if (!obj) {
@@ -55,7 +54,7 @@ export class ShareDataRow implements DataRow {
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}`;
}
}
@@ -74,7 +73,7 @@ export class ShareDataRow implements DataRow {
}
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 {

View File

@@ -24,21 +24,22 @@ import { ShareDataTableAdapter } from './share-datatable-adapter';
describe('ShareDataTableAdapter', () => {
let documentListService: DocumentListService;
let contentService: ContentService;
beforeEach(() => {
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);
spyOn(documentListService, 'getDocumentThumbnailUrl').and.returnValue(imageUrl);
});
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');
});
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';
expect(adapter.sortingMode).toBe('client');
@@ -48,7 +49,7 @@ describe('ShareDataTableAdapter', () => {
});
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';
expect(adapter.sortingMode).toBe('server');
@@ -59,27 +60,27 @@ describe('ShareDataTableAdapter', () => {
it('should setup rows and columns with constructor', () => {
let schema = [<DataColumn> {}];
let adapter = new ShareDataTableAdapter(documentListService, null, schema);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, schema);
expect(adapter.getRows()).toEqual([]);
expect(adapter.getColumns()).toEqual(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([]);
});
it('should set new columns', () => {
let columns = [<DataColumn> {}, <DataColumn> {}];
let adapter = new ShareDataTableAdapter(documentListService, null, null);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
adapter.setColumns(columns);
expect(adapter.getColumns()).toEqual(columns);
});
it('should reset columns', () => {
let columns = [<DataColumn> {}, <DataColumn> {}];
let adapter = new ShareDataTableAdapter(documentListService, null, columns);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, columns);
expect(adapter.getColumns()).toEqual(columns);
adapter.setColumns(null);
@@ -88,7 +89,7 @@ describe('ShareDataTableAdapter', () => {
it('should set new rows', () => {
let rows = [<DataRow> {}, <DataRow> {}];
let adapter = new ShareDataTableAdapter(documentListService, null, null);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
expect(adapter.getRows()).toEqual([]);
adapter.setRows(rows);
@@ -97,7 +98,7 @@ describe('ShareDataTableAdapter', () => {
it('should reset rows', () => {
let rows = [<DataRow> {}, <DataRow> {}];
let adapter = new ShareDataTableAdapter(documentListService, null, null);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
adapter.setRows(rows);
expect(adapter.getRows()).toEqual(rows);
@@ -107,7 +108,7 @@ describe('ShareDataTableAdapter', () => {
});
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();
let rows = [<DataRow> {}];
@@ -117,7 +118,7 @@ describe('ShareDataTableAdapter', () => {
});
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 = () => {
return adapter.getValue(null, <DataColumn> {});
};
@@ -125,7 +126,7 @@ describe('ShareDataTableAdapter', () => {
});
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 = () => {
return adapter.getValue(<DataRow> {}, null);
};
@@ -143,8 +144,8 @@ describe('ShareDataTableAdapter', () => {
type: 'string'
};
let row = new ShareDataRow(file, documentListService, null);
let adapter = new ShareDataTableAdapter(documentListService, null, null);
let row = new ShareDataRow(file, contentService, null);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
let value = adapter.getValue(row, col);
expect(value).toBe(rawValue);
@@ -153,12 +154,12 @@ describe('ShareDataTableAdapter', () => {
it('should generate fallback icon for a file thumbnail with missing mime type', () => {
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();
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 value = adapter.getValue(row, col);
@@ -169,12 +170,12 @@ describe('ShareDataTableAdapter', () => {
it('should generate fallback icon for a file with no content entry', () => {
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();
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 value = adapter.getValue(row, col);
@@ -188,8 +189,8 @@ describe('ShareDataTableAdapter', () => {
let file = new FileNode();
file.entry['icon'] = imageUrl;
let adapter = new ShareDataTableAdapter(documentListService, null, null);
let row = new ShareDataRow(file, documentListService, null);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
let row = new ShareDataRow(file, contentService, null);
let col = <DataColumn> { type: 'image', key: 'icon' };
let value = adapter.getValue(row, col);
@@ -199,9 +200,9 @@ describe('ShareDataTableAdapter', () => {
it('should resolve folder icon', () => {
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 value = adapter.getValue(row, col);
@@ -212,9 +213,9 @@ describe('ShareDataTableAdapter', () => {
it('should resolve smart folder icon', () => {
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 value = adapter.getValue(row, col);
@@ -225,9 +226,9 @@ describe('ShareDataTableAdapter', () => {
it('should resolve link folder icon', () => {
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 value = adapter.getValue(row, col);
@@ -238,9 +239,9 @@ describe('ShareDataTableAdapter', () => {
it('should resolve rule folder icon', () => {
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 value = adapter.getValue(row, col);
@@ -250,11 +251,11 @@ describe('ShareDataTableAdapter', () => {
it('should resolve file thumbnail', () => {
let imageUrl = 'http://<addresss>';
let adapter = new ShareDataTableAdapter(documentListService, null, null);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, null);
adapter.thumbnails = true;
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 value = adapter.getValue(row, col);
@@ -265,14 +266,14 @@ describe('ShareDataTableAdapter', () => {
it('should resolve fallback file icon for unknown node', () => {
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();
file.entry.isFile = false;
file.entry.isFolder = false;
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 value = adapter.getValue(row, col);
@@ -282,14 +283,14 @@ describe('ShareDataTableAdapter', () => {
it('should resolve file icon for content type', () => {
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();
file.entry.isFile = false;
file.entry.isFolder = false;
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 value = adapter.getValue(row, col);
@@ -303,13 +304,13 @@ describe('ShareDataTableAdapter', () => {
let folder = new FolderNode();
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.setRows([
new ShareDataRow(file2, documentListService, null),
new ShareDataRow(file1, documentListService, null),
new ShareDataRow(folder, documentListService, null)
new ShareDataRow(file2, contentService, null),
new ShareDataRow(file1, contentService, null),
new ShareDataRow(folder, contentService, null)
]);
let sorted = adapter.getRows();
@@ -326,11 +327,11 @@ describe('ShareDataTableAdapter', () => {
file2.entry['dateProp'] = new Date(2016, 6, 30, 13, 14, 2);
let col = <DataColumn> { key: 'dateProp' };
let adapter = new ShareDataTableAdapter(documentListService, null, [col]);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, [col]);
adapter.setRows([
new ShareDataRow(file2, documentListService, null),
new ShareDataRow(file1, documentListService, null)
new ShareDataRow(file2, contentService, null),
new ShareDataRow(file1, contentService, null)
]);
adapter.sort('dateProp', 'asc');
@@ -356,13 +357,13 @@ describe('ShareDataTableAdapter', () => {
file4.entry.content.sizeInBytes = 2852791665; // 2.66 GB
let col = <DataColumn> { key: 'content.sizeInBytes' };
let adapter = new ShareDataTableAdapter(documentListService, null, [col]);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, [col]);
adapter.setRows([
new ShareDataRow(file3, documentListService, null),
new ShareDataRow(file4, documentListService, null),
new ShareDataRow(file1, documentListService, null),
new ShareDataRow(file2, documentListService, null)
new ShareDataRow(file3, contentService, null),
new ShareDataRow(file4, contentService, null),
new ShareDataRow(file1, contentService, null),
new ShareDataRow(file2, contentService, null)
]);
adapter.sort('content.sizeInBytes', 'asc');
@@ -389,15 +390,15 @@ describe('ShareDataTableAdapter', () => {
let file6 = new FileNode('b');
let col = <DataColumn> { key: 'name' };
let adapter = new ShareDataTableAdapter(documentListService, null, [col]);
let adapter = new ShareDataTableAdapter(documentListService, null, contentService, [col]);
adapter.setRows([
new ShareDataRow(file4, documentListService, null),
new ShareDataRow(file6, documentListService, null),
new ShareDataRow(file3, documentListService, null),
new ShareDataRow(file1, documentListService, null),
new ShareDataRow(file2, documentListService, null),
new ShareDataRow(file5, documentListService, null)
new ShareDataRow(file4, contentService, null),
new ShareDataRow(file6, contentService, null),
new ShareDataRow(file3, contentService, null),
new ShareDataRow(file1, contentService, null),
new ShareDataRow(file2, contentService, null),
new ShareDataRow(file5, contentService, null)
]);
adapter.sort('name', 'asc');
@@ -423,25 +424,25 @@ describe('ShareDataTableAdapter', () => {
it('should wrap node', () => {
let file = new FileNode();
let row = new ShareDataRow(file, documentListService, null);
let row = new ShareDataRow(file, contentService, null);
expect(row.node).toBe(file);
});
it('should require object source', () => {
expect(() => {
return new ShareDataRow(null, documentListService, null);
return new ShareDataRow(null, contentService, null);
}).toThrowError(ShareDataRow.ERR_OBJECT_NOT_FOUND);
});
it('should resolve value from node entry', () => {
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');
});
it('should check value', () => {
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('missing')).toBeFalsy();
@@ -450,21 +451,21 @@ describe('ShareDataTableAdapter', () => {
it('should be set as drop target when user has permission for that node', () => {
let file = new FolderNode('test');
file.entry['allowableOperations'] = ['create'];
let row = new ShareDataRow(file, documentListService, null);
let row = new ShareDataRow(file, contentService, null);
expect(row.isDropTarget).toBeTruthy();
});
it('should not be set as drop target when user has permission for that node', () => {
let file = new FolderNode('test');
let row = new ShareDataRow(file, documentListService, null);
let row = new ShareDataRow(file, contentService, null);
expect(row.isDropTarget).toBeFalsy();
});
it('should not be set as drop target when element is not a Folder', () => {
let file = new FileNode('test');
let row = new ShareDataRow(file, documentListService, null);
let row = new ShareDataRow(file, contentService, null);
expect(row.isDropTarget).toBeFalsy();
});

View File

@@ -15,7 +15,7 @@
* 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 { PermissionStyleModel } from './../models/permissions-style.model';
import { DocumentListService } from './../services/document-list.service';
@@ -52,6 +52,7 @@ export class ShareDataTableAdapter implements DataTableAdapter {
constructor(private documentListService: DocumentListService,
private thumbnailService: ThumbnailService,
private contentService: ContentService,
schema: DataColumn[] = [],
sorting?: DataSorting,
sortingMode: string = 'client') {
@@ -241,7 +242,7 @@ export class ShareDataTableAdapter implements DataTableAdapter {
if (page && page.list) {
let data = page.list.entries;
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) {
rows = rows.filter(this.filter);

View File

@@ -16,8 +16,7 @@
*/
import {
AlfrescoApiService, AuthenticationService, ContentService, LogService,
PermissionsEnum, ThumbnailService
AlfrescoApiService, AuthenticationService, ContentService, LogService, ThumbnailService
} from '@alfresco/adf-core';
import { Injectable } from '@angular/core';
@@ -179,17 +178,6 @@ export class DocumentListService {
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) {
this.logService.error(error);
return throwError(error || 'Server error');

View File

@@ -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();
});
}
}

View File

@@ -17,6 +17,5 @@
export * from './document-library.model.mock';
export * from './document-list.component.mock';
export * from './document-list.service.mock';
export * from './search.component.mock';
export * from './search.service.mock';

View File

@@ -118,7 +118,7 @@ export let errorJson = {
@Component({
template: `
<adf-search [searchTerm]="searchedWord" [queryBody]="searchNode" [maxResults]="maxResults"
<adf-search [searchTerm]="searchedWord" [maxResults]="maxResults"
(error)="showSearchResult('ERROR')"
(success)="showSearchResult('success')" #search>
<ng-template let-data>

View File

@@ -32,8 +32,7 @@
<adf-search #search
#auto="searchAutocomplete"
class="adf-search-result-autocomplete"
[maxResults]="liveSearchMaxResults"
[queryBody]="customQueryBody">
[maxResults]="liveSearchMaxResults">
<ng-template let-data>
<mat-list *ngIf="isSearchBarActive()" id="autocomplete-search-result-list">
<mat-list-item

View File

@@ -19,7 +19,7 @@ import { AuthenticationService, ThumbnailService } from '@alfresco/adf-core';
import { animate, state, style, transition, trigger } from '@angular/animations';
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output,
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 { SearchComponent } from './search.component';
import { MatListItem } from '@angular/material';
@@ -72,10 +72,6 @@ export class SearchControlComponent implements OnInit, OnDestroy {
@Input()
liveSearchMaxResults: number = 5;
/** @deprecated in 2.1.0 */
@Input()
customQueryBody: QueryBody;
/** Emitted when the search is submitted by pressing the ENTER key.
* The search term is provided as the value of the event.
*/

View File

@@ -17,22 +17,10 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { SearchService, setupTestBed, CoreModule } from '@alfresco/adf-core';
import { QueryBody } from '@alfresco/js-api';
import { differentResult, folderResult, result, SimpleSearchTestComponent } from '../../mock';
import { Observable, of, throwError } from 'rxjs';
import { differentResult, result, SimpleSearchTestComponent } from '../../mock';
import { of, throwError } from 'rxjs';
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', () => {
let fixture: ComponentFixture<SimpleSearchTestComponent>, element: HTMLElement;
@@ -131,30 +119,6 @@ describe('SearchComponent', () => {
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) => {
spyOn(searchService, 'search').and.returnValue(of(result));
component.setSearchWordTo('searchTerm');
@@ -168,29 +132,5 @@ describe('SearchComponent', () => {
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();
});
});
});
});

View File

@@ -29,7 +29,7 @@ import {
ViewChild,
ViewEncapsulation
} from '@angular/core';
import { NodePaging, QueryBody } from '@alfresco/js-api';
import { NodePaging } from '@alfresco/js-api';
import { Subject } from 'rxjs';
import { debounceTime } from 'rxjs/operators';
@@ -64,10 +64,6 @@ export class SearchComponent implements AfterContentInit, OnChanges {
@Input()
skipResults: number = 0;
/** @deprecated in 2.1.0 */
@Input()
queryBody: QueryBody;
/** Search term to use when executing the search. Updating this value will
* run a new search and update the results.
*/
@@ -129,10 +125,6 @@ export class SearchComponent implements AfterContentInit, OnChanges {
}
ngOnChanges(changes) {
if (changes.queryBody &&
this.hasDifferentQueryBody(changes.queryBody.previousValue, changes.queryBody.currentValue)) {
this.loadSearchResults();
}
if (changes.searchTerm && changes.searchTerm.currentValue) {
this.loadSearchResults(changes.searchTerm.currentValue);
}
@@ -147,10 +139,6 @@ export class SearchComponent implements AfterContentInit, OnChanges {
this.loadSearchResults(this.searchTerm);
}
private hasDifferentQueryBody(previousQueryBody: QueryBody, currentQueryBody: QueryBody) {
return JSON.stringify(previousQueryBody) !== JSON.stringify(currentQueryBody);
}
private cleanResults() {
if (this.results) {
this.results = {};
@@ -160,17 +148,10 @@ export class SearchComponent implements AfterContentInit, OnChanges {
private loadSearchResults(searchTerm?: string) {
this.resetResults();
if (searchTerm) {
if (this.queryBody) {
this.searchService.searchByQueryBody(this.queryBody).subscribe(
(result) => this.onSearchDataLoaded(result),
(err) => this.onSearchDataError(err)
);
} else {
this.searchService.search(searchTerm, this.maxResults, this.skipResults).subscribe(
(result) => this.onSearchDataLoaded(result),
(err) => this.onSearchDataError(err)
);
}
} else {
this.cleanResults();
}

View File

@@ -63,13 +63,6 @@ export abstract class UploadBase implements OnInit, OnDestroy {
@Output()
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. */
@Output()
error = new EventEmitter();

View File

@@ -23,9 +23,8 @@ import { ChangeDetectorRef, Component, Input, Output, EventEmitter, OnDestroy, O
import { Subscription, merge } from 'rxjs';
import { FileUploadingListComponent } from './file-uploading-list.component';
// @deprecated file-uploading-dialog TODO remove in 3.0.0
@Component({
selector: 'adf-file-uploading-dialog, file-uploading-dialog',
selector: 'adf-file-uploading-dialog',
templateUrl: './file-uploading-dialog.component.html',
styleUrls: ['./file-uploading-dialog.component.scss']
})

View File

@@ -151,18 +151,7 @@ describe('UploadDragAreaComponent', () => {
spyOn(uploadService, 'uploadFilesInTheQueue');
fixture.detectChanges();
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);
}
};
component.onFilesEntityDropped(itemEntity);
component.onFilesDropped([new File(['fakefake'], 'file-fake.png', { type: 'image/png' })]);
expect(uploadService.addToQueue).not.toHaveBeenCalled();
expect(uploadService.uploadFilesInTheQueue).not.toHaveBeenCalled();
@@ -270,19 +259,9 @@ describe('UploadDragAreaComponent', () => {
component.success = null;
component.acceptedFilesType = '.png';
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(() => {
component.onFilesEntityDropped(itemEntity);
component.onFilesDropped([new File(['fakefake'], 'file-fake.png', { type: 'image/png' })]);
expect(uploadService.uploadFilesInTheQueue).toHaveBeenCalledWith(null);
});
}));
@@ -293,19 +272,8 @@ describe('UploadDragAreaComponent', () => {
fixture.detectChanges();
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(() => {
component.onFilesEntityDropped(itemEntity);
component.onFilesDropped([new File(['fakefake'], 'file-fake.png', { type: 'image/png' })]);
expect(uploadService.uploadFilesInTheQueue).not.toHaveBeenCalledWith(null);
});
}));
@@ -315,18 +283,7 @@ describe('UploadDragAreaComponent', () => {
fixture.detectChanges();
spyOn(uploadService, 'uploadFilesInTheQueue');
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);
}
};
component.onFilesEntityDropped(itemEntity);
component.onFilesDropped([new File(['fakefake'], 'file-fake.png', { type: 'image/png' })]);
expect(uploadService.uploadFilesInTheQueue).toHaveBeenCalledWith(null);
}));

View File

@@ -19,7 +19,7 @@ import {
EXTENDIBLE_COMPONENT, FileInfo, FileModel, FileUtils, NodePermissionSubject,
NotificationService, TranslationService, UploadService, ContentService, PermissionsEnum
} 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';
@Component({
@@ -34,15 +34,6 @@ import { UploadBase } from './base-upload/upload-base';
})
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,
protected translationService: TranslationService,
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
*

View File

@@ -35,13 +35,6 @@ export class FileDraggableDirective implements OnInit, OnDestroy {
@Output()
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. */
@Output()
folderEntityDropped: EventEmitter<any> = new EventEmitter();

View File

@@ -36,10 +36,6 @@ export class VersionListComponent implements OnChanges {
versions: VersionEntry[] = [];
isLoading = true;
/** @deprecated in 2.3.0 */
@Input()
id: string;
/** The target node. */
@Input()
node: Node;

View File

@@ -23,7 +23,7 @@ import moment from 'moment-es6';
import { Moment } from 'moment';
import { CardViewDateItemModel } from '../../models/card-view-dateitem.model';
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 { MOMENT_DATE_FORMATS } from '../../../utils/moment-date-formats.model';
@@ -58,13 +58,14 @@ export class CardViewDateItemComponent implements OnInit {
constructor(private cardViewUpdateService: CardViewUpdateService,
private dateAdapter: DateAdapter<Moment>,
private preferences: UserPreferencesService) {
private userPreferencesService: UserPreferencesService) {
}
ngOnInit() {
this.preferences.locale$.subscribe((locale) => {
this.userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.dateAdapter.setLocale(locale);
});
(<MomentDateAdapter> this.dateAdapter).overrideDisplayFormat = this.SHOW_FORMAT;
if (this.property.value) {

View File

@@ -22,11 +22,8 @@ import { MatMenuTrigger } from '@angular/material';
import { Subscription } from 'rxjs';
import { ContextMenuService } from './context-menu.service';
/**
* @deprecated: context-menu-holder is deprecated, use adf-context-menu-holder instead.
*/
@Component({
selector: 'adf-context-menu-holder, context-menu-holder',
selector: 'adf-context-menu-holder',
template: `
<button mat-button [matMenuTriggerFor]="contextMenu"></button>
<mat-menu #contextMenu="matMenu" class="context-menu">

View File

@@ -20,9 +20,8 @@
import { Directive, HostListener, Input } from '@angular/core';
import { ContextMenuOverlayService } from './context-menu-overlay.service';
// @deprecated 2.3.0 context-menu tag removed
@Directive({
selector: '[adf-context-menu], [context-menu]'
selector: '[context-menu]'
})
export class ContextMenuDirective {
/** Items for the menu. */

View File

@@ -40,13 +40,6 @@ export class NodeRestoreDirective {
@Input('adf-restore')
selection: DeletedNodeEntry[];
/**
* Path to restored node.
* @deprecated 2.4.0
*/
@Input()
location: string = '';
/** Emitted when restoration is complete. */
@Output()
restore: EventEmitter<RestoreMessageModel> = new EventEmitter();

View File

@@ -158,10 +158,9 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
/**
* Emitted when any error occurs.
* @deprecated in 2.4.0, will be renamed as "error" in 3.x.x
*/
@Output()
onError: EventEmitter<any> = new EventEmitter<any>();
error: EventEmitter<any> = new EventEmitter<any>();
debugMode: boolean = false;
@@ -458,7 +457,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}
handleError(err: any): any {
this.onError.emit(err);
this.error.emit(err);
}
parseForm(json: any): FormModel {

View File

@@ -23,7 +23,7 @@ import { DatetimeAdapter, MAT_DATETIME_FORMATS } from '@mat-datetimepicker/core'
import { MomentDatetimeAdapter, MAT_MOMENT_DATETIME_FORMATS } from '@mat-datetimepicker/moment';
import moment from 'moment-es6';
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 { MOMENT_DATE_FORMATS } from '../../../../utils/moment-date-formats.model';
import { FormService } from './../../../services/form.service';
@@ -49,14 +49,15 @@ export class DateTimeWidgetComponent extends WidgetComponent implements OnInit {
constructor(public formService: FormService,
private dateAdapter: DateAdapter<Moment>,
private preferences: UserPreferencesService) {
private userPreferencesService: UserPreferencesService) {
super(formService);
}
ngOnInit() {
this.preferences.locale$.subscribe((locale) => {
this.userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.dateAdapter.setLocale(locale);
});
let momentDateAdapter = <MomentDateAdapter> this.dateAdapter;
momentDateAdapter.overrideDisplayFormat = this.field.dateDisplayFormat;

View File

@@ -17,7 +17,7 @@
/* 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 { MOMENT_DATE_FORMATS } from '../../../../utils/moment-date-formats.model';
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
@@ -46,14 +46,15 @@ export class DateWidgetComponent extends WidgetComponent implements OnInit {
constructor(public formService: FormService,
private dateAdapter: DateAdapter<Moment>,
private preferences: UserPreferencesService) {
private userPreferencesService: UserPreferencesService) {
super(formService);
}
ngOnInit() {
this.preferences.locale$.subscribe((locale) => {
this.userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.dateAdapter.setLocale(locale);
});
let momentDateAdapter = <MomentDateAdapter> this.dateAdapter;
momentDateAdapter.overrideDisplayFormat = this.field.dateDisplayFormat;

View File

@@ -17,7 +17,7 @@
/* 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 { MOMENT_DATE_FORMATS } from '../../../../../../utils/moment-date-formats.model';
import { Component, Input, OnInit } from '@angular/core';
@@ -55,13 +55,14 @@ export class DateEditorComponent implements OnInit {
maxDate: Moment;
constructor(private dateAdapter: DateAdapter<Moment>,
private preferences: UserPreferencesService) {
private userPreferencesService: UserPreferencesService) {
}
ngOnInit() {
this.preferences.locale$.subscribe((locale) => {
this.userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.dateAdapter.setLocale(locale);
});
let momentDateAdapter = <MomentDateAdapter> this.dateAdapter;
momentDateAdapter.overrideDisplayFormat = this.DATE_FORMAT;

View File

@@ -17,7 +17,7 @@
/* 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 { MOMENT_DATE_FORMATS } from '../../../../../../utils/moment-date-formats.model';
import { Component, Input, OnInit } from '@angular/core';
@@ -60,13 +60,14 @@ export class DateTimeEditorComponent implements OnInit {
maxDate: Moment;
constructor(private dateAdapter: DateAdapter<Moment>,
private preferences: UserPreferencesService) {
private userPreferencesService: UserPreferencesService) {
}
ngOnInit() {
this.preferences.locale$.subscribe((locale) => {
this.userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.dateAdapter.setLocale(locale);
});
let momentDateAdapter = <MomentDateAdapter> this.dateAdapter;
momentDateAdapter.overrideDisplayFormat = this.DATE_FORMAT;

View File

@@ -57,7 +57,6 @@ export class WidgetComponent implements AfterViewInit {
/**
* Emitted when a field value changes.
* @deprecated Used only to trigger visibility engine; components should do that internally if needed.
*/
@Output()
fieldChanged: EventEmitter<FormFieldModel> = new EventEmitter<FormFieldModel>();
@@ -96,12 +95,10 @@ export class WidgetComponent implements AfterViewInit {
this.fieldChanged.emit(this.field);
}
/** @deprecated used only to trigger visibility engine, components should do that internally if needed */
checkVisibility(field: FormFieldModel) {
this.fieldChanged.emit(field);
}
/** @deprecated used only to trigger visibility engine, components should do that internally if needed */
onFieldChanged(field: FormFieldModel) {
this.fieldChanged.emit(field);
}

View File

@@ -18,7 +18,6 @@
import { TestBed } from '@angular/core/testing';
import { Response, ResponseOptions } from '@angular/http';
import { AlfrescoApiService } from '../../services/alfresco-api.service';
import { FormDefinitionModel } from '../models/form-definition.model';
import { formModelTabs, AlfrescoApiServiceMock } from '../../mock';
import { FormService } from './form.service';
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) => {
spyOn(service, 'getUserProfileImageApi').and.returnValue('/app/rest/users/2002/picture');
let fakeFilter: string = 'whatever';

View File

@@ -129,7 +129,9 @@ export class FormService {
this.ecmModelService.searchEcmType(formName, EcmModelService.MODEL_NAME).subscribe(
(customType) => {
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.complete();
}, (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.
* @param name The form name to search for

View File

@@ -90,7 +90,6 @@ describe('LoginComponent', () => {
});
function loginWithCredentials(username, password, providers: string = 'ECM') {
component.providers = providers;
usernameInput.value = username;
passwordInput.value = password;
@@ -116,6 +115,8 @@ describe('LoginComponent', () => {
});
it('should redirect to previous route state on successful login', () => {
appConfigService.config.providers = 'ECM';
spyOn(authService, 'login').and.returnValue(of({ type: 'type', ticket: 'ticket' }));
const redirect = '/home';
component.successRoute = redirect;
@@ -393,7 +394,6 @@ describe('LoginComponent', () => {
it('should return success event after the login have succeeded', (done) => {
spyOn(authService, 'login').and.returnValue(of({ type: 'type', ticket: 'ticket' }));
component.providers = 'ECM';
expect(component.isError).toBe(false);
component.success.subscribe(() => {
@@ -409,7 +409,6 @@ describe('LoginComponent', () => {
});
it('should return error with a wrong username', (done) => {
component.providers = 'ECM';
component.error.subscribe(() => {
fixture.detectChanges();
@@ -424,8 +423,6 @@ describe('LoginComponent', () => {
});
it('should return error with a wrong password', (done) => {
component.providers = 'ECM';
component.error.subscribe(() => {
fixture.detectChanges();
fixture.whenStable().then(() => {
@@ -440,8 +437,6 @@ describe('LoginComponent', () => {
});
it('should return error with a wrong username and password', (done) => {
component.providers = 'ECM';
component.error.subscribe(() => {
fixture.detectChanges();
fixture.whenStable().then(() => {
@@ -462,7 +457,6 @@ describe('LoginComponent', () => {
message: 'ERROR: the network is offline, Origin is not allowed by Access-Control-Allow-Origin'
}
}));
component.providers = 'ECM';
component.error.subscribe(() => {
fixture.detectChanges();
@@ -480,7 +474,6 @@ describe('LoginComponent', () => {
it('should return CSRF error when server CSRF error occurs', async(() => {
spyOn(authService, 'login')
.and.returnValue(throwError({ message: 'ERROR: Invalid CSRF-token', status: 403 }));
component.providers = 'ECM';
component.error.subscribe(() => {
fixture.detectChanges();
@@ -502,7 +495,6 @@ describe('LoginComponent', () => {
status: 403
}
));
component.providers = 'ECM';
component.error.subscribe(() => {
fixture.detectChanges();
@@ -516,8 +508,6 @@ describe('LoginComponent', () => {
}));
it('should emit success event after the login has succeeded and discard password', async(() => {
component.providers = 'ECM';
component.success.subscribe((event) => {
fixture.detectChanges();
@@ -532,7 +522,6 @@ describe('LoginComponent', () => {
it('should emit error event after the login has failed', async(() => {
spyOn(authService, 'login').and.returnValue(throwError('Fake server error'));
component.providers = 'ECM';
component.error.subscribe((error) => {
fixture.detectChanges();

View File

@@ -25,7 +25,6 @@ import { AuthenticationService } from '../../services/authentication.service';
import { LogService } from '../../services/log.service';
import { TranslationService } from '../../services/translation.service';
import { UserPreferencesService } from '../../services/user-preferences.service';
import { SettingsService } from '../../services/settings.service';
import { LoginErrorEvent } from '../models/login-error.event';
import { LoginSubmitEvent } from '../models/login-submit.event';
@@ -91,24 +90,10 @@ export class LoginComponent implements OnInit {
@Input()
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. */
@Input()
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. */
@Input()
successRoute: string = null;
@@ -154,8 +139,7 @@ export class LoginComponent implements OnInit {
private logService: LogService,
private router: Router,
private appConfig: AppConfigService,
private userPreferences: UserPreferencesService,
private settingsService: SettingsService
private userPreferences: UserPreferencesService
) {
this.initFormError();
this.initFormFieldsMessages();
@@ -188,9 +172,6 @@ export class LoginComponent implements OnInit {
* @param event
*/
onSubmit(values: any) {
this.settingsService.setProviders(this.providers);
this.settingsService.csrfDisabled = this.disableCsrf;
this.disableError();
const args = new LoginSubmitEvent({
controls: { username: this.form.controls.username }
@@ -242,9 +223,7 @@ export class LoginComponent implements OnInit {
.login(values.username, values.password, this.rememberMe)
.subscribe(
(token: any) => {
const redirectUrl = this.authService.getRedirect(
this.providers
);
const redirectUrl = this.authService.getRedirect();
this.actualLoginStep = LoginSteps.Welcome;
this.userPreferences.setStoragePrefix(values.username);

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;
}
}
}

View File

@@ -22,6 +22,5 @@ export * from './user-process.model';
export * from './comment.model';
export * from './ecm-company.model';
export * from './redirection.model';
export * from './comment-process.model';
export * from './pagination.model';
export * from './oauth-config.model';

View File

@@ -1,4 +1,5 @@
<div *ngIf="pagination?.hasMoreItems || isLoading" class="adf-infinite-pagination">
isLoading : {{isLoading}}
<button mat-button
*ngIf="!isLoading"
class="adf-infinite-pagination-load-more"

View File

@@ -23,6 +23,33 @@ import { PaginatedComponent } from './paginated-component.interface';
import { BehaviorSubject } from 'rxjs';
import { setupTestBed } from '../testing/setupTestBed';
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', () => {
@@ -31,13 +58,17 @@ describe('InfinitePaginationComponent', () => {
let pagination: Pagination;
setupTestBed({
imports: [CoreTestingModule]
imports: [CoreTestingModule],
declarations: [
TestPaginatedComponent
]
});
beforeEach(() => {
fixture = TestBed.createComponent(InfinitePaginationComponent);
component = fixture.componentInstance;
component.target = TestBed.createComponent(TestPaginatedComponent).componentInstance;
pagination = {
skipCount: 0,
hasMoreItems: false
@@ -48,12 +79,12 @@ describe('InfinitePaginationComponent', () => {
fixture.destroy();
});
describe('Standalone', () => {
describe('View', () => {
it('should show the loading spinner if loading', () => {
pagination.hasMoreItems = true;
component.pagination = pagination;
component.isLoading = true;
component.target = null;
fixture.detectChanges();
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', () => {
pagination.hasMoreItems = true;
component.pagination = pagination;
component.target.updatePagination(pagination);
component.isLoading = false;
fixture.detectChanges();
@@ -72,7 +103,7 @@ describe('InfinitePaginationComponent', () => {
it('should show the load more button if NOT loading and has more items', () => {
pagination.hasMoreItems = true;
component.pagination = pagination;
component.target.updatePagination(pagination);
component.isLoading = false;
fixture.detectChanges();
@@ -82,7 +113,7 @@ describe('InfinitePaginationComponent', () => {
it('should NOT show anything if pagination has NO more items', () => {
pagination.hasMoreItems = false;
component.pagination = pagination;
component.target.updatePagination(pagination);
fixture.detectChanges();
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) => {
pagination.hasMoreItems = true;
pagination.skipCount = 5;
component.pagination = pagination;
component.target.updatePagination(pagination);
component.isLoading = false;
component.pageSize = 5;
fixture.detectChanges();
@@ -111,22 +142,16 @@ describe('InfinitePaginationComponent', () => {
describe('Target', () => {
let testTarget: PaginatedComponent;
let spyTarget;
beforeEach(() => {
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', () => {
component.target = testTarget;
component.target.updatePagination(pagination);
fixture.detectChanges();
expect(component.pagination).toBe(pagination);
@@ -134,32 +159,44 @@ describe('InfinitePaginationComponent', () => {
});
it('should call the target\'s updatePagination on invoking the onLoadMore', () => {
component.target = testTarget;
component.target.updatePagination(pagination);
fixture.detectChanges();
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', () => {
component.target = testTarget;
component.pageSize = 7;
component.target.updatePagination(pagination);
fixture.detectChanges();
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', () => {
component.target = testTarget;
fixture.detectChanges();
fixture.destroy();
const emitNewPaginationEvent = () => {
let newPagination = { maxItems: 1, skipCount: 0, totalItems: 2, hasMoreItems: true };
testTarget.pagination.next(newPagination);
component.target.pagination.next(newPagination);
};
expect(emitNewPaginationEvent).not.toThrow();

View File

@@ -39,24 +39,12 @@ import { UserPreferencesService } from '../services/user-preferences.service';
})
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 = {
skipCount: 0,
hasMoreItems: false,
merge: true
};
/**
* Pagination object.
* @deprecated 2.3.0
*/
@Input()
pagination: PaginationModel;
/** Component that provides custom pagination support. */
@Input()
target: PaginatedComponent;
@@ -73,6 +61,8 @@ export class InfinitePaginationComponent implements OnInit, OnDestroy, Paginatio
@Output()
loadMore: EventEmitter<PaginationModel> = new EventEmitter<PaginationModel>();
pagination: PaginationModel;
private paginationSubscription: Subscription;
constructor(private cdr: ChangeDetectorRef, private userPreferencesService: UserPreferencesService) {

View File

@@ -20,10 +20,5 @@ import { BehaviorSubject } from 'rxjs';
export interface PaginatedComponent {
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);
}

View File

@@ -50,10 +50,6 @@ export class AlfrescoApiService {
return this.getInstance().activiti.taskApi;
}
// get modelsApi(): Core.ModelsApi {
// return this.getInstance().activiti.modelsApi;
// }
get contentApi(): ContentApi {
return this.getInstance().content;
}
@@ -120,13 +116,13 @@ export class AlfrescoApiService {
}
const config = {
provider: this.getProvider(),
provider: this.appConfig.get<string>(AppConfigValues.PROVIDERS),
hostEcm: this.appConfig.get<string>(AppConfigValues.ECMHOST),
hostBpm: this.appConfig.get<string>(AppConfigValues.BPMHOST),
authType: this.appConfig.get<string>(AppConfigValues.AUTHTYPE, 'BASIC'),
contextRootBpm: this.appConfig.get<string>(AppConfigValues.CONTEXTROOTBPM),
contextRoot: this.appConfig.get<string>(AppConfigValues.CONTEXTROOTECM),
disableCsrf: this.getDisableCSRF(),
disableCsrf: this.appConfig.get<boolean>(AppConfigValues.DISABLECSRF),
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);
}
}

View File

@@ -40,6 +40,8 @@ describe('AuthGuardService BPM', () => {
authGuard = TestBed.get(AuthGuardBpm);
routerService = TestBed.get(Router);
appConfigService = TestBed.get(AppConfigService);
appConfigService.config.providers = 'BPM';
});
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({
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(() => {
@@ -91,7 +93,7 @@ describe('AuthGuardService BPM', () => {
expect(authService.setRedirect).toHaveBeenCalledWith({
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(() => {
@@ -104,7 +106,7 @@ describe('AuthGuardService BPM', () => {
expect(authService.setRedirect).toHaveBeenCalledWith({
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(() => {

View File

@@ -40,6 +40,8 @@ describe('AuthGuardService ECM', () => {
authGuard = TestBed.get(AuthGuardEcm);
routerService = TestBed.get(Router);
appConfigService = TestBed.get(AppConfigService);
appConfigService.config.providers = 'ECM';
});
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({
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(() => {
@@ -91,7 +93,7 @@ describe('AuthGuardService ECM', () => {
expect(authService.setRedirect).toHaveBeenCalledWith({
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(() => {
@@ -104,7 +106,7 @@ describe('AuthGuardService ECM', () => {
expect(authService.setRedirect).toHaveBeenCalledWith({
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(() => {

View File

@@ -144,19 +144,19 @@ describe('AuthenticationService', () => {
it('[ECM] should set/get redirectUrl when provider is ECM', () => {
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', () => {
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', () => {
authService.setRedirect(null);
expect(authService.getRedirect(appConfigService.config.providers)).toBeNull();
expect(authService.getRedirect()).toBeNull();
});
it('[ECM] should return isECMProvider true', () => {
@@ -260,19 +260,19 @@ describe('AuthenticationService', () => {
it('[BPM] should set/get redirectUrl when provider is BPM', () => {
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', () => {
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', () => {
authService.setRedirect(null);
expect(authService.getRedirect(appConfigService.config.providers)).toBeNull();
expect(authService.getRedirect()).toBeNull();
});
it('[BPM] should return isECMProvider false', () => {
@@ -469,25 +469,25 @@ describe('AuthenticationService', () => {
it('[ALL] should set/get redirectUrl when provider is ALL', () => {
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', () => {
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', () => {
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', () => {
authService.setRedirect(null);
expect(authService.getRedirect(appConfigService.config.providers)).toBeNull();
expect(authService.getRedirect()).toBeNull();
});
it('[ALL] should return isECMProvider false', () => {

View File

@@ -244,10 +244,10 @@ export class AuthenticationService {
}
/** Gets the URL to redirect to after login.
* @param provider Service provider. Can be "ECM", "BPM" or "ALL".
* @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;
}

View File

@@ -18,7 +18,6 @@
import { TestBed } from '@angular/core/testing';
import { CookieServiceMock } from '../mock/cookie.service.mock';
import { ContentService } from './content.service';
import { SettingsService } from './settings.service';
import { AppConfigService } from '../app-config/app-config.service';
import { AuthenticationService } from './authentication.service';
import { CookieService } from './cookie.service';
@@ -37,7 +36,6 @@ describe('ContentService', () => {
let contentService: ContentService;
let authService: AuthenticationService;
let settingsService: SettingsService;
let storage: StorageService;
let node: any;
@@ -56,7 +54,6 @@ describe('ContentService', () => {
beforeEach(() => {
authService = TestBed.get(AuthenticationService);
settingsService = TestBed.get(SettingsService);
contentService = TestBed.get(ContentService);
storage = TestBed.get(StorageService);
storage.clear();
@@ -71,7 +68,8 @@ describe('ContentService', () => {
let appConfig: AppConfigService = TestBed.get(AppConfigService);
appConfig.config = {
ecmHost: 'http://localhost:9876/ecm'
ecmHost: 'http://localhost:9876/ecm',
provider: 'ECM'
};
});
@@ -79,10 +77,6 @@ describe('ContentService', () => {
jasmine.Ajax.uninstall();
});
beforeEach(() => {
settingsService.setProviders('ECM');
});
it('should return a valid content URL', (done) => {
authService.login('fake-username', 'fake-password').subscribe(() => {
expect(contentService.getContentUrl(node)).toBe('http://localhost:9876/ecm/alfresco/api/' +

View File

@@ -17,7 +17,6 @@
export * from './authentication.service';
export * from './alfresco-api.service';
export * from './settings.service';
export * from './content.service';
export * from './auth-guard.service';
export * from './auth-guard-ecm.service';

View File

@@ -51,7 +51,6 @@ export class RenditionsService {
);
}
/** @deprecated */
isRenditionAvailable(nodeId: string, encoding: string): Observable<boolean> {
return new Observable((observer) => {
this.getRendition(nodeId, encoding).subscribe(
@@ -71,7 +70,6 @@ export class RenditionsService {
});
}
/** @deprecated */
isConversionPossible(nodeId: string, encoding: string): Observable<boolean> {
return new Observable((observer) => {
this.getRendition(nodeId, encoding).subscribe(
@@ -87,27 +85,22 @@ export class RenditionsService {
});
}
/** @deprecated */
getRenditionUrl(nodeId: string, encoding: string): string {
return this.apiService.contentApi.getRenditionUrl(nodeId, encoding);
}
/** @deprecated */
getRendition(nodeId: string, encoding: string): Observable<RenditionEntry> {
return from(this.apiService.renditionsApi.getRendition(nodeId, encoding));
}
/** @deprecated */
getRenditionsListByNodeId(nodeId: string): Observable<RenditionPaging> {
return from(this.apiService.renditionsApi.getRenditions(nodeId));
}
/** @deprecated */
createRendition(nodeId: string, encoding: string): Observable<{}> {
return from(this.apiService.renditionsApi.createRendition(nodeId, { id: encoding }));
}
/** @deprecated */
convert(nodeId: string, encoding: string, pollingInterval: number = 1000, retries: number = 5) {
return this.createRendition(nodeId, encoding)
.pipe(
@@ -115,7 +108,6 @@ export class RenditionsService {
);
}
/** @deprecated */
private pollRendition(nodeId: string, encoding: string, intervalSize: number = 1000, retries: number = 5) {
let attempts = 0;
return interval(intervalSize)

View File

@@ -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();
});
});

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);
}
}
}

View File

@@ -19,7 +19,7 @@ import { Inject, Injectable, InjectionToken, Optional } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Observable } from 'rxjs';
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.');
@@ -37,7 +37,7 @@ export class TranslationService {
customLoader: TranslateLoaderService;
constructor(public translate: TranslateService,
userPreference: UserPreferencesService,
userPreferencesService: UserPreferencesService,
@Optional() @Inject(TRANSLATION_PROVIDER) providers: TranslationProvider[]) {
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.use(this.userLang);
});
this.use(this.userLang); });
}
/**

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.
* @param emitter (Deprecated) Emitter to invoke on file status change
* @param emitter Emitter to invoke on file status change
*/
uploadFilesInTheQueue(emitter?: EventEmitter<any>): void {
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);

View File

@@ -40,13 +40,6 @@ export class UserPreferencesService {
};
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>;
onChange: Observable<any>;
@@ -54,8 +47,6 @@ export class UserPreferencesService {
private appConfig: AppConfigService,
private storage: StorageService) {
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.onChange = this.onChangeSubject.asObservable();
}
@@ -169,12 +160,10 @@ export class UserPreferencesService {
/** Current locale setting. */
get locale(): string {
const locale = this.get(UserPreferenceValues.Locale, this.userPreferenceStatus[UserPreferenceValues.Locale]);
return locale;
return this.get(UserPreferenceValues.Locale, this.userPreferenceStatus[UserPreferenceValues.Locale]);
}
set locale(value: string) {
this.localeSubject.next(value);
this.set(UserPreferenceValues.Locale, value);
}

View File

@@ -50,12 +50,6 @@ export class HostSettingsComponent implements OnInit {
@Output()
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. */
@Output()
cancel = new EventEmitter<boolean>();
@@ -64,12 +58,6 @@ export class HostSettingsComponent implements OnInit {
@Output()
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,
private storageService: StorageService,
private alfrescoApiService: AlfrescoApiService,

View File

@@ -114,14 +114,14 @@
</mat-menu>
</ng-container>
<ng-container *ngIf="allowSidebar">
<ng-container *ngIf="allowRightSidebar">
<adf-toolbar-divider></adf-toolbar-divider>
<button
mat-icon-button
title="{{ 'ADF_VIEWER.ACTIONS.INFO' | translate }}"
data-automation-id="adf-toolbar-sidebar"
[color]="showSidebar ? 'accent' : 'default'"
[color]="showRightSidebar ? 'accent' : 'default'"
(click)="toggleSidebar()">
<mat-icon>info_outline</mat-icon>
</button>
@@ -132,12 +132,12 @@
</ng-container>
<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" >
<ng-container *ngIf="sidebarTemplate">
<ng-container *ngTemplateOutlet="sidebarTemplate;context:sidebarTemplateContext"></ng-container>
<ng-container *ngIf="sidebarRightTemplate">
<ng-container *ngTemplateOutlet="sidebarRightTemplate;context:sidebarRightTemplateContext"></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>
</ng-container>
@@ -150,7 +150,7 @@
</div>
</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-content-container">
<ng-container *ngIf="isLoading">
@@ -166,7 +166,7 @@
</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-content-container" [ngSwitch]="viewerType">
<ng-container *ngSwitchCase="'pdf'">

View File

@@ -467,8 +467,8 @@ describe('ViewerComponent', () => {
describe('SideBar Test', () => {
it('should NOT display sidebar if is not allowed', (done) => {
component.showSidebar = true;
component.allowSidebar = false;
component.showRightSidebar = true;
component.allowRightSidebar = false;
fixture.detectChanges();
fixture.whenStable().then(() => {
@@ -479,8 +479,8 @@ describe('ViewerComponent', () => {
});
it('should display sidebar on the right side', (done) => {
component.allowSidebar = true;
component.showSidebar = true;
component.allowRightSidebar = true;
component.showRightSidebar = true;
fixture.detectChanges();
fixture.whenStable().then(() => {

View File

@@ -129,40 +129,25 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
@Input()
allowLeftSidebar = false;
/** Allow the right sidebar.
* @deprecated 2.5.0 - will be renamed allowRightSidebar in 3.0.0
*/
/** Allow the right sidebar. */
@Input()
allowSidebar = false;
allowRightSidebar = false;
/** Toggles PDF thumbnails. */
@Input()
allowThumbnails = true;
/**
* Toggles sidebar visibility. Requires `allowSidebar` to be set to `true`.
* @deprecated 2.5.0 - will be renamed showRightSidebar in 3.0.0
*/
/** Toggles right sidebar visibility. Requires `allowRightSidebar` to be set to `true`. */
@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()
showLeftSidebar = false;
/**
* The position of the sidebar. Can be `left` or `right`.
* @deprecated 2.5.0 use sidebarTemplateLeft
*/
/** The template for the right sidebar. The template context contains the loaded node data. */
@Input()
sidebarPosition = 'right';
/**
* 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;
sidebarRightTemplate: TemplateRef<any> = null;
/** The template for the left sidebar. The template context contains the loaded node data. */
@Input()
@@ -223,7 +208,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
urlFileContent: string;
otherMenu: any;
extension: string;
sidebarTemplateContext: { node: Node } = { node: null };
sidebarRightTemplateContext: { node: Node } = { node: null };
sidebarLeftTemplateContext: { node: Node } = { node: null };
fileTitle: string;
@@ -376,7 +361,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
}
this.extensionChange.emit(this.extension);
this.sidebarTemplateContext.node = data;
this.sidebarRightTemplateContext.node = data;
this.sidebarLeftTemplateContext.node = data;
this.scrollTop();
@@ -404,18 +389,18 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
}
toggleSidebar() {
this.showSidebar = !this.showSidebar;
if (this.showSidebar && this.nodeId) {
this.showRightSidebar = !this.showRightSidebar;
if (this.showRightSidebar && this.nodeId) {
this.apiService.getInstance().nodes.getNode(this.nodeId, { include: ['allowableOperations'] })
.then((nodeEntry: NodeEntry) => {
this.sidebarTemplateContext.node = nodeEntry.entry;
this.sidebarRightTemplateContext.node = nodeEntry.entry;
});
}
}
toggleLeftSidebar() {
this.showLeftSidebar = !this.showLeftSidebar;
if (this.showSidebar && this.nodeId) {
if (this.showRightSidebar && this.nodeId) {
this.apiService.getInstance().nodes.getNode(this.nodeId, { include: ['allowableOperations'] })
.then((nodeEntry: NodeEntry) => {
this.sidebarLeftTemplateContext.node = nodeEntry.entry;

View File

@@ -21,9 +21,8 @@ import { ReportParametersModel } from '../../diagram/models/report/reportParamet
import { AnalyticsService } from '../services/analytics.service';
import { share } from 'rxjs/operators';
// @deprecated 2.3.0 analytics-report-list tag removed
@Component({
selector: 'adf-analytics-report-list, analytics-report-list',
selector: 'adf-analytics-report-list',
templateUrl: './analytics-report-list.component.html',
styleUrls: ['./analytics-report-list.component.scss'],
encapsulation: ViewEncapsulation.None

View File

@@ -38,9 +38,8 @@ import { ReportParametersModel } from '../../diagram/models/report/reportParamet
import { ReportQuery } from '../../diagram/models/report/reportQuery.model';
import { AnalyticsService } from '../services/analytics.service';
// @deprecated 2.3.0 analytics-report-parameters tag removed
@Component({
selector: 'adf-analytics-report-parameters, analytics-report-parameters',
selector: 'adf-analytics-report-parameters',
templateUrl: './analytics-report-parameters.component.html',
styleUrls: ['./analytics-report-parameters.component.scss'],
encapsulation: ViewEncapsulation.None

View File

@@ -1,12 +1,12 @@
<div class="adf-analytics-container">
<analytics-report-parameters [appId]="appId" [reportId]="reportId"
<adf-analytics-report-parameters [appId]="appId" [reportId]="reportId"
[hideComponent]="hideParameters"
(formValueChanged)="reset()"
(success)="showReport($event)"
(saveReportSuccess)="onSaveReportSuccess($event)"
(deleteReportSuccess)="onDeleteReportSuccess()"
(edit)="onEditReport($event)">
</analytics-report-parameters>
</adf-analytics-report-parameters>
<adf-analytics-generator [reportId]="reportId"
[reportParamQuery]="reportParamQuery"

View File

@@ -17,7 +17,7 @@
/* 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 { AbstractControl, FormControl, FormGroup, Validators } from '@angular/forms';
import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material';
@@ -54,13 +54,14 @@ export class DateRangeWidgetComponent implements OnInit {
constructor(
private dateAdapter: DateAdapter<Moment>,
private preferences: UserPreferencesService) {
private userPreferencesService: UserPreferencesService) {
}
ngOnInit() {
this.preferences.locale$.subscribe( (locale) => {
this.userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.dateAdapter.setLocale(locale);
});
let momentDateAdapter = <MomentDateAdapter> this.dateAdapter;
momentDateAdapter.overrideDisplayFormat = this.SHOW_FORMAT;

View File

@@ -17,9 +17,8 @@
import { Component, ElementRef, EventEmitter, Input, OnInit, Output } from '@angular/core';
// @deprecated 2.3.0 diagram-alfresco-publish-task tag removed
@Component({
selector: 'adf-diagram-publish-task, diagram-alfresco-publish-task',
selector: 'adf-diagram-publish-task',
templateUrl: './diagram-alfresco-publish-task.component.html'
})
export class DiagramAlfrescoPublishTaskComponent implements OnInit {

View File

@@ -17,9 +17,8 @@
import { Component, ElementRef, EventEmitter, Input, OnInit, Output } from '@angular/core';
// @deprecated 2.3.0 diagram-sequence-flow tag removed
@Component({
selector: 'adf-diagram-sequence-flow, diagram-sequence-flow',
selector: 'adf-diagram-sequence-flow',
templateUrl: './diagram-sequence-flow.component.html'
})
export class DiagramSequenceFlowComponent implements OnInit {

View File

@@ -69,7 +69,7 @@ describe('Diagrams flows', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
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();
let tooltip: any = element.querySelector('diagram-tooltip > div');
@@ -90,7 +90,7 @@ describe('Diagrams flows', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
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();
let tooltip: any = element.querySelector('diagram-tooltip > div');

View File

@@ -57,7 +57,7 @@
<div *ngFor="let flow of diagram.flows">
<div [ngSwitch]="flow.type">
<div *ngSwitchCase="'sequenceFlow'">
<diagram-sequence-flow [flow]="flow"></diagram-sequence-flow>
<adf-diagram-sequence-flow [flow]="flow"></adf-diagram-sequence-flow>
</div>
</div>
</div>

View File

@@ -27,7 +27,8 @@ import {
LogService,
UserPreferencesService,
IdentityUserService,
IdentityUserModel
IdentityUserModel,
UserPreferenceValues
} from '@alfresco/adf-core';
import { PeopleCloudComponent } from './people-cloud/people-cloud.component';
@@ -95,16 +96,17 @@ export class StartTaskCloudComponent implements OnInit, OnDestroy {
constructor(private taskService: StartTaskCloudService,
private dateAdapter: DateAdapter<Moment>,
private preferences: UserPreferencesService,
private userPreferencesService: UserPreferencesService,
private formBuilder: FormBuilder,
private identityUserService: IdentityUserService,
private logService: LogService) {
}
ngOnInit() {
this.localeSub = this.preferences.locale$.subscribe((locale) => {
this.userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.dateAdapter.setLocale(locale);
});
this.loadCurrentUser();
this.buildForm();
}

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