Commit bc6cc878 authored by Phil Hughes's avatar Phil Hughes

Merge branch '10081-env-table' into 'master'

Reduces EE differences for environments table

Closes gitlab-ee#10081

See merge request gitlab-org/gitlab-ce!25916
parents 1e035484 cf706800
...@@ -4,21 +4,24 @@ ...@@ -4,21 +4,24 @@
*/ */
import { GlLoadingIcon } from '@gitlab/ui'; import { GlLoadingIcon } from '@gitlab/ui';
import _ from 'underscore'; import _ from 'underscore';
import environmentItem from './environment_item.vue'; import environmentTableMixin from 'ee_else_ce/environments/mixins/environments_table_mixin';
import EnvironmentItem from './environment_item.vue';
export default { export default {
components: { components: {
environmentItem, EnvironmentItem,
GlLoadingIcon, GlLoadingIcon,
DeployBoard: () => import('ee_component/environments/components/deploy_board_component.vue'),
CanaryDeploymentCallout: () =>
import('ee_component/environments/components/canary_deployment_callout.vue'),
}, },
mixins: [environmentTableMixin],
props: { props: {
environments: { environments: {
type: Array, type: Array,
required: true, required: true,
default: () => [], default: () => [],
}, },
canReadEnvironment: { canReadEnvironment: {
type: Boolean, type: Boolean,
required: false, required: false,
...@@ -95,6 +98,21 @@ export default { ...@@ -95,6 +98,21 @@ export default {
:can-read-environment="canReadEnvironment" :can-read-environment="canReadEnvironment"
/> />
<div
v-if="shouldRenderDeployBoard"
:key="`deploy-board-row-${i}`"
class="js-deploy-board-row"
>
<div class="deploy-board-container">
<deploy-board
:deploy-board-data="model.deployBoardData"
:is-loading="model.isLoadingDeployBoard"
:is-empty="model.isEmptyDeployBoard"
:logs-path="model.logs_path"
/>
</div>
</div>
<template v-if="shouldRenderFolderContent(model)"> <template v-if="shouldRenderFolderContent(model)">
<div v-if="model.isLoadingFolderContent" :key="`loading-item-${i}`"> <div v-if="model.isLoadingFolderContent" :key="`loading-item-${i}`">
<gl-loading-icon :size="2" class="prepend-top-16" /> <gl-loading-icon :size="2" class="prepend-top-16" />
...@@ -111,13 +129,24 @@ export default { ...@@ -111,13 +129,24 @@ export default {
<div :key="`sub-div-${i}`"> <div :key="`sub-div-${i}`">
<div class="text-center prepend-top-10"> <div class="text-center prepend-top-10">
<a :href="folderUrl(model)" class="btn btn-default">{{ <a :href="folderUrl(model)" class="btn btn-default">
s__('Environments|Show all') {{ s__('Environments|Show all') }}
}}</a> </a>
</div> </div>
</div> </div>
</template> </template>
</template> </template>
<template v-if="shouldShowCanaryCallout(model)">
<canary-deployment-callout
:key="`canary-promo-${i}`"
:canary-deployment-feature-id="canaryDeploymentFeatureId"
:user-callouts-path="userCalloutsPath"
:lock-promotion-svg-path="lockPromotionSvgPath"
:help-canary-deployments-path="helpCanaryDeploymentsPath"
:data-js-canary-promo-key="i"
/>
</template>
</template> </template>
</div> </div>
</template> </template>
export default {
methods: {
shouldShowCanaryCallout() {
return false;
},
shouldRenderDeployBoard() {
return false;
},
},
};
---
title: Removes EE differences for environments_table.vue
merge_request:
author:
type: other
...@@ -6,6 +6,14 @@ describe('Environment table', () => { ...@@ -6,6 +6,14 @@ describe('Environment table', () => {
let Component; let Component;
let vm; let vm;
const eeOnlyProps = {
canaryDeploymentFeatureId: 'canary_deployment',
showCanaryDeploymentCallout: true,
userCalloutsPath: '/callouts',
lockPromotionSvgPath: '/assets/illustrations/lock-promotion.svg',
helpCanaryDeploymentsPath: 'help/canary-deployments',
};
beforeEach(() => { beforeEach(() => {
Component = Vue.extend(environmentTableComp); Component = Vue.extend(environmentTableComp);
}); });
...@@ -27,6 +35,7 @@ describe('Environment table', () => { ...@@ -27,6 +35,7 @@ describe('Environment table', () => {
vm = mountComponent(Component, { vm = mountComponent(Component, {
environments: [mockItem], environments: [mockItem],
canReadEnvironment: true, canReadEnvironment: true,
...eeOnlyProps,
}); });
expect(vm.$el.getAttribute('class')).toContain('ci-table'); expect(vm.$el.getAttribute('class')).toContain('ci-table');
...@@ -67,6 +76,7 @@ describe('Environment table', () => { ...@@ -67,6 +76,7 @@ describe('Environment table', () => {
vm = mountComponent(Component, { vm = mountComponent(Component, {
environments: mockItems, environments: mockItems,
canReadEnvironment: true, canReadEnvironment: true,
...eeOnlyProps,
}); });
const [old, newer, older, noDeploy] = mockItems; const [old, newer, older, noDeploy] = mockItems;
...@@ -130,6 +140,7 @@ describe('Environment table', () => { ...@@ -130,6 +140,7 @@ describe('Environment table', () => {
vm = mountComponent(Component, { vm = mountComponent(Component, {
environments: mockItems, environments: mockItems,
canReadEnvironment: true, canReadEnvironment: true,
...eeOnlyProps,
}); });
const [prod, review, staging] = mockItems; const [prod, review, staging] = mockItems;
...@@ -166,6 +177,7 @@ describe('Environment table', () => { ...@@ -166,6 +177,7 @@ describe('Environment table', () => {
vm = mountComponent(Component, { vm = mountComponent(Component, {
environments: mockItems, environments: mockItems,
canReadEnvironment: true, canReadEnvironment: true,
...eeOnlyProps,
}); });
const [old, newer, older] = mockItems; const [old, newer, older] = mockItems;
...@@ -192,6 +204,7 @@ describe('Environment table', () => { ...@@ -192,6 +204,7 @@ describe('Environment table', () => {
vm = mountComponent(Component, { vm = mountComponent(Component, {
environments: mockItems, environments: mockItems,
canReadEnvironment: true, canReadEnvironment: true,
...eeOnlyProps,
}); });
const [old, newer, older] = mockItems; const [old, newer, older] = mockItems;
...@@ -240,6 +253,7 @@ describe('Environment table', () => { ...@@ -240,6 +253,7 @@ describe('Environment table', () => {
vm = mountComponent(Component, { vm = mountComponent(Component, {
environments: mockItems, environments: mockItems,
canReadEnvironment: true, canReadEnvironment: true,
...eeOnlyProps,
}); });
expect(vm.sortedEnvironments.map(env => env.name)).toEqual([ expect(vm.sortedEnvironments.map(env => env.name)).toEqual([
......
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