Commit 0a9ded0f authored by Dhiraj Bodicherla's avatar Dhiraj Bodicherla

Using lodash in environments dashboard components

parent 6a3bff49
<script> <script>
import _ from 'underscore'; import { isEmpty } from 'lodash';
import { mapState, mapActions } from 'vuex'; import { mapState, mapActions } from 'vuex';
import { import {
GlModal, GlModal,
...@@ -82,7 +82,7 @@ export default { ...@@ -82,7 +82,7 @@ export default {
return this.searchCount > 0; return this.searchCount > 0;
}, },
okDisabled() { okDisabled() {
return _.isEmpty(this.selectedProjects); return isEmpty(this.selectedProjects);
}, },
}, },
created() { created() {
......
<script> <script>
import _ from 'underscore'; import { escape as esc, isEmpty } from 'lodash';
import { GlTooltipDirective, GlLink, GlBadge } from '@gitlab/ui'; import { GlTooltipDirective, GlLink, GlBadge } from '@gitlab/ui';
import Alerts from 'ee/vue_shared/dashboards/components/alerts.vue'; import Alerts from 'ee/vue_shared/dashboards/components/alerts.vue';
import TimeAgo from 'ee/vue_shared/dashboards/components/time_ago.vue'; import TimeAgo from 'ee/vue_shared/dashboards/components/time_ago.vue';
...@@ -61,21 +61,21 @@ export default { ...@@ -61,21 +61,21 @@ export default {
}; };
}, },
user() { user() {
return this.lastDeployment && !_.isEmpty(this.lastDeployment.user) return this.lastDeployment && !isEmpty(this.lastDeployment.user)
? this.lastDeployment.user ? this.lastDeployment.user
: null; : null;
}, },
lastPipeline() { lastPipeline() {
return !_.isEmpty(this.environment.last_pipeline) ? this.environment.last_pipeline : null; return !isEmpty(this.environment.last_pipeline) ? this.environment.last_pipeline : null;
}, },
lastDeployment() { lastDeployment() {
return !_.isEmpty(this.environment.last_deployment) ? this.environment.last_deployment : null; return !isEmpty(this.environment.last_deployment) ? this.environment.last_deployment : null;
}, },
deployable() { deployable() {
return this.lastDeployment ? this.lastDeployment.deployable : null; return this.lastDeployment ? this.lastDeployment.deployable : null;
}, },
commit() { commit() {
return !_.isEmpty(this.lastDeployment.commit) ? this.lastDeployment.commit : {}; return !isEmpty(this.lastDeployment.commit) ? this.lastDeployment.commit : {};
}, },
jobTooltip() { jobTooltip() {
return this.deployable return this.deployable
...@@ -83,7 +83,7 @@ export default { ...@@ -83,7 +83,7 @@ export default {
: s__('EnvironmentDashboard|Created through the Deployment API'); : s__('EnvironmentDashboard|Created through the Deployment API');
}, },
commitRef() { commitRef() {
return this.lastDeployment && !_.isEmpty(this.lastDeployment.commit) return this.lastDeployment && !isEmpty(this.lastDeployment.commit)
? { ? {
...this.lastDeployment.commit, ...this.lastDeployment.commit,
...this.lastDeployment.ref, ...this.lastDeployment.ref,
...@@ -95,7 +95,7 @@ export default { ...@@ -95,7 +95,7 @@ export default {
return ( return (
this.commit.author || { this.commit.author || {
avatar_url: this.commit.author_gravatar_url, avatar_url: this.commit.author_gravatar_url,
path: `mailto:${_.escape(this.commit.author_email)}`, path: `mailto:${esc(this.commit.author_email)}`,
username: this.commit.author_name, username: this.commit.author_name,
} }
); );
......
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