import Ember from 'ember'; import { fieldIdentifierTypes } from 'wherehows-web/constants/datasets/compliance'; const { String: { htmlSafe } } = Ember; /** * Defines a map of values for the compliance policy on a dataset * @type {object} */ const compliancePolicyStrings = { // TODO: DSS-6122 Create and move to Error module complianceDataException: 'Unexpected discrepancy in compliance data', missingTypes: 'Looks like you may have forgotten to specify a `Field Format` for all ID fields?', successUpdating: 'Congrats! Your changes have been successfully saved!', failedUpdating: 'Oops! We are having trouble updating this dataset at the moment.', successUploading: 'Metadata successfully updated! Please "Save" when ready.', invalidPolicyData: 'Received policy in an unexpected format! Please check the provided attributes and try again.', helpText: { classification: 'The default value is taken from go/dht and should be good enough in most cases. ' + 'You can optionally override it if required by house security.' } }; /** * List of identifier type keys without the none object value * @type {Array} */ const fieldIdentifierTypeKeysBarNone: Array = Object.keys(fieldIdentifierTypes).filter(k => k !== 'none'); /** * Keys for the field display options * @type {Array} */ const fieldDisplayKeys: Array = ['none', '_', ...fieldIdentifierTypeKeysBarNone]; /** * A list of field identifier types mapped to label, value options for select display * @type {Array<{value: string, label: string, isDisabled: boolean}>} */ const fieldIdentifierOptions: Array<{ value: string; label: string; isDisabled: boolean; }> = fieldDisplayKeys.map(fieldIdentifierType => { const divider = '──────────'; const { value = fieldIdentifierType, displayAs: label = divider } = fieldIdentifierTypes[fieldIdentifierType] || {}; // Adds a divider for a value of _ // Visually this separates ID from none fieldIdentifierTypes return { value, label, isDisabled: fieldIdentifierType === '_' }; }); /** * Defines the html string for informing the user of hidden tracking fields * @type {Ember.String.htmlSafe} */ const hiddenTrackingFields = htmlSafe( '

Some fields in this dataset have been hidden from the table(s) below. ' + "These are tracking fields for which we've been able to predetermine the compliance classification.

" + '

For example: header.memberId, requestHeader. ' + 'Hopefully, this saves you some scrolling!

' ); /** * Defines the sequence of edit steps in the compliance policy component */ const complianceSteps = { 0: { name: 'editCompliancePolicy' }, 1: { name: 'editPurgePolicy' }, 2: { name: 'editDatasetClassification' } }; export { compliancePolicyStrings, fieldIdentifierOptions, complianceSteps, hiddenTrackingFields };