Skip to content

Commit

Permalink
Show description of service method parameters and make their types cl…
Browse files Browse the repository at this point in the history
…ickable (#363)

#SkipVersionBump
  • Loading branch information
lukasmatta authored Mar 28, 2024
1 parent 63ee020 commit 29cde86
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 11 deletions.
2 changes: 1 addition & 1 deletion projects/composition/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ const routes: Routes = [
)
},
{
matcher: pathMatcher('notifications'),
matcher: pathMatcher('notification'),
title: 'Notifications',
loadComponent: () =>
import('./pages/notification-page/notification-page.component').then(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class NavigationSidebarComponent implements OnInit {
},
{
title: 'Notifications',
url: '/notifications'
url: '/notification'
},
{
title: 'Paginator',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,29 @@ <h2>Methods</h2>
<span>{{ method.name }}</span>
</td>
<td class="highlighted-text">
{{ parseParameters(method.parameters) || 'null' }}
<div class="parameters">
@for (param of method.parameters; track param.name) {
<span>
<strong [cpsTooltip]="param.description || ''">
{{ param.name }}:
</strong>
<a
*ngIf="
param.type | detectType: TypesMap as type;
else simpleType
"
[routerLink]="'/' + TypesMap[type] + '/api'"
fragment="{{ type }}">
{{ param.type }}
</a>
<ng-template #simpleType>
<span>{{ param.type }}</span>
</ng-template>
</span>
} @empty {
null
}
</div>
</td>
<td class="highlighted-text">
<a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@
border-bottom: 1px solid var(--cps-color-line-light);
white-space: pre-line;

span {
display: flex;
max-width: min-content;
white-space: pre-line;
}

&.highlighted-bg {
span {
color: var(--cps-color-depth-darken4);
Expand Down Expand Up @@ -62,6 +56,16 @@
border: 1px solid var(--cps-color-line-light);
}
}

.parameters {
display: flex;
flex-direction: column;
gap: 5px;

strong {
cursor: pointer;
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { Component, Input } from '@angular/core';
import { ServiceAPI } from '../../models/service-api.model';
import { CommonModule } from '@angular/common';
import { CpsTabComponent, CpsTabGroupComponent } from 'cps-ui-kit';
import {
CpsTabComponent,
CpsTabGroupComponent,
CpsTooltipDirective
} from 'cps-ui-kit';
import { ViewerComponent } from '../viewer/viewer.component';
import TypesMap from '../../api-data/types_map.json';
import { RouterLink } from '@angular/router';
Expand All @@ -17,7 +21,8 @@ import { DetectTypePipe } from '../../pipes/detect-type.pipe';
CpsTabComponent,
CpsTabGroupComponent,
RouterLink,
DetectTypePipe
DetectTypePipe,
CpsTooltipDirective
]
})
export class ServiceDocsViewerComponent extends ViewerComponent {
Expand Down

0 comments on commit 29cde86

Please sign in to comment.