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.UrlConfig.getJenkinsRootURL 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-pipeline-editor / src / main / js / services / fetchClassic.js View on Github external
fetchOptions: {
                method: 'POST',
                body: body,
                headers: headers,
                disableLoadingIndicator: disableLoadingIndicator,
            },
        }).then(data => {
            if (data.status === 'ok') {
                handler(data.data);
            }
        });
    };
    if (cache.crumb) {
        useCrumb(cache.crumb);
    } else {
        Fetch.fetch(`${UrlConfig.getJenkinsRootURL()}/blue/rest/pipeline-metadata/crumbInfo`, {
            fetchOptions: { method: 'GET', disableLoadingIndicator: disableLoadingIndicator },
        }).then(response => {
            if (!response.ok) {
                if (window.isDevelopmentMode) console.error('An error occurred while fetching:', path);
                throw response;
            }

            if (cache.crumb) {
                useCrumb(cache.crumb);
            } else {
                try {
                    let crumb = response.text();
                    if (crumb.then) {
                        crumb
                            .then(c => {
                                cache.crumb = c;
github jenkinsci / blueocean-plugin / blueocean-web / src / main / js / main.jsx View on Github external
const AdminLink = props => {
    const { t } = props;

    const user = User.current();
    const showLink = !Security.isSecurityEnabled() || (user && user.isAdministrator);

    if (showLink) {
        var adminCaption = t('administration', {
            defaultValue: 'Administration',
        });
        return <a href="{`${UrlConfig.getJenkinsRootURL()}/manage`}">{adminCaption}</a>;
    }

    return null;
};
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / creation / bitbucket / api / BbCreationApi.js View on Github external
findBranches(pipelineName) {
        const path = UrlConfig.getJenkinsRootURL();
        const pipelineUrl = Utils.cleanSlashes(`${path}/blue/rest/organizations/${this.organization}/pipelines/${pipelineName}/`);
        return this._fetch(pipelineUrl)
            .then(response => capabilityAugmenter.augmentCapabilities(response))
            .then(pipeline => this._findBranchesSuccess(pipeline), error => this._findBranchesFailure(error));
    }
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / creation / bitbucket / server / api / BbServerApi.js View on Github external
createServer(serverName, serverUrl) {
        const path = UrlConfig.getJenkinsRootURL();
        const createUrl = Utils.cleanSlashes(`${path}/blue/rest/organizations/${this.organization}/scm/${this.scmId}/servers`);

        const requestBody = {
            name: serverName,
            apiUrl: serverUrl,
        };

        const fetchOptions = {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json',
            },
            body: JSON.stringify(requestBody),
        };

        return this._fetch(createUrl, { fetchOptions });
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / creation / bitbucket / server / api / BbServerApi.js View on Github external
listServers() {
        const path = UrlConfig.getJenkinsRootURL();
        const serversUrl = Utils.cleanSlashes(`${path}/blue/rest/organizations/${this.organization}/scm/${this.scmId}/servers`);

        return this._fetch(serversUrl);
    }
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / components / PipelineRowItem.jsx View on Github external
function generateRedirectURL(pipeline) {
    if (capable(pipeline, MATRIX_PIPELINE)) {
        return `${UrlConfig.getJenkinsRootURL()}${pipeline._links.self.href}`;
    }
    return null;
}
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / creation / github / api / GithubCreationApi.js View on Github external
listRepositories(credentialId, apiUrl, organizationName, pageNumber = 1, pageSize = 100) {
        const path = UrlConfig.getJenkinsRootURL();
        let reposUrl = Utils.cleanSlashes(
            `${path}/blue/rest/organizations/${this.organization}/scm/${this.scmId}/organizations/${organizationName}/repositories/` +
                `?credentialId=${credentialId}&pageNumber=${pageNumber}&pageSize=${pageSize}`
        );
        reposUrl = GithubApiUtils.appendApiUrlParam(reposUrl, apiUrl);

        return this._fetch(reposUrl).then(response => capabilityAugmenter.augmentCapabilities(response));
    }
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / components / RunDetailsHeader.jsx View on Github external
const cause = run =&gt; {
            const lastCause = (run &amp;&amp; run.causes &amp;&amp; run.causes.length &gt; 0 &amp;&amp; run.causes[run.causes.length - 1]) || null;
            if (lastCause &amp;&amp; lastCause.upstreamProject) {
                const activityUrl = `${UrlConfig.getJenkinsRootURL()}/${lastCause.upstreamUrl}display/redirect?provider=blueocean`;
                const runUrl = `${UrlConfig.getJenkinsRootURL()}/${lastCause.upstreamUrl}${lastCause.upstreamBuild}/display/redirect?provider=blueocean`;

                return (
                    <div title="{lastCause.shortDescription}">
                        Started by upstream pipeline "<a href="{activityUrl}">{lastCause.upstreamProject}</a>" build{' '}
                        <a href="{runUrl}">#{lastCause.upstreamBuild}</a>
                    </div>
                );
            }
            const causeMessage = (lastCause &amp;&amp; lastCause.shortDescription) || null;
            return (
                <div title="{causeMessage}">
                    {causeMessage}
                </div>
            );
        };
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / creation / github / api / GithubCreationApi.js View on Github external
listOrganizations(credentialId, apiUrl) {
        const path = UrlConfig.getJenkinsRootURL();
        let orgsUrl = Utils.cleanSlashes(
            `${path}/blue/rest/organizations/${this.organization}/scm/${this.scmId}/organizations/?credentialId=${credentialId}`,
            false
        );
        orgsUrl = GithubApiUtils.appendApiUrlParam(orgsUrl, apiUrl);

        return this._fetch(orgsUrl)
            .then(orgs => capabilityAugmenter.augmentCapabilities(orgs))
            .then(orgs => this._listOrganizationsSuccess(orgs), error => this._listOrganizationsFailure(error));
    }
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / creation / github / api / GithubCreationApi.js View on Github external
findExistingOrgFolder(githubOrganization) {
        const path = UrlConfig.getJenkinsRootURL();
        const orgFolderUrl = Utils.cleanSlashes(`${path}/blue/rest/organizations/${this.organization}/pipelines/${githubOrganization.name}`);
        return this._fetch(orgFolderUrl)
            .then(response => capabilityAugmenter.augmentCapabilities(response))
            .then(data => this._findExistingOrgFolderSuccess(data), error => this._findExistingOrgFolderFailure(error));
    }