Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
react-admin-cubicweb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cubicweb
react-admin-cubicweb
Commits
5f7a610e60d5
Commit
5f7a610e60d5
authored
4 years ago
by
Frank Bessou
Browse files
Options
Downloads
Patches
Plain Diff
fix: run prettier
parent
70c03510bc06
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
packages/demo/src/App.tsx
+9
-5
9 additions, 5 deletions
packages/demo/src/App.tsx
packages/ra-cubicweb/src/index.ts
+18
-12
18 additions, 12 deletions
packages/ra-cubicweb/src/index.ts
with
27 additions
and
17 deletions
packages/demo/src/App.tsx
+
9
−
5
View file @
5f7a610e
...
...
@@ -24,7 +24,7 @@
import
{
schema
}
from
"
./schema
"
;
export
const
MuseumShow
=
(
props
:
ShowProps
)
=>
(
const
MuseumShow
=
(
props
:
ShowProps
)
=>
(
<
Show
{
...
props
}
>
<
SimpleShowLayout
>
<
TextField
source
=
"id"
/>
...
...
@@ -63,7 +63,7 @@
</
List
>
);
export
const
CityList
=
(
props
:
ListProps
)
=>
(
const
CityList
=
(
props
:
ListProps
)
=>
(
<
List
{
...
props
}
>
<
Datagrid
rowClick
=
"show"
>
<
TextField
source
=
"id"
/>
...
...
@@ -73,9 +73,9 @@
</
List
>
);
export
const
CityShow
=
(
props
:
ShowProps
)
=>
(
const
CityShow
=
(
props
:
ShowProps
)
=>
(
<
Show
{
...
props
}
>
<
SimpleShowLayout
>
<
TextField
source
=
"id"
/>
<
TextField
source
=
"name"
/>
<
NumberField
source
=
"zip_code"
/>
...
...
@@ -77,7 +77,11 @@
<
Show
{
...
props
}
>
<
SimpleShowLayout
>
<
TextField
source
=
"id"
/>
<
TextField
source
=
"name"
/>
<
NumberField
source
=
"zip_code"
/>
<
ReferenceArrayField
label
=
"Museum"
reference
=
"Museum"
source
=
"reverse_is_in"
>
<
ReferenceArrayField
label
=
"Museum"
reference
=
"Museum"
source
=
"reverse_is_in"
>
<
Datagrid
rowClick
=
"show"
>
...
...
@@ -83,5 +87,5 @@
<
Datagrid
rowClick
=
"show"
>
<
TextField
source
=
"name"
/>
<
TextField
source
=
"name"
/>
</
Datagrid
>
</
ReferenceArrayField
>
</
SimpleShowLayout
>
...
...
This diff is collapsed.
Click to expand it.
packages/ra-cubicweb/src/index.ts
+
18
−
12
View file @
5f7a610e
...
...
@@ -89,7 +89,9 @@
// Getting subject relations
const
subjectRelations
=
Object
.
fromEntries
(
Object
.
entries
(
schema
.
relationships
).
filter
(
Object
.
entries
(
schema
.
relationships
).
filter
(
([
_relationName
,
definition
]:
[
string
,
S
[
"
relationships
"
][
string
]])
=>
definition
.
subject
.
includes
(
resource
)
)
...
...
@@ -105,7 +107,9 @@
// Getting object relations
const
objectRelations
=
Object
.
fromEntries
(
Object
.
entries
(
schema
.
relationships
).
filter
(
Object
.
entries
(
schema
.
relationships
).
filter
(
([
_relationName
,
definition
]:
[
string
,
S
[
"
relationships
"
][
string
]])
=>
definition
.
object
.
includes
(
resource
)
)
...
...
@@ -132,7 +136,7 @@
restrictions
.
push
(
`X
${
key
}
${
variable
}
`
);
});
const
result
=
await
rqlClient
.
queryRows
(
`Any
${
selection
.
join
(
"
,
"
)}
Where
${
restrictions
.
join
(
"
,
"
)}
, X eid IN (
${
params
.
ids
.
join
(
"
,
"
)
}
)`
`Any
${
selection
.
join
(
"
,
"
)}
Where
${
restrictions
.
join
(
"
,
"
)}
, X eid IN (
${
params
.
ids
.
join
(
"
,
"
)
}
)`
);
...
...
@@ -138,11 +142,13 @@
);
const
entities
=
result
.
map
((
row
,
rowIdx
)
=>
row
.
reduce
(
(
agg
,
attributeValue
,
idx
)
=>
({
[
attributesNames
[
idx
]]:
attributeValue
,
...
agg
,
}),
{
id
:
params
.
ids
[
rowIdx
]
}
));
const
entities
=
result
.
map
((
row
,
rowIdx
)
=>
row
.
reduce
(
(
agg
,
attributeValue
,
idx
)
=>
({
[
attributesNames
[
idx
]]:
attributeValue
,
...
agg
,
}),
{
id
:
params
.
ids
[
rowIdx
]
}
)
);
return
{
data
:
entities
};
},
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment