mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[ACS-5645] Implemented the review comments
This commit is contained in:
+1
-1
@@ -30,7 +30,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<p *ngIf="!hasCategory" class="adf-no-categories-message">
|
<p *ngIf="isCategoryEmpty" class="adf-no-categories-message">
|
||||||
{{ noCategoriesMsg | translate }}
|
{{ noCategoriesMsg | translate }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
-1
@@ -53,7 +53,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.adf-no-categories-message {
|
.adf-no-categories-message {
|
||||||
margin-left: 9px;
|
|
||||||
margin-top: 28.5px;
|
margin-top: 28.5px;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
|
|||||||
+5
-10
@@ -240,17 +240,12 @@ describe('CategoriesManagementComponent', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('hasCategory', () => {
|
describe('isCategoryEmpty', () => {
|
||||||
it('should return true when has categories', () => {
|
it('should return true when categories empty', () => {
|
||||||
component.categories = [category3, category4];
|
|
||||||
const result = component.hasCategory;
|
|
||||||
expect(result).toBeTrue();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return false when does not have categories', () => {
|
|
||||||
component.categories = [];
|
component.categories = [];
|
||||||
const result = component.hasCategory;
|
component.categoryNameControlVisible = false;
|
||||||
expect(result).toBeFalse();
|
const result = component.isCategoryEmpty;
|
||||||
|
expect(result).toBeTrue();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -189,10 +189,10 @@ export class CategoriesManagementComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns `true` if has categories, otherwise `false`
|
* Returns `true` if categories empty, otherwise `false`
|
||||||
*/
|
*/
|
||||||
get hasCategory(): boolean {
|
get isCategoryEmpty(): boolean {
|
||||||
return this.categories?.length > 0;
|
return this.categories?.length === 0 && !this.categoryNameControlVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
get existingCategories(): Category[] {
|
get existingCategories(): Category[] {
|
||||||
|
|||||||
+4
-2
@@ -202,8 +202,10 @@
|
|||||||
<mat-icon>
|
<mat-icon>
|
||||||
{{ group.expanded ? 'expand_more' : 'chevron_right'}}
|
{{ group.expanded ? 'expand_more' : 'chevron_right'}}
|
||||||
</mat-icon>
|
</mat-icon>
|
||||||
<mat-panel-title class="adf-metadata-properties-title">
|
<mat-panel-title class="adf-metadata-properties-title" matTooltip="{{ group.title | translate }}">
|
||||||
{{ group.title | translate }}
|
<p class="adf-metadata-properties-group-title">
|
||||||
|
{{ group.title | translate }}
|
||||||
|
</p>
|
||||||
</mat-panel-title>
|
</mat-panel-title>
|
||||||
</div>
|
</div>
|
||||||
<button *ngIf="hasGroupToggleEdit(group)"
|
<button *ngIf="hasGroupToggleEdit(group)"
|
||||||
|
|||||||
+28
-8
@@ -1,14 +1,22 @@
|
|||||||
.adf {
|
.adf {
|
||||||
&-metadata-properties {
|
&-metadata-properties {
|
||||||
mat-expansion-panel-header {
|
mat-expansion-panel-header {
|
||||||
height: 56px;
|
height: 56px;
|
||||||
|
padding: 0 12px;
|
||||||
.adf-metadata-properties-title {
|
|
||||||
font-weight: 700;
|
.adf-metadata-properties-title {
|
||||||
font-size: 15px;
|
font-weight: 700;
|
||||||
padding-left: 12px;
|
font-size: 15px;
|
||||||
|
padding-left: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.adf-metadata-properties-group-title {
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
width: 80px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.mat-expansion-panel:not([class*='mat-elevation-z']) {
|
.mat-expansion-panel:not([class*='mat-elevation-z']) {
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
@@ -47,7 +55,7 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
padding: 24px;
|
padding-top: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-tags {
|
&-tags {
|
||||||
@@ -118,3 +126,15 @@
|
|||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.adf-metadata-grouped-properties-container .mat-content.mat-content-hide-toggle {
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.adf-metadata-grouped-properties-container {
|
||||||
|
.mat-expansion-panel {
|
||||||
|
.mat-expansion-panel-body {
|
||||||
|
padding: 0 24px 0px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+7
-3
@@ -21,7 +21,7 @@ import { By } from '@angular/platform-browser';
|
|||||||
import { Category, CategoryPaging, ClassesApi, Node, Tag, TagBody, TagEntry, TagPaging, TagPagingList } from '@alfresco/js-api';
|
import { Category, CategoryPaging, ClassesApi, Node, Tag, TagBody, TagEntry, TagPaging, TagPagingList } from '@alfresco/js-api';
|
||||||
import { ContentMetadataComponent } from './content-metadata.component';
|
import { ContentMetadataComponent } from './content-metadata.component';
|
||||||
import { ContentMetadataService } from '../../services/content-metadata.service';
|
import { ContentMetadataService } from '../../services/content-metadata.service';
|
||||||
import { AppConfigService, CardViewBaseItemModel, CardViewComponent, LogService, UpdateNotification } from '@alfresco/adf-core';
|
import { AppConfigService, CardViewBaseItemModel, CardViewComponent, LogService, NotificationService, UpdateNotification } from '@alfresco/adf-core';
|
||||||
import { NodesApiService } from '../../../common/services/nodes-api.service';
|
import { NodesApiService } from '../../../common/services/nodes-api.service';
|
||||||
import { EMPTY, of, throwError } from 'rxjs';
|
import { EMPTY, of, throwError } from 'rxjs';
|
||||||
import { ContentTestingModule } from '../../../testing/content.testing.module';
|
import { ContentTestingModule } from '../../../testing/content.testing.module';
|
||||||
@@ -52,6 +52,7 @@ describe('ContentMetadataComponent', () => {
|
|||||||
let tagService: TagService;
|
let tagService: TagService;
|
||||||
let categoryService: CategoryService;
|
let categoryService: CategoryService;
|
||||||
let getClassSpy: jasmine.Spy;
|
let getClassSpy: jasmine.Spy;
|
||||||
|
let notificationService: NotificationService;
|
||||||
|
|
||||||
const preset = 'custom-preset';
|
const preset = 'custom-preset';
|
||||||
|
|
||||||
@@ -192,6 +193,7 @@ describe('ContentMetadataComponent', () => {
|
|||||||
nodesApiService = TestBed.inject(NodesApiService);
|
nodesApiService = TestBed.inject(NodesApiService);
|
||||||
tagService = TestBed.inject(TagService);
|
tagService = TestBed.inject(TagService);
|
||||||
categoryService = TestBed.inject(CategoryService);
|
categoryService = TestBed.inject(CategoryService);
|
||||||
|
notificationService = TestBed.inject(NotificationService);
|
||||||
const propertyDescriptorsService = TestBed.inject(PropertyDescriptorsService);
|
const propertyDescriptorsService = TestBed.inject(PropertyDescriptorsService);
|
||||||
const classesApi = propertyDescriptorsService['classesApi'];
|
const classesApi = propertyDescriptorsService['classesApi'];
|
||||||
|
|
||||||
@@ -441,6 +443,7 @@ describe('ContentMetadataComponent', () => {
|
|||||||
|
|
||||||
describe('toggleEdit', () => {
|
describe('toggleEdit', () => {
|
||||||
let mockEvent: MouseEvent;
|
let mockEvent: MouseEvent;
|
||||||
|
let showErrorSpy: jasmine.Spy;
|
||||||
const mockGroup: CardViewGroup = {
|
const mockGroup: CardViewGroup = {
|
||||||
editable: false,
|
editable: false,
|
||||||
expanded: false,
|
expanded: false,
|
||||||
@@ -450,6 +453,7 @@ describe('ContentMetadataComponent', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mockEvent = new MouseEvent('click');
|
mockEvent = new MouseEvent('click');
|
||||||
component.editableGroup = mockGroup;
|
component.editableGroup = mockGroup;
|
||||||
|
showErrorSpy = spyOn(notificationService, 'showError').and.stub();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should toggle General Info editing mode', () => {
|
it('should toggle General Info editing mode', () => {
|
||||||
@@ -489,10 +493,10 @@ describe('ContentMetadataComponent', () => {
|
|||||||
|
|
||||||
it('should show Snackbar when Editing Panel is Active', () => {
|
it('should show Snackbar when Editing Panel is Active', () => {
|
||||||
spyOn(component, 'isEditingPanel').and.returnValue(true);
|
spyOn(component, 'isEditingPanel').and.returnValue(true);
|
||||||
spyOn(component, 'showSnackbarError');
|
|
||||||
component.toggleEdit(mockEvent, mockGroup, ButtonType.GeneralInfo);
|
component.toggleEdit(mockEvent, mockGroup, ButtonType.GeneralInfo);
|
||||||
expect(component.isEditingPanel).toHaveBeenCalled();
|
expect(component.isEditingPanel).toHaveBeenCalled();
|
||||||
expect(component.showSnackbarError).toHaveBeenCalledWith('METADATA.BASIC.SAVE_OR_DISCARD_CHANGES');
|
expect(showErrorSpy).toHaveBeenCalledWith('METADATA.BASIC.SAVE_OR_DISCARD_CHANGES');
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+1
-9
@@ -374,14 +374,10 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
showSnackbarError(message: string): void {
|
|
||||||
this.notificationService.showError(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
toggleEdit(event: MouseEvent, group: CardViewGroup, buttonType: ButtonType): void {
|
toggleEdit(event: MouseEvent, group: CardViewGroup, buttonType: ButtonType): void {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
if (this.isEditingPanel()) {
|
if (this.isEditingPanel()) {
|
||||||
this.showSnackbarError('METADATA.BASIC.SAVE_OR_DISCARD_CHANGES');
|
this.notificationService.showError('METADATA.BASIC.SAVE_OR_DISCARD_CHANGES');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,21 +393,18 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
this.editableTags = false;
|
this.editableTags = false;
|
||||||
this.editableCategories = false;
|
this.editableCategories = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ButtonType.Tags:
|
case ButtonType.Tags:
|
||||||
this.editableTags = !this.editableTags;
|
this.editableTags = !this.editableTags;
|
||||||
this.editableTagsChange.emit(this.editableTags);
|
this.editableTagsChange.emit(this.editableTags);
|
||||||
this.isTagPanelVisible = this.editableTags;
|
this.isTagPanelVisible = this.editableTags;
|
||||||
this.tagNameControlVisible = true;
|
this.tagNameControlVisible = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ButtonType.Categories:
|
case ButtonType.Categories:
|
||||||
this.editableCategories = !this.editableCategories;
|
this.editableCategories = !this.editableCategories;
|
||||||
this.editableCategoriesChange.emit(this.editableCategories);
|
this.editableCategoriesChange.emit(this.editableCategories);
|
||||||
this.isCategoriesPanelVisible = this.editableCategories;
|
this.isCategoriesPanelVisible = this.editableCategories;
|
||||||
this.categoryControlVisible = true;
|
this.categoryControlVisible = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ButtonType.Group:
|
case ButtonType.Group:
|
||||||
group.editable = !group.editable;
|
group.editable = !group.editable;
|
||||||
this.groupChange.emit(group);
|
this.groupChange.emit(group);
|
||||||
@@ -420,7 +413,6 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
group.expanded = true;
|
group.expanded = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,16 +14,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<p
|
<p
|
||||||
class="adf-no-tags-message"
|
class="adf-no-tags-message"
|
||||||
*ngIf="!hasTags">
|
*ngIf="isTagsEmpty">
|
||||||
{{ 'TAG.TAGS_CREATOR.NO_TAGS_CREATED' | translate }}
|
{{ 'TAG.TAGS_CREATOR.NO_TAGS_CREATED' | translate }}
|
||||||
</p>
|
</p>
|
||||||
<div
|
<div
|
||||||
class="adf-tags-list"
|
class="adf-tags-list"
|
||||||
[class.adf-tags-list-fixed]="!tagNameControlVisible"
|
[class.adf-tags-list-fixed]="!tagNameControlVisible"
|
||||||
#tagsList>
|
#tagsList>
|
||||||
<span
|
<span *ngFor="let tag of tags" class="adf-tag adf-label-with-icon-button">
|
||||||
*ngFor="let tag of tags"
|
|
||||||
class="adf-tag adf-label-with-icon-button">
|
|
||||||
{{ tag }}
|
{{ tag }}
|
||||||
<button
|
<button
|
||||||
data-automation-id="remove-tag-button"
|
data-automation-id="remove-tag-button"
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ adf-tags-creator {
|
|||||||
border-radius: 16px;
|
border-radius: 16px;
|
||||||
padding: 6px 0;
|
padding: 6px 0;
|
||||||
padding-left: 12px;
|
padding-left: 12px;
|
||||||
margin-left: 8px;
|
|
||||||
|
|
||||||
.adf-remove-tag {
|
.adf-remove-tag {
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
@@ -21,7 +20,6 @@ adf-tags-creator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.adf-no-tags-message {
|
.adf-no-tags-message {
|
||||||
margin-left: 9px;
|
|
||||||
margin-top: 28.5px;
|
margin-top: 28.5px;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
@@ -55,7 +53,6 @@ adf-tags-creator {
|
|||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
display: flex;
|
display: flex;
|
||||||
padding: 0 12px;
|
|
||||||
|
|
||||||
.mat-form-field-underline {
|
.mat-form-field-underline {
|
||||||
display: none;
|
display: none;
|
||||||
@@ -70,7 +67,7 @@ adf-tags-creator {
|
|||||||
color: var(--theme-primary-color);
|
color: var(--theme-primary-color);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
margin-top: -1px;
|
margin-top: -1px;
|
||||||
padding-left: 27px;
|
padding-left: 12px;
|
||||||
overflow-wrap: anywhere;
|
overflow-wrap: anywhere;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding-right: 12px;
|
padding-right: 12px;
|
||||||
@@ -79,10 +76,13 @@ adf-tags-creator {
|
|||||||
|
|
||||||
.adf-tags-list {
|
.adf-tags-list {
|
||||||
padding-right: 0;
|
padding-right: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.adf-tag {
|
.adf-tag {
|
||||||
margin-top: 0;
|
margin-top: 8px;
|
||||||
overflow-wrap: anywhere;
|
overflow-wrap: anywhere;
|
||||||
|
|
||||||
& + .adf-tag {
|
& + .adf-tag {
|
||||||
@@ -104,7 +104,7 @@ adf-tags-creator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.adf-tags-list {
|
.adf-tags-list {
|
||||||
padding-left: 18px;
|
padding-left: 12px;
|
||||||
margin-top: -2px;
|
margin-top: -2px;
|
||||||
padding-right: 0;
|
padding-right: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -123,7 +123,7 @@ adf-tags-creator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.mat-list-item-content-reverse {
|
.mat-list-item-content-reverse {
|
||||||
padding: 0 6px;
|
padding: 0;
|
||||||
|
|
||||||
.mat-pseudo-checkbox {
|
.mat-pseudo-checkbox {
|
||||||
display: none;
|
display: none;
|
||||||
|
|||||||
@@ -337,17 +337,12 @@ describe('TagsCreatorComponent', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('hasTags', () => {
|
describe('isTagsEmpty', () => {
|
||||||
it('should return true when has tags', () => {
|
it('should return true when tags empty', () => {
|
||||||
component.tags = ['new tag 1', 'new tag 2'];
|
|
||||||
const result = component.hasTags;
|
|
||||||
expect(result).toBeTrue();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return false when does not have tags', () => {
|
|
||||||
component.tags = [];
|
component.tags = [];
|
||||||
const result = component.hasTags;
|
component.tagNameControlVisible = false;
|
||||||
expect(result).toBeFalse();
|
const result = component.isTagsEmpty;
|
||||||
|
expect(result).toBeTrue();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -227,10 +227,10 @@ export class TagsCreatorComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns `true` if has tags, otherwise `false`
|
* Returns `true` if tags empty, otherwise `false`
|
||||||
*/
|
*/
|
||||||
get hasTags(): boolean {
|
get isTagsEmpty(): boolean {
|
||||||
return this.tags?.length > 0;
|
return this.tags.length === 0 && !this.tagNameControlVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
get existingTags(): TagEntry[] {
|
get existingTags(): TagEntry[] {
|
||||||
|
|||||||
Reference in New Issue
Block a user