Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
cdc1cef1
Commit
cdc1cef1
authored
Mar 11, 2019
by
Filipa Lacerda
Committed by
Phil Hughes
Mar 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduces EE differences for environments table
Async loads EE components Creates a Mixin for EE properties
parent
2e5163d8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
66 additions
and
81 deletions
+66
-81
app/assets/javascripts/environments/components/environments_table.vue
...avascripts/environments/components/environments_table.vue
+11
-49
app/assets/javascripts/environments/mixins/environments_table_mixin.js
...vascripts/environments/mixins/environments_table_mixin.js
+10
-0
changelogs/unreleased/10081-env-table.yml
changelogs/unreleased/10081-env-table.yml
+5
-0
ee/app/assets/javascripts/environments/mixins/environments_table_mixin.js
...vascripts/environments/mixins/environments_table_mixin.js
+32
-0
ee/spec/javascripts/environments/environments_table_spec.js
ee/spec/javascripts/environments/environments_table_spec.js
+0
-8
spec/javascripts/environments/environment_table_spec.js
spec/javascripts/environments/environment_table_spec.js
+8
-24
No files found.
app/assets/javascripts/environments/components/environments_table.vue
View file @
cdc1cef1
...
...
@@ -4,62 +4,29 @@
*/
import
{
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
_
from
'
underscore
'
;
import
environmentItem
from
'
./environment_item.vue
'
;
// eslint-disable-line import/order
// 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
import
environmentTableMixin
from
'
ee_else_ce/environments/mixins/environments_table_mixin
'
;
import
EnvironmentItem
from
'
./environment_item.vue
'
;
export
default
{
components
:
{
environmentItem
,
deployBoard
,
EnvironmentItem
,
GlLoadingIcon
,
// ee-only start
CanaryDeploymentCallout
,
// ee-only end
DeployBoard
:
()
=>
import
(
'
ee_component/environments/components/deploy_board_component.vue
'
),
CanaryDeploymentCallout
:
()
=>
import
(
'
ee_component/environments/components/canary_deployment_callout.vue
'
),
},
mixins
:
[
environmentTableMixin
],
props
:
{
environments
:
{
type
:
Array
,
required
:
true
,
default
:
()
=>
[],
},
canReadEnvironment
:
{
type
:
Boolean
,
required
:
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
:
{
sortedEnvironments
()
{
...
...
@@ -101,11 +68,6 @@ export default {
.
sortBy
(
env
=>
(
env
.
isFolder
?
-
1
:
1
))
.
value
();
},
// ee-only start
shouldShowCanaryCallout
(
env
)
{
return
env
.
showCanaryCallout
&&
this
.
showCanaryDeploymentCallout
;
},
// ee-only end
},
};
</
script
>
...
...
@@ -137,7 +99,7 @@ export default {
/>
<div
v-if=
"
model.hasDeployBoard && model.isDeployBoardVisible
"
v-if=
"
shouldRenderDeployBoard(model)
"
:key=
"`deploy-board-row-$
{i}`"
class="js-deploy-board-row"
>
...
...
@@ -167,9 +129,9 @@ export default {
<div
:key=
"`sub-div-$
{i}`">
<div
class=
"text-center prepend-top-10"
>
<a
:href=
"folderUrl(model)"
class=
"btn btn-default"
>
{{
s__
(
'
Environments|Show all
'
)
}}
</a>
<a
:href=
"folderUrl(model)"
class=
"btn btn-default"
>
{{
s__
(
'
Environments|Show all
'
)
}}
</a>
</div>
</div>
</
template
>
...
...
app/assets/javascripts/environments/mixins/environments_table_mixin.js
0 → 100644
View file @
cdc1cef1
export
default
{
methods
:
{
shouldShowCanaryCallout
()
{
return
false
;
},
shouldRenderDeployBoard
()
{
return
false
;
},
},
};
changelogs/unreleased/10081-env-table.yml
0 → 100644
View file @
cdc1cef1
---
title
:
Removes EE differences for environments_table.vue
merge_request
:
author
:
type
:
other
ee/app/assets/javascripts/environments/mixins/environments_table_mixin.js
0 → 100644
View file @
cdc1cef1
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
;
},
},
};
ee/spec/javascripts/environments/environments_table_spec.js
View file @
cdc1cef1
...
...
@@ -28,13 +28,11 @@ describe('Environment table', () => {
vm
=
mountComponent
(
Component
,
{
environments
:
[
mockItem
],
canReadEnvironment
:
true
,
// ee-only start
canaryDeploymentFeatureId
:
'
canary_deployment
'
,
showCanaryDeploymentCallout
:
true
,
userCalloutsPath
:
'
/callouts
'
,
lockPromotionSvgPath
:
'
/assets/illustrations/lock-promotion.svg
'
,
helpCanaryDeploymentsPath
:
'
help/canary-deployments
'
,
// ee-only end
});
expect
(
vm
.
$el
.
getAttribute
(
'
class
'
)).
toContain
(
'
ci-table
'
);
...
...
@@ -57,13 +55,11 @@ describe('Environment table', () => {
environments
:
[
mockItem
],
canCreateDeployment
:
false
,
canReadEnvironment
:
true
,
// ee-only start
canaryDeploymentFeatureId
:
'
canary_deployment
'
,
showCanaryDeploymentCallout
:
true
,
userCalloutsPath
:
'
/callouts
'
,
lockPromotionSvgPath
:
'
/assets/illustrations/lock-promotion.svg
'
,
helpCanaryDeploymentsPath
:
'
help/canary-deployments
'
,
// ee-only end
});
expect
(
vm
.
$el
.
querySelector
(
'
.js-deploy-board-row
'
)).
toBeDefined
();
...
...
@@ -95,19 +91,16 @@ describe('Environment table', () => {
vm
=
mountComponent
(
Component
,
{
environments
:
[
mockItem
],
canReadEnvironment
:
true
,
// ee-only start
canaryDeploymentFeatureId
:
'
canary_deployment
'
,
showCanaryDeploymentCallout
:
true
,
userCalloutsPath
:
'
/callouts
'
,
lockPromotionSvgPath
:
'
/assets/illustrations/lock-promotion.svg
'
,
helpCanaryDeploymentsPath
:
'
help/canary-deployments
'
,
// ee-only end
});
vm
.
$el
.
querySelector
(
'
.deploy-board-icon
'
).
click
();
});
// ee-only start
it
(
'
should render canary callout
'
,
()
=>
{
const
mockItem
=
{
name
:
'
review
'
,
...
...
@@ -131,5 +124,4 @@ describe('Environment table', () => {
expect
(
vm
.
$el
.
querySelector
(
'
.canary-deployment-callout
'
)).
not
.
toBeNull
();
});
// ee-only end
});
spec/javascripts/environments/environment_table_spec.js
View file @
cdc1cef1
...
...
@@ -5,21 +5,17 @@ import mountComponent from 'spec/helpers/vue_mount_component_helper';
describe
(
'
Environment table
'
,
()
=>
{
let
Component
;
let
vm
;
// ee-only start
let
eeOnlyProps
;
// ee-only end
const
eeOnlyProps
=
{
canaryDeploymentFeatureId
:
'
canary_deployment
'
,
showCanaryDeploymentCallout
:
true
,
userCalloutsPath
:
'
/callouts
'
,
lockPromotionSvgPath
:
'
/assets/illustrations/lock-promotion.svg
'
,
helpCanaryDeploymentsPath
:
'
help/canary-deployments
'
,
};
beforeEach
(()
=>
{
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
(()
=>
{
...
...
@@ -39,9 +35,7 @@ describe('Environment table', () => {
vm
=
mountComponent
(
Component
,
{
environments
:
[
mockItem
],
canReadEnvironment
:
true
,
// ee-only start
...
eeOnlyProps
,
// ee-only end
});
expect
(
vm
.
$el
.
getAttribute
(
'
class
'
)).
toContain
(
'
ci-table
'
);
...
...
@@ -82,9 +76,7 @@ describe('Environment table', () => {
vm
=
mountComponent
(
Component
,
{
environments
:
mockItems
,
canReadEnvironment
:
true
,
// ee-only start
...
eeOnlyProps
,
// ee-only end
});
const
[
old
,
newer
,
older
,
noDeploy
]
=
mockItems
;
...
...
@@ -148,9 +140,7 @@ describe('Environment table', () => {
vm
=
mountComponent
(
Component
,
{
environments
:
mockItems
,
canReadEnvironment
:
true
,
// ee-only start
...
eeOnlyProps
,
// ee-only end
});
const
[
prod
,
review
,
staging
]
=
mockItems
;
...
...
@@ -187,9 +177,7 @@ describe('Environment table', () => {
vm
=
mountComponent
(
Component
,
{
environments
:
mockItems
,
canReadEnvironment
:
true
,
// ee-only start
...
eeOnlyProps
,
// ee-only end
});
const
[
old
,
newer
,
older
]
=
mockItems
;
...
...
@@ -216,9 +204,7 @@ describe('Environment table', () => {
vm
=
mountComponent
(
Component
,
{
environments
:
mockItems
,
canReadEnvironment
:
true
,
// ee-only start
...
eeOnlyProps
,
// ee-only end
});
const
[
old
,
newer
,
older
]
=
mockItems
;
...
...
@@ -267,9 +253,7 @@ describe('Environment table', () => {
vm
=
mountComponent
(
Component
,
{
environments
:
mockItems
,
canReadEnvironment
:
true
,
// ee-only start
...
eeOnlyProps
,
// ee-only end
});
expect
(
vm
.
sortedEnvironments
.
map
(
env
=>
env
.
name
)).
toEqual
([
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment