mark all as no

This commit is contained in:
Seyi Adebajo 2017-08-20 18:12:56 -07:00
parent b5b2b2b8ba
commit ef1c1df63b
3 changed files with 51 additions and 11 deletions

View File

@ -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);
},
/**

View File

@ -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;

View File

@ -90,13 +90,21 @@
</sup>
</a>
</p>
{{#if isEditing}}
<button
{{action "markDatasetAsNotContainingMemberData"}}
class="nacho-button--large nacho-button--secondary mark-dataset-no-button">
Mark all as No
</button>
{{/if}}
</header>
</section>
<table class="nacho-table nacho-table--bordered nacho-table--stripped">
<thead>
<tr>
<th>Types of Member Data</th>
<th>Types of member data</th>
<th class="dataset-field-content__header">
<span class="dataset-field-value">Is this type of member data contained in this dataset?</span>
</th>