Skip to content

Commit

Permalink
fix(editor): fix-misc-issues-with-dashboard-views
Browse files Browse the repository at this point in the history
  • Loading branch information
Romuald Caplier committed Sep 20, 2024
1 parent 66a3379 commit a98e713
Show file tree
Hide file tree
Showing 43 changed files with 615 additions and 781 deletions.
8 changes: 6 additions & 2 deletions apps/metadata-editor-e2e/src/e2e/dashboard.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ describe('dashboard', () => {
cy.get('@draft')
.children('div')
.eq(5)
.should('contain', ' Not published ')
.should('include.text', 'Not published')
cy.get('@draft').children('div').eq(6).should('contain', ' - ')
cy.clearRecordDrafts()
})
Expand All @@ -204,7 +204,11 @@ describe('dashboard', () => {
.find('span')
.invoke('text')
.should('eq', 'admin admin')
cy.get('@record').children('div').eq(5).should('contain', ' Published ')
cy.get('@record')
.children('div')
.eq(5)
.find('span')
.should('include.text', 'Published')
cy.get('@record').children('div').eq(6).should('not.contain', ' - ')
cy.clearRecordDrafts()
})
Expand Down
4 changes: 3 additions & 1 deletion apps/metadata-editor-e2e/src/e2e/edit.cy.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/* eslint-disable cypress/no-unnecessary-waiting */

describe('editor form', () => {
let recordUuid
let recordUuid: any
before(() => {
cy.login('admin', 'admin', false)
cy.viewport(1920, 2400)

cy.clearRecordDrafts()

Expand Down Expand Up @@ -53,6 +54,7 @@ describe('editor form', () => {
})
beforeEach(() => {
cy.login('admin', 'admin', false)
cy.visit('/catalog/search')
cy.wrap(recordUuid).as('recordUuid')

cy.get('@recordUuid').then((recordUuid) => {
Expand Down
41 changes: 0 additions & 41 deletions apps/metadata-editor-e2e/src/e2e/my-org.cy.ts

This file was deleted.

20 changes: 11 additions & 9 deletions apps/metadata-editor-e2e/src/e2e/record-actions.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ describe('record-actions', () => {
cy.visit('/catalog/search')
})
describe('delete', () => {
const recordId = `TEST_RECORD_${Date.now()}`
describe('record with draft', () => {
it('should delete the record, delete its associated draft and refresh the interface', () => {
// First create a record and its draft
Expand All @@ -13,13 +14,15 @@ describe('record-actions', () => {
.as('abstractField')
.focus()
cy.get('@abstractField').type('record abstract')
cy.get('[data-test="recordTitleInput"]').click()
cy.get('[data-test="recordTitleInput"]').type('{selectAll}{backspace}')
cy.get('[data-test="recordTitleInput"]').type(recordId)
cy.intercept({
method: 'PUT',
pathname: '**/records',
}).as('insertRecord')
cy.get('md-editor-publish-button').click()
cy.wait('@insertRecord')
cy.get('@abstractField').focus()
cy.get('@abstractField').type('draft abstract')
// Assert that the draft exists in the local storage
cy.editor_readFormUniqueIdentifier().then((uniqueIdentifier) =>
Expand All @@ -31,18 +34,17 @@ describe('record-actions', () => {
)
cy.visit('/my-space/my-records')
cy.get('[data-cy="table-row"]')
.contains('My new record')
.contains(recordId)
.should('have.length', 1)
cy.get('[data-cy="dashboard-drafts-count"]').should('contain', '1')
// Delete the record
cy.get('[data-test="record-menu-button"]').last().click()
cy.get('[data-test="record-menu-delete-button"]').click()
cy.get('[data-cy="confirm-button"]').click()
cy.get('[data-cy="table-row"]')
.contains('My new record')
.contains(recordId)
.should('have.length', 0)
cy.get('gn-ui-notification').should('contain', 'Delete success')
cy.get('[data-cy="dashboard-drafts-count"]').should('contain', '0')
})
})

Expand All @@ -51,6 +53,9 @@ describe('record-actions', () => {
// First create a draft
cy.get('[data-cy="create-record"]').click()
cy.url().should('include', '/create')
cy.get('[data-test="recordTitleInput"]').click()
cy.get('[data-test="recordTitleInput"]').type('{selectAll}{backspace}')
cy.get('[data-test="recordTitleInput"]').type(recordId)
cy.get('gn-ui-form-field[ng-reflect-model=abstract] textarea')
.as('abstractField')
.focus()
Expand All @@ -63,17 +68,14 @@ describe('record-actions', () => {
})
cy.visit('/my-space/my-draft')
cy.get('[data-cy="table-row"]')
.contains('My new record')
.contains(recordId)
.should('have.length', 1)
cy.get('[data-cy="dashboard-drafts-count"]').should('contain', '1')
// Delete the draft
cy.get('[data-test="record-menu-button"]').click()
cy.get('[data-test="record-menu-delete-button"]').click()
cy.get('[data-cy="confirm-button"]').click()
cy.get('[data-cy="table-row"]')
.contains('New record')
.should('have.length', 0)
cy.get('[data-cy="dashboard-drafts-count"]').should('contain', '0')
cy.get('[data-cy="table-row"]').should('not.exist')
})
})
})
Expand Down
22 changes: 8 additions & 14 deletions apps/metadata-editor/src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ import { EditPageComponent } from './edit/edit-page.component'
import { EditRecordResolver } from './edit-record.resolver'
import { MyRecordsComponent } from './records/my-records/my-records.component'
import { MyDraftComponent } from './records/my-draft/my-draft.component'
import { MyLibraryComponent } from './records/my-library/my-library.component'
import { SearchRecordsComponent } from './records/search-records/search-records-list.component'
import { TemplatesComponent } from './records/templates/templates.component'
import { MyOrgUsersComponent } from './my-org-users/my-org-users.component'
import { MyOrgRecordsComponent } from './records/my-org-records/my-org-records.component'
import { NewRecordResolver } from './new-record.resolver'
import { DuplicateRecordResolver } from './duplicate-record.resolver'
import { AllRecordsComponent } from './records/all-records/all-records.component'

export const appRoutes: Route[] = [
{ path: '', redirectTo: 'catalog/search', pathMatch: 'prefix' },
Expand All @@ -26,35 +25,30 @@ export const appRoutes: Route[] = [
},
{
path: 'discussion',
component: SearchRecordsComponent,
component: AllRecordsComponent,
pathMatch: 'prefix',
},
{
path: 'calendar',
component: SearchRecordsComponent,
component: AllRecordsComponent,
pathMatch: 'prefix',
},
{
path: 'contacts',
component: SearchRecordsComponent,
component: AllRecordsComponent,
pathMatch: 'prefix',
},
{
path: 'thesaurus',
component: SearchRecordsComponent,
component: AllRecordsComponent,
pathMatch: 'prefix',
},
{
path: 'search',
title: 'Search Records',
component: SearchRecordsComponent,
component: AllRecordsComponent,
pathMatch: 'prefix',
},
{
path: 'my-org',
title: 'My Organisation',
component: MyOrgRecordsComponent,
},
],
},
{
Expand All @@ -78,7 +72,7 @@ export const appRoutes: Route[] = [
{
path: 'templates',
title: 'Templates',
component: MyLibraryComponent,
component: TemplatesComponent,
pathMatch: 'prefix',
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@
>
<mat-icon class="material-symbols-outlined">edit_note</mat-icon>
<span translate="">dashboard.records.myDraft</span>
<gn-ui-badge
[style.--gn-ui-badge-rounded]="'100px'"
data-cy="dashboard-drafts-count"
>{{ draftsCount$ | async }}</gn-ui-badge
>
<ng-container *ngIf="draftsCount$ | async as draftsCount">
<gn-ui-badge *ngIf="draftsCount > 0" data-cy="dashboard-drafts-count">{{
draftsCount
}}</gn-ui-badge>
</ng-container>
</a>
<a
class="menu-item btn-inactive"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<md-editor-sidebar></md-editor-sidebar>
</aside>
<div class="grow flex flex-col">
<header class="shrink-0 border-b border-blue-300">
<header class="shrink-0 border-b border-gray-300">
<md-editor-search-header></md-editor-search-header>
</header>
<div class="relative">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
:host ::ng-deep gn-ui-autocomplete input {
@apply bg-blue-50 rounded-3xl shadow-none !py-2 !px-8 !pl-14 hover:shadow-none focus:outline-4 focus:outline-offset-1 focus:outline-blue-100 focus:outline-dotted;
@apply rounded-3xl shadow-none !py-2 !px-8 !pl-14 hover:shadow-none;
}
:host ::ng-deep gn-ui-autocomplete button {
@apply bg-blue-50 hover:bg-blue-50 border-none shadow-none hover:shadow-none text-gray-500 hover:text-gray-600 left-0 right-auto rounded-3xl;
@apply border-none shadow-none hover:shadow-none text-gray-500 hover:text-gray-600 left-0 right-auto rounded-3xl;
}

::ng-deep .mdc-menu-surface.mat-mdc-autocomplete-panel {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<div class="py-3 px-12 flex justify-between w-full">
<div class="w-2/3">
<gn-ui-fuzzy-search></gn-ui-fuzzy-search>
<gn-ui-fuzzy-search
style="--gn-ui-text-input-border-size: 0px"
></gn-ui-fuzzy-search>
</div>
<div class="flex gap-5 items-center">
<button [title]="'editor.temporary.disabled' | translate" disabled>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,5 @@ <h1 class="text-[16px] text-main font-title font-bold" translate>
</gn-ui-button>
</div>

<div
class="shadow-md shadow-gray-300 border-[1px] border-gray-200 overflow-hidden rounded bg-white grow mx-[32px] my-[16px]"
>
<gn-ui-results-table-container
class="text-[14px]"
(recordClick)="editRecord($event)"
(duplicateRecord)="duplicateRecord($event)"
></gn-ui-results-table-container>

<div class="px-5 py-5 flex justify-center gap-8 items-baseline">
<div class="grow">
<gn-ui-pagination-buttons
[currentPage]="searchFacade.currentPage$ | async"
[totalPages]="searchFacade.totalPages$ | async"
(newCurrentPageEvent)="searchService.setPage($event)"
></gn-ui-pagination-buttons>
</div>
</div>
</div>
<md-editor-records-list></md-editor-records-list>
</main>
Loading

0 comments on commit a98e713

Please sign in to comment.