2018-04-12 14:39:22 -07:00
|
|
|
import Component from '@ember/component';
|
2019-08-31 20:51:14 -07:00
|
|
|
import { computed } from '@ember/object';
|
|
|
|
import { empty } from '@ember/object/computed';
|
2018-09-13 20:21:18 -07:00
|
|
|
import { classNames } from '@ember-decorators/component';
|
2020-08-26 15:44:50 -07:00
|
|
|
import { OwnerWithAvatarRecord } from 'datahub-web/typings/app/datasets/owners';
|
2018-04-12 14:39:22 -07:00
|
|
|
|
2018-09-13 20:21:18 -07:00
|
|
|
@classNames('dataset-authors-suggested')
|
2018-04-12 14:39:22 -07:00
|
|
|
export default class DatasetsOwnersSuggestedOwners extends Component {
|
|
|
|
/**
|
|
|
|
* Whether or not the component is expanded. If not, users will only see the initial header information
|
|
|
|
* whereas if expanded then users will see the list of all suggested owners
|
|
|
|
* @type {boolean}
|
|
|
|
*/
|
|
|
|
isExpanded = false;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Passed in value from parent component, `dataset-authors`, a.k.a. systemGeneratedOwners, this list
|
|
|
|
* represents a possible list of owners provided by scanning various systems.
|
2018-09-13 20:21:18 -07:00
|
|
|
* @type {Array<OwnerWithAvatarRecord>}
|
2018-04-12 14:39:22 -07:00
|
|
|
* @default []
|
|
|
|
*/
|
2019-08-31 20:51:14 -07:00
|
|
|
owners: Array<OwnerWithAvatarRecord> = [];
|
2018-04-12 14:39:22 -07:00
|
|
|
|
2018-08-12 13:02:01 -07:00
|
|
|
/**
|
|
|
|
* Computed based on the owners array, detects whether this array is empty or not
|
|
|
|
* @type {ComputedProperty<boolean>}
|
|
|
|
*/
|
|
|
|
@empty('owners')
|
|
|
|
isEmpty: boolean;
|
|
|
|
|
2018-04-12 14:39:22 -07:00
|
|
|
/**
|
|
|
|
* For the facepile in the suggestions window header, we do not need tos how all the faces of all the
|
|
|
|
* possible owners as this could be a large amount. Take only up to the first four to pass into the
|
|
|
|
* template for rendering
|
2018-09-13 20:21:18 -07:00
|
|
|
* @type {ComputedProperty<Array<OwnerWithAvatarRecord>>}
|
2018-04-12 14:39:22 -07:00
|
|
|
*/
|
2018-08-12 13:02:01 -07:00
|
|
|
@computed('owners')
|
2019-08-31 20:51:14 -07:00
|
|
|
get facepileOwners(): Array<OwnerWithAvatarRecord> {
|
2018-09-13 20:21:18 -07:00
|
|
|
return this.owners.slice(0, 4);
|
2018-08-12 13:02:01 -07:00
|
|
|
}
|
2018-04-12 14:39:22 -07:00
|
|
|
}
|