mirror of
https://github.com/datahub-project/datahub.git
synced 2025-09-27 18:14:54 +00:00
propagates qps to container
This commit is contained in:
parent
37802e280b
commit
f3c6b8fdaa
@ -258,6 +258,12 @@ export default class DatasetCompliance extends Component {
|
|||||||
|
|
||||||
notifyOnChangeSetRequiresReview: (hasChangeSetDrift: boolean) => void;
|
notifyOnChangeSetRequiresReview: (hasChangeSetDrift: boolean) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* External action to handle compliance filter change
|
||||||
|
* @type {(tagFilter: TagFilter) => TagFilter}
|
||||||
|
*/
|
||||||
|
onComplianceTagFilterChange: (tagFilter: TagFilter) => TagFilter;
|
||||||
|
|
||||||
classNames = ['compliance-container'];
|
classNames = ['compliance-container'];
|
||||||
|
|
||||||
classNameBindings = ['isEditing:compliance-container--edit-mode'];
|
classNameBindings = ['isEditing:compliance-container--edit-mode'];
|
||||||
@ -302,11 +308,11 @@ export default class DatasetCompliance extends Component {
|
|||||||
classifiers: Array<ISecurityClassificationOption> = getSecurityClassificationDropDownOptions();
|
classifiers: Array<ISecurityClassificationOption> = getSecurityClassificationDropDownOptions();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default to show all fields to review
|
* Specifies the filter to be applied on the list of fields shown in the compliance policy table
|
||||||
* @type {string}
|
* @type {TagFilter}
|
||||||
* @memberof DatasetCompliance
|
* @memberof DatasetCompliance
|
||||||
*/
|
*/
|
||||||
fieldReviewOption: TagFilter = TagFilter.showAll;
|
fieldReviewOption!: TagFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Computes a cta string for the selected field review filter option
|
* Computes a cta string for the selected field review filter option
|
||||||
@ -1327,15 +1333,12 @@ export default class DatasetCompliance extends Component {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the fieldReviewOption with the user selected value
|
* Invokes the external action to update the tagFilter query
|
||||||
* @param {{value: TagFilter}} { value }
|
* @param {{value: TagFilter}} { value }
|
||||||
* @returns {TagFilter}
|
* @returns {TagFilter}
|
||||||
*/
|
*/
|
||||||
onFieldReviewChange(this: DatasetCompliance, { value }: { value: TagFilter }): TagFilter {
|
onFieldReviewChange(this: DatasetCompliance, { value }: { value: TagFilter }): TagFilter {
|
||||||
const option = set(this, 'fieldReviewOption', value);
|
return this.onComplianceTagFilterChange(value);
|
||||||
get(this, 'foldChangeSetTask').perform();
|
|
||||||
|
|
||||||
return option;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -378,7 +378,7 @@ export default class DatasetComplianceContainer extends Component {
|
|||||||
* Resets the compliance information for the dataset with the previously persisted properties
|
* Resets the compliance information for the dataset with the previously persisted properties
|
||||||
*/
|
*/
|
||||||
@action
|
@action
|
||||||
resetPrivacyCompliancePolicy() {
|
resetPrivacyCompliancePolicy(): void {
|
||||||
get(this, 'getComplianceTask').perform();
|
get(this, 'getComplianceTask').perform();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,7 +394,7 @@ export default class DatasetComplianceContainer extends Component {
|
|||||||
}: {
|
}: {
|
||||||
isNewComplianceInfo: boolean;
|
isNewComplianceInfo: boolean;
|
||||||
fromUpstream: boolean;
|
fromUpstream: boolean;
|
||||||
}) {
|
}): void {
|
||||||
this.setOnComplianceType({ isNewComplianceInfo, fromUpstream });
|
this.setOnComplianceType({ isNewComplianceInfo, fromUpstream });
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,7 +403,7 @@ export default class DatasetComplianceContainer extends Component {
|
|||||||
* @param {boolean} hasDrift
|
* @param {boolean} hasDrift
|
||||||
*/
|
*/
|
||||||
@action
|
@action
|
||||||
onCompliancePolicyChangeSetDrift(hasDrift: boolean) {
|
onCompliancePolicyChangeSetDrift(hasDrift: boolean): void {
|
||||||
this.setOnChangeSetDrift(hasDrift);
|
this.setOnChangeSetDrift(hasDrift);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -413,7 +413,7 @@ export default class DatasetComplianceContainer extends Component {
|
|||||||
* @param {SuggestionIntent} feedback
|
* @param {SuggestionIntent} feedback
|
||||||
*/
|
*/
|
||||||
@action
|
@action
|
||||||
onSuggestionsComplianceFeedback(uid: string | null = null, feedback: SuggestionIntent) {
|
onSuggestionsComplianceFeedback(uid: string | null = null, feedback: SuggestionIntent): void {
|
||||||
saveDatasetComplianceSuggestionFeedbackByUrn(get(this, 'urn'), uid, feedback);
|
saveDatasetComplianceSuggestionFeedbackByUrn(get(this, 'urn'), uid, feedback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,6 +68,12 @@ enum TagFilter {
|
|||||||
showCompleted = 'show-completed'
|
showCompleted = 'show-completed'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TagFilter type guard that narrows to a TagFilter type if compatible
|
||||||
|
* @param {any} candidate
|
||||||
|
* @returns {candidate is TagFilter}
|
||||||
|
*/
|
||||||
|
const isTagFilter = (candidate: any): candidate is TagFilter => Object.values(TagFilter).includes(candidate);
|
||||||
/**
|
/**
|
||||||
* Takes a compliance data type and transforms it into a compliance field identifier option
|
* Takes a compliance data type and transforms it into a compliance field identifier option
|
||||||
* @param {IComplianceDataType} complianceDataType
|
* @param {IComplianceDataType} complianceDataType
|
||||||
@ -684,6 +690,7 @@ export {
|
|||||||
complianceSteps,
|
complianceSteps,
|
||||||
getComplianceSteps,
|
getComplianceSteps,
|
||||||
editableTags,
|
editableTags,
|
||||||
|
isTagFilter,
|
||||||
isAutoGeneratedPolicy,
|
isAutoGeneratedPolicy,
|
||||||
removeReadonlyAttr,
|
removeReadonlyAttr,
|
||||||
tagNeedsReview,
|
tagNeedsReview,
|
||||||
|
@ -21,17 +21,23 @@ enum Tabs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the tab selection property on the provided route with the currently selected tab
|
* Sets a DatasetController property K to the supplied value
|
||||||
|
* @template K keyof DatasetController
|
||||||
* @param {Route} route the route instance to update
|
* @param {Route} route the route instance to update
|
||||||
* @param {Tabs} tabSelected identifier for the selected tab
|
* @param {K} prop the property on the DatasetController to be set
|
||||||
* @returns {Tabs}
|
* @param {DatasetController[K]} value value to be applied to prop
|
||||||
|
* @returns {DatasetController[K]}
|
||||||
*/
|
*/
|
||||||
const setTabSelectedOnAncestorController = (route: Route, tabSelected: Tabs): Tabs => {
|
const setPropertyOnAncestorController = <K extends keyof DatasetController>(
|
||||||
|
route: Route,
|
||||||
|
prop: K,
|
||||||
|
value: DatasetController[K]
|
||||||
|
): DatasetController[K] => {
|
||||||
const { routeName, controllerFor } = route;
|
const { routeName, controllerFor } = route;
|
||||||
assert('route should be a descendant of datasets.dataset', !routeName.indexOf('datasets.dataset.'));
|
assert('route should be a descendant of datasets.dataset', !routeName.indexOf('datasets.dataset.'));
|
||||||
const ancestorController = <DatasetController>controllerFor.call(route, 'datasets.dataset');
|
const ancestorController = <DatasetController>controllerFor.call(route, 'datasets.dataset');
|
||||||
|
|
||||||
return set(ancestorController, 'tabSelected', tabSelected);
|
return set(ancestorController, prop, value);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,15 +45,14 @@ const setTabSelectedOnAncestorController = (route: Route, tabSelected: Tabs): Ta
|
|||||||
* @param {{ selectedTab: Tabs }} { selectedTab } options bag contains identifier for the current tab
|
* @param {{ selectedTab: Tabs }} { selectedTab } options bag contains identifier for the current tab
|
||||||
* @returns {typeof Route} the descendant route class
|
* @returns {typeof Route} the descendant route class
|
||||||
*/
|
*/
|
||||||
const descendantDatasetRouteClassFactory = ({ selectedTab }: { selectedTab: Tabs }): typeof Route => {
|
const descendantDatasetRouteClassFactory = ({ selectedTab }: { selectedTab: Tabs }): typeof Route =>
|
||||||
return class DatasetDescendantRoute extends Route {
|
class DatasetDescendantRoute extends Route.extend({
|
||||||
actions = {
|
actions: {
|
||||||
didTransition(this: DatasetDescendantRoute) {
|
didTransition(this: DatasetDescendantRoute): void {
|
||||||
// on successful route transition
|
// on successful route transition
|
||||||
setTabSelectedOnAncestorController(this, selectedTab);
|
setPropertyOnAncestorController(this, 'tabSelected', selectedTab);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
};
|
}) {};
|
||||||
};
|
|
||||||
|
|
||||||
export { Tabs, descendantDatasetRouteClassFactory };
|
export { Tabs, descendantDatasetRouteClassFactory, setPropertyOnAncestorController };
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
import Controller from '@ember/controller';
|
import Controller from '@ember/controller';
|
||||||
import { computed, set, get, setProperties, getWithDefault } from '@ember/object';
|
import { computed, get, getWithDefault, set, setProperties } from '@ember/object';
|
||||||
import ComputedProperty from '@ember/object/computed';
|
import ComputedProperty, { or } from '@ember/object/computed';
|
||||||
import { or } from '@ember/object/computed';
|
|
||||||
import { encodeUrn } from 'wherehows-web/utils/validators/urn';
|
import { encodeUrn } from 'wherehows-web/utils/validators/urn';
|
||||||
import { Tabs } from 'wherehows-web/constants/datasets/shared';
|
import { Tabs } from 'wherehows-web/constants/datasets/shared';
|
||||||
import { action } from '@ember-decorators/object';
|
import { action } from '@ember-decorators/object';
|
||||||
import { DatasetPlatform, TagFilter } from 'wherehows-web/constants';
|
import { DatasetPlatform, isTagFilter, TagFilter } from 'wherehows-web/constants';
|
||||||
import { IDatasetView } from 'wherehows-web/typings/api/datasets/dataset';
|
import { IDatasetView } from 'wherehows-web/typings/api/datasets/dataset';
|
||||||
import { next } from '@ember/runloop';
|
import { next } from '@ember/runloop';
|
||||||
import { IAppConfig } from 'wherehows-web/typings/api/configurator/configurator';
|
import { IAppConfig } from 'wherehows-web/typings/api/configurator/configurator';
|
||||||
@ -137,10 +136,10 @@ export default class DatasetController extends Controller {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates the current query value for the compliance tags to be filtered by
|
* Indicates the current query value for the compliance tags to be filtered by
|
||||||
* @type {(TagFilter | undefined)}
|
* @type {(TagFilter)}
|
||||||
* @memberof DatasetController
|
* @memberof DatasetController
|
||||||
*/
|
*/
|
||||||
complianceTagFilter: TagFilter | undefined;
|
complianceTagFilter: TagFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts the uri on a model to a usable URN format
|
* Converts the uri on a model to a usable URN format
|
||||||
@ -175,6 +174,7 @@ export default class DatasetController extends Controller {
|
|||||||
this.tabSelected || (this.tabSelected = Tabs.Ownership);
|
this.tabSelected || (this.tabSelected = Tabs.Ownership);
|
||||||
this.jitAclAccessWhitelist || (this.jitAclAccessWhitelist = []);
|
this.jitAclAccessWhitelist || (this.jitAclAccessWhitelist = []);
|
||||||
this.wikiLinks || (this.wikiLinks = {});
|
this.wikiLinks || (this.wikiLinks = {});
|
||||||
|
isTagFilter(this.complianceTagFilter) || (this.complianceTagFilter = TagFilter.showAll);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -250,4 +250,17 @@ export default class DatasetController extends Controller {
|
|||||||
setOwnershipRuleChange(ownersNotConfirmed: boolean) {
|
setOwnershipRuleChange(ownersNotConfirmed: boolean) {
|
||||||
next(this, () => set(this, 'datasetOwnersRequiredNotMet', ownersNotConfirmed));
|
next(this, () => set(this, 'datasetOwnersRequiredNotMet', ownersNotConfirmed));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transitions to queryParams when the compliance filter has been changed
|
||||||
|
* @param {TagFilter} fieldFilter the new filter to apply
|
||||||
|
* @returns {TagFilter}
|
||||||
|
* @memberof DatasetController
|
||||||
|
*/
|
||||||
|
@action
|
||||||
|
onComplianceTagFilterChange(fieldFilter: TagFilter): TagFilter {
|
||||||
|
// @ts-ignore types not updated to reflect passing only QPs to transitionToRoute
|
||||||
|
this.transitionToRoute({ queryParams: { fieldFilter } });
|
||||||
|
return fieldFilter;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,9 +87,9 @@ export default class DatasetRoute extends Route {
|
|||||||
return { dataset_id: uri };
|
return { dataset_id: uri };
|
||||||
}
|
}
|
||||||
|
|
||||||
async setupController(this: DatasetRoute, controller: DatasetController, model: IDatasetView) {
|
setupController(this: DatasetRoute, controller: DatasetController, model: IDatasetView): void {
|
||||||
const { getConfig } = Configurator;
|
const { getConfig } = Configurator;
|
||||||
set(controller, 'model', model);
|
super.setupController(controller, model);
|
||||||
|
|
||||||
setProperties(controller, {
|
setProperties(controller, {
|
||||||
isInternal: !!getConfig('isInternal'),
|
isInternal: !!getConfig('isInternal'),
|
||||||
|
@ -1,32 +1,30 @@
|
|||||||
import { set } from '@ember/object';
|
import {
|
||||||
import { descendantDatasetRouteClassFactory, Tabs } from 'wherehows-web/constants/datasets/shared';
|
descendantDatasetRouteClassFactory,
|
||||||
|
setPropertyOnAncestorController,
|
||||||
|
Tabs
|
||||||
|
} from 'wherehows-web/constants/datasets/shared';
|
||||||
import DatasetComplianceController from 'wherehows-web/controllers/datasets/dataset/compliance';
|
import DatasetComplianceController from 'wherehows-web/controllers/datasets/dataset/compliance';
|
||||||
import { refreshModelForQueryParams } from 'wherehows-web/utils/helpers/routes';
|
import { refreshModelForQueryParams } from 'wherehows-web/utils/helpers/routes';
|
||||||
import { IDatasetView } from 'wherehows-web/typings/api/datasets/dataset';
|
import { isTagFilter, TagFilter } from 'wherehows-web/constants';
|
||||||
import DatasetController from 'wherehows-web/controllers/datasets/dataset';
|
import DatasetController from 'wherehows-web/controllers/datasets/dataset';
|
||||||
|
|
||||||
export default class Compliance extends descendantDatasetRouteClassFactory({ selectedTab: Tabs.Compliance }) {
|
export default class Compliance extends descendantDatasetRouteClassFactory({ selectedTab: Tabs.Compliance }) {
|
||||||
queryParams = refreshModelForQueryParams(['fieldFilter']);
|
queryParams = refreshModelForQueryParams(['fieldFilter']);
|
||||||
|
|
||||||
setupController(controller: DatasetComplianceController, model: IDatasetView): void {
|
async model(): Promise<DatasetController['model'] | object> {
|
||||||
const { setPropOnAncestorController } = this;
|
return { ...this.controllerFor('datasets.dataset').model };
|
||||||
|
}
|
||||||
|
|
||||||
|
setupController(controller: DatasetComplianceController, model: object): void {
|
||||||
|
const { fieldFilter } = controller;
|
||||||
|
|
||||||
super.setupController(controller, model);
|
super.setupController(controller, model);
|
||||||
|
|
||||||
// set the compliance tagFilter on the ancestor controller
|
// set the complianceTagFilter property on the ancestor controller
|
||||||
setPropOnAncestorController('complianceTagFilter', controller.fieldFilter);
|
setPropertyOnAncestorController(
|
||||||
|
this,
|
||||||
|
'complianceTagFilter',
|
||||||
|
isTagFilter(fieldFilter) ? fieldFilter : TagFilter.showAll
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets a DatasetController property K to the supplied value
|
|
||||||
* @template K keyof DatasetController
|
|
||||||
* @param {K} prop the property on the DatasetController to be set
|
|
||||||
* @param {DatasetController[K]} value value to be applied to prop
|
|
||||||
* @returns {DatasetController[K]}
|
|
||||||
* @memberof Compliance
|
|
||||||
*/
|
|
||||||
setPropOnAncestorController = <K extends keyof DatasetController>(
|
|
||||||
prop: K,
|
|
||||||
value: DatasetController[K]
|
|
||||||
): DatasetController[K] => set(this.controllerFor('datasets.dataset'), prop, value);
|
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
schemaless=schemaless
|
schemaless=schemaless
|
||||||
platform=platform
|
platform=platform
|
||||||
wikiLinks=@wikiLinks
|
wikiLinks=@wikiLinks
|
||||||
|
fieldReviewOption=@complianceTagFilter
|
||||||
complianceInfo=complianceInfo
|
complianceInfo=complianceInfo
|
||||||
exportPolicy=exportPolicy
|
exportPolicy=exportPolicy
|
||||||
complianceSuggestion=complianceSuggestion
|
complianceSuggestion=complianceSuggestion
|
||||||
@ -32,6 +33,7 @@
|
|||||||
isNewComplianceInfo=isNewComplianceInfo
|
isNewComplianceInfo=isNewComplianceInfo
|
||||||
schemaFieldNamesMappedToDataTypes=schemaFieldNamesMappedToDataTypes
|
schemaFieldNamesMappedToDataTypes=schemaFieldNamesMappedToDataTypes
|
||||||
complianceDataTypes=complianceDataTypes
|
complianceDataTypes=complianceDataTypes
|
||||||
|
onComplianceTagFilterChange=@onComplianceTagFilterChange
|
||||||
notifyOnComplianceSuggestionFeedback=(action "onSuggestionsComplianceFeedback")
|
notifyOnComplianceSuggestionFeedback=(action "onSuggestionsComplianceFeedback")
|
||||||
notifyOnChangeSetRequiresReview=(action "onCompliancePolicyChangeSetDrift")
|
notifyOnChangeSetRequiresReview=(action "onCompliancePolicyChangeSetDrift")
|
||||||
onSave=(action "savePrivacyCompliancePolicy")
|
onSave=(action "savePrivacyCompliancePolicy")
|
||||||
|
@ -158,9 +158,11 @@
|
|||||||
platform=model.platform
|
platform=model.platform
|
||||||
wikiLinks=wikiLinks
|
wikiLinks=wikiLinks
|
||||||
datasetName=model.nativeName
|
datasetName=model.nativeName
|
||||||
|
complianceTagFilter=complianceTagFilter
|
||||||
notifyPiiStatus=(action "onNotifyPiiStatus")
|
notifyPiiStatus=(action "onNotifyPiiStatus")
|
||||||
setOnChangeSetDrift=(action "setOnChangeSetDrift")
|
setOnChangeSetDrift=(action "setOnChangeSetDrift")
|
||||||
setOnComplianceType=(action "setOnComplianceTypeChange")
|
setOnComplianceType=(action "setOnComplianceTypeChange")
|
||||||
|
onComplianceTagFilterChange=(action "onComplianceTagFilterChange")
|
||||||
}}
|
}}
|
||||||
{{/tabs.tabpanel}}
|
{{/tabs.tabpanel}}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user