mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-11 18:56:41 +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
84 lines
2.7 KiB
TypeScript
84 lines
2.7 KiB
TypeScript
import { attribute } from '@ember-decorators/component';
|
|
import { computed } from '@ember/object';
|
|
import { reads } from '@ember/object/computed';
|
|
import { getAbsoluteUrl } from '@datahub/utils/helpers/url';
|
|
import DynamicLink from 'dynamic-link/components/dynamic-link';
|
|
|
|
/**
|
|
* Defines the AnalyticsTrackableLinkTo class
|
|
* Useful for automatically tracking the impressions and interactions of link content
|
|
* Tracking must be initialized by invoking `trackAllContentImpressions` activity on paq
|
|
* to track content
|
|
* @export
|
|
* @class AnalyticsTrackableLinkTo
|
|
* @extends {LinkComponent}
|
|
*/
|
|
export default class AnalyticsTrackableLinkTo extends DynamicLink {
|
|
/**
|
|
* External handler for click events raised on this component instance
|
|
*/
|
|
onClick?: (e: MouseEvent) => void;
|
|
|
|
/**
|
|
* Externally set attribute for grouping pieces of content.
|
|
* Specifies the data attribute data-content-name derived from the component attribute,
|
|
* contentName
|
|
*
|
|
* This defines the name of the content block to easily identify a specific block.
|
|
* A content name groups different content pieces together
|
|
* For instance, a content name could be "Product A", there could be many different content pieces
|
|
* to exactly know which content was displayed and interacted with
|
|
* @type {string}
|
|
*/
|
|
@attribute('data-content-name')
|
|
contentName?: string;
|
|
|
|
/**
|
|
* Externally set attribute for identifying this instance of content i.e. the actual content
|
|
* that was displayed
|
|
*
|
|
* Multiple content pieces can be grouped together in a content name
|
|
* @type {string}
|
|
*/
|
|
@attribute('data-content-piece')
|
|
contentPiece?: string;
|
|
|
|
/**
|
|
* Aliases the href property on the LinkComponent
|
|
* @type {string}
|
|
*/
|
|
@reads('href')
|
|
hrefAlias!: string;
|
|
|
|
/**
|
|
* Specifies the data attribute data-content-target defining the target from interacting with this content block.
|
|
* Useful to track the direction or path a user will take in navigating with this content
|
|
* @readonly
|
|
* @type {string}
|
|
*/
|
|
@attribute('data-content-target')
|
|
@computed('hrefAlias')
|
|
get contentTarget(): string {
|
|
return getAbsoluteUrl(this.hrefAlias);
|
|
}
|
|
|
|
/**
|
|
* This specifies the data attribute data-track-content which defines a content block.
|
|
* A content block is required for any content that is intended to be tracked
|
|
* This attribute does not require any value hence intentionally narrow type of empty string ''
|
|
* @type {''}
|
|
*/
|
|
@attribute('data-track-content')
|
|
readonly dataTrackContent: '' = '';
|
|
|
|
/**
|
|
* Invokes the the closure handler on click
|
|
* @param {MouseEvent} e DOM mouse click event
|
|
*/
|
|
click(e: MouseEvent): boolean {
|
|
this.onClick && this.onClick(e);
|
|
|
|
return super.click(e);
|
|
}
|
|
}
|