Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
afterClose = () => {
const { router, params } = this.context;
router.push(UrlBuilder.buildPipelineUrl(params.organization, params.pipeline));
};
navigateToBranch = branch => {
const organization = this.context.params.organization;
const pipeline = this.context.params.pipeline;
const baseUrl = UrlBuilder.buildPipelineUrl(organization, pipeline);
let activitiesURL = `${baseUrl}/activity`;
if (branch) {
activitiesURL += '?branch=' + encodeURIComponent(branch);
}
this.context.router.push(activitiesURL);
};
goToActivity() {
const { organization, pipeline, branch } = this.props.params;
const { router } = this.context;
const location = UrlBuilder.buildPipelineUrl(organization, pipeline);
activityService.removeItem(activityService.pagerKey(organization, pipeline, branch));
router.push(location);
}
const orgUrl = UrlBuilder.buildOrganizationUrl(organizationName);
const activityUrl = UrlBuilder.buildPipelineUrl(organizationName, fullName, 'activity');
const isReady = !!pipeline;
if (!pipeline && this.error) {
logger.log(`Error finding pipeline page for ${fullName}.`, this.error);
return ;
}
if (isReady) {
setTitle(`${organizationDisplayName} / ${name}`);
} else {
setTitle(translate('common.pager.loading', { defaultValue: 'Loading...' }));
}
const baseUrl = UrlBuilder.buildPipelineUrl(organizationName, fullName);
const trendsEnabled = AppConfig.isFeatureEnabled('trends');
const pageTabLinks = [
{translate('pipelinedetail.common.tab.activity', { defaultValue: 'Activity' })},
{translate('pipelinedetail.common.tab.branches', { defaultValue: 'Branches' })},
{translate('pipelinedetail.common.tab.pullrequests', { defaultValue: 'Pull Requests' })},
trendsEnabled && {translate('pipelinedetail.common.tab.trends', { defaultValue: 'Trends' })},
];
const pageHeader = isReady ? (
<h1>
{AppConfig.showOrg() && (
<span>
</span></h1>
this.createPipeline()}>
{t('creation.git.step1.create_button')}
}
/>
);
}
if (!runs || !runs.length) {
if (!isMultiBranchPipeline) {
return ;
} else if (!branch) {
const { params } = this.context;
const branchesUrl = UrlBuilder.buildPipelineUrl(params.organization, params.pipeline, 'branches');
return ;
}
}
}
const showTable = branch || (runs && runs.length > 0);
const head = 'pipelinedetail.activity.header';
const status = t(`${head}.status`, { defaultValue: 'Status' });
const runHeader = t(`${head}.run`, { defaultValue: 'Run' });
const commit = t(`${head}.commit`, { defaultValue: 'Commit' });
const message = t(`${head}.message`, { defaultValue: 'Message' });
const duration = t(`${head}.duration`, { defaultValue: 'Duration' });
const completed = t(`${head}.completed`, { defaultValue: 'Completed' });
const branchText = t(`${head}.branch`, { defaultValue: 'Branch' });
const decodedBranchName = branch ? decodeURIComponent(branch) : branch;
finish() {
const pipeline = this.props.flowManager.pipeline;
const url = UrlBuilder.buildPipelineUrl(pipeline.organization, pipeline.fullName, 'activity');
this.props.flowManager.completeFlow({ url });
}
navigateToBranch = branch => {
const organization = this.props.params.organization;
const pipeline = this.props.params.pipeline;
const baseUrl = UrlBuilder.buildPipelineUrl(organization, pipeline);
let activitiesURL = `${baseUrl}/trends`;
if (branch) {
activitiesURL += '?branch=' + encodeURIComponent(branch);
}
this.context.router.push(activitiesURL);
};
render() {
const pipeline = this.context.pipelineService.getPipeline(this.href);
const { setTitle } = this.props;
const { location = {} } = this.context;
const { organization, name, fullName, fullDisplayName } = pipeline || {};
const organizationName = organization || AppConfig.getOrganizationName();
const organizationDisplayName = organization === AppConfig.getOrganizationName() ? AppConfig.getOrganizationDisplayName() : organization;
const orgUrl = UrlBuilder.buildOrganizationUrl(organizationName);
const activityUrl = UrlBuilder.buildPipelineUrl(organizationName, fullName, 'activity');
const isReady = !!pipeline;
if (!pipeline && this.error) {
logger.log(`Error finding pipeline page for ${fullName}.`, this.error);
return ;
}
if (isReady) {
setTitle(`${organizationDisplayName} / ${name}`);
} else {
setTitle(translate('common.pager.loading', { defaultValue: 'Loading...' }));
}
const baseUrl = UrlBuilder.buildPipelineUrl(organizationName, fullName);
const trendsEnabled = AppConfig.isFeatureEnabled('trends');
navigateToPipeline = () => {
const { organization, fullName } = this.props.pipeline;
const { location } = this.context;
const pipelineUrl = UrlBuilder.buildPipelineUrl(organization, fullName);
location.pathname = pipelineUrl;
this.context.router.push(location);
};