Skip to content

Instantly share code, notes, and snippets.

@dispalt
Created September 27, 2018 02:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dispalt/e382de13b7214ced3d5ab524123afc1b to your computer and use it in GitHub Desktop.
Save dispalt/e382de13b7214ced3d5ab524123afc1b to your computer and use it in GitHub Desktop.
diff --git i/api/src/main/scala/com/goodcover/gql/ClaimSchema.scala w/api/src/main/scala/com/goodcover/gql/ClaimSchema.scala
index f522db989..f895e3f40 100644
--- i/api/src/main/scala/com/goodcover/gql/ClaimSchema.scala
+++ w/api/src/main/scala/com/goodcover/gql/ClaimSchema.scala
@@ -117,6 +117,7 @@ class ClaimSchema(nodeInterface: InterfaceType[Ctx, AnyRef], A1VersionedPolicyTy
Field("policy", OptionType(A1VersionedPolicyType), resolve = _.value.selectedPolicy),
Field("documents", ListType(ClaimDocumentType), resolve = _.value.documents),
Field("lossPlace", OptionType(PlaceType), resolve = _.value.lossPlace),
+ Field("foo", OptionType(IntType), resolve = _ => 1),
// TODO: Add events here and to [[ClaimEventInterface]]; these need to be kept in sync
// If this is more permissive than the types implemented it will throw a Runtime error.
Field("events", ListType(ClaimEventInterface), resolve = _.value.events collect {
diff --git i/api/src/main/scala/com/goodcover/gql/admin/AdminClaimSchema.scala w/api/src/main/scala/com/goodcover/gql/admin/AdminClaimSchema.scala
index 7c513a375..d1973d320 100644
--- i/api/src/main/scala/com/goodcover/gql/admin/AdminClaimSchema.scala
+++ w/api/src/main/scala/com/goodcover/gql/admin/AdminClaimSchema.scala
@@ -60,7 +60,8 @@ class AdminClaimSchema(
Field("lossDateFormatted", OptionType(StringType), resolve = _.value.lossDateFormatted),
Field("status", StringType, resolve = _.value.status.label),
Field("policy", OptionType(A1VersionedPolicyType), resolve = _.value.selectedPolicy),
-// Field("lossPlace", OptionType(PlaceType), resolve = _.value.lossPlace),
+ Field("foo", OptionType(StringType), resolve = _ => ""),
+ // Field("lossPlace", OptionType(PlaceType), resolve = _.value.lossPlace),
Field("lossAdjustment", OptionType(LossAdjustmentType), resolve = _.value.lossAdjustment),
// TODO: Add events here and to [[ClaimEventInterface]]; these need to be kept in sync
// If this is more permissive than the types implemented it will throw a Runtime error.
diff --git i/client-admin/src/main/scala/web/admin/views/NewClaimView.scala w/client-admin/src/main/scala/web/admin/views/NewClaimView.scala
index 7b7950d44..59a6a4ec4 100644
--- i/client-admin/src/main/scala/web/admin/views/NewClaimView.scala
+++ w/client-admin/src/main/scala/web/admin/views/NewClaimView.scala
@@ -20,7 +20,7 @@ import web.admin.routes._
import web.base.all._
import web.base.gql
import web.cps.SubjectWrapper
-import web.cps.claims.EventG
+import web.cps.claims.{ClaimC, EventG}
import scala.scalajs.js
@@ -60,6 +60,7 @@ import scala.scalajs.js
id name description active url size contentType bucketKey source
}
}
+ ...Foo_claim
...EventPane_claim
}
...AdminCore_viewer
@@ -98,6 +99,7 @@ object NewClaimView {
<.div(
^.cls := "gc-NewClaimView",
DetailsPane.Props(p.viewer, p.rc).render,
+ ClaimC.Props(p.viewer.claim.get).render,
Row(gutter = 16)(
Col(layout)(EventPane.Props(p.viewer.claim.get, p.rc, ps, p.relay).render),
Col(layout)(LossAdjustmentForm(
diff --git i/client-comp/src/main/resources/shared-gql/Foo_claim.gql w/client-comp/src/main/resources/shared-gql/Foo_claim.gql
index e69de29bb..50bd71ab0 100644
--- i/client-comp/src/main/resources/shared-gql/Foo_claim.gql
+++ w/client-comp/src/main/resources/shared-gql/Foo_claim.gql
@@ -0,0 +1,5 @@
+fragment Foo_claim on Claim {
+
+ id rawId
+ foo
+}
diff --git i/client-comp/src/main/scala/web/cps/claims/ClaimC.scala w/client-comp/src/main/scala/web/cps/claims/ClaimC.scala
index c7327ceaa..cc1632dc5 100644
--- i/client-comp/src/main/scala/web/cps/claims/ClaimC.scala
+++ w/client-comp/src/main/scala/web/cps/claims/ClaimC.scala
@@ -1,2 +1,34 @@
package web.cps.claims
-class ClaimC {}
+
+import japgolly.scalajs.react._
+import japgolly.scalajs.react.vdom.html_<^._
+import japgolly.scalajs.react.extra._
+import japgolly.scalajs.react.extra.router.RouterCtl
+import web.base.all._
+import relay.Container
+import relay.generated.Foo_claim
+import web.base.gql
+
+import scala.scalajs.js
+
+object ClaimC {
+
+ final case class Props(claim: Foo_claim) {
+ @inline def render: VdomElement = C(this)
+ }
+
+ private[this] final class Backend(val $ : BackendScope[Props, Unit]) {
+ def render(p: Props): VdomElement = {
+ <.div(p.claim.rawId, p.claim.foo)
+ }
+ }
+
+ private[this] val C = Container
+ .fragmentContainerBuilder(
+ ScalaComponent
+ .builder[Props]("ClaimC")
+ .renderBackend[Backend]
+ .build)
+ .addFrag(Foo_claim)
+ .build
+}
diff --git i/server/src/main/resources/admin-schema.graphql w/server/src/main/resources/admin-schema.graphql
index 0ebd1d0f3..4ed4d436a 100644
--- i/server/src/main/resources/admin-schema.graphql
+++ w/server/src/main/resources/admin-schema.graphql
@@ -359,6 +359,7 @@ type Claim implements Node {
lossDateFormatted: String
status: String!
policy: A1VersionedPolicy
+ foo: String
lossAdjustment: LossAdjustmentInput
events: [ClaimV1Event!]!
history(includeAccountDetails: Boolean = true): [AccountHistory!]!
diff --git i/server/src/main/resources/user-schema.graphql w/server/src/main/resources/user-schema.graphql
index 6d17beec3..eca4595cc 100644
--- i/server/src/main/resources/user-schema.graphql
+++ w/server/src/main/resources/user-schema.graphql
@@ -294,6 +294,7 @@ type Claim implements Node {
policy: A1VersionedPolicy
documents: [ClaimDocument!]!
lossPlace: Place
+ foo: Int
events: [ClaimV1Event!]!
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment