-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(metadata-editor): organize fields into pages and sections.
- Loading branch information
Romuald Caplier
committed
Jul 16, 2024
1 parent
55a2990
commit f100ab3
Showing
33 changed files
with
750 additions
and
198 deletions.
There are no files selected for viewing
Empty file.
39 changes: 39 additions & 0 deletions
39
apps/metadata-editor/src/app/edit/components/breadcrumbs/breadcrumbs.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<div class="w-full flex flex-row p-8 items-center gap-6"> | ||
<ng-container | ||
*ngFor="let page of pages; let index = index; let isLast = last" | ||
> | ||
<div class="flex flex-row items-center gap-4"> | ||
<div class="flex flex-row items-center gap-4 hover:cursor-pointer"> | ||
<gn-ui-button | ||
(buttonClick)="pageSectionClickHandler(index)" | ||
class="flex flex-row items-center" | ||
[type]="selectedPage === index ? 'primary' : 'default'" | ||
extraClass="bg-transparent border-none" | ||
> | ||
<div | ||
class="w-10 h-10 rounded-[8px] pt-3 text-center" | ||
[ngClass]=" | ||
selectedPage === index ? 'bg-primary font-bold' : 'bg-gray-200' | ||
" | ||
> | ||
{{ index }} | ||
</div> | ||
<div | ||
class="ms-4" | ||
[ngClass]=" | ||
selectedPage === index | ||
? 'text-center text-black font-bold' | ||
: 'text-gray-400' | ||
" | ||
translate | ||
> | ||
{{ page.label }} | ||
</div> | ||
</gn-ui-button> | ||
</div> | ||
<div *ngIf="!isLast" class="w-10"> | ||
<hr class="border-t-[2px]" /> | ||
</div> | ||
</div> | ||
</ng-container> | ||
</div> |
58 changes: 58 additions & 0 deletions
58
apps/metadata-editor/src/app/edit/components/breadcrumbs/breadcrumbs.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing' | ||
import { TopToolbarComponent } from './top-toolbar.component' | ||
import { Component } from '@angular/core' | ||
import { PublishButtonComponent } from '../publish-button/publish-button.component' | ||
import { BehaviorSubject } from 'rxjs' | ||
import { EditorFacade } from '@geonetwork-ui/feature/editor' | ||
import { TranslateModule } from '@ngx-translate/core' | ||
import { BreadcrumbsComponent } from './breadcrumbs.component' | ||
|
||
class EditorFacadeMock { | ||
changedSinceSave$ = new BehaviorSubject(false) | ||
alreadySavedOnce$ = new BehaviorSubject(false) | ||
} | ||
|
||
@Component({ | ||
selector: 'md-editor-publish-button', | ||
template: '', | ||
standalone: true, | ||
}) | ||
class MockPublishButtonComponent {} | ||
|
||
describe('BreadcrumbsComponent', () => { | ||
let component: BreadcrumbsComponent | ||
let fixture: ComponentFixture<BreadcrumbsComponent> | ||
let editorFacade: EditorFacadeMock | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [TopToolbarComponent, TranslateModule.forRoot()], | ||
providers: [ | ||
{ | ||
provide: EditorFacade, | ||
useClass: EditorFacadeMock, | ||
}, | ||
], | ||
}) | ||
.overrideComponent(TopToolbarComponent, { | ||
add: { | ||
imports: [MockPublishButtonComponent], | ||
}, | ||
remove: { | ||
imports: [PublishButtonComponent], | ||
}, | ||
}) | ||
.compileComponents() | ||
|
||
fixture = TestBed.createComponent(BreadcrumbsComponent) | ||
component = fixture.componentInstance | ||
editorFacade = TestBed.inject(EditorFacade) as any | ||
fixture.detectChanges() | ||
}) | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy() | ||
}) | ||
|
||
describe('save status', () => {}) | ||
}) |
38 changes: 38 additions & 0 deletions
38
apps/metadata-editor/src/app/edit/components/breadcrumbs/breadcrumbs.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { | ||
ChangeDetectionStrategy, | ||
Component, | ||
EventEmitter, | ||
Input, | ||
Output, | ||
} from '@angular/core' | ||
import { CommonModule } from '@angular/common' | ||
import { PublishButtonComponent } from '../publish-button/publish-button.component' | ||
import { ButtonComponent } from '@geonetwork-ui/ui/inputs' | ||
import { MatIconModule } from '@angular/material/icon' | ||
import { TranslateModule } from '@ngx-translate/core' | ||
import { EditorFieldPage } from '@geonetwork-ui/feature/editor' | ||
|
||
@Component({ | ||
selector: 'md-editor-breadcrumbs', | ||
standalone: true, | ||
imports: [ | ||
CommonModule, | ||
PublishButtonComponent, | ||
ButtonComponent, | ||
MatIconModule, | ||
TranslateModule, | ||
], | ||
templateUrl: './breadcrumbs.component.html', | ||
styleUrls: ['./breadcrumbs.component.css'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class BreadcrumbsComponent { | ||
@Input() selectedPage = 0 | ||
@Input() pages: EditorFieldPage[] | ||
|
||
@Output() selectedPageChange = new EventEmitter<number>() | ||
|
||
pageSectionClickHandler(index: number) { | ||
this.selectedPageChange.emit(index) | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
apps/metadata-editor/src/app/edit/components/top-toolbar/top-toolbar.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 36 additions & 9 deletions
45
apps/metadata-editor/src/app/edit/edit-page.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,38 @@ | ||
<div class="flex flex-col h-full"> | ||
<div class="w-full h-auto shrink-0"> | ||
<md-editor-top-toolbar></md-editor-top-toolbar> | ||
</div> | ||
<div class="grow overflow-auto relative"> | ||
<div class="absolute top-0 left-0 w-2/3 z-10 pointer-events-none"> | ||
<gn-ui-notifications-container></gn-ui-notifications-container> | ||
<ng-container *ngIf="fields$ | async as fields"> | ||
<div class="flex flex-col h-full"> | ||
<div class="w-full h-auto shrink-0"> | ||
<md-editor-top-toolbar></md-editor-top-toolbar> | ||
<md-editor-breadcrumbs | ||
[pages]="fields.pages" | ||
[selectedPage]="selectedPage" | ||
(selectedPageChange)="selectedPageChange($event)" | ||
></md-editor-breadcrumbs> | ||
</div> | ||
<div class="grow overflow-auto relative"> | ||
<div class="absolute top-0 left-0 w-2/3 z-10 pointer-events-none"> | ||
<gn-ui-notifications-container></gn-ui-notifications-container> | ||
</div> | ||
<gn-ui-record-form | ||
[page]="fields.pages | find: selectedPage" | ||
></gn-ui-record-form> | ||
</div> | ||
<div class="p-8 mt-auto flex flex-row justify-between"> | ||
<gn-ui-button | ||
type="secondary" | ||
(buttonClick)="previousPageButtonHandler()" | ||
translate | ||
> | ||
{{ | ||
selectedPage === 0 | ||
? ('editor.record.form.bottomButtons.comeBackLater' | translate) | ||
: ('editor.record.form.bottomButtons.previous' | translate) | ||
}} | ||
</gn-ui-button> | ||
<gn-ui-button type="primary" (buttonClick)="nextPageButtonHandler()" | ||
><span translate | ||
>editor.record.form.bottomButtons.next</span | ||
></gn-ui-button | ||
> | ||
</div> | ||
<gn-ui-record-form></gn-ui-record-form> | ||
</div> | ||
</div> | ||
</ng-container> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.