analyses: Array<Analysis>,
analysesLoading: boolean,
canAdmin: boolean,
+ canDeleteAnalyses: boolean,
className?: string,
changeEvent: (event: string, name: string) => Promise<*>,
deleteAnalysis: (analysis: string) => Promise<*>,
addVersion={this.props.addVersion}
analysis={analysis}
canAdmin={this.props.canAdmin}
+ canDeleteAnalyses={this.props.canDeleteAnalyses}
canCreateVersion={this.props.project.qualifier === 'TRK'}
changeEvent={this.props.changeEvent}
deleteAnalysis={this.props.deleteAnalysis}
addVersion: (analysis: string, version: string) => Promise<*>,
analysis: Analysis,
canAdmin: boolean,
+ canDeleteAnalyses: boolean,
canCreateVersion: boolean,
changeEvent: (event: string, name: string) => Promise<*>,
deleteAnalysis: (analysis: string) => Promise<*>,
const { date, events } = analysis;
const analysisTitle = translate('project_activity.analysis');
const hasVersion = events.find(event => event.category === 'VERSION') != null;
+
+ const canAddVersion = canAdmin && !hasVersion && this.props.canCreateVersion;
+ const canAddEvent = canAdmin;
+ const canDeleteAnalyses = this.props.canDeleteAnalyses && !isFirst;
+
return (
<li
className={classNames('project-activity-analysis clearfix', {
</div>
<div className="project-activity-analysis-icon big-spacer-right" title={analysisTitle} />
- {canAdmin && (
+ {(canAddVersion || canAddEvent || canDeleteAnalyses) && (
<div className="project-activity-analysis-actions spacer-left">
<div className="dropdown display-inline-block">
<button
<SettingsIcon size={12} style={{ marginTop: 3 }} /> <i className="icon-dropdown" />
</button>
<ul className="dropdown-menu dropdown-menu-right">
- {!hasVersion &&
- this.props.canCreateVersion && (
+ {canAddVersion && (
<li>
<AddEventForm
addEvent={this.props.addVersion}
/>
</li>
)}
- <li>
- <AddEventForm
- addEvent={this.props.addCustomEvent}
- analysis={analysis}
- addEventButtonText="project_activity.add_custom_event"
- />
- </li>
- {!isFirst && <li role="separator" className="divider" />}
- {!isFirst && (
+ {canAddEvent && (
+ <li>
+ <AddEventForm
+ addEvent={this.props.addCustomEvent}
+ analysis={analysis}
+ addEventButtonText="project_activity.add_custom_event"
+ />
+ </li>
+ )}
+ {(canAddVersion || canAddEvent) &&
+ canDeleteAnalyses && <li role="separator" className="divider" />}
+ {canDeleteAnalyses && (
<li>
<RemoveAnalysisForm
analysis={analysis}
<Events
analysis={analysis.key}
canAdmin={canAdmin}
+ canDeleteAnalyses={this.props.canDeleteAnalyses}
changeEvent={this.props.changeEvent}
deleteEvent={this.props.deleteEvent}
events={events}
const canAdmin =
(props.project.qualifier === 'TRK' || props.project.qualifier === 'APP') &&
(configuration ? configuration.showHistory : false);
+ const canDeleteAnalyses = configuration ? configuration.showHistory : false;
return (
<div id="project-activity" className="page page-limited">
<Helmet title={translate('project_activity.page')} />
analysesLoading={props.analysesLoading}
analyses={analyses}
canAdmin={canAdmin}
+ canDeleteAnalyses={canDeleteAnalyses}
className="boxed-group-inner"
changeEvent={props.changeEvent}
deleteAnalysis={props.deleteAnalysis}
project_activity.remove_custom_event.question=Are you sure you want to delete this event?
project_activity.reset_dates=Reset dates
project_activity.delete_analysis=Delete Analysis
-project_activity.delete_analysis.question=Are you sure you want to delete this analysis from the project history?
+project_activity.delete_analysis.question=Are you sure you want to delete this analysis from the history?
project_activity.filter_events=Filter events
project_activity.graphs.issues=Issues