From ef1c1df63b39758938f49c8b3150e74b224b7982 Mon Sep 17 00:00:00 2001 From: Seyi Adebajo Date: Sun, 20 Aug 2017 18:12:56 -0700 Subject: [PATCH] mark all as no --- .../app/components/dataset-compliance.js | 45 +++++++++++++++---- .../_compliance-prompts.scss | 7 ++- .../components/dataset-compliance.hbs | 10 ++++- 3 files changed, 51 insertions(+), 11 deletions(-) diff --git a/wherehows-web/app/components/dataset-compliance.js b/wherehows-web/app/components/dataset-compliance.js index d5a0cb81ca..a0964f2d3b 100644 --- a/wherehows-web/app/components/dataset-compliance.js +++ b/wherehows-web/app/components/dataset-compliance.js @@ -323,7 +323,7 @@ export default Component.extend({ datasetClassification: computed(`${datasetClassificationKey}.{${datasetClassifiersKeys.join(',')}}`, function() { const sourceDatasetClassification = get(this, datasetClassificationKey) || {}; - return Object.keys(datasetClassifiers).sort().reduce((classifiers, classifier) => { + return datasetClassifiersKeys.sort().reduce((classifiers, classifier) => { return [ ...classifiers, { @@ -615,7 +615,41 @@ export default Component.extend({ } }, + /** + * Gets a reference to the current dataset classification object + */ + getDatasetClassificationRef() { + let sourceDatasetClassification = getWithDefault(this, datasetClassificationKey, {}); + + // For datasets initially without a datasetClassification, the default value is null + if (sourceDatasetClassification === null) { + sourceDatasetClassification = set(this, datasetClassificationKey, {}); + } + + return sourceDatasetClassification; + }, + actions: { + /** + * Sets each datasetClassification value as false + */ + markDatasetAsNotContainingMemberData() { + const willMarkAllAsNo = confirm( + 'Are you sure that any this dataset does not contain any of the listed types of member data' + ); + + return ( + willMarkAllAsNo && + setProperties( + this.getDatasetClassificationRef(), + datasetClassifiersKeys.reduce( + (classification, classifier) => ({ ...classification, ...{ [classifier]: false } }), + {} + ) + ) + ); + }, + /** * Handle the user intent to place this compliance component in edit mode */ @@ -748,14 +782,7 @@ export default Component.extend({ * @return {*} */ onChangeDatasetClassification(classifier, value) { - let sourceDatasetClassification = getWithDefault(this, datasetClassificationKey, {}); - - // For datasets initially without a datasetClassification, the default value is null - if (sourceDatasetClassification === null) { - sourceDatasetClassification = set(this, datasetClassificationKey, {}); - } - - return set(sourceDatasetClassification, classifier, value); + return set(this.getDatasetClassificationRef(), classifier, value); }, /** diff --git a/wherehows-web/app/styles/components/dataset-compliance/_compliance-prompts.scss b/wherehows-web/app/styles/components/dataset-compliance/_compliance-prompts.scss index 428b42c584..3e878f4830 100644 --- a/wherehows-web/app/styles/components/dataset-compliance/_compliance-prompts.scss +++ b/wherehows-web/app/styles/components/dataset-compliance/_compliance-prompts.scss @@ -2,7 +2,7 @@ * Prompt for privacy compliance */ .metadata-prompt { - margin-top: 30px; + margin: 30px 0 20px; /** * Overrides default styles @@ -13,11 +13,16 @@ } &__header { + display: flex; font-size: 20px; font-weight: fw(normal, 4); } } +.mark-dataset-no-button { + margin-left: auto; +} + /// Wraps a status notification icon for a given dataset .dataset-tag-container { width: 20px; diff --git a/wherehows-web/app/templates/components/dataset-compliance.hbs b/wherehows-web/app/templates/components/dataset-compliance.hbs index e6bb34837b..f93387f81d 100644 --- a/wherehows-web/app/templates/components/dataset-compliance.hbs +++ b/wherehows-web/app/templates/components/dataset-compliance.hbs @@ -90,13 +90,21 @@

+ + {{#if isEditing}} + + {{/if}} - +
Types of Member DataTypes of member data Is this type of member data contained in this dataset?