Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Connection-Studio
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
Admin message
GitLab upgrade completed. Current version is 17.8.2.
Show more breadcrumbs
cedar
Connection-Studio
Commits
27e5ec30
Commit
27e5ec30
authored
1 year ago
by
Simon Ebel
Browse files
Options
Downloads
Patches
Plain Diff
feat: move values update to data view component. Ref #168
parent
10a8ae34
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
front/src/pages/View.js
+42
-40
42 additions, 40 deletions
front/src/pages/View.js
webservices/main/src/fr/inria/cedar/connectionstudio/webservices/connectionlens/DataViewServlet.java
+1
-0
1 addition, 0 deletions
...ionstudio/webservices/connectionlens/DataViewServlet.java
with
43 additions
and
40 deletions
front/src/pages/View.js
+
42
−
40
View file @
27e5ec30
...
...
@@ -183,12 +183,10 @@ function DataView({
activeSource
,
statement
,
shouldExecuteQuery
,
shouldUpdateValues
,
})
{
const
{
activeLang
}
=
useLang
();
const
[
shouldUpdateValues
,
setShouldUpdateValues
]
=
React
.
useState
(
false
);
const
[
valuesToUpdate
,
setValuesToUpdate
]
=
React
.
useState
({});
const
[
activeRows
,
setActiveRows
]
=
React
.
useState
({});
const
[
displayRows
,
setDisplayRows
]
=
React
.
useState
([]);
const
[
columnData
,
setColumnData
]
=
React
.
useState
([]);
...
...
@@ -308,6 +306,16 @@ function DataView({
setfieldIdToValueIdToRowId
(
fieldIdToValueIdToRowId
);
},
[
activeRows
,
IdToField
]);
const
[
valuesToUpdate
,
setValuesToUpdate
]
=
React
.
useState
({});
const
{
updated
,
isUpdateError
,
isUpdateLoading
}
=
useUpdateValues
(
shouldUpdateValues
,
database
,
contexts
,
valuesToUpdate
,
activeSource
.
type
);
return
(
<
Box
>
{
Object
.
keys
(
activeRows
).
length
>
0
?
(
...
...
@@ -348,35 +356,37 @@ function DataView({
const
fieldId
=
params
.
colDef
.
id
;
const
valueId
=
params
.
row
.
fieldToValue
[
fieldId
];
const
rowsToUpdate
=
fieldIdToValueIdToRowId
[
fieldId
][
valueId
];
const
updatedValue
=
event
.
target
.
value
;
var
updatedRows
=
{
...
activeRows
};
rowsToUpdate
.
forEach
((
id
)
=>
{
var
updatedRow
=
{
...
activeRows
[
id
]
};
updatedRow
[
IdToField
[
fieldId
]]
=
updatedValue
;
updatedRows
[
id
]
=
updatedRow
;
let
oldValue
=
activeRows
[
id
][
IdToField
[
fieldId
]];
if
(
!
(
id
in
valuesToUpdate
))
{
valuesToUpdate
[
id
]
=
{};
if
(
event
.
target
)
{
const
updatedValue
=
event
.
target
.
value
;
var
updatedRows
=
{
...
activeRows
};
rowsToUpdate
.
forEach
((
id
)
=>
{
var
updatedRow
=
{
...
activeRows
[
id
]
};
updatedRow
[
IdToField
[
fieldId
]]
=
updatedValue
;
updatedRows
[
id
]
=
updatedRow
;
let
oldValue
=
activeRows
[
id
][
IdToField
[
fieldId
]];
if
(
!
(
id
in
valuesToUpdate
))
{
valuesToUpdate
[
id
]
=
{};
}
if
(
!
(
fieldId
in
valuesToUpdate
[
id
]))
{
valuesToUpdate
[
id
][
fieldId
]
=
{
newValue
:
updatedValue
,
oldValue
:
oldValue
,
};
}
else
{
valuesToUpdate
[
id
][
fieldId
]
=
{
newValue
:
updatedValue
,
oldValue
:
valuesToUpdate
[
id
][
fieldId
].
oldValue
,
};
}
});
setActiveRows
(
updatedRows
);
setValuesToUpdate
({
...
valuesToUpdate
});
if
(
params
.
reason
===
GridCellEditStopReasons
.
cellFocusOut
)
{
event
.
defaultMuiPrevented
=
true
;
}
if
(
!
(
fieldId
in
valuesToUpdate
[
id
]))
{
valuesToUpdate
[
id
][
fieldId
]
=
{
newValue
:
updatedValue
,
oldValue
:
oldValue
,
};
}
else
{
valuesToUpdate
[
id
][
fieldId
]
=
{
newValue
:
updatedValue
,
oldValue
:
valuesToUpdate
[
id
][
fieldId
].
oldValue
,
};
}
});
setActiveRows
(
updatedRows
);
setValuesToUpdate
({
...
valuesToUpdate
});
if
(
params
.
reason
===
GridCellEditStopReasons
.
cellFocusOut
)
{
event
.
defaultMuiPrevented
=
true
;
}
}}
/
>
...
...
@@ -714,15 +724,6 @@ export default function View() {
};
const
[
shouldUpdateValues
,
setShouldUpdateValues
]
=
React
.
useState
(
false
);
const
[
valuesToUpdate
,
setValuesToUpdate
]
=
React
.
useState
({});
const
{
updated
,
isUpdateError
,
isUpdateLoading
}
=
useUpdateValues
(
shouldUpdateValues
,
database
,
contexts
,
valuesToUpdate
,
activeSource
.
type
);
const
handleOnUpdate
=
()
=>
{
setShouldUpdateValues
(
true
);
...
...
@@ -848,6 +849,7 @@ export default function View() {
activeSource
=
{
activeSource
}
statement
=
{
statement
}
shouldExecuteQuery
=
{
shouldExecuteQuery
}
shouldUpdateValues
=
{
shouldUpdateValues
}
><
/DataView
>
<
/Box
>
);
...
...
This diff is collapsed.
Click to expand it.
webservices/main/src/fr/inria/cedar/connectionstudio/webservices/connectionlens/DataViewServlet.java
+
1
−
0
View file @
27e5ec30
...
...
@@ -176,6 +176,7 @@ public class DataViewServlet extends MasterServlet {
try
{
String
UpdatedStatement
=
request
.
getParameter
(
RequestParameters
.
STATETMENT
);
SimpleQuery
mq
=
getMixedQuery
(
contexts
);
mq
.
toSQLQuery
();
StringBuffer
data
=
ConnectionManagerCl
.
executeStatement
(
database
,
UpdatedStatement
,
mq
);
...
...
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