mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-06-29 22:47:34 +00:00
fetch config
This commit is contained in:
parent
82e0846893
commit
2c5f145f5c
@ -15,12 +15,13 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { httpQuery } from "../base";
|
import { httpQuery } from "../base";
|
||||||
|
import { HttpURL } from "./url";
|
||||||
|
|
||||||
export default async function fetchQuery({ method, json, url }: { method: string; json?: unknown; url: string }) {
|
export default async function fetchQuery({ method, json, path }: { method: string; json?: unknown; path: string }) {
|
||||||
const response = await httpQuery({
|
const response = await httpQuery({
|
||||||
method,
|
method,
|
||||||
json,
|
json,
|
||||||
url,
|
url: (HttpURL as { [key: string]: string })[path],
|
||||||
});
|
});
|
||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
response.errors = response.errors.map((e: { message: string }) => e.message).join(" ");
|
response.errors = response.errors.map((e: { message: string }) => e.message).join(" ");
|
||||||
|
@ -14,8 +14,9 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
export const ClusterNodes = `/status/cluster/nodes`;
|
|
||||||
|
|
||||||
export const ConfigTTL = `/status/config/ttl`;
|
export const HttpURL = {
|
||||||
|
ClusterNodes: `/status/cluster/nodes`,
|
||||||
export const DebuggingConfigDump = `/debugging/config/dump`;
|
ConfigTTL: `/status/config/ttl`,
|
||||||
|
DebuggingConfigDump: `/debugging/config/dump`,
|
||||||
|
};
|
||||||
|
@ -21,28 +21,42 @@ import type { Cluster } from "@/types/settings";
|
|||||||
|
|
||||||
interface SettingsState {
|
interface SettingsState {
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
nodes: Cluster[];
|
clusterNodes: Cluster[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const settingsStore = defineStore({
|
export const settingsStore = defineStore({
|
||||||
id: "settings",
|
id: "settings",
|
||||||
state: (): SettingsState => ({
|
state: (): SettingsState => ({
|
||||||
nodes: [],
|
clusterNodes: [],
|
||||||
loading: false,
|
loading: false,
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
async getNodes() {
|
async getClusterNodes() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
const res = await fetchQuery({
|
const res = await fetchQuery({
|
||||||
method: "get",
|
method: "get",
|
||||||
url: "",
|
path: "ClusterNodes",
|
||||||
|
});
|
||||||
|
this.loading = false;
|
||||||
|
return res.nodes;
|
||||||
|
},
|
||||||
|
async getConfigTTL() {
|
||||||
|
this.loading = true;
|
||||||
|
const res = await fetchQuery({
|
||||||
|
method: "get",
|
||||||
|
path: "ConfigTTL",
|
||||||
|
});
|
||||||
|
this.loading = false;
|
||||||
|
return res;
|
||||||
|
},
|
||||||
|
async getDebuggingConfigDump() {
|
||||||
|
this.loading = true;
|
||||||
|
const res = await fetchQuery({
|
||||||
|
method: "get",
|
||||||
|
path: "DebuggingConfigDump",
|
||||||
});
|
});
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
if (res.errors) {
|
|
||||||
return res;
|
return res;
|
||||||
}
|
|
||||||
|
|
||||||
return res.data;
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user