diff --git a/wherehows-web/app/components/dataset-compliance.js b/wherehows-web/app/components/dataset-compliance.js index b39da3c0c0..a1cf7d1e3c 100644 --- a/wherehows-web/app/components/dataset-compliance.js +++ b/wherehows-web/app/components/dataset-compliance.js @@ -44,7 +44,8 @@ const { failedUpdating, helpText, successUploading, - invalidPolicyData + invalidPolicyData, + missingPurgePolicy } = compliancePolicyStrings; /** @@ -774,6 +775,14 @@ export default Component.extend({ }); }, + /** + * Notifies the user to provide a missing purge policy + * @return {Promise} + */ + needsPurgePolicyType() { + return Promise.reject(get(this, 'notifications').notify('error', { content: missingPurgePolicy })); + }, + /** * Updates the currently active step in the edit sequence * @param {number} step @@ -889,7 +898,13 @@ export default Component.extend({ * @return {void|Promise.} */ didEditPurgePolicy() { - if (isExempt(get(this, 'complianceInfo.complianceType'))) { + const { complianceType } = get(this, 'complianceInfo'); + + if (!complianceType) { + return this.needsPurgePolicyType(); + } + + if (isExempt(complianceType)) { return this.showPurgeExemptionWarning(); } }, diff --git a/wherehows-web/app/constants/dataset-compliance.ts b/wherehows-web/app/constants/dataset-compliance.ts index b6427707b4..73350fac90 100644 --- a/wherehows-web/app/constants/dataset-compliance.ts +++ b/wherehows-web/app/constants/dataset-compliance.ts @@ -54,7 +54,8 @@ const compliancePolicyStrings = { classification: 'This security classification is from go/dht and should be good enough in most cases. ' + 'You can optionally override it if required by house security.' - } + }, + missingPurgePolicy: 'Please specify a Compliance Purge Policy' }; /**