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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
ecfdbee6
Commit
ecfdbee6
authored
6 years ago
by
Filipa Lacerda
Committed by
Phil Hughes
6 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Creates vue component for environments block
parent
722631a9
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
278 additions
and
0 deletions
+278
-0
app/assets/javascripts/jobs/components/environments_block.vue
...assets/javascripts/jobs/components/environments_block.vue
+118
-0
changelogs/unreleased/50101-env-block.yml
changelogs/unreleased/50101-env-block.yml
+5
-0
locale/gitlab.pot
locale/gitlab.pot
+18
-0
spec/javascripts/jobs/components/environments_block_spec.js
spec/javascripts/jobs/components/environments_block_spec.js
+137
-0
No files found.
app/assets/javascripts/jobs/components/environments_block.vue
0 → 100644
View file @
ecfdbee6
<
script
>
import
_
from
'
underscore
'
;
import
CiIcon
from
'
~/vue_shared/components/ci_icon.vue
'
;
import
{
sprintf
,
__
}
from
'
../../locale
'
;
export
default
{
components
:
{
CiIcon
,
},
props
:
{
deploymentStatus
:
{
type
:
Object
,
required
:
true
,
},
},
computed
:
{
environment
()
{
let
environmentText
;
switch
(
this
.
deploymentStatus
.
status
)
{
case
'
latest
'
:
environmentText
=
sprintf
(
__
(
'
This job is the most recent deployment to %{link}.
'
),
{
link
:
this
.
environmentLink
},
false
,
);
break
;
case
'
out_of_date
'
:
if
(
this
.
hasLastDeployment
)
{
environmentText
=
sprintf
(
__
(
'
This job is an out-of-date deployment to %{environmentLink}. View the most recent deployment %{deploymentLink}.
'
,
),
{
environmentLink
:
this
.
environmentLink
,
deploymentLink
:
this
.
deploymentLink
,
},
false
,
);
}
else
{
environmentText
=
sprintf
(
__
(
'
This job is an out-of-date deployment to %{environmentLink}.
'
),
{
environmentLink
:
this
.
environmentLink
},
false
,
);
}
break
;
case
'
failed
'
:
environmentText
=
sprintf
(
__
(
'
The deployment of this job to %{environmentLink} did not succeed.
'
),
{
environmentLink
:
this
.
environmentLink
},
false
,
);
break
;
case
'
creating
'
:
if
(
this
.
hasLastDeployment
)
{
environmentText
=
sprintf
(
__
(
'
This job is creating a deployment to %{environmentLink} and will overwrite the last %{deploymentLink}.
'
,
),
{
environmentLink
:
this
.
environmentLink
,
deploymentLink
:
this
.
deploymentLink
,
},
false
,
);
}
else
{
environmentText
=
sprintf
(
__
(
'
This job is creating a deployment to %{environmentLink}.
'
),
{
environmentLink
:
this
.
environmentLink
},
false
,
);
}
break
;
default
:
break
;
}
return
environmentText
;
},
environmentLink
()
{
return
sprintf
(
'
%{startLink}%{name}%{endLink}
'
,
{
startLink
:
`<a href="
${
this
.
deploymentStatus
.
environment
.
path
}
">`
,
name
:
_
.
escape
(
this
.
deploymentStatus
.
environment
.
name
),
endLink
:
'
</a>
'
,
},
false
,
);
},
deploymentLink
()
{
return
sprintf
(
'
%{startLink}%{name}%{endLink}
'
,
{
startLink
:
`<a href="
${
this
.
lastDeployment
.
path
}
">`
,
name
:
_
.
escape
(
this
.
lastDeployment
.
name
),
endLink
:
'
</a>
'
,
},
false
,
);
},
hasLastDeployment
()
{
return
this
.
deploymentStatus
.
environment
.
last_deployment
;
},
lastDeployment
()
{
return
this
.
deploymentStatus
.
environment
.
last_deployment
;
},
},
};
</
script
>
<
template
>
<div
class=
"prepend-top-default js-environment-container"
>
<div
class=
"environment-information"
>
<ci-icon
:status=
"deploymentStatus.icon"
/>
<p
v-html=
"environment"
></p>
</div>
</div>
</
template
>
This diff is collapsed.
Click to expand it.
changelogs/unreleased/50101-env-block.yml
0 → 100644
View file @
ecfdbee6
---
title
:
Creates vue component for environments information in job log view
merge_request
:
author
:
type
:
other
This diff is collapsed.
Click to expand it.
locale/gitlab.pot
View file @
ecfdbee6
...
...
@@ -5492,6 +5492,9 @@ msgstr ""
msgid "The collection of events added to the data gathered for that stage."
msgstr ""
msgid "The deployment of this job to %{environmentLink} did not succeed."
msgstr ""
msgid "The fork relationship has been removed."
msgstr ""
...
...
@@ -5675,6 +5678,18 @@ msgstr ""
msgid "This job has not started yet"
msgstr ""
msgid "This job is an out-of-date deployment to %{environmentLink}."
msgstr ""
msgid "This job is an out-of-date deployment to %{environmentLink}. View the most recent deployment %{deploymentLink}."
msgstr ""
msgid "This job is creating a deployment to %{environmentLink} and will overwrite the last %{deploymentLink}."
msgstr ""
msgid "This job is creating a deployment to %{environmentLink}."
msgstr ""
msgid "This job is in pending state and is waiting to be picked by a runner"
msgstr ""
...
...
@@ -5684,6 +5699,9 @@ msgstr ""
msgid "This job is stuck, because you don't have any active runners that can run this job."
msgstr ""
msgid "This job is the most recent deployment to %{link}."
msgstr ""
msgid "This job requires a manual action"
msgstr ""
...
...
This diff is collapsed.
Click to expand it.
spec/javascripts/jobs/components/environments_block_spec.js
0 → 100644
View file @
ecfdbee6
import
Vue
from
'
vue
'
;
import
component
from
'
~/jobs/components/environments_block.vue
'
;
import
mountComponent
from
'
../../helpers/vue_mount_component_helper
'
;
describe
(
'
Environments block
'
,
()
=>
{
const
Component
=
Vue
.
extend
(
component
);
let
vm
;
const
icon
=
{
group
:
'
success
'
,
icon
:
'
status_success
'
,
label
:
'
passed
'
,
text
:
'
passed
'
,
tooltip
:
'
passed
'
,
};
const
deployment
=
{
path
:
'
deployment
'
,
name
:
'
deployment name
'
,
};
const
environment
=
{
path
:
'
/environment
'
,
name
:
'
environment
'
,
};
afterEach
(()
=>
{
vm
.
$destroy
();
});
describe
(
'
with latest deployment
'
,
()
=>
{
it
(
'
renders info for most recent deployment
'
,
()
=>
{
vm
=
mountComponent
(
Component
,
{
deploymentStatus
:
{
status
:
'
latest
'
,
icon
,
deployment
,
environment
,
},
});
expect
(
vm
.
$el
.
textContent
.
trim
()).
toEqual
(
'
This job is the most recent deployment to environment.
'
,
);
});
});
describe
(
'
with out of date deployment
'
,
()
=>
{
describe
(
'
with last deployment
'
,
()
=>
{
it
(
'
renders info for out date and most recent
'
,
()
=>
{
vm
=
mountComponent
(
Component
,
{
deploymentStatus
:
{
status
:
'
out_of_date
'
,
icon
,
deployment
,
environment
:
Object
.
assign
({},
environment
,
{
last_deployment
:
{
name
:
'
deployment
'
,
path
:
'
last_deployment
'
},
}),
},
});
expect
(
vm
.
$el
.
textContent
.
trim
()).
toEqual
(
'
This job is an out-of-date deployment to environment. View the most recent deployment deployment.
'
,
);
});
});
describe
(
'
without last deployment
'
,
()
=>
{
it
(
'
renders info about out of date deployment
'
,
()
=>
{
vm
=
mountComponent
(
Component
,
{
deploymentStatus
:
{
status
:
'
out_of_date
'
,
icon
,
deployment
:
null
,
environment
,
},
});
expect
(
vm
.
$el
.
textContent
.
trim
()).
toEqual
(
'
This job is an out-of-date deployment to environment.
'
,
);
});
});
});
describe
(
'
with failed deployment
'
,
()
=>
{
it
(
'
renders info about failed deployment
'
,
()
=>
{
vm
=
mountComponent
(
Component
,
{
deploymentStatus
:
{
status
:
'
failed
'
,
icon
,
deployment
:
null
,
environment
,
},
});
expect
(
vm
.
$el
.
textContent
.
trim
()).
toEqual
(
'
The deployment of this job to environment did not succeed.
'
,
);
});
});
describe
(
'
creating deployment
'
,
()
=>
{
describe
(
'
with last deployment
'
,
()
=>
{
it
(
'
renders info about creating deployment and overriding lastest deployment
'
,
()
=>
{
vm
=
mountComponent
(
Component
,
{
deploymentStatus
:
{
status
:
'
creating
'
,
icon
,
deployment
,
environment
:
Object
.
assign
({},
environment
,
{
last_deployment
:
{
name
:
'
deployment
'
,
path
:
'
last_deployment
'
},
}),
},
});
expect
(
vm
.
$el
.
textContent
.
trim
()).
toEqual
(
'
This job is creating a deployment to environment and will overwrite the last deployment.
'
,
);
});
});
describe
(
'
without last deployment
'
,
()
=>
{
it
(
'
renders info about failed deployment
'
,
()
=>
{
vm
=
mountComponent
(
Component
,
{
deploymentStatus
:
{
status
:
'
creating
'
,
icon
,
deployment
:
null
,
environment
,
},
});
expect
(
vm
.
$el
.
textContent
.
trim
()).
toEqual
(
'
This job is creating a deployment to environment.
'
,
);
});
});
});
});
This diff is collapsed.
Click to expand it.
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