mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-01 11:19:05 +00:00
Code cleanup for refactoring dataset compliance entities
This commit is contained in:
parent
dc456343ca
commit
e1efafca52
@ -4,14 +4,14 @@ import { set } from '@ember/object';
|
||||
import { noop } from 'wherehows-web/utils/helpers/functions';
|
||||
import { ComplianceEdit, TagFilter, ComplianceFieldIdValue } from 'wherehows-web/constants';
|
||||
import { htmlSafe } from '@ember/string';
|
||||
import { IComplianceChangeSet } from 'wherehows-web/typings/app/dataset-compliance';
|
||||
import { IComplianceChangeSet, IDropDownOption } from 'wherehows-web/typings/app/dataset-compliance';
|
||||
import { TrackableEventCategory, trackableEvent } from 'wherehows-web/constants/analytics/event-tracking';
|
||||
|
||||
/**
|
||||
* The ComplianceSchemaEntities component allows the user to individually tag fields to annotate the
|
||||
* The DatasetComplianceEntities component allows the user to individually tag fields to annotate the
|
||||
* data contained in the dataset schema, found in the Compliance tab for datasets.
|
||||
*/
|
||||
export default class ComplianceSchemaEntities extends Component.extend({}) {
|
||||
export default class DatasetComplianceEntities extends Component.extend({}) {
|
||||
/**
|
||||
* Passed in flag determining whether or not we are in an editing mode for the schema entities.
|
||||
* @type {boolean}
|
||||
@ -27,25 +27,24 @@ export default class ComplianceSchemaEntities extends Component.extend({}) {
|
||||
/**
|
||||
* Passed in action/method from parent, updates the editing mode and corresponding target
|
||||
*/
|
||||
toggleEditing: (e: boolean, target?: ComplianceEdit) => void;
|
||||
toggleEditing: (isEditing: boolean, target?: ComplianceEdit) => void;
|
||||
|
||||
/**
|
||||
* Passed in action from parent, updates showGuidedEditMode state on parent
|
||||
*/
|
||||
// Note: [REFACTOR-COMPLIANCE] This passed in function is to maintain status quo while we migrate the
|
||||
// refactor logic and should eventually no longer be required
|
||||
showGuidedEditMode: (b: boolean) => void;
|
||||
showGuidedEditMode: (isShowingGuidedEditMode: boolean) => void;
|
||||
|
||||
/**
|
||||
* Passed in action from parent, updates fieldReviewOption state on parent
|
||||
*/
|
||||
// Note: [REFACTOR-COMPLIANCE] Same as above showGuidedEditMode
|
||||
fieldReviewChange: (o: { value: TagFilter }) => TagFilter;
|
||||
fieldReviewChange: (o: { value: TagFilter }) => IDropDownOption<TagFilter>;
|
||||
|
||||
/**
|
||||
* Specifies the filter to be applied on the list of fields shown in the compliance policy table
|
||||
* @type {TagFilter}
|
||||
* @memberof DatasetCompliance
|
||||
*/
|
||||
// Note: [REFACTOR-COMPLIANCE] This value will currently be passed in from the parent but should
|
||||
// eventually live only on this component
|
||||
@ -80,16 +79,16 @@ export default class ComplianceSchemaEntities extends Component.extend({}) {
|
||||
* Flag indicating the current compliance policy edit-view mode. Guided edit mode allows users
|
||||
* to go through a wizard to edit the schema entities while the other method is direct JSON editing
|
||||
* @type {boolean}
|
||||
* @memberof ComplianceSchemaEntities
|
||||
* @memberof DatasetComplianceEntities
|
||||
*/
|
||||
showGuidedComplianceEditMode = true;
|
||||
|
||||
/**
|
||||
* A list of ui values and labels for review filter drop-down
|
||||
* @type {Array<{value: TagFilter, label:string}>}
|
||||
* @memberof ComplianceSchemaEntities
|
||||
* @memberof DatasetComplianceEntities
|
||||
*/
|
||||
fieldReviewOptions: Array<{ value: ComplianceSchemaEntities['fieldReviewOption']; label: string }> = [
|
||||
fieldReviewOptions: Array<IDropDownOption<DatasetComplianceEntities['fieldReviewOption']>> = [
|
||||
{ value: TagFilter.showAll, label: ' Show all fields' },
|
||||
{ value: TagFilter.showReview, label: '? Show fields missing a data type' },
|
||||
{ value: TagFilter.showSuggested, label: '! Show fields that need review' },
|
||||
@ -112,7 +111,7 @@ export default class ComplianceSchemaEntities extends Component.extend({}) {
|
||||
* @param {boolean} toggle flag ,if true, show guided edit mode, otherwise, advanced
|
||||
*/
|
||||
@action
|
||||
onShowGuidedEditMode(this: ComplianceSchemaEntities, toggle: boolean): void {
|
||||
onShowGuidedEditMode(this: DatasetComplianceEntities, toggle: boolean): void {
|
||||
const isShowingGuidedEditMode = set(this, 'showGuidedComplianceEditMode', toggle);
|
||||
// Note: [REFACTOR-COMPLIANCE] Should be deleted once full functionality lives on this component
|
||||
this.showGuidedEditMode(isShowingGuidedEditMode);
|
||||
@ -124,7 +123,7 @@ export default class ComplianceSchemaEntities extends Component.extend({}) {
|
||||
* @returns {TagFilter}
|
||||
*/
|
||||
@action
|
||||
onFieldReviewChange(this: ComplianceSchemaEntities, option: { value: TagFilter }): TagFilter {
|
||||
onFieldReviewChange(this: DatasetComplianceEntities, option: { value: TagFilter }): IDropDownOption<TagFilter> {
|
||||
// Note: [REFACTOR-COMPLIANCE] The passed in effects should eventually live only on this component
|
||||
return this.fieldReviewChange(option);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user