Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#2148] Show tags on the ramp chart #2163

Merged
merged 30 commits into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
356846a
show all tags of repo
jonasongg Mar 18, 2024
82a3c20
add checkbox to toggle showing of repo tags
jonasongg Mar 18, 2024
ed0f2a5
add newline
jonasongg Mar 18, 2024
a4f3d41
fix lint
jonasongg Mar 18, 2024
05e2ba6
change view repo tags checkbox to show tags
jonasongg Mar 22, 2024
4989606
update documentation
jonasongg Mar 25, 2024
c22f1cf
add tests for show tags on ramp chart
jonasongg Mar 25, 2024
154d624
add show tags test
jonasongg Mar 25, 2024
feeb20a
add link to tags in show tags
jonasongg Mar 30, 2024
dea2fe5
add test for redirecting to opening tag
jonasongg Mar 30, 2024
fea42a1
fix lint
jonasongg Mar 30, 2024
ee8c74c
fix show tags when sort by authors
jonasongg Apr 6, 2024
c4a4b02
add view repo tags to the hash
jonasongg Apr 6, 2024
3b17857
fix logic for getting tags
jonasongg Apr 6, 2024
9347db8
fix lint
jonasongg Apr 10, 2024
0e177cb
Merge remote-tracking branch 'upstream/master' into add-show-tags-on-…
jonasongg Apr 10, 2024
875c335
extract showTags v-ifs into computed booleans
jonasongg Apr 15, 2024
dcc5a73
Merge remote-tracking branch 'upstream/master' into add-show-tags-on-…
jonasongg Apr 15, 2024
6eb18f4
merge
jonasongg Apr 15, 2024
1537302
add show tags to renderFilterHash test
jonasongg Apr 15, 2024
1a6213d
Merge branch 'master' into add-show-tags-on-ramp-chart
jonasongg Apr 15, 2024
d6733a4
fix getTagLink for viewing tags for author
jonasongg Apr 18, 2024
5e786a2
Merge remote-tracking branch 'refs/remotes/origin/add-show-tags-on-ra…
jonasongg Apr 18, 2024
0f208d3
Merge remote-tracking branch 'upstream/master' into add-show-tags-on-…
jonasongg Apr 18, 2024
e1cd222
Merge branch 'master' into add-show-tags-on-ramp-chart
jonasongg Apr 19, 2024
cf06707
fix showTags cypress test
jonasongg Apr 19, 2024
98f3be7
Merge branch 'master' into add-show-tags-on-ramp-chart
jonasongg Apr 24, 2024
3832b3c
fix failing cypress
jonasongg Apr 25, 2024
a481255
fix cypress
jonasongg Apr 25, 2024
37b4b88
Merge branch 'master' into add-show-tags-on-ramp-chart
sopa301 Apr 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/ug/usingReports.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ The `Tool Bar` at the top of the Chart panel provides a set of configuration opt
* a breakdown of the number of lines of codes added to each file type (if the checkbox is checked). More info on note [3] below.
* `Merge group`: merges all the ramp charts of each group into a single ramp chart; aggregates the contribution of each group.
* viewing of authored code of the group as a whole is available when `group by repos`.
* `Show tags`: shows the tags of all the repos under a group

Notes:<br>
[1] **`Sort groups by`**: each main group has its own index and percentile according to its ranking position after sorting (e.g., if the groups are sorted by contribution in descending order, a 25% percentile indicates that the group is in the top 25% of the whole cohort in terms of contribution)<br>.
Expand Down
67 changes: 67 additions & 0 deletions frontend/cypress/tests/chartView/chartView_showTags.cy.js
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a Cypress test for displaying tags when grouped by author too?

Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
describe('show tags', () => {
it('unchecked should not display any tags for a group', () => {
cy.get('#summary label.show-tags > input:visible')
.should('be.visible')
.uncheck()
.should('not.be.checked');

cy.get('.summary-charts__title--tags')
.should('not.exist');
});

it('checked should display all tags for a group', () => {
cy.get('#summary label.show-tags > input:visible')
.should('be.visible')
.check()
.should('be.checked');

cy.get('#summary label.merge-group > input:visible')
.should('be.visible')
.check()
.should('be.checked');

cy.get('.icon-button.fa-list-ul')
.should('exist')
.first()
.click();

const correctTags = [];

cy.get('.zoom__title--tags')
.find('.tag')
.each(($tag) => correctTags.push($tag.text().trim()))
.then(() => {
cy.get('.summary-charts')
.first()
.find('.summary-charts__title--tags')
.find('.tag')
.each(($tag) => {
expect(correctTags).to.include($tag.text().trim());
});

cy.get('.summary-charts')
.first()
.find('.summary-charts__title--tags')
.find('.tag')
.should('have.length', correctTags.length);
});
});

it('clicked should redirect to the correct tag page', () => {
cy.get('#summary label.show-tags > input:visible')
.should('be.visible')
.check()
.should('be.checked');

cy.get('.summary-charts__title--tags')
.find('.tag')
.first()
.invoke('removeAttr', 'target') // to open in the same window
.click();

cy.origin('https://github.com', () => {
cy.url()
.should('equal', 'https://github.com/reposense/RepoSense/releases/tag/v1.0');
});
});
});
14 changes: 14 additions & 0 deletions frontend/cypress/tests/codeView/codeView_renderFilterHash.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,20 @@ describe('render filter hash', () => {
.should('contain', 'mergegroup=reposense%2FRepoSense%5Bcypress%5D');
});

it('show tags: url params should persist after change and reload', () => {
cy.get('#summary label.show-tags input:visible')
.should('be.visible')
.check();

cy.url()
.should('contain', 'viewRepoTags=true');

cy.reload();

cy.url()
.should('contain', 'viewRepoTags=true');
});

it('checked file types: url params should persist after change and reload', () => {
cy.get('#summary label.filter-breakdown input:visible')
.should('not.be.checked');
Expand Down
48 changes: 48 additions & 0 deletions frontend/src/components/c-summary-charts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,18 @@
v-if="sortGroupSelection.includes('totalCommits')"
) {{ getPercentile(i) }} %&nbsp
span.tooltip-text.right-aligned {{ getPercentileExplanation(i) }}
.summary-charts__title--tags(
v-if="isViewingTagsByRepo"
)
a.tag(
v-for="tag in getTags(repo)",
v-bind:href="getTagLink(repo[0], tag)",
target="_blank",
vbind:key="tag",
tabindex="-1"
)
font-awesome-icon(icon="tags")
span &nbsp;{{ tag }}
.summary-charts__fileType--breakdown(v-if="filterBreakdown")
template(v-if="filterGroupSelection !== 'groupByNone'")
.summary-charts__fileType--breakdown__legend(
Expand Down Expand Up @@ -261,6 +273,16 @@
v-if="filterGroupSelection === 'groupByNone' && sortGroupSelection.includes('totalCommits')"
) {{ getPercentile(j) }} %&nbsp
span.tooltip-text.right-aligned {{ getPercentileExplanation(j) }}
.summary-chart__title--tags(v-if="isViewingTagsByAuthor")
a.tag(
v-for="tag in getTags(repo, user)",
v-bind:href="getTagLink(user, tag)",
target="_blank",
vbind:key="tag",
tabindex="-1"
)
font-awesome-icon(icon="tags")
span &nbsp;{{ tag }}

.summary-chart__ramp(
v-on:click="openTabZoomSubrange(user, $event, isGroupMerged(getGroupName(repo)))"
Expand Down Expand Up @@ -374,6 +396,10 @@ export default defineComponent({
type: Number,
default: undefined,
},
viewRepoTags: {
type: Boolean,
default: false,
},
},
data(): {
drags: Array<number>,
Expand Down Expand Up @@ -420,6 +446,14 @@ export default defineComponent({
isChartWidgetMode(): boolean {
return this.chartIndex !== undefined && this.chartIndex >= 0 && this.isChartGroupWidgetMode;
},
isViewingTagsByRepo() {
return this.filterGroupSelection === FilterGroupSelection.GroupByRepos && this.viewRepoTags;
},
isViewingTagsByAuthor() {
return (this.filterGroupSelection === FilterGroupSelection.GroupByAuthors
|| this.filterGroupSelection === FilterGroupSelection.GroupByNone)
&& this.viewRepoTags;
},
...mapState({
mergedGroups: (state: unknown) => (state as StoreState).mergedGroups,
fileTypeColors: (state: unknown) => (state as StoreState).fileTypeColors,
Expand Down Expand Up @@ -576,6 +610,10 @@ export default defineComponent({
}
},

getTagLink(repo: User, tag: string): string | undefined {
return window.filterUnsupported(`${window.getRepoLinkUnfiltered(repo.repoId)}releases/tag/${tag}`);
},

// triggering opening of tabs //
openTabAuthorship(user: User, repo: Array<User>, index: number, isMerged: boolean): void {
const {
Expand Down Expand Up @@ -902,6 +940,16 @@ export default defineComponent({
chart.scrollIntoView({ block: 'nearest' });
}
},

getTags(repo: Array<User>, user?: User): Array<string> {
if (user) repo = repo.filter((r) => r.name === user.name);
return [...new Set(repo.flatMap((r) => r.commits).flatMap((c) => c.commitResults).flatMap((r) => r.tags))]
.filter(Boolean) as Array<string>;
},
},
});
</script>

<style lang="scss" scoped>
@import '../styles/tags.scss';
</style>
5 changes: 5 additions & 0 deletions frontend/src/styles/summary-chart.scss
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
&__title {
align-items: center;
display: flex;
flex-wrap: wrap;
font-weight: bold;
text-align: left;

Expand Down Expand Up @@ -128,6 +129,10 @@
@include mini-font;
display: inline;
}

&--tags {
margin: .25rem 0;
}
}

&__fileType--breakdown {
Expand Down
16 changes: 16 additions & 0 deletions frontend/src/styles/tags.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@import 'colors';

/* Tags in commits */
.tag {
@include mini-font;
background: mui-color('grey', '600');
border-radius: 5px;
color: mui-color('white');
display: inline-block;
margin: .2rem .2rem .2rem 0;
padding: 0 3px 0 3px;

.fa-tags {
width: .65rem;
}
}
27 changes: 23 additions & 4 deletions frontend/src/views/c-summary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@
v-bind:disabled="filterGroupSelection === 'groupByNone'"
)
span merge all groups
label.show-tags
input.mui-checkbox(
type="checkbox",
v-model="viewRepoTags",
v-on:change="getFiltered"
)
span show tags
.error-message-box(v-if="Object.entries(errorMessages).length && !isWidgetMode")
.error-message-box__close-button(v-on:click="dismissTab($event)") &times;
.error-message-box__message The following issues occurred when analyzing the following repositories:
Expand Down Expand Up @@ -123,7 +130,8 @@
v-bind:max-date="maxDate",
v-bind:sort-group-selection="sortGroupSelection",
v-bind:chart-group-index="chartGroupIndex",
v-bind:chart-index="chartIndex"
v-bind:chart-index="chartIndex",
v-bind:view-repo-tags="viewRepoTags"
)
</template>

Expand Down Expand Up @@ -205,7 +213,8 @@ export default defineComponent({
chartGroupIndex: number | undefined,
chartIndex: number | undefined,
errorIsShowingMore: boolean,
numberOfErrorMessagesToShow: number
numberOfErrorMessagesToShow: number,
viewRepoTags: boolean,
} {
return {
checkedFileTypes: [] as Array<string>,
Expand Down Expand Up @@ -235,6 +244,7 @@ export default defineComponent({
chartIndex: undefined as number | undefined,
errorIsShowingMore: false,
numberOfErrorMessagesToShow: 4,
viewRepoTags: false,
};
},
computed: {
Expand Down Expand Up @@ -388,7 +398,7 @@ export default defineComponent({
},

setSummaryHash(): void {
const { addHash, encodeHash } = window;
const { addHash, encodeHash, removeHash } = window;

addHash('search', this.filterSearch);
addHash('sort', this.sortGroupSelection);
Expand Down Expand Up @@ -419,7 +429,13 @@ export default defineComponent({
: '';
addHash('checkedFileTypes', checkedFileTypesHash);
} else {
window.removeHash('checkedFileTypes');
removeHash('checkedFileTypes');
}

if (this.viewRepoTags) {
addHash('viewRepoTags', 'true');
} else {
removeHash('viewRepoTags');
}

encodeHash();
Expand Down Expand Up @@ -470,6 +486,9 @@ export default defineComponent({
if (hash.chartIndex) {
this.chartIndex = parseInt(hash.chartIndex, 10);
}
if (hash.viewRepoTags) {
this.viewRepoTags = convertBool(hash.viewRepoTags);
}
},

getGroupName(group: Array<User>): string {
Expand Down
16 changes: 1 addition & 15 deletions frontend/src/views/c-zoom.vue
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ export default defineComponent({

<style lang="scss" scoped>
@import '../styles/_colors.scss';
@import '../styles/tags.scss';

#tab-zoom {
.zoom {
Expand Down Expand Up @@ -414,21 +415,6 @@ export default defineComponent({
h3 {
@include large-font;
}

/* Tags in commits */
.tag {
@include mini-font;
background: mui-color('grey', '600');
border-radius: 5px;
color: mui-color('white');
display: inline-block;
margin: .2rem .2rem .2rem 0;
padding: 0 3px 0 3px;

.fa-tags {
width: .65rem;
}
}
}
}
}
Expand Down
Loading