mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-03-12 01:32:12 +00:00
feat: separate prettier from eslint
This commit is contained in:
committed by
Thea Schöbl
parent
939fb6ef0f
commit
a88d000ccd
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 StApps
|
||||
* Copyright (C) 2022 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
@@ -13,19 +13,9 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Injectable} from '@angular/core';
|
||||
import {
|
||||
SCFacet,
|
||||
SCSearchFilter,
|
||||
SCSearchSort,
|
||||
SCThingType,
|
||||
} from '@openstapps/core';
|
||||
import {SCFacet, SCSearchFilter, SCSearchSort, SCThingType} from '@openstapps/core';
|
||||
import {Subject} from 'rxjs';
|
||||
import {
|
||||
FilterBucket,
|
||||
FilterContext,
|
||||
FilterFacet,
|
||||
SortContext,
|
||||
} from './context-type';
|
||||
import {FilterBucket, FilterContext, FilterFacet, SortContext} from './context-type';
|
||||
|
||||
/**
|
||||
* ContextMenuService provides bidirectional communication of context menu options and search queries
|
||||
@@ -87,9 +77,7 @@ export class ContextMenuService {
|
||||
*
|
||||
* @param filterContext FilterContext to build SCSearchFilter from
|
||||
*/
|
||||
buildFilterQuery = (
|
||||
filterContext: FilterContext,
|
||||
): SCSearchFilter | undefined => {
|
||||
buildFilterQuery = (filterContext: FilterContext): SCSearchFilter | undefined => {
|
||||
const filters: SCSearchFilter[] = [];
|
||||
|
||||
if (typeof this.forcedType !== 'undefined') {
|
||||
@@ -217,10 +205,7 @@ export class ContextMenuService {
|
||||
* Updates context filter with new facets.
|
||||
* It preserves the checked status of existing filter options
|
||||
*/
|
||||
updateContextFilterOptions = (
|
||||
contextFilter: FilterContext,
|
||||
facets: SCFacet[],
|
||||
) => {
|
||||
updateContextFilterOptions = (contextFilter: FilterContext, facets: SCFacet[]) => {
|
||||
const newFilterOptions: FilterFacet[] = [];
|
||||
|
||||
// iterate new facets
|
||||
@@ -236,21 +221,15 @@ export class ContextMenuService {
|
||||
// search existing filterOption
|
||||
const filterOption = contextFilter.options.find(
|
||||
(contextFacet: FilterFacet) =>
|
||||
contextFacet.field === facet.field &&
|
||||
contextFacet.onlyOnType === facet.onlyOnType,
|
||||
contextFacet.field === facet.field && contextFacet.onlyOnType === facet.onlyOnType,
|
||||
);
|
||||
for (const bucket of facet.buckets) {
|
||||
// search existing bucket to preserve checked status
|
||||
const existingFilterBucket = filterOption
|
||||
? filterOption.buckets.find(
|
||||
(contextBucket: FilterBucket) =>
|
||||
contextBucket.key === bucket.key,
|
||||
)
|
||||
? filterOption.buckets.find((contextBucket: FilterBucket) => contextBucket.key === bucket.key)
|
||||
: undefined;
|
||||
const filterBucket: FilterBucket = {
|
||||
checked: existingFilterBucket
|
||||
? existingFilterBucket.checked
|
||||
: false,
|
||||
checked: existingFilterBucket ? existingFilterBucket.checked : false,
|
||||
count: bucket.count,
|
||||
key: bucket.key,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user