mirror of
https://github.com/datahub-project/datahub.git
synced 2026-01-07 15:27:05 +00:00
Merge pull request #941 from theseyi/schemaless-misc
adds changes for sec classification. updates node build version. fixes related issues
This commit is contained in:
commit
618618a325
@ -2,7 +2,7 @@ apply plugin: "com.moowork.node"
|
||||
|
||||
node {
|
||||
// Version of node to use.
|
||||
version = '8.9.1'
|
||||
version = '8.9.4'
|
||||
|
||||
// Base URL for fetching node distributions (change if you have a mirror).
|
||||
distBaseUrl = 'https://nodejs.org/dist'
|
||||
@ -51,4 +51,5 @@ clean {
|
||||
delete 'node_modules'
|
||||
delete 'bower_components'
|
||||
delete 'dist'
|
||||
delete 'tmp'
|
||||
}
|
||||
|
||||
@ -4,15 +4,14 @@ import ComputedProperty, { gt, not, or } from '@ember/object/computed';
|
||||
import { run, schedule } from '@ember/runloop';
|
||||
import { inject } from '@ember/service';
|
||||
import { classify } from '@ember/string';
|
||||
import { IFieldIdentifierOption } from 'wherehows-web/constants/dataset-compliance';
|
||||
import { Classification } from 'wherehows-web/constants/datasets/compliance';
|
||||
import { IFieldIdentifierOption, ISecurityClassificationOption } from 'wherehows-web/constants/dataset-compliance';
|
||||
import { IDatasetView } from 'wherehows-web/typings/api/datasets/dataset';
|
||||
import { IDataPlatform } from 'wherehows-web/typings/api/list/platforms';
|
||||
import { readPlatforms } from 'wherehows-web/utils/api/list/platforms';
|
||||
|
||||
import isTrackingHeaderField from 'wherehows-web/utils/validators/tracking-headers';
|
||||
import {
|
||||
securityClassificationDropdownOptions,
|
||||
getSecurityClassificationDropDownOptions,
|
||||
DatasetClassifiers,
|
||||
getFieldIdentifierOptions,
|
||||
getDefaultSecurityClassification,
|
||||
@ -125,7 +124,7 @@ const {
|
||||
successUploading,
|
||||
invalidPolicyData,
|
||||
missingPurgePolicy,
|
||||
defaultDatasetClassificationMsg
|
||||
missingDatasetSecurityClassification
|
||||
} = compliancePolicyStrings;
|
||||
|
||||
/**
|
||||
@ -248,7 +247,7 @@ export default class DatasetCompliance extends ObservableDecorator {
|
||||
complianceDataTypes: Array<IComplianceDataType>;
|
||||
|
||||
// Map of classifiers options for drop down
|
||||
classifiers = securityClassificationDropdownOptions;
|
||||
classifiers: Array<ISecurityClassificationOption> = getSecurityClassificationDropDownOptions();
|
||||
|
||||
/**
|
||||
* Default to show all fields to review
|
||||
@ -1152,11 +1151,6 @@ export default class DatasetCompliance extends ObservableDecorator {
|
||||
|
||||
if (complianceInfo) {
|
||||
const { confidentiality, containingPersonalData } = complianceInfo;
|
||||
const dialogActions: { [prop: string]: () => void } = {};
|
||||
const confirmConfidentialityPromise = new Promise((resolve, reject) => {
|
||||
dialogActions['didConfirm'] = () => resolve();
|
||||
dialogActions['didDismiss'] = () => reject();
|
||||
});
|
||||
|
||||
// defaults the containing personal data flag to false if undefined
|
||||
if (typeof containingPersonalData === 'undefined') {
|
||||
@ -1164,13 +1158,11 @@ export default class DatasetCompliance extends ObservableDecorator {
|
||||
}
|
||||
|
||||
if (!confidentiality) {
|
||||
get(this, 'notifications').notify(NotificationEvent.confirm, {
|
||||
dialogActions,
|
||||
header: 'Confirm dataset classification',
|
||||
content: defaultDatasetClassificationMsg
|
||||
get(this, 'notifications').notify(NotificationEvent.error, {
|
||||
content: missingDatasetSecurityClassification
|
||||
});
|
||||
await confirmConfidentialityPromise;
|
||||
set(complianceInfo, 'confidentiality', Classification.Internal);
|
||||
|
||||
return Promise.reject(new Error(missingDatasetSecurityClassification));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import Component from '@ember/component';
|
||||
import { get } from '@ember/object';
|
||||
import { ISecurityClassificationOption, securityClassificationDropdownOptions } from 'wherehows-web/constants';
|
||||
import { get, computed } from '@ember/object';
|
||||
import { getSecurityClassificationDropDownOptions, ISecurityClassificationOption } from 'wherehows-web/constants';
|
||||
|
||||
export default class SchemalessTagging extends Component {
|
||||
classNames = ['schemaless-tagging'];
|
||||
@ -31,7 +31,11 @@ export default class SchemalessTagging extends Component {
|
||||
* @type {Array<ISecurityClassificationOption>}
|
||||
* @memberof SchemalessTagging
|
||||
*/
|
||||
classifiers: Array<ISecurityClassificationOption> = securityClassificationDropdownOptions;
|
||||
classifiers = computed('containsPersonalData', function(
|
||||
this: SchemalessTagging
|
||||
): Array<ISecurityClassificationOption> {
|
||||
return getSecurityClassificationDropDownOptions(get(this, 'containsPersonalData'));
|
||||
});
|
||||
|
||||
/**
|
||||
* Flag indicating if this component should be in edit mode or readonly
|
||||
@ -54,6 +58,10 @@ export default class SchemalessTagging extends Component {
|
||||
* @returns boolean
|
||||
*/
|
||||
onPersonalDataToggle(this: SchemalessTagging, containsPersonalDataTag: boolean) {
|
||||
if (containsPersonalDataTag) {
|
||||
this.actions.onSecurityClassificationChange.call(this, { value: null });
|
||||
}
|
||||
|
||||
return get(this, 'onPersonalDataChange')(containsPersonalDataTag);
|
||||
},
|
||||
|
||||
@ -62,7 +70,10 @@ export default class SchemalessTagging extends Component {
|
||||
* @param {ISecurityClassificationOption} { value } security Classification value for the dataset
|
||||
* @returns null | Classification
|
||||
*/
|
||||
onSecurityClassificationChange(this: SchemalessTagging, { value }: ISecurityClassificationOption) {
|
||||
onSecurityClassificationChange(
|
||||
this: SchemalessTagging,
|
||||
{ value }: { value: ISecurityClassificationOption['value'] }
|
||||
) {
|
||||
const securityClassification = value || null;
|
||||
return get(this, 'onClassificationChange')(securityClassification);
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ const { String: { htmlSafe } } = Ember;
|
||||
/**
|
||||
* Defines the generic interface field identifier drop downs
|
||||
* @interface IFieldIdentifierOption
|
||||
* @template T
|
||||
* @template T
|
||||
*/
|
||||
interface IFieldIdentifierOption<T> {
|
||||
value: T;
|
||||
@ -56,13 +56,12 @@ const compliancePolicyStrings = {
|
||||
'You can optionally override it if required by house security.'
|
||||
},
|
||||
missingPurgePolicy: 'Please specify a Compliance Purge Policy',
|
||||
defaultDatasetClassificationMsg: `You haven't set this dataset's security classification,
|
||||
it's value will be set to default of "${Classification.Internal}"`
|
||||
missingDatasetSecurityClassification: 'Please specify a security classification for this dataset.'
|
||||
};
|
||||
|
||||
/**
|
||||
* Takes a compliance data type and transforms it into a compliance field identifier option
|
||||
* @param {IComplianceDataType} complianceDataType
|
||||
* @param {IComplianceDataType} complianceDataType
|
||||
* @returns {IComplianceFieldIdentifierOption}
|
||||
*/
|
||||
const getFieldIdentifierOption = (complianceDataType: IComplianceDataType): IComplianceFieldIdentifierOption => {
|
||||
|
||||
@ -22,7 +22,19 @@ const lowQualitySuggestionConfidenceThreshold = 0.5;
|
||||
* Stores a unique list of classification values
|
||||
* @type {Array<Classification>} the list of classification values
|
||||
*/
|
||||
const classifiers = Object.values(Classification);
|
||||
const classifiers = [
|
||||
Classification.HighlyConfidential,
|
||||
Classification.Confidential,
|
||||
Classification.LimitedDistribution,
|
||||
Classification.Internal,
|
||||
Classification.Public
|
||||
];
|
||||
|
||||
/**
|
||||
* Lists the dataset security classification options that are exluded for datasets containing PII
|
||||
* @type {Classification[]}
|
||||
*/
|
||||
const classifiersExcludedIfPII = [Classification.Internal, Classification.Public];
|
||||
|
||||
/**
|
||||
* Takes a string, returns a formatted string. Niche , single use case
|
||||
@ -32,17 +44,17 @@ const classifiers = Object.values(Classification);
|
||||
const formatAsCapitalizedStringWithSpaces = (string: string) => capitalize(string.toLowerCase().replace(/[_]/g, ' '));
|
||||
|
||||
/**
|
||||
* A derived list of security classification options from classifiers list, including an empty string option and value
|
||||
* @type {Array<ISecurityClassificationOption>}
|
||||
* Derives the list of security classification options from the list of classifiers and disables options if
|
||||
* the containsPii argument is truthy. Includes a disabled placeholder option: Unspecified
|
||||
* @param {boolean = false} containsPii flag indicating if the dataset contains Pii
|
||||
* @return {Array<ISecurityClassificationOption>}
|
||||
*/
|
||||
const securityClassificationDropdownOptions: Array<ISecurityClassificationOption> = [
|
||||
null,
|
||||
...classifiers.sort()
|
||||
].map((value: ISecurityClassificationOption['value']) => ({
|
||||
value,
|
||||
label: value ? formatAsCapitalizedStringWithSpaces(value) : 'Unspecified',
|
||||
isDisabled: !value
|
||||
}));
|
||||
const getSecurityClassificationDropDownOptions = (containsPii: boolean = false): Array<ISecurityClassificationOption> =>
|
||||
[null, ...classifiers].map((value: ISecurityClassificationOption['value']) => ({
|
||||
value,
|
||||
label: value ? formatAsCapitalizedStringWithSpaces(value) : 'Unspecified',
|
||||
isDisabled: !value || (containsPii && classifiersExcludedIfPII.includes(value))
|
||||
}));
|
||||
|
||||
/**
|
||||
* Checks if the identifierType is a mixed Id
|
||||
@ -81,7 +93,7 @@ const getDefaultSecurityClassification = (
|
||||
};
|
||||
|
||||
export {
|
||||
securityClassificationDropdownOptions,
|
||||
getSecurityClassificationDropDownOptions,
|
||||
formatAsCapitalizedStringWithSpaces,
|
||||
fieldIdentifierTypeValues,
|
||||
isMixedId,
|
||||
|
||||
@ -28,6 +28,17 @@
|
||||
<div class="schemaless-tagging__tag">
|
||||
<h4 class="schemaless-tagging__prompt">
|
||||
Dataset security classification
|
||||
|
||||
<a
|
||||
target="_blank"
|
||||
href="http://go/dht">
|
||||
<sup>
|
||||
More Info
|
||||
|
||||
<span class="glyphicon glyphicon-question-sign"
|
||||
title="More information dataset security classification"></span>
|
||||
</sup>
|
||||
</a>
|
||||
</h4>
|
||||
|
||||
<div class="schemaless-tagging__input">
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
"ember-cli": "~2.18.0",
|
||||
"ember-cli-app-version": "^3.0.0",
|
||||
"ember-cli-babel": "^6.6.0",
|
||||
"ember-cli-bootstrap-sassy": "^0.5.6",
|
||||
"ember-cli-bootstrap-sassy": "^0.5.8",
|
||||
"ember-cli-code-coverage": "theseyi/ember-cli-code-coverage",
|
||||
"ember-cli-dependency-checker": "^2.0.0",
|
||||
"ember-cli-eslint": "^4.2.1",
|
||||
|
||||
@ -80,13 +80,14 @@ test('it invokes the onPersonalDataChange external action on when toggled', func
|
||||
|
||||
this.set('isEditable', true);
|
||||
this.set('containsPersonalData', false);
|
||||
this.set('onClassificationChange', () => {});
|
||||
this.set('onPersonalDataChange', containsPersonalData => {
|
||||
assert.equal(++onPersonalDataChangeCallCount, 1, 'successfully invokes the external action');
|
||||
assert.ok(containsPersonalData, 'flag value is truthy');
|
||||
});
|
||||
|
||||
this.render(
|
||||
hbs`{{datasets/schemaless-tagging isEditable=isEditable onPersonalDataChange=onPersonalDataChange containsPersonalData=containsPersonalData}}`
|
||||
hbs`{{datasets/schemaless-tagging isEditable=isEditable onPersonalDataChange=onPersonalDataChange onClassificationChange=onClassificationChange containsPersonalData=containsPersonalData}}`
|
||||
);
|
||||
|
||||
assert.equal(onPersonalDataChangeCallCount, 0, 'external action is not invoked on instantiation');
|
||||
|
||||
@ -2578,7 +2578,7 @@ debug@^3.0.1, debug@^3.1.0:
|
||||
dependencies:
|
||||
ms "2.0.0"
|
||||
|
||||
debuglog@*, debuglog@^1.0.1:
|
||||
debuglog@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492"
|
||||
|
||||
@ -2846,9 +2846,9 @@ ember-cli-babel@^6.0.0, ember-cli-babel@^6.0.0-beta.4, ember-cli-babel@^6.0.0-be
|
||||
ember-cli-version-checker "^2.1.0"
|
||||
semver "^5.4.1"
|
||||
|
||||
ember-cli-bootstrap-sassy@^0.5.6:
|
||||
version "0.5.7"
|
||||
resolved "https://registry.yarnpkg.com/ember-cli-bootstrap-sassy/-/ember-cli-bootstrap-sassy-0.5.7.tgz#8cb3b484c6a81cb3987f5a2207c453a30f206e2d"
|
||||
ember-cli-bootstrap-sassy@^0.5.8:
|
||||
version "0.5.8"
|
||||
resolved "https://registry.yarnpkg.com/ember-cli-bootstrap-sassy/-/ember-cli-bootstrap-sassy-0.5.8.tgz#9bb6d4c3f7f8a634fc51b0f2a29983d82e88b404"
|
||||
dependencies:
|
||||
bootstrap-sass "^3.0.0"
|
||||
broccoli-funnel "^1.2.0"
|
||||
@ -5099,7 +5099,7 @@ ignore@^3.3.3:
|
||||
version "3.3.7"
|
||||
resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.7.tgz#612289bfb3c220e186a58118618d5be8c1bab021"
|
||||
|
||||
imurmurhash@*, imurmurhash@^0.1.4:
|
||||
imurmurhash@^0.1.4:
|
||||
version "0.1.4"
|
||||
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
|
||||
|
||||
@ -5966,10 +5966,6 @@ lodash._baseflatten@^3.0.0:
|
||||
lodash.isarguments "^3.0.0"
|
||||
lodash.isarray "^3.0.0"
|
||||
|
||||
lodash._baseindexof@*:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c"
|
||||
|
||||
lodash._basetostring@^3.0.0:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/lodash._basetostring/-/lodash._basetostring-3.0.1.tgz#d1861d877f824a52f669832dcaf3ee15566a07d5"
|
||||
@ -5985,14 +5981,10 @@ lodash._basevalues@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash._basevalues/-/lodash._basevalues-3.0.0.tgz#5b775762802bde3d3297503e26300820fdf661b7"
|
||||
|
||||
lodash._bindcallback@*, lodash._bindcallback@^3.0.0:
|
||||
lodash._bindcallback@^3.0.0:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e"
|
||||
|
||||
lodash._cacheindexof@*:
|
||||
version "3.0.2"
|
||||
resolved "https://registry.yarnpkg.com/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92"
|
||||
|
||||
lodash._createassigner@^3.0.0:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/lodash._createassigner/-/lodash._createassigner-3.1.1.tgz#838a5bae2fdaca63ac22dee8e19fa4e6d6970b11"
|
||||
@ -6001,12 +5993,6 @@ lodash._createassigner@^3.0.0:
|
||||
lodash._isiterateecall "^3.0.0"
|
||||
lodash.restparam "^3.0.0"
|
||||
|
||||
lodash._createcache@*:
|
||||
version "3.1.2"
|
||||
resolved "https://registry.yarnpkg.com/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093"
|
||||
dependencies:
|
||||
lodash._getnative "^3.0.0"
|
||||
|
||||
lodash._createset@~4.0.0:
|
||||
version "4.0.3"
|
||||
resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26"
|
||||
@ -6029,7 +6015,7 @@ lodash._escapestringchar@~2.3.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash._escapestringchar/-/lodash._escapestringchar-2.3.0.tgz#cce73ae60fc6da55d2bf8a0679c23ca2bab149fc"
|
||||
|
||||
lodash._getnative@*, lodash._getnative@^3.0.0:
|
||||
lodash._getnative@^3.0.0:
|
||||
version "3.9.1"
|
||||
resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5"
|
||||
|
||||
@ -6248,7 +6234,7 @@ lodash.omit@^4.1.0:
|
||||
version "4.5.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash.omit/-/lodash.omit-4.5.0.tgz#6eb19ae5a1ee1dd9df0b969e66ce0b7fa30b5e60"
|
||||
|
||||
lodash.restparam@*, lodash.restparam@^3.0.0:
|
||||
lodash.restparam@^3.0.0:
|
||||
version "3.6.1"
|
||||
resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805"
|
||||
|
||||
@ -7756,7 +7742,7 @@ readable-stream@~2.2.3:
|
||||
string_decoder "~1.0.0"
|
||||
util-deprecate "~1.0.1"
|
||||
|
||||
readdir-scoped-modules@*, readdir-scoped-modules@^1.0.0:
|
||||
readdir-scoped-modules@^1.0.0:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.0.2.tgz#9fafa37d286be5d92cbaebdee030dc9b5f406747"
|
||||
dependencies:
|
||||
@ -9328,7 +9314,7 @@ uuid@~3.0.1:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1"
|
||||
|
||||
validate-npm-package-license@*, validate-npm-package-license@^3.0.1:
|
||||
validate-npm-package-license@^3.0.1:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz#2804babe712ad3379459acfbe24746ab2c303fbc"
|
||||
dependencies:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user