diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2016-09-13 16:28:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-13 16:28:59 +0200 |
commit | 0359411125578632c70ccf458625d0163c2b8b16 (patch) | |
tree | 5da13e3fd075c7df922f2bdd43437bb0b5fe5641 /server/sonar-web/src/main/js/apps/code | |
parent | 935f49ee8a39366098bb4627a2e0aa700f762fa2 (diff) | |
download | sonarqube-0359411125578632c70ccf458625d0163c2b8b16.tar.gz sonarqube-0359411125578632c70ccf458625d0163c2b8b16.zip |
SONAR-8036 Code page does not expand root directory properly (#1239)
Diffstat (limited to 'server/sonar-web/src/main/js/apps/code')
-rw-r--r-- | server/sonar-web/src/main/js/apps/code/actions/index.js | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/server/sonar-web/src/main/js/apps/code/actions/index.js b/server/sonar-web/src/main/js/apps/code/actions/index.js index f8ace5adf1d..464e8372b64 100644 --- a/server/sonar-web/src/main/js/apps/code/actions/index.js +++ b/server/sonar-web/src/main/js/apps/code/actions/index.js @@ -129,13 +129,28 @@ function getPath (componentKey) { return '/' + encodeURIComponent(componentKey); } +function requestChildren (componentKey, metrics, page) { + return getChildren(componentKey, metrics, { p: page, ps: PAGE_SIZE }).then(r => { + if (r.paging.total > r.paging.pageSize * r.paging.pageIndex) { + return requestChildren(componentKey, metrics, page + 1).then(moreComponents => { + return [...r.components, ...moreComponents]; + }) + } + return r.components; + }); +} + +function requestAllChildren (componentKey, metrics) { + return requestChildren(componentKey, metrics, 1); +} + function expandRootDir (metrics) { return function ({ children, total, ...other }) { const rootDir = children.find(component => component.qualifier === 'DIR' && component.name === '/'); if (rootDir) { - return getChildren(rootDir.key, metrics).then(r => { - const nextChildren = _.without([...children, ...r.components], rootDir); - const nextTotal = total + r.components.length - /* root dir */ 1; + return requestAllChildren(rootDir.key, metrics).then(components => { + const nextChildren = _.without([...children, ...components], rootDir); + const nextTotal = total + components.length - /* root dir */ 1; return { children: nextChildren, total: nextTotal, ...other }; }); } else { |