Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* ============================================================================
* Copyright (c) Palo Alto Networks
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
* ========================================================================== */

import { create } from "./utils";

export function createCallbackMethodEndpoint(method: String, path: String) {
return [
create("MethodEndpoint", {
method: method,
path: path,
context: "callback",
}),
"\n\n",
];
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* LICENSE file in the root directory of this source tree.
* ========================================================================== */

import { createCallbackMethodEndpoint } from "./createCallbackMethodEndpoint";
import { createDescription } from "./createDescription";
import { createMethodEndpoint } from "./createMethodEndpoint";
import { createRequestBodyDetails } from "./createRequestBodyDetails";
import { createStatusCodes } from "./createStatusCodes";
import { create } from "./utils";
Expand Down Expand Up @@ -78,7 +78,7 @@ export function createCallbacks({ callbacks }: Props) {
label: `${method.toUpperCase()} ${name}`,
value: `${method}-${name}`,
children: [
createMethodEndpoint(method, path),
createCallbackMethodEndpoint(method, path),
// TODO: add `deprecation notice` when markdown support is added
createDescription(description),
createRequestBodyDetails({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,12 @@
import { create } from "./utils";

export function createMethodEndpoint(method: String, path: String) {
return [create("MethodEndpoint", { method: method, path: path }), "\n\n"];
return [
create("MethodEndpoint", {
method: method,
path: path,
context: "endpoint",
}),
"\n\n",
];
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,18 @@ function colorForMethod(method: string) {
export interface Props {
method: string;
path: string;
context?: "endpoint" | "callback";
}

function MethodEndpoint({ method, path }: Props) {
function MethodEndpoint({ method, path, context }: Props) {
let serverValue = useTypedSelector((state: any) => state.server.value);
let serverUrlWithVariables = "";

const renderServerUrl = () => {
if (context === "callback") {
return "";
}

if (serverValue && serverValue.variables) {
serverUrlWithVariables = serverValue.url.replace(/\/$/, "");

Expand Down
Loading