Commit 42c52633 authored by Phil Hughes's avatar Phil Hughes

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

EE: Reduces EE differences for environments table

See merge request gitlab-org/gitlab-ee!9933
parents 2e5163d8 cdc1cef1
...@@ -4,62 +4,29 @@ ...@@ -4,62 +4,29 @@
*/ */
import { GlLoadingIcon } from '@gitlab/ui'; import { GlLoadingIcon } from '@gitlab/ui';
import _ from 'underscore'; import _ from 'underscore';
import environmentItem from './environment_item.vue'; // eslint-disable-line import/order import environmentTableMixin from 'ee_else_ce/environments/mixins/environments_table_mixin';
import EnvironmentItem from './environment_item.vue';
// ee-only start
import deployBoard from 'ee/environments/components/deploy_board_component.vue';
import CanaryDeploymentCallout from 'ee/environments/components/canary_deployment_callout.vue';
// ee-only end
export default { export default {
components: { components: {
environmentItem, EnvironmentItem,
deployBoard,
GlLoadingIcon, GlLoadingIcon,
// ee-only start DeployBoard: () => import('ee_component/environments/components/deploy_board_component.vue'),
CanaryDeploymentCallout, CanaryDeploymentCallout: () =>
// ee-only end 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,
default: false, default: false,
}, },
// ee-only start
canaryDeploymentFeatureId: {
type: String,
required: true,
},
showCanaryDeploymentCallout: {
type: Boolean,
required: true,
},
userCalloutsPath: {
type: String,
required: true,
},
lockPromotionSvgPath: {
type: String,
required: true,
},
helpCanaryDeploymentsPath: {
type: String,
required: true,
},
// ee-only end
}, },
computed: { computed: {
sortedEnvironments() { sortedEnvironments() {
...@@ -101,11 +68,6 @@ export default { ...@@ -101,11 +68,6 @@ export default {
.sortBy(env => (env.isFolder ? -1 : 1)) .sortBy(env => (env.isFolder ? -1 : 1))
.value(); .value();
}, },
// ee-only start
shouldShowCanaryCallout(env) {
return env.showCanaryCallout && this.showCanaryDeploymentCallout;
},
// ee-only end
}, },
}; };
</script> </script>
...@@ -137,7 +99,7 @@ export default { ...@@ -137,7 +99,7 @@ export default {
/> />
<div <div
v-if="model.hasDeployBoard && model.isDeployBoardVisible" v-if="shouldRenderDeployBoard(model)"
:key="`deploy-board-row-${i}`" :key="`deploy-board-row-${i}`"
class="js-deploy-board-row" class="js-deploy-board-row"
> >
...@@ -167,9 +129,9 @@ export default { ...@@ -167,9 +129,9 @@ 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>
......
export default {
methods: {
shouldShowCanaryCallout() {
return false;
},
shouldRenderDeployBoard() {
return false;
},
},
};
---
title: Removes EE differences for environments_table.vue
merge_request:
author:
type: other
export default {
props: {
canaryDeploymentFeatureId: {
type: String,
required: true,
},
showCanaryDeploymentCallout: {
type: Boolean,
required: true,
},
userCalloutsPath: {
type: String,
required: true,
},
lockPromotionSvgPath: {
type: String,
required: true,
},
helpCanaryDeploymentsPath: {
type: String,
required: true,
},
},
methods: {
shouldShowCanaryCallout(env) {
return env.showCanaryCallout && this.showCanaryDeploymentCallout;
},
shouldRenderDeployBoard(model) {
return model.hasDeployBoard && model.isDeployBoardVisible;
},
},
};
...@@ -28,13 +28,11 @@ describe('Environment table', () => { ...@@ -28,13 +28,11 @@ describe('Environment table', () => {
vm = mountComponent(Component, { vm = mountComponent(Component, {
environments: [mockItem], environments: [mockItem],
canReadEnvironment: true, canReadEnvironment: true,
// ee-only start
canaryDeploymentFeatureId: 'canary_deployment', canaryDeploymentFeatureId: 'canary_deployment',
showCanaryDeploymentCallout: true, showCanaryDeploymentCallout: true,
userCalloutsPath: '/callouts', userCalloutsPath: '/callouts',
lockPromotionSvgPath: '/assets/illustrations/lock-promotion.svg', lockPromotionSvgPath: '/assets/illustrations/lock-promotion.svg',
helpCanaryDeploymentsPath: 'help/canary-deployments', helpCanaryDeploymentsPath: 'help/canary-deployments',
// ee-only end
}); });
expect(vm.$el.getAttribute('class')).toContain('ci-table'); expect(vm.$el.getAttribute('class')).toContain('ci-table');
...@@ -57,13 +55,11 @@ describe('Environment table', () => { ...@@ -57,13 +55,11 @@ describe('Environment table', () => {
environments: [mockItem], environments: [mockItem],
canCreateDeployment: false, canCreateDeployment: false,
canReadEnvironment: true, canReadEnvironment: true,
// ee-only start
canaryDeploymentFeatureId: 'canary_deployment', canaryDeploymentFeatureId: 'canary_deployment',
showCanaryDeploymentCallout: true, showCanaryDeploymentCallout: true,
userCalloutsPath: '/callouts', userCalloutsPath: '/callouts',
lockPromotionSvgPath: '/assets/illustrations/lock-promotion.svg', lockPromotionSvgPath: '/assets/illustrations/lock-promotion.svg',
helpCanaryDeploymentsPath: 'help/canary-deployments', helpCanaryDeploymentsPath: 'help/canary-deployments',
// ee-only end
}); });
expect(vm.$el.querySelector('.js-deploy-board-row')).toBeDefined(); expect(vm.$el.querySelector('.js-deploy-board-row')).toBeDefined();
...@@ -95,19 +91,16 @@ describe('Environment table', () => { ...@@ -95,19 +91,16 @@ describe('Environment table', () => {
vm = mountComponent(Component, { vm = mountComponent(Component, {
environments: [mockItem], environments: [mockItem],
canReadEnvironment: true, canReadEnvironment: true,
// ee-only start
canaryDeploymentFeatureId: 'canary_deployment', canaryDeploymentFeatureId: 'canary_deployment',
showCanaryDeploymentCallout: true, showCanaryDeploymentCallout: true,
userCalloutsPath: '/callouts', userCalloutsPath: '/callouts',
lockPromotionSvgPath: '/assets/illustrations/lock-promotion.svg', lockPromotionSvgPath: '/assets/illustrations/lock-promotion.svg',
helpCanaryDeploymentsPath: 'help/canary-deployments', helpCanaryDeploymentsPath: 'help/canary-deployments',
// ee-only end
}); });
vm.$el.querySelector('.deploy-board-icon').click(); vm.$el.querySelector('.deploy-board-icon').click();
}); });
// ee-only start
it('should render canary callout', () => { it('should render canary callout', () => {
const mockItem = { const mockItem = {
name: 'review', name: 'review',
...@@ -131,5 +124,4 @@ describe('Environment table', () => { ...@@ -131,5 +124,4 @@ describe('Environment table', () => {
expect(vm.$el.querySelector('.canary-deployment-callout')).not.toBeNull(); expect(vm.$el.querySelector('.canary-deployment-callout')).not.toBeNull();
}); });
// ee-only end
}); });
...@@ -5,21 +5,17 @@ import mountComponent from 'spec/helpers/vue_mount_component_helper'; ...@@ -5,21 +5,17 @@ import mountComponent from 'spec/helpers/vue_mount_component_helper';
describe('Environment table', () => { describe('Environment table', () => {
let Component; let Component;
let vm; let vm;
// ee-only start
let eeOnlyProps; const eeOnlyProps = {
// ee-only end 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);
// ee-only start
eeOnlyProps = {
canaryDeploymentFeatureId: 'canary_deployment',
showCanaryDeploymentCallout: true,
userCalloutsPath: '/callouts',
lockPromotionSvgPath: '/assets/illustrations/lock-promotion.svg',
helpCanaryDeploymentsPath: 'help/canary-deployments',
};
// ee-only end
}); });
afterEach(() => { afterEach(() => {
...@@ -39,9 +35,7 @@ describe('Environment table', () => { ...@@ -39,9 +35,7 @@ describe('Environment table', () => {
vm = mountComponent(Component, { vm = mountComponent(Component, {
environments: [mockItem], environments: [mockItem],
canReadEnvironment: true, canReadEnvironment: true,
// ee-only start
...eeOnlyProps, ...eeOnlyProps,
// ee-only end
}); });
expect(vm.$el.getAttribute('class')).toContain('ci-table'); expect(vm.$el.getAttribute('class')).toContain('ci-table');
...@@ -82,9 +76,7 @@ describe('Environment table', () => { ...@@ -82,9 +76,7 @@ describe('Environment table', () => {
vm = mountComponent(Component, { vm = mountComponent(Component, {
environments: mockItems, environments: mockItems,
canReadEnvironment: true, canReadEnvironment: true,
// ee-only start
...eeOnlyProps, ...eeOnlyProps,
// ee-only end
}); });
const [old, newer, older, noDeploy] = mockItems; const [old, newer, older, noDeploy] = mockItems;
...@@ -148,9 +140,7 @@ describe('Environment table', () => { ...@@ -148,9 +140,7 @@ describe('Environment table', () => {
vm = mountComponent(Component, { vm = mountComponent(Component, {
environments: mockItems, environments: mockItems,
canReadEnvironment: true, canReadEnvironment: true,
// ee-only start
...eeOnlyProps, ...eeOnlyProps,
// ee-only end
}); });
const [prod, review, staging] = mockItems; const [prod, review, staging] = mockItems;
...@@ -187,9 +177,7 @@ describe('Environment table', () => { ...@@ -187,9 +177,7 @@ describe('Environment table', () => {
vm = mountComponent(Component, { vm = mountComponent(Component, {
environments: mockItems, environments: mockItems,
canReadEnvironment: true, canReadEnvironment: true,
// ee-only start
...eeOnlyProps, ...eeOnlyProps,
// ee-only end
}); });
const [old, newer, older] = mockItems; const [old, newer, older] = mockItems;
...@@ -216,9 +204,7 @@ describe('Environment table', () => { ...@@ -216,9 +204,7 @@ describe('Environment table', () => {
vm = mountComponent(Component, { vm = mountComponent(Component, {
environments: mockItems, environments: mockItems,
canReadEnvironment: true, canReadEnvironment: true,
// ee-only start
...eeOnlyProps, ...eeOnlyProps,
// ee-only end
}); });
const [old, newer, older] = mockItems; const [old, newer, older] = mockItems;
...@@ -267,9 +253,7 @@ describe('Environment table', () => { ...@@ -267,9 +253,7 @@ describe('Environment table', () => {
vm = mountComponent(Component, { vm = mountComponent(Component, {
environments: mockItems, environments: mockItems,
canReadEnvironment: true, canReadEnvironment: true,
// ee-only start
...eeOnlyProps, ...eeOnlyProps,
// ee-only end
}); });
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