mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[ACS-5645] Lint fixes
This commit is contained in:
committed by
Anukriti Singh
parent
2b0ead0077
commit
ee71ce5cbb
-1
@@ -496,7 +496,6 @@ describe('ContentMetadataComponent', () => {
|
|||||||
component.toggleEdit(mockEvent, mockGroup, ButtonType.GeneralInfo);
|
component.toggleEdit(mockEvent, mockGroup, ButtonType.GeneralInfo);
|
||||||
expect(component.isEditingPanel).toHaveBeenCalled();
|
expect(component.isEditingPanel).toHaveBeenCalled();
|
||||||
expect(showErrorSpy).toHaveBeenCalledWith('METADATA.BASIC.SAVE_OR_DISCARD_CHANGES');
|
expect(showErrorSpy).toHaveBeenCalledWith('METADATA.BASIC.SAVE_OR_DISCARD_CHANGES');
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+66
-32
@@ -129,18 +129,26 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
@Input()
|
@Input()
|
||||||
customPanels: ContentMetadataCustomPanel[] = [];
|
customPanels: ContentMetadataCustomPanel[] = [];
|
||||||
|
|
||||||
/** (optional) This flag sets the metadata in read only mode
|
/**
|
||||||
/** (optional) This flag sets the metadata in read only mode
|
* (optional) This flag sets the metadata in read-only mode,
|
||||||
* preventing changes.
|
* preventing changes.
|
||||||
*/
|
*/
|
||||||
@Input()
|
@Input()
|
||||||
readOnly = false;
|
readOnly = false;
|
||||||
|
|
||||||
/** Emitted when content's editable state is changed. **/
|
/**
|
||||||
|
* Emitted when content's editable state is changed.
|
||||||
|
*
|
||||||
|
* @Output
|
||||||
|
*/
|
||||||
@Output()
|
@Output()
|
||||||
editableChange = new EventEmitter<boolean>();
|
editableChange = new EventEmitter<boolean>();
|
||||||
|
|
||||||
/** Emitted when content's editableTags state is changed. **/
|
/**
|
||||||
|
* Emitted when content's editableTags state is changed.
|
||||||
|
*
|
||||||
|
* @Output
|
||||||
|
*/
|
||||||
@Output()
|
@Output()
|
||||||
editableTagsChange = new EventEmitter<boolean>();
|
editableTagsChange = new EventEmitter<boolean>();
|
||||||
|
|
||||||
@@ -148,19 +156,35 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
@Output()
|
@Output()
|
||||||
editableCategoriesChange = new EventEmitter<boolean>();
|
editableCategoriesChange = new EventEmitter<boolean>();
|
||||||
|
|
||||||
/** Emitted when content's group state is changed. **/
|
/**
|
||||||
|
* Emitted when content's group state is changed.
|
||||||
|
*
|
||||||
|
* @Output
|
||||||
|
*/
|
||||||
@Output()
|
@Output()
|
||||||
groupChange = new EventEmitter<CardViewGroup>();
|
groupChange = new EventEmitter<CardViewGroup>();
|
||||||
|
|
||||||
/** (optional) This flag toggles editable of categories content. **/
|
/**
|
||||||
|
* (optional) This flag toggles editable of categories content.
|
||||||
|
*
|
||||||
|
* @Input
|
||||||
|
*/
|
||||||
@Input()
|
@Input()
|
||||||
editableCategories = false;
|
editableCategories = false;
|
||||||
|
|
||||||
/** (optional) This flag toggles editable of tags content. **/
|
/**
|
||||||
|
* (optional) This flag toggles editable of tags content.
|
||||||
|
*
|
||||||
|
* @Input
|
||||||
|
*/
|
||||||
@Input()
|
@Input()
|
||||||
editableTags = false;
|
editableTags = false;
|
||||||
|
|
||||||
/** group content state **/
|
/**
|
||||||
|
* group content state
|
||||||
|
* @Input()
|
||||||
|
* group: CardViewGroup;
|
||||||
|
*/
|
||||||
@Input()
|
@Input()
|
||||||
group: CardViewGroup;
|
group: CardViewGroup;
|
||||||
|
|
||||||
@@ -290,7 +314,8 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called after clicking save button. It confirms all changes done for metadata and hides both category and tag name controls.
|
* Called after clicking save button. It confirms all changes done for metadata and hides both category and tag name controls.
|
||||||
* Before clicking on that button they are not saved.
|
*
|
||||||
|
* @param Before clicking on that button they are not saved.
|
||||||
*/
|
*/
|
||||||
saveChanges(buttonType: ButtonType, event: MouseEvent, group?: CardViewGroup) {
|
saveChanges(buttonType: ButtonType, event: MouseEvent, group?: CardViewGroup) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
@@ -390,21 +415,21 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
this.editable = !this.editable;
|
this.editable = !this.editable;
|
||||||
this.editableChange.emit(this.editable);
|
this.editableChange.emit(this.editable);
|
||||||
this.panel.open();
|
this.panel.open();
|
||||||
group.editable =false;
|
group.editable = 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;
|
||||||
group.editable =false;
|
group.editable = false;
|
||||||
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;
|
||||||
group.editable =false;
|
group.editable = false;
|
||||||
break;
|
break;
|
||||||
case ButtonType.Group:
|
case ButtonType.Group:
|
||||||
group.editable = !group.editable;
|
group.editable = !group.editable;
|
||||||
@@ -455,7 +480,8 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
keyDown(event: KeyboardEvent) {
|
keyDown(event: KeyboardEvent) {
|
||||||
if (event.keyCode === 37 || event.keyCode === 39) { // ArrowLeft && ArrowRight
|
if (event.keyCode === 37 || event.keyCode === 39) {
|
||||||
|
// ArrowLeft && ArrowRight
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -465,13 +491,15 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
updatedNode: this.nodesApiService.updateNode(this.node.id, this.changedProperties),
|
updatedNode: this.nodesApiService.updateNode(this.node.id, this.changedProperties),
|
||||||
...(this.displayTags ? this.saveTags() : {}),
|
...(this.displayTags ? this.saveTags() : {}),
|
||||||
...(this.displayCategories ? this.saveCategories() : {})
|
...(this.displayCategories ? this.saveCategories() : {})
|
||||||
}).pipe(
|
})
|
||||||
catchError((err) => {
|
.pipe(
|
||||||
this.cardViewContentUpdateService.updateElement(this.targetProperty);
|
catchError((err) => {
|
||||||
this.handleUpdateError(err);
|
this.cardViewContentUpdateService.updateElement(this.targetProperty);
|
||||||
this._saving = false;
|
this.handleUpdateError(err);
|
||||||
return of(null);
|
this._saving = false;
|
||||||
}))
|
return of(null);
|
||||||
|
})
|
||||||
|
)
|
||||||
.subscribe((result: any) => {
|
.subscribe((result: any) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.updateUndefinedNodeProperties(result.updatedNode);
|
this.updateUndefinedNodeProperties(result.updatedNode);
|
||||||
@@ -485,9 +513,9 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
this.loadTagsForNode(this.node.id);
|
this.loadTagsForNode(this.node.id);
|
||||||
}
|
}
|
||||||
if (this.displayCategories && !!result.LinkingCategories) {
|
if (this.displayCategories && !!result.LinkingCategories) {
|
||||||
this.assignedCategories = result.LinkingCategories.list ?
|
this.assignedCategories = result.LinkingCategories.list
|
||||||
result.LinkingCategories.list.entries.map((entry: CategoryEntry) => entry.entry) :
|
? result.LinkingCategories.list.entries.map((entry: CategoryEntry) => entry.entry)
|
||||||
[result.LinkingCategories.entry];
|
: [result.LinkingCategories.entry];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._saving = false;
|
this._saving = false;
|
||||||
@@ -524,11 +552,14 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
private getProperties(node: Node) {
|
private getProperties(node: Node) {
|
||||||
const properties$ = this.contentMetadataService.getBasicProperties(node);
|
const properties$ = this.contentMetadataService.getBasicProperties(node);
|
||||||
const contentTypeProperty$ = this.contentMetadataService.getContentTypeProperty(node);
|
const contentTypeProperty$ = this.contentMetadataService.getContentTypeProperty(node);
|
||||||
return zip(properties$, contentTypeProperty$)
|
return zip(properties$, contentTypeProperty$).pipe(
|
||||||
.pipe(map(([properties, contentTypeProperty]) => {
|
map(([properties, contentTypeProperty]) => {
|
||||||
const filteredProperties = contentTypeProperty.filter((property) => properties.findIndex((baseProperty) => baseProperty.key === property.key) === -1);
|
const filteredProperties = contentTypeProperty.filter(
|
||||||
|
(property) => properties.findIndex((baseProperty) => baseProperty.key === property.key) === -1
|
||||||
|
);
|
||||||
return [...properties, ...filteredProperties];
|
return [...properties, ...filteredProperties];
|
||||||
}));
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private isEmpty(value: any): boolean {
|
private isEmpty(value: any): boolean {
|
||||||
@@ -584,11 +615,14 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (this.tags.length) {
|
if (this.tags.length) {
|
||||||
observables.tagsAssigning = this.tagService.assignTagsToNode(this.node.id, this.tags.map((tag) => {
|
observables.tagsAssigning = this.tagService.assignTagsToNode(
|
||||||
const tagBody = new TagBody();
|
this.node.id,
|
||||||
tagBody.tag = tag;
|
this.tags.map((tag) => {
|
||||||
return tagBody;
|
const tagBody = new TagBody();
|
||||||
}));
|
tagBody.tag = tag;
|
||||||
|
return tagBody;
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return observables;
|
return observables;
|
||||||
|
|||||||
Reference in New Issue
Block a user