UNPKG

@stolostron/multicluster-sdk

Version:

Provides extensions and APIs that dynamic plugins can use to leverage multicluster capabilities provided by Red Hat Advanced Cluster Management.

32 lines 1.73 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getCachedHubClusterName = exports.fetchHubClusterName = void 0; /* Copyright Contributors to the Open Cluster Management project */ const apiRequests_1 = require("../api/apiRequests"); const dynamic_plugin_sdk_1 = require("@openshift-console/dynamic-plugin-sdk"); const getHubClusterNameUrl = '/hub'; let cachedHubClusterName = undefined; const fetchHubClusterName = () => __awaiter(void 0, void 0, void 0, function* () { if (cachedHubClusterName) { return cachedHubClusterName; } const url = (0, apiRequests_1.getBackendUrl)() + getHubClusterNameUrl; const data = yield (0, dynamic_plugin_sdk_1.consoleFetchJSON)(url, 'GET'); cachedHubClusterName = data.localHubName; return cachedHubClusterName; }); exports.fetchHubClusterName = fetchHubClusterName; const getCachedHubClusterName = () => { return cachedHubClusterName; }; exports.getCachedHubClusterName = getCachedHubClusterName; //# sourceMappingURL=cachedHubClusterName.js.map