-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: remove usage of useCaluma in route
- Loading branch information
Showing
23 changed files
with
229 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
import Controller from "@ember/controller"; | ||
import getCaseQuery from "caluma-portal-demo/gql/queries/get-case"; | ||
import { queryManager } from "ember-apollo-client"; | ||
import { dropTask, lastValue } from "ember-concurrency"; | ||
|
||
export default class CasesDetailController extends Controller { | ||
get case() { | ||
return this.model.value[0]; | ||
@queryManager apollo; | ||
|
||
@lastValue("getCase") case; | ||
@dropTask | ||
*getCase() { | ||
return (yield this.apollo.query( | ||
{ | ||
query: getCaseQuery, | ||
variables: { filter: [{ id: this.model }] }, | ||
}, | ||
"allCases.edges" | ||
)).map(({ node }) => node)[0]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
import Controller from "@ember/controller"; | ||
import Controller, { inject as controller } from "@ember/controller"; | ||
|
||
export default class CasesDetailEditController extends Controller { | ||
get case() { | ||
return this.model.value[0]; | ||
} | ||
@controller("cases.detail") parent; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
import CasesDetailRoute from "caluma-portal-demo/cases/detail/index/route"; | ||
|
||
export default class CasesDetailEditRoute extends CasesDetailRoute { | ||
model() { | ||
return this.modelFor("cases.detail"); | ||
} | ||
} | ||
export default class CasesDetailEditRoute extends CasesDetailRoute {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{{#if @model}} | ||
<CfContent @documentId={{this.case.document.id}} /> | ||
{{#if this.parent.case}} | ||
<CfContent @documentId={{this.parent.case.document.id}} /> | ||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
import Route from "@ember/routing/route"; | ||
|
||
export default class CasesDetailRoute extends Route { | ||
model() { | ||
return this.modelFor("cases.detail"); | ||
} | ||
} | ||
export default class CasesDetailRoute extends Route {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
import Route from "@ember/routing/route"; | ||
import { useCalumaQuery } from "@projectcaluma/ember-core/caluma-query"; | ||
import { allCases } from "@projectcaluma/ember-core/caluma-query/queries"; | ||
|
||
export default class CasesDetailRoute extends Route { | ||
model({ case_id }) { | ||
const caseQuery = useCalumaQuery(this, allCases, () => ({ | ||
options: { pageSize: 1 }, | ||
filter: [{ id: case_id }], | ||
})); | ||
return case_id; | ||
} | ||
|
||
return caseQuery; | ||
setupController(controller, post) { | ||
super.setupController(controller, post); | ||
controller.getCase.perform(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import Controller from "@ember/controller"; | ||
import getWorkItemQuery from "caluma-portal-demo/gql/queries/get-work-item"; | ||
import { queryManager } from "ember-apollo-client"; | ||
import { dropTask, lastValue } from "ember-concurrency"; | ||
|
||
export default class CasesDetailWorkItemsEditController extends Controller { | ||
@queryManager apollo; | ||
|
||
@lastValue("getWorkItem") workItem; | ||
@dropTask | ||
*getWorkItem() { | ||
return (yield this.apollo.query( | ||
{ | ||
query: getWorkItemQuery, | ||
variables: { filter: [{ id: this.model }] }, | ||
}, | ||
"allWorkItems.edges" | ||
)).map(({ node }) => node)[0]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
import Route from "@ember/routing/route"; | ||
|
||
export default class CasesDetailWorkItemsEditFormRoute extends Route { | ||
model() { | ||
return this.modelFor("cases.detail.work-items.edit"); | ||
} | ||
} | ||
export default class CasesDetailWorkItemsEditFormRoute extends Route {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
<h3>{{this.workItem.name}}</h3> | ||
<h3>{{this.parent.workItem.name}}</h3> | ||
|
||
{{#if @model.isLoading}} | ||
{{#if this.parent.getWorkItem.isRunning}} | ||
<div class="uk-text-center uk-padding"> | ||
<UkSpinner @ratio={{2}} /> | ||
</div> | ||
{{else}} | ||
<CfContent @documentId={{this.workItem.document.id}} | ||
<CfContent @documentId={{this.parent.workItem.document.id}} | ||
@context={{hash | ||
actionButtonOnSuccess=this.actionButtonOnSuccess | ||
}} | ||
@disabled={{not this.workItem.isReady}} | ||
@disabled={{not (eq this.parent.workItem.status "READY")}} | ||
/> | ||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
import Route from "@ember/routing/route"; | ||
|
||
export default class CasesDetailWorkItemsEditRoute extends Route { | ||
model() { | ||
return this.modelFor("cases.detail.work-items.edit"); | ||
} | ||
} | ||
export default class CasesDetailWorkItemsEditRoute extends Route {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
import Route from "@ember/routing/route"; | ||
import { useCalumaQuery } from "@projectcaluma/ember-core/caluma-query"; | ||
import { allWorkItems } from "@projectcaluma/ember-core/caluma-query/queries"; | ||
|
||
export default class CasesDetailWorkItemsEditRoute extends Route { | ||
model({ work_item_id }) { | ||
const workItemsQuery = useCalumaQuery(this, allWorkItems, () => ({ | ||
options: { pageSize: 1 }, | ||
filter: [{ id: work_item_id }], | ||
})); | ||
return work_item_id; | ||
} | ||
|
||
return workItemsQuery; | ||
setupController(controller, post) { | ||
super.setupController(controller, post); | ||
controller.getWorkItem.perform(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
query getCaseQuery($filter: [CaseFilterSetType]) { | ||
allCases(filter: $filter) { | ||
edges { | ||
node { | ||
id | ||
status | ||
createdAt | ||
modifiedAt | ||
document { | ||
id | ||
form { | ||
name | ||
description | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.