mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
Proper file upload/download start parameters in widget player
Signed-off-by: SystemsPurge <naktiyoussef@proton.me>
This commit is contained in:
parent
7497cd9314
commit
b60c01a350
2 changed files with 16 additions and 8 deletions
src/pages
|
@ -137,16 +137,24 @@ const WidgetPlayer = (
|
|||
}
|
||||
|
||||
const clickStart = async () => {
|
||||
const url = window.location.origin;
|
||||
try {
|
||||
setPlayerState(transitionState(playerState, 'ICBUSY'));
|
||||
let pld = {action:"start",when:Math.round((new Date()).getTime() / 1000),parameters:{...startParameters}}
|
||||
if (config.fileIDs && config.fileIDs.length >0){
|
||||
pld.model = {
|
||||
url: `${url}/api/v2/files/${config.fileIDs[0]}`,
|
||||
type: "url",
|
||||
token: sessionToken
|
||||
}
|
||||
}
|
||||
if(isUploadResultsChecked){
|
||||
addResult({result: {
|
||||
scenarioID: scenarioID
|
||||
}})
|
||||
.then(v=>{
|
||||
pld.results = {
|
||||
url: `https://slew.k8s.eonerc.rwth-aachen.de/api/v2/results/${v.data.result.id}/file`,
|
||||
url: `${url}/api/v2/results/${v.data.result.id}/file`,
|
||||
type: "url",
|
||||
token: sessionToken
|
||||
}
|
||||
|
@ -159,10 +167,11 @@ const WidgetPlayer = (
|
|||
else{
|
||||
dispatch(sendActionToIC({token:sessionToken,id:config.icID,actions:[pld]}))
|
||||
}
|
||||
//sendAction({ icid: startConfig.icID, action: "start", when: Math.round((new Date()).getTime() / 1000), parameters: {...startParameters } }).unwrap();
|
||||
console.log(pld)
|
||||
} catch(error) {
|
||||
notificationsDataManager.addNotification(NotificationsFactory.LOAD_ERROR(error?.data?.message));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const clickReset = async () => {
|
||||
|
|
|
@ -40,6 +40,7 @@ const ConfigActionBoard = ({selectedConfigs, scenarioID}) => {
|
|||
const [isResultRequested, setIsResultRequested] = useState(false);
|
||||
|
||||
const handleConfigStart = async () => {
|
||||
const url = window.location.origin;
|
||||
for(const config of selectedConfigs){
|
||||
try {
|
||||
const action = {
|
||||
|
@ -50,7 +51,7 @@ const ConfigActionBoard = ({selectedConfigs, scenarioID}) => {
|
|||
}
|
||||
if (config.fileIDs && config.fileIDs.length >0){
|
||||
action.model = {
|
||||
url: `https://${window.location.hostname}/api/v2/files/${config.fileIDs[0]}`,
|
||||
url: `${url}/api/v2/files/${config.fileIDs[0]}`,
|
||||
type: "url",
|
||||
token: sessionToken
|
||||
}
|
||||
|
@ -87,22 +88,20 @@ const ConfigActionBoard = ({selectedConfigs, scenarioID}) => {
|
|||
const res = await addResult({result: newResult}).unwrap();
|
||||
|
||||
if(!isErrorAddingResult){
|
||||
const url = window.location.origin;
|
||||
action.results = {
|
||||
url: `https://${window.location.hostname}/api/v2/results/${res.result.id}/file`,
|
||||
url: `${url}/api/v2/results/${res.result.id}/file`,
|
||||
type: "url",
|
||||
token: sessionToken
|
||||
}
|
||||
//await sendAction(action).unwrap();
|
||||
await sendAction(action).unwrap();
|
||||
} else {
|
||||
notificationsDataManager.addNotification(NotificationsFactory.LOAD_ERROR("Error adding result"));
|
||||
}
|
||||
|
||||
refetchResults();
|
||||
} else {
|
||||
//await sendAction(action).unwrap();
|
||||
await sendAction(action).unwrap();
|
||||
}
|
||||
|
||||
notificationsDataManager.addNotification(NotificationsFactory.ACTION_INFO());
|
||||
} catch (err) {
|
||||
if(err.data){
|
||||
|
|
Loading…
Add table
Reference in a new issue