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

2100 widget info #2238

Closed
Closed
Show file tree
Hide file tree
Changes from all 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
33 changes: 30 additions & 3 deletions frontend/cypress/tests/chartView/chartView_optimiseTimeline.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('optimise timeline', () => {
});
});

it('start and end date indicators should exist', () => {
it('start and end date indicators should exist when optimise timeline is checked', () => {
cy.get('#summary label.optimise-timeline > input:visible')
.should('be.visible')
.check()
Expand All @@ -61,7 +61,34 @@ describe('optimise timeline', () => {
.should('have.text', '2023-03-03');
});

it('no commits in range should not have date indicators', () => {
it('start and end date indicators should exist when optimise timeline is unchecked', () => {
cy.get('#summary label.optimise-timeline > input:visible')
.should('be.visible')
.uncheck()
.should('be.not.checked');

// change since date
cy.get('input[name="since"]')
.type('2018-12-31');

// change until date
cy.get('input[name="until"]')
.type('2024-01-01');

cy.get('#summary-charts .summary-chart')
.first()
.find('.summary-chart__ramp .date-indicators span')
.first()
.should('have.text', '2018-12-31');

cy.get('#summary-charts .summary-chart')
.first()
.find('.summary-chart__ramp .date-indicators span')
.last()
.should('have.text', '2024-01-01');
});

it('no commits in range should still have date indicators', () => {
cy.get('#summary label.optimise-timeline > input:visible')
.should('be.visible')
.check()
Expand All @@ -78,7 +105,7 @@ describe('optimise timeline', () => {
cy.get('#summary-charts .summary-chart')
.first()
.find('.summary-chart__ramp .date-indicators')
.should('not.exist');
.should('exist');
});

it('zoom panel range should work correctly when timeline is optimised', () => {
Expand Down
20 changes: 20 additions & 0 deletions frontend/src/components/c-ramp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,20 @@
)
.date-indicators(v-if="optimiseTimeline")
span {{optimisedMinimumDate}}
span Generated by 
a(
v-bind:href="getRepoSenseHomeLink()", target="_blank"
)
strong RepoSense
span {{optimisedMaximumDate}}
.date-indicators(v-else)
span {{sdate}}
span Generated by 
a(
v-bind:href="getRepoSenseHomeLink()", target="_blank"
)
strong RepoSense
span {{udate}}
</template>

<script lang='ts'>
Expand Down Expand Up @@ -125,6 +138,13 @@ export default defineComponent({
getLink(commit: CommitResult): string | undefined {
return window.getCommitLink(commit.repoId, commit.hash);
},
getRepoSenseHomeLink(): string {
const version = window.repoSenseVersion;
if (!version) {
return `${window.HOME_PAGE_URL}/RepoSense/`;
}
return `${window.HOME_PAGE_URL}`;
},
getContributions(commit: CommitResult | Commit): number {
return commit.insertions + commit.deletions;
},
Expand Down
Loading