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
4111bddf
Commit
4111bddf
authored
Jan 06, 2021
by
Sarah GP
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unwrapArrayOfJobs function
Removes function and associated tests
parent
c1c16352
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
43 deletions
+1
-43
app/assets/javascripts/pipelines/components/pipeline_graph/pipeline_graph.vue
...ts/pipelines/components/pipeline_graph/pipeline_graph.vue
+1
-2
app/assets/javascripts/pipelines/components/unwrapping_utils.js
...sets/javascripts/pipelines/components/unwrapping_utils.js
+0
-17
spec/frontend/pipelines/unwrapping_utils_spec.js
spec/frontend/pipelines/unwrapping_utils_spec.js
+0
-24
No files found.
app/assets/javascripts/pipelines/components/pipeline_graph/pipeline_graph.vue
View file @
4111bddf
...
...
@@ -6,7 +6,6 @@ import JobPill from './job_pill.vue';
import
StagePill
from
'
./stage_pill.vue
'
;
import
{
generateLinksData
}
from
'
./drawing_utils
'
;
import
{
parseData
}
from
'
../parsing_utils
'
;
import
{
unwrapArrayOfJobs
}
from
'
../unwrapping_utils
'
;
import
{
DRAW_FAILURE
,
DEFAULT
,
INVALID_CI_CONFIG
,
EMPTY_PIPELINE_DATA
}
from
'
../../constants
'
;
import
{
createJobsHash
,
generateJobNeedsDict
}
from
'
../../utils
'
;
import
{
CI_CONFIG_STATUS_INVALID
}
from
'
~/pipeline_editor/constants
'
;
...
...
@@ -136,7 +135,7 @@ export default {
methods
:
{
prepareLinkData
()
{
try
{
const
arrayOfJobs
=
unwrapArrayOfJobs
(
this
.
pipelineStage
s
);
const
arrayOfJobs
=
this
.
pipelineStages
.
flatMap
(({
groups
})
=>
group
s
);
const
parsedData
=
parseData
(
arrayOfJobs
);
this
.
links
=
generateLinksData
(
parsedData
,
this
.
$options
.
CONTAINER_ID
);
}
catch
{
...
...
app/assets/javascripts/pipelines/components/unwrapping_utils.js
View file @
4111bddf
/**
* This function takes the stages and add the stage name
* at the group level as `category` to have an easier
* implementation while constructions nodes with D3
* @param {Array} stages
* @returns {Array} - Array of stages with stage name at the group level as `category`
*/
export
const
unwrapArrayOfJobs
=
(
stages
=
[])
=>
{
return
stages
.
map
(({
name
,
groups
})
=>
{
return
groups
.
map
((
group
)
=>
{
return
{
category
:
name
,
...
group
};
});
})
.
flat
(
2
);
};
const
unwrapGroups
=
(
stages
)
=>
{
return
stages
.
map
((
stage
)
=>
{
const
{
...
...
spec/frontend/pipelines/unwrapping_utils_spec.js
View file @
4111bddf
import
{
unwrapArrayOfJobs
,
unwrapGroups
,
unwrapNodesWithName
,
unwrapStagesWithNeeds
,
...
...
@@ -95,29 +94,6 @@ const completeMock = [
];
describe
(
'
Shared pipeline unwrapping utils
'
,
()
=>
{
describe
(
'
unwrapArrayOfJobs
'
,
()
=>
{
it
(
'
returns an empty array if the input is an empty undefined
'
,
()
=>
{
expect
(
unwrapArrayOfJobs
(
undefined
)).
toEqual
([]);
});
it
(
'
returns an empty array if the input is an empty array
'
,
()
=>
{
expect
(
unwrapArrayOfJobs
([])).
toEqual
([]);
});
it
(
'
returns a flatten array of each job with their data and stage name
'
,
()
=>
{
expect
(
unwrapArrayOfJobs
([
{
name
:
'
build
'
,
groups
:
[{
name
:
'
job_a_1
'
},
{
name
:
'
job_a_2
'
}]
},
{
name
:
'
test
'
,
groups
:
[{
name
:
'
job_b
'
}]
},
]),
).
toMatchObject
([
{
category
:
'
build
'
,
name
:
'
job_a_1
'
},
{
category
:
'
build
'
,
name
:
'
job_a_2
'
},
{
category
:
'
test
'
,
name
:
'
job_b
'
},
]);
});
});
describe
(
'
unwrapGroups
'
,
()
=>
{
it
(
'
takes stages without nodes and returns the unwrapped groups
'
,
()
=>
{
expect
(
unwrapGroups
(
stagesAndGroups
)[
0
].
groups
).
toEqual
(
groupsArray
);
...
...
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