);
return (
- <div className="sw-flex sw-flex-1 sw-flex-col sw-gap-1">
+ <div className="sw-flex sw-flex-1 sw-flex-col sw-gap-2 sw-min-w-0">
{sortedEvents.map((event) => (
<Event
analysisKey={analysisKey}
} from 'design-system';
import * as React from 'react';
import { WrappedComponentProps, injectIntl } from 'react-intl';
+import ClickEventBoundary from '../../../components/controls/ClickEventBoundary';
import HelpTooltip from '../../../components/controls/HelpTooltip';
import Tooltip from '../../../components/controls/Tooltip';
import { formatterOption } from '../../../components/intl/DateTimeFormatter';
ref={(ref) => (node = ref)}
>
<div className="it__project-activity-time">
- <ActivityTime className="sw-box-border sw-grow-0 sw-shrink-0 sw-h-page sw-body-sm-highlight sw-text-right sw-mr-2">
+ <ActivityTime className="sw-h-page sw-body-sm-highlight sw-text-right sw-mr-2 sw-py-1/2">
<TimeFormatter date={parsedDate} long={false}>
{(formattedTime) => <time dateTime={parsedDate.toISOString()}>{formattedTime}</time>}
</TimeFormatter>
</div>
{(canAddVersion || canAddEvent || canDeleteAnalyses) && (
- <div className="sw-h-page sw-grow-0 sw-shrink-0 sw-mr-4 sw-relative">
- <ActionsDropdown
- ariaLabel={translateWithParameters(
- 'project_activity.analysis_X_actions',
- analysis.buildString || formatDate(parsedDate, formatterOption)
+ <ClickEventBoundary>
+ <div className="sw-h-page sw-grow-0 sw-shrink-0 sw-mr-4 sw-relative">
+ <ActionsDropdown
+ ariaLabel={translateWithParameters(
+ 'project_activity.analysis_X_actions',
+ analysis.buildString || formatDate(parsedDate, formatterOption)
+ )}
+ buttonSize="small"
+ id="it__analysis-actions"
+ zLevel={PopupZLevel.Absolute}
+ >
+ {canAddVersion && (
+ <ItemButton className="js-add-version" onClick={() => setAddVersionForm(true)}>
+ {translate('project_activity.add_version')}
+ </ItemButton>
+ )}
+ {canAddEvent && (
+ <ItemButton className="js-add-event" onClick={() => setAddEventForm(true)}>
+ {translate('project_activity.add_custom_event')}
+ </ItemButton>
+ )}
+ {(canAddVersion || canAddEvent) && canDeleteAnalyses && <ItemDivider />}
+ {canDeleteAnalyses && (
+ <ItemDangerButton
+ className="js-delete-analysis"
+ onClick={() => setRemoveAnalysisForm(true)}
+ >
+ {translate('project_activity.delete_analysis')}
+ </ItemDangerButton>
+ )}
+ </ActionsDropdown>
+
+ {addVersionForm && (
+ <AddEventForm
+ addEvent={props.onAddVersion}
+ addEventButtonText="project_activity.add_version"
+ analysis={analysis}
+ onClose={() => setAddVersionForm(false)}
+ />
)}
- buttonSize="small"
- id="it__analysis-actions"
- zLevel={PopupZLevel.Absolute}
- >
- {canAddVersion && (
- <ItemButton className="js-add-version" onClick={() => setAddVersionForm(true)}>
- {translate('project_activity.add_version')}
- </ItemButton>
- )}
- {canAddEvent && (
- <ItemButton className="js-add-event" onClick={() => setAddEventForm(true)}>
- {translate('project_activity.add_custom_event')}
- </ItemButton>
- )}
- {(canAddVersion || canAddEvent) && canDeleteAnalyses && <ItemDivider />}
- {canDeleteAnalyses && (
- <ItemDangerButton
- className="js-delete-analysis"
- onClick={() => setRemoveAnalysisForm(true)}
- >
- {translate('project_activity.delete_analysis')}
- </ItemDangerButton>
+
+ {addEventForm && (
+ <AddEventForm
+ addEvent={props.onAddCustomEvent}
+ addEventButtonText="project_activity.add_custom_event"
+ analysis={analysis}
+ onClose={() => setAddEventForm(false)}
+ />
)}
- </ActionsDropdown>
-
- {addVersionForm && (
- <AddEventForm
- addEvent={props.onAddVersion}
- addEventButtonText="project_activity.add_version"
- analysis={analysis}
- onClose={() => setAddVersionForm(false)}
- />
- )}
-
- {addEventForm && (
- <AddEventForm
- addEvent={props.onAddCustomEvent}
- addEventButtonText="project_activity.add_custom_event"
- analysis={analysis}
- onClose={() => setAddEventForm(false)}
- />
- )}
- {removeAnalysisForm && (
- <RemoveAnalysisForm
- analysis={analysis}
- deleteAnalysis={props.onDeleteAnalysis}
- onClose={() => setRemoveAnalysisForm(false)}
- />
- )}
- </div>
+ {removeAnalysisForm && (
+ <RemoveAnalysisForm
+ analysis={analysis}
+ deleteAnalysis={props.onDeleteAnalysis}
+ onClose={() => setRemoveAnalysisForm(false)}
+ />
+ )}
+ </div>
+ </ClickEventBoundary>
)}
{analysis.events.length > 0 && (
}
const ActivityTime = styled.div`
+ box-sizing: border-box;
width: 4.5rem;
`;
await ui.appLoaded();
await ui.addVersionEvent('1.1.0.1', initialValue);
- // should appear 3x, one for the list, one for the graph and one for the tooltip
- expect(screen.getAllByText(initialValue).length).toEqual(3);
+ expect(screen.getAllByText(initialValue).length).toBeGreaterThan(0);
await act(async () => {
await ui.updateEvent(1, updatedValue);
- // should appear 3x, one for the list, one for the graph and one for the tooltip
- expect(screen.getAllByText(updatedValue).length).toEqual(3);
+ expect(screen.getAllByText(updatedValue).length).toBeGreaterThan(0);
});
await ui.deleteEvent(0);
await act(async () => {
await ui.addCustomEvent('1.1.0.1', initialValue);
- expect(screen.getAllByText(initialValue)[0]).toBeInTheDocument();
+ expect(screen.getAllByText(initialValue).length).toBeGreaterThan(0);
});
await act(async () => {
await ui.updateEvent(1, updatedValue);
- expect(screen.getAllByText(updatedValue)[0]).toBeInTheDocument();
+ expect(screen.getAllByText(updatedValue).length).toBeGreaterThan(0);
});
await ui.deleteEvent(0);
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { BareButton, ChevronDownIcon, StandoutLink } from 'design-system';
+import { BareButton, BranchIcon, ChevronDownIcon, Note, StandoutLink } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import { isMainBranch } from '../../helpers/branch-like';
import { translate } from '../../helpers/l10n';
-import { limitComponentName } from '../../helpers/path';
import { getProjectUrl } from '../../helpers/urls';
import { BranchLike } from '../../types/branch-like';
import {
DefinitionChangeType,
} from '../../types/project-activity';
import ClickEventBoundary from '../controls/ClickEventBoundary';
-import BranchIcon from '../icons/BranchIcon';
export type DefinitionChangeEvent = AnalysisEvent &
Required<Pick<AnalysisEvent, 'definitionChange'>>;
expanded: boolean;
}
-const NAME_MAX_LENGTH = 28;
-
export class DefinitionChangeEventInner extends React.PureComponent<Props, State> {
state: State = { expanded: false };
renderProjectLink = (project: { key: string; name: string }, branch: string | undefined) => (
<ClickEventBoundary>
- <StandoutLink title={project.name} to={getProjectUrl(project.key, branch)}>
- {limitComponentName(project.name, NAME_MAX_LENGTH)}
+ <StandoutLink
+ className="sw-truncate sw-mr-1"
+ title={project.name}
+ to={getProjectUrl(project.key, branch)}
+ >
+ {project.name}
</StandoutLink>
</ClickEventBoundary>
);
renderBranch = (branch = translate('branches.main_branch')) => (
- <span className="nowrap" title={branch}>
- <BranchIcon className="little-spacer-left text-text-top" />
+ <span className="sw-flex sw-items-center sw-mr-1" title={branch}>
+ <BranchIcon className="sw-ml-1" />
{branch}
</span>
);
const { event, readonly } = this.props;
const { expanded } = this.state;
return (
- <div className="sw-flex sw-basis-full sw-flex-col">
+ <div className="sw-w-full sw-body-sm sw-py-1/2">
<div className="sw-flex sw-justify-between">
- <span className="sw-mr-1">{translate('event.category', event.category)}</span>
+ <Note className="sw-mr-1 sw-body-sm-highlight">
+ {translate('event.category', event.category)}
+ </Note>
{!readonly && (
- <div>
- <BareButton onClick={this.toggleProjectsList}>
+ <ClickEventBoundary>
+ <BareButton
+ className="sw-flex sw-items-center sw-ml-2"
+ onClick={this.toggleProjectsList}
+ >
{expanded ? translate('hide') : translate('more')}
<ChevronDownIcon transform={expanded ? 'rotate(180)' : undefined} />
</BareButton>
- </div>
+ </ClickEventBoundary>
)}
</div>
{expanded && (
<ul className="sw-mt-2">
{event.definitionChange.projects.map((project) => (
- <li className="sw-p-1 sw-text-ellipsis sw-overflow-hidden" key={project.key}>
+ <li className="sw-flex sw-items-center sw-flex-wrap sw-p-1 sw-mb-1" key={project.key}>
{this.renderProjectChange(project)}
</li>
))}
}
return (
<Tooltip overlay={event.description}>
- <div className="sw-min-w-0 sw-flex-1">
+ <div className="sw-min-w-0 sw-flex-1 sw-py-1/2">
<div className="sw-flex sw-items-start">
<span>
<Note className="sw-mr-1 sw-body-sm-highlight">
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { BareButton, ChevronDownIcon, QualityGateIndicator, StandoutLink } from 'design-system';
+import {
+ BareButton,
+ ChevronDownIcon,
+ Note,
+ QualityGateIndicator,
+ StandoutLink,
+} from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import { translate, translateWithParameters } from '../../helpers/l10n';
const { event, readonly } = this.props;
const { expanded } = this.state;
return (
- <div className="sw-flex sw-basis-full sw-flex-col">
+ <div className="sw-w-full sw-body-sm sw-py-1/2">
<div className="sw-flex sw-justify-between">
- <div className="sw-flex sw-justify-between">
- <span className="sw-mr-1">{translate('event.category', event.category)}:</span>
- <div className="sw-mx-2">
+ <div className="sw-flex sw-items-center">
+ <Note className="sw-mr-1 sw-body-sm-highlight">
+ {translate('event.category', event.category)}
+ </Note>
+
+ <div className="sw-ml-2 sw-flex sw-items-center">
{event.qualityGate.stillFailing ? (
<FormattedMessage
defaultMessage={translate('event.quality_gate.still_x')}
) : (
<QualityGateIndicator status={event.qualityGate.status} size="sm" />
)}
+
+ <span className="sw-ml-1">
+ {translate(`event.quality_gate.${event.qualityGate.status}`)}
+ </span>
</div>
- <span>{translate(`event.quality_gate.${event.qualityGate.status}`)}</span>
</div>
{!readonly && event.qualityGate.failing.length > 0 && (
- <div>
- <BareButton onClick={this.toggleProjectsList}>
+ <ClickEventBoundary>
+ <BareButton
+ className="sw-flex sw-items-center sw-ml-2"
+ onClick={this.toggleProjectsList}
+ >
{expanded ? translate('hide') : translate('more')}
<ChevronDownIcon transform={expanded ? 'rotate(180)' : undefined} />
</BareButton>
- </div>
+ </ClickEventBoundary>
)}
</div>
{expanded && (
- <ul className="sw-flex sw-flex-col sw-mt-2">
+ <ul className="sw-mt-2">
{event.qualityGate.failing.map((project) => (
- <li className="sw-flex sw-p-1" key={project.key}>
- <div>
+ <li className="sw-flex sw-justify-between sw-p-1" key={project.key}>
+ <div className="sw-truncate">
<ClickEventBoundary>
<StandoutLink
title={project.name}
</StandoutLink>
</ClickEventBoundary>
</div>
- <div className="sw-shrink sw-flex sw-ml-2">
- <div className="sw-items-top">
- <QualityGateIndicator status={event.qualityGate.status} size="sm" />
- </div>
+ <div className="sw-flex sw-items-center sw-ml-2">
+ <QualityGateIndicator status={event.qualityGate.status} size="sm" />
<span className="sw-ml-2">
{translate(`event.quality_gate.${event.qualityGate.status}`)}
</span>