We will be sunsetting Advisor during Jan, 2026 and will instead be providing information in Snyk Security DB.

You can begin to take advantage of Snyk Security DB today for a unified, package-centric experience.

How to use the @jenkins-cd/blueocean-core-js.Fetch.fetchJSON function in @jenkins-cd/blueocean-core-js

To help you get started, we’ve selected a few @jenkins-cd/blueocean-core-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jenkinsci / blueocean-plugin / blueocean-personalization / src / main / js / model / FavoriteStore.js View on Github external
fetch(url, fetchOptions) {
        return Fetch.fetchJSON(url, { fetchOptions })
            .then(data => capabilityAugmenter.augmentCapabilities(data))
            .catch(error => {
                const responseBody = error.responseBody;
                if (responseBody && responseBody.code && responseBody.message) {
                    ToastService.newToast({
                        style: 'error',
                        caption: t('Favoriting Error'),
                        text: t(responseBody.message),
                    });
                }
                console.error(error); // eslint-disable-line no-console
            });
    }
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / util / smart-fetch.js View on Github external
return dedupe(url, () =>
            Fetch.fetchJSON(url) // Fetch data
            .then(data => augmenter.augmentCapabilities(data))
            .then(successAndFreeze)) // add success field & freeze graph
            .then(
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / components / PipelineTrends.jsx View on Github external
fetchTrendsData(theProps) {
        const { pipeline } = theProps;
        const baseUrl = `${AppConfig.getRestRoot()}/organizations/${AppConfig.getOrganizationName()}/pipelines/${pipeline.fullName}`;

        let fullUrl;

        if (capable(pipeline, MULTIBRANCH_PIPELINE)) {
            const branchName = this._selectedBranch(theProps, pipeline);
            fullUrl = `${baseUrl}/branches/${encodeURIComponent(branchName)}/trends/`;
        } else {
            fullUrl = `${baseUrl}/trends/`;
        }

        Fetch.fetchJSON(fullUrl).then(data => this._loadTrendsSuccess(data));
    }
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / components / karaoke / rest / KaraokeApi.js View on Github external
getRunWithId(pipeline, branch, runId) {
        const fetchOptions = prepareOptions();
        const href = generateDetailUrl(pipeline, branch, runId);
        logger.debug('Fetching href', href);
        return Fetch.fetchJSON(href, { fetchOptions });
    }
github jenkinsci / blueocean-plugin / blueocean-personalization / src / main / js / redux / FavoritesActions.jsx View on Github external
        return (dispatch) => Fetch.fetchJSON(url, { fetchOptions })
            .then(data => augmenter.augmentCapabilities(data))
            .then((json) => {
                fetchFlags[actionType] = false;
                return dispatch({
                    ...optional,
                    type: actionType,
                    payload: json,
                });
            })
            .catch((error) => {
                const responseBody = error.responseBody;
                if (responseBody && responseBody.code && responseBody.message) {
                    ToastService.newToast({
                        style: 'error',
                        caption: translator('Favoriting Error'),
                        text: translator(responseBody.message),
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / components / PipelineTrends.jsx View on Github external
updateTrends(trends, extensions) {
        extensions.forEach(trendExt => {
            this.extensions[trendExt.trendId] = trendExt.componentClass;
        });

        this.trends = trends;

        const rowsMap = {};

        for (const trend of trends) {
            const rowsUrl = trend._links && trend._links.rows && trend._links.rows.href;

            if (rowsUrl) {
                Fetch.fetchJSON(rowsUrl).then(rows => this._updateTrendRows(trend, rows));
            }

            rowsMap[trend.id] = [];
        }

        this.rowsMap = observable(rowsMap);
    }
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / credentials / git / GitCredentialsPickerSSH.jsx View on Github external
componentWillMount() {
        const { onStatus, dialog, onComplete } = this.props;
        if (onStatus) {
            onStatus('promptLoading');
        }
        Fetch.fetchJSON(this.restOrgPrefix + '/user/publickey/').then(credential => {
            this.setState({ credential });
            if (onStatus) {
                onStatus('promptReady');
            }
            if (!dialog) {
                onComplete(credential);
            }
        });
    }