mirror of
https://github.com/datahub-project/datahub.git
synced 2025-09-05 23:33:00 +00:00
Separate compliance and retention post requests on save
This commit is contained in:
parent
1434453682
commit
a3624a1671
@ -239,6 +239,11 @@ export default class DatasetCompliance extends Component {
|
|||||||
onReset: <T>() => Promise<T>;
|
onReset: <T>() => Promise<T>;
|
||||||
onSave: <T>() => Promise<T>;
|
onSave: <T>() => Promise<T>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Passthrough from parent to export policy component to save the retention policy
|
||||||
|
*/
|
||||||
|
onSaveRetentionPolicy: <T>() => Promise<T>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Passthrough from parent to export policy component to save the export policy
|
* Passthrough from parent to export policy component to save the export policy
|
||||||
*/
|
*/
|
||||||
@ -1499,10 +1504,11 @@ export default class DatasetCompliance extends Component {
|
|||||||
try {
|
try {
|
||||||
const isSaving = true;
|
const isSaving = true;
|
||||||
const onSave = get(this, 'onSave');
|
const onSave = get(this, 'onSave');
|
||||||
|
const onSaveRetentionPolicy = get(this, 'onSaveRetentionPolicy');
|
||||||
setSaveFlag(isSaving);
|
setSaveFlag(isSaving);
|
||||||
|
|
||||||
await this.beforeSaveCompliance(editTarget);
|
await this.beforeSaveCompliance(editTarget);
|
||||||
await onSave();
|
await (editTarget === ComplianceEdit.PurgePolicy ? onSaveRetentionPolicy() : onSave());
|
||||||
return;
|
return;
|
||||||
} finally {
|
} finally {
|
||||||
setSaveFlag();
|
setSaveFlag();
|
||||||
|
@ -40,6 +40,9 @@ import { notificationDialogActionFactory } from 'wherehows-web/utils/notificatio
|
|||||||
import Configurator from 'wherehows-web/services/configurator';
|
import Configurator from 'wherehows-web/services/configurator';
|
||||||
import { typeOf } from '@ember/utils';
|
import { typeOf } from '@ember/utils';
|
||||||
import { service } from '@ember-decorators/service';
|
import { service } from '@ember-decorators/service';
|
||||||
|
import { saveDatasetRetentionByUrn } from 'wherehows-web/utils/api/datasets/retention';
|
||||||
|
import { extractRetentionFromComplianceInfo } from 'wherehows-web/utils/datasets/retention';
|
||||||
|
import { IDatasetRetention } from 'wherehows-web/typings/api/datasets/retention';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type alias for the response when container data items are batched
|
* Type alias for the response when container data items are batched
|
||||||
@ -340,6 +343,30 @@ export default class DatasetComplianceContainer extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Persists the updates to the retention policy on the remote host
|
||||||
|
* @return {Promise<void>}
|
||||||
|
*/
|
||||||
|
@action
|
||||||
|
async saveRetentionPolicy(this: DatasetComplianceContainer): Promise<void> {
|
||||||
|
const complianceInfo = get(this, 'complianceInfo');
|
||||||
|
if (complianceInfo) {
|
||||||
|
const { complianceEntities } = complianceInfo;
|
||||||
|
|
||||||
|
await this.notifyOnSave<IDatasetRetention>(
|
||||||
|
saveDatasetRetentionByUrn(
|
||||||
|
get(this, 'urn'),
|
||||||
|
extractRetentionFromComplianceInfo({
|
||||||
|
...complianceInfo,
|
||||||
|
complianceEntities: removeReadonlyAttr(editableTags(complianceEntities))
|
||||||
|
})
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
this.resetPrivacyCompliancePolicy.call(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Persists the updates to the export policy on the remote host
|
* Persists the updates to the export policy on the remote host
|
||||||
* @return {Promise<void}
|
* @return {Promise<void}
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
notifyOnComplianceSuggestionFeedback=(action "onSuggestionsComplianceFeedback")
|
notifyOnComplianceSuggestionFeedback=(action "onSuggestionsComplianceFeedback")
|
||||||
notifyOnChangeSetRequiresReview=(action "onCompliancePolicyChangeSetDrift")
|
notifyOnChangeSetRequiresReview=(action "onCompliancePolicyChangeSetDrift")
|
||||||
onSave=(action "savePrivacyCompliancePolicy")
|
onSave=(action "savePrivacyCompliancePolicy")
|
||||||
|
onSaveRetentionPolicy=(action "saveRetentionPolicy")
|
||||||
onSaveExportPolicy=(action "saveExportPolicy")
|
onSaveExportPolicy=(action "saveExportPolicy")
|
||||||
onReset=(action "resetPrivacyCompliancePolicy")
|
onReset=(action "resetPrivacyCompliancePolicy")
|
||||||
onComplianceJsonUpdate=(action "onComplianceJsonUpdate")
|
onComplianceJsonUpdate=(action "onComplianceJsonUpdate")
|
||||||
|
@ -11,11 +11,7 @@ import {
|
|||||||
IDatasetExportPolicy
|
IDatasetExportPolicy
|
||||||
} from 'wherehows-web/typings/api/datasets/compliance';
|
} from 'wherehows-web/typings/api/datasets/compliance';
|
||||||
import { getJSON, postJSON } from 'wherehows-web/utils/api/fetcher';
|
import { getJSON, postJSON } from 'wherehows-web/utils/api/fetcher';
|
||||||
import { saveDatasetRetentionByUrn } from 'wherehows-web/utils/api/datasets/retention';
|
import { nullifyRetentionFieldsOnComplianceInfo } from 'wherehows-web/utils/datasets/retention';
|
||||||
import {
|
|
||||||
extractRetentionFromComplianceInfo,
|
|
||||||
nullifyRetentionFieldsOnComplianceInfo
|
|
||||||
} from 'wherehows-web/utils/datasets/retention';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs the dataset compliance url
|
* Constructs the dataset compliance url
|
||||||
@ -106,7 +102,6 @@ const saveDatasetComplianceByUrn = async (urn: string, complianceInfo: IComplian
|
|||||||
url: datasetComplianceUrlByUrn(urn),
|
url: datasetComplianceUrlByUrn(urn),
|
||||||
data: nullifyRetentionFieldsOnComplianceInfo(complianceInfo)
|
data: nullifyRetentionFieldsOnComplianceInfo(complianceInfo)
|
||||||
});
|
});
|
||||||
await saveDatasetRetentionByUrn(urn, extractRetentionFromComplianceInfo(complianceInfo));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user