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
Léo-Paul Géneau
gitlab-ce
Commits
f7d8c29e
Commit
f7d8c29e
authored
Feb 12, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix broken path
parent
bd01d79f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
25 deletions
+83
-25
app/assets/javascripts/environments/components/environment_item.js.es6
...vascripts/environments/components/environment_item.js.es6
+83
-25
No files found.
app/assets/javascripts/environments/components/environment_item.js.es6
View file @
f7d8c29e
const Vue = require('vue');
const Vue = require('vue');
const Timeago = require('timeago.j');
const Timeago = require('timeago.j
s
');
require('../../lib/utils/text_utility');
require('../../lib/utils/text_utility');
require('../../vue_shared/components/commit');
require('../../vue_shared/components/commit');
...
@@ -72,7 +72,7 @@ module.exports = Vue.component('environment-item', {
...
@@ -72,7 +72,7 @@ module.exports = Vue.component('environment-item', {
* @returns {Boolean}
* @returns {Boolean}
*/
*/
hasLastDeploymentKey() {
hasLastDeploymentKey() {
if (this.model.latest.last_deployment &&
if (this.model.la
stest && this.model.la
test.last_deployment &&
!this.$options.isObjectEmpty(this.model.latest.last_deployment)) {
!this.$options.isObjectEmpty(this.model.latest.last_deployment)) {
return true;
return true;
}
}
...
@@ -86,7 +86,7 @@ module.exports = Vue.component('environment-item', {
...
@@ -86,7 +86,7 @@ module.exports = Vue.component('environment-item', {
* @returns {Boolean|Undefined}
* @returns {Boolean|Undefined}
*/
*/
hasManualActions() {
hasManualActions() {
return this.model.latest.last_deployment &&
return this.model.la
stest && this.model.la
test.last_deployment &&
this.model.latest.last_deployment.manual_actions &&
this.model.latest.last_deployment.manual_actions &&
this.model.latest.last_deployment.manual_actions.length > 0;
this.model.latest.last_deployment.manual_actions.length > 0;
},
},
...
@@ -107,7 +107,8 @@ module.exports = Vue.component('environment-item', {
...
@@ -107,7 +107,8 @@ module.exports = Vue.component('environment-item', {
* @returns {Boolean|Undefined}
* @returns {Boolean|Undefined}
*/
*/
canRetry() {
canRetry() {
return this.hasLastDeploymentKey &&
return this.model.lastest &&
this.hasLastDeploymentKey &&
this.model.latest.last_deployment &&
this.model.latest.last_deployment &&
this.model.latest.last_deployment.deployable;
this.model.latest.last_deployment.deployable;
},
},
...
@@ -118,7 +119,8 @@ module.exports = Vue.component('environment-item', {
...
@@ -118,7 +119,8 @@ module.exports = Vue.component('environment-item', {
* @returns {Boolean|Undefined}
* @returns {Boolean|Undefined}
*/
*/
canShowDate() {
canShowDate() {
return this.model.latest.last_deployment &&
return this.model.lastest &&
this.model.latest.last_deployment &&
this.model.latest.last_deployment.deployable &&
this.model.latest.last_deployment.deployable &&
this.model.latest.last_deployment.deployable !== undefined;
this.model.latest.last_deployment.deployable !== undefined;
},
},
...
@@ -129,7 +131,13 @@ module.exports = Vue.component('environment-item', {
...
@@ -129,7 +131,13 @@ module.exports = Vue.component('environment-item', {
* @returns {String}
* @returns {String}
*/
*/
createdDate() {
createdDate() {
return timeagoInstance.format(this.model.latest.last_deployment.deployable.created_at);
if (this.model.lastest &&
this.model.latest.last_deployment &&
this.model.lastest.last_deployment.deployable &&
this.model.latest.last_deployment.deployable.created_at) {
return timeagoInstance.format(this.model.latest.last_deployment.deployable.created_at);
}
return '';
},
},
/**
/**
...
@@ -156,7 +164,8 @@ module.exports = Vue.component('environment-item', {
...
@@ -156,7 +164,8 @@ module.exports = Vue.component('environment-item', {
* @returns {String}
* @returns {String}
*/
*/
userImageAltDescription() {
userImageAltDescription() {
if (this.model.latest.last_deployment &&
if (this.model.latest &&
this.model.latest.last_deployment &&
this.model.latest.last_deployment.user &&
this.model.latest.last_deployment.user &&
this.model.latest.last_deployment.user.username) {
this.model.latest.last_deployment.user.username) {
return `${this.model.latest.last_deployment.user.username}'s avatar'`;
return `${this.model.latest.last_deployment.user.username}'s avatar'`;
...
@@ -170,7 +179,8 @@ module.exports = Vue.component('environment-item', {
...
@@ -170,7 +179,8 @@ module.exports = Vue.component('environment-item', {
* @returns {String|Undefined}
* @returns {String|Undefined}
*/
*/
commitTag() {
commitTag() {
if (this.model.latest.last_deployment &&
if (this.model.latest &&
this.model.latest.last_deployment &&
this.model.latest.last_deployment.tag) {
this.model.latest.last_deployment.tag) {
return this.model.latest.last_deployment.tag;
return this.model.latest.last_deployment.tag;
}
}
...
@@ -183,7 +193,8 @@ module.exports = Vue.component('environment-item', {
...
@@ -183,7 +193,8 @@ module.exports = Vue.component('environment-item', {
* @returns {Object|Undefined}
* @returns {Object|Undefined}
*/
*/
commitRef() {
commitRef() {
if (this.model.latest.last_deployment &&
if (this.model.latest &&
this.model.latest.last_deployment &&
this.model.latest.last_deployment.ref) {
this.model.latest.last_deployment.ref) {
return this.model.latest.last_deployment.ref;
return this.model.latest.last_deployment.ref;
}
}
...
@@ -196,7 +207,8 @@ module.exports = Vue.component('environment-item', {
...
@@ -196,7 +207,8 @@ module.exports = Vue.component('environment-item', {
* @returns {String|Undefined}
* @returns {String|Undefined}
*/
*/
commitUrl() {
commitUrl() {
if (this.model.latest.last_deployment &&
if (this.model.latest &&
this.model.latest.last_deployment &&
this.model.latest.last_deployment.commit &&
this.model.latest.last_deployment.commit &&
this.model.latest.last_deployment.commit.commit_path) {
this.model.latest.last_deployment.commit.commit_path) {
return this.model.latest.last_deployment.commit.commit_path;
return this.model.latest.last_deployment.commit.commit_path;
...
@@ -210,7 +222,8 @@ module.exports = Vue.component('environment-item', {
...
@@ -210,7 +222,8 @@ module.exports = Vue.component('environment-item', {
* @returns {String|Undefined}
* @returns {String|Undefined}
*/
*/
commitShortSha() {
commitShortSha() {
if (this.model.latest.last_deployment &&
if (this.model.latest &&
this.model.latest.last_deployment &&
this.model.latest.last_deployment.commit &&
this.model.latest.last_deployment.commit &&
this.model.latest.last_deployment.commit.short_id) {
this.model.latest.last_deployment.commit.short_id) {
return this.model.latest.last_deployment.commit.short_id;
return this.model.latest.last_deployment.commit.short_id;
...
@@ -224,7 +237,8 @@ module.exports = Vue.component('environment-item', {
...
@@ -224,7 +237,8 @@ module.exports = Vue.component('environment-item', {
* @returns {String|Undefined}
* @returns {String|Undefined}
*/
*/
commitTitle() {
commitTitle() {
if (this.model.latest.last_deployment &&
if (this.model.latest &&
this.model.latest.last_deployment &&
this.model.latest.last_deployment.commit &&
this.model.latest.last_deployment.commit &&
this.model.latest.last_deployment.commit.title) {
this.model.latest.last_deployment.commit.title) {
return this.model.latest.last_deployment.commit.title;
return this.model.latest.last_deployment.commit.title;
...
@@ -238,7 +252,8 @@ module.exports = Vue.component('environment-item', {
...
@@ -238,7 +252,8 @@ module.exports = Vue.component('environment-item', {
* @returns {Object|Undefined}
* @returns {Object|Undefined}
*/
*/
commitAuthor() {
commitAuthor() {
if (this.model.latest.last_deployment &&
if (this.model.latest &&
this.model.latest.last_deployment &&
this.model.latest.last_deployment.commit &&
this.model.latest.last_deployment.commit &&
this.model.latest.last_deployment.commit.author) {
this.model.latest.last_deployment.commit.author) {
return this.model.latest.last_deployment.commit.author;
return this.model.latest.last_deployment.commit.author;
...
@@ -253,7 +268,8 @@ module.exports = Vue.component('environment-item', {
...
@@ -253,7 +268,8 @@ module.exports = Vue.component('environment-item', {
* @returns {String|Undefined}
* @returns {String|Undefined}
*/
*/
retryUrl() {
retryUrl() {
if (this.model.latest.last_deployment &&
if (this.model.latest &&
this.model.latest.last_deployment &&
this.model.latest.last_deployment.deployable &&
this.model.latest.last_deployment.deployable &&
this.model.latest.last_deployment.deployable.retry_path) {
this.model.latest.last_deployment.deployable.retry_path) {
return this.model.latest.last_deployment.deployable.retry_path;
return this.model.latest.last_deployment.deployable.retry_path;
...
@@ -267,7 +283,7 @@ module.exports = Vue.component('environment-item', {
...
@@ -267,7 +283,7 @@ module.exports = Vue.component('environment-item', {
* @returns {Boolean|Undefined}
* @returns {Boolean|Undefined}
*/
*/
isLastDeployment() {
isLastDeployment() {
return this.model.latest.last_deployment &&
return this.model.latest
&& this.model.latest
.last_deployment &&
this.model.latest.last_deployment['last?'];
this.model.latest.last_deployment['last?'];
},
},
...
@@ -277,7 +293,8 @@ module.exports = Vue.component('environment-item', {
...
@@ -277,7 +293,8 @@ module.exports = Vue.component('environment-item', {
* @returns {String}
* @returns {String}
*/
*/
buildName() {
buildName() {
if (this.model.latest.last_deployment &&
if (this.model.latest &&
this.model.latest.last_deployment &&
this.model.latest.last_deployment.deployable) {
this.model.latest.last_deployment.deployable) {
return `${this.model.latest.last_deployment.deployable.name} #${this.model.latest.last_deployment.deployable.id}`;
return `${this.model.latest.last_deployment.deployable.name} #${this.model.latest.last_deployment.deployable.id}`;
}
}
...
@@ -290,7 +307,8 @@ module.exports = Vue.component('environment-item', {
...
@@ -290,7 +307,8 @@ module.exports = Vue.component('environment-item', {
* @returns {String}
* @returns {String}
*/
*/
deploymentInternalId() {
deploymentInternalId() {
if (this.model.latest.last_deployment &&
if (this.model.latest &&
this.model.latest.last_deployment &&
this.model.latest.last_deployment.iid) {
this.model.latest.last_deployment.iid) {
return `#${this.model.latest.last_deployment.iid}`;
return `#${this.model.latest.last_deployment.iid}`;
}
}
...
@@ -303,7 +321,8 @@ module.exports = Vue.component('environment-item', {
...
@@ -303,7 +321,8 @@ module.exports = Vue.component('environment-item', {
* @returns {Boolean}
* @returns {Boolean}
*/
*/
deploymentHasUser() {
deploymentHasUser() {
return !this.$options.isObjectEmpty(this.model.latest.last_deployment) &&
return this.model.latest &&
!this.$options.isObjectEmpty(this.model.latest.last_deployment) &&
!this.$options.isObjectEmpty(this.model.latest.last_deployment.user);
!this.$options.isObjectEmpty(this.model.latest.last_deployment.user);
},
},
...
@@ -314,7 +333,8 @@ module.exports = Vue.component('environment-item', {
...
@@ -314,7 +333,8 @@ module.exports = Vue.component('environment-item', {
* @returns {Object}
* @returns {Object}
*/
*/
deploymentUser() {
deploymentUser() {
if (!this.$options.isObjectEmpty(this.model.latest.last_deployment) &&
if (this.model.latest &&
!this.$options.isObjectEmpty(this.model.latest.last_deployment) &&
!this.$options.isObjectEmpty(this.model.latest.last_deployment.user)) {
!this.$options.isObjectEmpty(this.model.latest.last_deployment.user)) {
return this.model.latest.last_deployment.user;
return this.model.latest.last_deployment.user;
}
}
...
@@ -330,10 +350,39 @@ module.exports = Vue.component('environment-item', {
...
@@ -330,10 +350,39 @@ module.exports = Vue.component('environment-item', {
*/
*/
shouldRenderBuildName() {
shouldRenderBuildName() {
return !this.model.isFolder &&
return !this.model.isFolder &&
this.model.lastest &&
!this.$options.isObjectEmpty(this.model.latest.last_deployment) &&
!this.$options.isObjectEmpty(this.model.latest.last_deployment) &&
!this.$options.isObjectEmpty(this.model.latest.last_deployment.deployable);
!this.$options.isObjectEmpty(this.model.latest.last_deployment.deployable);
},
},
/**
* Verifies the presence of all the keys needed to render the buil_path.
*
* @return {String}
*/
buildPath() {
if (this.model.latest &&
this.model.lastest.last_deployment &&
this.model.latest.last_deployment.deployable &&
this.model.lastest.last_deployment.deployable.build_path) {
return this.model.lastest.last_deployment.deployable.build_path;
}
return '';
},
/**
* Verifies the presence of all the keys needed to render the external_url.
*
* @return {String}
*/
externalURL() {
if (this.model.latest && this.model.latest.external_url) {
return this.model.latest.external_url;
}
return '';
},
/**
/**
* Verifies if deplyment internal ID should be rendered by verifing
* Verifies if deplyment internal ID should be rendered by verifing
* if all the information needed is present
* if all the information needed is present
...
@@ -343,9 +392,18 @@ module.exports = Vue.component('environment-item', {
...
@@ -343,9 +392,18 @@ module.exports = Vue.component('environment-item', {
*/
*/
shouldRenderDeploymentID() {
shouldRenderDeploymentID() {
return !this.model.isFolder &&
return !this.model.isFolder &&
this.model.lastest &&
!this.$options.isObjectEmpty(this.model.latest.last_deployment) &&
!this.$options.isObjectEmpty(this.model.latest.last_deployment) &&
this.model.latest.last_deployment.iid !== undefined;
this.model.latest.last_deployment.iid !== undefined;
},
},
environmentPath() {
if (this.model && this.model.lastest && this.model.latest.environment_path) {
return this.model.latest.environment_path;
}
return '';
},
},
},
/**
/**
...
@@ -368,7 +426,7 @@ module.exports = Vue.component('environment-item', {
...
@@ -368,7 +426,7 @@ module.exports = Vue.component('environment-item', {
<td>
<td>
<a v-if="!model.isFolder"
<a v-if="!model.isFolder"
class="environment-name"
class="environment-name"
:href="
model.latest.environment_p
ath">
:href="
environmentP
ath">
{{model.name}}
{{model.name}}
</a>
</a>
<a v-else class="folder-name">
<a v-else class="folder-name">
...
@@ -406,7 +464,7 @@ module.exports = Vue.component('environment-item', {
...
@@ -406,7 +464,7 @@ module.exports = Vue.component('environment-item', {
<td class="environments-build-cell">
<td class="environments-build-cell">
<a v-if="shouldRenderBuildName"
<a v-if="shouldRenderBuildName"
class="build-link"
class="build-link"
:href="
model.latest.last_deployment.deployable.build_p
ath">
:href="
buildP
ath">
{{buildName}}
{{buildName}}
</a>
</a>
</td>
</td>
...
@@ -445,21 +503,21 @@ module.exports = Vue.component('environment-item', {
...
@@ -445,21 +503,21 @@ module.exports = Vue.component('environment-item', {
</actions-component>
</actions-component>
</div>
</div>
<div v-if="
model.latest.external_url
&& canReadEnvironment"
<div v-if="
externalURL
&& canReadEnvironment"
class="inline js-external-url-container">
class="inline js-external-url-container">
<external-url-component
<external-url-component
:external-url="
model.latest.external_url
">
:external-url="
externalURL
">
</external-url-component>
</external-url-component>
</div>
</div>
<div v-if="hasStopAction && canCreateDeployment"
<div v-if="hasStopAction && canCreateDeployment
&& model.latest
"
class="inline js-stop-component-container">
class="inline js-stop-component-container">
<stop-component
<stop-component
:stop-url="model.latest.stop_path">
:stop-url="model.latest.stop_path">
</stop-component>
</stop-component>
</div>
</div>
<div v-if="model.latest.terminal_path"
<div v-if="model.latest
&& model.latest
.terminal_path"
class="inline js-terminal-button-container">
class="inline js-terminal-button-container">
<terminal-button-component
<terminal-button-component
:terminal-icon-svg="terminalIconSvg"
:terminal-icon-svg="terminalIconSvg"
...
...
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