Skip to content

Commit 124e013

Browse files
authored
[#2436] Change portfolio mode to use custom sort order (#2462)
Change sort order in portfolio mode to use custom sort order. Users can customize the order of repositories in portfolio mode using the config file.
1 parent 7877237 commit 124e013

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
describe('sorting',
2+
{ baseUrl: Cypress.env('portfolioBaseUrl') },
3+
() => {
4+
beforeEach(() => {
5+
cy.readFile('configs/portfolio/repo-config.csv').then((csvString) => {
6+
const lines = csvString.trim().split('\n');
7+
// map last 3 repos in repo-config.csv to corresponding display title in summary charts
8+
const repoNames = lines.slice(-3).map((line) => {
9+
const values = line.split(',');
10+
11+
const match = values[0].match(/^https?:\/\/(www\.)?github.com\/([^/]+)\/([^/.]+)(\.git)?/i)
12+
const repoName = `${match[2]}/${match[3]}`;
13+
14+
return `${repoName}[${values[1]}]`;
15+
});
16+
cy.wrap(repoNames).as('repoNames')
17+
});
18+
})
19+
20+
it('repo order should follow order of rows in repo-config.csv', () => {
21+
cy.get('.summary-charts__title--groupname')
22+
.then(($els) => {
23+
// last 3 summary chart title
24+
const repoTitles = Cypress._.map($els, (el) => el.textContent.trim()).slice(-3);
25+
26+
cy.get('@repoNames').then((repoNames) => {
27+
repoNames.forEach((expectedRepoName, index) => {
28+
expect(repoTitles[index]).to.eq(expectedRepoName);
29+
});
30+
});
31+
})
32+
});
33+
},
34+
);

frontend/cypress/tests/portfolioView/portfolioView_widget.cy.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ describe('widget',
4040

4141
it('user link should open the correct user\'s widget', () => {
4242
cy.get('.summary-charts')
43-
.eq(1)
43+
.contains('.summary-charts__title--groupname', 'reposense/repoSense-action[main]')
44+
.parents('.summary-charts')
4445
.find('.summary-chart__title .fa-clipboard')
4546
.first()
4647
.click()

frontend/src/views/c-summary-portfolio.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ export default defineComponent({
172172
173173
const filterControl = {
174174
filterGroupSelection: FilterGroupSelection.GroupByRepos,
175-
sortingOption: SortGroupSelection.GroupTitle,
175+
sortingOption: SortGroupSelection.Default,
176176
sortingWithinOption: SortWithinGroupSelection.Title,
177177
isSortingDsc: false,
178178
isSortingWithinDsc: false,

0 commit comments

Comments
 (0)