mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2026-03-23 18:59:14 +00:00
(linting) Migrated over to the ESLint
This commit is contained in:
@@ -74,7 +74,7 @@ export class AcademyMockApi
|
||||
const steps = cloneDeep(this._demoCourseSteps);
|
||||
|
||||
// Find the course and attach steps to it
|
||||
const course = courses.find((item) => item.id === id);
|
||||
const course = courses.find(item => item.id === id);
|
||||
if ( course )
|
||||
{
|
||||
course.steps = steps;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* tslint:disable:max-line-length */
|
||||
/* eslint-disable */
|
||||
export const categories = [
|
||||
{
|
||||
id : '9a67dff7-3c38-4052-a335-0cef93438ff6',
|
||||
|
||||
@@ -110,11 +110,11 @@ export class CalendarMockApi
|
||||
const id = request.params.get('id');
|
||||
|
||||
// Find the calendar and delete it
|
||||
const index = this._calendars.findIndex((calendar) => calendar.id === id);
|
||||
const index = this._calendars.findIndex(calendar => calendar.id === id);
|
||||
this._calendars.splice(index, 1);
|
||||
|
||||
// Find the events that belong to the calendar and remove them as well
|
||||
this._events = this._events.filter((event) => event.calendarId !== id);
|
||||
this._events = this._events.filter(event => event.calendarId !== id);
|
||||
|
||||
// Return the response
|
||||
return [200, true];
|
||||
@@ -287,7 +287,7 @@ export class CalendarMockApi
|
||||
const id = request.params.get('id');
|
||||
|
||||
// Find the event and delete it
|
||||
const index = this._events.findIndex((item) => item.id === id);
|
||||
const index = this._events.findIndex(item => item.id === id);
|
||||
this._events.splice(index, 1);
|
||||
|
||||
// Return the response
|
||||
@@ -307,7 +307,7 @@ export class CalendarMockApi
|
||||
const mode = request.body.mode;
|
||||
|
||||
// Find the original recurring event from db
|
||||
const recurringEvent = this._events.find((item) => item.id === event.recurringEventId);
|
||||
const recurringEvent = this._events.find(item => item.id === event.recurringEventId);
|
||||
|
||||
// Single
|
||||
if ( mode === 'single' )
|
||||
@@ -406,7 +406,7 @@ export class CalendarMockApi
|
||||
if ( mode === 'all' )
|
||||
{
|
||||
// Find the event index
|
||||
const eventIndex = this._events.findIndex((item) => item.id === event.recurringEventId);
|
||||
const eventIndex = this._events.findIndex(item => item.id === event.recurringEventId);
|
||||
|
||||
// Update the recurring event
|
||||
this._events[eventIndex] = assign({}, this._events[eventIndex], omit(event, ['id', 'recurringEventId', 'range']));
|
||||
@@ -428,7 +428,7 @@ export class CalendarMockApi
|
||||
const mode = request.params.get('mode');
|
||||
|
||||
// Find the recurring event
|
||||
const recurringEvent = this._events.find((item) => item.id === event.recurringEventId);
|
||||
const recurringEvent = this._events.find(item => item.id === event.recurringEventId);
|
||||
|
||||
// Single
|
||||
if ( mode === 'single' )
|
||||
@@ -495,7 +495,7 @@ export class CalendarMockApi
|
||||
if ( mode === 'all' )
|
||||
{
|
||||
// Find the event and delete it
|
||||
const index = this._events.findIndex((item) => item.id === event.recurringEventId);
|
||||
const index = this._events.findIndex(item => item.id === event.recurringEventId);
|
||||
this._events.splice(index, 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable */
|
||||
import * as moment from 'moment';
|
||||
|
||||
/* tslint:disable:max-line-length */
|
||||
export const calendars = [
|
||||
{
|
||||
id : '1a470c8e-40ed-4c2d-b590-a4f1f6ead6cc',
|
||||
|
||||
@@ -22,12 +22,12 @@ export class ChatMockApi
|
||||
this.registerHandlers();
|
||||
|
||||
// Modify the chats array to attach certain data to it
|
||||
this._chats = this._chats.map((chat) => ({
|
||||
this._chats = this._chats.map(chat => ({
|
||||
...chat,
|
||||
// Get the actual contact object from the id and attach it to the chat
|
||||
contact: this._contacts.find((contact) => contact.id === chat.contactId),
|
||||
contact: this._contacts.find(contact => contact.id === chat.contactId),
|
||||
// Since we use same set of messages on all chats, we assign them here.
|
||||
messages: this._messages.map((message) => ({
|
||||
messages: this._messages.map(message => ({
|
||||
...message,
|
||||
chatId : chat.id,
|
||||
contactId: message.contactId === 'me' ? this._profile.id : chat.contactId,
|
||||
@@ -73,7 +73,7 @@ export class ChatMockApi
|
||||
const chats = cloneDeep(this._chats);
|
||||
|
||||
// Find the chat we need
|
||||
const chat = chats.find((item) => item.id === id);
|
||||
const chat = chats.find(item => item.id === id);
|
||||
|
||||
// Return the response
|
||||
return [200, chat];
|
||||
@@ -124,7 +124,7 @@ export class ChatMockApi
|
||||
contacts.sort((a, b) => a.name.localeCompare(b.name));
|
||||
|
||||
// Omit details and attachments from contacts
|
||||
contacts = contacts.map((contact) => omit(contact, ['details', 'attachments']));
|
||||
contacts = contacts.map(contact => omit(contact, ['details', 'attachments']));
|
||||
|
||||
// Return the response
|
||||
return [200, contacts];
|
||||
@@ -144,7 +144,7 @@ export class ChatMockApi
|
||||
const contacts = cloneDeep(this._contacts);
|
||||
|
||||
// Find the contact
|
||||
const contact = contacts.find((item) => item.id === id);
|
||||
const contact = contacts.find(item => item.id === id);
|
||||
|
||||
// Return the response
|
||||
return [200, contact];
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -66,7 +66,7 @@ export class ContactsMockApi
|
||||
if ( query )
|
||||
{
|
||||
// Filter the contacts
|
||||
contacts = contacts.filter((contact) => contact.name && contact.name.toLowerCase().includes(query.toLowerCase()));
|
||||
contacts = contacts.filter(contact => contact.name && contact.name.toLowerCase().includes(query.toLowerCase()));
|
||||
}
|
||||
|
||||
// Sort the contacts by the name field by default
|
||||
@@ -90,9 +90,7 @@ export class ContactsMockApi
|
||||
const contacts = cloneDeep(this._contacts);
|
||||
|
||||
// Find the contact
|
||||
const contact = contacts.find((item) => {
|
||||
return item.id === id;
|
||||
});
|
||||
const contact = contacts.find(item => item.id === id);
|
||||
|
||||
// Return the response
|
||||
return [200, contact];
|
||||
@@ -288,10 +286,10 @@ export class ContactsMockApi
|
||||
*
|
||||
* @param file
|
||||
*/
|
||||
const readAsDataURL = (file: File): Promise<any> => {
|
||||
const readAsDataURL = (file: File): Promise<any> =>
|
||||
|
||||
// Return a new promise
|
||||
return new Promise((resolve, reject) => {
|
||||
new Promise((resolve, reject) => {
|
||||
|
||||
// Create a new reader
|
||||
const reader = new FileReader();
|
||||
@@ -308,8 +306,8 @@ export class ContactsMockApi
|
||||
|
||||
// Read the file as the
|
||||
reader.readAsDataURL(file);
|
||||
});
|
||||
};
|
||||
})
|
||||
;
|
||||
|
||||
this._fuseMockApiService
|
||||
.onPost('api/apps/contacts/avatar')
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -81,9 +81,7 @@ export class ECommerceInventoryMockApi
|
||||
if ( search )
|
||||
{
|
||||
// Filter the products
|
||||
products = products.filter((contact) => {
|
||||
return contact.name && contact.name.toLowerCase().includes(search.toLowerCase());
|
||||
});
|
||||
products = products.filter(contact => contact.name && contact.name.toLowerCase().includes(search.toLowerCase()));
|
||||
}
|
||||
|
||||
// Paginate - Start
|
||||
@@ -148,9 +146,7 @@ export class ECommerceInventoryMockApi
|
||||
const products = cloneDeep(this._products);
|
||||
|
||||
// Find the product
|
||||
const product = products.find((item) => {
|
||||
return item.id === id;
|
||||
});
|
||||
const product = products.find(item => item.id === id);
|
||||
|
||||
// Return the response
|
||||
return [200, product];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* tslint:disable:max-line-length */
|
||||
/* eslint-disable */
|
||||
export const categories = [
|
||||
{
|
||||
id : 'b899ec30-b85a-40ab-bb1f-18a596d5c6de',
|
||||
|
||||
@@ -39,8 +39,8 @@ export class FileManagerMockApi
|
||||
const items = cloneDeep(this._items);
|
||||
|
||||
// Separate the items by folders and files
|
||||
const folders = items.filter((item) => item.type === 'folder');
|
||||
const files = items.filter((item) => item.type !== 'folder');
|
||||
const folders = items.filter(item => item.type === 'folder');
|
||||
const files = items.filter(item => item.type !== 'folder');
|
||||
|
||||
// Sort the folders and files alphabetically by filename
|
||||
folders.sort((a, b) => a.name.localeCompare(b.name));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* tslint:disable:max-line-length */
|
||||
/* eslint-disable */
|
||||
export const items = [
|
||||
{
|
||||
id : 'cd6897cb-acfd-4016-8b53-3f66a5b5fc68',
|
||||
@@ -175,5 +175,5 @@ export const items = [
|
||||
type : 'XLS',
|
||||
contents : null,
|
||||
description: null
|
||||
},
|
||||
}
|
||||
];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* tslint:disable:max-line-length */
|
||||
/* eslint-disable */
|
||||
export const faqCategories = [
|
||||
{
|
||||
id : '28924eab-97cc-465a-ba21-f232bb95843f',
|
||||
|
||||
@@ -69,7 +69,7 @@ export class MailboxMockApi
|
||||
this._folders.forEach((folder) => {
|
||||
|
||||
// Get the mails of this folder
|
||||
const mails = this._mails.filter((mail) => mail.folder === folder.id);
|
||||
const mails = this._mails.filter(mail => mail.folder === folder.id);
|
||||
|
||||
// If we are counting the 'sent' or the 'trash' folder...
|
||||
if ( folder.slug === 'sent' || folder.slug === 'trash' )
|
||||
@@ -148,9 +148,7 @@ export class MailboxMockApi
|
||||
|
||||
do
|
||||
{
|
||||
sameSlug = this._labels.filter((item) => {
|
||||
return item.slug === label.slug;
|
||||
});
|
||||
sameSlug = this._labels.filter(item => item.slug === label.slug);
|
||||
|
||||
if ( sameSlug.length > 0 )
|
||||
{
|
||||
@@ -215,13 +213,11 @@ export class MailboxMockApi
|
||||
const id = request.params.get('id');
|
||||
|
||||
// Find the label and delete it
|
||||
const index = this._labels.findIndex((item) => item.id === id);
|
||||
const index = this._labels.findIndex(item => item.id === id);
|
||||
this._labels.splice(index, 1);
|
||||
|
||||
// Get all the mails that have the label
|
||||
const mailsWithLabel = this._mails.filter((mail) => {
|
||||
return mail.labels.indexOf(id) > -1;
|
||||
});
|
||||
const mailsWithLabel = this._mails.filter(mail => mail.labels.indexOf(id) > -1);
|
||||
|
||||
// Iterate through them and remove the label
|
||||
mailsWithLabel.forEach((mail) => {
|
||||
@@ -267,9 +263,7 @@ export class MailboxMockApi
|
||||
});
|
||||
|
||||
// Sort by date - descending
|
||||
mails.sort((a, b) => {
|
||||
return new Date(b.date).getTime() - new Date(a.date).getTime();
|
||||
});
|
||||
mails.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime());
|
||||
|
||||
// Figure out the cc and bcc counts
|
||||
mails.forEach((mail) => {
|
||||
@@ -343,7 +337,7 @@ export class MailboxMockApi
|
||||
const mails = cloneDeep(this._mails);
|
||||
|
||||
// Find the mail
|
||||
const mail = mails.find((item) => item.id === id);
|
||||
const mail = mails.find(item => item.id === id);
|
||||
|
||||
return [
|
||||
200,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable */
|
||||
import * as moment from 'moment';
|
||||
|
||||
/* tslint:disable:max-line-length */
|
||||
export const folders = [
|
||||
{
|
||||
id : '7c004a19-4506-48ef-93ab-f16381302e3b',
|
||||
|
||||
@@ -35,13 +35,10 @@ export class NotesMockApi
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
this._fuseMockApiService
|
||||
.onGet('api/apps/notes/labels')
|
||||
.reply(() => {
|
||||
|
||||
return [
|
||||
200,
|
||||
cloneDeep(this._labels)
|
||||
];
|
||||
});
|
||||
.reply(() => [
|
||||
200,
|
||||
cloneDeep(this._labels)
|
||||
]);
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Labels - POST
|
||||
@@ -105,12 +102,12 @@ export class NotesMockApi
|
||||
const id = request.params.get('id');
|
||||
|
||||
// Delete the label
|
||||
this._labels = this._labels.filter((label) => label.id !== id);
|
||||
this._labels = this._labels.filter(label => label.id !== id);
|
||||
|
||||
// Go through notes and delete the label
|
||||
this._notes = this._notes.map((note) => ({
|
||||
this._notes = this._notes.map(note => ({
|
||||
...note,
|
||||
labels: note.labels.filter((item) => item !== id)
|
||||
labels: note.labels.filter(item => item !== id)
|
||||
}));
|
||||
|
||||
return [
|
||||
@@ -175,10 +172,10 @@ export class NotesMockApi
|
||||
let notes = cloneDeep(this._notes);
|
||||
|
||||
// Attach the labels to the notes
|
||||
notes = notes.map((note) => (
|
||||
notes = notes.map(note => (
|
||||
{
|
||||
...note,
|
||||
labels: note.labels.map((labelId) => labels.find((label) => label.id === labelId))
|
||||
labels: note.labels.map(labelId => labels.find(label => label.id === labelId))
|
||||
}
|
||||
));
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* tslint:disable:max-line-length */
|
||||
/* eslint-disable */
|
||||
import moment from 'moment';
|
||||
|
||||
export const labels = [
|
||||
|
||||
@@ -35,13 +35,10 @@ export class TasksMockApi
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
this._fuseMockApiService
|
||||
.onGet('api/apps/tasks/tags')
|
||||
.reply(() => {
|
||||
|
||||
return [
|
||||
200,
|
||||
cloneDeep(this._tags)
|
||||
];
|
||||
});
|
||||
.reply(() => [
|
||||
200,
|
||||
cloneDeep(this._tags)
|
||||
]);
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
// @ Tags - POST
|
||||
@@ -109,7 +106,7 @@ export class TasksMockApi
|
||||
const id = request.params.get('id');
|
||||
|
||||
// Find the tag and delete it
|
||||
const index = this._tags.findIndex((item) => item.id === id);
|
||||
const index = this._tags.findIndex(item => item.id === id);
|
||||
this._tags.splice(index, 1);
|
||||
|
||||
// Get the tasks that have the tag
|
||||
@@ -165,9 +162,8 @@ export class TasksMockApi
|
||||
let tasks = cloneDeep(this._tasks);
|
||||
|
||||
// Filter the tasks
|
||||
tasks = tasks.filter((task) => {
|
||||
return task.title && task.title.toLowerCase().includes(query.toLowerCase()) || task.notes && task.notes.toLowerCase().includes(query.toLowerCase());
|
||||
});
|
||||
tasks = tasks.filter(task => task.title && task.title.toLowerCase().includes(query.toLowerCase()) || task.notes && task.notes.toLowerCase()
|
||||
.includes(query.toLowerCase()));
|
||||
|
||||
// Mark the found chars
|
||||
tasks.forEach((task) => {
|
||||
@@ -231,7 +227,7 @@ export class TasksMockApi
|
||||
const tasks = cloneDeep(this._tasks);
|
||||
|
||||
// Find the task
|
||||
const task = tasks.find((item) => item.id === id);
|
||||
const task = tasks.find(item => item.id === id);
|
||||
|
||||
return [
|
||||
200,
|
||||
@@ -317,7 +313,7 @@ export class TasksMockApi
|
||||
const id = request.params.get('id');
|
||||
|
||||
// Find the task and delete it
|
||||
const index = this._tasks.findIndex((item) => item.id === id);
|
||||
const index = this._tasks.findIndex(item => item.id === id);
|
||||
this._tasks.splice(index, 1);
|
||||
|
||||
return [
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* tslint:disable:max-line-length */
|
||||
/* eslint-disable */
|
||||
export const tags = [
|
||||
{
|
||||
id : 'a0bf42ca-c3a5-47be-8341-b9c0bb8ef270',
|
||||
|
||||
Reference in New Issue
Block a user