mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-11 10:46:52 +00:00

* Releases updated version of datahub-web client UI code * Fix typo in yarn lock * Change yarn lock to match yarn registry directories * Previous commit missed some paths * Even more changes to yarnlock missing in previous commit * Include codegen file for typings * Add files to get parity for datahub-web and current OS datahub-midtier * Add in typo fix from previous commit - change to proper license * Implement proper OS fix for person entity picture url * Workarounds for open source DH issues * Fixes institutional memory api and removes unopensourced tabs for datasets * Fixes search dataset deprecation and user search issue as a result of changes * Remove internal only options in the avatar menu
51 lines
1.8 KiB
TypeScript
51 lines
1.8 KiB
TypeScript
import Component from '@ember/component';
|
|
// @ts-ignore: Ignore import of compiled template
|
|
import template from '../../templates/components/link/optional-value';
|
|
import { layout, tagName } from '@ember-decorators/component';
|
|
import { IDynamicLinkNode } from '@datahub/utils/types/vendor/dynamic-link';
|
|
import { computed } from '@ember/object';
|
|
|
|
/**
|
|
* Default class for the embedded anchor component
|
|
*/
|
|
export const defaultAnchorClass = 'optional-value-link';
|
|
|
|
/**
|
|
* Defines the Link::OptionalValue component, which provides a way to render an anchor element
|
|
* if the supplied value has a `route` attribute and conforms to the IDynamicLinkNode interface
|
|
* However, if this `route` attribute is not present the value is rendered as-is
|
|
* Since the eventual component is an anchor element, this is rendered as a tagless component
|
|
* @export
|
|
* @class LinkOptionalValue
|
|
* @extends {Component}
|
|
* @template M the DynamicLink model type
|
|
* @template R the DynamicLink route type
|
|
* @template QP the query parameters for the DynamicLink
|
|
*/
|
|
@tagName('')
|
|
@layout(template)
|
|
export default class LinkOptionalValue<M, R, QP> extends Component {
|
|
/**
|
|
* The DynamicLink component parameters used in generating the properties for the anchor element
|
|
* or the value to be rendered as a string in the DOM
|
|
*/
|
|
value: string | IDynamicLinkNode<M, R, QP> = '';
|
|
|
|
/**
|
|
* Optionally overridden CSS class selector for the anchor element
|
|
*/
|
|
linkClass = defaultAnchorClass;
|
|
|
|
/**
|
|
* Will standarize the input of models to an array of strings
|
|
*
|
|
* @readonly
|
|
*/
|
|
@computed('value.model')
|
|
get models(): Array<M> {
|
|
const models = typeof this.value !== 'string' ? this.value.model : [];
|
|
const modelsArray = Array.isArray(models) ? models : (models && [models]) || [];
|
|
return modelsArray;
|
|
}
|
|
}
|