mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-06-29 12:47:35 +00:00
fetch config
This commit is contained in:
parent
82e0846893
commit
2c5f145f5c
@ -15,12 +15,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
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({
|
||||
method,
|
||||
json,
|
||||
url,
|
||||
url: (HttpURL as { [key: string]: string })[path],
|
||||
});
|
||||
if (response.errors) {
|
||||
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
|
||||
* limitations under the License.
|
||||
*/
|
||||
export const ClusterNodes = `/status/cluster/nodes`;
|
||||
|
||||
export const ConfigTTL = `/status/config/ttl`;
|
||||
|
||||
export const DebuggingConfigDump = `/debugging/config/dump`;
|
||||
export const HttpURL = {
|
||||
ClusterNodes: `/status/cluster/nodes`,
|
||||
ConfigTTL: `/status/config/ttl`,
|
||||
DebuggingConfigDump: `/debugging/config/dump`,
|
||||
};
|
||||
|
@ -21,28 +21,42 @@ import type { Cluster } from "@/types/settings";
|
||||
|
||||
interface SettingsState {
|
||||
loading: boolean;
|
||||
nodes: Cluster[];
|
||||
clusterNodes: Cluster[];
|
||||
}
|
||||
|
||||
export const settingsStore = defineStore({
|
||||
id: "settings",
|
||||
state: (): SettingsState => ({
|
||||
nodes: [],
|
||||
clusterNodes: [],
|
||||
loading: false,
|
||||
}),
|
||||
actions: {
|
||||
async getNodes() {
|
||||
async getClusterNodes() {
|
||||
this.loading = true;
|
||||
const res = await fetchQuery({
|
||||
method: "get",
|
||||
url: "",
|
||||
path: "ClusterNodes",
|
||||
});
|
||||
this.loading = false;
|
||||
if (res.errors) {
|
||||
return res;
|
||||
}
|
||||
|
||||
return res.data;
|
||||
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;
|
||||
return res;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user