Skip to content

Commit 74a3193

Browse files
committed
feat: new option path-in-middle-panel
1 parent 1a29784 commit 74a3193

File tree

4 files changed

+40
-2
lines changed

4 files changed

+40
-2
lines changed

lib/components/Operation/operation.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
<h2 class="operation-header sharable-header">
44
<a class="share-link" href="#{{operation.anchor}}"></a>{{operation.summary}}
55
</h2>
6+
<endpoint-link *ngIf="pathInMiddlePanel"
7+
[verb]="operation.verb" [path]="operation.path"> </endpoint-link>
68
<div class="operation-tags" *ngIf="operation.info.tags.length">
79
<a *ngFor="let tag of operation.info.tags" attr.href="#tag/{{tag}}"> {{tag}} </a>
810
</div>
@@ -16,7 +18,8 @@ <h2 class="operation-header sharable-header">
1618
<div class="operation-samples">
1719
<h4 class="operation-params-subheader">Definition</h4>
1820

19-
<endpoint-link [verb]="operation.verb" [path]="operation.path"> </endpoint-link>
21+
<endpoint-link *ngIf="!pathInMiddlePanel"
22+
[verb]="operation.verb" [path]="operation.path"> </endpoint-link>
2023

2124
<div>
2225
<request-samples [pointer]="pointer" [schemaPointer]="operation.bodyParam?._pointer">

lib/components/Operation/operation.scss

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@
5757
background: $samples-panel-bg-color;
5858
}
5959

60+
.operation-samples pre {
61+
color: $sample-panel-color;
62+
}
63+
6064
.operation-samples header,
6165
.operation-samples > h5 {
6266
color: $sample-panel-headers-color;
@@ -103,3 +107,28 @@
103107
padding-bottom: 0;
104108
}
105109
}
110+
111+
.operation-content /deep/ endpoint-link {
112+
margin-bottom: 16px;
113+
114+
.operation-endpoint[class] {
115+
padding: 5px 30px 5px 5px;
116+
border: 0;
117+
border-bottom: 1px solid $border-color;
118+
border-radius: 0;
119+
background-color: transparent;
120+
}
121+
.operation-api-url-path {
122+
color: $black;
123+
}
124+
125+
.expand-icon {
126+
top: 8px;
127+
background-color: $border-color;
128+
}
129+
130+
.servers-overlay {
131+
border: 1px solid $border-color;
132+
border-top: 0;
133+
}
134+
}

lib/components/Operation/operation.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,15 @@ export class Operation extends BaseComponent implements OnInit {
3535
@HostBinding('attr.operation-id') operationId;
3636

3737
operation: OperationInfo;
38+
pathInMiddlePanel: boolean;
3839

3940
constructor(
4041
specMgr:SpecManager,
4142
private optionsService: OptionsService,
4243
private menu: MenuService) {
4344
super(specMgr);
45+
46+
this.pathInMiddlePanel = optionsService.options.pathInMiddlePanel;
4447
}
4548

4649
init() {

lib/services/options.service.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ const OPTION_NAMES = new Set([
1717
'lazyRendering',
1818
'expandResponses',
1919
'requiredPropsFirst',
20-
'noAutoAuth'
20+
'noAutoAuth',
21+
'pathInMiddlePanel',
2122
]);
2223

2324
export interface Options {
@@ -31,6 +32,7 @@ export interface Options {
3132
$scrollParent?: HTMLElement | Window;
3233
requiredPropsFirst?: boolean;
3334
noAutoAuth?: boolean;
35+
pathInMiddlePanel?: boolean;
3436
spec?: any;
3537
}
3638

@@ -98,6 +100,7 @@ export class OptionsService {
98100
if (isString(this._options.lazyRendering)) this._options.lazyRendering = true;
99101
if (isString(this._options.requiredPropsFirst)) this._options.requiredPropsFirst = true;
100102
if (isString(this._options.noAutoAuth)) this._options.noAutoAuth = true;
103+
if (isString(this._options.pathInMiddlePanel)) this._options.pathInMiddlePanel = true;
101104
if (isString(this._options.expandResponses)) {
102105
let str = this._options.expandResponses as string;
103106
if (str === 'all') return;

0 commit comments

Comments
 (0)