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

[#2098] Add show more button for error messages #2105

Merged
merged 13 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
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
4 changes: 4 additions & 0 deletions frontend/cypress/config/repo-config.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Repository's Location,Branch,File formats,Ignore Glob List,Ignore standalone config,Ignore Commits List,Ignore Authors List,Shallow Cloning,Find Previous Authors
https://github.com/reposense/RepoSense.git,cypress,,,,,,,
https://github.com/reposense/testrepo-Empty.git,master,,,,,,,
https://github.com/reposense/testrepo-Empty2.git,master,,,,,,,
https://github.com/reposense/testrepo-Empty3.git,master,,,,,,,
https://github.com/reposense/testrepo-Empty4.git,master,,,,,,,
https://github.com/reposense/testrepo-Empty5.git,master,,,,,,,
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,24 @@ describe('error summary', () => {
cy.get('.error-message-box')
.should('not.be.visible');
});

it('can be expanded and collapsed if count > 4', () => {
cy.get('.error-message-box')
.find('.error-message-box__failed-repo')
.should('have.length', 4);

cy.get('.error-message-box__show-more-container > a')
.click();

cy.get('.error-message-box')
.find('.error-message-box__failed-repo')
.should('have.length', 5);

cy.get('.error-message-box__show-more-container > a')
.click();

cy.get('.error-message-box')
.find('.error-message-box__failed-repo')
.should('have.length', 4);
});
});
21 changes: 19 additions & 2 deletions frontend/src/views/c-summary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@
.error-message-box(v-if="Object.entries(errorMessages).length && !isWidgetMode")
.error-message-box__close-button(v-on:click="dismissTab($event)") ×
.error-message-box__message The following issues occurred when analyzing the following repositories:
.error-message-box__failed-repo(v-for="errorBlock in errorMessages")
.error-message-box__failed-repo(
v-for="errorBlock in errorIsShowingMore ? errorMessages : Object.values(errorMessages).slice(0, 4)"
)
font-awesome-icon(icon="exclamation")
span.error-message-box__failed-repo--name {{ errorBlock.repoName }}
.error-message-box__failed-repo--reason(
Expand All @@ -92,7 +94,11 @@
v-bind:href="getReportIssueEmailLink(errorBlock.errorMessage)"
)
span {{ getReportIssueEmailAddress() }}
.error-message-box__failed-repo--reason(v-else) {{ errorBlock.errorMessage }}
.error-message-box__failed-repo--reason(v-else) {{ errorBlock.errorMessage }}\
.error-message-box__show-more-container(v-if="Object.keys(errorMessages).length > 4")
vvidday marked this conversation as resolved.
Show resolved Hide resolved
span(v-if="!errorIsShowingMore") Remaining error messages omitted to save space. 
a(v-if="!errorIsShowingMore", v-on:click="toggleErrorShowMore()") SHOW ALL...
a(v-else, v-on:click="toggleErrorShowMore()") SHOW LESS...
.fileTypes(v-if="filterBreakdown && !isWidgetMode")
.checkboxes.mui-form--inline(v-if="Object.keys(fileTypeColors).length > 0")
label(style='background-color: #000000; color: #ffffff')
Expand Down Expand Up @@ -201,6 +207,7 @@ export default defineComponent({
filterGroupSelectionWatcherFlag: false,
chartGroupIndex: undefined as number | undefined,
chartIndex: undefined as number | undefined,
errorIsShowingMore: false,
};
},
computed: {
Expand Down Expand Up @@ -933,6 +940,10 @@ export default defineComponent({
getFontColor(color: string) {
return window.getFontColor(color);
},

toggleErrorShowMore() {
this.errorIsShowingMore = !this.errorIsShowingMore;
},
},
});
</script>
Expand All @@ -941,4 +952,10 @@ export default defineComponent({
<style lang="scss">
@import '../styles/_colors.scss';
@import '../styles/summary-chart.scss';

.error-message-box__show-more-container {
display: flex;
justify-content: flex-end;
margin-top: .3rem;
}
</style>
Loading