Skip to content

Commit

Permalink
fix(app-crm): remove operation (#4869)
Browse files Browse the repository at this point in the history
  • Loading branch information
alicanerdurmaz authored Aug 28, 2023
1 parent 787a110 commit ba7c974
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 122 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export const DashboardLatestActivities: React.FC<{ limit?: number }> = ({
},
],
meta: {
operation: "audits",
fields: [
"id",
"action",
Expand Down
3 changes: 0 additions & 3 deletions examples/app-crm/src/components/kanban/comment-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ export const CommentForm = () => {
queryOptions: {
enabled: false,
},
meta: {
operation: "taskComment",
},
redirect: false,
mutationMode: "optimistic",
onMutationSuccess: () => {
Expand Down
4 changes: 2 additions & 2 deletions examples/app-crm/src/components/kanban/comment-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const CommentListItem = ({ item }: { item: TaskComment }) => {
HttpError,
TaskComment
>({
resource: "taskComment",
resource: "taskComments",
action: "edit",
queryOptions: {
enabled: false,
Expand Down Expand Up @@ -109,7 +109,7 @@ const CommentListItem = ({ item }: { item: TaskComment }) => {
</Typography.Link>
<DeleteButton
recordItemId={item.id}
meta={{ operation: "taskComment" }}
resource="taskComments"
size="small"
type="link"
icon={null}
Expand Down
5 changes: 2 additions & 3 deletions examples/app-crm/src/providers/resources.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const resources: IResourceItem[] = [
},
},
{
name: "stages",
name: "taskStages",
create: "/scrumboard/kanban/stages/create",
edit: "/scrumboard/kanban/stages/edit/:id",
list: "/scrumboard/kanban",
Expand All @@ -68,8 +68,7 @@ export const resources: IResourceItem[] = [
},
},
{
name: "stages",
identifier: "deal-stages",
name: "dealStages",
create: "/scrumboard/sales/stages/create",
edit: "/scrumboard/sales/stages/edit/:id",
list: "/scrumboard/sales",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export const KanbanCreateStage = () => {
const { formProps, modalProps, close } = useModalForm({
action: "create",
defaultVisible: true,
resource: "taskStages",
meta: {
operation: "taskStage",
fields: ["id"],
},
onMutationSuccess: () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export const KanbanEditStage = () => {
const { formProps, modalProps, close } = useModalForm({
action: "edit",
defaultVisible: true,
resource: "taskStages",
meta: {
operation: "taskStage",
fields: ["id", "title"],
},
onMutationSuccess: () => {
Expand Down
9 changes: 2 additions & 7 deletions examples/app-crm/src/routes/scrumboard/kanban/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,11 @@ export const KanbanPage: FC<PropsWithChildren> = ({ children }) => {
const navigate = useNavigate();

const { data: stages, isLoading: isLoadingStages } = useList<TaskStage>({
resource: "tasks",
resource: "taskStages",
pagination: {
mode: "off",
},
meta: {
operation: "taskStages",
fields: ["id", "title"],
},
});
Expand All @@ -67,7 +66,6 @@ export const KanbanPage: FC<PropsWithChildren> = ({ children }) => {
mode: "off",
},
meta: {
operation: "tasks",
fields: taskFragment,
},
});
Expand Down Expand Up @@ -146,10 +144,7 @@ export const KanbanPage: FC<PropsWithChildren> = ({ children }) => {

const handleDeleteStage = (args: { stageId: string }) => {
deleteStage({
resource: "tasks",
meta: {
operation: "taskStage",
},
resource: "taskStage",
id: args.stageId,
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export const SalesCreateStage = () => {
const { formProps, modalProps, close } = useModalForm({
action: "create",
defaultVisible: true,
resource: "dealStages",
meta: {
operation: "dealStage",
fields: ["id"],
},
onMutationSuccess: () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export const SalesEditStage = () => {
const { formProps, modalProps, close } = useModalForm({
action: "edit",
defaultVisible: true,
resource: "dealStages",
meta: {
operation: "dealStage",
fields: ["id", "title"],
},
onMutationSuccess: () => {
Expand Down
9 changes: 3 additions & 6 deletions examples/app-crm/src/routes/scrumboard/sales/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ export const SalesPage: FC<PropsWithChildren> = ({ children }) => {
const navigate = useNavigate();

const { data: stages, isLoading: isLoadingStages } = useList<DealStage>({
resource: "dealStages",
pagination: {
mode: "off",
},
meta: {
operation: "dealStages",
fields: [
"id",
"title",
Expand All @@ -59,6 +59,7 @@ export const SalesPage: FC<PropsWithChildren> = ({ children }) => {
});

const { data: deals, isLoading: isLoadingDeals } = useList<Deal>({
resource: "deals",
sorters: [
{
field: "createdAt",
Expand All @@ -72,7 +73,6 @@ export const SalesPage: FC<PropsWithChildren> = ({ children }) => {
mode: "off",
},
meta: {
operation: "deals",
fields: dealsFragment,
},
});
Expand Down Expand Up @@ -199,10 +199,7 @@ export const SalesPage: FC<PropsWithChildren> = ({ children }) => {

const handleDeleteStage = (args: { stageId: string }) => {
deleteStage({
resource: "deals",
meta: {
operation: "dealStage",
},
resource: "dealStage",
id: args.stageId,
});
};
Expand Down
Loading

0 comments on commit ba7c974

Please sign in to comment.