Commit a2101989 authored by Phil Hughes's avatar Phil Hughes

Merge branch 'use-sprintf-security-reports' into 'master'

Use gl-sprintf in security reports app

See merge request gitlab-org/gitlab!20487
parents dafad067 d5ced6cb
<script> <script>
import { isUndefined } from 'underscore'; import { isUndefined } from 'underscore';
import { s__, sprintf } from '~/locale'; import { s__ } from '~/locale';
import { GlEmptyState } from '@gitlab/ui'; import { GlEmptyState, GlSprintf } from '@gitlab/ui';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue'; import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue';
import TimeagoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; import TimeagoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
...@@ -10,6 +10,7 @@ import SecurityDashboardApp from 'ee/security_dashboard/components/app.vue'; ...@@ -10,6 +10,7 @@ import SecurityDashboardApp from 'ee/security_dashboard/components/app.vue';
export default { export default {
components: { components: {
GlEmptyState, GlEmptyState,
GlSprintf,
UserAvatarLink, UserAvatarLink,
Icon, Icon,
TimeagoTooltip, TimeagoTooltip,
...@@ -83,15 +84,6 @@ export default { ...@@ -83,15 +84,6 @@ export default {
}, },
}, },
computed: { computed: {
headline() {
return sprintf(
s__('SecurityDashboard|Pipeline %{pipelineLink} triggered'),
{
pipelineLink: `<a href="${this.pipeline.path}">#${this.pipeline.id}</a>`,
},
false,
);
},
emptyStateDescription() { emptyStateDescription() {
return s__( return s__(
`SecurityDashboard| `SecurityDashboard|
...@@ -108,17 +100,28 @@ export default { ...@@ -108,17 +100,28 @@ export default {
<div class="card security-dashboard prepend-top-default"> <div class="card security-dashboard prepend-top-default">
<div class="card-header border-bottom-0"> <div class="card-header border-bottom-0">
<span class="js-security-dashboard-left"> <span class="js-security-dashboard-left">
<span v-html="headline"></span> <gl-sprintf
<timeago-tooltip :time="pipeline.created" /> :message="
{{ __('by') }} s__('SecurityDashboard|Pipeline %{pipelineLink} triggered %{timeago} by %{user}')
<user-avatar-link "
:link-href="triggeredBy.path" >
:img-src="triggeredBy.avatarPath" <template #pipelineLink>
:img-alt="triggeredBy.name" <a :href="pipeline.path">#{{ pipeline.id }}</a>
:img-size="24" </template>
:username="triggeredBy.name" <template #timeago>
class="avatar-image-container" <timeago-tooltip :time="pipeline.created" />
/> </template>
<template #user>
<user-avatar-link
:link-href="triggeredBy.path"
:img-src="triggeredBy.avatarPath"
:img-alt="triggeredBy.name"
:img-size="24"
:username="triggeredBy.name"
class="avatar-image-container"
/>
</template>
</gl-sprintf>
</span> </span>
<span class="js-security-dashboard-right pull-right"> <span class="js-security-dashboard-right pull-right">
<icon name="branch" /> <icon name="branch" />
......
...@@ -72,16 +72,6 @@ describe('Card security reports app', () => { ...@@ -72,16 +72,6 @@ describe('Card security reports app', () => {
mock.restore(); mock.restore();
}); });
describe('computed properties', () => {
describe('headline', () => {
it('renders `Pipeline <link> triggered`', () => {
expect(wrapper.vm.headline).toBe(
`Pipeline <a href="${TEST_HOST}/pipeline">#55</a> triggered`,
);
});
});
});
describe('Headline renders', () => { describe('Headline renders', () => {
it('renders pipeline metadata information', () => { it('renders pipeline metadata information', () => {
const element = wrapper.find('.card-header .js-security-dashboard-left'); const element = wrapper.find('.card-header .js-security-dashboard-left');
......
...@@ -15303,7 +15303,7 @@ msgstr "" ...@@ -15303,7 +15303,7 @@ msgstr ""
msgid "SecurityDashboard|More information" msgid "SecurityDashboard|More information"
msgstr "" msgstr ""
msgid "SecurityDashboard|Pipeline %{pipelineLink} triggered" msgid "SecurityDashboard|Pipeline %{pipelineLink} triggered %{timeago} by %{user}"
msgstr "" msgstr ""
msgid "SecurityDashboard|Project" msgid "SecurityDashboard|Project"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment