Skip to content

Commit

Permalink
Merge pull request #686 from erxes/fix-tslint-variable-name
Browse files Browse the repository at this point in the history
Fixed console warning of tslint variable-name
  • Loading branch information
batamar authored Oct 16, 2018
2 parents 5ce57ce + 0b77118 commit 1332bc5
Show file tree
Hide file tree
Showing 56 changed files with 104 additions and 96 deletions.
2 changes: 1 addition & 1 deletion src/modules/common/components/step/Step.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Props = {
img?: string;
title?: string;
children?: React.ReactNode;
next?: (number: number) => void;
next?: (stepNumber: number) => void;
nextButton?: React.ReactNode;
save?: (name: string, e: React.MouseEvent) => void;
message?: any;
Expand Down
2 changes: 1 addition & 1 deletion src/modules/deals/components/editForm/EditForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type Props = {
users: IUser[];
addDeal: (doc: IDealParams, callback: () => void) => void;
saveDeal: (doc: IDealParams, callback: () => void) => void;
removeDeal: (_id: string, callback: () => void) => void;
removeDeal: (dealId: string, callback: () => void) => void;
closeModal: () => void;
};

Expand Down
2 changes: 1 addition & 1 deletion src/modules/deals/components/editForm/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type Props = {
value: any
) => void;
copyDeal: () => void;
removeDeal: (_id: string) => void;
removeDeal: (dealId: string) => void;
saveProductsData: () => void;
};

Expand Down
2 changes: 1 addition & 1 deletion src/modules/deals/components/portable/Deal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { IDeal } from '../../types';
type Props = {
deal: IDeal;
onAdd: (stageId: string, deal: IDeal) => void;
onRemove: (_id: string, stageId: string) => void;
onRemove: (dealId: string, stageId: string) => void;
onUpdate: (deal: IDeal) => void;
};

Expand Down
4 changes: 2 additions & 2 deletions src/modules/deals/components/product/ProductForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ class ProductForm extends React.Component<Props, State> {
onChangeProductsData(productsData);
}

removeProductItem(_id) {
removeProductItem(productId) {
const { productsData, onChangeProductsData } = this.props;

const removedProductsData = productsData.filter(p => p._id !== _id);
const removedProductsData = productsData.filter(p => p._id !== productId);

onChangeProductsData(removedProductsData);

Expand Down
6 changes: 3 additions & 3 deletions src/modules/deals/components/product/ProductItemForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Props = {
currencies: string[];
productsData?: IProductData[];
productData: IProductData;
removeProductItem?: (_id: string) => void;
removeProductItem?: (productId: string) => void;
onChangeProductsData?: (productsData: IProductData[]) => void;
updateTotal?: () => void;
};
Expand Down Expand Up @@ -70,11 +70,11 @@ class ProductItemForm extends React.Component<Props> {
}
}

onChangeField(type, value, _id) {
onChangeField(type, value, productId) {
const { productsData, onChangeProductsData } = this.props;

if (productsData) {
const productData = productsData.find(p => p._id === _id);
const productData = productsData.find(p => p._id === productId);
if (productData) {
productData[type] = value;
}
Expand Down
2 changes: 1 addition & 1 deletion src/modules/deals/components/stage/DealItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type Props = {
isDragging: boolean;
provided;
onAdd: (stageId: string, deal: IDeal) => void;
onRemove: (_id: string, stageId: string) => void;
onRemove: (dealId: string, stageId: string) => void;
onUpdate: (deal: IDeal) => void;
};

Expand Down
6 changes: 3 additions & 3 deletions src/modules/deals/containers/PipelineContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface IStore {
stageIds: string[];
onDragEnd: (result: IDragResult) => void;
onAddDeal: (stageId: string, deal: IDeal) => void;
onRemoveDeal: (_id: string, stageId: string) => void;
onRemoveDeal: (dealId: string, stageId: string) => void;
onUpdateDeal: (deal: IDeal, prevStageId?: string) => void;
}

Expand Down Expand Up @@ -129,10 +129,10 @@ export class PipelineProvider extends React.Component<Props, State> {
});
};

onRemoveDeal = (_id: string, stageId: string) => {
onRemoveDeal = (dealId: string, stageId: string) => {
const { dealMap } = this.state;

const deals = dealMap[stageId].filter(deal => deal._id !== _id);
const deals = dealMap[stageId].filter(deal => deal._id !== dealId);

this.setState({
dealMap: { ...dealMap, [stageId]: deals }
Expand Down
8 changes: 4 additions & 4 deletions src/modules/deals/containers/editForm/EditForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type Props = {
editMutation: SaveDealMutation;
removeMutation: RemoveDealMutation;
onAdd?: (stageId: string, deal: IDeal) => void;
onRemove?: (_id: string, stageId: string) => void;
onRemove?: (dealId: string, stageId: string) => void;
onUpdate?: (deal: IDeal, prevStageId: string) => void;
closeModal: () => void;
};
Expand Down Expand Up @@ -72,16 +72,16 @@ class EditFormContainer extends React.Component<Props> {
});
}

removeDeal(_id: string, callback) {
removeDeal(dealId: string, callback) {
const { removeMutation, onRemove, stageId } = this.props;

confirm().then(() =>
removeMutation({ variables: { _id } })
removeMutation({ variables: { _id: dealId } })
.then(() => {
callback();

if (onRemove) {
onRemove(_id, stageId);
onRemove(dealId, stageId);
}
})

Expand Down
12 changes: 6 additions & 6 deletions src/modules/deals/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { IDeal } from './types';
type StagesWithDeals = IStage & { deals: IDeal[] };

const dealFactory = (pipeline: IPipeline, stage: IStage): IDeal => {
const _id = Math.random().toString();
const id = Math.random().toString();

return {
_id,
_id: id,
order: 1,
stageId: stage._id,
assignedUsers: [],
Expand All @@ -18,19 +18,19 @@ const dealFactory = (pipeline: IPipeline, stage: IStage): IDeal => {
pipeline,
products: [],
amount: 10000,
name: `Deal_${_id}`
name: `Deal_${id}`
};
};

const stageFactory = (
pipeline: IPipeline,
dealCount: number
): StagesWithDeals => {
const _id = Math.random().toString();
const id = Math.random().toString();

const stage: IStage = {
_id,
name: `Stage_${_id}`,
_id: id,
name: `Stage_${id}`,
pipelineId: pipeline._id
};

Expand Down
9 changes: 6 additions & 3 deletions src/modules/deals/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,11 @@ export interface IStageMap {
}

export type SaveDealMutation = ({ variables: IDealParams }) => Promise<any>;

interface IRemoveDealVariables {
_id: string;
}

export type RemoveDealMutation = (
{
variables: { _id: string }
}
{ variables: IRemoveDealVariables }
) => Promise<any>;
4 changes: 2 additions & 2 deletions src/modules/engage/components/Scheduler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ class Scheduler extends React.Component<Props, State> {
this.props.onChange('scheduleDate', scheduleDate);
}

generateOptions(number) {
generateOptions(length) {
const options: React.ReactNode[] = [];

for (let i = 1; i <= number; i++) {
for (let i = 1; i <= length; i++) {
options.push(
<option key={i} value={i}>
{i}
Expand Down
2 changes: 1 addition & 1 deletion src/modules/engage/containers/MessageListRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { IEngageMessage } from '../types';
import { crudMutationsOptions } from '../utils';

type Props = {
removeMutation: (_id: string) => Promise<void>;
removeMutation: (engageId: string) => Promise<void>;
setPauseMutation: (params: { vairables: { _id: string } }) => Promise<void>;
setLiveMutation: (params: { vairables: { _id: string } }) => Promise<void>;
setLiveManualMutation: (
Expand Down
2 changes: 1 addition & 1 deletion src/modules/forms/components/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type Props = {
toggleBulk: (target: IFormIntegration, toAdd: boolean) => void;
toggleAll: (bulk: IFormIntegration[], name: string) => void;
loading: boolean;
remove: (_id: string, callback: (error: Error) => void) => void;
remove: (integrationId: string, callback: (error: Error) => void) => void;
};

class List extends React.Component<Props, {}> {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/forms/components/Row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Props = {
integration: IFormIntegration;

toggleBulk: (integration: IFormIntegration, checked: boolean) => void;
remove: (_id: string, callback: (error: Error) => void) => void;
remove: (integrationId: string, callback: (error: Error) => void) => void;

isChecked: boolean;
};
Expand Down
4 changes: 2 additions & 2 deletions src/modules/forms/containers/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ class ListContainer extends React.Component<Props, {}> {

const integrations = integrationsQuery.integrations || [];

const remove = (_id: string, callback: (error?: any) => void) => {
const remove = (integrationId: string, callback: (error?: any) => void) => {
removeMutation({
variables: { _id }
variables: { _id: integrationId }
}).then(() => {
// refresh queries
integrationsQuery.refetch();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type Props = {
queryParams: any;
currentCategoryId: string;
topicIds: string;
remove: (_id: string) => void;
remove: (articleId: string) => void;
loading: boolean;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type Props = {
queryParams: any;
currentCategoryId: string;
topicIds: string;
remove: (_id: string) => void;
remove: (articleId: string) => void;
};

class ArticleRow extends React.Component<Props> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type Props = {
topicIds: string;
categories: ICategory[];
articlesCount: number;
remove: (_id: string) => void;
remove: (categoryId: string) => void;
};

class CategoryList extends React.Component<Props> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type Props = {
topicIds: string;
category: ICategory;
articlesCount: number;
remove: (_id: string) => void;
remove: (categoryId: string) => void;
isActive: boolean;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type Props = {
callback: () => void,
topic: ITopic
) => void;
remove?: (_id: string) => void;
remove?: (knowledgeBaseId: string) => void;
closeModal: () => void;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type Props = {
callback: () => void,
object: any
) => void;
remove: (_id: string) => void;
remove: (knowledgeBaseId: string) => void;
};

class KnowledgeList extends React.Component<Props> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type Props = {
currentCategoryId: string;
topic: ITopic;
articlesCount: number;
remove: (_id: string) => void;
remove: (knowledgeBaseId: string) => void;

save: (
params: {
Expand Down
4 changes: 2 additions & 2 deletions src/modules/knowledgeBase/containers/article/ArticleList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ const ArticleContainer = (props: Props) => {
} = props;

// remove action
const remove = _id => {
const remove = articleId => {
confirm().then(() => {
removeArticlesMutation({
variables: { _id }
variables: { _id: articleId }
})
.then(() => {
articlesQuery.refetch();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ const KnowledgeBaseContainer = (props: Props) => {
} = props;

// remove action
const remove = _id => {
const remove = categoryId => {
confirm().then(() => {
removeCategoriesMutation({
variables: { _id }
variables: { _id: categoryId }
})
.then(() => {
categoriesQuery.refetch();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ const KnowledgeBaseContainer = (props: Props) => {
} = props;

// remove action
const remove = _id => {
const remove = topicId => {
confirm().then(() => {
removeTopicsMutation({
variables: { _id }
variables: { _id: topicId }
})
.then(() => {
topicsQuery.refetch();
Expand Down
2 changes: 1 addition & 1 deletion src/modules/notifications/components/NotificationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { NotifList } from './styles';

type Props = {
notifications: INotification[];
markAsRead: (_ids?: string[]) => void;
markAsRead: (notificationIds?: string[]) => void;
count: number;
};

Expand Down
2 changes: 1 addition & 1 deletion src/modules/notifications/components/NotificationRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { INotification } from '../types';

interface IProps extends IRouterProps {
notification: INotification;
markAsRead: (_ids?: string[]) => void;
markAsRead: (notificationIds?: string[]) => void;
createdUser?: IUser;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {

type Props = {
notifications: INotification[];
markAsRead: (_ids?: string[]) => void;
markAsRead: (notificationIds?: string[]) => void;
update?: () => void;
};

Expand Down
6 changes: 4 additions & 2 deletions src/modules/notifications/containers/NotificationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ class NotificationListContainer extends React.Component<Props> {
notificationsMarkAsReadMutation
} = this.props;

const markAsRead = (_ids?: string[]) => {
notificationsMarkAsReadMutation({ variables: { _ids: _ids || [] } })
const markAsRead = (notificationIds?: string[]) => {
notificationsMarkAsReadMutation({
variables: { _ids: notificationIds || [] }
})
.then(() => {
notificationsQuery.refetch();
Alert.success('Notification have been seen');
Expand Down
4 changes: 2 additions & 2 deletions src/modules/notifications/containers/NotificationsLatest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class NotificationsLatestContainer extends React.Component<Props> {
return <Spinner objective={true} />;
}

const markAsRead = _ids => {
notificationsMarkAsReadMutation({ variables: { _ids } })
const markAsRead = notificationIds => {
notificationsMarkAsReadMutation({ variables: { _ids: notificationIds } })
.then(() => {
notificationsQuery.refetch();
Alert.success('Notification have been seen');
Expand Down
2 changes: 1 addition & 1 deletion src/modules/segments/components/Filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { ISegment } from '../types';

type Props = {
currentSegment?: string;
setSegment: (_id: string) => void;
setSegment: (segmentId: string) => void;
removeSegment: () => void;
contentType?: string;
counts?: any;
Expand Down
Loading

0 comments on commit 1332bc5

Please sign in to comment.