Commit 84b69f34 authored by Filipa Lacerda's avatar Filipa Lacerda

Moves mr widget options ee file into vue file

parent 75ee3d1e
...@@ -44,4 +44,4 @@ export { default as SquashBeforeMerge } from 'ee/vue_merge_request_widget/compon ...@@ -44,4 +44,4 @@ export { default as SquashBeforeMerge } from 'ee/vue_merge_request_widget/compon
export { default as notify } from '../lib/utils/notify'; export { default as notify } from '../lib/utils/notify';
export { default as SourceBranchRemovalStatus } from './components/source_branch_removal_status.vue'; export { default as SourceBranchRemovalStatus } from './components/source_branch_removal_status.vue';
export { default as mrWidgetOptions } from 'ee/vue_merge_request_widget/mr_widget_options'; export { default as mrWidgetOptions } from 'ee/vue_merge_request_widget/mr_widget_options.vue';
<script>
import { n__, s__, __, sprintf } from '~/locale'; import { n__, s__, __, sprintf } from '~/locale';
import CEWidgetOptions from '~/vue_merge_request_widget/mr_widget_options'; import CEWidgetOptions from '~/vue_merge_request_widget/mr_widget_options.vue';
import WidgetApprovals from './components/approvals/mr_widget_approvals'; import WidgetApprovals from './components/approvals/mr_widget_approvals';
import GeoSecondaryNode from './components/states/mr_widget_secondary_geo_node'; import GeoSecondaryNode from './components/states/mr_widget_secondary_geo_node';
import ReportSection from '../vue_shared/security_reports/components/report_section.vue'; import ReportSection from '../vue_shared/security_reports/components/report_section.vue';
...@@ -118,6 +119,15 @@ export default { ...@@ -118,6 +119,15 @@ export default {
return this.checkReportStatus(this.isLoadingPerformance, this.loadingPerformanceFailed); return this.checkReportStatus(this.isLoadingPerformance, this.loadingPerformanceFailed);
}, },
}, },
created() {
if (this.shouldRenderCodeQuality) {
this.fetchCodeQuality();
}
if (this.shouldRenderPerformance) {
this.fetchPerformance();
}
},
methods: { methods: {
fetchCodeQuality() { fetchCodeQuality() {
const { head_path, base_path } = this.mr.codeclimate; const { head_path, base_path } = this.mr.codeclimate;
...@@ -167,97 +177,100 @@ export default { ...@@ -167,97 +177,100 @@ export default {
}; };
}, },
}, },
created() { };
if (this.shouldRenderCodeQuality) { </script>
this.fetchCodeQuality(); <template>
} <div class="mr-state-widget prepend-top-default">
<mr-widget-header :mr="mr" />
if (this.shouldRenderPerformance) { <mr-widget-pipeline
this.fetchPerformance(); v-if="shouldRenderPipelines"
} :pipeline="mr.pipeline"
}, :ci-status="mr.ciStatus"
template: ` :has-ci="mr.hasCI"
<div class="mr-state-widget prepend-top-default"> />
<mr-widget-header :mr="mr" /> <deployment
<mr-widget-pipeline v-for="deployment in mr.deployments"
v-if="shouldRenderPipelines" :key="deployment.id"
:pipeline="mr.pipeline" :deployment="deployment"
:ci-status="mr.ciStatus" />
:has-ci="mr.hasCI" <mr-widget-approvals
/> v-if="shouldRenderApprovals"
<deployment :mr="mr"
v-for="deployment in mr.deployments" :service="service"
:key="deployment.id" />
:deployment="deployment" <report-section
/> class="js-codequality-widget mr-widget-border-top"
<mr-widget-approvals v-if="shouldRenderCodeQuality"
v-if="shouldRenderApprovals" type="codequality"
:status="codequalityStatus"
:loading-text="translateText('codeclimate').loading"
:error-text="translateText('codeclimate').error"
:success-text="codequalityText"
:unresolved-issues="mr.codeclimateMetrics.newIssues"
:resolved-issues="mr.codeclimateMetrics.resolvedIssues"
:has-issues="hasCodequalityIssues"
/>
<report-section
class="js-performance-widget mr-widget-border-top"
v-if="shouldRenderPerformance"
type="performance"
:status="performanceStatus"
:loading-text="translateText('performance').loading"
:error-text="translateText('performance').error"
:success-text="performanceText"
:unresolved-issues="mr.performanceMetrics.degraded"
:resolved-issues="mr.performanceMetrics.improved"
:neutral-issues="mr.performanceMetrics.neutral"
:has-issues="hasPerformanceMetrics"
/>
<grouped-security-reports-app
v-if="shouldRenderSecurityReport"
:head-blob-path="mr.headBlobPath"
:base-blob-path="mr.baseBlobPath"
:sast-head-path="mr.sast.head_path"
:sast-base-path="mr.sast.base_path"
:sast-help-path="mr.sastHelp"
:dast-head-path="mr.dast.head_path"
:dast-base-path="mr.dast.base_path"
:dast-help-path="mr.dastHelp"
:sast-container-head-path="mr.sastContainer.head_path"
:sast-container-base-path="mr.sastContainer.base_path"
:sast-container-help-path="mr.sastContainerHelp"
:dependency-scanning-head-path="mr.dependencyScanning.head_path"
:dependency-scanning-base-path="mr.dependencyScanning.base_path"
:dependency-scanning-help-path="mr.dependencyScanningHelp"
:vulnerability-feedback-path="mr.vulnerabilityFeedbackPath"
:vulnerability-feedback-help-path="mr.vulnerabilityFeedbackHelpPath"
:pipeline-id="mr.securityReportsPipelineId"
/>
<div class="mr-widget-section">
<component
:is="componentName"
:mr="mr" :mr="mr"
:service="service" :service="service"
/> />
<report-section
class="js-codequality-widget mr-widget-border-top" <section
v-if="shouldRenderCodeQuality" v-if="mr.maintainerEditAllowed"
type="codequality" class="mr-info-list mr-links"
:status="codequalityStatus" >
:loading-text="translateText('codeclimate').loading" {{ s__("mrWidget|Allows edits from maintainers") }}
:error-text="translateText('codeclimate').error" </section>
:success-text="codequalityText"
:unresolved-issues="mr.codeclimateMetrics.newIssues" <mr-widget-related-links
:resolved-issues="mr.codeclimateMetrics.resolvedIssues" v-if="shouldRenderRelatedLinks"
:has-issues="hasCodequalityIssues" :state="mr.state"
/> :related-links="mr.relatedLinks"
<report-section
class="js-performance-widget mr-widget-border-top"
v-if="shouldRenderPerformance"
type="performance"
:status="performanceStatus"
:loading-text="translateText('performance').loading"
:error-text="translateText('performance').error"
:success-text="performanceText"
:unresolved-issues="mr.performanceMetrics.degraded"
:resolved-issues="mr.performanceMetrics.improved"
:neutral-issues="mr.performanceMetrics.neutral"
:has-issues="hasPerformanceMetrics"
/> />
<grouped-security-reports-app <source-branch-removal-status
v-if="shouldRenderSecurityReport" v-if="shouldRenderSourceBranchRemovalStatus"
:head-blob-path="mr.headBlobPath"
:base-blob-path="mr.baseBlobPath"
:sast-head-path="mr.sast.head_path"
:sast-base-path="mr.sast.base_path"
:sast-help-path="mr.sastHelp"
:dast-head-path="mr.dast.head_path"
:dast-base-path="mr.dast.base_path"
:dast-help-path="mr.dastHelp"
:sast-container-head-path="mr.sastContainer.head_path"
:sast-container-base-path="mr.sastContainer.base_path"
:sast-container-help-path="mr.sastContainerHelp"
:dependency-scanning-head-path="mr.dependencyScanning.head_path"
:dependency-scanning-base-path="mr.dependencyScanning.base_path"
:dependency-scanning-help-path="mr.dependencyScanningHelp"
:vulnerability-feedback-path="mr.vulnerabilityFeedbackPath"
:vulnerability-feedback-help-path="mr.vulnerabilityFeedbackHelpPath"
:pipeline-id="mr.securityReportsPipelineId"
/> />
<div class="mr-widget-section">
<component
:is="componentName"
:mr="mr"
:service="service" />
<mr-widget-maintainer-edit
:maintainerEditAllowed="mr.maintainerEditAllowed" />
<mr-widget-related-links
v-if="shouldRenderRelatedLinks"
:state="mr.state"
:related-links="mr.relatedLinks" />
<source-branch-removal-status
v-if="shouldRenderSourceBranchRemovalStatus"
/>
</div>
<div class="mr-widget-footer" v-if="shouldRenderMergeHelp">
<mr-widget-merge-help />
</div>
</div> </div>
`, <div
}; class="mr-widget-footer"
v-if="shouldRenderMergeHelp"
>
<mr-widget-merge-help />
</div>
</div>
</template
import Vue from 'vue'; import Vue from 'vue';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import mrWidgetOptions from 'ee/vue_merge_request_widget/mr_widget_options'; import mrWidgetOptions from 'ee/vue_merge_request_widget/mr_widget_options.vue';
import MRWidgetService from 'ee/vue_merge_request_widget/services/mr_widget_service'; import MRWidgetService from 'ee/vue_merge_request_widget/services/mr_widget_service';
import MRWidgetStore from 'ee/vue_merge_request_widget/stores/mr_widget_store'; import MRWidgetStore from 'ee/vue_merge_request_widget/stores/mr_widget_store';
import mountComponent from 'spec/helpers/vue_mount_component_helper'; import mountComponent from 'spec/helpers/vue_mount_component_helper';
......
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