mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-11 18:56:41 +00:00

* Releases updated version of datahub-web client UI code * Fix typo in yarn lock * Change yarn lock to match yarn registry directories * Previous commit missed some paths * Even more changes to yarnlock missing in previous commit * Include codegen file for typings * Add files to get parity for datahub-web and current OS datahub-midtier * Add in typo fix from previous commit - change to proper license * Implement proper OS fix for person entity picture url * Workarounds for open source DH issues * Fixes institutional memory api and removes unopensourced tabs for datasets * Fixes search dataset deprecation and user search issue as a result of changes * Remove internal only options in the avatar menu
57 lines
1.8 KiB
TypeScript
57 lines
1.8 KiB
TypeScript
import { action, set } from '@ember/object';
|
|
import { IProtocolDefinition } from '@datahub/utils/types/controllers';
|
|
import { ProtocolController } from '@datahub/utils/controllers/protocol';
|
|
|
|
/**
|
|
* JIT ACL Protocol will shared common functionality for request_jit_urns
|
|
*/
|
|
export const JitAclProtocol: IProtocolDefinition = {
|
|
protocol: (ControllerClass: typeof ProtocolController): typeof ProtocolController => {
|
|
class Protocol extends ControllerClass {
|
|
/**
|
|
* A list of dataset urns to request for JIT ACL Access provided as a query param
|
|
* The query param renders the request-access modal if there are urns provided
|
|
* @type {Array<string>}
|
|
*/
|
|
request_jit_urns: Array<string> = [];
|
|
|
|
/**
|
|
* Action passed as UI control for adding a dataset urn to the 'urns' query param
|
|
* @param urn dataset urn added
|
|
*/
|
|
@action
|
|
addRequestJitUrn(urn: string): void {
|
|
const requestJitUrns = this.request_jit_urns;
|
|
|
|
if (!requestJitUrns.includes(urn)) {
|
|
set(this, 'request_jit_urns', [...requestJitUrns, urn]);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Action passed as UI control for removing a dataset urn from the 'urns' query param
|
|
* @param urn dataset urn filtered out
|
|
*/
|
|
@action
|
|
removeRequestJitUrn(urn: string): void {
|
|
const requestJitUrns = this.request_jit_urns;
|
|
set(
|
|
this,
|
|
'request_jit_urns',
|
|
[...requestJitUrns].filter((requestJitUrn: string): boolean => requestJitUrn !== urn)
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Action passed as UI control for resetting the request_jit_urns array to an empty array
|
|
*/
|
|
@action
|
|
resetRequestJitUrns(): void {
|
|
set(this, 'request_jit_urns', []);
|
|
}
|
|
}
|
|
return Protocol;
|
|
},
|
|
queryParams: ['request_jit_urns']
|
|
};
|