-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add documentation pages collapse and display in the breadcrumb (#…
- Loading branch information
1 parent
8cb0631
commit ccf3363
Showing
14 changed files
with
297 additions
and
70 deletions.
There are no files selected for viewing
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
29 changes: 29 additions & 0 deletions
29
...tails/api-tab-documentation/components/api-documentation/api-documentation.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,29 @@ | ||
<!-- | ||
Copyright (C) 2024 The Gravitee team (http://gravitee.io) | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<div class="page-content"> | ||
@if (selectedPageData$ | async; as selectedPageData) { | ||
@if (selectedPageData.result) { | ||
<app-page class="page-content__container" [page]="selectedPageData.result" [pages]="pages()" [apiId]="apiId()"></app-page> | ||
} | ||
@if (selectedPageData.error) { | ||
<div i18n="@@apiDocumentationError">An error has occurred.</div> | ||
} | ||
} @else { | ||
<app-loader /> | ||
} | ||
</div> |
23 changes: 23 additions & 0 deletions
23
...tails/api-tab-documentation/components/api-documentation/api-documentation.component.scss
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,23 @@ | ||
/* | ||
* Copyright (C) 2024 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
.page-content { | ||
width: 100%; | ||
|
||
&__container { | ||
min-width: 0; | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
...details/api-tab-documentation/components/api-documentation/api-documentation.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,68 @@ | ||
/* | ||
* Copyright (C) 2024 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { AsyncPipe } from '@angular/common'; | ||
import { HttpErrorResponse } from '@angular/common/http'; | ||
import { Component, DestroyRef, effect, inject, input, InputSignal } from '@angular/core'; | ||
import { Router, RouterModule } from '@angular/router'; | ||
import { catchError, map, Observable, of, tap } from 'rxjs'; | ||
import { BreadcrumbService } from 'xng-breadcrumb'; | ||
|
||
import { LoaderComponent } from '../../../../../../components/loader/loader.component'; | ||
import { PageComponent } from '../../../../../../components/page/page.component'; | ||
import { Page } from '../../../../../../entities/page/page'; | ||
import { PageService } from '../../../../../../services/page.service'; | ||
|
||
interface SelectedPageData { | ||
result?: Page; | ||
error?: unknown; | ||
} | ||
|
||
@Component({ | ||
selector: 'app-api-documentation', | ||
standalone: true, | ||
imports: [AsyncPipe, PageComponent, RouterModule, LoaderComponent], | ||
templateUrl: './api-documentation.component.html', | ||
styleUrl: './api-documentation.component.scss', | ||
}) | ||
export class ApiDocumentationComponent { | ||
pageId: InputSignal<string> = input.required<string>(); | ||
apiId: InputSignal<string> = input.required<string>(); | ||
pages: InputSignal<Page[]> = input.required<Page[]>(); | ||
selectedPageData$: Observable<SelectedPageData> = of(); | ||
destroyRef = inject(DestroyRef); | ||
|
||
constructor( | ||
private readonly pageService: PageService, | ||
private readonly router: Router, | ||
private readonly breadcrumbService: BreadcrumbService, | ||
) { | ||
effect(() => { | ||
this.selectedPageData$ = this.getSelectedPage$(this.pageId()); | ||
}); | ||
} | ||
|
||
private getSelectedPage$(pageId: string): Observable<SelectedPageData> { | ||
return this.pageService.getByApiIdAndId(this.apiId(), pageId, true).pipe( | ||
tap(page => { | ||
this.breadcrumbService.set('@pageName', page.name); | ||
}), | ||
map(result => ({ result })), | ||
catchError((error: HttpErrorResponse) => { | ||
return of({ error }); | ||
}), | ||
); | ||
} | ||
} |
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
28 changes: 28 additions & 0 deletions
28
gravitee-apim-portal-webui-next/src/components/drawer/drawer.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,28 @@ | ||
<!-- | ||
Copyright (C) 2024 The Gravitee team (http://gravitee.io) | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<button mat-icon-button class="btn_container" (click)="close()"> | ||
<div class="btn_container__btn"> | ||
<mat-icon> | ||
{{ isOpen ? 'keyboard_double_arrow_left' : 'menu' }} | ||
</mat-icon> | ||
</div> | ||
</button> | ||
|
||
<div [ngClass]="isOpen ? 'drawer-container__content' : 'drawer-container__content--hidden'"> | ||
<ng-content></ng-content> | ||
</div> |
25 changes: 25 additions & 0 deletions
25
gravitee-apim-portal-webui-next/src/components/drawer/drawer.component.scss
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,25 @@ | ||
/* | ||
* Copyright (C) 2024 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
.drawer-container { | ||
&__content { | ||
transition: all 300ms; | ||
|
||
&--hidden { | ||
display: none; | ||
} | ||
} | ||
} |
Oops, something went wrong.