Skip to content
代码片段 群组 项目
未验证 提交 047d6d3b 编辑于 作者: Andrew Fontaine's avatar Andrew Fontaine 提交者: GitLab
浏览文件

Merge branch '443786_clarify_action_timestamp' into 'master'

No related branches found
No related tags found
无相关合并请求
...@@ -5,6 +5,7 @@ import { ...@@ -5,6 +5,7 @@ import {
GlIcon, GlIcon,
GlLink, GlLink,
GlLoadingIcon, GlLoadingIcon,
GlSprintf,
GlTooltipDirective as GlTooltip, GlTooltipDirective as GlTooltip,
GlTruncate, GlTruncate,
} from '@gitlab/ui'; } from '@gitlab/ui';
...@@ -24,6 +25,7 @@ export default { ...@@ -24,6 +25,7 @@ export default {
GlBadge, GlBadge,
GlIcon, GlIcon,
GlLink, GlLink,
GlSprintf,
GlTruncate, GlTruncate,
GlLoadingIcon, GlLoadingIcon,
TimeAgoTooltip, TimeAgoTooltip,
...@@ -61,6 +63,12 @@ export default { ...@@ -61,6 +63,12 @@ export default {
shortSha() { shortSha() {
return this.commit?.shortId; return this.commit?.shortId;
}, },
timeStamp() {
return this.deployment?.deployedAt ? __('Deployed %{timeago}') : __('Created %{timeago}');
},
displayTimeAgo() {
return this.deployment?.deployedAt || this.deployment?.createdAt;
},
createdAt() { createdAt() {
return this.deployment?.createdAt; return this.deployment?.createdAt;
}, },
...@@ -207,10 +215,19 @@ export default { ...@@ -207,10 +215,19 @@ export default {
size="small" size="small"
/> />
</div> </div>
<time-ago-tooltip v-if="createdAt" :time="createdAt" class="gl-display-flex"> <time-ago-tooltip
v-if="displayTimeAgo"
:time="displayTimeAgo"
class="gl-display-flex"
data-testid="deployment-timestamp"
>
<template #default="{ timeAgo }"> <template #default="{ timeAgo }">
<gl-icon name="calendar" class="gl-mr-2" /> <gl-icon name="calendar" class="gl-mr-2" />
<span class="gl-mr-2 gl-white-space-nowrap">{{ timeAgo }}</span> <span class="gl-mr-2 gl-white-space-nowrap">
<gl-sprintf :message="timeStamp">
<template #timeago>{{ timeAgo }}</template>
</gl-sprintf>
</span>
</template> </template>
</time-ago-tooltip> </time-ago-tooltip>
</div> </div>
......
...@@ -15152,6 +15152,9 @@ msgstr "" ...@@ -15152,6 +15152,9 @@ msgstr ""
msgid "Created %{time_ago}" msgid "Created %{time_ago}"
msgstr "" msgstr ""
   
msgid "Created %{timeago}"
msgstr ""
msgid "Created %{timestamp}" msgid "Created %{timestamp}"
msgstr "" msgstr ""
   
...@@ -17415,6 +17418,9 @@ msgstr "" ...@@ -17415,6 +17418,9 @@ msgstr ""
msgid "Deployed" msgid "Deployed"
msgstr "" msgstr ""
   
msgid "Deployed %{timeago}"
msgstr ""
msgid "Deployed to" msgid "Deployed to"
msgstr "" msgstr ""
   
...@@ -153,16 +153,22 @@ describe('~/environments/components/deployment.vue', () => { ...@@ -153,16 +153,22 @@ describe('~/environments/components/deployment.vue', () => {
}); });
}); });
}); });
describe('deployedAt', () => {
describe('created at time', () => {
describe('is present', () => { describe('is present', () => {
it('shows the timestamp the deployment was deployed at', () => { it('shows the timestamp the deployment was deployed at', () => {
wrapper = createWrapper(); wrapper = createWrapper();
const date = wrapper.findByTitle( const date = wrapper.findByTestId('deployment-timestamp');
localeDateFormat.asDateTimeFull.format(deployment.createdAt), expect(date.text()).toBe('Deployed 1 day ago');
); });
});
});
describe('created at time', () => {
describe('is present and deploymentAt is null', () => {
it('shows the timestamp the deployment was created at', () => {
wrapper = createWrapper({ propsData: { deployment: { ...deployment, deployedAt: null } } });
expect(date.text()).toBe('1 day ago'); const date = wrapper.findByTestId('deployment-timestamp');
expect(date.text()).toBe('Created 1 day ago');
}); });
}); });
describe('is not present', () => { describe('is not present', () => {
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册