Skip to content

Commit

Permalink
gh-432 - rename organistion to department.
Browse files Browse the repository at this point in the history
Exception for references to mdm-resources which have an independent concept of organisation.
  • Loading branch information
abwilson23 committed Sep 11, 2024
1 parent 39bc94c commit c19f579
Show file tree
Hide file tree
Showing 26 changed files with 280 additions and 376 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Mauro Data Explorer

A web application to browse a Mauro metadata catalogue and request access to particular
data via the organisation.
data via the department.

It is useful to get an overview of the [high-level concepts](docs/CONCEPTS.md) of the
Mauro Data Explorer before diving in. Once you have some familiarity, please follow the
Expand Down
7 changes: 4 additions & 3 deletions docs/CONCEPTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ 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 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,
3. Submit this user data specification to the department running this instance to gain access to the real data sets owned by the department,
based on the data elements specified.

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.
Expand Down Expand Up @@ -105,12 +105,13 @@ The `subset` endpoint is a core Mauro endpoint which allows a deep copy of a set

## Submitting Data Specifications

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:
Once happy with the collection of data elements gathered, the user will be able to submit their data specification to the department hosting the
Mauro Data Explorer. Submission covers several areas:

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 data specification 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 department.

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.

Expand Down
16 changes: 3 additions & 13 deletions src/app/data-explorer/contact-form/contact-form.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@
autocomplete="on"
required
/>
<mat-error *ngIf="firstName?.errors?.required">
First name is required
</mat-error>
<mat-error *ngIf="firstName?.errors?.required"> First name is required </mat-error>
</mat-form-field>
</div>
<div class="col-md-6">
Expand All @@ -58,13 +56,7 @@
<div class="form-input">
<mat-form-field [appearance]="formFieldAppearance">
<mat-label>Organisation</mat-label>
<input
matInput
type="text"
name="text"
formControlName="organisation"
autocomplete="on"
/>
<input matInput type="text" name="text" formControlName="organisation" autocomplete="on" />
</mat-form-field>
</div>
<div class="form-input">
Expand All @@ -79,9 +71,7 @@
required
/>
<mat-error *ngIf="email?.errors?.required"> Email is required </mat-error>
<mat-error *ngIf="email?.errors?.pattern">
Please enter a valid email address
</mat-error>
<mat-error *ngIf="email?.errors?.pattern"> Please enter a valid email address </mat-error>
</mat-form-field>
</div>
<div class="form-input">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ import { SimpleChange } from '@angular/core';
import { MatFormField, MatLabel } from '@angular/material/form-field';
import { MockComponent, MockDirective } from 'ng-mocks';
import { PluginResearchContactPayload } from 'src/app/mauro/plugins/plugin-research.resource';
import {
ComponentHarness,
setupTestModuleForComponent,
} from 'src/app/testing/testing.helpers';
import { ComponentHarness, setupTestModuleForComponent } from 'src/app/testing/testing.helpers';

import { ContactFormComponent, ContactFormState } from './contact-form.component';

Expand Down
9 changes: 1 addition & 8 deletions src/app/data-explorer/contact-form/contact-form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,7 @@ limitations under the License.
SPDX-License-Identifier: Apache-2.0
*/
import {
Component,
EventEmitter,
Input,
OnChanges,
Output,
SimpleChanges,
} from '@angular/core';
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { MatFormFieldAppearance } from '@angular/material/form-field';
import { defaultEmailPattern } from 'src/app/core/core.types';
Expand Down
55 changes: 24 additions & 31 deletions src/app/mauro/data-model.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,11 @@ describe('DataModelService', () => {
});

describe('get data classes', () => {
it.each([undefined, null])(
'should return an empty list if %p parent provided',
(parent) => {
const expected$ = cold('(a|)', { a: [] });
const actual$ = service.getDataClasses(parent!); // eslint-disable-line @typescript-eslint/no-non-null-assertion
expect(actual$).toBeObservable(expected$);
}
);
it.each([undefined, null])('should return an empty list if %p parent provided', (parent) => {
const expected$ = cold('(a|)', { a: [] });
const actual$ = service.getDataClasses(parent!); // eslint-disable-line @typescript-eslint/no-non-null-assertion
expect(actual$).toBeObservable(expected$);
});

it('should return an empty list if no parent id provided', () => {
const parent: DataModel = {
Expand Down Expand Up @@ -256,18 +253,16 @@ describe('DataModelService', () => {
availableActions: ['show'],
};

endpointsStub.dataClass.getChildDataClass.mockImplementationOnce(
(dmId, dcId, cDcId) => {
expect(dmId).toBe(id.dataModelId);
expect(dcId).toBe(id.parentDataClassId);
expect(cDcId).toBe(id.dataClassId);
return cold('--a|', {
a: {
body: expectedDataClass,
},
});
}
);
endpointsStub.dataClass.getChildDataClass.mockImplementationOnce((dmId, dcId, cDcId) => {
expect(dmId).toBe(id.dataModelId);
expect(dcId).toBe(id.parentDataClassId);
expect(cDcId).toBe(id.dataClassId);
return cold('--a|', {
a: {
body: expectedDataClass,
},
});
});

const expected$ = cold('--a|', { a: expectedDataClass });
const actual$ = service.getDataClass(id);
Expand Down Expand Up @@ -657,17 +652,15 @@ describe('DataModelService', () => {
modelVersion: undefined,
};

endpointsStub.dataModel.newBranchModelVersion.mockImplementationOnce(
(id, payload) => {
expect(id).toBe(currentModel.id);
expect(payload).toStrictEqual({});
return cold('--a|', {
a: {
body: nextModel,
},
});
}
);
endpointsStub.dataModel.newBranchModelVersion.mockImplementationOnce((id, payload) => {
expect(id).toBe(currentModel.id);
expect(payload).toStrictEqual({});
return cold('--a|', {
a: {
body: nextModel,
},
});
});

const expected$ = cold('--a|', {
a: nextModel,
Expand Down
16 changes: 3 additions & 13 deletions src/app/pages/contact-support/contact-support.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,13 @@ import { PluginResearchContactPayload } from 'src/app/mauro/plugins/plugin-resea
import { ResearchPluginService } from 'src/app/mauro/research-plugin.service';
import { createMatDialogStub } from 'src/app/testing/stubs/mat-dialog.stub';
import { createResearchPluginServiceStub } from 'src/app/testing/stubs/research-plugin.stub';
import {
ComponentHarness,
setupTestModuleForComponent,
} from 'src/app/testing/testing.helpers';
import { ComponentHarness, setupTestModuleForComponent } from 'src/app/testing/testing.helpers';
import { ContactSupportComponent } from './contact-support.component';

describe('ContactSupportComponent', () => {
let harness: ComponentHarness<ContactSupportComponent>;
const researchStub = createResearchPluginServiceStub();
const dialogStub = createMatDialogStub<
FeedbackDialogComponent,
FeedbackDialogResponse
>();
const dialogStub = createMatDialogStub<FeedbackDialogComponent, FeedbackDialogResponse>();

const contactData: PluginResearchContactPayload = {
firstName: 'test',
Expand All @@ -55,11 +49,7 @@ describe('ContactSupportComponent', () => {

beforeEach(async () => {
harness = await setupTestModuleForComponent(ContactSupportComponent, {
declarations: [
ContactFormComponent,
MockComponent(MatFormField),
MockDirective(MatLabel),
],
declarations: [ContactFormComponent, MockComponent(MatFormField), MockDirective(MatLabel)],
providers: [
{
provide: ResearchPluginService,
Expand Down
4 changes: 1 addition & 3 deletions src/app/pages/my-account/my-account.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ <h1>My Account</h1>
<section class="form-section">
<div class="sub-heading-with-actions">
<h2>Security</h2>
<a mat-stroked-button color="primary" routerLink="/change-password"
>Change password</a
>
<a mat-stroked-button color="primary" routerLink="/change-password">Change password</a>
</div>
</section>
<section class="form-section">
Expand Down
15 changes: 5 additions & 10 deletions src/app/pages/my-account/my-account.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ import { createCatalogueUserServiceStub } from 'src/app/testing/stubs/catalogue-
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';
import {
ComponentHarness,
setupTestModuleForComponent,
} from 'src/app/testing/testing.helpers';
import { ComponentHarness, setupTestModuleForComponent } from 'src/app/testing/testing.helpers';
import { MyAccountComponent } from './my-account.component';
import { createDataSpecificationServiceStub } from 'src/app/testing/stubs/data-specifications.stub';
import { DataSpecificationService } from 'src/app/data-explorer/data-specification.service';
Expand Down Expand Up @@ -296,12 +293,10 @@ describe('MyAccountComponent', () => {
return of(folder);
});

dataSpecificationStub.getDataSpecificationFolderName.mockImplementationOnce(
(email) => {
expect(email).toBe(updatedUser.emailAddress);
return newFolderName;
}
);
dataSpecificationStub.getDataSpecificationFolderName.mockImplementationOnce((email) => {
expect(email).toBe(updatedUser.emailAddress);
return newFolderName;
});

dataSpecificationStub.updateDataSpecificationsFolder.mockImplementationOnce(
(folderId, email) => {
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/sde-main/sde-main.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h1>Secure Data Environment</h1>
<mdm-sde-requests></mdm-sde-requests>
</mat-tab>

<mat-tab label="Organisations">
<mat-tab label="Departments">
<mdm-departments></mdm-departments>
</mat-tab>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
SPDX-License-Identifier: Apache-2.0
-->
<sde-list
[data]="myOrganisations"
[data]="myDepartments"
[displayedColumns]="displayColumns"
[canFilter]="false"
[paginated]="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@ limitations under the License.
SPDX-License-Identifier: Apache-2.0
*/
import { DepartmentListComponent } from './department-list.component';
import {
ComponentHarness,
setupTestModuleForComponent,
} from '../../../testing/testing.helpers';
import { ComponentHarness, setupTestModuleForComponent } from '../../../testing/testing.helpers';
import { createMatDialogStub } from '../../../testing/stubs/mat-dialog.stub';
import { MatDialog } from '@angular/material/dialog';
import { UserOrganisationDTO } from '@maurodatamapper/sde-resources';
import { UserDepartmentDTO } from '@maurodatamapper/sde-resources';
import { spyOn } from 'jest-mock';

describe('DepartmentListComponent', () => {
Expand All @@ -46,7 +43,7 @@ describe('DepartmentListComponent', () => {
});

it('should emit rowClickEvent when onRowClickEvent is called', () => {
const userOrgDto = { organisationId: '1' } as UserOrganisationDTO;
const userOrgDto = { departmentId: '1' } as UserDepartmentDTO;
const spy = spyOn(harness.component.rowClickEvent, 'emit');

harness.component.onRowClickEvent(userOrgDto);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,20 @@ SPDX-License-Identifier: Apache-2.0
*/
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import {
ListColumn,
Organisation,
UserOrganisationDTO,
} from '@maurodatamapper/sde-resources';
import { ListColumn, Department, UserDepartmentDTO } from '@maurodatamapper/sde-resources';

@Component({
selector: 'mdm-department-list',
templateUrl: './department-list.component.html',
styleUrls: ['./department-list.component.scss'],
})
export class DepartmentListComponent implements OnInit {
@Input() myOrganisations: UserOrganisationDTO[] = [];
@Output() rowClickEvent = new EventEmitter<UserOrganisationDTO>();
@Output() listLoadedEvent = new EventEmitter<Organisation>();
@Input() myDepartments: UserDepartmentDTO[] = [];
@Output() rowClickEvent = new EventEmitter<UserDepartmentDTO>();
@Output() listLoadedEvent = new EventEmitter<Department>();

displayColumns: ListColumn[] = [
{ displayHeader: 'Name', fieldName: 'organisationName' },
{ displayHeader: 'Name', fieldName: 'departmentName' },
{ displayHeader: 'Role', fieldName: 'role' },
{ displayHeader: 'End date', fieldName: 'endDate' },
];
Expand All @@ -46,7 +42,7 @@ export class DepartmentListComponent implements OnInit {

ngOnInit(): void {}

onRowClickEvent(value: UserOrganisationDTO) {
onRowClickEvent(value: UserDepartmentDTO) {
this.rowClickEvent.emit(value);
}
}
Loading

0 comments on commit c19f579

Please sign in to comment.