Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
2dfdf535
Commit
2dfdf535
authored
Jan 18, 2022
by
Andrew Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show when deployment happened
Useful to know when an environment was last updated.
parent
55a4cc5a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
0 deletions
+31
-0
app/assets/javascripts/environments/components/deployment.vue
...assets/javascripts/environments/components/deployment.vue
+8
-0
spec/frontend/environments/deployment_spec.js
spec/frontend/environments/deployment_spec.js
+23
-0
No files found.
app/assets/javascripts/environments/components/deployment.vue
View file @
2dfdf535
...
...
@@ -2,6 +2,7 @@
import
{
GlBadge
,
GlIcon
,
GlTooltipDirective
as
GlTooltip
}
from
'
@gitlab/ui
'
;
import
{
__
,
s__
}
from
'
~/locale
'
;
import
ClipboardButton
from
'
~/vue_shared/components/clipboard_button.vue
'
;
import
TimeAgoTooltip
from
'
~/vue_shared/components/time_ago_tooltip.vue
'
;
import
DeploymentStatusBadge
from
'
./deployment_status_badge.vue
'
;
export
default
{
...
...
@@ -10,6 +11,7 @@ export default {
DeploymentStatusBadge
,
GlBadge
,
GlIcon
,
TimeAgoTooltip
,
},
directives
:
{
GlTooltip
,
...
...
@@ -35,6 +37,9 @@ export default {
shortSha
()
{
return
this
.
deployment
?.
commit
?.
shortId
;
},
createdAt
()
{
return
this
.
deployment
?.
createdAt
;
},
},
i18n
:
{
latestBadge
:
s__
(
'
Deployment|Latest Deployed
'
),
...
...
@@ -69,6 +74,9 @@ export default {
:title=
"$options.i18n.copyButton"
size=
"small"
/>
<time-ago-tooltip
v-if=
"createdAt"
:time=
"createdAt"
class=
"gl-ml-5!"
>
<template
#default
="
{ timeAgo }">
<gl-icon
name=
"calendar"
/>
{{
timeAgo
}}
</
template
>
</time-ago-tooltip>
</div>
</div>
</template>
spec/frontend/environments/deployment_spec.js
View file @
2dfdf535
import
{
mountExtended
}
from
'
helpers/vue_test_utils_helper
'
;
import
{
__
,
s__
}
from
'
~/locale
'
;
import
{
formatDate
}
from
'
~/lib/utils/datetime_utility
'
;
import
{
useFakeDate
}
from
'
helpers/fake_date
'
;
import
ClipboardButton
from
'
~/vue_shared/components/clipboard_button.vue
'
;
import
Deployment
from
'
~/environments/components/deployment.vue
'
;
import
DeploymentStatusBadge
from
'
~/environments/components/deployment_status_badge.vue
'
;
import
{
resolvedEnvironment
}
from
'
./graphql/mock_data
'
;
describe
(
'
~/environments/components/deployment.vue
'
,
()
=>
{
useFakeDate
(
2022
,
0
,
8
,
16
);
const
deployment
=
resolvedEnvironment
.
lastDeployment
;
let
wrapper
;
...
...
@@ -125,4 +129,23 @@ describe('~/environments/components/deployment.vue', () => {
});
});
});
describe
(
'
created at time
'
,
()
=>
{
describe
(
'
is present
'
,
()
=>
{
it
(
'
shows the timestamp the deployment was deployed at
'
,
()
=>
{
wrapper
=
createWrapper
();
const
date
=
wrapper
.
findByTitle
(
formatDate
(
deployment
.
createdAt
));
expect
(
date
.
text
()).
toBe
(
'
1 day ago
'
);
});
});
describe
(
'
is not present
'
,
()
=>
{
it
(
'
does not show the timestamp
'
,
()
=>
{
wrapper
=
createWrapper
({
propsData
:
{
deployment
:
{
createdAt
:
null
}
}
});
const
date
=
wrapper
.
findByTitle
(
formatDate
(
deployment
.
createdAt
));
expect
(
date
.
exists
()).
toBe
(
false
);
});
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment