mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-29 19:46:00 +00:00
refactors compliance typings and constants module definitions/imports
This commit is contained in:
parent
8e2aa13ea9
commit
d20a54e88a
@ -1,9 +1,9 @@
|
||||
import Component from '@ember/component';
|
||||
import ComputedProperty from '@ember/object/computed';
|
||||
import { computed, getProperties } from '@ember/object';
|
||||
import { IComplianceChangeSet } from 'wherehows-web/components/dataset-compliance';
|
||||
import noop from 'wherehows-web/utils/noop';
|
||||
import { SuggestionIntent } from 'wherehows-web/constants';
|
||||
import { IComplianceChangeSet } from 'wherehows-web/typings/app/dataset-compliance';
|
||||
|
||||
/**
|
||||
* Describes the interface for the auto-suggest-action component
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { action } from 'ember-decorators/object';
|
||||
import { IComplianceChangeSet } from 'wherehows-web/components/dataset-compliance';
|
||||
import DatasetTableRow from 'wherehows-web/components/dataset-table-row';
|
||||
import ComputedProperty, { alias, bool } from '@ember/object/computed';
|
||||
import { computed, get, getProperties, getWithDefault } from '@ember/object';
|
||||
@ -8,9 +7,6 @@ import {
|
||||
ComplianceFieldIdValue,
|
||||
SuggestionIntent,
|
||||
getDefaultSecurityClassification,
|
||||
IComplianceFieldFormatOption,
|
||||
IComplianceFieldIdentifierOption,
|
||||
IDropDownOption,
|
||||
fieldChangeSetRequiresReview,
|
||||
isFieldIdType,
|
||||
changeSetReviewableAttributeTriggers,
|
||||
@ -21,6 +17,12 @@ import { getFieldSuggestions } from 'wherehows-web/utils/datasets/compliance-sug
|
||||
import noop from 'wherehows-web/utils/noop';
|
||||
import { hasEnumerableKeys } from 'wherehows-web/utils/object';
|
||||
import { IComplianceEntity } from 'wherehows-web/typings/api/datasets/compliance';
|
||||
import {
|
||||
IComplianceChangeSet,
|
||||
IComplianceFieldFormatOption,
|
||||
IComplianceFieldIdentifierOption,
|
||||
IDropDownOption
|
||||
} from 'wherehows-web/typings/app/dataset-compliance';
|
||||
|
||||
/**
|
||||
* Constant definition for an unselected field format
|
||||
|
@ -5,11 +5,10 @@ import { run, schedule, next } from '@ember/runloop';
|
||||
import { inject } from '@ember/service';
|
||||
import { classify } from '@ember/string';
|
||||
import { assert } from '@ember/debug';
|
||||
import { IDropDownOption, 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 { task, TaskInstance } from 'ember-concurrency';
|
||||
import {
|
||||
getSecurityClassificationDropDownOptions,
|
||||
DatasetClassifiers,
|
||||
@ -19,7 +18,6 @@ import {
|
||||
getComplianceSteps,
|
||||
isExempt,
|
||||
ComplianceFieldIdValue,
|
||||
IComplianceFieldIdentifierOption,
|
||||
IDatasetClassificationOption,
|
||||
DatasetClassification,
|
||||
SuggestionIntent,
|
||||
@ -47,75 +45,16 @@ import {
|
||||
ISuggestedFieldClassification,
|
||||
IComplianceSuggestion
|
||||
} from 'wherehows-web/typings/api/datasets/compliance';
|
||||
import { task, TaskInstance } from 'ember-concurrency';
|
||||
|
||||
/**
|
||||
* Describes the DatasetCompliance actions index signature to allow
|
||||
* access to actions using `did${editStepName}` accessors
|
||||
*/
|
||||
interface IDatasetComplianceActions {
|
||||
didEditCompliancePolicy: () => Promise<boolean>;
|
||||
didEditPurgePolicy: () => Promise<{} | void>;
|
||||
didEditDatasetLevelCompliancePolicy: () => Promise<void>;
|
||||
[K: string]: (...args: Array<any>) => any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias for the properties defined on an object indicating the values for a compliance entity object in
|
||||
* addition to related component metadata using in processing ui interactions / rendering for the field
|
||||
*/
|
||||
type SchemaFieldToPolicyValue = Pick<
|
||||
IComplianceEntity,
|
||||
'identifierField' | 'identifierType' | 'logicalType' | 'securityClassification' | 'nonOwner' | 'readonly'
|
||||
> & {
|
||||
// flag indicating that the field has a current policy upstream
|
||||
privacyPolicyExists: boolean;
|
||||
// flag indicating the field changeSet has been modified on the client
|
||||
isDirty: boolean;
|
||||
policyModificationTime: IComplianceInfo['modifiedTime'];
|
||||
dataType: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Describes the interface for a mapping of field names to type, SchemaFieldToPolicyValue
|
||||
* @interface ISchemaFieldsToPolicy
|
||||
*/
|
||||
export interface ISchemaFieldsToPolicy {
|
||||
[fieldName: string]: SchemaFieldToPolicyValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias for the properties on an object indicating the suggested values for field / record properties
|
||||
* as well as suggestions metadata
|
||||
*/
|
||||
type SchemaFieldToSuggestedValue = Pick<
|
||||
IComplianceEntity,
|
||||
'identifierType' | 'logicalType' | 'securityClassification'
|
||||
> &
|
||||
Pick<ISuggestedFieldClassification, 'confidenceLevel' | 'uid'> & {
|
||||
suggestionsModificationTime: IComplianceSuggestion['lastModified'];
|
||||
};
|
||||
|
||||
/**
|
||||
* Describes the mapping of attributes to value types for a datasets schema field names to suggested property values
|
||||
* @interface ISchemaFieldsToSuggested
|
||||
*/
|
||||
export interface ISchemaFieldsToSuggested {
|
||||
[fieldName: string]: SchemaFieldToSuggestedValue;
|
||||
}
|
||||
/**
|
||||
* Describes the interface for a locally assembled compliance field instance
|
||||
* used in rendering a compliance row
|
||||
*/
|
||||
export type IComplianceChangeSet = {
|
||||
suggestion?: SchemaFieldToSuggestedValue;
|
||||
suggestionAuthority?: SuggestionIntent;
|
||||
} & SchemaFieldToPolicyValue;
|
||||
|
||||
/**
|
||||
* Defines the applicable string values for compliance fields drop down filter
|
||||
*/
|
||||
type ShowAllShowReview = 'showReview' | 'showAll';
|
||||
import {
|
||||
IComplianceChangeSet,
|
||||
IComplianceFieldIdentifierOption,
|
||||
IDatasetComplianceActions,
|
||||
IDropDownOption,
|
||||
ISchemaFieldsToPolicy,
|
||||
ISchemaFieldsToSuggested,
|
||||
ISecurityClassificationOption,
|
||||
ShowAllShowReview
|
||||
} from 'wherehows-web/typings/app/dataset-compliance';
|
||||
|
||||
const {
|
||||
complianceDataException,
|
||||
|
@ -1,6 +1,7 @@
|
||||
import Component from '@ember/component';
|
||||
import { get, computed } from '@ember/object';
|
||||
import { getSecurityClassificationDropDownOptions, ISecurityClassificationOption } from 'wherehows-web/constants';
|
||||
import { ISecurityClassificationOption } from 'wherehows-web/typings/app/dataset-compliance';
|
||||
import { getSecurityClassificationDropDownOptions } from 'wherehows-web/constants';
|
||||
|
||||
export default class SchemalessTagging extends Component {
|
||||
classNames = ['schemaless-tagging'];
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { IDropDownOption } from 'wherehows-web/constants';
|
||||
|
||||
import { IDropDownOption } from 'wherehows-web/typings/app/dataset-compliance';
|
||||
/**
|
||||
* List of string values for every dataset classifier
|
||||
* @enum {string}
|
||||
|
@ -1,9 +1,3 @@
|
||||
import {
|
||||
IComplianceChangeSet,
|
||||
ISchemaFieldsToPolicy,
|
||||
ISchemaFieldsToSuggested
|
||||
} from 'wherehows-web/components/dataset-compliance';
|
||||
import { Classification, ComplianceFieldIdValue, IdLogicalType } from 'wherehows-web/constants/datasets/compliance';
|
||||
import { PurgePolicy } from 'wherehows-web/constants/index';
|
||||
import { IComplianceEntity, IComplianceInfo } from 'wherehows-web/typings/api/datasets/compliance';
|
||||
import { IComplianceDataType } from 'wherehows-web/typings/api/list/compliance-datatypes';
|
||||
@ -12,40 +6,12 @@ import { fleece } from 'wherehows-web/utils/object';
|
||||
import { lastSeenSuggestionInterval } from 'wherehows-web/constants/metadata-acquisition';
|
||||
import { pick } from 'lodash';
|
||||
import { decodeUrn } from 'wherehows-web/utils/validators/urn';
|
||||
|
||||
/**
|
||||
* Defines the generic interface field identifier drop downs
|
||||
* @interface IDropDownOption
|
||||
* @template T
|
||||
*/
|
||||
interface IDropDownOption<T> {
|
||||
value: T;
|
||||
label: string;
|
||||
isDisabled?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the interface for compliance data type field option
|
||||
* @interface IComplianceFieldIdentifierOption
|
||||
* @extends {IDropDownOption<ComplianceFieldIdValue>}
|
||||
*/
|
||||
interface IComplianceFieldIdentifierOption extends IDropDownOption<ComplianceFieldIdValue> {
|
||||
isId: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the interface for a compliance field format dropdown option
|
||||
* @interface IComplianceFieldFormatOption
|
||||
* @extends {(IDropDownOption<IdLogicalType | null>)}
|
||||
*/
|
||||
interface IComplianceFieldFormatOption extends IDropDownOption<IdLogicalType | null> {}
|
||||
|
||||
/**
|
||||
* Defines the interface for an each security classification dropdown option
|
||||
* @interface ISecurityClassificationOption
|
||||
* @extends {(IDropDownOption<Classification | null>)}
|
||||
*/
|
||||
interface ISecurityClassificationOption extends IDropDownOption<Classification | null> {}
|
||||
import {
|
||||
IComplianceChangeSet,
|
||||
IComplianceFieldIdentifierOption,
|
||||
ISchemaFieldsToPolicy,
|
||||
ISchemaFieldsToSuggested
|
||||
} from 'wherehows-web/typings/app/dataset-compliance';
|
||||
|
||||
/**
|
||||
* Defines a map of values for the compliance policy on a dataset
|
||||
@ -307,10 +273,6 @@ export {
|
||||
filterEditableEntities,
|
||||
isAutoGeneratedPolicy,
|
||||
removeReadonlyAttr,
|
||||
IComplianceFieldIdentifierOption,
|
||||
IComplianceFieldFormatOption,
|
||||
ISecurityClassificationOption,
|
||||
IDropDownOption,
|
||||
fieldChangeSetRequiresReview,
|
||||
isFieldIdType,
|
||||
mergeMappedColumnFieldsWithSuggestions,
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { IComplianceChangeSet } from 'wherehows-web/components/dataset-compliance';
|
||||
import { ISecurityClassificationOption } from 'wherehows-web/constants/dataset-compliance';
|
||||
import { Classification, ComplianceFieldIdValue } from 'wherehows-web/constants/datasets/compliance';
|
||||
import { IComplianceDataType } from 'wherehows-web/typings/api/list/compliance-datatypes';
|
||||
import { formatAsCapitalizedStringWithSpaces } from 'wherehows-web/utils/helpers/string';
|
||||
import { IComplianceChangeSet, ISecurityClassificationOption } from 'wherehows-web/typings/app/dataset-compliance';
|
||||
|
||||
/**
|
||||
* Length of time between suggestion modification time and last modified time for the compliance policy
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { IDropDownOption } from 'wherehows-web/constants/dataset-compliance';
|
||||
import { AccessControlAccessType } from 'wherehows-web/utils/datasets/acl-access';
|
||||
import { IDropDownOption } from 'wherehows-web/typings/app/dataset-compliance';
|
||||
|
||||
/**
|
||||
* Describes the interface for an AccessControlEntry object
|
||||
|
124
wherehows-web/app/typings/app/dataset-compliance.d.ts
vendored
Normal file
124
wherehows-web/app/typings/app/dataset-compliance.d.ts
vendored
Normal file
@ -0,0 +1,124 @@
|
||||
import {
|
||||
IComplianceEntity,
|
||||
IComplianceInfo,
|
||||
ISuggestedFieldClassification,
|
||||
IComplianceSuggestion
|
||||
} from 'wherehows-web/typings/api/datasets/compliance';
|
||||
import { SuggestionIntent } from 'wherehows-web/constants';
|
||||
import { Classification, ComplianceFieldIdValue, IdLogicalType } from 'wherehows-web/constants/datasets/compliance';
|
||||
|
||||
/**
|
||||
* Describes the DatasetCompliance actions index signature to allow
|
||||
* access to actions using `did${editStepName}` accessors
|
||||
*/
|
||||
interface IDatasetComplianceActions {
|
||||
didEditCompliancePolicy: () => Promise<boolean>;
|
||||
didEditPurgePolicy: () => Promise<{} | void>;
|
||||
didEditDatasetLevelCompliancePolicy: () => Promise<void>;
|
||||
[K: string]: (...args: Array<any>) => any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias for the properties defined on an object indicating the values for a compliance entity object in
|
||||
* addition to related component metadata using in processing ui interactions / rendering for the field
|
||||
*/
|
||||
type SchemaFieldToPolicyValue = Pick<
|
||||
IComplianceEntity,
|
||||
'identifierField' | 'identifierType' | 'logicalType' | 'securityClassification' | 'nonOwner' | 'readonly'
|
||||
> & {
|
||||
// flag indicating that the field has a current policy upstream
|
||||
privacyPolicyExists: boolean;
|
||||
// flag indicating the field changeSet has been modified on the client
|
||||
isDirty: boolean;
|
||||
policyModificationTime: IComplianceInfo['modifiedTime'];
|
||||
dataType: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Describes the interface for a mapping of field names to type, SchemaFieldToPolicyValue
|
||||
* @interface ISchemaFieldsToPolicy
|
||||
*/
|
||||
interface ISchemaFieldsToPolicy {
|
||||
[fieldName: string]: SchemaFieldToPolicyValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias for the properties on an object indicating the suggested values for field / record properties
|
||||
* as well as suggestions metadata
|
||||
*/
|
||||
type SchemaFieldToSuggestedValue = Pick<
|
||||
IComplianceEntity,
|
||||
'identifierType' | 'logicalType' | 'securityClassification'
|
||||
> &
|
||||
Pick<ISuggestedFieldClassification, 'confidenceLevel' | 'uid'> & {
|
||||
suggestionsModificationTime: IComplianceSuggestion['lastModified'];
|
||||
};
|
||||
|
||||
/**
|
||||
* Describes the mapping of attributes to value types for a datasets schema field names to suggested property values
|
||||
* @interface ISchemaFieldsToSuggested
|
||||
*/
|
||||
interface ISchemaFieldsToSuggested {
|
||||
[fieldName: string]: SchemaFieldToSuggestedValue;
|
||||
}
|
||||
/**
|
||||
* Describes the interface for a locally assembled compliance field instance
|
||||
* used in rendering a compliance row
|
||||
*/
|
||||
type IComplianceChangeSet = {
|
||||
suggestion?: SchemaFieldToSuggestedValue;
|
||||
suggestionAuthority?: SuggestionIntent;
|
||||
} & SchemaFieldToPolicyValue;
|
||||
|
||||
/**
|
||||
* Defines the generic interface field identifier drop downs
|
||||
* @interface IDropDownOption
|
||||
* @template T
|
||||
*/
|
||||
interface IDropDownOption<T> {
|
||||
value: T;
|
||||
label: string;
|
||||
isDisabled?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the interface for compliance data type field option
|
||||
* @interface IComplianceFieldIdentifierOption
|
||||
* @extends {IDropDownOption<ComplianceFieldIdValue>}
|
||||
*/
|
||||
interface IComplianceFieldIdentifierOption extends IDropDownOption<ComplianceFieldIdValue> {
|
||||
isId: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the interface for a compliance field format dropdown option
|
||||
* @interface IComplianceFieldFormatOption
|
||||
* @extends {(IDropDownOption<IdLogicalType | null>)}
|
||||
*/
|
||||
interface IComplianceFieldFormatOption extends IDropDownOption<IdLogicalType | null> {}
|
||||
|
||||
/**
|
||||
* Defines the interface for an each security classification dropdown option
|
||||
* @interface ISecurityClassificationOption
|
||||
* @extends {(IDropDownOption<Classification | null>)}
|
||||
*/
|
||||
interface ISecurityClassificationOption extends IDropDownOption<Classification | null> {}
|
||||
|
||||
/**
|
||||
* Defines the applicable string values for compliance fields drop down filter
|
||||
*/
|
||||
type ShowAllShowReview = 'showReview' | 'showAll';
|
||||
|
||||
export {
|
||||
IComplianceChangeSet,
|
||||
ShowAllShowReview,
|
||||
IDatasetComplianceActions,
|
||||
SchemaFieldToPolicyValue,
|
||||
ISchemaFieldsToPolicy,
|
||||
SchemaFieldToSuggestedValue,
|
||||
ISchemaFieldsToSuggested,
|
||||
IDropDownOption,
|
||||
IComplianceFieldIdentifierOption,
|
||||
IComplianceFieldFormatOption,
|
||||
ISecurityClassificationOption
|
||||
};
|
@ -1,6 +1,6 @@
|
||||
import { IComplianceChangeSet } from 'wherehows-web/components/dataset-compliance';
|
||||
import { lowQualitySuggestionConfidenceThreshold } from 'wherehows-web/constants';
|
||||
import { arrayMap } from 'wherehows-web/utils/array';
|
||||
import { IComplianceChangeSet } from 'wherehows-web/typings/app/dataset-compliance';
|
||||
|
||||
/**
|
||||
* Takes a list of suggestions with confidence values, and if the confidence is greater than
|
||||
|
Loading…
x
Reference in New Issue
Block a user