#674 revert eror throw and ad set/get for grid communities and collections

This commit is contained in:
Dániel Péter Sipos
2020-11-13 14:12:27 +01:00
parent 9339cfaafd
commit 7b160cdbd3
8 changed files with 118 additions and 16 deletions

View File

@@ -1,9 +1,12 @@
import { Component, Inject } from '@angular/core';
import { Component, Inject, Input } from '@angular/core';
import { Collection } from '../../../core/shared/collection.model';
import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
import { ViewMode } from '../../../core/shared/view-mode.model';
import { listableObjectComponent } from '../../object-collection/shared/listable-object/listable-object.decorator';
import { hasNoValue, hasValue } from '../../empty.util';
import { followLink } from '../../utils/follow-link-config.model';
import { LinkService } from '../../../core/cache/builders/link.service';
/**
* Component representing a grid element for collection
@@ -15,4 +18,21 @@ import { listableObjectComponent } from '../../object-collection/shared/listable
})
@listableObjectComponent(Collection, ViewMode.GridElement)
export class CollectionGridElementComponent extends AbstractListableElementComponent<Collection> {}
export class CollectionGridElementComponent extends AbstractListableElementComponent<Collection> {
private _object: Collection;
constructor( private linkService: LinkService){
super();
}
@Input() set object(object: Collection) {
this._object = object;
if (hasValue(this._object) && hasNoValue(this._object.logo)) {
this.linkService.resolveLink<Collection>(this._object, followLink('logo'))
}
}
get object(): Collection {
return this._object;
}
}

View File

@@ -1,9 +1,12 @@
import { Component } from '@angular/core';
import { Component, Input } from '@angular/core';
import { Community } from '../../../core/shared/community.model';
import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
import { ViewMode } from '../../../core/shared/view-mode.model';
import { listableObjectComponent } from '../../object-collection/shared/listable-object/listable-object.decorator';
import { followLink } from '../../utils/follow-link-config.model';
import { LinkService } from '../../../core/cache/builders/link.service';
import { hasNoValue, hasValue } from '../../empty.util';
/**
* Component representing a grid element for a community
@@ -15,4 +18,21 @@ import { listableObjectComponent } from '../../object-collection/shared/listable
})
@listableObjectComponent(Community, ViewMode.GridElement)
export class CommunityGridElementComponent extends AbstractListableElementComponent<Community> {}
export class CommunityGridElementComponent extends AbstractListableElementComponent<Community> {
private _object: Community;
constructor( private linkService: LinkService){
super();
}
@Input() set object(object: Community) {
this._object = object;
if (hasValue(this._object) && hasNoValue(this._object.logo)) {
this.linkService.resolveLink<Community>(this._object, followLink('logo'))
}
}
get object(): Community {
return this._object;
}
}

View File

@@ -53,6 +53,7 @@ export class GridThumbnailComponent implements OnInit, OnChanges {
!hasValue(changes.thumbnail.previousValue) &&
hasValue(changes.thumbnail.currentValue)
) {
console.log('this.thumbnail', changes.thumbnail.currentValue);
this.checkThumbnail(changes.thumbnail.currentValue);
}
}

View File

@@ -1,10 +1,15 @@
import { Component } from '@angular/core';
import { Component, Input } from '@angular/core';
import { SearchResultGridElementComponent } from '../search-result-grid-element.component';
import { Collection } from '../../../../core/shared/collection.model';
import { CollectionSearchResult } from '../../../object-collection/shared/collection-search-result.model';
import { ViewMode } from '../../../../core/shared/view-mode.model';
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
import { hasNoValue, hasValue } from '../../../empty.util';
import { followLink } from '../../../utils/follow-link-config.model';
import { LinkService } from '../../../../core/cache/builders/link.service';
import { TruncatableService } from '../../../truncatable/truncatable.service';
import { BitstreamDataService } from '../../../../core/data/bitstream-data.service';
@Component({
selector: 'ds-collection-search-result-grid-element',
@@ -15,4 +20,29 @@ import { listableObjectComponent } from '../../../object-collection/shared/lista
* Component representing a grid element for a collection search result
*/
@listableObjectComponent(CollectionSearchResult, ViewMode.GridElement)
export class CollectionSearchResultGridElementComponent extends SearchResultGridElementComponent<CollectionSearchResult, Collection> {}
export class CollectionSearchResultGridElementComponent extends SearchResultGridElementComponent< CollectionSearchResult, Collection > {
private _dso: Collection;
constructor(
private linkService: LinkService,
protected truncatableService: TruncatableService,
protected bitstreamDataService: BitstreamDataService
) {
super(truncatableService, bitstreamDataService);
}
@Input() set dso(dso: Collection) {
this._dso = dso;
console.log('aaasdasd')
if (hasValue(this._dso) && hasNoValue(this._dso.logo)) {
this.linkService.resolveLink<Collection>(
this._dso,
followLink('logo')
);
}
}
get dso(): Collection {
return this._dso;
}
}

View File

@@ -1,18 +1,47 @@
import { Component } from '@angular/core';
import { Component, Input } from '@angular/core';
import { Community } from '../../../../core/shared/community.model';
import { SearchResultGridElementComponent } from '../search-result-grid-element.component';
import { CommunitySearchResult } from '../../../object-collection/shared/community-search-result.model';
import { ViewMode } from '../../../../core/shared/view-mode.model';
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
import { LinkService } from '../../../../core/cache/builders/link.service';
import { TruncatableService } from '../../../truncatable/truncatable.service';
import { BitstreamDataService } from '../../../../core/data/bitstream-data.service';
import { hasNoValue, hasValue } from '../../../empty.util';
import { followLink } from '../../../utils/follow-link-config.model';
@Component({
selector: 'ds-community-search-result-grid-element',
styleUrls: ['../search-result-grid-element.component.scss', 'community-search-result-grid-element.component.scss'],
templateUrl: 'community-search-result-grid-element.component.html'
styleUrls: [
'../search-result-grid-element.component.scss',
'community-search-result-grid-element.component.scss',
],
templateUrl: 'community-search-result-grid-element.component.html',
})
/**
* Component representing a grid element for a community search result
*/
@listableObjectComponent(CommunitySearchResult, ViewMode.GridElement)
export class CommunitySearchResultGridElementComponent extends SearchResultGridElementComponent<CommunitySearchResult, Community> {
export class CommunitySearchResultGridElementComponent extends SearchResultGridElementComponent<CommunitySearchResult,Community> {
private _dso: Community;
constructor(
private linkService: LinkService,
protected truncatableService: TruncatableService,
protected bitstreamDataService: BitstreamDataService
) {
super(truncatableService, bitstreamDataService);
}
@Input() set dso(dso: Community) {
this._dso = dso;
console.log('aaasdasd');
if (hasValue(this._dso) && hasNoValue(this._dso.logo)) {
this.linkService.resolveLink<Community>(this._dso, followLink('logo'));
}
}
get dso(): Community {
return this._dso;
}
}