mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[ACA-1437] Custom row for search results DL (#414)
* custom row * clean up
This commit is contained in:
committed by
Denys Vuika
parent
edc9d6ba32
commit
b06dcd4391
@@ -159,7 +159,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"search": {
|
"search": {
|
||||||
"include": ["path", "allowableOperations"],
|
"include": ["path", "allowableOperations", "properties"],
|
||||||
"sorting": {
|
"sorting": {
|
||||||
"options": [
|
"options": [
|
||||||
{
|
{
|
||||||
@@ -217,6 +217,7 @@
|
|||||||
"filterQueries": [
|
"filterQueries": [
|
||||||
{ "query": "TYPE:'cm:folder' OR TYPE:'cm:content'" },
|
{ "query": "TYPE:'cm:folder' OR TYPE:'cm:content'" },
|
||||||
{ "query": "NOT cm:creator:System" },
|
{ "query": "NOT cm:creator:System" },
|
||||||
|
{ "query": "NOT TYPE:'dl:dataList' AND NOT TYPE:'dl:todoList' AND NOT TYPE:'dl:issue' AND NOT TYPE:'fm:topic' AND NOT TYPE:'lnk:link' AND NOT TYPE:'fm:post'" },
|
||||||
{ "query": "-(SITE: _REPOSITORY_)" }
|
{ "query": "-(SITE: _REPOSITORY_)" }
|
||||||
],
|
],
|
||||||
"facetFields": [
|
"facetFields": [
|
||||||
|
@@ -57,6 +57,7 @@ import { SearchInputComponent } from './components/search-input/search-input.com
|
|||||||
import { SidenavComponent } from './components/sidenav/sidenav.component';
|
import { SidenavComponent } from './components/sidenav/sidenav.component';
|
||||||
import { AboutComponent } from './components/about/about.component';
|
import { AboutComponent } from './components/about/about.component';
|
||||||
import { LocationLinkComponent } from './components/location-link/location-link.component';
|
import { LocationLinkComponent } from './components/location-link/location-link.component';
|
||||||
|
import { CustomDlRowComponent } from './components/custom-dl-row/custom-dl-row.component';
|
||||||
import { NodeCopyDirective } from './common/directives/node-copy.directive';
|
import { NodeCopyDirective } from './common/directives/node-copy.directive';
|
||||||
import { NodeDeleteDirective } from './common/directives/node-delete.directive';
|
import { NodeDeleteDirective } from './common/directives/node-delete.directive';
|
||||||
import { NodeMoveDirective } from './common/directives/node-move.directive';
|
import { NodeMoveDirective } from './common/directives/node-move.directive';
|
||||||
@@ -139,6 +140,7 @@ import { ViewerEffects } from './store/effects/viewer.effects';
|
|||||||
PreviewComponent,
|
PreviewComponent,
|
||||||
AboutComponent,
|
AboutComponent,
|
||||||
LocationLinkComponent,
|
LocationLinkComponent,
|
||||||
|
CustomDlRowComponent,
|
||||||
NodeCopyDirective,
|
NodeCopyDirective,
|
||||||
NodeDeleteDirective,
|
NodeDeleteDirective,
|
||||||
NodeMoveDirective,
|
NodeMoveDirective,
|
||||||
|
@@ -0,0 +1,21 @@
|
|||||||
|
<div class="app-custom-search-row">
|
||||||
|
<div class="line">
|
||||||
|
<a *ngIf="isFile" href="" (click)="showPreview()" class="link"> {{ name }} </a>
|
||||||
|
|
||||||
|
<span *ngIf="!isFile" class="bold"> {{ name }} </span>
|
||||||
|
|
||||||
|
<span *ngIf="hasTitle"> ( {{ title }} ) </span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div *ngIf="hasDescription" class="line"> {{ description }} </div>
|
||||||
|
|
||||||
|
<div class="line">
|
||||||
|
{{ 'APP.BROWSE.SEARCH.CUSTOM_ROW.MODIFIED' | translate }}: {{ modifiedAt | date:'medium' }}
|
||||||
|
|
||||||
|
by <span> {{ user }} </span>
|
||||||
|
|
||||||
|
<span *ngIf="size">| {{ size }} </span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="line">{{ 'APP.BROWSE.SEARCH.CUSTOM_ROW.LOCATION' | translate }}: <app-location-link [context]="context"></app-location-link></div>
|
||||||
|
</div>
|
@@ -0,0 +1,24 @@
|
|||||||
|
@import 'mixins';
|
||||||
|
|
||||||
|
.app-custom-search-row {
|
||||||
|
@include flex-column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.line {
|
||||||
|
margin: 5px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bold {
|
||||||
|
font-weight: 400;
|
||||||
|
color: rgba(0, 0, 0, 0.87);
|
||||||
|
}
|
||||||
|
|
||||||
|
.link {
|
||||||
|
text-decoration: none;
|
||||||
|
color: rgba(0, 0, 0, 0.87);
|
||||||
|
}
|
||||||
|
|
||||||
|
.link:hover {
|
||||||
|
color: #2196F3;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
108
src/app/components/custom-dl-row/custom-dl-row.component.ts
Normal file
108
src/app/components/custom-dl-row/custom-dl-row.component.ts
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Alfresco Example Content Application
|
||||||
|
*
|
||||||
|
* Copyright (C) 2005 - 2018 Alfresco Software Limited
|
||||||
|
*
|
||||||
|
* This file is part of the Alfresco Example Content Application.
|
||||||
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
|
* provided under the following open source license terms:
|
||||||
|
*
|
||||||
|
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
|
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
||||||
|
import { ViewNodeAction } from '../../store/actions/viewer.action';
|
||||||
|
import { Store } from '@ngrx/store';
|
||||||
|
import { AppStore } from '../../store/states/app.state';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-custom-dl-row',
|
||||||
|
templateUrl: './custom-dl-row.component.html',
|
||||||
|
styleUrls: ['./custom-dl-row.component.scss']
|
||||||
|
})
|
||||||
|
export class CustomDlRowComponent implements OnInit {
|
||||||
|
private node: MinimalNodeEntryEntity;
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
context: any;
|
||||||
|
|
||||||
|
constructor(private store: Store<AppStore>) {}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.node = this.context.row.node.entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
get name() {
|
||||||
|
return this.getValue('name');
|
||||||
|
}
|
||||||
|
|
||||||
|
get title() {
|
||||||
|
return this.getValue('properties["cm:title"]');
|
||||||
|
}
|
||||||
|
|
||||||
|
get description() {
|
||||||
|
return this.getValue('properties["cm:description"]');
|
||||||
|
}
|
||||||
|
|
||||||
|
get modifiedAt() {
|
||||||
|
return this.getValue('modifiedAt');
|
||||||
|
}
|
||||||
|
|
||||||
|
get size() {
|
||||||
|
return this.getValue('content.modifiedAt');
|
||||||
|
}
|
||||||
|
|
||||||
|
get user() {
|
||||||
|
return this.getValue('modifiedByUser.displayName');
|
||||||
|
}
|
||||||
|
|
||||||
|
get hasDescription() {
|
||||||
|
return this.description;
|
||||||
|
}
|
||||||
|
|
||||||
|
get hasTitle() {
|
||||||
|
return this.title;
|
||||||
|
}
|
||||||
|
|
||||||
|
get hasSize() {
|
||||||
|
return this.size;
|
||||||
|
}
|
||||||
|
|
||||||
|
get isFile() {
|
||||||
|
return this.getValue('isFile');
|
||||||
|
}
|
||||||
|
|
||||||
|
showPreview() {
|
||||||
|
const { id, name} = this.node;
|
||||||
|
|
||||||
|
this.store.dispatch(new ViewNodeAction({
|
||||||
|
id,
|
||||||
|
name
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
private getValue(path) {
|
||||||
|
return path
|
||||||
|
.replace('["', '.')
|
||||||
|
.replace('"]', '')
|
||||||
|
.replace('[', '.')
|
||||||
|
.replace(']', '')
|
||||||
|
.split('.')
|
||||||
|
.reduce((acc, part) => acc ? acc[part] : null, this.node);
|
||||||
|
}
|
||||||
|
}
|
@@ -78,7 +78,8 @@ export class LocationLinkComponent implements OnInit {
|
|||||||
const data: DataTableAdapter = this.context.data;
|
const data: DataTableAdapter = this.context.data;
|
||||||
const col: DataColumn = this.context.col;
|
const col: DataColumn = this.context.col;
|
||||||
const row: DataRow = this.context.row;
|
const row: DataRow = this.context.row;
|
||||||
const value: PathInfoEntity = data.getValue(row, col);
|
const path: PathInfoEntity = data.getValue(row, col);
|
||||||
|
const value = path || this.context.row.node.entry.path;
|
||||||
|
|
||||||
if (value && value.name && value.elements) {
|
if (value && value.name && value.elements) {
|
||||||
this.displayText = this.getDisplayText(value);
|
this.displayText = this.getDisplayText(value);
|
||||||
|
@@ -100,32 +100,15 @@
|
|||||||
[sr-title]="'ADF-DOCUMENT-LIST.LAYOUT.THUMBNAIL'"
|
[sr-title]="'ADF-DOCUMENT-LIST.LAYOUT.THUMBNAIL'"
|
||||||
[sortable]="false">
|
[sortable]="false">
|
||||||
</data-column>
|
</data-column>
|
||||||
|
|
||||||
<data-column
|
<data-column
|
||||||
[key]="'name'"
|
key
|
||||||
[type]="'text'"
|
type="text">
|
||||||
[title]="'ADF-DOCUMENT-LIST.LAYOUT.NAME'"
|
<ng-template let-context>
|
||||||
[class]="'full-width ellipsis-cell'"
|
<app-custom-dl-row [context]="context"></app-custom-dl-row>
|
||||||
[sortable]="false">
|
</ng-template>
|
||||||
</data-column>
|
|
||||||
<data-column
|
|
||||||
[key]="'content.sizeInBytes'"
|
|
||||||
[type]="'fileSize'"
|
|
||||||
[title]="'ADF-DOCUMENT-LIST.LAYOUT.SIZE'"
|
|
||||||
[sortable]="false">
|
|
||||||
</data-column>
|
|
||||||
<data-column
|
|
||||||
[key]="'modifiedAt'"
|
|
||||||
[type]="'date'"
|
|
||||||
[title]="'ADF-DOCUMENT-LIST.LAYOUT.MODIFIED_ON'"
|
|
||||||
[format]="'timeAgo'"
|
|
||||||
[sortable]="false">
|
|
||||||
</data-column>
|
|
||||||
<data-column
|
|
||||||
[key]="'modifiedByUser.displayName'"
|
|
||||||
[type]="'text'"
|
|
||||||
[title]="'ADF-DOCUMENT-LIST.LAYOUT.MODIFIED_BY'"
|
|
||||||
[sortable]="false">
|
|
||||||
</data-column>
|
</data-column>
|
||||||
|
|
||||||
</data-columns>
|
</data-columns>
|
||||||
|
|
||||||
<empty-folder-content>
|
<empty-folder-content>
|
||||||
|
@@ -98,7 +98,11 @@
|
|||||||
},
|
},
|
||||||
"SEARCH": {
|
"SEARCH": {
|
||||||
"TITLE": "Search Results",
|
"TITLE": "Search Results",
|
||||||
"FOUND_RESULTS": "{{ number }} results found"
|
"FOUND_RESULTS": "{{ number }} results found",
|
||||||
|
"CUSTOM_ROW": {
|
||||||
|
"MODIFIED": "Modified",
|
||||||
|
"LOCATION": "Location"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ACTIONS": {
|
"ACTIONS": {
|
||||||
|
Reference in New Issue
Block a user