mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-10 16:32:26 +00:00
Merge pull request #1330 from cptran777/red-dot-ownership
Red dot ownership
This commit is contained in:
commit
abc99b4244
@ -20,6 +20,7 @@ import {
|
|||||||
} from 'wherehows-web/constants/datasets/owner';
|
} from 'wherehows-web/constants/datasets/owner';
|
||||||
import { OwnerSource, OwnerType } from 'wherehows-web/utils/api/datasets/owners';
|
import { OwnerSource, OwnerType } from 'wherehows-web/utils/api/datasets/owners';
|
||||||
import Notifications, { NotificationEvent } from 'wherehows-web/services/notifications';
|
import Notifications, { NotificationEvent } from 'wherehows-web/services/notifications';
|
||||||
|
import { noop } from 'wherehows-web/utils/helpers/functions';
|
||||||
|
|
||||||
type Comparator = -1 | 0 | 1;
|
type Comparator = -1 | 0 | 1;
|
||||||
|
|
||||||
@ -114,6 +115,8 @@ export default class DatasetAuthors extends Component {
|
|||||||
*/
|
*/
|
||||||
isAddingOwner = false;
|
isAddingOwner = false;
|
||||||
|
|
||||||
|
setOwnershipRuleChange: (notConfirmed: boolean) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag that resolves in the affirmative if the number of confirmed owner is less the minimum required
|
* Flag that resolves in the affirmative if the number of confirmed owner is less the minimum required
|
||||||
* @type {ComputedProperty<boolean>}
|
* @type {ComputedProperty<boolean>}
|
||||||
@ -128,7 +131,9 @@ export default class DatasetAuthors extends Component {
|
|||||||
}
|
}
|
||||||
// If there have been no changes, then we want to automatically set true in order to disable save button
|
// If there have been no changes, then we want to automatically set true in order to disable save button
|
||||||
// when no changes have been made
|
// when no changes have been made
|
||||||
return changedState === -1 ? true : isRequiredMinOwnersNotConfirmed(get(this, 'confirmedOwners'));
|
const requiredOwnersNotConfirmed = isRequiredMinOwnersNotConfirmed(get(this, 'confirmedOwners'));
|
||||||
|
get(this, 'setOwnershipRuleChange')(requiredOwnersNotConfirmed);
|
||||||
|
return changedState === -1 || requiredOwnersNotConfirmed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -201,6 +206,8 @@ export default class DatasetAuthors extends Component {
|
|||||||
`Expected action save to be an function (Ember action), got ${typeOfSaveAction}`,
|
`Expected action save to be an function (Ember action), got ${typeOfSaveAction}`,
|
||||||
typeOfSaveAction === 'function'
|
typeOfSaveAction === 'function'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.setOwnershipRuleChange || (this.setOwnershipRuleChange = noop);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import { Tabs } from 'wherehows-web/constants/datasets/shared';
|
|||||||
import { action } from '@ember-decorators/object';
|
import { action } from '@ember-decorators/object';
|
||||||
import { DatasetPlatform } from 'wherehows-web/constants';
|
import { DatasetPlatform } 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';
|
||||||
|
|
||||||
export default class DatasetController extends Controller {
|
export default class DatasetController extends Controller {
|
||||||
queryParams = ['urn'];
|
queryParams = ['urn'];
|
||||||
@ -102,6 +103,19 @@ export default class DatasetController extends Controller {
|
|||||||
*/
|
*/
|
||||||
datasetContainsPersonalData: boolean;
|
datasetContainsPersonalData: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether or not we have met the dataset ownership count requirements
|
||||||
|
* @type {boolean}
|
||||||
|
* @memberof DatasetController
|
||||||
|
*/
|
||||||
|
datasetOwnersRequiredNotMet: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flag indicating that the dataset ownership requires user attention
|
||||||
|
* @type {ComputedProperty<boolean>}
|
||||||
|
*/
|
||||||
|
ownershipRequiresUserAction: ComputedProperty<boolean> = or('datasetOwnersRequiredNotMet');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag indicating that the compliance policy needs user attention
|
* Flag indicating that the compliance policy needs user attention
|
||||||
* @type {ComputedProperty<boolean>}
|
* @type {ComputedProperty<boolean>}
|
||||||
@ -219,4 +233,14 @@ export default class DatasetController extends Controller {
|
|||||||
const fromUpstream = get(this, 'isPolicyFromUpstream');
|
const fromUpstream = get(this, 'isPolicyFromUpstream');
|
||||||
set(this, 'compliancePolicyHasDrift', !fromUpstream && hasDrift);
|
set(this, 'compliancePolicyHasDrift', !fromUpstream && hasDrift);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Triggered when the ownership information changes, will alert the user on the tab with a red dot if
|
||||||
|
* the current state of the dataset doesn't match the rules set out for the dataset ownership
|
||||||
|
* @param ownersNotConfirmed - Whether or not the owners for the dataset meet the requirements
|
||||||
|
*/
|
||||||
|
@action
|
||||||
|
setOwnershipRuleChange(ownersNotConfirmed: boolean) {
|
||||||
|
next(this, () => set(this, 'datasetOwnersRequiredNotMet', ownersNotConfirmed));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,6 +34,7 @@
|
|||||||
owners=owners
|
owners=owners
|
||||||
suggestedOwners=suggestedOwners
|
suggestedOwners=suggestedOwners
|
||||||
ownerTypes=ownerTypes
|
ownerTypes=ownerTypes
|
||||||
|
setOwnershipRuleChange=setOwnershipRuleChange
|
||||||
save=(action "saveOwnerChanges")
|
save=(action "saveOwnerChanges")
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|||||||
@ -94,7 +94,7 @@
|
|||||||
{{#tablist.tab tabIds.Ownership on-select=(action "tabSelectionChanged")}}
|
{{#tablist.tab tabIds.Ownership on-select=(action "tabSelectionChanged")}}
|
||||||
Ownership
|
Ownership
|
||||||
|
|
||||||
{{#if requiredMinNotConfirmed}}
|
{{#if ownershipRequiresUserAction}}
|
||||||
<span class="notification-dot notification-dot--on-tab" aria-hidden="true"></span>
|
<span class="notification-dot notification-dot--on-tab" aria-hidden="true"></span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/tablist.tab}}
|
{{/tablist.tab}}
|
||||||
@ -142,7 +142,9 @@
|
|||||||
{{/tabs.tabpanel}}
|
{{/tabs.tabpanel}}
|
||||||
|
|
||||||
{{#tabs.tabpanel tabIds.Ownership}}
|
{{#tabs.tabpanel tabIds.Ownership}}
|
||||||
{{datasets/containers/dataset-ownership urn=encodedUrn}}
|
{{datasets/containers/dataset-ownership
|
||||||
|
urn=encodedUrn
|
||||||
|
setOwnershipRuleChange=(action "setOwnershipRuleChange")}}
|
||||||
{{/tabs.tabpanel}}
|
{{/tabs.tabpanel}}
|
||||||
|
|
||||||
{{#tabs.tabpanel tabIds.Compliance}}
|
{{#tabs.tabpanel tabIds.Compliance}}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user