How to use the @jenkins-cd/blueocean-core-js.UrlBuilder.buildRunUrl 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-dashboard / src / main / js / components / BranchDetailsRow.jsx View on Github external
if (!branch || !pipeline) {
            return null;
        }

        const { router, location } = this.context;
        const openRunDetails = newUrl => {
            // TODO: Move this out of this method
            location.pathname = newUrl;
            router.push(location);
        };
        const latestRun = branch.latestRun;
        if (!latestRun) {
            return noRun(branch, openRunDetails, t, this.context.store, columns);
        }
        const cleanBranchName = decodeURIComponent(branch.name);
        const runDetailsUrl = UrlBuilder.buildRunUrl(branch.organization, pipeline.fullName, cleanBranchName, latestRun.id, 'pipeline');

        const statusIndicator = (
            
        );

        const runMessage = ;

        const completed = (
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / components / RunDetails.jsx View on Github external
// early out
        if (!this.context.params || !run) {
            return null;
        }

        const { router, location, params } = this.context;
        const { pipeline, setTitle, t, locale } = this.props;
        const { isVisible } = this.state;

        if (!run || !pipeline) {
            this.props.setTitle(translate('common.pager.loading', { defaultValue: 'Loading...' }));
            return null;
        }

        const baseUrl = UrlBuilder.buildRunUrl(params.organization, params.pipeline, params.branch, params.runId, null);
        logger.debug('params', params.organization, params.pipeline, params.branch, params.runId);
        const currentRun = new RunRecord(run);
        const computedTitle = `${currentRun.organization} / ${pipeline.fullName} / ${params.pipeline === params.branch ? '' : `${params.branch} / `} #${
            currentRun.id
        }`;
        setTitle(computedTitle);

        const switchRunDetails = newUrl => {
            location.pathname = newUrl;
            router.push(location);
        };

        const base = { base: baseUrl };

        const failureCount = Math.min(99, (testSummary && parseInt(testSummary.failed)) || 0);
        const testsBadge = failureCount &gt; 0 &amp;&amp; <div>{failureCount}</div>;
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / components / ActivityDetailsRow.jsx View on Github external
render() {
        const { run, pipeline, t, locale, getTimes, columns, isMultibranch } = this.props;

        if (!run || !pipeline) {
            return null;
        }

        const resultRun = run.result === 'UNKNOWN' ? run.state : run.result;
        const runDetailsUrl = UrlBuilder.buildRunUrl(pipeline.organization, pipeline.fullName, decodeURIComponent(run.pipeline), run.id, 'pipeline');
        const changesUrl = UrlBuilder.buildRunUrl(pipeline.organization, pipeline.fullName, decodeURIComponent(run.pipeline), run.id, 'changes');

        const { durationInMillis, endTime, startTime } = getTimes({
            result: resultRun,
            durationInMillis: run.durationInMillis,
            startTime: run.startTime,
            endTime: run.endTime,
        });

        const isRunning = run.state === 'RUNNING' || run.state === 'PAUSED' || run.state === 'QUEUED';
        const branchName = isMultibranch && decodeURIComponent(run.pipeline);
        const dataProps = {
            'data-pipeline': pipeline.name,
            'data-runid': run.id,
        };

        if (isMultibranch) {
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / components / RunIdNavigation.tsx View on Github external
render() {
        const { run, pipeline, branchName, t } = this.props;

        const nextRunId = getRunId(run._links.nextRun) || '';
        const prevRunId = getRunId(run._links.prevRun) || '';

        const nextRunUrl = nextRunId ? UrlBuilder.buildRunUrl(pipeline.organization, pipeline.fullName, branchName, nextRunId, 'pipeline') : '';
        const prevRunUrl = prevRunId ? UrlBuilder.buildRunUrl(pipeline.organization, pipeline.fullName, branchName, prevRunId, 'pipeline') : '';

        return (
            <span>
                {prevRunUrl &amp;&amp; (
                    
                        
                    
                )}
                
                {nextRunUrl &amp;&amp; (
                    
                        
                    
                )}
            </span>
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / components / RunIdNavigation.tsx View on Github external
render() {
        const { run, pipeline, branchName, t } = this.props;

        const nextRunId = getRunId(run._links.nextRun) || '';
        const prevRunId = getRunId(run._links.prevRun) || '';

        const nextRunUrl = nextRunId ? UrlBuilder.buildRunUrl(pipeline.organization, pipeline.fullName, branchName, nextRunId, 'pipeline') : '';
        const prevRunUrl = prevRunId ? UrlBuilder.buildRunUrl(pipeline.organization, pipeline.fullName, branchName, prevRunId, 'pipeline') : '';

        return (
            <span>
                {prevRunUrl &amp;&amp; (
                    
                        
                    
                )}
                
                {nextRunUrl &amp;&amp; (
                    
                        
                    
                )}
            </span>
        );
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / components / RunDetailsHeader.jsx View on Github external
render() {
        const { run, pipeline, branchName, t } = this.props;

        const nextRunId = run._links.nextRun ? /[\/].*runs\/*([0-9]*)/g.exec(run._links.nextRun.href)[1] : '';
        const prevRunId = run._links.prevRun ? /[\/].*runs\/*([0-9]*)/g.exec(run._links.prevRun.href)[1] : '';

        const nextRunUrl = nextRunId ? UrlBuilder.buildRunUrl(pipeline.organization, pipeline.fullName, branchName, nextRunId, 'pipeline') : '';
        const prevRunUrl = prevRunId ? UrlBuilder.buildRunUrl(pipeline.organization, pipeline.fullName, branchName, prevRunId, 'pipeline') : '';

        return (
            <span>
                {prevRunUrl &amp;&amp; (
                    
                        
                    
                )}
                
                {nextRunUrl &amp;&amp; (
                    
                        
                    
                )}
            </span>
        );
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / components / RunDetailsHeader.jsx View on Github external
render() {
        const { run, pipeline, branchName, t } = this.props;

        const nextRunId = run._links.nextRun ? /[\/].*runs\/*([0-9]*)/g.exec(run._links.nextRun.href)[1] : '';
        const prevRunId = run._links.prevRun ? /[\/].*runs\/*([0-9]*)/g.exec(run._links.prevRun.href)[1] : '';

        const nextRunUrl = nextRunId ? UrlBuilder.buildRunUrl(pipeline.organization, pipeline.fullName, branchName, nextRunId, 'pipeline') : '';
        const prevRunUrl = prevRunId ? UrlBuilder.buildRunUrl(pipeline.organization, pipeline.fullName, branchName, prevRunId, 'pipeline') : '';

        return (
            <span>
                {prevRunUrl &amp;&amp; (
                    
                        
                    
                )}
                
                {nextRunUrl &amp;&amp; (
                    
                        
                    
                )}
            </span>
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / components / RunDetails.jsx View on Github external
navigateToChanges = () => {
        const {
            location,
            params: { organization, pipeline, branch, runId },
        } = this.context;

        const changesUrl = UrlBuilder.buildRunUrl(organization, pipeline, branch, runId, 'changes');
        location.pathname = changesUrl;
        this.context.router.push(location);
    };
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / components / ActivityDetailsRow.jsx View on Github external
render() {
        const { run, pipeline, t, locale, getTimes, columns, isMultibranch } = this.props;

        if (!run || !pipeline) {
            return null;
        }

        const resultRun = run.result === 'UNKNOWN' ? run.state : run.result;
        const runDetailsUrl = UrlBuilder.buildRunUrl(pipeline.organization, pipeline.fullName, decodeURIComponent(run.pipeline), run.id, 'pipeline');
        const changesUrl = UrlBuilder.buildRunUrl(pipeline.organization, pipeline.fullName, decodeURIComponent(run.pipeline), run.id, 'changes');

        const { durationInMillis, endTime, startTime } = getTimes({
            result: resultRun,
            durationInMillis: run.durationInMillis,
            startTime: run.startTime,
            endTime: run.endTime,
        });

        const isRunning = run.state === 'RUNNING' || run.state === 'PAUSED' || run.state === 'QUEUED';
        const branchName = isMultibranch && decodeURIComponent(run.pipeline);
        const dataProps = {
            'data-pipeline': pipeline.name,
            'data-runid': run.id,
        };
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / components / PullRequestRow.jsx View on Github external
render() {
        const { pr, t, locale, pipeline: contextPipeline, columns } = this.props;

        if (!pr || !pr.pullRequest || !contextPipeline) {
            return null;
        }

        const { latestRun, pullRequest, name } = pr;

        if (!latestRun) {
            return noRun(pr, this.openRunDetails, t, columns);
        }

        const result = latestRun.result === 'UNKNOWN' ? latestRun.state : latestRun.result;
        const { fullName, organization } = contextPipeline;
        const runDetailsUrl = UrlBuilder.buildRunUrl(organization, fullName, decodeURIComponent(latestRun.pipeline), latestRun.id, 'pipeline');

        const statusIndicator = (
            
        );

        const completed = (