Skip to content

Commit 92eec25

Browse files
committed
new: Add verbs badges (implements #61)
1 parent 3f48357 commit 92eec25

File tree

4 files changed

+99
-8
lines changed

4 files changed

+99
-8
lines changed

lib/components/EndpointLink/endpoint-link.scss

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,39 @@
110110
transform: translateY(0%) scaleY(1);
111111
}
112112
}
113+
114+
.http-verb {
115+
color: white;
116+
117+
&.get {
118+
background-color: $get-color;
119+
}
120+
121+
&.post {
122+
background-color: $post-color;
123+
}
124+
125+
&.put {
126+
background-color: $put-color;
127+
}
128+
129+
&.options {
130+
background-color: $options-color;
131+
}
132+
133+
&.patch {
134+
background-color: $patch-color;
135+
}
136+
137+
&.delete {
138+
background-color: $delete-color;
139+
}
140+
141+
&.basic {
142+
background-color: $basic-color;
143+
}
144+
145+
&.link {
146+
background-color: $link-color;
147+
}
148+
}

lib/components/SideMenu/side-menu-items.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<li *ngFor="let item of items; let idx = index" class="menu-item"
22
ngClass="menu-item-depth-{{item.depth}} {{item.active ? 'active' : ''}} menu-item-for-{{item.metadata?.type}}">
3-
<label class="menu-item-header" [ngClass]="{disabled: !item.ready}" (click)="activateItem(item)"> {{item.name}}</label>
3+
<label class="menu-item-header" [ngClass]="{disabled: !item.ready}" (click)="activateItem(item)">
4+
<span class="operation-type" [ngClass]="item?.metadata?.operation" *ngIf="item?.metadata?.operation"> {{item?.metadata?.operation}} </span>
5+
{{item.name}}
6+
</label>
47
<ul *ngIf="item.items" class="menu-subitems" [@itemAnimation]="(item.active || item.isGroup) ? 'expanded' : 'collapsed'">
58
<side-menu-items [items]="item.items" (activate)="activateItem($event)"> </side-menu-items>
69
</ul>

lib/components/SideMenu/side-menu-items.scss

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,58 @@
108108
//background: none;
109109
}
110110
}
111+
112+
.menu-item-header > .operation-type {
113+
width: 26px;
114+
display: inline-block;
115+
height: 13px;
116+
background-color: #333;
117+
border-radius: 3px;
118+
vertical-align: middle;
119+
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAACgCAYAAADuDlcXAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpFNjQ5N0JDQUE3OTYxMUU0ODNGMUE0RUM3NjRDRTQyNyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpFNjQ5N0JDQkE3OTYxMUU0ODNGMUE0RUM3NjRDRTQyNyI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkU2NDk3QkM4QTc5NjExRTQ4M0YxQTRFQzc2NENFNDI3IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkU2NDk3QkM5QTc5NjExRTQ4M0YxQTRFQzc2NENFNDI3Ii8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+mIrGwQAAAZ9JREFUeNrsmtuOwyAMRBmU//9lbx9208ayjQ1EarSDVFW56ARIGGZIIK/S3gWvX3X7LN3a6WxDHdPnnDBpcZHEOe3wrmLUMg2zatKykPOq1/5fK71tLIQR9jjYsaJfWdWAAcRsM2W1z9LNGcFkRlmtPhvpf7qmHAGEESZqLFr/qbHaCy4Is6oxLdvT+nWr0lLPCCPsFn+mA5e2UjLycL1o6qLMiapqRGoifVCDinrgU2mRyJthzZg3CSPs+2HhIM4YGq0a4oDgiGjYTKw20/OwUzAEuXz73YSqtdsV+F1a3eZpweFEGGG7Y3ULbJRk4nYPlEHbUi86wpNtbz4oB37PICOrLEdC9DKzFv7EkQ8tYY8Nr8tuyJrRsdpMrIJ0n4GPBmGEEUbYzRMKnFwug1B7rppmbCiyBjBrQ1vC8KW/CxrF7osNrRbxMjofWsIIuwU2vapnZfTRq4/wFXl3hG9bMzP6ZWV47LoB+Gym1/EyUleKI2GEPW8pQpu80bHLvsifSWFVAVEzo2VDTxxb9T16eO7sF0vmxPNPxPFHgAEA/rGUMXq/uWcAAAAASUVORK5CYII=');
120+
background-repeat: no-repeat;
121+
background-position: 6px 4px;
122+
text-indent: -9000px;
123+
margin-right: 7px;
124+
margin-top: -3px;
125+
126+
&.get {
127+
background-position: 8px -12px;
128+
background-color: $get-color;
129+
}
130+
131+
&.post {
132+
background-position: 6px 4px;
133+
background-color: $post-color;
134+
}
135+
136+
&.put {
137+
background-position: 8px -28px;
138+
background-color: $put-color;
139+
}
140+
141+
&.options {
142+
background-position: 4px -148px;
143+
background-color: $options-color;
144+
}
145+
146+
&.patch {
147+
background-position: 4px -114px;
148+
background-color: $patch-color;
149+
}
150+
151+
&.delete {
152+
background-position: 4px -44px;
153+
background-color: $delete-color;
154+
}
155+
156+
&.basic {
157+
background-position: 5px -79px;
158+
background-color: $basic-color;
159+
}
160+
161+
&.link {
162+
background-position: 4px -131px;
163+
background-color: $link-color;
164+
}
165+
}

lib/components/SideMenu/side-menu.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ import { Component,
1111
} from '@angular/core';
1212

1313
import { trigger, state, animate, transition, style } from '@angular/core';
14-
import { BaseComponent, SpecManager } from '../base';
15-
import { ScrollService, MenuService, OptionsService, MenuItem, Marker} from '../../services/';
14+
import { ScrollService, MenuService, OptionsService, MenuItem } from '../../services/';
1615
import { BrowserDomAdapter as DOM } from '../../utils/browser-adapter';
1716

1817
const global = window;
@@ -47,7 +46,7 @@ export class SideMenuItems {
4746
templateUrl: './side-menu.html',
4847
styleUrls: ['./side-menu.css']
4948
})
50-
export class SideMenu extends BaseComponent implements OnInit, OnDestroy {
49+
export class SideMenu implements OnInit, OnDestroy {
5150
activeCatCaption: string;
5251
activeItemCaption: string;
5352
menuItems: Array<MenuItem>;
@@ -59,15 +58,13 @@ export class SideMenu extends BaseComponent implements OnInit, OnDestroy {
5958
private $scrollParent: any;
6059

6160
constructor(
62-
specMgr:SpecManager,
6361
elementRef:ElementRef,
6462
private scrollService:ScrollService,
6563
private menuService:MenuService,
6664
optionsService:OptionsService,
6765
private detectorRef:ChangeDetectorRef,
68-
private marker:Marker
66+
//private marker:Marker
6967
) {
70-
super(specMgr);
7168
this.$element = elementRef.nativeElement;
7269

7370
this.activeCatCaption = '';
@@ -154,7 +151,7 @@ export class SideMenu extends BaseComponent implements OnInit, OnDestroy {
154151
}
155152

156153
ngOnInit() {
157-
this.preinit();
154+
this.init();
158155
}
159156

160157
ngAfterViewInit() {

0 commit comments

Comments
 (0)