Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This PR includes show records results title on top of records list in Explore and Annotation Mode and unify styles Closes #1061 * results record title margin * make global component * fix lint * show filtered records only for rules * add text2text records title * ResultsTitle * fix lint * ResultsTitle test * ResultsTitle snap * ResultsList component * ResultsTitle component * fix: rename component file Co-authored-by: Francisco Aranda <francisco@recogn.ai> (cherry picked from commit dc49805)
- Loading branch information
1 parent
58ea754
commit 54ebb15
Showing
13 changed files
with
102 additions
and
98 deletions.
There are no files selected for viewing
68 changes: 0 additions & 68 deletions
68
frontend/components/commons/header/filters/HeaderTitle.vue
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<template> | ||
<p class="records-title" v-if="dataset.results.total > 0"> | ||
Records | ||
<span v-if="showWhenFiltered && areFiltersApplied.length" | ||
>with filters applied</span | ||
> | ||
({{ dataset.results.total | formatNumber }}) | ||
</p> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
dataset: { | ||
type: Object, | ||
required: true, | ||
}, | ||
showWhenFiltered: { | ||
type: Boolean, | ||
required: false, | ||
}, | ||
excludedFilter: { | ||
type: Array, | ||
default: () => { | ||
return ["text"]; | ||
}, | ||
}, | ||
}, | ||
computed: { | ||
areFiltersApplied() { | ||
const appliedFilters = Object.keys(this.dataset.query) | ||
.filter((f) => !this.excludedFilter.includes(f)) | ||
.map((key) => this.dataset.query[key]); | ||
return appliedFilters.filter((v) => v && Object.values(v).length); | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.records-title { | ||
color: $font-secondary; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { mount } from "@vue/test-utils"; | ||
import ResultsTitle from "@/components/commons/results/ResultsTitle"; | ||
|
||
function mountResultsTitle() { | ||
return mount(ResultsTitle, { | ||
propsData: { | ||
dataset: { | ||
task: "TextClassification", | ||
results: { | ||
total: 400, | ||
}, | ||
query: { | ||
annotated_as: undefined, | ||
annotated_by: undefined, | ||
from: undefined, | ||
limit: undefined, | ||
metadata: {}, | ||
predicted: undefined, | ||
predicted_as: ["Alta"], | ||
predicted_by: undefined, | ||
score: undefined, | ||
status: undefined, | ||
text: "de", | ||
}, | ||
}, | ||
showWhenFiltered: true, | ||
excludedFilter: ["text"], | ||
}, | ||
}); | ||
} | ||
|
||
describe("ResultsTitle", () => { | ||
let spy = jest.spyOn(console, "error"); | ||
afterEach(() => spy.mockReset()); | ||
|
||
test("renders properly", () => { | ||
const wrapper = mountResultsTitle(); | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
}); |
9 changes: 9 additions & 0 deletions
9
frontend/specs/components/results/__snapshots__/ResultsTitle.spec.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`ResultsTitle renders properly 1`] = ` | ||
<p class="records-title"> | ||
Records | ||
<span>with filters applied</span> | ||
(400) | ||
</p> | ||
`; |