copies suggestions over to newly create changeSet item. sorts compliance table by identifierField and maintains sort on re-render. removes the option to delete the sole tag for a compliance policy. restyles the last saved note on the compliance upper right corner

This commit is contained in:
Seyi Adebajo 2018-04-16 15:20:00 -07:00
parent d28762515a
commit dde6ff6fbe
8 changed files with 66 additions and 27 deletions

View File

@ -24,11 +24,13 @@ export default class DatasetComplianceRollupRow extends Component.extend({
}) {
/**
* References the parent external action to add a tag to the list of change sets
* @memberof DatasetComplianceRollupRow
*/
onFieldTagAdded: (tag: IComplianceChangeSet) => IComplianceChangeSet;
/**
* References the parent external action to add a tag to the list of change sets
* @memberof DatasetComplianceRollupRow
*/
onFieldTagRemoved: (tag: IComplianceChangeSet) => IComplianceChangeSet;
@ -233,15 +235,25 @@ export default class DatasetComplianceRollupRow extends Component.extend({
*/
@action
onAddFieldTag(this: DatasetComplianceRollupRow, { identifierType, logicalType }: Partial<IColumnFieldProps>) {
const { identifierField, dataType, onFieldTagAdded, fieldChangeSet } = getProperties(this, [
const { identifierField, dataType, onFieldTagAdded, fieldChangeSet, fieldProps } = getProperties(this, [
'identifierField',
'dataType',
'onFieldTagAdded',
'fieldChangeSet'
'fieldChangeSet',
'fieldProps'
]);
if (isFieldTagged(fieldChangeSet)) {
onFieldTagAdded(complianceFieldTagFactory({ identifierField, dataType, identifierType, logicalType }));
onFieldTagAdded(
complianceFieldTagFactory({
identifierField,
dataType,
identifierType,
logicalType,
suggestion: fieldProps.suggestion,
suggestionAuthority: fieldProps.suggestionAuthority
})
);
}
// expand row on click

View File

@ -30,7 +30,8 @@ import {
changeSetFieldsRequiringReview,
changeSetReviewableAttributeTriggers,
mapSchemaColumnPropsToCurrentPrivacyPolicy,
foldComplianceChangeSets
foldComplianceChangeSets,
sortFoldedChangeSetTuples
} from 'wherehows-web/constants';
import { isPolicyExpectedShape } from 'wherehows-web/utils/datasets/compliance-policy';
import scrollMonitor from 'scrollmonitor';
@ -703,7 +704,7 @@ export default class DatasetCompliance extends Component {
foldedChangeSet: ComputedProperty<Array<IdentifierFieldWithFieldChangeSetTuple>> = computed(
'filteredChangeSet',
function(this: DatasetCompliance): Array<IdentifierFieldWithFieldChangeSetTuple> {
return foldComplianceChangeSets(get(this, 'filteredChangeSet'));
return sortFoldedChangeSetTuples(foldComplianceChangeSets(get(this, 'filteredChangeSet')));
}
);

View File

@ -12,8 +12,7 @@ import {
IdentifierFieldWithFieldChangeSetTuple,
IIdentifierFieldWithFieldChangeSetObject,
ISchemaFieldsToPolicy,
ISchemaFieldsToSuggested,
SchemaFieldToPolicyValue
ISchemaFieldsToSuggested
} from 'wherehows-web/typings/app/dataset-compliance';
import {
IColumnFieldProps,
@ -377,18 +376,25 @@ const complianceFieldTagFactory = ({
identifierField,
dataType,
identifierType,
logicalType
}: IColumnFieldProps): SchemaFieldToPolicyValue => ({
identifierField,
dataType,
identifierType: identifierType || null,
logicalType: logicalType || null,
securityClassification: null,
nonOwner: null,
readonly: false,
privacyPolicyExists: false,
isDirty: true
});
logicalType,
suggestion,
suggestionAuthority
}: IColumnFieldProps): IComplianceChangeSet =>
Object.assign(
{
identifierField,
dataType,
identifierType: identifierType || null,
logicalType: logicalType || null,
securityClassification: null,
nonOwner: null,
readonly: false,
privacyPolicyExists: false,
isDirty: true
},
suggestion ? { suggestion } : void 0,
suggestionAuthority ? { suggestionAuthority } : void 0
);
/**
* Takes the current compliance entities, and mod time and returns a reducer that consumes a list of IColumnFieldProps
@ -422,6 +428,22 @@ const columnToPolicyReducingFn: ICompliancePolicyReducerFactory = (
};
};
/**
* Sorts a list of change set tuples by identifierField
* @param {Array<IdentifierFieldWithFieldChangeSetTuple>} tuples
* @return {Array<IdentifierFieldWithFieldChangeSetTuple>}
*/
const sortFoldedChangeSetTuples = (
tuples: Array<IdentifierFieldWithFieldChangeSetTuple>
): Array<IdentifierFieldWithFieldChangeSetTuple> => {
const tupleSortFn = (
[fieldNameA]: IdentifierFieldWithFieldChangeSetTuple,
[fieldNameB]: IdentifierFieldWithFieldChangeSetTuple
): number => fieldNameA.localeCompare(fieldNameB);
return tuples.sort(tupleSortFn);
};
export {
compliancePolicyStrings,
getFieldIdentifierOption,
@ -445,5 +467,6 @@ export {
changeSetReviewableAttributeTriggers,
mapSchemaColumnPropsToCurrentPrivacyPolicy,
foldComplianceChangeSets,
complianceFieldTagFactory
complianceFieldTagFactory,
sortFoldedChangeSetTuples
};

View File

@ -44,6 +44,7 @@
.policy-last-saved {
margin-left: auto;
text-align: right;
max-width: 300px;
&__saved {
font-weight: fw(normal, 6);

View File

@ -9,6 +9,7 @@
fieldProps=fieldProps
suggestion=suggestion
isReadonly=isReadonlyField
hasSingleTag=hasSingleTag
isReviewRequested=isReviewRequested
suggestionResolution=suggestionResolution
suggestionMatchesCurrentValue=suggestionMatchesCurrentValue

View File

@ -83,8 +83,9 @@
{{moment-from-now complianceInfo.modifiedTime}}
</span>
by
<span class="policy-last-saved__saved">
{{complianceInfo.modifiedBy}}
<span class="policy-last-saved__saved" title="{{complianceInfo.modifiedBy}}">
{{tooltip-on-element text=complianceInfo.modifiedBy}}
{{split-text complianceInfo.modifiedBy 30}}
</span>
{{/if}}
</div>

View File

@ -32,9 +32,7 @@
{{#dataset-table
class="dataset-compliance-fields"
fields=foldedChangeSet
sortColumnWithName=sortColumnWithName
filterBy=filterBy
sortDirection=sortDirection
tableRowComponent='dataset-compliance-rollup-row'
searchTerm=searchTerm as |table|
}}
@ -71,7 +69,7 @@
</tr>
{{#table.body as |body|}}
{{#each (sort-by table.sortBy table.data) as |field|}}
{{#each table.data as |field|}}
{{#body.row
field=field
isNewComplianceInfo=isNewComplianceInfo
@ -335,7 +333,7 @@
</td>
{{#row.cell}}
{{#if isEditing}}
{{#if (and isEditing (not row.hasSingleTag))}}
<button class="nacho-button nacho-button--tertiary dataset-compliance-fields__remove-tag"
onclick={{action row.onRemoveFieldTag tag}}>
&times;

View File

@ -1,6 +1,6 @@
import { IDatasetColumn } from 'wherehows-web/typings/api/datasets/columns';
import { IComplianceEntity, IComplianceInfo } from 'wherehows-web/typings/api/datasets/compliance';
import { ISchemaFieldsToPolicy } from 'wherehows-web/typings/app/dataset-compliance';
import { IComplianceChangeSet, ISchemaFieldsToPolicy } from 'wherehows-web/typings/app/dataset-compliance';
/**
* Defines the interface for keys extracted from the columns property on an response of IDatasetSchemaGetResponse
@ -11,6 +11,8 @@ interface IColumnFieldProps {
dataType: IDatasetColumn['dataType'];
identifierType?: IComplianceEntity['identifierType'];
logicalType?: IComplianceEntity['logicalType'];
suggestion?: IComplianceChangeSet['suggestion'];
suggestionAuthority?: IComplianceChangeSet['suggestionAuthority'];
}
/**