mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-05-10 23:19:44 +00:00
refactor: replace TSLint with ESLint
This commit is contained in:
committed by
Jovan Krunić
parent
67fb4a43c9
commit
d696215d08
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
|
||||
import moment from 'moment'
|
||||
|
||||
|
||||
@@ -42,22 +42,15 @@ export const sampleAggregations: SCBackendAggregationConfiguration[] = [
|
||||
},
|
||||
{
|
||||
fieldName: 'academicTerms.acronym',
|
||||
onlyOnTypes: [
|
||||
SCThingType.AcademicEvent,
|
||||
SCThingType.SportCourse,
|
||||
],
|
||||
onlyOnTypes: [SCThingType.AcademicEvent, SCThingType.SportCourse],
|
||||
},
|
||||
{
|
||||
fieldName: 'academicTerm.acronym',
|
||||
onlyOnTypes: [
|
||||
SCThingType.Catalog,
|
||||
],
|
||||
onlyOnTypes: [SCThingType.Catalog],
|
||||
},
|
||||
{
|
||||
fieldName: 'majors',
|
||||
onlyOnTypes: [
|
||||
SCThingType.AcademicEvent,
|
||||
],
|
||||
onlyOnTypes: [SCThingType.AcademicEvent],
|
||||
},
|
||||
{
|
||||
fieldName: 'keywords',
|
||||
|
||||
@@ -16,95 +16,98 @@ import {SCFacet, SCThingType} from '@openstapps/core';
|
||||
|
||||
export const facetsMock: SCFacet[] = [
|
||||
{
|
||||
'buckets': [
|
||||
buckets: [
|
||||
{
|
||||
'count': 60,
|
||||
'key': 'academic event',
|
||||
count: 60,
|
||||
key: 'academic event',
|
||||
},
|
||||
{
|
||||
'count': 160,
|
||||
'key': 'message',
|
||||
count: 160,
|
||||
key: 'message',
|
||||
},
|
||||
{
|
||||
'count': 151,
|
||||
'key': 'date series',
|
||||
count: 151,
|
||||
key: 'date series',
|
||||
},
|
||||
{
|
||||
'count': 106,
|
||||
'key': 'dish',
|
||||
count: 106,
|
||||
key: 'dish',
|
||||
},
|
||||
{
|
||||
'count': 20,
|
||||
'key': 'building',
|
||||
count: 20,
|
||||
key: 'building',
|
||||
},
|
||||
{
|
||||
'count': 20,
|
||||
'key': 'semester',
|
||||
count: 20,
|
||||
key: 'semester',
|
||||
},
|
||||
],
|
||||
'field': 'type',
|
||||
field: 'type',
|
||||
},
|
||||
{
|
||||
'buckets': [
|
||||
buckets: [
|
||||
{
|
||||
'count': 12,
|
||||
'key': 'Max Mustermann',
|
||||
count: 12,
|
||||
key: 'Max Mustermann',
|
||||
},
|
||||
{
|
||||
'count': 2,
|
||||
'key': 'Foo Bar',
|
||||
count: 2,
|
||||
key: 'Foo Bar',
|
||||
},
|
||||
],
|
||||
'field': 'performers',
|
||||
'onlyOnType': SCThingType.AcademicEvent,
|
||||
field: 'performers',
|
||||
onlyOnType: SCThingType.AcademicEvent,
|
||||
},
|
||||
{
|
||||
'buckets': [
|
||||
buckets: [
|
||||
{
|
||||
'count': 5,
|
||||
'key': 'colloquium',
|
||||
count: 5,
|
||||
key: 'colloquium',
|
||||
},
|
||||
{
|
||||
'count': 15,
|
||||
'key': 'course',
|
||||
count: 15,
|
||||
key: 'course',
|
||||
},
|
||||
],
|
||||
'field': 'categories',
|
||||
'onlyOnType': SCThingType.AcademicEvent,
|
||||
field: 'categories',
|
||||
onlyOnType: SCThingType.AcademicEvent,
|
||||
},
|
||||
{
|
||||
'buckets': [
|
||||
buckets: [
|
||||
{
|
||||
'count': 5,
|
||||
'key': 'unipedia',
|
||||
}],
|
||||
'field': 'categories',
|
||||
'onlyOnType': SCThingType.Article,
|
||||
count: 5,
|
||||
key: 'unipedia',
|
||||
},
|
||||
],
|
||||
field: 'categories',
|
||||
onlyOnType: SCThingType.Article,
|
||||
},
|
||||
{
|
||||
'buckets': [
|
||||
buckets: [
|
||||
{
|
||||
'count': 5,
|
||||
'key': 'employees',
|
||||
count: 5,
|
||||
key: 'employees',
|
||||
},
|
||||
{
|
||||
'count': 15,
|
||||
'key': 'students',
|
||||
}],
|
||||
'field': 'audiences',
|
||||
'onlyOnType': SCThingType.Message,
|
||||
count: 15,
|
||||
key: 'students',
|
||||
},
|
||||
],
|
||||
field: 'audiences',
|
||||
onlyOnType: SCThingType.Message,
|
||||
},
|
||||
{
|
||||
'buckets': [
|
||||
buckets: [
|
||||
{
|
||||
'count': 5,
|
||||
'key': 'main dish',
|
||||
count: 5,
|
||||
key: 'main dish',
|
||||
},
|
||||
{
|
||||
'count': 15,
|
||||
'key': 'salad',
|
||||
}],
|
||||
'field': 'categories',
|
||||
'onlyOnType': SCThingType.Dish,
|
||||
count: 15,
|
||||
key: 'salad',
|
||||
},
|
||||
],
|
||||
field: 'categories',
|
||||
onlyOnType: SCThingType.Dish,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -15,15 +15,29 @@
|
||||
import {HttpClient} from '@angular/common/http';
|
||||
import {Injectable} from '@angular/core';
|
||||
import {
|
||||
SCAcademicEvent, SCArticle, SCBook, SCBuilding, SCCatalog,
|
||||
SCDateSeries, SCDish, SCFavorite, SCMessage, SCPerson, SCRoom, SCSearchFilter,
|
||||
SCThing, SCThingOriginType, SCThingType, SCToDo, SCToDoPriority,
|
||||
SCAcademicEvent,
|
||||
SCArticle,
|
||||
SCBook,
|
||||
SCBuilding,
|
||||
SCCatalog,
|
||||
SCDateSeries,
|
||||
SCDish,
|
||||
SCFavorite,
|
||||
SCMessage,
|
||||
SCPerson,
|
||||
SCRoom,
|
||||
SCSearchFilter,
|
||||
SCThing,
|
||||
SCThingOriginType,
|
||||
SCThingType,
|
||||
SCToDo,
|
||||
SCToDoPriority,
|
||||
} from '@openstapps/core';
|
||||
import {Observable, of} from 'rxjs';
|
||||
import {checkFilter} from '../fakesearch/filters';
|
||||
import {sampleResources} from './resources/test-resources';
|
||||
|
||||
// tslint:disable:no-magic-numbers
|
||||
/* eslint-disable */
|
||||
const sampleMessages: SCMessage[] = [
|
||||
{
|
||||
audiences: ['students'],
|
||||
@@ -385,9 +399,9 @@ export class SampleThings {
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
// tslint:disable-next-line:prefer-function-over-method no-any
|
||||
// eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-explicit-any
|
||||
getSampleThing(uid: string): Observable<any[]> {
|
||||
// tslint:disable-next-line:no-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const sampleThings: any[] = [];
|
||||
for (const resource of sampleResources) {
|
||||
if (resource.instance.uid as SCThingType === uid) {
|
||||
@@ -403,12 +417,12 @@ export class SampleThings {
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
// tslint:disable-next-line:prefer-function-over-method no-any
|
||||
// eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-explicit-any
|
||||
getSampleThings(filter?: SCSearchFilter): Observable<any[]> {
|
||||
// tslint:disable-next-line:no-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const sampleThings: any[] = [];
|
||||
for (const resource of sampleResources) {
|
||||
// tslint:disable-next-line:max-line-length
|
||||
// eslint-disable-next-line max-len
|
||||
// if ([SCThingType.Video].includes(resource.instance.type as SCThingType)) {
|
||||
if (typeof filter === 'undefined' || checkFilter(resource.instance as SCThing, filter)) {
|
||||
sampleThings.push(resource.instance);
|
||||
|
||||
Reference in New Issue
Block a user