[ACS-5645] Implemented changes as per review comments

This commit is contained in:
Yasa-Nataliya
2023-10-09 20:23:58 +05:30
parent f0de971e8e
commit 702805f039
14 changed files with 51 additions and 78 deletions
@@ -30,7 +30,7 @@
</button>
</span>
</div>
<p *ngIf="!isCategoryEmpty" class="adf-no-categories-message">
<p *ngIf="!hasCategory" class="adf-no-categories-message">
{{ noCategoriesMsg | translate }}
</p>
</div>
@@ -240,16 +240,16 @@ describe('CategoriesManagementComponent', () => {
});
});
describe('isCategoryEmpty', () => {
it('should return true when categories is not empty', () => {
describe('hasCategory', () => {
it('should return true when has categories', () => {
component.categories = [category3, category4];
const result = component.isCategoryEmpty;
const result = component.hasCategory;
expect(result).toBeTrue();
});
it('should return false when categories is empty', () => {
it('should return false when does not have categories', () => {
component.categories = [];
const result = component.isCategoryEmpty;
const result = component.hasCategory;
expect(result).toBeFalse();
});
});
@@ -177,6 +177,9 @@ export class CategoriesManagementComponent implements OnInit, OnDestroy {
this.cancelExistingCategoriesLoading$.complete();
}
/*
* Returns `true` if categoryNameControlVisible is true, otherwise `false`
*/
get isNameCategoryVisible(): boolean {
return (!this.categoryNameControlVisible && this.categories?.length > 0) || this.categoryNameControlVisible;
}
@@ -185,7 +188,10 @@ export class CategoriesManagementComponent implements OnInit, OnDestroy {
return this._categoryNameControl;
}
get isCategoryEmpty(): boolean {
/*
* Returns `true` if has categories, otherwise `false`
*/
get hasCategory(): boolean {
return this.categories?.length > 0;
}
@@ -30,7 +30,8 @@
<button mat-icon-button
[attr.title]="'CORE.METADATA.ACTIONS.CANCEL' | translate"
(click)="cancelChanges(buttonType.GeneralInfo, $event, group)"
data-automation-id="reset-metadata">
data-automation-id="reset-metadata"
class="adf-metadata-action-buttons-clear">
<mat-icon>clear</mat-icon>
</button>
<button mat-icon-button
@@ -84,7 +85,8 @@
<button mat-icon-button
[attr.title]="'CORE.METADATA.ACTIONS.CANCEL' | translate"
(click)="cancelChanges(buttonType.Tags, $event, group)"
data-automation-id="reset-tags-metadata">
data-automation-id="reset-tags-metadata"
class="adf-metadata-action-buttons-clear">
<mat-icon>clear</mat-icon>
</button>
<button mat-icon-button
@@ -146,7 +148,8 @@
<button mat-icon-button
[attr.title]="'CORE.METADATA.ACTIONS.CANCEL' | translate"
(click)="cancelChanges(buttonType.Categories, $event, group)"
data-automation-id="reset-metadata">
data-automation-id="reset-metadata"
class="adf-metadata-action-buttons-clear">
<mat-icon>clear</mat-icon>
</button>
<button mat-icon-button
@@ -216,7 +219,8 @@
<button mat-icon-button
[attr.title]="'CORE.METADATA.ACTIONS.CANCEL' | translate"
(click)="cancelChanges(buttonType.Group, $event, group)"
data-automation-id="reset-metadata">
data-automation-id="reset-metadata"
class="adf-metadata-action-buttons-clear">
<mat-icon>clear</mat-icon>
</button>
<button mat-icon-button
@@ -4,7 +4,7 @@
height: 56px;
.adf-metadata-properties-title {
font-weight: normal;
font-weight: 700;
font-size: 15px;
padding-left: 12px;
}
@@ -78,7 +78,10 @@
&-metadata-action-buttons {
display: flex;
justify-content: space-evenly;
margin: 10px;
&-clear {
color: var(--theme-metadata-action-button-clear-color);
}
}
&-metadata-categories-header {
@@ -111,7 +114,7 @@
}
.adf-content-metadata-card {
.mat-card:not([class*='mat-elevation-z']) {
.mat-card {
box-shadow: none;
}
}
@@ -49,8 +49,9 @@ import { TagService } from '../../../tag/services/tag.service';
import { CategoryService } from '../../../category/services/category.service';
import { CategoriesManagementMode } from '../../../category/categories-management/categories-management-mode';
import { MatExpansionPanel } from '@angular/material/expansion';
import { AllowableOperationsEnum, ContentService } from '@alfresco/adf-content-services';
import { ButtonType } from './button-type.enum';
import { AllowableOperationsEnum } from '../../../common/models/allowable-operations.enum';
import { ContentService } from '../../../common/services/content.service';
const DEFAULT_SEPARATOR = ', ';
@@ -151,12 +152,15 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
@Output()
groupChange = new EventEmitter<CardViewGroup>();
/** (optional) This flag toggles editable of categories content. **/
@Input()
editableCategories = false;
/** (optional) This flag toggles editable of tags content. **/
@Input()
editableTags = false;
/** group content state **/
@Input()
group: CardViewGroup;
@@ -360,6 +364,7 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
this.loadProperties(this.node);
}
// Returns the editing state of the panel
isEditingPanel(): boolean {
return (
(this.editable && this.hasMetadataChanged) ||
@@ -20,6 +20,6 @@ import { CardViewItem } from '@alfresco/adf-core';
export interface CardViewGroup {
title: string;
properties: CardViewItem[];
editable: boolean;
expanded: boolean;
editable?: boolean;
expanded?: boolean;
}
@@ -14,7 +14,7 @@
</div>
<p
class="adf-no-tags-message"
*ngIf="!isTagsEmpty">
*ngIf="!hasTags">
{{ 'TAG.TAGS_CREATOR.NO_TAGS_CREATED' | translate }}
</p>
<div
@@ -337,15 +337,16 @@ describe('TagsCreatorComponent', () => {
});
});
describe('isTagsEmpty', () => {
it('should return true when tags is not empty', () => {
describe('hasTags', () => {
it('should return true when has tags', () => {
component.tags = ['new tag 1', 'new tag 2'];
const result = component.isTagsEmpty;
const result = component.hasTags;
expect(result).toBeTrue();
});
it('should return false when tags is empty', () => {
it('should return false when does not have tags', () => {
component.tags = [];
const result = component.isTagsEmpty;
const result = component.hasTags;
expect(result).toBeFalse();
});
});
@@ -219,11 +219,17 @@ export class TagsCreatorComponent implements OnInit, OnDestroy {
return this._tagNameControl;
}
/*
* Returns `true` if tagNameControlVisible is true, otherwise `false`
*/
get isNameTagsVisible(): boolean {
return (!this.tagNameControlVisible && this.tags?.length > 0) || this.tagNameControlVisible;
}
get isTagsEmpty(): boolean {
/*
* Returns `true` if has tags, otherwise `false`
*/
get hasTags(): boolean {
return this.tags?.length > 0;
}