Smart Filters & Dashboard Customization (#2282)
Co-authored-by: Robbie Davis <robbie@therobbiedavis.com>
This commit is contained in:
parent
3d501c9532
commit
84f85b4f24
92 changed files with 7149 additions and 555 deletions
|
|
@ -107,6 +107,49 @@ export class FilterUtilitiesService {
|
|||
}).join(','));
|
||||
}
|
||||
|
||||
decodeSeriesFilter(encodedFilter: string) {
|
||||
const filter = this.metadataService.createDefaultFilterDto();
|
||||
|
||||
if (encodedFilter.includes('name=')) {
|
||||
filter.name = decodeURIComponent(encodedFilter).split('name=')[1].split('&')[0];
|
||||
}
|
||||
|
||||
const stmtsStartIndex = encodedFilter.indexOf(statementsKey);
|
||||
let endIndex = encodedFilter.indexOf('&' + sortOptionsKey);
|
||||
if (endIndex < 0) {
|
||||
endIndex = encodedFilter.indexOf('&' + limitToKey);
|
||||
}
|
||||
|
||||
if (stmtsStartIndex !== -1 || endIndex !== -1) {
|
||||
// +1 is for the =
|
||||
const stmtsEncoded = encodedFilter.substring(stmtsStartIndex + statementsKey.length, endIndex);
|
||||
filter.statements = this.decodeFilterStatements(stmtsEncoded);
|
||||
}
|
||||
|
||||
if (encodedFilter.includes(sortOptionsKey)) {
|
||||
const optionsStartIndex = encodedFilter.indexOf('&' + sortOptionsKey);
|
||||
const endIndex = encodedFilter.indexOf('&' + limitToKey);
|
||||
const sortOptionsEncoded = encodedFilter.substring(optionsStartIndex + sortOptionsKey.length + 1, endIndex);
|
||||
const sortOptions = this.decodeSortOptions(sortOptionsEncoded);
|
||||
if (sortOptions) {
|
||||
filter.sortOptions = sortOptions;
|
||||
}
|
||||
}
|
||||
|
||||
if (encodedFilter.includes(limitToKey)) {
|
||||
const limitTo = decodeURIComponent(encodedFilter).split(limitToKey)[1].split('&')[0];
|
||||
filter.limitTo = parseInt(limitTo, 10);
|
||||
}
|
||||
|
||||
if (encodedFilter.includes(combinationKey)) {
|
||||
const combo = decodeURIComponent(encodedFilter).split(combinationKey)[1].split('&')[0];;
|
||||
filter.combination = parseInt(combo, 10) as FilterCombination;
|
||||
}
|
||||
|
||||
return filter;
|
||||
}
|
||||
|
||||
|
||||
filterPresetsFromUrlV2(snapshot: ActivatedRouteSnapshot): SeriesFilterV2 {
|
||||
const filter = this.metadataService.createDefaultFilterDto();
|
||||
if (!window.location.href.includes('?')) return filter;
|
||||
|
|
|
|||
|
|
@ -2,4 +2,8 @@
|
|||
width: 100%;
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue