Skip to content

Commit

Permalink
fix upstream merge issues mockoon#83
Browse files Browse the repository at this point in the history
  • Loading branch information
isuru89 committed Jun 8, 2024
1 parent f246429 commit e9ed51e
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 188 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,24 @@
</div>
<div class="nav-link-subtitle mt-1 d-flex align-items-center">
<span
*ngIf="log.protocol === 'ws'"
class="color-method-{{
log.protocol | lowercase
}} me-2 route-method"
>{{ log.protocol | uppercase }}
</span>
<span
*ngIf="log.protocol !== 'ws'"
class="color-method-{{
log.method | lowercase
}} me-2 route-method"
>{{ log.method | uppercase }}
</span>
<span
class="color-status-{{
log.response.status.toString().slice(0, 1).concat('xx')
log.response?.status.toString().slice(0, 1).concat('xx')
}} me-2"
>{{ log.response.status }}
>{{ log.response?.status }}
</span>
<app-svg
*ngIf="log.route && !log.proxied"
Expand Down Expand Up @@ -201,7 +209,23 @@
<div class="environment-logs-content-item">
<strong>Request URL:</strong> {{ data.selectedLog.url }}
</div>
<div class="environment-logs-content-item">
<div
*ngIf="data.selectedLog.protocol === 'ws'"
class="environment-logs-content-item"
>
<strong>Protocol:&nbsp;</strong>
<span
class="color-method-{{
data.selectedLog.protocol | lowercase
}} me-2"
>
{{ data.selectedLog.protocol | uppercase }}
</span>
</div>
<div
*ngIf="data.selectedLog.protocol !== 'ws'"
class="environment-logs-content-item"
>
<strong>Method:&nbsp;</strong>
<span
class="color-method-{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
</div>

<div
*ngIf="activeRoute && activeRoute.type === 'ws'"
*ngIf="data.activeRoute && data.activeRoute.type === 'ws'"
class="d-flex mt-2"
>
<app-toggle
Expand Down Expand Up @@ -182,6 +182,9 @@
*ngIf="data.activeRouteResponse"
class="dropdown-toggle-label"
>
<span *ngIf="data.activeRoute.type === 'ws'" class="pe-2"
>Response {{ data.activeRouteResponseIndex + 1 }}
</span>
<span *ngIf="data.activeRoute?.type === 'http'" class="pe-2"
>Response {{ data.activeRouteResponseIndex + 1 }} ({{
data.activeRouteResponse?.statusCode
Expand Down Expand Up @@ -262,6 +265,9 @@
)
"
>
<span *ngIf="data.activeRoute.type === 'ws'" class="pe-2"
>Response {{ routeResponseIndex + 1 }}</span
>
<span *ngIf="data.activeRoute?.type === 'http'" class="pe-2"
>Response {{ routeResponseIndex + 1 }} ({{
routeResponse.statusCode
Expand Down Expand Up @@ -299,7 +305,12 @@
<app-svg icon="data"></app-svg>
</span>
</ng-container>
<ng-container *ngIf="data.activeRoute?.type === 'http'">
<ng-container
*ngIf="
data.activeRoute?.type === 'http' ||
data.activeRoute?.type === 'ws'
"
>
<span
*ngIf="routeResponse.default"
class="px-2"
Expand Down Expand Up @@ -336,159 +347,12 @@
prefix="response-modes"
formControlName="responseMode"
[items]="
activeRoute.type === 'ws' ? responseModesForWs : responseModes
data.activeRoute.type === 'ws'
? responseModesForWs
: responseModes
"
appTourStep="tour-route-response-modes"
></app-toggle>

<div *ngIf="data.activeRouteResponse" class="d-flex p-2">
<!-- Response settings -->
<ul class="nav nav-tabs flex-fill">
<li class="nav-item">
<a
class="nav-link"
[ngClass]="{ active: activeTab === 'RESPONSE' }"
(click)="setActiveTab('RESPONSE')"
>{{
activeRoute.type === 'http' ||
(activeRoute.type === 'crud' &&
!data.activeRouteResponse?.default)
? 'Status & Body'
: 'Data'
}}</a
>
</li>
<li class="nav-item" *ngIf="activeRoute.type !== 'ws'">
<a
class="nav-link d-flex align-items-center"
[ngClass]="{ active: activeTab === 'HEADERS' }"
(click)="setActiveTab('HEADERS')"
>
Headers
<span
*ngIf="data.activeRouteResponse?.headers.length"
class="badge badge-hollow fw-bold ms-2"
>
{{ data.activeRouteResponse?.headers.length }}
</span>
</a>
</li>
<li
class="nav-item"
*ngIf="
activeRoute.type === 'http' ||
activeRoute.type === 'ws' ||
(activeRoute.type === 'crud' &&
!data.activeRouteResponse?.default)
"
appTourStep="tour-route-response-rules"
>
<a
class="nav-link d-flex align-items-center"
[ngClass]="{ active: activeTab === 'RULES' }"
(click)="setActiveTab('RULES')"
><span
*ngIf="
rulesDisablingResponseModes.includes(
activeRoute.responseMode
) || !!activeRoute.streamingMode
"
class="text-warning"
[ngbTooltip]="texts.DISABLED_RULES_WARNING"
id="disabled-rules-warning-icon"
><app-svg icon="warning" class="pe-1"></app-svg>
</span>
Rules
<span
*ngIf="data.activeRouteResponse?.rules.length"
class="badge badge-hollow fw-bold ms-2"
>
{{ data.activeRouteResponse?.rules.length }}
</span>
</a>
</li>
<li
class="nav-item"
*ngIf="
activeRoute.type === 'http' ||
(activeRoute.type === 'crud' &&
!data.activeRouteResponse?.default)
"
>
<a
class="nav-link d-flex align-items-center"
[ngClass]="{ active: activeTab === 'CALLBACKS' }"
(click)="setActiveTab('CALLBACKS')"
>
Callbacks
<span
*ngIf="data.activeRouteResponse?.callbacks?.length"
class="badge badge-hollow font-weight-bold ms-2"
>
{{ data.activeRouteResponse?.callbacks?.length }}
</span>
</a>
</li>
<li
class="nav-item"
*ngIf="
activeRoute.type === 'http' ||
activeRoute.type === 'ws' ||
(activeRoute.type === 'crud' &&
!data.activeRouteResponse?.default)
"
>
<a
class="nav-link"
[ngClass]="{ active: activeTab === 'SETTINGS' }"
(click)="setActiveTab('SETTINGS')"
>Settings</a
>
</li>
</ul>

<!-- Response duplication button -->
<button
type="button"
id="route-response-duplication-button"
class="btn btn-link btn-icon"
(click)="duplicateRouteResponse()"
>
<span ngbTooltip="Duplicate response">
<app-svg icon="content_copy"></app-svg
></span>
</button>

<!-- Response delete button: show anywhere if http and more than one response, or only after the first response if on a crud route -->
<button
*ngIf="
(activeRoute?.responses.length > 1 &&
(activeRoute?.type === 'http' ||
activeRoute?.type === 'ws')) ||
(!data.activeRouteResponse?.default &&
activeRoute?.type === 'crud')
"
type="button"
id="route-response-removal-button"
class="btn btn-link btn-icon"
(click)="deleteCurrentRouteResponse()"
>
<span
*ngIf="
(deleteCurrentRouteResponseRequested$ | async).enabled ===
false
"
ngbTooltip="Delete response"
><app-svg icon="delete"></app-svg
></span>
<span
*ngIf="(deleteCurrentRouteResponseRequested$ | async).enabled"
class="text-danger"
ngbTooltip="Confirm deletion"
><app-svg icon="delete"></app-svg
></span>
</button>
</div>
</div>

<div *ngIf="data.activeRouteResponse" class="d-flex p-2">
Expand All @@ -508,7 +372,7 @@
}}</a
>
</li>
<li class="nav-item">
<li class="nav-item" *ngIf="data.activeRoute.type !== 'ws'">
<a
class="nav-link d-flex align-items-center"
[ngClass]="{ active: data.activeTab === 'HEADERS' }"
Expand All @@ -527,6 +391,7 @@
class="nav-item"
*ngIf="
data.activeRoute?.type === 'http' ||
data.activeRoute?.type === 'ws' ||
(data.activeRoute?.type === 'crud' &&
!data.activeRouteResponse?.default)
"
Expand All @@ -540,7 +405,7 @@
*ngIf="
rulesDisablingResponseModes.includes(
data.activeRoute?.responseMode
)
) || !!data.activeRoute.streamingMode
"
class="text-warning"
[ngbTooltip]="texts.DISABLED_RULES_WARNING"
Expand Down Expand Up @@ -611,7 +476,8 @@
<button
*ngIf="
(data.activeRoute?.responses.length > 1 &&
data.activeRoute?.type === 'http') ||
(data.activeRoute?.type === 'http' ||
data.activeRoute?.type === 'ws')) ||
(!data.activeRouteResponse?.default &&
data.activeRoute?.type === 'crud')
"
Expand Down Expand Up @@ -654,7 +520,7 @@
data.activeRoute?.type === 'crud' &&
data.activeRouteResponse?.default
? 'crud'
: activeRoute.type
: data.activeRoute.type
}}"
>
<app-custom-select
Expand Down Expand Up @@ -715,7 +581,8 @@
type="number"
class="form-control"
[attr.disabled]="
activeRoute.type === 'ws' && !!activeRoute.streamingMode
data.activeRoute.type === 'ws' &&
!!data.activeRoute.streamingMode
? true
: null
"
Expand All @@ -739,9 +606,9 @@

<ng-container
*ngIf="
activeRoute.type === 'http' ||
activeRoute.type === 'ws' ||
(activeRoute.type === 'crud' &&
data.activeRoute.type === 'http' ||
data.activeRoute.type === 'ws' ||
(data.activeRoute.type === 'crud' &&
!data.activeRouteResponse?.default)
"
>
Expand Down Expand Up @@ -947,7 +814,7 @@
</div>
<div
class="input-group align-items-center"
*ngIf="activeRoute.type !== 'ws'"
*ngIf="data.activeRoute.type !== 'ws'"
>
<div class="form-check mb-0">
<input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,31 +37,12 @@
<button class="btn dropdown-item" (click)="addHTTPRoute()">
<app-svg icon="endpoint" class="me-1"></app-svg> HTTP route
</button>
<button class="btn dropdown-item" (click)="addWebSocketRoute()">
<app-svg icon="websocket" class="me-1"></app-svg> WebSocket
</button>
<button class="btn dropdown-item" (click)="addFolder()">
<app-svg icon="folder" class="me-1"></app-svg> Folder
</button>
<div
class="dropdown-menu"
id="routes-add-dropdown-menu"
ngbDropdownMenu
>
<button class="btn dropdown-item" (click)="addCRUDRouteTemplate()">
<app-svg icon="magic" class="me-1"></app-svg> Assistants and
templates
</button>
<button class="btn dropdown-item" (click)="addCRUDRoute()">
<app-svg icon="endpoints" class="me-1"></app-svg> CRUD route
</button>
<button class="btn dropdown-item" (click)="addHTTPRoute()">
<app-svg icon="endpoint" class="me-1"></app-svg> HTTP route
</button>
<button class="btn dropdown-item" (click)="addWebSocketRoute()">
<app-svg icon="websocket" class="me-1"></app-svg> WebSocket
</button>
<button class="btn dropdown-item" (click)="addFolder()">
<app-svg icon="folder" class="me-1"></app-svg> Folder
</button>
</div>
</div>
</div>

Expand Down Expand Up @@ -280,9 +261,19 @@
<div class="nav-link-subtitle mt-1 d-flex align-items-center">
<span
class="color-method-{{
route.type === 'crud' ? 'crud' : route.method
route.type === 'crud'
? 'crud'
: route.type === 'ws'
? 'ws'
: route.method
}} me-2"
>{{ route.type === 'crud' ? 'CRUD' : (route.method | uppercase) }}
>{{
route.type === 'crud'
? 'CRUD'
: route.type === 'ws'
? 'WS'
: (route.method | uppercase)
}}
</span>

<app-svg
Expand Down

0 comments on commit e9ed51e

Please sign in to comment.