Skip to content

Commit

Permalink
Merge pull request #73 from nhsengland/develop
Browse files Browse the repository at this point in the history
Creating Release 1.6.0
  • Loading branch information
JyotiJaiswal169 authored Nov 15, 2021
2 parents e46e405 + 7c704f5 commit 2906825
Show file tree
Hide file tree
Showing 38 changed files with 1,020 additions and 411 deletions.
15 changes: 14 additions & 1 deletion src/modules/core/helpers/utils.helper.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { UtilsHelper } from './utils.helper';


describe('Core/Helpers/UtilsHelper', () => {
describe('Core/Helpers/UtilsHelper/isEmpty', () => {

it(`should return 'true' when object is 'empty'`, () => {
expect(UtilsHelper.isEmpty({})).toBe(true);
Expand Down Expand Up @@ -32,3 +32,16 @@ describe('Core/Helpers/UtilsHelper', () => {
});

});


describe('Core/Helpers/UtilsHelper/arrayFullTextSearch', () => {

const items = ['One cat', 'One dog', 'Two cats', 'Two dogs'];

it(`should return 'true' when object is 'empty'`, () => {
const search = 'One';
const expected = ['One cat', 'One dog'];
expect(UtilsHelper.arrayFullTextSearch(items, search)).toEqual(expected);
});

});
20 changes: 20 additions & 0 deletions src/modules/core/helpers/utils.helper.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
export class UtilsHelper {


static isEmpty = (obj: any) => [Object, Array].includes((obj || {}).constructor) && !Object.entries((obj || {})).length;


static arrayFullTextSearch(items: string[], searchText: string): string[] {

const searchWords = searchText.trim().replace(/\s\s/g, ' ').toLowerCase().split(' '); // Removes more than on space to just one, and split by words.

return items.filter(item => {

const itemWords = item.trim().replace(/\s\s/g, ' ').toLowerCase().split(' ');

// Return true if all the searchWords, have an equivalent that startsWith on the itemWords.
return searchWords.every(el =>
itemWords.findIndex(f => f.startsWith(el)) > -1
);

});
}

}
5 changes: 3 additions & 2 deletions src/modules/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export { TableModel } from './models/table.model';
export { APIQueryParamsType } from './models/table.model';

// Helpers
export { RandomGeneratorHelper } from './helpers/random-generator.helper';
export { RoutingHelper } from './helpers/routing.helper';
export { DatesHelper } from './helpers/dates.helper';
export { LocalStorageHelper } from './helpers/local-storage.helper';
export { RandomGeneratorHelper } from './helpers/random-generator.helper';
export { RoutingHelper } from './helpers/routing.helper';
export { UtilsHelper } from './helpers/utils.helper';
1 change: 1 addition & 0 deletions src/modules/core/models/table.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export class TableModel<T = { [key: string]: string | number | boolean }, F = AP
clearData(): this {
this.dataSource = [];
this.totalRows = 0;
this.page = 1;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ const routes: Routes = [
{
path: ':innovationId',
data: { module: 'accessor' },
runGuardsAndResolvers: 'pathParamsOrQueryParamsChange',
resolve: { innovationData: InnovationDataResolver },
children: [
{ path: '', pathMatch: 'full', redirectTo: 'overview' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,112 +18,118 @@ <h1 class="nhsuk-heading-xl nhsuk-u-margin-bottom-5"> {{ pageTitle }} </h1>

<theme-spinner *ngIf="pageStatus === 'LOADING'" cssClass="nhsuk-u-margin-9"></theme-spinner>

<ng-container *ngIf="pageStatus === 'READY' && openedActionsList.getTotalRowsNumber() === 0">
<p> There are no open actions </p>
</ng-container>

<ng-container *ngIf="pageStatus === 'READY' && openedActionsList.getTotalRowsNumber() > 0">
<ng-container *ngIf="pageStatus === 'READY'">

<table class="nhsuk-table-responsive app-sortable-table">
<caption class="nhsuk-table__caption"> Open actions list </caption>
<thead class="nhsuk-table__head">
<tr>
<th *ngFor="let item of openedActionsList.getHeaderColumns(); let i = index" scope="col" [ngClass]="item.align" [attr.aria-sort]="item.orderDir">
<ng-container *ngIf="!item.orderable">{{ item.label }}</ng-container>
<button *ngIf="item.orderable" type="button">{{ item.label }}</button>
<ng-container *ngIf="item.key === 'status'">
<br />
<a routerLink="statuses" class="nhsuk-body-s nhsuk-u-margin-bottom-0" arial-label="View status keys information"> Status key </a>
</ng-container>
</th>
</tr>
</thead>
<tbody class="nhsuk-table__body">
<tr *ngFor="let item of openedActionsList.getRecords()" class="nhsuk-table__row">
<td class="nhsuk-table__cell">
<span class="nhsuk-table-responsive__heading">{{ openedActionsList.getColumnLabel('id') }}</span>
<span>{{ item.displayId }}</span>
</td>
<td class="nhsuk-table__cell">
<div class="side-menu-flex">
<div>
<span class="nhsuk-table-responsive__heading">{{ openedActionsList.getColumnLabel('name') }}</span>
<a routerLink="/accessor/innovations/{{ innovationId }}/action-tracker/{{ item.id }}" attr.aria-label="View {{ item.name }} action"> {{ item.name }} </a>
</div>
<div>
<notification-tag *ngIf="item.notifications.count > 0" type="circle"></notification-tag>
</div>
</div>
</td>
<td class="nhsuk-table__cell">
<span class="nhsuk-table-responsive__heading">{{ openedActionsList.getColumnLabel('createdAt') }}</span>
{{ item.createdAt | date: ('app.date_formats.long_date' | translate) }}
</td>
<td class="nhsuk-table__cell text-align-right">
<span class="nhsuk-table-responsive__heading">{{ openedActionsList.getColumnLabel('status') }}</span>
<strong class="nhsuk-tag" [ngClass]="innovationSectionActionStatus[item.status]?.cssClass || ''">{{ innovationSectionActionStatus[item.status]?.label || '' }}</strong>
</td>
</tr>
</tbody>
</table>
<ng-container *ngIf="openedActionsList.getTotalRowsNumber() === 0 && closedActionsList.getTotalRowsNumber() === 0; else openedOrClosedActions">
<p> There are no actions </p>
</ng-container>

<details class="nhsuk-details nhsuk-u-padding-top-5">
<summary class="nhsuk-details__summary">
<span class="nhsuk-details__summary-text">
All closed actions
</span>
</summary>
<div class="nhsuk-details__text">
<ng-template #openedOrClosedActions>

<ng-container *ngIf="pageStatus === 'READY' && closedActionsList.getTotalRowsNumber() === 0">
<p> There are no closed actions </p>
</ng-container>
<ng-container *ngIf="openedActionsList.getTotalRowsNumber() === 0">
<p> There are no open actions </p>
</ng-container>

<ng-container *ngIf="pageStatus === 'READY' && closedActionsList.getTotalRowsNumber() > 0">

<table class="nhsuk-table-responsive app-sortable-table">
<caption class="nhsuk-table__caption"> Closed actions list </caption>
<thead class="nhsuk-table__head">
<tr>
<th *ngFor="let item of closedActionsList.getHeaderColumns(); let i = index" scope="col" [ngClass]="item.align" [attr.aria-sort]="item.orderDir">
<ng-container *ngIf="!item.orderable">{{ item.label }}</ng-container>
<button *ngIf="item.orderable" type="button">{{ item.label }}</button>
</th>
</tr>
</thead>
<tbody class="nhsuk-table__body">
<tr *ngFor="let item of closedActionsList.getRecords()" class="nhsuk-table__row">
<td class="nhsuk-table__cell">
<span class="nhsuk-table-responsive__heading">{{ closedActionsList.getColumnLabel('id') }} </span>
<span>{{ item.displayId }}</span>
</td>
<td class="nhsuk-table__cell">
<div class="side-menu-flex">
<div>
<span class="nhsuk-table-responsive__heading">{{ closedActionsList.getColumnLabel('name') }} </span>
<a routerLink="/accessor/innovations/{{ innovationId }}/action-tracker/{{ item.id }}" attr.aria-label="View {{ item.name }} action"> {{ item.name }} </a>
</div>
<div>
<notification-tag *ngIf="item.notifications && item.notifications.count > 0" type="circle"></notification-tag>
</div>
<ng-container *ngIf="openedActionsList.getTotalRowsNumber() > 0">
<table class="nhsuk-table-responsive app-sortable-table nhsuk-u-padding-bottom-5">
<caption class="nhsuk-table__caption"> Open actions list </caption>
<thead class="nhsuk-table__head">
<tr>
<th *ngFor="let item of openedActionsList.getHeaderColumns(); let i = index" scope="col" [ngClass]="item.align" [attr.aria-sort]="item.orderDir">
<ng-container *ngIf="!item.orderable">{{ item.label }}</ng-container>
<button *ngIf="item.orderable" type="button">{{ item.label }}</button>
<ng-container *ngIf="item.key === 'status'">
<br />
<a routerLink="statuses" class="nhsuk-body-s nhsuk-u-margin-bottom-0" arial-label="View status keys information"> Status key </a>
</ng-container>
</th>
</tr>
</thead>
<tbody class="nhsuk-table__body">
<tr *ngFor="let item of openedActionsList.getRecords()" class="nhsuk-table__row">
<td class="nhsuk-table__cell">
<span class="nhsuk-table-responsive__heading">{{ openedActionsList.getColumnLabel('id') }}</span>
<span>{{ item.displayId }}</span>
</td>
<td class="nhsuk-table__cell">
<div class="side-menu-flex">
<div>
<span class="nhsuk-table-responsive__heading">{{ openedActionsList.getColumnLabel('name') }}</span>
<a routerLink="/accessor/innovations/{{ innovationId }}/action-tracker/{{ item.id }}" attr.aria-label="View {{ item.name }} action"> {{ item.name }} </a>
</div>
<div>
<notification-tag *ngIf="item.notifications.count > 0" type="circle"></notification-tag>
</div>
</div>
</td>
<td class="nhsuk-table__cell">
<span class="nhsuk-table-responsive__heading">{{ openedActionsList.getColumnLabel('createdAt') }}</span>
{{ item.createdAt | date: ('app.date_formats.long_date' | translate) }}
</td>
<td class="nhsuk-table__cell text-align-right">
<span class="nhsuk-table-responsive__heading">{{ openedActionsList.getColumnLabel('status') }}</span>
<strong class="nhsuk-tag" [ngClass]="innovationSectionActionStatus[item.status]?.cssClass || ''">{{ innovationSectionActionStatus[item.status]?.label || '' }}</strong>
</td>
</tr>
</tbody>
</table>
</ng-container>

</td>
<td class="nhsuk-table__cell">
<span class="nhsuk-table-responsive__heading">{{ closedActionsList.getColumnLabel('createdAt') }} </span>
{{ item.createdAt | date: ('app.date_formats.long_date' | translate) }}
</td>
<td class="nhsuk-table__cell text-align-right">
<span class="nhsuk-table-responsive__heading">{{ closedActionsList.getColumnLabel('status') }} </span>
<strong class="nhsuk-tag" [ngClass]="innovationSectionActionStatus[item.status]?.cssClass || ''">{{ innovationSectionActionStatus[item.status]?.label || '' }}</strong>
</td>
</tr>
</tbody>
</table>

</ng-container>
<ng-container *ngIf="closedActionsList.getTotalRowsNumber() === 0">
<p> There are no closed actions </p>
</ng-container>

<ng-container *ngIf="closedActionsList.getTotalRowsNumber() > 0">
<details class="nhsuk-details nhsuk-u-padding-top-5">
<summary class="nhsuk-details__summary">
<span class="nhsuk-details__summary-text">
All closed actions
</span>
</summary>
<div class="nhsuk-details__text">
<table class="nhsuk-table-responsive app-sortable-table">
<caption class="nhsuk-table__caption"> Closed actions list </caption>
<thead class="nhsuk-table__head">
<tr>
<th *ngFor="let item of closedActionsList.getHeaderColumns(); let i = index" scope="col" [ngClass]="item.align" [attr.aria-sort]="item.orderDir">
<ng-container *ngIf="!item.orderable">{{ item.label }}</ng-container>
<button *ngIf="item.orderable" type="button">{{ item.label }}</button>
</th>
</tr>
</thead>
<tbody class="nhsuk-table__body">
<tr *ngFor="let item of closedActionsList.getRecords()" class="nhsuk-table__row">
<td class="nhsuk-table__cell">
<span class="nhsuk-table-responsive__heading">{{ closedActionsList.getColumnLabel('id') }} </span>
<span>{{ item.displayId }}</span>
</td>
<td class="nhsuk-table__cell">
<div class="side-menu-flex">
<div>
<span class="nhsuk-table-responsive__heading">{{ closedActionsList.getColumnLabel('name') }} </span>
<a routerLink="/accessor/innovations/{{ innovationId }}/action-tracker/{{ item.id }}" attr.aria-label="View {{ item.name }} action"> {{ item.name }} </a>
</div>
<div>
<notification-tag *ngIf="item.notifications && item.notifications.count > 0" type="circle"></notification-tag>
</div>
</div>
</td>
<td class="nhsuk-table__cell">
<span class="nhsuk-table-responsive__heading">{{ closedActionsList.getColumnLabel('createdAt') }} </span>
{{ item.createdAt | date: ('app.date_formats.long_date' | translate) }}
</td>
<td class="nhsuk-table__cell text-align-right">
<span class="nhsuk-table-responsive__heading">{{ closedActionsList.getColumnLabel('status') }} </span>
<strong class="nhsuk-tag" [ngClass]="innovationSectionActionStatus[item.status]?.cssClass || ''">{{ innovationSectionActionStatus[item.status]?.label || '' }}</strong>
</td>
</tr>
</tbody>
</table>
</div>
</details>
</ng-container>

</div>
</details>
</ng-template>

</ng-container>
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ <h2 class="nhsuk-heading-xs nhsuk-u-margin-0">Filters</h2>
<tr *ngFor="let item of innovationsList.getRecords()" class="nhsuk-table__row">
<td class="nhsuk-table__cell">
<span class="nhsuk-table-responsive__heading">{{ innovationsList.getColumnLabel('name') }}</span>
{{ item.name }}
<a routerLink="/accessor/innovations/{{ item.id }}" attr.aria-label="View {{ item.name }} innovation"> {{ item.name }} </a>
</td>
<td class="nhsuk-table__cell">
<span class="nhsuk-table-responsive__heading">{{ innovationsList.getColumnLabel('submittedAt') }}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import { PageInnovationRecordComponent } from '@modules/shared/pages/innovation/

import { InnovationSupportOrganisationsSupportStatusInfoComponent } from './pages/innovation/support/organisations-support-status-info.component';
import { PageInnovationSupportStatusListComponent } from '@shared-module/pages/innovation/innovation-support-status-list.component';

import { PageInnovationCommentsListComponent } from '@shared-module/pages/innovation/comments/comments-list.component';
import { PageInnovationCommentsNewComponent } from '@shared-module/pages/innovation/comments/comments-new.component';
// Resolvers.
import { InnovationDataResolver } from './resolvers/innovation-data.resolver';
import { InnovationSectionViewComponent } from '@modules/shared/pages/innovation/section-view.component';
Expand Down Expand Up @@ -124,6 +127,14 @@ const routes: Routes = [
// path: 'comments', pathMatch: 'full', component: InnovationCommentsComponent,
// data: { layoutOptions: { type: 'innovationLeftAsideMenu', showInnovationHeader: false } }
// }
{
path: 'comments', pathMatch: 'full', component: PageInnovationCommentsListComponent,
data: { layoutOptions: { type: 'innovationLeftAsideMenu', backLink: { url: '/accessor/innovations', label: 'Innovations' } } }
},
{
path: 'comments/new', pathMatch: 'full', component: PageInnovationCommentsNewComponent,
data: { layoutOptions: { type: 'emptyLeftAside', backLink: { url: '/accessor/innovations/:innovationId/comments', label: 'Go back' } } }
},
]
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ describe('FeatureModules/Assessment/AssessmentLayoutComponent', () => {
const expected = [
{ title: 'Overview', link: `/assessment/innovations/innovation01/overview` },
{ title: 'Innovation record', link: `/assessment/innovations/innovation01/record` },
{ title: 'Comments', link: `/assessment/innovations/innovation01/comments` },
{ title: 'Support status', link: `/assessment/innovations/innovation01/support` },
// { title: 'Action tracker', link: `/assessment/innovations/innovation01/action-tracker` },
// { title: 'Comments', link: `/assessment/innovations/innovation01/comments` }
];

fixture = TestBed.createComponent(AssessmentLayoutComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,10 @@ export class AssessmentLayoutComponent extends CoreComponent {
{ title: 'Overview', link: `/assessment/innovations/${currentRouteInnovationId}/overview` },
{ title: 'Innovation record', link: `/assessment/innovations/${currentRouteInnovationId}/record` },
// { title: 'Action tracker', link: `/assessment/innovations/${currentRouteInnovationId}/action-tracker` },
// { title: 'Comments', link: `/assessment/innovations/${currentRouteInnovationId}/comments` }

];
if (innovation.status === 'IN_PROGRESS') {
this.leftSideBar.push({ title: 'Comments', link: `/assessment/innovations/${currentRouteInnovationId}/comments` });
this.leftSideBar.push({ title: 'Support status', link: `/assessment/innovations/${currentRouteInnovationId}/support` });
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,17 @@ <h1 class="nhsuk-heading-l"> {{ pageTitle }} </h1>

<ng-container *ngIf="pageStatus === 'READY' && innovationsList.getTotalRowsNumber() > 0">

<p class="nhsuk-body-m nhsuk-u-font-weight-bold nhsuk-u-margin-bottom-1">{{innovationsList.getTotalRowsNumber() }} innovations</p>
<p *ngIf="currentTab.key !== 'IN_PROGRESS' && currentTab.innovationsOverdue > 0" class="nhsuk-body-s nhsuk-u-margin-bottom-2 d-flex align-items-center">
<p class="nhsuk-body-m nhsuk-u-font-weight-bold nhsuk-u-margin-bottom-1">{{ innovationsList.getTotalRowsNumber() }} innovations</p>

<p *ngIf="currentTab.key !== 'IN_PROGRESS' && currentTab.overdueInnovations > 0" class="nhsuk-body-s nhsuk-u-margin-bottom-2 d-flex align-items-center">
<span class="dot-error nhsuk-u-margin-right-2"></span>
<span>{{ currentTab.innovationsOverdue }} are overdue</span>
<span>{{ currentTab.overdueInnovations }} are overdue</span>
</p>

<form *ngIf="currentTab.key === 'IN_PROGRESS'" [formGroup]="form" class="nhsuk-u-margin-bottom-1">
<theme-form-radio-group controlName="supportFilter" label="Organisations support status" [items]="formFilterItems" size="small" [pageUniqueField]="false"></theme-form-radio-group>
</form>

<hr class="nhsuk-section-break nhsuk-section-break--visible" />

<table class="nhsuk-table-responsive app-sortable-table nhsuk-u-margin-top-3">
Expand Down
Loading

0 comments on commit 2906825

Please sign in to comment.