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
eccf0728
Commit
eccf0728
authored
Nov 09, 2020
by
Thong Kuah
Committed by
Jose Vargas
Jan 04, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move toggleDeployBoard function to core
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/47147
parent
6151f1e2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
73 additions
and
30 deletions
+73
-30
app/assets/javascripts/environments/stores/environments_store.js
...ets/javascripts/environments/stores/environments_store.js
+12
-2
ee/app/assets/javascripts/environments/stores/environments_store.js
...ets/javascripts/environments/stores/environments_store.js
+1
-20
ee/spec/frontend/environments/environments_store_spec.js
ee/spec/frontend/environments/environments_store_spec.js
+0
-6
ee/spec/frontend/environments/mock_data.js
ee/spec/frontend/environments/mock_data.js
+1
-0
spec/frontend/environments/environments_store_spec.js
spec/frontend/environments/environments_store_spec.js
+22
-1
spec/frontend/environments/mock_data.js
spec/frontend/environments/mock_data.js
+37
-1
No files found.
app/assets/javascripts/environments/stores/environments_store.js
View file @
eccf0728
...
...
@@ -135,12 +135,22 @@ export default class EnvironmentsStore {
/**
* Toggles deploy board visibility for the provided environment ID.
* Currently only works on EE.
*
* @param {Object} environment
* @return {Array}
*/
toggleDeployBoard
()
{
toggleDeployBoard
(
environmentID
)
{
const
environments
=
this
.
state
.
environments
.
slice
();
this
.
state
.
environments
=
environments
.
map
(
env
=>
{
let
updated
=
{
...
env
};
if
(
env
.
id
===
environmentID
)
{
updated
=
{
...
updated
,
isDeployBoardVisible
:
!
env
.
isDeployBoardVisible
};
}
return
updated
;
});
return
this
.
state
.
environments
;
}
...
...
ee/app/assets/javascripts/environments/stores/environments_store.js
View file @
eccf0728
import
CeEnvironmentsStore
from
'
~/environments/stores/environments_store
'
;
export
default
class
EnvironmentsStore
extends
CeEnvironmentsStore
{
// TODO: delete when deploy boards moved to Core
storeEnvironments
(
environments
=
[])
{
super
.
storeEnvironments
(
environments
);
...
...
@@ -15,24 +16,4 @@ export default class EnvironmentsStore extends CeEnvironmentsStore {
this
.
state
.
environments
[
0
].
showCanaryCallout
=
true
;
}
}
/**
* Toggles deploy board visibility for the provided environment ID.
*
* @param {Object} environment
* @return {Array}
*/
toggleDeployBoard
(
environmentID
)
{
const
environments
=
this
.
state
.
environments
.
slice
();
this
.
state
.
environments
=
environments
.
map
((
env
)
=>
{
let
updated
=
{
...
env
};
if
(
env
.
id
===
environmentID
)
{
updated
=
{
...
updated
,
isDeployBoardVisible
:
!
env
.
isDeployBoardVisible
};
}
return
updated
;
});
return
this
.
state
.
environments
;
}
}
ee/spec/frontend/environments/environments_store_spec.js
View file @
eccf0728
...
...
@@ -39,12 +39,6 @@ describe('Store', () => {
store
.
storeEnvironments
([
environment
]);
});
it
(
'
should toggle deploy board property for given environment id
'
,
()
=>
{
store
.
toggleDeployBoard
(
1
);
expect
(
store
.
state
.
environments
[
0
].
isDeployBoardVisible
).
toEqual
(
false
);
});
it
(
'
should keep deploy board data when updating environments
'
,
()
=>
{
expect
(
store
.
state
.
environments
[
0
].
deployBoardData
).
toEqual
(
deployBoardMockData
);
...
...
ee/spec/frontend/environments/mock_data.js
View file @
eccf0728
// TODO remove
export
const
deployBoardMockData
=
{
instances
:
[
{
status
:
'
finished
'
,
tooltip
:
'
tanuki-2334 Finished
'
,
pod_name
:
'
production-tanuki-1
'
},
...
...
spec/frontend/environments/environments_store_spec.js
View file @
eccf0728
import
Store
from
'
~/environments/stores/environments_store
'
;
import
{
environmentsList
,
serverData
}
from
'
./mock_data
'
;
import
{
environmentsList
,
serverData
,
deployBoardMockData
}
from
'
./mock_data
'
;
describe
(
'
Store
'
,
()
=>
{
let
store
;
...
...
@@ -76,6 +76,27 @@ describe('Store', () => {
expect
(
store
.
state
.
environments
[
1
].
folderName
).
toEqual
(
serverData
[
1
].
name
);
});
describe
(
'
deploy boards
'
,
()
=>
{
beforeEach
(()
=>
{
const
environment
=
{
name
:
'
foo
'
,
size
:
1
,
latest
:
{
id
:
1
,
},
rollout_status
:
deployBoardMockData
,
};
store
.
storeEnvironments
([
environment
]);
});
it
(
'
should toggle deploy board property for given environment id
'
,
()
=>
{
store
.
toggleDeployBoard
(
1
);
expect
(
store
.
state
.
environments
[
0
].
isDeployBoardVisible
).
toEqual
(
false
);
});
});
describe
(
'
toggleFolder
'
,
()
=>
{
it
(
'
should toggle folder
'
,
()
=>
{
store
.
storeEnvironments
(
serverData
);
...
...
spec/frontend/environments/mock_data.js
View file @
eccf0728
...
...
@@ -26,6 +26,42 @@ const buildProps = {
updated_at
:
'
2017-02-01T19:42:18.400Z
'
,
};
const
deployBoardMockData
=
{
instances
:
[
{
status
:
'
finished
'
,
tooltip
:
'
tanuki-2334 Finished
'
,
pod_name
:
'
production-tanuki-1
'
},
{
status
:
'
finished
'
,
tooltip
:
'
tanuki-2335 Finished
'
,
pod_name
:
'
production-tanuki-1
'
},
{
status
:
'
finished
'
,
tooltip
:
'
tanuki-2336 Finished
'
,
pod_name
:
'
production-tanuki-1
'
},
{
status
:
'
finished
'
,
tooltip
:
'
tanuki-2337 Finished
'
,
pod_name
:
'
production-tanuki-1
'
},
{
status
:
'
finished
'
,
tooltip
:
'
tanuki-2338 Finished
'
,
pod_name
:
'
production-tanuki-1
'
},
{
status
:
'
finished
'
,
tooltip
:
'
tanuki-2339 Finished
'
,
pod_name
:
'
production-tanuki-1
'
},
{
status
:
'
finished
'
,
tooltip
:
'
tanuki-2340 Finished
'
,
pod_name
:
'
production-tanuki-1
'
},
{
status
:
'
finished
'
,
tooltip
:
'
tanuki-2334 Finished
'
,
pod_name
:
'
production-tanuki-1
'
},
{
status
:
'
finished
'
,
tooltip
:
'
tanuki-2335 Finished
'
,
pod_name
:
'
production-tanuki-1
'
},
{
status
:
'
finished
'
,
tooltip
:
'
tanuki-2336 Finished
'
,
pod_name
:
'
production-tanuki-1
'
},
{
status
:
'
finished
'
,
tooltip
:
'
tanuki-2337 Finished
'
,
pod_name
:
'
production-tanuki-1
'
},
{
status
:
'
finished
'
,
tooltip
:
'
tanuki-2338 Finished
'
,
pod_name
:
'
production-tanuki-1
'
},
{
status
:
'
finished
'
,
tooltip
:
'
tanuki-2339 Finished
'
,
pod_name
:
'
production-tanuki-1
'
},
{
status
:
'
finished
'
,
tooltip
:
'
tanuki-2340 Finished
'
,
pod_name
:
'
production-tanuki-1
'
},
{
status
:
'
deploying
'
,
tooltip
:
'
tanuki-2341 Deploying
'
,
pod_name
:
'
production-tanuki-1
'
},
{
status
:
'
deploying
'
,
tooltip
:
'
tanuki-2342 Deploying
'
,
pod_name
:
'
production-tanuki-1
'
},
{
status
:
'
deploying
'
,
tooltip
:
'
tanuki-2343 Deploying
'
,
pod_name
:
'
production-tanuki-1
'
},
{
status
:
'
failed
'
,
tooltip
:
'
tanuki-2344 Failed
'
,
pod_name
:
'
production-tanuki-1
'
},
{
status
:
'
ready
'
,
tooltip
:
'
tanuki-2345 Ready
'
,
pod_name
:
'
production-tanuki-1
'
},
{
status
:
'
ready
'
,
tooltip
:
'
tanuki-2346 Ready
'
,
pod_name
:
'
production-tanuki-1
'
},
{
status
:
'
preparing
'
,
tooltip
:
'
tanuki-2348 Preparing
'
,
pod_name
:
'
production-tanuki-1
'
},
{
status
:
'
preparing
'
,
tooltip
:
'
tanuki-2349 Preparing
'
,
pod_name
:
'
production-tanuki-1
'
},
{
status
:
'
preparing
'
,
tooltip
:
'
tanuki-2350 Preparing
'
,
pod_name
:
'
production-tanuki-1
'
},
{
status
:
'
preparing
'
,
tooltip
:
'
tanuki-2353 Preparing
'
,
pod_name
:
'
production-tanuki-1
'
},
{
status
:
'
waiting
'
,
tooltip
:
'
tanuki-2354 Waiting
'
,
pod_name
:
'
production-tanuki-1
'
},
{
status
:
'
waiting
'
,
tooltip
:
'
tanuki-2355 Waiting
'
,
pod_name
:
'
production-tanuki-1
'
},
{
status
:
'
waiting
'
,
tooltip
:
'
tanuki-2356 Waiting
'
,
pod_name
:
'
production-tanuki-1
'
},
],
abort_url
:
'
url
'
,
rollback_url
:
'
url
'
,
completion
:
100
,
status
:
'
found
'
,
};
const
environment
=
{
name
:
'
production
'
,
size
:
1
,
...
...
@@ -262,4 +298,4 @@ const tableData = {
},
};
export
{
environment
,
environmentsList
,
folder
,
serverData
,
tableData
};
export
{
environment
,
environmentsList
,
folder
,
serverData
,
tableData
,
deployBoardMockData
};
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