mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-06-29 15:27:34 +00:00
update query
This commit is contained in:
parent
c7a087e715
commit
c38ba1c0b2
@ -34,25 +34,23 @@ class HTTPError extends Error {
|
||||
}
|
||||
}
|
||||
|
||||
const BasePath = `/graphql`;
|
||||
export const BasePath = `/graphql`;
|
||||
|
||||
export async function httpQuery({
|
||||
path = "",
|
||||
url = "",
|
||||
method = "GET",
|
||||
json,
|
||||
headers = {},
|
||||
basePath = `/graphql`,
|
||||
}: {
|
||||
path?: string;
|
||||
method: string;
|
||||
json: unknown;
|
||||
headers: Recordable;
|
||||
basePath?: string;
|
||||
headers?: Recordable;
|
||||
url: string;
|
||||
}) {
|
||||
const timeoutId = setTimeout(() => {
|
||||
abortRequestsAndUpdate();
|
||||
}, Timeout);
|
||||
const url = `${basePath || BasePath}${path}`;
|
||||
|
||||
const response: Response = await fetch(url, {
|
||||
method,
|
||||
headers: {
|
||||
|
@ -14,13 +14,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { httpQuery } from "./base";
|
||||
import { httpQuery, BasePath } from "./base";
|
||||
|
||||
async function customQuery(param: { queryStr: string; conditions: { [key: string]: unknown } }) {
|
||||
const response = await httpQuery({
|
||||
url: BasePath,
|
||||
method: "post",
|
||||
json: { query: param.queryStr, variables: { ...param.conditions } },
|
||||
headers: {},
|
||||
});
|
||||
if (response.errors) {
|
||||
response.errors = response.errors.map((e: { message: string }) => e.message).join(" ");
|
||||
|
@ -14,21 +14,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { httpQuery } from "./base";
|
||||
import { httpQuery } from "../base";
|
||||
|
||||
export default async function fetchQuery({
|
||||
headers,
|
||||
method,
|
||||
json,
|
||||
}: {
|
||||
method: string;
|
||||
json: unknown;
|
||||
headers: Recordable;
|
||||
}) {
|
||||
export default async function fetchQuery({ method, json, url }: { method: string; json: unknown; url: string }) {
|
||||
const response = await httpQuery({
|
||||
method,
|
||||
json,
|
||||
headers,
|
||||
url,
|
||||
});
|
||||
if (response.errors) {
|
||||
response.errors = response.errors.map((e: { message: string }) => e.message).join(" ");
|
21
src/graphql/http/url.ts
Normal file
21
src/graphql/http/url.ts
Normal file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export const ClusterNodes = `/status/cluster/nodes`;
|
||||
|
||||
export const ConfigTTL = `/status/config/ttl`;
|
||||
|
||||
export const DebuggingConfigDump = `/debugging/config/dump`;
|
@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { httpQuery } from "./base";
|
||||
import { httpQuery, BasePath } from "./base";
|
||||
import * as app from "./query/app";
|
||||
import * as selector from "./query/selector";
|
||||
import * as dashboard from "./query/dashboard";
|
||||
@ -50,8 +50,8 @@ class Graphql {
|
||||
}
|
||||
async params(variables: unknown) {
|
||||
const response = await httpQuery({
|
||||
url: BasePath,
|
||||
method: "post",
|
||||
headers: {},
|
||||
json: {
|
||||
query: query[this.queryData],
|
||||
variables,
|
||||
|
@ -47,6 +47,10 @@ limitations under the License. -->
|
||||
<i class="ml-10">{{ t("timeReload") }}</i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-h item">
|
||||
<span class="label">{{ t("TTL") }}</span>
|
||||
<div> TTL </div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
|
Loading…
Reference in New Issue
Block a user