Commit a99e7685 authored by Brandon Labuschagne's avatar Brandon Labuschagne

Merge branch 'vue-data-syntax' into 'master'

Refactor: update Vue data arrow syntax to function syntax

See merge request gitlab-org/gitlab!56127
parents bc54a3bc 47b370dc
...@@ -54,15 +54,17 @@ export default { ...@@ -54,15 +54,17 @@ export default {
required: false, required: false,
}, },
}, },
data: () => ({ data() {
currentServerSideSettings: { return {
host: null, currentServerSideSettings: {
port: null, host: null,
protocol: null, port: null,
wafLogEnabled: null, protocol: null,
ciliumLogEnabled: null, wafLogEnabled: null,
}, ciliumLogEnabled: null,
}), },
};
},
computed: { computed: {
isSaving() { isSaving() {
return [UPDATING].includes(this.status); return [UPDATING].includes(this.status);
......
...@@ -53,11 +53,13 @@ export default { ...@@ -53,11 +53,13 @@ export default {
}), }),
}, },
}, },
data: () => ({ data() {
modSecurityLogo, return {
initialValue: null, modSecurityLogo,
initialMode: null, initialValue: null,
}), initialMode: null,
};
},
computed: { computed: {
modSecurityEnabled: { modSecurityEnabled: {
get() { get() {
......
...@@ -24,9 +24,11 @@ export default { ...@@ -24,9 +24,11 @@ export default {
GlTable, GlTable,
GlAlert, GlAlert,
}, },
data: () => ({ data() {
errorMessage: '', return {
}), errorMessage: '',
};
},
methods: { methods: {
getFeatureDocumentationLinkLabel(item) { getFeatureDocumentationLinkLabel(item) {
return sprintf(s__('SecurityConfiguration|Feature documentation for %{featureName}'), { return sprintf(s__('SecurityConfiguration|Feature documentation for %{featureName}'), {
......
...@@ -14,9 +14,11 @@ export default { ...@@ -14,9 +14,11 @@ export default {
default: '', default: '',
}, },
}, },
data: () => ({ data() {
isLoading: false, return {
}), isLoading: false,
};
},
methods: { methods: {
async mutate() { async mutate() {
this.isLoading = true; this.isLoading = true;
......
...@@ -37,9 +37,11 @@ export default { ...@@ -37,9 +37,11 @@ export default {
required: true, required: true,
}, },
}, },
data: () => ({ data() {
state: STATE_IDLING, return {
}), state: STATE_IDLING,
};
},
computed: { computed: {
shortSha() { shortSha() {
return truncateSha(this.diffFile.content_sha); return truncateSha(this.diffFile.content_sha);
......
...@@ -45,9 +45,11 @@ export default { ...@@ -45,9 +45,11 @@ export default {
required: true, required: true,
}, },
}, },
data: () => ({ data() {
disabled: false, return {
}), disabled: false,
};
},
i18n: { i18n: {
compareAllButtonTitle: s__('Trials|Compare all plans'), compareAllButtonTitle: s__('Trials|Compare all plans'),
popoverTitle: s__('Trials|Hey there'), popoverTitle: s__('Trials|Hey there'),
......
...@@ -20,9 +20,11 @@ export default { ...@@ -20,9 +20,11 @@ export default {
required: true, required: true,
}, },
}, },
data: () => ({ data() {
tooltipTitle: '', return {
}), tooltipTitle: '',
};
},
mounted() { mounted() {
this.updateTooltipTitle(); this.updateTooltipTitle();
}, },
......
...@@ -62,9 +62,11 @@ export default { ...@@ -62,9 +62,11 @@ export default {
default: false, default: false,
}, },
}, },
data: () => ({ data() {
autoDevopsAlertDismissed: 'false', return {
}), autoDevopsAlertDismissed: 'false',
};
},
computed: { computed: {
devopsMessage() { devopsMessage() {
return this.autoDevopsEnabled return this.autoDevopsEnabled
......
...@@ -18,10 +18,12 @@ export default { ...@@ -18,10 +18,12 @@ export default {
default: 'h3', default: 'h3',
}, },
}, },
data: () => ({ data() {
collapseId: uniqueId('expandable-section-'), return {
visible: false, collapseId: uniqueId('expandable-section-'),
}), visible: false,
};
},
computed: { computed: {
toggleText() { toggleText() {
return this.visible ? __('Collapse') : __('Expand'); return this.visible ? __('Collapse') : __('Expand');
......
...@@ -29,11 +29,13 @@ export default { ...@@ -29,11 +29,13 @@ export default {
default: () => [], default: () => [],
}, },
}, },
data: () => ({ data() {
isRunningScan: null, return {
hasRunScanError: false, isRunningScan: null,
runScanErrors: [], hasRunScanError: false,
}), runScanErrors: [],
};
},
computed: { computed: {
error() { error() {
if (this.hasRunScanError) { if (this.hasRunScanError) {
......
...@@ -25,10 +25,12 @@ export default { ...@@ -25,10 +25,12 @@ export default {
required: true, required: true,
}, },
}, },
data: () => ({ data() {
isPreparingCsvExport: false, return {
showPopover: localStorage.getItem(STORAGE_KEY) !== 'true', isPreparingCsvExport: false,
}), showPopover: localStorage.getItem(STORAGE_KEY) !== 'true',
};
},
computed: { computed: {
buttonProps() { buttonProps() {
const { isPreparingCsvExport } = this; const { isPreparingCsvExport } = this;
......
...@@ -10,9 +10,11 @@ export default { ...@@ -10,9 +10,11 @@ export default {
StandardFilter, StandardFilter,
GlToggle, GlToggle,
}, },
data: () => ({ data() {
filterConfigs: [severityFilter, scannerFilter], return {
}), filterConfigs: [severityFilter, scannerFilter],
};
},
computed: { computed: {
...mapState('filters', ['filters']), ...mapState('filters', ['filters']),
hideDismissed: { hideDismissed: {
......
...@@ -17,9 +17,11 @@ export default { ...@@ -17,9 +17,11 @@ export default {
props: { props: {
projects: { type: Array, required: false, default: undefined }, projects: { type: Array, required: false, default: undefined },
}, },
data: () => ({ data() {
filterQuery: {}, return {
}), filterQuery: {},
};
},
computed: { computed: {
filters() { filters() {
const filters = [stateFilter, severityFilter, scannerFilter, activityFilter]; const filters = [stateFilter, severityFilter, scannerFilter, activityFilter];
......
...@@ -13,9 +13,11 @@ export default { ...@@ -13,9 +13,11 @@ export default {
GlButton, GlButton,
GlFormSelect, GlFormSelect,
}, },
data: () => ({ data() {
dismissalReason: null, return {
}), dismissalReason: null,
};
},
computed: { computed: {
...mapGetters('vulnerabilities', ['selectedVulnerabilitiesCount']), ...mapGetters('vulnerabilities', ['selectedVulnerabilitiesCount']),
canDismissVulnerability() { canDismissVulnerability() {
......
...@@ -24,10 +24,12 @@ export default { ...@@ -24,10 +24,12 @@ export default {
default: () => ({}), default: () => ({}),
}, },
}, },
data: () => ({ data() {
queryError: false, return {
vulnerabilitiesCount: {}, queryError: false,
}), vulnerabilitiesCount: {},
};
},
computed: { computed: {
isLoading() { isLoading() {
return this.$apollo.queries.vulnerabilitiesCount.loading; return this.$apollo.queries.vulnerabilitiesCount.loading;
......
...@@ -52,14 +52,16 @@ export default { ...@@ -52,14 +52,16 @@ export default {
default: '', default: '',
}, },
}, },
data: () => ({ data() {
slide: 0, return {
carouselImages: [ slide: 0,
securityDependencyImageUrl, carouselImages: [
securityScanningImageUrl, securityDependencyImageUrl,
securityDashboardImageUrl, securityScanningImageUrl,
], securityDashboardImageUrl,
}), ],
};
},
computed: { computed: {
discoverButtonProps() { discoverButtonProps() {
return { return {
......
...@@ -57,10 +57,12 @@ export default { ...@@ -57,10 +57,12 @@ export default {
required: true, required: true,
}, },
}, },
data: () => ({ data() {
localDismissalComment: '', return {
dismissalCommentErrorMessage: '', localDismissalComment: '',
}), dismissalCommentErrorMessage: '',
};
},
computed: { computed: {
canCreateIssueForThisVulnerability() { canCreateIssueForThisVulnerability() {
return Boolean(!this.isResolved && !this.vulnerability.hasIssue && this.canCreateIssue); return Boolean(!this.isResolved && !this.vulnerability.hasIssue && this.canCreateIssue);
......
...@@ -18,9 +18,11 @@ export default { ...@@ -18,9 +18,11 @@ export default {
default: false, default: false,
}, },
}, },
data: () => ({ data() {
selectedButton: {}, return {
}), selectedButton: {},
};
},
created() { created() {
this.setButton(this.buttons[0]); this.setButton(this.buttons[0]);
}, },
......
...@@ -40,12 +40,12 @@ export default { ...@@ -40,12 +40,12 @@ export default {
required: true, required: true,
}, },
}, },
data() {
data: () => ({ return {
discussionsDictionary: {}, discussionsDictionary: {},
lastFetchedAt: null, lastFetchedAt: null,
}), };
},
computed: { computed: {
discussions() { discussions() {
return Object.values(this.discussionsDictionary); return Object.values(this.discussionsDictionary);
...@@ -92,21 +92,17 @@ export default { ...@@ -92,21 +92,17 @@ export default {
}; };
}, },
}, },
created() { created() {
this.fetchDiscussions(); this.fetchDiscussions();
}, },
updated() { updated() {
this.$nextTick(() => { this.$nextTick(() => {
initUserPopovers(this.$el.querySelectorAll('.js-user-link')); initUserPopovers(this.$el.querySelectorAll('.js-user-link'));
}); });
}, },
beforeDestroy() { beforeDestroy() {
if (this.poll) this.poll.stop(); if (this.poll) this.poll.stop();
}, },
methods: { methods: {
dateToSeconds(date) { dateToSeconds(date) {
return Date.parse(date) / 1000; return Date.parse(date) / 1000;
...@@ -199,7 +195,6 @@ export default { ...@@ -199,7 +195,6 @@ export default {
} }
} }
}); });
// Emit an event that tells the header to refresh the vulnerability. // Emit an event that tells the header to refresh the vulnerability.
if (isVulnerabilityStateChanged) { if (isVulnerabilityStateChanged) {
this.$emit('vulnerability-state-change'); this.$emit('vulnerability-state-change');
...@@ -211,7 +206,6 @@ export default { ...@@ -211,7 +206,6 @@ export default {
<template> <template>
<div data-qa-selector="vulnerability_footer"> <div data-qa-selector="vulnerability_footer">
<solution-card v-if="hasSolution" v-bind="solutionInfo" /> <solution-card v-if="hasSolution" v-bind="solutionInfo" />
<div v-if="vulnerability.mergeRequestFeedback" class="card gl-mt-5"> <div v-if="vulnerability.mergeRequestFeedback" class="card gl-mt-5">
<merge-request-note <merge-request-note
:feedback="vulnerability.mergeRequestFeedback" :feedback="vulnerability.mergeRequestFeedback"
...@@ -219,7 +213,6 @@ export default { ...@@ -219,7 +213,6 @@ export default {
class="card-body" class="card-body"
/> />
</div> </div>
<related-jira-issues <related-jira-issues
v-if="glFeatures.jiraForVulnerabilities && createJiraIssueUrl" v-if="glFeatures.jiraForVulnerabilities && createJiraIssueUrl"
class="gl-mt-6" class="gl-mt-6"
...@@ -231,7 +224,6 @@ export default { ...@@ -231,7 +224,6 @@ export default {
:project-path="project.url" :project-path="project.url"
:help-path="vulnerability.relatedIssuesHelpPath" :help-path="vulnerability.relatedIssuesHelpPath"
/> />
<div class="notes" data-testid="detection-note"> <div class="notes" data-testid="detection-note">
<div class="system-note gl-display-flex gl-align-items-center gl-p-0! gl-mt-6!"> <div class="system-note gl-display-flex gl-align-items-center gl-p-0! gl-mt-6!">
<div class="timeline-icon gl-m-0!"> <div class="timeline-icon gl-m-0!">
...@@ -244,9 +236,7 @@ export default { ...@@ -244,9 +236,7 @@ export default {
/> />
</div> </div>
</div> </div>
<hr /> <hr />
<ul v-if="discussions.length" ref="historyList" class="notes discussion-body"> <ul v-if="discussions.length" ref="historyList" class="notes discussion-body">
<history-entry <history-entry
v-for="discussion in discussions" v-for="discussion in discussions"
......
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