diff --git a/wherehows-web/app/components/more-info.ts b/wherehows-web/app/components/more-info.ts new file mode 100644 index 0000000000..deedfe505e --- /dev/null +++ b/wherehows-web/app/components/more-info.ts @@ -0,0 +1,41 @@ +import Component from '@ember/component'; + +export default class MoreInfo extends Component { + tagName = 'span'; + + classNames = ['more-info']; + + /** + * Proxies to anchor element target attribute + * @type {string} + * @memberOf MoreInfo + */ + target: string; + + /** + * Proxies to anchor element href attribute + * @type {string} + * @memberOf MoreInfo + */ + link: string; + + /** + * Renders the tool tip component, if present + * @type {string} + * @memberOf MoreInfo + */ + tooltip: string; + + constructor() { + super(...arguments); + + this.target || (this.target = '_blank'); + this.link || (this.link = '#'); + } + + /** + * Disables DOM event propagation + * @return {boolean} + */ + click = () => false; +} diff --git a/wherehows-web/app/templates/components/datasets/schemaless-tagging.hbs b/wherehows-web/app/templates/components/datasets/schemaless-tagging.hbs index 025cf349e6..6ce18cbd64 100644 --- a/wherehows-web/app/templates/components/datasets/schemaless-tagging.hbs +++ b/wherehows-web/app/templates/components/datasets/schemaless-tagging.hbs @@ -29,16 +29,10 @@

Dataset security classification - - - More Info - - - - + {{more-info + link="http://go/dht" + tooltip="information dataset security classification" + }}

diff --git a/wherehows-web/app/templates/components/more-info.hbs b/wherehows-web/app/templates/components/more-info.hbs new file mode 100644 index 0000000000..324c2f96ad --- /dev/null +++ b/wherehows-web/app/templates/components/more-info.hbs @@ -0,0 +1,14 @@ + + + {{#if tooltip}} + {{tooltip-on-element + text=tooltip + }} + {{/if}} + + More Info + + + + diff --git a/wherehows-web/app/templates/components/purge-policy.hbs b/wherehows-web/app/templates/components/purge-policy.hbs index 63bf025579..118457f2de 100644 --- a/wherehows-web/app/templates/components/purge-policy.hbs +++ b/wherehows-web/app/templates/components/purge-policy.hbs @@ -3,16 +3,10 @@

Compliance Purge Policy - - - More Info - - - - + {{more-info + link="http://go/gdpr/deletions/purgePolicies" + tooltip="more information Purge Policies" + }}

diff --git a/wherehows-web/app/templates/datasets/dataset-compliance/-dataset-classification.hbs b/wherehows-web/app/templates/datasets/dataset-compliance/-dataset-classification.hbs index 7f8b1a9753..2e88b8de71 100644 --- a/wherehows-web/app/templates/datasets/dataset-compliance/-dataset-classification.hbs +++ b/wherehows-web/app/templates/datasets/dataset-compliance/-dataset-classification.hbs @@ -5,18 +5,11 @@ "Does this dataset contain the following types of data?" "Types of data contained in this dataset"}} - - - - - More Info - - - + {{more-info + link="http://go/gdpr-taxonomy#MetadataTaxonomyforDataSets-DatasetLevelTags" + tooltip="more information on Dataset classification with examples" + }}

{{#if isEditing}} diff --git a/wherehows-web/app/templates/datasets/dataset-compliance/-dataset-compliance-entities.hbs b/wherehows-web/app/templates/datasets/dataset-compliance/-dataset-compliance-entities.hbs index e8804f1528..88b022d51a 100644 --- a/wherehows-web/app/templates/datasets/dataset-compliance/-dataset-compliance-entities.hbs +++ b/wherehows-web/app/templates/datasets/dataset-compliance/-dataset-compliance-entities.hbs @@ -4,16 +4,12 @@ {{if isEditing "Does any field in the schema contain an IDs (e.g. Member ID, Enterprise Profile ID etc) or other PII information?" "IDs and PII in the schema"}} - - - More Info - - - + {{more-info + link="http://go/gdpr-pii" + tooltip="more information on Schema field format and types" + }} +

@@ -45,7 +41,16 @@ {{#table.head as |head|}} {{#head.column class="dataset-compliance-fields__notification-column"}}{{/head.column}} - {{#head.column columnName="identifierField"}}Field{{/head.column}} + {{#head.column columnName="identifierField"}} + + Field + + {{more-info + link="http://go/tms-schema" + tooltip="more information on Schema" + }} + + {{/head.column}} {{#head.column columnName="dataType"}}Data Type{{/head.column}} {{#head.column class="nacho-table-cell-wrapped" columnName="confidence"}} System Suggestion Confidence @@ -151,16 +156,11 @@
Field Type - - - More Info - - - + {{more-info + link="http://go/metadata_acquisition#ProjectOverview-compliance" + tooltip="more information on various IDs" + }}
{{ember-selector @@ -178,16 +178,11 @@
Field Format - - - More Info - - - + {{more-info + link="http://go/metadata_acquisition#ProjectOverview-compliance" + tooltip="more information on Field Format" + }}
{{ember-selector diff --git a/wherehows-web/tests/integration/components/more-info-test.js b/wherehows-web/tests/integration/components/more-info-test.js new file mode 100644 index 0000000000..5d980e2ae2 --- /dev/null +++ b/wherehows-web/tests/integration/components/more-info-test.js @@ -0,0 +1,48 @@ +import { moduleForComponent, test } from 'ember-qunit'; +import hbs from 'htmlbars-inline-precompile'; +import { click } from 'ember-native-dom-helpers'; + +const elementQuery = '.more-info'; + +moduleForComponent('more-info', 'Integration | Component | more info', { + integration: true +}); + +test('it renders', function(assert) { + this.render(hbs`{{more-info}}`); + const element = document.querySelector(elementQuery); + + assert.ok(element, 'component is rendered in the DOM'); + assert.equal( + element.querySelector('a').getAttribute('target'), + '_blank', + 'sets the default target attribute when none is provided' + ); + assert.equal( + element.querySelector('a').getAttribute('href'), + '#', + 'it sets a default href attribute when none is provided' + ); +}); + +test('MoreInfo', function(assert) { + const externalUrl = 'https://www.linkedin.com'; + const target = '_self'; + + this.set('href', externalUrl); + this.set('target', target); + + this.render(hbs`{{more-info target=target link=href}}`); + const element = document.querySelector(elementQuery); + + assert.equal( + element.querySelector('a').getAttribute('target'), + target, + 'it sets the passed in target attribute when on is provided' + ); + assert.equal( + element.querySelector('a').getAttribute('href'), + externalUrl, + 'it sets the passed href attribute when a value is provided' + ); +});