diff --git a/docs/CONCEPTS.md b/docs/CONCEPTS.md index 2e31a364..0796203c 100644 --- a/docs/CONCEPTS.md +++ b/docs/CONCEPTS.md @@ -35,19 +35,20 @@ Although not essential, it would be beneficial to apply this profile to the data 2. Providing additional information for help in choosing appropriate data elements to request for a user's own purposes. 3. Auto-populating the search filters to provide advanced search capabilities. -# User Requests +# User Data Specifications The primary use case of the Mauro Data Explorer is to: 1. Browse or search the provided catalogue for data elements. -2. Gather data elements of interest to the user into a formal _user request_. -3. Submit this user request to the organisation running this instance to gain access to the real data sets owned by the organisation, based on the data elements requested. +2. Gather data elements of interest to the user into a formal _user data specification_. +3. Submit this user data specification to the organisation running this instance to gain access to the real data sets owned by the organisation, + based on the data elements specified. -The current implementation considers user requests to be _data models_ in their own right - they are created under the access level of the user signed-in to the Mauro Data Explorer, then populated with data elements before they are submitted. The sections below go into further detail. +The current implementation considers user data specifications to be _data models_ in their own right - they are created under the access level of the user signed-in to the Mauro Data Explorer, then populated with data elements before they are submitted. The sections below go into further detail. -## Requests Folder +## Data Specifications Folder -Every user who signs in to the Mauro Data Explorer will automatically be assigned a folder within the Mauro instance to collect their own requests in one place. This folder is located in Mauro where the `explorer.config.root_request_folder` is defined, which is a [configuration key](SETUP.md#configuration-keys) provided by the `mdm-plugin-explorer`. A root request folder is automatically created by the `mdm-plugin-explorer` called "Explorer Content", though the API property can be changed to any other folder if required. +Every user who signs in to the Mauro Data Explorer will automatically be assigned a folder within the Mauro instance to collect their own data specifications in one place. This folder is located in Mauro where the `explorer.config.root_data_specification_folder` is defined, which is a [configuration key](SETUP.md#configuration-keys) provided by the `mdm-plugin-explorer`. A root data specification folder is automatically created by the `mdm-plugin-explorer` called "Explorer Content", though the API property can be changed to any other folder if required. The user's folder is named after the user's email address for uniqueness. @@ -57,30 +58,30 @@ The user's folder is named after the user's email address for uniqueness. > > For a user signed-in with the email address `user@test.com` > -> The user request folder will be located under `explorer.config.root_request_folder` and named `user[at]test.com`. +> The user's data specification folder will be located under `explorer.config.root_data_specification_folder` and named `user[at]test.com`. -This request folder is created along with a new user group containing that user. This group is then assigned to the [editor role](https://maurodatamapper.github.io/user-guides/permissions/permissions/#editor) to allow that user (normally with a read-only role) to create catalogue items underneath it. +This data specification folder is created along with a new user group containing that user. This group is then assigned to the [editor role](https://maurodatamapper.github.io/user-guides/permissions/permissions/#editor) to allow that user (normally with a read-only role) to create catalogue items underneath it. -Once created, the Mauro instance will contain a set of sub-folders similar to below, assuming the default root request folder is used: +Once created, the Mauro instance will contain a set of sub-folders similar to below, assuming the default root data specification folder is used: * Explorer Content * user1[at]test.com * user2[at]test.com * etc -## Creating Requests +## Creating Data Specifications -Each user will automatically create user request data models, usually via another action to also assign data elements to them. The data models created will: +Each user will automatically create user data specification data models, usually via another action to also assign data elements to them. The data models created will: -1. Be created directly under their own requests folder. +1. Be created directly under their own data specification folder. 2. Be accessible only to that user or administrators. -3. Be created as a draft. In the context of the Mauro Data Explorer, these are "unsent" requests which may still be edited. +3. Be created as a draft. In the context of the Mauro Data Explorer, these are "unsent" data specifications which may still be edited. -A user is able to create more than one unsent request at once. +A user is able to create more than one unsent data specification at once. ## Copying Data Elements -The signed-in user will be able to copy data elements from the root data model into their own request model. This uses the following Mauro endpoint to accomplish this: +The signed-in user will be able to copy data elements from the root data model into their own data specification model. This uses the following Mauro endpoint to accomplish this: ``` PUT api/dataModels/{sourceDataModelId}/subset/{targetDataModelId} @@ -102,20 +103,20 @@ The `subset` endpoint is a core Mauro endpoint which allows a deep copy of a set 3. Any related data types from the source data model, if they do not already exist. 4. All requested data elements, stored under the child data class copy. -## Submitting Requests +## Submitting Data Specifications -Once happy with the collection of data elements gathered, the user will be able to submit their request to the organisation hosting the Mauro Data Explorer. Submission covers several areas: +Once happy with the collection of data elements gathered, the user will be able to submit their data specification to the organisation hosting the Mauro Data Explorer. Submission covers several areas: -1. The request data model is [finalised](https://maurodatamapper.github.io/user-guides/finalising-data-models/finalising-data-models/). +1. The data specification data model is [finalised](https://maurodatamapper.github.io/user-guides/finalising-data-models/finalising-data-models/). 2. The current implementation of `mdm-plugin-explorer` will email a notification to an administrator. -At this point, the Mauro Data Explorer does not handle the submitted request anymore, the request for data access now falls under the control/responsibility of the hosting organisation. +At this point, the Mauro Data Explorer does not handle the submitted data specification anymore, the request for data access now falls under the control/responsibility of the hosting organisation. -It is possible for a user to create a new version of a previously submitted request, using the same [versioning](https://maurodatamapper.github.io/user-guides/branch-version-fork/branch-version-fork/) mechanisms that all data models have. This will create a new draft version which can be modified again before being submitted (finalised) a second time. +It is possible for a user to create a new version of a previously submitted data specification, using the same [versioning](https://maurodatamapper.github.io/user-guides/branch-version-fork/branch-version-fork/) mechanisms that all data models have. This will create a new draft version which can be modified again before being submitted (finalised) a second time. # Template Requests -Instead of creating User Requests from scratch, it is possible to base a request off of a _template_. This is a pre-made request that is finalised and can be forked to make a copy from. +Instead of creating user data specifications from scratch, it is possible to base a data specification off of a _template_. This is a pre-made data specification that is finalised and can be forked to make a copy from. ## Templates Folder @@ -125,4 +126,4 @@ The `mdm-plugin-explorer` will automatically: 2. Secure this folder to only be read by the "Explorer Readers" user group. 3. Install the API property `explorer.config.root_-_template_folder` pointing to this folder. -This will be the root folder to store any finalised template requests. The Mauro Data Explorer `/templates` page route will list all available templates and allow the user to inspect them and copy from them. Copying involves forking the Data Model request to build the copy, which is then automatically moved to the current user's personal request folder. +This will be the root folder to store any finalised template data specifications. The Mauro Data Explorer `/templates` page route will list all available templates and allow the user to inspect them and copy from them. Copying involves forking the template data specification to build the copy, which is then automatically moved to the current user's personal data specification folder. diff --git a/docs/SETUP.md b/docs/SETUP.md index c73cd8a2..8cafb1c1 100644 --- a/docs/SETUP.md +++ b/docs/SETUP.md @@ -9,7 +9,7 @@ It is essential to install the [mdm-plugin-explorer](https://github.com/MauroDat The [mdm-plugin-explorer](https://github.com/MauroDataMapper-Plugins/mdm-plugin-explorer) will automatically install the following API property keys, which are required for the Mauro Data Explorer to function: - `explorer.config.root_data_model_path` -- `explorer.config.root_request_folder` +- `explorer.config.root_data_specification_folder` - `explorer.config.root_template_folder` - `explorer.config.profile_namespace` - `explorer.config.profile_service_name` diff --git a/src/app/app.component.html b/src/app/app.component.html index 012a94ad..88fda914 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -26,7 +26,7 @@ [signedInUserProfileImageSrc]="signedInUserProfileImageSrc" [rightLinks]="headerRightLinks" [accountLink]="accountLink" - [unsentRequestCount]="unsentRequestsCount" + [unsentDataSpecificationCount]="unsentDataSpecificationsCount" >
diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index 12984108..c1ce77c9 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -20,11 +20,11 @@ import { ActivatedRoute, RouterOutlet } from '@angular/router'; import { MockDirective } from 'ng-mocks'; import { AppComponent } from './app.component'; import { StateRouterService } from './core/state-router.service'; -import { DataRequestsService } from './data-explorer/data-requests.service'; +import { DataSpecificationService } from './data-explorer/data-specification.service'; import { MdmEndpointsService } from './mauro/mdm-endpoints.service'; import { FooterComponent } from './shared/footer/footer.component'; import { HeaderComponent } from './shared/header/header.component'; -import { createDataRequestsServiceStub } from './testing/stubs/data-requests.stub'; +import { createDataSpecificationServiceStub } from './testing/stubs/data-specifications.stub'; import { createMdmEndpointsStub, MdmEndpointsServiceStub, @@ -38,7 +38,7 @@ import { of } from 'rxjs'; describe('AppComponent', () => { let harness: ComponentHarness; - const dataRequestsStub = createDataRequestsServiceStub(); + const dataSpecificationStub = createDataSpecificationServiceStub(); const endpointsStub: MdmEndpointsServiceStub = createMdmEndpointsStub(); const dataElementSearchStub = createDataElementSearchServiceStub(); const themesStub = createThemeServiceStub(); @@ -54,8 +54,8 @@ describe('AppComponent', () => { useValue: {}, }, { - provide: DataRequestsService, - useValue: dataRequestsStub, + provide: DataSpecificationService, + useValue: dataSpecificationStub, }, { provide: MdmEndpointsService, diff --git a/src/app/app.component.ts b/src/app/app.component.ts index d523be0e..a8c77449 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -32,7 +32,7 @@ import { import { environment } from '../environments/environment'; import { BroadcastEvent, BroadcastService } from './core/broadcast.service'; import { StateRouterService } from './core/state-router.service'; -import { DataRequestsService } from './data-explorer/data-requests.service'; +import { DataSpecificationService } from './data-explorer/data-specification.service'; import { ErrorService } from './pages/error/error.service'; import { MdmHttpError } from './mauro/mauro.types'; import { SecurityService } from './security/security.service'; @@ -53,7 +53,7 @@ export class AppComponent implements OnInit, OnDestroy { isLoading = false; loadingCaption = ''; - unsentRequestsCount = 0; + unsentDataSpecificationsCount = 0; signedInUserProfileImageSrc?: string; @@ -125,8 +125,8 @@ export class AppComponent implements OnInit, OnDestroy { ]; accountLink: HeaderLink = { - label: 'My requests', - routerLink: '/requests', + label: 'My Data Specifications', + routerLink: '/dataSpecifications', arrow: 'angle-down', }; @@ -172,7 +172,7 @@ export class AppComponent implements OnInit, OnDestroy { private broadcast: BroadcastService, private security: SecurityService, private userDetails: UserDetailsService, - private dataRequests: DataRequestsService, + private dataSpecification: DataSpecificationService, private stateRouter: StateRouterService, private toastr: ToastrService, private userIdle: UserIdleService, @@ -207,9 +207,12 @@ export class AppComponent implements OnInit, OnDestroy { takeUntil(this.unsubscribe$), switchMap((userSignedIn) => { this.setupSignedInUser(userSignedIn); - return this.getUnsentRequestCount(); + return this.getUnsentDataSpecificationCount(); }), - map((unsentRequestsCount) => (this.unsentRequestsCount = unsentRequestsCount)) + map( + (unsentDataSpecificationsCount) => + (this.unsentDataSpecificationsCount = unsentDataSpecificationsCount) + ) ) .subscribe(() => {}); @@ -221,8 +224,9 @@ export class AppComponent implements OnInit, OnDestroy { const user = this.userDetails.get(); if (user) { this.setupSignedInUser(user); - this.getUnsentRequestCount().subscribe( - (unsentRequestsCount) => (this.unsentRequestsCount = unsentRequestsCount) + this.getUnsentDataSpecificationCount().subscribe( + (unsentDataSpecificationsCount) => + (this.unsentDataSpecificationsCount = unsentDataSpecificationsCount) ); } @@ -233,7 +237,7 @@ export class AppComponent implements OnInit, OnDestroy { this.subscribeHttpErrorEvent('http-not-implemented', '/not-implemented'); this.subscribeHttpErrorEvent('http-server-error', '/server-error'); - this.subscribeDataRequestChanges(); + this.subscribeDataSpecificationChanges(); this.broadcast .onLoading() @@ -292,34 +296,44 @@ export class AppComponent implements OnInit, OnDestroy { : undefined; } - private getUnsentRequestCount() { - return this.dataRequests.list().pipe( + private getUnsentDataSpecificationCount() { + return this.dataSpecification.list().pipe( catchError(() => { - this.toastr.error('There was a problem locating your current requests.'); + this.toastr.error( + 'There was a problem locating your current data specifications.' + ); return EMPTY; }), - map((requests) => { - return requests.filter((req) => req.status === 'unsent').length; + map((dataSpecifications) => { + return dataSpecifications.filter( + (specification) => specification.status === 'unsent' + ).length; }) ); } - private subscribeDataRequestChanges() { + private subscribeDataSpecificationChanges() { this.broadcast - .on('data-request-added') + .on('data-specification-added') .pipe( takeUntil(this.unsubscribe$), - switchMap(() => this.getUnsentRequestCount()), - map((unsentRequestsCount) => (this.unsentRequestsCount = unsentRequestsCount)) + switchMap(() => this.getUnsentDataSpecificationCount()), + map( + (unsentDataSpecificationsCount) => + (this.unsentDataSpecificationsCount = unsentDataSpecificationsCount) + ) ) .subscribe(() => {}); this.broadcast - .on('data-request-submitted') + .on('data-specification-submitted') .pipe( takeUntil(this.unsubscribe$), - switchMap(() => this.getUnsentRequestCount()), - map((unsentRequestsCount) => (this.unsentRequestsCount = unsentRequestsCount)) + switchMap(() => this.getUnsentDataSpecificationCount()), + map( + (unsentDataSpecificationsCount) => + (this.unsentDataSpecificationsCount = unsentDataSpecificationsCount) + ) ) .subscribe(() => {}); } diff --git a/src/app/core/broadcast.service.ts b/src/app/core/broadcast.service.ts index bb5b9bca..1d01f090 100644 --- a/src/app/core/broadcast.service.ts +++ b/src/app/core/broadcast.service.ts @@ -31,8 +31,8 @@ export type BroadcastEvent = | 'user-signed-in' | 'user-signed-out' | 'sign-out-user' - | 'data-request-added' - | 'data-request-submitted' + | 'data-specification-added' + | 'data-specification-submitted' | 'data-intersections-refreshed' | 'data-bookmarks-refreshed' | 'loading'; diff --git a/src/app/core/state-router.service.ts b/src/app/core/state-router.service.ts index 6d9b84e5..b8ae7886 100644 --- a/src/app/core/state-router.service.ts +++ b/src/app/core/state-router.service.ts @@ -33,7 +33,7 @@ export type KnownRouterPath = | '/search' | '/search/listing' | '/dashboard' - | '/requests' + | '/dataSpecifications' | '/account'; /** diff --git a/src/app/data-explorer/create-request-dialog/create-request-dialog.component.html b/src/app/data-explorer/create-data-specification-dialog/create-data-specification-dialog.component.html similarity index 79% rename from src/app/data-explorer/create-request-dialog/create-request-dialog.component.html rename to src/app/data-explorer/create-data-specification-dialog/create-data-specification-dialog.component.html index a0f718b5..745952ff 100644 --- a/src/app/data-explorer/create-request-dialog/create-request-dialog.component.html +++ b/src/app/data-explorer/create-data-specification-dialog/create-data-specification-dialog.component.html @@ -16,20 +16,20 @@ SPDX-License-Identifier: Apache-2.0 --> -

Create a new request

+

Create a new data specification

-
+
Name - Please enter a request name + Please enter a data specification name
@@ -40,7 +40,7 @@

Create a new request

matInput rows="6" formControlName="description" - placeholder="Enter a description of your request" + placeholder="Enter a description of your data specification" > @@ -51,9 +51,9 @@

Create a new request

diff --git a/src/app/data-explorer/create-request-dialog/create-request-dialog.component.scss b/src/app/data-explorer/create-data-specification-dialog/create-data-specification-dialog.component.scss similarity index 100% rename from src/app/data-explorer/create-request-dialog/create-request-dialog.component.scss rename to src/app/data-explorer/create-data-specification-dialog/create-data-specification-dialog.component.scss diff --git a/src/app/data-explorer/create-request-dialog/create-request-dialog.component.spec.ts b/src/app/data-explorer/create-data-specification-dialog/create-data-specification-dialog.component.spec.ts similarity index 76% rename from src/app/data-explorer/create-request-dialog/create-request-dialog.component.spec.ts rename to src/app/data-explorer/create-data-specification-dialog/create-data-specification-dialog.component.spec.ts index c7cb2d6c..c7e167b7 100644 --- a/src/app/data-explorer/create-request-dialog/create-request-dialog.component.spec.ts +++ b/src/app/data-explorer/create-data-specification-dialog/create-data-specification-dialog.component.spec.ts @@ -24,22 +24,22 @@ import { } from '@angular/material/dialog'; import { MatFormField, MatLabel } from '@angular/material/form-field'; import { MockComponent, MockDirective } from 'ng-mocks'; -import { createMatDialogRefStub } from 'src/app/testing/stubs/mat-dialog.stub'; +import { createMatDialogRefStub } from '../../testing/stubs/mat-dialog.stub'; import { ComponentHarness, setupTestModuleForComponent, -} from 'src/app/testing/testing.helpers'; +} from '../../testing/testing.helpers'; import { - CreateRequestDialogComponent, - CreateRequestDialogResponse, -} from './create-request-dialog.component'; + CreateDataSpecificationDialogComponent, + CreateDataSpecificationDialogResponse, +} from './create-data-specification-dialog.component'; -describe('CreateRequestDialogComponent', () => { - let harness: ComponentHarness; - const dialogRefStub = createMatDialogRefStub(); +describe('CreateDataSpecificationDialogComponent', () => { + let harness: ComponentHarness; + const dialogRefStub = createMatDialogRefStub(); beforeEach(async () => { - harness = await setupTestModuleForComponent(CreateRequestDialogComponent, { + harness = await setupTestModuleForComponent(CreateDataSpecificationDialogComponent, { declarations: [ MockDirective(MatDialogContent), MockDirective(MatDialogActions), @@ -61,13 +61,13 @@ describe('CreateRequestDialogComponent', () => { it('should create', () => { expect(harness.isComponentCreated).toBeTruthy(); - expect(harness.component.requestForm).toBeDefined(); + expect(harness.component.dataSpecificationForm).toBeDefined(); expect(harness.component.showDescription).toBeTruthy(); }); it('should initialise', () => { harness.component.ngOnInit(); - expect(harness.component.requestForm).toBeDefined(); + expect(harness.component.dataSpecificationForm).toBeDefined(); expect(harness.component.name?.value).toBe(''); expect(harness.component.name?.hasValidator(Validators.required)).toBeTruthy(); // eslint-disable-line @typescript-eslint/unbound-method expect(harness.component.description?.value).toBe(''); @@ -85,8 +85,8 @@ describe('CreateRequestDialogComponent', () => { }); it('should close when form is valid', () => { - const expected: CreateRequestDialogResponse = { - name: 'Test request', + const expected: CreateDataSpecificationDialogResponse = { + name: 'Test data specification', description: 'Test description', }; diff --git a/src/app/data-explorer/create-request-dialog/create-request-dialog.component.ts b/src/app/data-explorer/create-data-specification-dialog/create-data-specification-dialog.component.ts similarity index 67% rename from src/app/data-explorer/create-request-dialog/create-request-dialog.component.ts rename to src/app/data-explorer/create-data-specification-dialog/create-data-specification-dialog.component.ts index e9028c83..ca5936c4 100644 --- a/src/app/data-explorer/create-request-dialog/create-request-dialog.component.ts +++ b/src/app/data-explorer/create-data-specification-dialog/create-data-specification-dialog.component.ts @@ -20,22 +20,22 @@ import { Component, Inject, OnInit, Optional } from '@angular/core'; import { FormControl, FormGroup, Validators } from '@angular/forms'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; -export interface CreateRequestDialogOptions { +export interface CreateDataSpecificationDialogOptions { showDescription?: boolean; } -export interface CreateRequestDialogResponse { +export interface CreateDataSpecificationDialogResponse { name: string; description: string; } @Component({ - selector: 'mdm-create-request-dialog', - templateUrl: './create-request-dialog.component.html', - styleUrls: ['./create-request-dialog.component.scss'], + selector: 'mdm-create-data-specification-dialog', + templateUrl: './create-data-specification-dialog.component.html', + styleUrls: ['./create-data-specification-dialog.component.scss'], }) -export class CreateRequestDialogComponent implements OnInit { - requestForm = new FormGroup({ +export class CreateDataSpecificationDialogComponent implements OnInit { + dataSpecificationForm = new FormGroup({ name: new FormControl('', [ Validators.required, // eslint-disable-line @typescript-eslint/unbound-method ]), @@ -46,18 +46,20 @@ export class CreateRequestDialogComponent implements OnInit { constructor( public dialogRef: MatDialogRef< - CreateRequestDialogComponent, - CreateRequestDialogResponse + CreateDataSpecificationDialogComponent, + CreateDataSpecificationDialogResponse >, - @Inject(MAT_DIALOG_DATA) @Optional() private data: CreateRequestDialogOptions + @Inject(MAT_DIALOG_DATA) + @Optional() + private data: CreateDataSpecificationDialogOptions ) {} get name() { - return this.requestForm.controls.name; + return this.dataSpecificationForm.controls.name; } get description() { - return this.requestForm.controls.description; + return this.dataSpecificationForm.controls.description; } ngOnInit(): void { @@ -69,7 +71,7 @@ export class CreateRequestDialogComponent implements OnInit { } create() { - if (this.requestForm.invalid) { + if (this.dataSpecificationForm.invalid) { return; } diff --git a/src/app/data-explorer/data-class-row/data-class-row.component.html b/src/app/data-explorer/data-class-row/data-class-row.component.html index 6b447035..7d851e77 100644 --- a/src/app/data-explorer/data-class-row/data-class-row.component.html +++ b/src/app/data-explorer/data-class-row/data-class-row.component.html @@ -36,22 +36,24 @@

{{ (dataClassWithElements?.dataClass)!.label }}

class="mdm-data-class-row__header-button" color="primary" (click)="removeClass()" - matTooltip="Remove from request" - matTooltipClass="mdm-request-icon-tooltip" - aria-label="Remove from request" + matTooltip="Remove from data specification" + matTooltipClass="mdm-data-specification-icon-tooltip" + aria-label="Remove from data specification" > - + > -
+
diff --git a/src/app/data-explorer/data-class-row/data-class-row.component.spec.ts b/src/app/data-explorer/data-class-row/data-class-row.component.spec.ts index 1eae5b9c..dc7d1910 100644 --- a/src/app/data-explorer/data-class-row/data-class-row.component.spec.ts +++ b/src/app/data-explorer/data-class-row/data-class-row.component.spec.ts @@ -18,7 +18,7 @@ SPDX-License-Identifier: Apache-2.0 */ import { CatalogueItemDomainType } from '@maurodatamapper/mdm-resources'; import { MockComponent } from 'ng-mocks'; -import { RequestElementAddDeleteEvent } from 'src/app/shared/data-element-in-request/data-element-in-request.component'; +import { DataSpecificationElementAddDeleteEvent } from '../../shared/data-element-in-data-specification/data-element-in-data-specification.component'; import { ComponentHarness, setupTestModuleForComponent, @@ -73,10 +73,10 @@ describe('DataClassRowComponent', () => { it('should create', () => { expect(harness.isComponentCreated).toBeTruthy(); expect(harness.component.dataClassWithElements).toBeUndefined(); - expect(harness.component.suppressViewRequestsDialogButton).toBe(false); + expect(harness.component.suppressViewDataSpecificationsDialogButton).toBe(false); expect(harness.component.canDelete).toBe(true); expect(harness.component.sourceTargetIntersections).toStrictEqual({ - dataAccessRequests: [], + dataSpecifications: [], sourceTargetIntersections: [], }); expect(harness.component.expanded).toBe(true); @@ -167,8 +167,8 @@ describe('DataClassRowComponent', () => { isSelected: false, }; - it('should raise a request add or delete event', () => { - const event: RequestElementAddDeleteEvent = { + it('should raise a data specification add or delete event', () => { + const event: DataSpecificationElementAddDeleteEvent = { adding: true, dataModel: { label: 'model', @@ -177,9 +177,9 @@ describe('DataClassRowComponent', () => { dataElement, }; - const eventSpy = jest.spyOn(harness.component.requestAddDelete, 'emit'); + const eventSpy = jest.spyOn(harness.component.dataSpecificationAddDelete, 'emit'); - harness.component.handleRequestAddDelete(event); + harness.component.handleDataSpecificationAddDelete(event); expect(eventSpy).toHaveBeenCalledWith(event); }); diff --git a/src/app/data-explorer/data-class-row/data-class-row.component.ts b/src/app/data-explorer/data-class-row/data-class-row.component.ts index 4d03b595..b367ad70 100644 --- a/src/app/data-explorer/data-class-row/data-class-row.component.ts +++ b/src/app/data-explorer/data-class-row/data-class-row.component.ts @@ -17,13 +17,13 @@ limitations under the License. SPDX-License-Identifier: Apache-2.0 */ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; -import { RequestElementAddDeleteEvent } from 'src/app/shared/data-element-in-request/data-element-in-request.component'; +import { DataSpecificationElementAddDeleteEvent } from '../../shared/data-element-in-data-specification/data-element-in-data-specification.component'; import { DataClassWithElements, DataElementSearchResult, DataItemDeleteEvent, } from '../data-explorer.types'; -import { DataAccessRequestsSourceTargetIntersections } from '../data-requests.service'; +import { DataSpecificationSourceTargetIntersections } from '../data-specification.service'; @Component({ selector: 'mdm-data-class-row', @@ -32,12 +32,13 @@ import { DataAccessRequestsSourceTargetIntersections } from '../data-requests.se }) export class DataClassRowComponent implements OnInit { @Input() dataClassWithElements?: DataClassWithElements; - @Input() suppressViewRequestsDialogButton = false; + @Input() suppressViewDataSpecificationsDialogButton = false; @Input() canDelete = true; - @Input() sourceTargetIntersections: DataAccessRequestsSourceTargetIntersections; + @Input() sourceTargetIntersections: DataSpecificationSourceTargetIntersections; @Output() deleteItemEvent = new EventEmitter(); - @Output() requestAddDelete = new EventEmitter(); + @Output() dataSpecificationAddDelete = + new EventEmitter(); @Output() updateAllChildrenSelected = new EventEmitter(); expanded = true; @@ -48,7 +49,7 @@ export class DataClassRowComponent implements OnInit { constructor() { this.sourceTargetIntersections = { - dataAccessRequests: [], + dataSpecifications: [], sourceTargetIntersections: [], }; } @@ -82,8 +83,8 @@ export class DataClassRowComponent implements OnInit { this.expanded = !this.expanded; } - handleRequestAddDelete(event: RequestElementAddDeleteEvent) { - this.requestAddDelete.emit(event); + handleDataSpecificationAddDelete(event: DataSpecificationElementAddDeleteEvent) { + this.dataSpecificationAddDelete.emit(event); } handleDeleteItemEvent(event: DataItemDeleteEvent) { diff --git a/src/app/data-explorer/data-element-row/data-element-row.component.html b/src/app/data-explorer/data-element-row/data-element-row.component.html index 8095148d..9e7af49e 100644 --- a/src/app/data-explorer/data-element-row/data-element-row.component.html +++ b/src/app/data-explorer/data-element-row/data-element-row.component.html @@ -50,22 +50,24 @@ class="mdm-data-element-row__header-button" color="primary" (click)="removeElement()" - matTooltip="Remove from request" - matTooltipClass="mdm-request-icon-tooltip" - aria-label="Remove from request" + matTooltip="Remove from data specification" + matTooltipClass="mdm-data-specification-icon-tooltip" + aria-label="Remove from data specification" > - + [caption]="'Add to other data specifications'" + [suppressViewDataSpecificationsDialogButton]=" + suppressViewDataSpecificationsDialogButton + " + (dataSpecificationAddDelete)="handleDataSpecificationAddDelete($event)" + (createDataSpecificationClicked)="handleCreateDataSpecification($event)" + >
- + > { @@ -63,7 +63,7 @@ describe('DataElementSearchResultComponent', () => { declarations: [ MockComponent(BookmarkToggleComponent), MockComponent(IdentifiableDataIconComponent), - MockComponent(DataElementInRequestComponent), + MockComponent(DataElementInDataSpecificationComponent), MockComponent(HeaderAndContentBoxComponent), MockComponent(MatCheckbox), ], diff --git a/src/app/data-explorer/data-element-search-result/data-element-search-result.component.ts b/src/app/data-explorer/data-element-search-result/data-element-search-result.component.ts index 71e6db3a..b4009280 100644 --- a/src/app/data-explorer/data-element-search-result/data-element-search-result.component.ts +++ b/src/app/data-explorer/data-element-search-result/data-element-search-result.component.ts @@ -29,7 +29,7 @@ import { SelectableDataElementSearchResultCheckedEvent, DataElementSearchResult, } from '../data-explorer.types'; -import { DataAccessRequestsSourceTargetIntersections } from '../data-requests.service'; +import { DataSpecificationSourceTargetIntersections } from '../data-specification.service'; @Component({ selector: 'mdm-data-element-search-result', @@ -44,7 +44,7 @@ export class DataElementSearchResultComponent { @Input() isBookmarked = false; - @Input() sourceTargetIntersections: DataAccessRequestsSourceTargetIntersections; + @Input() sourceTargetIntersections: DataSpecificationSourceTargetIntersections; @Output() checked = new EventEmitter(); @@ -54,7 +54,7 @@ export class DataElementSearchResultComponent { constructor() { this.sourceTargetIntersections = { - dataAccessRequests: [], + dataSpecifications: [], sourceTargetIntersections: [], }; } diff --git a/src/app/data-explorer/data-explorer.module.ts b/src/app/data-explorer/data-explorer.module.ts index 66c98409..eed1d3f3 100644 --- a/src/app/data-explorer/data-explorer.module.ts +++ b/src/app/data-explorer/data-explorer.module.ts @@ -25,14 +25,14 @@ import { PaginationComponent } from './pagination/pagination.component'; import { ContactFormComponent } from './contact-form/contact-form.component'; import { FeedbackDialogComponent } from './feedback-dialog/feedback-dialog.component'; import { PAGINATION_CONFIG } from './data-explorer.types'; -import { RequestStatusChipComponent } from './request-status-chip/request-status-chip.component'; +import { DataSpecificationStatusChipComponent } from './data-specification-status-chip/data-specification-status-chip.component'; import { BreadcrumbComponent } from './breadcrumb/breadcrumb.component'; import { DataElementRowComponent } from './data-element-row/data-element-row.component'; import { DataClassRowComponent } from './data-class-row/data-class-row.component'; import { DataSchemaRowComponent } from './data-schema-row/data-schema-row.component'; -import { CreateRequestDialogComponent } from './create-request-dialog/create-request-dialog.component'; -import { RequestCreatedDialogComponent } from './request-created-dialog/request-created-dialog.component'; -import { RequestUpdatedDialogComponent } from './request-updated-dialog/request-updated-dialog.component'; +import { CreateDataSpecificationDialogComponent } from './create-data-specification-dialog/create-data-specification-dialog.component'; +import { DataSpecificationCreatedDialogComponent } from './data-specification-created-dialog/data-specification-created-dialog.component'; +import { DataSpecificationUpdatedDialogComponent } from './data-specification-updated-dialog/data-specification-updated-dialog.component'; import { SuccessDialogComponent } from './success-dialog/success-dialog.component'; import { IdentifiableDataIconComponent } from './identifiable-data-icon/identifiable-data-icon.component'; import { SearchFiltersComponent } from './search-filters/search-filters.component'; @@ -42,10 +42,10 @@ import { QueryBuilderComponent } from '../data-explorer/querybuilder/querybuilde import { QueryBuilderModule } from 'angular2-query-builder'; import { MeqlPipe } from './pipes/meql.pipe'; import { MeqlOutputComponent } from './meql-output/meql-output.component'; -import { DataRequestRowComponent } from './data-request-row/data-request-row.component'; +import { DataSpecificationRowComponent } from './data-specification-row/data-specification-row.component'; import { DataQueryRowComponent } from './data-query-row/data-query-row.component'; import { NumberFormatDirective } from './querybuilder/directives/number-format.directive'; -import { EditRequestDialogComponent } from './edit-request-dialog/edit-request-dialog.component'; +import { EditDataSpecificationDialogComponent } from './edit-data-specification-dialog/edit-data-specification-dialog.component'; import { SelectionExpandedDialogComponent } from './selection-expanded-dialog/selection-expanded-dialog.component'; import { SelectionCompactComponent } from './selection-compact/selection-compact.component'; @@ -55,15 +55,15 @@ import { SelectionCompactComponent } from './selection-compact/selection-compact DataElementRowComponent, DataClassRowComponent, DataSchemaRowComponent, - RequestStatusChipComponent, + DataSpecificationStatusChipComponent, PaginationComponent, SortByComponent, ContactFormComponent, FeedbackDialogComponent, BreadcrumbComponent, - CreateRequestDialogComponent, - RequestCreatedDialogComponent, - RequestUpdatedDialogComponent, + CreateDataSpecificationDialogComponent, + DataSpecificationCreatedDialogComponent, + DataSpecificationUpdatedDialogComponent, SuccessDialogComponent, IdentifiableDataIconComponent, SearchFiltersComponent, @@ -72,10 +72,10 @@ import { SelectionCompactComponent } from './selection-compact/selection-compact QueryBuilderComponent, MeqlPipe, MeqlOutputComponent, - DataRequestRowComponent, + DataSpecificationRowComponent, DataQueryRowComponent, NumberFormatDirective, - EditRequestDialogComponent, + EditDataSpecificationDialogComponent, SelectionExpandedDialogComponent, SelectionCompactComponent, ], @@ -89,14 +89,14 @@ import { SelectionCompactComponent } from './selection-compact/selection-compact SortByComponent, ContactFormComponent, FeedbackDialogComponent, - RequestStatusChipComponent, + DataSpecificationStatusChipComponent, BreadcrumbComponent, IdentifiableDataIconComponent, SearchFiltersComponent, CatalogueSearchFormComponent, QueryBuilderComponent, MeqlOutputComponent, - DataRequestRowComponent, + DataSpecificationRowComponent, DataQueryRowComponent, NumberFormatDirective, SelectionCompactComponent, diff --git a/src/app/data-explorer/data-explorer.types.ts b/src/app/data-explorer/data-explorer.types.ts index e1ff7b7a..0e9c2de3 100644 --- a/src/app/data-explorer/data-explorer.types.ts +++ b/src/app/data-explorer/data-explorer.types.ts @@ -229,12 +229,12 @@ export const mapProfileSearchResult = ( }; }; -export type DataRequestStatus = 'unsent' | 'submitted'; +export type DataSpecificationStatus = 'unsent' | 'submitted'; /* .* - * Determine the status of a request made by a user for data access. + * Determine the status of a data specification made by a user for data access. */ -export const getDataRequestStatus = (model: DataModel): DataRequestStatus => { +export const getDataSpecificationStatus = (model: DataModel): DataSpecificationStatus => { if (model.modelVersion) { // Model was finalised, so is now locked return 'submitted'; @@ -244,19 +244,19 @@ export const getDataRequestStatus = (model: DataModel): DataRequestStatus => { }; /** - * Define a Data Request, which is an extension of a {@link DataModel}. + * Define a data specification, which is an extension of a {@link DataModel}. */ -export interface DataRequest extends DataModel { +export interface DataSpecification extends DataModel { /** - * Get the status of this request, one of {@link DataRequestStatus}. + * Get the status of this data specification, one of {@link DataSpecificationStatus}. */ - status: DataRequestStatus; + status: DataSpecificationStatus; } -export const mapToDataRequest = (dataModel: DataModel): DataRequest => { +export const mapToDataSpecification = (dataModel: DataModel): DataSpecification => { return { ...dataModel, - status: getDataRequestStatus(dataModel), + status: getDataSpecificationStatus(dataModel), }; }; @@ -312,9 +312,9 @@ export interface BookMarkCheckedEvent { checked: boolean; } -export interface AddToRequestEvent { +export interface AddToDataSpecificationEvent { item: DataElementSearchResult; - requestId: Uuid; + dataSpecificationId: Uuid; } export interface RemoveBookmarkEvent { @@ -357,18 +357,18 @@ export interface DataItemDeleteEvent { confirmationMessage?: string; } -export type DataRequestQueryType = 'none' | 'cohort' | 'data'; +export type DataSpecificationQueryType = 'none' | 'cohort' | 'data'; -export const dataRequestQueryLanguage = 'json-meql'; +export const dataSpecificationQueryLanguage = 'json-meql'; -export interface DataRequestQueryPayload { +export interface DataSpecificationQueryPayload { ruleId?: Uuid; representationId?: Uuid; - type: DataRequestQueryType; + type: DataSpecificationQueryType; condition: QueryCondition; } -export type DataRequestQuery = Required; +export type DataSpecificationQuery = Required; export type QueryOperator = | '=' @@ -407,6 +407,6 @@ export interface DataSchema { dataClasses: DataClassWithElements[]; } -export interface ForkDataRequestOptions { +export interface ForkDataSpecificationOptions { targetFolder?: Folder; } diff --git a/src/app/data-explorer/data-query-row/data-query-row.component.spec.ts b/src/app/data-explorer/data-query-row/data-query-row.component.spec.ts index a5e7f0c4..0d156e62 100644 --- a/src/app/data-explorer/data-query-row/data-query-row.component.spec.ts +++ b/src/app/data-explorer/data-query-row/data-query-row.component.spec.ts @@ -20,7 +20,7 @@ import { ComponentHarness, setupTestModuleForComponent, } from 'src/app/testing/testing.helpers'; -import { DataRequestQueryType } from '../data-explorer.types'; +import { DataSpecificationQueryType } from '../data-explorer.types'; import { DataQueryRowComponent } from './data-query-row.component'; @@ -40,7 +40,7 @@ describe('DataQueryRowComponent', () => { expect(harness.component.editRouterLink).toBeUndefined(); }); - it.each<[DataRequestQueryType | undefined, string | null]>([ + it.each<[DataSpecificationQueryType | undefined, string | null]>([ ['cohort', 'Cohort query'], ['data', 'Data query'], [undefined, null], diff --git a/src/app/data-explorer/data-query-row/data-query-row.component.ts b/src/app/data-explorer/data-query-row/data-query-row.component.ts index 99fa1066..1c4b207e 100644 --- a/src/app/data-explorer/data-query-row/data-query-row.component.ts +++ b/src/app/data-explorer/data-query-row/data-query-row.component.ts @@ -18,7 +18,7 @@ SPDX-License-Identifier: Apache-2.0 */ import { Component, Input } from '@angular/core'; import { RouterLinkRef } from 'src/app/shared/types/shared.types'; -import { DataRequestQueryType, QueryCondition } from '../data-explorer.types'; +import { DataSpecificationQueryType, QueryCondition } from '../data-explorer.types'; @Component({ selector: 'mdm-data-query-row', @@ -26,7 +26,7 @@ import { DataRequestQueryType, QueryCondition } from '../data-explorer.types'; styleUrls: ['./data-query-row.component.scss'], }) export class DataQueryRowComponent { - @Input() queryType?: DataRequestQueryType; + @Input() queryType?: DataSpecificationQueryType; @Input() condition?: QueryCondition; @Input() readOnly = false; @Input() createRouterLink?: RouterLinkRef; diff --git a/src/app/data-explorer/data-schema-row/data-schema-row.component.html b/src/app/data-explorer/data-schema-row/data-schema-row.component.html index d14b181f..a4f725e0 100644 --- a/src/app/data-explorer/data-schema-row/data-schema-row.component.html +++ b/src/app/data-explorer/data-schema-row/data-schema-row.component.html @@ -36,22 +36,24 @@

{{ dataSchema.schema.label }}

class="mdm-data-schema-row__header-button" color="primary" (click)="removeSchema()" - matTooltip="Remove from request" - matTooltipClass="mdm-request-icon-tooltip" - aria-label="Remove from request" + matTooltip="Remove from data specification" + matTooltipClass="mdm-data-specification-icon-tooltip" + aria-label="Remove from data specification" > - + [caption]="'Add to other data specifications'" + [suppressViewDataSpecificationsDialogButton]=" + suppressViewDataSpecificationsDialogButton + " + (dataSpecificationAddDelete)="handleDataSpecificationAddDelete($event)" + >
-
+
diff --git a/src/app/data-explorer/data-schema-row/data-schema-row.component.spec.ts b/src/app/data-explorer/data-schema-row/data-schema-row.component.spec.ts index 8de050d4..acfe9de8 100644 --- a/src/app/data-explorer/data-schema-row/data-schema-row.component.spec.ts +++ b/src/app/data-explorer/data-schema-row/data-schema-row.component.spec.ts @@ -17,7 +17,7 @@ limitations under the License. SPDX-License-Identifier: Apache-2.0 */ import { CatalogueItemDomainType } from '@maurodatamapper/mdm-resources'; -import { RequestElementAddDeleteEvent } from 'src/app/shared/data-element-in-request/data-element-in-request.component'; +import { DataSpecificationElementAddDeleteEvent } from '../../shared/data-element-in-data-specification/data-element-in-data-specification.component'; import { buildDataClass, buildDataElement, @@ -70,10 +70,10 @@ describe('DataSchemaRowComponent', () => { it('should create', () => { expect(harness.isComponentCreated).toBeTruthy(); expect(harness.component.dataSchema).toBeUndefined(); - expect(harness.component.suppressViewRequestsDialogButton).toBe(false); + expect(harness.component.suppressViewDataSpecificationsDialogButton).toBe(false); expect(harness.component.canDelete).toBe(true); expect(harness.component.sourceTargetIntersections).toStrictEqual({ - dataAccessRequests: [], + dataSpecifications: [], sourceTargetIntersections: [], }); }); @@ -191,8 +191,8 @@ describe('DataSchemaRowComponent', () => { isSelected: false, }; - it('should raise a request add or delete event', () => { - const event: RequestElementAddDeleteEvent = { + it('should raise a data specification add or delete event', () => { + const event: DataSpecificationElementAddDeleteEvent = { adding: true, dataModel: { label: 'model', @@ -201,9 +201,9 @@ describe('DataSchemaRowComponent', () => { dataElement, }; - const eventSpy = jest.spyOn(harness.component.requestAddDelete, 'emit'); + const eventSpy = jest.spyOn(harness.component.dataSpecificationAddDelete, 'emit'); - harness.component.handleRequestAddDelete(event); + harness.component.handleDataSpecificationAddDelete(event); expect(eventSpy).toHaveBeenCalledWith(event); }); diff --git a/src/app/data-explorer/data-schema-row/data-schema-row.component.ts b/src/app/data-explorer/data-schema-row/data-schema-row.component.ts index baefd653..935fe9d6 100644 --- a/src/app/data-explorer/data-schema-row/data-schema-row.component.ts +++ b/src/app/data-explorer/data-schema-row/data-schema-row.component.ts @@ -17,13 +17,13 @@ limitations under the License. SPDX-License-Identifier: Apache-2.0 */ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; -import { RequestElementAddDeleteEvent } from 'src/app/shared/data-element-in-request/data-element-in-request.component'; +import { DataSpecificationElementAddDeleteEvent } from '../../shared/data-element-in-data-specification/data-element-in-data-specification.component'; import { DataElementSearchResult, DataItemDeleteEvent, DataSchema, } from '../data-explorer.types'; -import { DataAccessRequestsSourceTargetIntersections } from '../data-requests.service'; +import { DataSpecificationSourceTargetIntersections } from '../data-specification.service'; import { DataSchemaService } from 'src/app/data-explorer/data-schema.service'; @Component({ @@ -33,12 +33,13 @@ import { DataSchemaService } from 'src/app/data-explorer/data-schema.service'; }) export class DataSchemaRowComponent implements OnInit { @Input() dataSchema?: DataSchema; - @Input() suppressViewRequestsDialogButton = false; + @Input() suppressViewDataSpecificationsDialogButton = false; @Input() canDelete = true; - @Input() sourceTargetIntersections: DataAccessRequestsSourceTargetIntersections; + @Input() sourceTargetIntersections: DataSpecificationSourceTargetIntersections; @Output() deleteItemEvent = new EventEmitter(); - @Output() requestAddDelete = new EventEmitter(); + @Output() dataSpecificationAddDelete = + new EventEmitter(); @Output() updateAllOrSomeChildrenSelected = new EventEmitter(); expanded = true; @@ -47,7 +48,7 @@ export class DataSchemaRowComponent implements OnInit { constructor(private dataSchemaService: DataSchemaService) { this.sourceTargetIntersections = { - dataAccessRequests: [], + dataSpecifications: [], sourceTargetIntersections: [], }; } @@ -64,8 +65,8 @@ export class DataSchemaRowComponent implements OnInit { this.expanded = !this.expanded; } - handleRequestAddDelete(event: RequestElementAddDeleteEvent) { - this.requestAddDelete.emit(event); + handleDataSpecificationAddDelete(event: DataSpecificationElementAddDeleteEvent) { + this.dataSpecificationAddDelete.emit(event); } handleDeleteItemEvent(event: DataItemDeleteEvent) { diff --git a/src/app/data-explorer/data-schema.service.spec.ts b/src/app/data-explorer/data-schema.service.spec.ts index 9014ec3b..6274ef6a 100644 --- a/src/app/data-explorer/data-schema.service.spec.ts +++ b/src/app/data-explorer/data-schema.service.spec.ts @@ -23,7 +23,11 @@ import { isDataModel } from '../mauro/mauro.types'; import { createDataModelServiceStub } from '../testing/stubs/data-model.stub'; import { buildDataClass, buildDataElement } from '../testing/stubs/data-schema.stub'; import { setupTestModuleForService } from '../testing/testing.helpers'; -import { DataClassWithElements, DataRequest, DataSchema } from './data-explorer.types'; +import { + DataClassWithElements, + DataSpecification, + DataSchema, +} from './data-explorer.types'; import { DataSchemaService } from './data-schema.service'; describe('DataSchemaService', () => { @@ -156,10 +160,10 @@ describe('DataSchemaService', () => { }); }); - it('should load all data schemas for a request', () => { - const request: DataRequest = { + it('should load all data schemas for a data specification', () => { + const dataSpecification: DataSpecification = { id: '123', - label: 'request', + label: 'data specification', domainType: CatalogueItemDomainType.DataModel, status: 'unsent', }; @@ -188,11 +192,11 @@ describe('DataSchemaService', () => { }); const expected$ = cold('-------(a|)', { a: schemas }); - const actual$ = service.loadDataSchemas(request); + const actual$ = service.loadDataSchemas(dataSpecification); expect(actual$).toBeObservable(expected$); expect(actual$).toSatisfyOnFlush(() => { - // Request - expect(dataModelsStub.getDataClasses).toHaveBeenNthCalledWith(1, request); + // Data specification + expect(dataModelsStub.getDataClasses).toHaveBeenNthCalledWith(1, dataSpecification); // Schemas expect(dataModelsStub.getDataClasses).toHaveBeenNthCalledWith( diff --git a/src/app/data-explorer/data-schema.service.ts b/src/app/data-explorer/data-schema.service.ts index 685074fe..3141160c 100644 --- a/src/app/data-explorer/data-schema.service.ts +++ b/src/app/data-explorer/data-schema.service.ts @@ -22,7 +22,7 @@ import { forkJoin, map, Observable, switchMap } from 'rxjs'; import { DataClassWithElements, DataElementSearchResult, - DataRequest, + DataSpecification, DataSchema, } from '../data-explorer/data-explorer.types'; import { DataModelService } from '../mauro/data-model.service'; @@ -37,8 +37,10 @@ export class DataSchemaService { * Gets all data classes (with elements as children) from a list of data schemas as a flat list. */ reduceDataClassesFromSchemas(dataSchemas: DataSchema[]): DataClassWithElements[] { - const dataRequestClasses = dataSchemas.map((dataSchema) => dataSchema.dataClasses); - return dataRequestClasses.reduce( + const dataSpecificationClasses = dataSchemas.map( + (dataSchema) => dataSchema.dataClasses + ); + return dataSpecificationClasses.reduce( (accumulator, value) => accumulator.concat(value), [] ); @@ -48,10 +50,10 @@ export class DataSchemaService { * Gets all data elements from a list of data schemas as a flat list. */ reduceDataElementsFromSchemas(dataSchemas: DataSchema[]): DataElementSearchResult[] { - const dataRequestElements = dataSchemas.map((dataSchema) => + const dataSpecificationElements = dataSchemas.map((dataSchema) => this.reduceDataElementsFromSchema(dataSchema) ); - return dataRequestElements.reduce( + return dataSpecificationElements.reduce( (accumulator, value) => accumulator.concat(value), [] ); @@ -70,8 +72,8 @@ export class DataSchemaService { ); } - loadDataSchemas(request: DataRequest): Observable { - return this.dataModels.getDataClasses(request as DataModel).pipe( + loadDataSchemas(dataSpecification: DataSpecification): Observable { + return this.dataModels.getDataClasses(dataSpecification as DataModel).pipe( switchMap((schemas) => { const dataSchema = schemas.map((schema) => { return this.loadDataClasses(schema).pipe( diff --git a/src/app/data-explorer/request-created-dialog/request-created-dialog.component.html b/src/app/data-explorer/data-specification-created-dialog/data-specification-created-dialog.component.html similarity index 75% rename from src/app/data-explorer/request-created-dialog/request-created-dialog.component.html rename to src/app/data-explorer/data-specification-created-dialog/data-specification-created-dialog.component.html index 0bd6f8ea..65424b65 100644 --- a/src/app/data-explorer/request-created-dialog/request-created-dialog.component.html +++ b/src/app/data-explorer/data-specification-created-dialog/data-specification-created-dialog.component.html @@ -16,7 +16,7 @@ SPDX-License-Identifier: Apache-2.0 --> -

New request '{{ name }}' created

+

New data specification '{{ name }}' created

{{ subHeading }}

    @@ -24,16 +24,20 @@

    New request '{{ name }}' created

- -
-

{{ request.description }}

+
+

{{ dataSpecification.description }}

-
+

No description provided

- + [status]="dataSpecification.status" + > diff --git a/src/app/data-explorer/data-request-row/data-request-row.component.scss b/src/app/data-explorer/data-specification-row/data-specification-row.component.scss similarity index 100% rename from src/app/data-explorer/data-request-row/data-request-row.component.scss rename to src/app/data-explorer/data-specification-row/data-specification-row.component.scss diff --git a/src/app/data-explorer/data-request-row/data-request-row.component.spec.ts b/src/app/data-explorer/data-specification-row/data-specification-row.component.spec.ts similarity index 80% rename from src/app/data-explorer/data-request-row/data-request-row.component.spec.ts rename to src/app/data-explorer/data-specification-row/data-specification-row.component.spec.ts index 6b659f89..f6465f2d 100644 --- a/src/app/data-explorer/data-request-row/data-request-row.component.spec.ts +++ b/src/app/data-explorer/data-specification-row/data-specification-row.component.spec.ts @@ -19,20 +19,20 @@ SPDX-License-Identifier: Apache-2.0 import { ComponentHarness, setupTestModuleForComponent, -} from 'src/app/testing/testing.helpers'; +} from '../../testing/testing.helpers'; -import { DataRequestRowComponent } from './data-request-row.component'; +import { DataSpecificationRowComponent } from './data-specification-row.component'; -describe('DataRequestRowComponent', () => { - let harness: ComponentHarness; +describe('DataSpecificationRowComponent', () => { + let harness: ComponentHarness; beforeEach(async () => { - harness = await setupTestModuleForComponent(DataRequestRowComponent); + harness = await setupTestModuleForComponent(DataSpecificationRowComponent); }); it('should create', () => { expect(harness.isComponentCreated).toBeTruthy(); - expect(harness.component.request).toBeUndefined(); + expect(harness.component.dataSpecification).toBeUndefined(); expect(harness.component.detailsRouterLink).toBeUndefined(); expect(harness.component.showStatus).toBe(true); expect(harness.component.showLabel).toBe(true); diff --git a/src/app/data-explorer/data-request-row/data-request-row.component.ts b/src/app/data-explorer/data-specification-row/data-specification-row.component.ts similarity index 77% rename from src/app/data-explorer/data-request-row/data-request-row.component.ts rename to src/app/data-explorer/data-specification-row/data-specification-row.component.ts index 7c838b5e..b12f5059 100644 --- a/src/app/data-explorer/data-request-row/data-request-row.component.ts +++ b/src/app/data-explorer/data-specification-row/data-specification-row.component.ts @@ -17,16 +17,16 @@ limitations under the License. SPDX-License-Identifier: Apache-2.0 */ import { Component, EventEmitter, Input, Output } from '@angular/core'; -import { RouterLinkRef } from 'src/app/shared/types/shared.types'; -import { DataRequest } from '../data-explorer.types'; +import { RouterLinkRef } from '../../shared/types/shared.types'; +import { DataSpecification } from '../data-explorer.types'; @Component({ - selector: 'mdm-data-request-row', - templateUrl: './data-request-row.component.html', - styleUrls: ['./data-request-row.component.scss'], + selector: 'mdm-data-specification-row', + templateUrl: './data-specification-row.component.html', + styleUrls: ['./data-specification-row.component.scss'], }) -export class DataRequestRowComponent { - @Input() request?: DataRequest; +export class DataSpecificationRowComponent { + @Input() dataSpecification?: DataSpecification; @Input() detailsRouterLink?: RouterLinkRef; @Input() showStatus = true; @Input() showLabel = true; diff --git a/src/app/data-explorer/request-status-chip/request-status-chip.component.html b/src/app/data-explorer/data-specification-status-chip/data-specification-status-chip.component.html similarity index 88% rename from src/app/data-explorer/request-status-chip/request-status-chip.component.html rename to src/app/data-explorer/data-specification-status-chip/data-specification-status-chip.component.html index ec491138..72307149 100644 --- a/src/app/data-explorer/request-status-chip/request-status-chip.component.html +++ b/src/app/data-explorer/data-specification-status-chip/data-specification-status-chip.component.html @@ -16,6 +16,6 @@ SPDX-License-Identifier: Apache-2.0 --> -
+
{{ status }}
diff --git a/src/app/data-explorer/request-status-chip/request-status-chip.component.scss b/src/app/data-explorer/data-specification-status-chip/data-specification-status-chip.component.scss similarity index 76% rename from src/app/data-explorer/request-status-chip/request-status-chip.component.scss rename to src/app/data-explorer/data-specification-status-chip/data-specification-status-chip.component.scss index ad439c24..fa6ce922 100644 --- a/src/app/data-explorer/request-status-chip/request-status-chip.component.scss +++ b/src/app/data-explorer/data-specification-status-chip/data-specification-status-chip.component.scss @@ -18,19 +18,19 @@ SPDX-License-Identifier: Apache-2.0 */ @import "../../../styles/base/all"; -.mdm-request-status-chip { +.mdm-data-specification-status-chip { display: inline-block; padding: 2px 8px; border-radius: 23px; margin: 5px 0 5px; &--unsent { - color: $color-unsentRequest-contrast; - background-color: $color-unsentRequest; + color: $color-unsentDataSpecification-contrast; + background-color: $color-unsentDataSpecification; } &--submitted { - color: $color-submittedRequest-contrast; - background-color: $color-submittedRequest; + color: $color-submittedDataSpecification-contrast; + background-color: $color-submittedDataSpecification; } } diff --git a/src/app/data-explorer/request-status-chip/request-status-chip.component.spec.ts b/src/app/data-explorer/data-specification-status-chip/data-specification-status-chip.component.spec.ts similarity index 71% rename from src/app/data-explorer/request-status-chip/request-status-chip.component.spec.ts rename to src/app/data-explorer/data-specification-status-chip/data-specification-status-chip.component.spec.ts index d44100da..94ab1d30 100644 --- a/src/app/data-explorer/request-status-chip/request-status-chip.component.spec.ts +++ b/src/app/data-explorer/data-specification-status-chip/data-specification-status-chip.component.spec.ts @@ -19,15 +19,15 @@ SPDX-License-Identifier: Apache-2.0 import { ComponentHarness, setupTestModuleForComponent, -} from 'src/app/testing/testing.helpers'; +} from '../../testing/testing.helpers'; -import { RequestStatusChipComponent } from './request-status-chip.component'; +import { DataSpecificationStatusChipComponent } from './data-specification-status-chip.component'; -describe('RequestStatusChipComponent', () => { - let harness: ComponentHarness; +describe('DataSpecificationStatusChipComponent', () => { + let harness: ComponentHarness; beforeEach(async () => { - harness = await setupTestModuleForComponent(RequestStatusChipComponent); + harness = await setupTestModuleForComponent(DataSpecificationStatusChipComponent); }); it('should create', () => { diff --git a/src/app/data-explorer/request-status-chip/request-status-chip.component.ts b/src/app/data-explorer/data-specification-status-chip/data-specification-status-chip.component.ts similarity index 64% rename from src/app/data-explorer/request-status-chip/request-status-chip.component.ts rename to src/app/data-explorer/data-specification-status-chip/data-specification-status-chip.component.ts index cdd3aed4..9b7d58fc 100644 --- a/src/app/data-explorer/request-status-chip/request-status-chip.component.ts +++ b/src/app/data-explorer/data-specification-status-chip/data-specification-status-chip.component.ts @@ -17,15 +17,15 @@ limitations under the License. SPDX-License-Identifier: Apache-2.0 */ import { Component, Input } from '@angular/core'; -import { DataRequestStatus } from '../data-explorer.types'; +import { DataSpecificationStatus } from '../data-explorer.types'; @Component({ - selector: 'mdm-request-status-chip', - templateUrl: './request-status-chip.component.html', - styleUrls: ['./request-status-chip.component.scss'], + selector: 'mdm-data-specification-status-chip', + templateUrl: './data-specification-status-chip.component.html', + styleUrls: ['./data-specification-status-chip.component.scss'], }) -export class RequestStatusChipComponent { - @Input() status?: DataRequestStatus; +export class DataSpecificationStatusChipComponent { + @Input() status?: DataSpecificationStatus; /** * Get the CSS class to use to represent status, mapped to an object that can be applied to @@ -33,8 +33,8 @@ export class RequestStatusChipComponent { */ get statusCssClassMap() { return { - 'mdm-request-status-chip--unsent': this.status === 'unsent', - 'mdm-request-status-chip--submitted': this.status === 'submitted', + 'mdm-data-specification-status-chip--unsent': this.status === 'unsent', + 'mdm-data-specification-status-chip--submitted': this.status === 'submitted', }; } } diff --git a/src/app/data-explorer/request-updated-dialog/request-updated-dialog.component.html b/src/app/data-explorer/data-specification-updated-dialog/data-specification-updated-dialog.component.html similarity index 85% rename from src/app/data-explorer/request-updated-dialog/request-updated-dialog.component.html rename to src/app/data-explorer/data-specification-updated-dialog/data-specification-updated-dialog.component.html index 143fc63f..5333859c 100644 --- a/src/app/data-explorer/request-updated-dialog/request-updated-dialog.component.html +++ b/src/app/data-explorer/data-specification-updated-dialog/data-specification-updated-dialog.component.html @@ -24,11 +24,15 @@

'{{ name }}' updated

- - diff --git a/src/app/data-explorer/edit-request-dialog/edit-request-dialog.component.scss b/src/app/data-explorer/edit-data-specification-dialog/edit-data-specification-dialog.component.scss similarity index 100% rename from src/app/data-explorer/edit-request-dialog/edit-request-dialog.component.scss rename to src/app/data-explorer/edit-data-specification-dialog/edit-data-specification-dialog.component.scss diff --git a/src/app/data-explorer/edit-request-dialog/edit-request-dialog.component.spec.ts b/src/app/data-explorer/edit-data-specification-dialog/edit-data-specification-dialog.component.spec.ts similarity index 74% rename from src/app/data-explorer/edit-request-dialog/edit-request-dialog.component.spec.ts rename to src/app/data-explorer/edit-data-specification-dialog/edit-data-specification-dialog.component.spec.ts index 1f277282..a96e77cf 100644 --- a/src/app/data-explorer/edit-request-dialog/edit-request-dialog.component.spec.ts +++ b/src/app/data-explorer/edit-data-specification-dialog/edit-data-specification-dialog.component.spec.ts @@ -27,45 +27,45 @@ import { import { MatFormField, MatLabel } from '@angular/material/form-field'; import { MockComponent, MockDirective } from 'ng-mocks'; import { Observable, of } from 'rxjs'; -import { dontAllowDuplicatedNames } from 'src/app/shared/mdm-validators'; -import { createDataRequestsServiceStub } from 'src/app/testing/stubs/data-requests.stub'; +import { dontAllowDuplicatedNames } from '../../shared/mdm-validators'; +import { createDataSpecificationServiceStub } from '../../testing/stubs/data-specifications.stub'; import { createMatDialogRefStub, createMatDialogStub, -} from 'src/app/testing/stubs/mat-dialog.stub'; +} from '../../testing/stubs/mat-dialog.stub'; import { ComponentHarness, setupTestModuleForComponent, -} from 'src/app/testing/testing.helpers'; -import { DataRequestsService } from '../data-requests.service'; +} from '../../testing/testing.helpers'; +import { DataSpecificationService } from '../data-specification.service'; import { OkCancelDialogResponse } from '../ok-cancel-dialog/ok-cancel-dialog.component'; import { - EditRequestDialogComponent, - EditRequestDialogOptions, - EditRequestDialogResponse, -} from './edit-request-dialog.component'; - -describe('EditRequestDialogComponent', () => { - let harness: ComponentHarness; - const dialogRefStub = createMatDialogRefStub(); - const dataRequestsStub = createDataRequestsServiceStub(); + EditDataSpecificationDialogComponent, + EditDataSpecificationDialogOptions, + EditDataSpecificationDialogResponse, +} from './edit-data-specification-dialog.component'; + +describe('EditDataSpecificationDialogComponent', () => { + let harness: ComponentHarness; + const dialogRefStub = createMatDialogRefStub(); + const dataSpecificationStub = createDataSpecificationServiceStub(); const dialogsStub = createMatDialogStub(); - dataRequestsStub.isDataRequestNameAvailable.mockImplementation( + dataSpecificationStub.isDataSpecificationNameAvailable.mockImplementation( (): Observable => { return of(true); } ); const label = 'label 1'; const description = 'description'; - const requestData: EditRequestDialogOptions = { - requestName: label, - requestDescription: description, + const dataSpecificationData: EditDataSpecificationDialogOptions = { + dataSpecificationName: label, + dataSpecificationDescription: description, }; beforeEach(async () => { - harness = await setupTestModuleForComponent(EditRequestDialogComponent, { + harness = await setupTestModuleForComponent(EditDataSpecificationDialogComponent, { declarations: [ MockDirective(MatDialogContent), MockDirective(MatDialogActions), @@ -78,12 +78,12 @@ describe('EditRequestDialogComponent', () => { useValue: dialogRefStub, }, { - provide: DataRequestsService, - useValue: dataRequestsStub, + provide: DataSpecificationService, + useValue: dataSpecificationStub, }, { provide: MAT_DIALOG_DATA, - useValue: requestData, + useValue: dataSpecificationData, }, { provide: MatDialog, @@ -100,7 +100,7 @@ describe('EditRequestDialogComponent', () => { it('should create', () => { // Assert expect(harness.isComponentCreated).toBeTruthy(); - expect(harness.component.requestForm).toBeUndefined(); + expect(harness.component.dataSpecificationForm).toBeUndefined(); }); it('should initialise', () => { @@ -108,7 +108,7 @@ describe('EditRequestDialogComponent', () => { harness.component.ngOnInit(); // Assert - expect(harness.component.requestForm).toBeDefined(); + expect(harness.component.dataSpecificationForm).toBeDefined(); expect(harness.component.name?.value).toBe(label); expect(harness.component.name?.hasValidator(Validators.required)).toBeTruthy(); // eslint-disable-line @typescript-eslint/unbound-method expect(harness.component.description?.value).toBe(description); @@ -123,7 +123,7 @@ describe('EditRequestDialogComponent', () => { expect( harness.component.name?.hasAsyncValidator( dontAllowDuplicatedNames( - dataRequestsStub as unknown as DataRequestsService, + dataSpecificationStub as unknown as DataSpecificationService, label ) ) @@ -149,7 +149,7 @@ describe('EditRequestDialogComponent', () => { const okCancelResponse: OkCancelDialogResponse = { result: true, }; - dataRequestsStub.isDataRequestNameAvailable.mockImplementation( + dataSpecificationStub.isDataSpecificationNameAvailable.mockImplementation( (): Observable => { return of(true); } @@ -187,13 +187,13 @@ describe('EditRequestDialogComponent', () => { it('should update when form is valid', () => { // Arrange - dataRequestsStub.isDataRequestNameAvailable.mockImplementation( + dataSpecificationStub.isDataSpecificationNameAvailable.mockImplementation( (): Observable => { return of(true); } ); - const expected: EditRequestDialogResponse = { - name: 'Test request', + const expected: EditDataSpecificationDialogResponse = { + name: 'Test data specification', description: 'Test description', }; diff --git a/src/app/data-explorer/edit-request-dialog/edit-request-dialog.component.ts b/src/app/data-explorer/edit-data-specification-dialog/edit-data-specification-dialog.component.ts similarity index 65% rename from src/app/data-explorer/edit-request-dialog/edit-request-dialog.component.ts rename to src/app/data-explorer/edit-data-specification-dialog/edit-data-specification-dialog.component.ts index 30005390..afbdd17a 100644 --- a/src/app/data-explorer/edit-request-dialog/edit-request-dialog.component.ts +++ b/src/app/data-explorer/edit-data-specification-dialog/edit-data-specification-dialog.component.ts @@ -19,56 +19,59 @@ SPDX-License-Identifier: Apache-2.0 import { Component, Inject, OnInit, Optional } from '@angular/core'; import { FormControl, FormGroup, Validators } from '@angular/forms'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; -import { DataRequestsService } from 'src/app/data-explorer/data-requests.service'; -import { dontAllowDuplicatedNames } from 'src/app/shared/mdm-validators'; +import { DataSpecificationService } from '../data-specification.service'; +import { dontAllowDuplicatedNames } from '../../shared/mdm-validators'; import { DialogService } from '../dialog.service'; -export interface EditRequestDialogOptions { - requestName: string; - requestDescription?: string; +export interface EditDataSpecificationDialogOptions { + dataSpecificationName: string; + dataSpecificationDescription?: string; } -export interface EditRequestDialogResponse { +export interface EditDataSpecificationDialogResponse { name: string; description: string; } @Component({ - selector: 'mdm-edit-request-dialog', - templateUrl: './edit-request-dialog.component.html', - styleUrls: ['./edit-request-dialog.component.scss'], + selector: 'mdm-edit-data-specification-dialog', + templateUrl: './edit-data-specification-dialog.component.html', + styleUrls: ['./edit-data-specification-dialog.component.scss'], }) -export class EditRequestDialogComponent implements OnInit { - requestForm!: FormGroup; +export class EditDataSpecificationDialogComponent implements OnInit { + dataSpecificationForm!: FormGroup; initialDescription?: string; initialName?: string; constructor( - public dialogRef: MatDialogRef, - private dataRequests: DataRequestsService, + public dialogRef: MatDialogRef< + EditDataSpecificationDialogComponent, + EditDataSpecificationDialogResponse + >, + private dataSpecifications: DataSpecificationService, private dialogs: DialogService, - @Inject(MAT_DIALOG_DATA) @Optional() private data: EditRequestDialogOptions + @Inject(MAT_DIALOG_DATA) @Optional() private data: EditDataSpecificationDialogOptions ) {} get name() { - return this.requestForm.get('name'); + return this.dataSpecificationForm.get('name'); } get description() { - return this.requestForm.get('description'); + return this.dataSpecificationForm.get('description'); } ngOnInit(): void { - this.initialDescription = this.data.requestDescription; - this.initialName = this.data.requestName; + this.initialDescription = this.data.dataSpecificationDescription; + this.initialName = this.data.dataSpecificationName; - this.requestForm = new FormGroup({ + this.dataSpecificationForm = new FormGroup({ name: new FormControl( this.initialName, [ Validators.required, // eslint-disable-line @typescript-eslint/unbound-method ], - dontAllowDuplicatedNames(this.dataRequests, this.initialName) + dontAllowDuplicatedNames(this.dataSpecifications, this.initialName) ), description: new FormControl(this.initialDescription), @@ -108,7 +111,7 @@ export class EditRequestDialogComponent implements OnInit { } update() { - if (this.requestForm.invalid) { + if (this.dataSpecificationForm.invalid) { return; } diff --git a/src/app/data-explorer/query-builder.service.spec.ts b/src/app/data-explorer/query-builder.service.spec.ts index 6e2a570a..99338440 100644 --- a/src/app/data-explorer/query-builder.service.spec.ts +++ b/src/app/data-explorer/query-builder.service.spec.ts @@ -30,7 +30,7 @@ import { ProfileService } from '../mauro/profile.service'; import { QueryBuilderService, QueryConfiguration } from './query-builder.service'; import { DataElementSearchResult, - DataRequestQueryPayload, + DataSpecificationQueryPayload, } from '../data-explorer/data-explorer.types'; import { QueryBuilderConfig } from 'angular2-query-builder'; import { createProfileServiceStub } from '../testing/stubs/profile.stub'; @@ -368,7 +368,7 @@ describe('QueryBuilderService', () => { } as DataElementSearchResult, ]; - const expectedQuery: DataRequestQueryPayload | undefined = isReferencedInQuery + const expectedQuery: DataSpecificationQueryPayload | undefined = isReferencedInQuery ? ({ condition: { condition: 'and', @@ -380,7 +380,7 @@ describe('QueryBuilderService', () => { }, ], }, - } as DataRequestQueryPayload) + } as DataSpecificationQueryPayload) : undefined; const expectedQueryBuilderConfig: QueryBuilderConfig = { @@ -464,7 +464,8 @@ describe('QueryBuilderService', () => { const expectedResult: QueryConfiguration = { dataElementSearchResult: expectedDataElementSearchResult, - dataRequestQueryPayload: expectedQuery as Required, + dataSpecificationQueryPayload: + expectedQuery as Required, config: expectedQueryBuilderConfig, }; diff --git a/src/app/data-explorer/query-builder.service.ts b/src/app/data-explorer/query-builder.service.ts index f5988401..0f0ec6d2 100644 --- a/src/app/data-explorer/query-builder.service.ts +++ b/src/app/data-explorer/query-builder.service.ts @@ -27,7 +27,7 @@ import { QueryBuilderConfig } from 'angular2-query-builder'; import { catchError, forkJoin, map, Observable, of } from 'rxjs'; import { DataElementSearchResult, - DataRequestQueryPayload, + DataSpecificationQueryPayload, QueryCondition, QueryExpression, } from '../data-explorer/data-explorer.types'; @@ -36,7 +36,7 @@ import { ProfileService } from '../mauro/profile.service'; export interface QueryConfiguration { dataElementSearchResult: DataElementSearchResult[]; - dataRequestQueryPayload: Required | undefined; + dataSpecificationQueryPayload: Required | undefined; config: QueryBuilderConfig; } @@ -70,9 +70,9 @@ export class QueryBuilderService { public setupConfig( dataElements: DataElementSearchResult[], - query?: DataRequestQueryPayload + query?: DataSpecificationQueryPayload ): Observable { - const requests$ = dataElements.map((dataElement) => { + const dataSpecifications$ = dataElements.map((dataElement) => { const profile$ = this.getQueryBuilderDatatype(dataElement.dataType).pipe( catchError((error) => { if (error.status === 404) { @@ -88,7 +88,7 @@ export class QueryBuilderService { return forkJoin([profile$, dataElement$]); }); - return forkJoin(requests$).pipe( + return forkJoin(dataSpecifications$).pipe( map((items) => { return this.getQueryFields(items, dataElements, query); }) @@ -173,7 +173,7 @@ export class QueryBuilderService { : null; } - private getQueryCondition(query?: DataRequestQueryPayload): QueryCondition { + private getQueryCondition(query?: DataSpecificationQueryPayload): QueryCondition { return query ? query.condition : { @@ -219,7 +219,7 @@ export class QueryBuilderService { private getQueryFields( items: [Profile, DataElementSearchResult][], dataElements: DataElementSearchResult[], - query?: DataRequestQueryPayload + query?: DataSpecificationQueryPayload ): QueryConfiguration { const queryCondition: QueryCondition = this.getQueryCondition(query); @@ -257,7 +257,7 @@ export class QueryBuilderService { return { dataElementSearchResult: dataElements, - dataRequestQueryPayload: query as Required, + dataSpecificationQueryPayload: query as Required, config, }; } diff --git a/src/app/data-explorer/selection-compact/selection-compact.component.ts b/src/app/data-explorer/selection-compact/selection-compact.component.ts index 6bb9c034..16d4c028 100644 --- a/src/app/data-explorer/selection-compact/selection-compact.component.ts +++ b/src/app/data-explorer/selection-compact/selection-compact.component.ts @@ -20,7 +20,7 @@ import { Component, Input } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { Observable } from 'rxjs'; import { DataElementSearchResult } from '../data-explorer.types'; -import { DataAccessRequestsSourceTargetIntersections } from '../data-requests.service'; +import { DataSpecificationSourceTargetIntersections } from '../data-specification.service'; import { SelectionExpandedDialogComponent, SelectionExpandedDialogData, @@ -33,12 +33,12 @@ import { SelectionService } from '../selection.service'; styleUrls: ['./selection-compact.component.scss'], }) export class SelectionCompactComponent { - @Input() sourceTargetIntersections: DataAccessRequestsSourceTargetIntersections; + @Input() sourceTargetIntersections: DataSpecificationSourceTargetIntersections; selectedElements$: Observable; constructor(private selectionService: SelectionService, private matDialog: MatDialog) { this.sourceTargetIntersections = { - dataAccessRequests: [], + dataSpecifications: [], sourceTargetIntersections: [], }; this.selectedElements$ = this.selectionService.list$; diff --git a/src/app/data-explorer/selection-expanded-dialog/selection-expanded-dialog.component.ts b/src/app/data-explorer/selection-expanded-dialog/selection-expanded-dialog.component.ts index d4f53e7c..6ee0eee0 100644 --- a/src/app/data-explorer/selection-expanded-dialog/selection-expanded-dialog.component.ts +++ b/src/app/data-explorer/selection-expanded-dialog/selection-expanded-dialog.component.ts @@ -21,11 +21,11 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { Uuid } from '@maurodatamapper/mdm-resources'; import { Observable } from 'rxjs'; import { DataElementSearchResult } from '../data-explorer.types'; -import { DataAccessRequestsSourceTargetIntersections } from '../data-requests.service'; +import { DataSpecificationSourceTargetIntersections } from '../data-specification.service'; import { SelectionService } from '../selection.service'; export interface SelectionExpandedDialogData { - sourceTargetIntersections: DataAccessRequestsSourceTargetIntersections; + sourceTargetIntersections: DataSpecificationSourceTargetIntersections; } @Component({ @@ -35,7 +35,7 @@ export interface SelectionExpandedDialogData { }) export class SelectionExpandedDialogComponent { selectedElements$: Observable; - sourceTargetIntersections: DataAccessRequestsSourceTargetIntersections; + sourceTargetIntersections: DataSpecificationSourceTargetIntersections; constructor( public dialogRef: MatDialogRef, private selectionService: SelectionService, diff --git a/src/app/mauro/data-model.service.spec.ts b/src/app/mauro/data-model.service.spec.ts index 6bce1097..ccc9ed89 100644 --- a/src/app/mauro/data-model.service.spec.ts +++ b/src/app/mauro/data-model.service.spec.ts @@ -779,7 +779,7 @@ describe('DataModelService', () => { assert(expectedModel.id, 'expected model id is null'); return; } - const request: ModelUpdatePayload = { + const dataSpecification: ModelUpdatePayload = { domainType: CatalogueItemDomainType.DataModel, id: expectedModel.id, label, @@ -789,7 +789,7 @@ describe('DataModelService', () => { const expected$ = cold('--a|', { a: expectedModel }); // Act - const actual$ = service.update(expectedModel.id, request); + const actual$ = service.update(expectedModel.id, dataSpecification); // Assert expect(actual$).toBeObservable(expected$); @@ -801,7 +801,7 @@ describe('DataModelService', () => { const emptyId = ''; - const request: ModelUpdatePayload = { + const dataSpecification: ModelUpdatePayload = { domainType: CatalogueItemDomainType.DataModel, id: '1', label: 'label', @@ -809,7 +809,7 @@ describe('DataModelService', () => { }; // Act - const actual$ = service.update(emptyId, request); + const actual$ = service.update(emptyId, dataSpecification); // Assert expect(actual$).toBeObservable(expected$); @@ -821,7 +821,7 @@ describe('DataModelService', () => { const emptyId = ''; - const request: ModelUpdatePayload = { + const dataSpecification: ModelUpdatePayload = { domainType: CatalogueItemDomainType.DataModel, id: emptyId, label: 'label', @@ -829,7 +829,7 @@ describe('DataModelService', () => { }; // Act - const actual$ = service.update('1', request); + const actual$ = service.update('1', dataSpecification); // Assert expect(actual$).toBeObservable(expected$); diff --git a/src/app/mauro/plugins/plugin-research.resource.ts b/src/app/mauro/plugins/plugin-research.resource.ts index 4da7f8b6..44fd0998 100644 --- a/src/app/mauro/plugins/plugin-research.resource.ts +++ b/src/app/mauro/plugins/plugin-research.resource.ts @@ -60,21 +60,21 @@ export class MdmPluginResearchResource extends MdmResource { } /** - * `HTTP PUT` - Submit an access request to the data owner for further processing. + * `HTTP PUT` - Submit a data specification access request to the data owner for further processing. * - * @param id The unique identifier of the Data Request (Data Model) to submit. + * @param id The unique identifier of the Data Specification (Data Model) to submit. * @param options Optional REST handler parameters, if required. * @returns The result of the `PUT` request: * * `200 OK` - will return an empty response. The HTTP status explains that it was successful. */ - submitRequest(id: Uuid, options?: RequestSettings) { + submitDataSpecification(id: Uuid, options?: RequestSettings) { const url = `${this.apiEndpoint}/researchAccessRequest/${id}`; return this.simplePut(url, null, options); } /** - * `HTTP POST` - Get, or create if none exists, a folder in which to keep a user's requests + * `HTTP POST` - Get, or create if none exists, a folder in which to keep a user's data specifications * * @param options Optional REST handler parameters, if required. * @returns The result of the `POST` request: @@ -87,7 +87,7 @@ export class MdmPluginResearchResource extends MdmResource { } /** - * `HTTP GET` - Get the root folder where template requests are held. + * `HTTP GET` - Get the root folder where template data specifications are held. * * @param options Optional REST handler parameters, if required. * @returns The result of the `POST` request: diff --git a/src/app/mauro/research-plugin.service.spec.ts b/src/app/mauro/research-plugin.service.spec.ts index 12409d1c..f0d0aaaa 100644 --- a/src/app/mauro/research-plugin.service.spec.ts +++ b/src/app/mauro/research-plugin.service.spec.ts @@ -64,20 +64,22 @@ describe('ResearchPluginService', () => { expect(actual$).toBeObservable(expected$); }); - it('should submit a data request', () => { + it('should submit a data specification', () => { const id = '123'; const dataModel: DataModelDetail = { id, - label: 'test request', + label: 'test data specification', domainType: CatalogueItemDomainType.DataModel, availableActions: ['show'], finalised: true, }; - endpointsStub.pluginResearch.submitRequest.mockImplementationOnce((ident) => { - expect(ident).toBe(id); - return cold('--a|', { a: { body: {} } }); - }); + endpointsStub.pluginResearch.submitDataSpecification.mockImplementationOnce( + (ident) => { + expect(ident).toBe(id); + return cold('--a|', { a: { body: {} } }); + } + ); endpointsStub.dataModel.get.mockImplementationOnce((ident) => { expect(ident).toBe(id); @@ -85,7 +87,7 @@ describe('ResearchPluginService', () => { }); const expected$ = cold('----a|', { a: dataModel }); - const actual$ = service.submitRequest(id); + const actual$ = service.submitDataSpecification(id); expect(actual$).toBeObservable(expected$); }); }); diff --git a/src/app/mauro/research-plugin.service.ts b/src/app/mauro/research-plugin.service.ts index 3ab69861..5c90198f 100644 --- a/src/app/mauro/research-plugin.service.ts +++ b/src/app/mauro/research-plugin.service.ts @@ -45,8 +45,8 @@ export class ResearchPluginService { .pipe(map((response: PluginResearchContactResponse) => response.body)); } - submitRequest(id: Uuid): Observable { - return this.endpoints.pluginResearch.submitRequest(id).pipe( + submitDataSpecification(id: Uuid): Observable { + return this.endpoints.pluginResearch.submitDataSpecification(id).pipe( switchMap(() => this.endpoints.dataModel.get(id)), map((response: DataModelDetailResponse) => response.body) ); diff --git a/src/app/pages/browse/browse.component.html b/src/app/pages/browse/browse.component.html index 5deecfbb..18f78eda 100644 --- a/src/app/pages/browse/browse.component.html +++ b/src/app/pages/browse/browse.component.html @@ -101,8 +101,13 @@

Browse the catalogue

-
diff --git a/src/app/pages/browse/browse.component.spec.ts b/src/app/pages/browse/browse.component.spec.ts index 6b7fe7bb..38c2dbb0 100644 --- a/src/app/pages/browse/browse.component.spec.ts +++ b/src/app/pages/browse/browse.component.spec.ts @@ -41,15 +41,15 @@ import { MatDialog } from '@angular/material/dialog'; import { MatMenu } from '@angular/material/menu'; import { createDataExplorerServiceStub } from 'src/app/testing/stubs/data-explorer.stub'; import { DataExplorerService } from 'src/app/data-explorer/data-explorer.service'; -import { createDataRequestsServiceStub } from 'src/app/testing/stubs/data-requests.stub'; -import { DataRequestsService } from 'src/app/data-explorer/data-requests.service'; +import { createDataSpecificationServiceStub } from 'src/app/testing/stubs/data-specifications.stub'; +import { DataSpecificationService } from 'src/app/data-explorer/data-specification.service'; import { createSecurityServiceStub } from 'src/app/testing/stubs/security.stub'; import { SecurityService } from 'src/app/security/security.service'; import { UserDetails } from 'src/app/security/user-details.service'; import { DataElementDto, DataElementInstance, - DataRequest, + DataSpecification, } from 'src/app/data-explorer/data-explorer.types'; import { createBroadcastServiceStub } from 'src/app/testing/stubs/broadcast.stub'; import { BroadcastService } from 'src/app/core/broadcast.service'; @@ -61,7 +61,7 @@ describe('BrowseComponent', () => { const stateRouterStub = createStateRouterStub(); const toastrStub = createToastrServiceStub(); const matDialogStub = createMatDialogStub(); - const dataRequestsStub = createDataRequestsServiceStub(); + const dataSpecificationStub = createDataSpecificationServiceStub(); const securityStub = createSecurityServiceStub(); const broadcastStub = createBroadcastServiceStub(); @@ -111,8 +111,8 @@ describe('BrowseComponent', () => { useValue: matDialogStub, }, { - provide: DataRequestsService, - useValue: dataRequestsStub, + provide: DataSpecificationService, + useValue: dataSpecificationStub, }, { provide: SecurityService, @@ -379,7 +379,7 @@ describe('BrowseComponent', () => { }); }); - describe('create request from data class', () => { + describe('create data specification from data class', () => { const selected: DataClass = { id: '123', label: 'test class', @@ -398,12 +398,12 @@ describe('BrowseComponent', () => { }, ]; - const dataRequest = { id: '999' } as DataRequest; + const dataSpecification = { id: '999' } as DataSpecification; - dataRequestsStub.createWithDialogs.mockImplementation(() => { + dataSpecificationStub.createWithDialogs.mockImplementation(() => { return of({ - dataRequest, - action: 'view-requests', + dataSpecification, + action: 'view-data-specifications', }); }); @@ -411,7 +411,7 @@ describe('BrowseComponent', () => { const navigateToSpy = jest.spyOn(stateRouterStub, 'navigateTo'); beforeEach(() => { - dataRequestsStub.createWithDialogs.mockClear(); + dataSpecificationStub.createWithDialogs.mockClear(); broadcastStub.loading.mockClear(); toastrStub.error.mockClear(); navigateKnownSpy.mockClear(); @@ -430,49 +430,52 @@ describe('BrowseComponent', () => { const spy = jest.spyOn(toastrStub, 'error'); // act - harness.component.createRequest(); + harness.component.createDataSpecification(); // assert expect(spy).toHaveBeenCalledWith( - 'You must have selected an element to create a request with.' + 'You must have selected an element to create a data specification with.' ); }); - it('should transition to requests page if RequestCreatedAction is \'view-requests\'', () => { + it('should transition to dataSpecifications page if DataSpecificationCreatedAction is \'view-data-specifications\'', () => { // act - harness.component.createRequest(); + harness.component.createDataSpecification(); // assert - expect(navigateKnownSpy).toHaveBeenCalledWith('/requests'); + expect(navigateKnownSpy).toHaveBeenCalledWith('/dataSpecifications'); }); - it('should transition to request detail page if RequestCreatedAction is \'view-request-detail\'', () => { + it('should transition to data specification detail page if DataSpecificationCreatedAction is \'view-data-specification-detail\'', () => { // arrange - dataRequestsStub.createWithDialogs.mockImplementationOnce(() => { + dataSpecificationStub.createWithDialogs.mockImplementationOnce(() => { return of({ - dataRequest, - action: 'view-request-detail', + dataSpecification, + action: 'view-data-specification-detail', }); }); // act - harness.component.createRequest(); + harness.component.createDataSpecification(); // assert - expect(navigateToSpy).toHaveBeenCalledWith(['/requests', dataRequest.id]); + expect(navigateToSpy).toHaveBeenCalledWith([ + '/dataSpecifications', + dataSpecification.id, + ]); }); - it('should not transition to requests page if RequestCreatedAction is \'continue\'', () => { + it('should not transition to dataSpecifications page if DataSpecificationCreatedAction is \'continue\'', () => { // arrange - dataRequestsStub.createWithDialogs.mockImplementationOnce(() => { + dataSpecificationStub.createWithDialogs.mockImplementationOnce(() => { return of({ - dataRequest, + dataSpecification, action: 'continue', }); }); // act - harness.component.createRequest(); + harness.component.createDataSpecification(); // assert expect(navigateKnownSpy).not.toHaveBeenCalled(); @@ -480,7 +483,7 @@ describe('BrowseComponent', () => { it('should use the provided callback function to retrieve the dataElements to add', () => { // arrange - const createSpy = jest.spyOn(dataRequestsStub, 'createWithDialogs'); + const createSpy = jest.spyOn(dataSpecificationStub, 'createWithDialogs'); const expectedDataElements = dataElements.map((de) => { return { ...de, @@ -488,15 +491,15 @@ describe('BrowseComponent', () => { } as DataElementInstance; }); - dataRequestsStub.createWithDialogs.mockImplementationOnce(() => { + dataSpecificationStub.createWithDialogs.mockImplementationOnce(() => { return of({ - dataRequest, - action: 'view-requests', + dataSpecification, + action: 'view-data-specifications', }); }); // act - harness.component.createRequest(); + harness.component.createDataSpecification(); // assert @@ -504,7 +507,7 @@ describe('BrowseComponent', () => { // createSpy.mock.calls is an array containing the call arguments of all calls that have been made to this mock function. // Each item in the array is an array of arguments that were passed during the call. For example, createSpy.mock.calls[0][0] // gets the first argument of the first call to this mock function. In this case, this is the callback function used to retrieve - // the Observable containing the dataElements to be added to the new request. + // the Observable containing the dataElements to be added to the new data specification. const call = createSpy.mock.calls[0]; const callback = call[0]; let returnedDataElements; diff --git a/src/app/pages/browse/browse.component.ts b/src/app/pages/browse/browse.component.ts index 0bb964a3..e4e619b6 100644 --- a/src/app/pages/browse/browse.component.ts +++ b/src/app/pages/browse/browse.component.ts @@ -30,7 +30,7 @@ import { mapSearchParametersToParams, } from 'src/app/data-explorer/data-explorer.types'; import { UserDetails } from 'src/app/security/user-details.service'; -import { DataRequestsService } from 'src/app/data-explorer/data-requests.service'; +import { DataSpecificationService } from 'src/app/data-explorer/data-specification.service'; import { DataExplorerService } from 'src/app/data-explorer/data-explorer.service'; import { SecurityService } from 'src/app/security/security.service'; import { Uuid } from '@maurodatamapper/mdm-resources'; @@ -47,14 +47,14 @@ export class BrowseComponent implements OnInit { static readonly ChildDataClassParentClassSelectedLabel: string = 'Please select a data class …'; static readonly ChildDataClassSelectedLabel: string = 'Data classes'; - readonly suppressViewRequestsDialogButton = false; + readonly suppressViewDataSpecificationsDialogButton = false; parentDataClasses: DataClass[] = []; childDataClasses: DataClass[] = []; selected?: DataClass; private user: UserDetails | null; constructor( - private dataRequests: DataRequestsService, + private dataSpecification: DataSpecificationService, private dataExplorer: DataExplorerService, private dataModels: DataModelService, private toastr: ToastrService, @@ -90,14 +90,16 @@ export class BrowseComponent implements OnInit { this.loadParentDataClasses(); } - createRequest() { + createDataSpecification() { if (!this.user) { - this.toastr.error('You must be signed in in order to create data requests.'); + this.toastr.error('You must be signed in in order to create data specifications.'); return; } if (!this.selected) { - this.toastr.error('You must have selected an element to create a request with.'); + this.toastr.error( + 'You must have selected an element to create a data specification with.' + ); return; } @@ -116,14 +118,17 @@ export class BrowseComponent implements OnInit { ); }; - this.dataRequests - .createWithDialogs(getDataElements, this.suppressViewRequestsDialogButton) + this.dataSpecification + .createWithDialogs(getDataElements, this.suppressViewDataSpecificationsDialogButton) .subscribe((response) => { console.log(response); - if (response.action === 'view-requests') { - this.stateRouter.navigateToKnownPath('/requests'); - } else if (response.action === 'view-request-detail') { - this.stateRouter.navigateTo(['/requests', response.dataRequest.id]); + if (response.action === 'view-data-specifications') { + this.stateRouter.navigateToKnownPath('/dataSpecifications'); + } else if (response.action === 'view-data-specification-detail') { + this.stateRouter.navigateTo([ + '/dataSpecifications', + response.dataSpecification.id, + ]); } }); } diff --git a/src/app/pages/dashboard/dashboard.component.html b/src/app/pages/dashboard/dashboard.component.html index 06c21738..7dfc059c 100644 --- a/src/app/pages/dashboard/dashboard.component.html +++ b/src/app/pages/dashboard/dashboard.component.html @@ -51,9 +51,9 @@

Search our catalogue

-

Your current data requests

+

Your current data specifications

What are requests? What are data specifications?

@@ -64,23 +64,28 @@

Your current data requests

Search or browse our catalogue to identify further data points of interest. You can also use our - request templates, curated to represent common - scenarios, as a starting point for your own data requests. + data specification templates, curated to represent + common scenarios, as a starting point for your own data specifications.

-

- No active requests yet? Search the catalogue to start, or review our templates. +

+ No active data specifications yet? Search the catalogue to start, or review our + templates.

-
- - +
+ +
-

{{ request.label }}

+

{{ dataSpecification.label }}

- {{ request.description }} + {{ dataSpecification.description }}

diff --git a/src/app/pages/dashboard/dashboard.component.scss b/src/app/pages/dashboard/dashboard.component.scss index 65a9d8fb..5652b2a9 100644 --- a/src/app/pages/dashboard/dashboard.component.scss +++ b/src/app/pages/dashboard/dashboard.component.scss @@ -33,7 +33,7 @@ SPDX-License-Identifier: Apache-2.0 margin-top: 2em; } - &__request-card { + &__data-specification-card { background-color: $color-white; border: 1px solid #e5e5e5; border-radius: 10px; diff --git a/src/app/pages/dashboard/dashboard.component.spec.ts b/src/app/pages/dashboard/dashboard.component.spec.ts index a4ce443d..88bc6f09 100644 --- a/src/app/pages/dashboard/dashboard.component.spec.ts +++ b/src/app/pages/dashboard/dashboard.component.spec.ts @@ -23,11 +23,11 @@ import { ToastrService } from 'ngx-toastr'; import { Carousel } from 'primeng/carousel'; import { of, throwError } from 'rxjs'; import { StateRouterService } from 'src/app/core/state-router.service'; -import { DataRequest } from 'src/app/data-explorer/data-explorer.types'; -import { DataRequestsService } from 'src/app/data-explorer/data-requests.service'; +import { DataSpecification } from 'src/app/data-explorer/data-explorer.types'; +import { DataSpecificationService } from 'src/app/data-explorer/data-specification.service'; import { SecurityService } from 'src/app/security/security.service'; import { UserDetails } from 'src/app/security/user-details.service'; -import { createDataRequestsServiceStub } from 'src/app/testing/stubs/data-requests.stub'; +import { createDataSpecificationServiceStub } from 'src/app/testing/stubs/data-specifications.stub'; import { createSecurityServiceStub } from 'src/app/testing/stubs/security.stub'; import { createStateRouterStub } from 'src/app/testing/stubs/state-router.stub'; import { createToastrServiceStub } from 'src/app/testing/stubs/toastr.stub'; @@ -42,7 +42,7 @@ describe('DashboardComponent', () => { let harness: ComponentHarness; const securityStub = createSecurityServiceStub(); const stateRouterStub = createStateRouterStub(); - const dataRequestsStub = createDataRequestsServiceStub(); + const dataSpecificationStub = createDataSpecificationServiceStub(); const toastrStub = createToastrServiceStub(); beforeEach(async () => { @@ -62,8 +62,8 @@ describe('DashboardComponent', () => { useValue: stateRouterStub, }, { - provide: DataRequestsService, - useValue: dataRequestsStub, + provide: DataSpecificationService, + useValue: dataSpecificationStub, }, { provide: ToastrService, @@ -90,42 +90,42 @@ describe('DashboardComponent', () => { expect(spy).toHaveBeenCalledWith('/home'); }); - it('should initialize the currentUserRequests list upon successful retrieval of requests', () => { + it('should initialize the currentUserDataSpecifications list upon successful retrieval of data specifications', () => { securityStub.getSignedInUser.mockImplementationOnce(() => { return { email: 'email' } as UserDetails; }); - const openRequests = [ + const openDataSpecifications = [ { label: 'dataModel-1', status: 'unsent' }, { label: 'dataModel-2', status: 'unsent' }, { label: 'dataModel-3', status: 'submitted' }, - ] as DataRequest[]; + ] as DataSpecification[]; - dataRequestsStub.list.mockImplementationOnce(() => { - return of(openRequests); + dataSpecificationStub.list.mockImplementationOnce(() => { + return of(openDataSpecifications); }); harness.component.ngOnInit(); - const expected = openRequests.filter((r) => r.status === 'unsent'); - expect(harness.component.currentUserRequests).toEqual(expected); + const expected = openDataSpecifications.filter((r) => r.status === 'unsent'); + expect(harness.component.currentUserDataSpecifications).toEqual(expected); }); }); - describe('loadRequests', () => { - it('should raise a toastr message if something goes wrong and not set currentUserRequests', () => { + describe('loadDataSpecifications', () => { + it('should raise a toastr message if something goes wrong and not set currentUserDataSpecifications', () => { const spy = jest.spyOn(toastrStub, 'error'); - dataRequestsStub.list.mockImplementationOnce(() => { + dataSpecificationStub.list.mockImplementationOnce(() => { return throwError(() => {}); }); - harness.component.loadRequests(); + harness.component.loadDataSpecifications(); expect(spy).toHaveBeenCalledWith( - 'Unable to retrieve your current requests from the server.' + 'Unable to retrieve your current data specifications from the server.' ); - expect(harness.component.currentUserRequests).toEqual([]); + expect(harness.component.currentUserDataSpecifications).toEqual([]); }); }); diff --git a/src/app/pages/dashboard/dashboard.component.ts b/src/app/pages/dashboard/dashboard.component.ts index f12f1348..d7dc5adb 100644 --- a/src/app/pages/dashboard/dashboard.component.ts +++ b/src/app/pages/dashboard/dashboard.component.ts @@ -20,10 +20,10 @@ import { Component, OnInit } from '@angular/core'; import { ToastrService } from 'ngx-toastr'; import { catchError, map, throwError } from 'rxjs'; import { StateRouterService } from 'src/app/core/state-router.service'; -import { DataRequestsService } from 'src/app/data-explorer/data-requests.service'; +import { DataSpecificationService } from 'src/app/data-explorer/data-specification.service'; import { DataElementSearchParameters, - DataRequest, + DataSpecification, mapSearchParametersToParams, } from 'src/app/data-explorer/data-explorer.types'; import { SecurityService } from 'src/app/security/security.service'; @@ -35,14 +35,14 @@ import { SecurityService } from 'src/app/security/security.service'; }) export class DashboardComponent implements OnInit { searchTerms = ''; - currentUserRequests: DataRequest[] = []; + currentUserDataSpecifications: DataSpecification[] = []; itemCardNumerOfLinesToShow = 6; currentCardsHeight = 1; constructor( private security: SecurityService, private stateRouter: StateRouterService, - private dataRequests: DataRequestsService, + private dataSpecification: DataSpecificationService, private toastr: ToastrService ) {} @@ -57,22 +57,26 @@ export class DashboardComponent implements OnInit { return; } - this.loadRequests(); + this.loadDataSpecifications(); } - loadRequests() { - this.dataRequests + loadDataSpecifications() { + this.dataSpecification .list() .pipe( catchError((error) => { - this.toastr.error('Unable to retrieve your current requests from the server.'); + this.toastr.error( + 'Unable to retrieve your current data specifications from the server.' + ); return throwError(() => error); }), - map((requests) => requests.filter((req) => req.status === 'unsent')) + map((dataSpecifications) => + dataSpecifications.filter((specification) => specification.status === 'unsent') + ) ) - .subscribe((dataRequests: DataRequest[]) => { - this.currentUserRequests = [...dataRequests]; - this.calculateLinesToShow(this.currentUserRequests); + .subscribe((dataSpecifications: DataSpecification[]) => { + this.currentUserDataSpecifications = [...dataSpecifications]; + this.calculateLinesToShow(this.currentUserDataSpecifications); }); } @@ -85,33 +89,33 @@ export class DashboardComponent implements OnInit { this.stateRouter.navigateToKnownPath('/search/listing', params); } - private calculateLinesToShow(currentUserRequests: DataRequest[]) { + private calculateLinesToShow(currentUserDataSpecifications: DataSpecification[]) { let approximateCharactersPerLine: number; - // when there is only 1 request, the width of the + // when there is only 1 data specification, the width of the // card item is 100% so it can fit more characters per line. // When 2 elements, is 50%ish, and then 3 or more around 30%. // baseNumberOfCharacters is pure empiric tesing driven // there is no way to know for sure, as different combination // of letters can ocuppy different space (except in monospace fonts) const baseNumberOfCharacters = 30; - if (currentUserRequests.length < 1) { + if (currentUserDataSpecifications.length < 1) { return; - } else if (currentUserRequests.length < 2) { + } else if (currentUserDataSpecifications.length < 2) { approximateCharactersPerLine = baseNumberOfCharacters * 3; - } else if (currentUserRequests.length < 3) { + } else if (currentUserDataSpecifications.length < 3) { approximateCharactersPerLine = baseNumberOfCharacters * 3; } else { approximateCharactersPerLine = baseNumberOfCharacters; } - // Get the maximum length of the current requests + // Get the maximum length of the current data specifications // if description is undefined, use 1. - // Minumum 1, even if no dataRequests. + // Minumum 1, even if no dataSpecifications. const longestDescription: number = - currentUserRequests.length > 0 + currentUserDataSpecifications.length > 0 ? Math.max( - ...currentUserRequests.map((x) => { + ...currentUserDataSpecifications.map((x) => { return x.description ? x.description.length : 0; }) ) diff --git a/src/app/pages/data-element/data-element.component.html b/src/app/pages/data-element/data-element.component.html index f0c9c0e4..602aef25 100644 --- a/src/app/pages/data-element/data-element.component.html +++ b/src/app/pages/data-element/data-element.component.html @@ -29,11 +29,11 @@

{{ dataElement.label }}

- + > { let harness: ComponentHarness; const dataModelStub = createDataModelServiceStub(); const bookmarkStub = createBookmarkServiceStub(); const toastrStub = createToastrServiceStub(); - const dataRequestsStub = createDataRequestsServiceStub(); + const dataSpecificationStub = createDataSpecificationServiceStub(); const profileStub = createProfileServiceStub(); const terminologiesStub = createTerminologyServiceStub(); const config: DataExplorerConfiguration = { @@ -92,7 +92,7 @@ describe('DataElementComponent', () => { MockComponent(SummaryMetadataComponent), DataElementProfileComponent, BookmarkToggleComponent, - MockComponent(DataElementInRequestComponent), + MockComponent(DataElementInDataSpecificationComponent), ], providers: [ { @@ -124,8 +124,8 @@ describe('DataElementComponent', () => { useValue: config, }, { - provide: DataRequestsService, - useValue: dataRequestsStub, + provide: DataSpecificationService, + useValue: dataSpecificationStub, }, ], }); @@ -183,9 +183,9 @@ describe('DataElementComponent', () => { profileStub.get.mockReturnValue(of(profile)); }; - const setupDataRequestsService = () => { - dataRequestsStub.getRequestsIntersections.mockReturnValue( - of({ dataAccessRequests: [], sourceTargetIntersections: [] }) + const setupDataSpecificationService = () => { + dataSpecificationStub.getDataSpecificationIntersections.mockReturnValue( + of({ dataSpecifications: [], sourceTargetIntersections: [] }) ); }; @@ -193,7 +193,7 @@ describe('DataElementComponent', () => { harness = await setupComponentTest(); setupDataModelService(); setupProfileService(); - setupDataRequestsService(); + setupDataSpecificationService(); bookmarkStub.isBookmarked.mockReturnValue(of(false)); }); diff --git a/src/app/pages/data-element/data-element.component.ts b/src/app/pages/data-element/data-element.component.ts index e2eeb4cc..843f4514 100644 --- a/src/app/pages/data-element/data-element.component.ts +++ b/src/app/pages/data-element/data-element.component.ts @@ -37,9 +37,9 @@ import { } from 'src/app/data-explorer/data-explorer.types'; import { DataElementSearchResult } from 'src/app/data-explorer/data-explorer.types'; import { - DataAccessRequestsSourceTargetIntersections, - DataRequestsService, -} from 'src/app/data-explorer/data-requests.service'; + DataSpecificationSourceTargetIntersections, + DataSpecificationService, +} from 'src/app/data-explorer/data-specification.service'; import { TerminologyService } from 'src/app/mauro/terminology.service'; import { BroadcastService } from 'src/app/core/broadcast.service'; @@ -63,7 +63,7 @@ export class DataElementComponent implements OnInit { isBookmarked = false; - sourceTargetIntersections: DataAccessRequestsSourceTargetIntersections; + sourceTargetIntersections: DataSpecificationSourceTargetIntersections; /** * Signal to attach to subscriptions to trigger when they should be unsubscribed. */ @@ -71,7 +71,7 @@ export class DataElementComponent implements OnInit { constructor( private route: ActivatedRoute, private dataModels: DataModelService, - private dataRequests: DataRequestsService, + private dataSpecification: DataSpecificationService, private bookmarks: BookmarkService, private profileService: ProfileService, private toastr: ToastrService, @@ -80,7 +80,7 @@ export class DataElementComponent implements OnInit { @Inject(DATA_EXPLORER_CONFIGURATION) private config: DataExplorerConfiguration ) { this.sourceTargetIntersections = { - dataAccessRequests: [], + dataSpecifications: [], sourceTargetIntersections: [], }; } @@ -122,7 +122,7 @@ export class DataElementComponent implements OnInit { this.setIdentifiableData(); this.setDataTypeModel(); - this.subscribeDataRequestChanges(); + this.subscribeDataSpecificationChanges(); } ); } @@ -178,12 +178,12 @@ export class DataElementComponent implements OnInit { } private loadIntersections() { - return this.dataRequests - .getRequestsIntersections(this.dataModelId, [this.dataElementId]) + return this.dataSpecification + .getDataSpecificationIntersections(this.dataModelId, [this.dataElementId]) .pipe( catchError((error) => { console.log(error); - this.toastr.error('Unable to retrieve requests.'); + this.toastr.error('Unable to retrieve data specifications.'); return EMPTY; }) ); @@ -254,9 +254,9 @@ export class DataElementComponent implements OnInit { }; } - private subscribeDataRequestChanges() { + private subscribeDataSpecificationChanges() { this.broadcast - .on('data-request-added') + .on('data-specification-added') .pipe( takeUntil(this.unsubscribe$), switchMap(() => this.loadIntersections()) diff --git a/src/app/pages/request-query/request-query.component.html b/src/app/pages/data-specification-query/data-specification-query.component.html similarity index 52% rename from src/app/pages/request-query/request-query.component.html rename to src/app/pages/data-specification-query/data-specification-query.component.html index 936f2acf..efd9623b 100644 --- a/src/app/pages/request-query/request-query.component.html +++ b/src/app/pages/data-specification-query/data-specification-query.component.html @@ -17,28 +17,32 @@ SPDX-License-Identifier: Apache-2.0 -->
-
+
-

{{ dataRequest.label }}

+

{{ dataSpecification.label }}

-
+
-