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
bd98909c
Commit
bd98909c
authored
Sep 18, 2019
by
Martin Wortschack
Committed by
Filipa Lacerda
Sep 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly set the path for milestones and labels
- Move to utils and add spec
parent
b2c666ff
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
19 deletions
+51
-19
ee/app/assets/javascripts/analytics/productivity_analytics/index.js
...ets/javascripts/analytics/productivity_analytics/index.js
+3
-19
ee/app/assets/javascripts/analytics/productivity_analytics/utils.js
...ets/javascripts/analytics/productivity_analytics/utils.js
+15
-0
ee/spec/frontend/analytics/productivity_analytics/utils_spec.js
...c/frontend/analytics/productivity_analytics/utils_spec.js
+33
-0
No files found.
ee/app/assets/javascripts/analytics/productivity_analytics/index.js
View file @
bd98909c
import
Vue
from
'
vue
'
;
import
Api
from
'
~/api
'
;
import
store
from
'
./store
'
;
import
FilterDropdowns
from
'
./components/filter_dropdowns.vue
'
;
import
TimeFrameDropdown
from
'
./components/timeframe_dropdown.vue
'
;
import
ProductivityAnalyticsApp
from
'
./components/app.vue
'
;
import
FilteredSearchProductivityAnalytics
from
'
./filtered_search_productivity_analytics
'
;
import
{
getLabelsEndpoint
,
getMilestonesEndpoint
}
from
'
./utils
'
;
export
default
()
=>
{
const
container
=
document
.
getElementById
(
'
js-productivity-analytics
'
);
...
...
@@ -41,8 +41,8 @@ export default () => {
searchBarContainer
.
classList
.
remove
(
'
hide
'
);
const
filteredSearchInput
=
searchBarContainer
.
querySelector
(
'
.filtered-search
'
);
const
labelsEndpoint
=
this
.
getLabelsEndpoint
(
groupNamespace
,
projectNamespace
);
const
milestonesEndpoint
=
this
.
getMilestonesEndpoint
(
groupNamespace
,
projectNamespace
);
const
labelsEndpoint
=
getLabelsEndpoint
(
groupNamespace
,
projectNamespace
);
const
milestonesEndpoint
=
getMilestonesEndpoint
(
groupNamespace
,
projectNamespace
);
filteredSearchInput
.
setAttribute
(
'
data-group-id
'
,
groupId
);
...
...
@@ -55,22 +55,6 @@ export default () => {
filterManager
=
new
FilteredSearchProductivityAnalytics
({
isGroup
:
false
});
filterManager
.
setup
();
},
getLabelsEndpoint
(
namespacePath
,
projectPath
)
{
if
(
projectPath
)
{
return
Api
.
buildUrl
(
Api
.
projectLabelsPath
)
.
replace
(
'
:namespace_path
'
,
namespacePath
)
.
replace
(
'
:project_path
'
,
projectPath
);
}
return
Api
.
buildUrl
(
Api
.
groupLabelsPath
).
replace
(
'
:namespace_path
'
,
namespacePath
);
},
getMilestonesEndpoint
(
namespacePath
,
projectPath
)
{
if
(
projectPath
)
{
return
`/
${
namespacePath
}
/
${
projectPath
}
/-/milestones`
;
}
return
`/groups/
${
namespacePath
}
/-/milestones`
;
},
},
render
(
h
)
{
return
h
(
FilterDropdowns
,
{
...
...
ee/app/assets/javascripts/analytics/productivity_analytics/utils.js
0 → 100644
View file @
bd98909c
export
const
getLabelsEndpoint
=
(
namespacePath
,
projectPathWithNamespace
)
=>
{
if
(
projectPathWithNamespace
)
{
return
`/
${
projectPathWithNamespace
}
/-/labels`
;
}
return
`/groups/
${
namespacePath
}
/-/labels`
;
};
export
const
getMilestonesEndpoint
=
(
namespacePath
,
projectPathWithNamespace
)
=>
{
if
(
projectPathWithNamespace
)
{
return
`/
${
projectPathWithNamespace
}
/-/milestones`
;
}
return
`/groups/
${
namespacePath
}
/-/milestones`
;
};
ee/spec/frontend/analytics/productivity_analytics/utils_spec.js
0 → 100644
View file @
bd98909c
import
{
getLabelsEndpoint
,
getMilestonesEndpoint
,
}
from
'
ee/analytics/productivity_analytics/utils
'
;
describe
(
'
Productivity Analytics utils
'
,
()
=>
{
const
namespacePath
=
'
gitlab-org
'
;
const
projectWithNamespace
=
'
gitlab-org/gitlab-test
'
;
describe
(
'
getLabelsEndpoint
'
,
()
=>
{
it
(
'
returns the group labels path when no project is given
'
,
()
=>
{
expect
(
getLabelsEndpoint
(
namespacePath
)).
toBe
(
'
/groups/gitlab-org/-/labels
'
);
});
it
(
'
returns the project labels path when a project is given
'
,
()
=>
{
expect
(
getLabelsEndpoint
(
namespacePath
,
projectWithNamespace
)).
toBe
(
'
/gitlab-org/gitlab-test/-/labels
'
,
);
});
});
describe
(
'
getMilestonesEndpoint
'
,
()
=>
{
it
(
'
returns the group milestone path when no project is given
'
,
()
=>
{
expect
(
getMilestonesEndpoint
(
namespacePath
)).
toBe
(
'
/groups/gitlab-org/-/milestones
'
);
});
it
(
'
returns the project milestone path when a project is given
'
,
()
=>
{
expect
(
getMilestonesEndpoint
(
namespacePath
,
projectWithNamespace
)).
toBe
(
'
/gitlab-org/gitlab-test/-/milestones
'
,
);
});
});
});
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