Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
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
RadioObservatory
LOFAR
Commits
8497f99f
Commit
8497f99f
authored
4 years ago
by
Ramesh Kumar
Browse files
Options
Downloads
Patches
Plain Diff
TMSS-226
: Updated code to update multiple tasks.
parent
e4a23025
No related branches found
No related tags found
1 merge request
!214
Resolve TMSS-348 - Merged other local branches
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js
+44
-33
44 additions, 33 deletions
SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js
SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js
+10
-7
10 additions, 7 deletions
...MSS/frontend/tmss_webapp/src/services/schedule.service.js
with
54 additions
and
40 deletions
SAS/TMSS/frontend/tmss_webapp/src/routes/Scheduling/edit.js
+
44
−
33
View file @
8497f99f
...
@@ -19,7 +19,9 @@ import ScheduleService from '../../services/schedule.service';
...
@@ -19,7 +19,9 @@ import ScheduleService from '../../services/schedule.service';
import
TaskService
from
'
../../services/task.service
'
;
import
TaskService
from
'
../../services/task.service
'
;
import
UIConstants
from
'
../../utils/ui.constants
'
;
import
UIConstants
from
'
../../utils/ui.constants
'
;
/**
* Compoenent to edit scheduling unit draft
*/
export
class
EditSchedulingUnit
extends
Component
{
export
class
EditSchedulingUnit
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
...
@@ -36,7 +38,7 @@ export class EditSchedulingUnit extends Component {
...
@@ -36,7 +38,7 @@ export class EditSchedulingUnit extends Component {
paramsSchema
:
null
,
paramsSchema
:
null
,
validEditor
:
false
,
validEditor
:
false
,
validFields
:
{},
validFields
:
{},
taskDraft
:
{}
observStrategyVisible
:
false
}
}
this
.
projects
=
[];
this
.
projects
=
[];
this
.
schedulingSets
=
[];
this
.
schedulingSets
=
[];
...
@@ -68,7 +70,7 @@ export class EditSchedulingUnit extends Component {
...
@@ -68,7 +70,7 @@ export class EditSchedulingUnit extends Component {
* @param {number} strategyId
* @param {number} strategyId
*/
*/
async
changeStrategy
(
strategyId
)
{
async
changeStrategy
(
strategyId
)
{
let
task
DraftName
;
let
task
sToUpdate
=
{}
;
const
observStrategy
=
_
.
find
(
this
.
observStrategies
,
{
'
id
'
:
strategyId
});
const
observStrategy
=
_
.
find
(
this
.
observStrategies
,
{
'
id
'
:
strategyId
});
const
tasks
=
observStrategy
.
template
.
tasks
;
const
tasks
=
observStrategy
.
template
.
tasks
;
let
paramsOutput
=
{};
let
paramsOutput
=
{};
...
@@ -90,7 +92,7 @@ export class EditSchedulingUnit extends Component {
...
@@ -90,7 +92,7 @@ export class EditSchedulingUnit extends Component {
schema
[
'
$schema
'
]
=
taskTemplate
.
schema
[
'
$schema
'
];
schema
[
'
$schema
'
]
=
taskTemplate
.
schema
[
'
$schema
'
];
observStrategy
.
template
.
parameters
.
forEach
(
async
(
param
,
index
)
=>
{
observStrategy
.
template
.
parameters
.
forEach
(
async
(
param
,
index
)
=>
{
if
(
param
.
refs
[
0
].
indexOf
(
`/tasks/
${
taskName
}
`
)
>
0
)
{
if
(
param
.
refs
[
0
].
indexOf
(
`/tasks/
${
taskName
}
`
)
>
0
)
{
task
Draft
Name
=
taskName
;
task
sToUpdate
[
task
Name
]
=
taskName
;
// Resolve the identified template
// Resolve the identified template
const
$templateRefs
=
await
$RefParser
.
resolve
(
taskTemplate
);
const
$templateRefs
=
await
$RefParser
.
resolve
(
taskTemplate
);
let
property
=
{
};
let
property
=
{
};
...
@@ -117,7 +119,7 @@ export class EditSchedulingUnit extends Component {
...
@@ -117,7 +119,7 @@ export class EditSchedulingUnit extends Component {
}
}
});
});
}
}
this
.
setState
({
observStrategy
:
observStrategy
,
paramsSchema
:
schema
,
paramsOutput
:
paramsOutput
,
task
Draft
:
taskDraftNam
e
});
this
.
setState
({
observStrategy
:
observStrategy
,
paramsSchema
:
schema
,
paramsOutput
:
paramsOutput
,
task
sToUpdate
:
tasksToUpdat
e
});
// Function called to clear the JSON Editor fields and reload with new schema
// Function called to clear the JSON Editor fields and reload with new schema
if
(
this
.
state
.
editorFunction
)
{
if
(
this
.
state
.
editorFunction
)
{
...
@@ -138,10 +140,12 @@ export class EditSchedulingUnit extends Component {
...
@@ -138,10 +140,12 @@ export class EditSchedulingUnit extends Component {
this
.
schedulingSets
=
responses
[
1
];
this
.
schedulingSets
=
responses
[
1
];
this
.
observStrategies
=
responses
[
2
];
this
.
observStrategies
=
responses
[
2
];
this
.
taskTemplates
=
responses
[
3
];
this
.
taskTemplates
=
responses
[
3
];
this
.
setState
({
taskDrafts
:
responses
[
5
].
data
.
results
});
responses
[
4
].
project
=
this
.
schedulingSets
.
find
(
i
=>
i
.
id
===
responses
[
4
].
scheduling_set_id
).
project_id
;
responses
[
4
].
project
=
this
.
schedulingSets
.
find
(
i
=>
i
.
id
===
responses
[
4
].
scheduling_set_id
).
project_id
;
this
.
setState
({
schedulingUnit
:
responses
[
4
]
});
this
.
setState
({
schedulingUnit
:
responses
[
4
],
taskDrafts
:
responses
[
5
].
data
.
results
,
this
.
changeStrategy
(
responses
[
4
].
observation_strategy_template_id
);
observStrategyVisible
:
responses
[
4
].
observation_strategy_template_id
?
true
:
false
});
if
(
responses
[
4
].
observation_strategy_template_id
)
{
this
.
changeStrategy
(
responses
[
4
].
observation_strategy_template_id
);
}
if
(
this
.
state
.
schedulingUnit
.
project
)
{
if
(
this
.
state
.
schedulingUnit
.
project
)
{
const
projectSchedSets
=
_
.
filter
(
this
.
schedulingSets
,
{
'
project_id
'
:
this
.
state
.
schedulingUnit
.
project
});
const
projectSchedSets
=
_
.
filter
(
this
.
schedulingSets
,
{
'
project_id
'
:
this
.
state
.
schedulingUnit
.
project
});
this
.
setState
({
isLoading
:
false
,
schedulingSets
:
projectSchedSets
});
this
.
setState
({
isLoading
:
false
,
schedulingSets
:
projectSchedSets
});
...
@@ -241,21 +245,24 @@ export class EditSchedulingUnit extends Component {
...
@@ -241,21 +245,24 @@ export class EditSchedulingUnit extends Component {
* Function to create Scheduling unit
* Function to create Scheduling unit
*/
*/
async
saveSchedulingUnit
()
{
async
saveSchedulingUnit
()
{
let
observStrategy
=
_
.
cloneDeep
(
this
.
state
.
observStrategy
);
if
(
this
.
state
.
schedulingUnit
.
observation_strategy_template_id
)
{
const
$refs
=
await
$RefParser
.
resolve
(
observStrategy
.
template
);
let
observStrategy
=
_
.
cloneDeep
(
this
.
state
.
observStrategy
);
observStrategy
.
template
.
parameters
.
forEach
(
async
(
param
,
index
)
=>
{
const
$refs
=
await
$RefParser
.
resolve
(
observStrategy
.
template
);
$refs
.
set
(
observStrategy
.
template
.
parameters
[
index
][
'
refs
'
][
0
],
this
.
state
.
paramsOutput
[
'
param_
'
+
index
]);
observStrategy
.
template
.
parameters
.
forEach
(
async
(
param
,
index
)
=>
{
});
$refs
.
set
(
observStrategy
.
template
.
parameters
[
index
][
'
refs
'
][
0
],
this
.
state
.
paramsOutput
[
'
param_
'
+
index
]);
const
task
=
this
.
state
.
taskDrafts
.
find
(
draft
=>
draft
.
name
===
this
.
state
.
taskDraft
);
});
const
schedulingUnit
=
await
ScheduleService
.
updateSUDraftFromObservStrategy
(
observStrategy
,
this
.
state
.
schedulingUnit
,
task
,
this
.
state
.
taskDraft
);
const
schedulingUnit
=
await
ScheduleService
.
updateSUDraftFromObservStrategy
(
observStrategy
,
this
.
state
.
schedulingUnit
,
this
.
state
.
taskDrafts
,
this
.
state
.
tasksToUpdate
);
if
(
schedulingUnit
)
{
if
(
schedulingUnit
)
{
this
.
growl
.
show
({
severity
:
'
success
'
,
summary
:
'
Success
'
,
detail
:
'
Scheduling Unit and tasks edited successfully!
'
});
// this.growl.show({severity: 'success', summary: 'Success', detail: 'Scheduling Unit and tasks edited successfully!'});
this
.
props
.
history
.
push
({
this
.
props
.
history
.
push
({
pathname
:
`/schedulingunit/view/draft/
${
this
.
props
.
match
.
params
.
id
}
`
,
pathname
:
`/schedulingunit/view/draft/
${
this
.
props
.
match
.
params
.
id
}
`
,
});
});
}
else
{
}
else
{
this
.
growl
.
show
({
severity
:
'
error
'
,
summary
:
'
Error Occured
'
,
detail
:
'
Unable to update Scheduling Unit/Tasks
'
});
this
.
growl
.
show
({
severity
:
'
error
'
,
summary
:
'
Error Occured
'
,
detail
:
'
Unable to update Scheduling Unit/Tasks
'
});
}
}
}
else
{
this
.
growl
.
show
({
severity
:
'
error
'
,
summary
:
'
Error Occured
'
,
detail
:
'
Template Missing.
'
});
}
}
}
/**
/**
...
@@ -337,16 +344,20 @@ export class EditSchedulingUnit extends Component {
...
@@ -337,16 +344,20 @@ export class EditSchedulingUnit extends Component {
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
div
className
=
"
p-field p-grid
"
>
<
div
className
=
"
p-field p-grid
"
>
<
label
htmlFor
=
"
observStrategy
"
className
=
"
col-lg-2 col-md-2 col-sm-12
"
>
Observation
Strategy
<
/label
>
{
this
.
state
.
observStrategyVisible
&&
<
div
className
=
"
col-lg-3 col-md-3 col-sm-12
"
data
-
testid
=
"
observStrategy
"
>
<>
<
Dropdown
inputId
=
"
observStrategy
"
optionLabel
=
"
name
"
optionValue
=
"
id
"
<
label
htmlFor
=
"
observStrategy
"
className
=
"
col-lg-2 col-md-2 col-sm-12
"
>
Observation
Strategy
<
/label
>
tooltip
=
"
Observation Strategy Template to be used to create the Scheduling Unit and Tasks
"
tooltipOptions
=
{
this
.
tooltipOptions
}
<
div
className
=
"
col-lg-3 col-md-3 col-sm-12
"
data
-
testid
=
"
observStrategy
"
>
value
=
{
this
.
state
.
schedulingUnit
.
observation_strategy_template_id
}
<
Dropdown
inputId
=
"
observStrategy
"
optionLabel
=
"
name
"
optionValue
=
"
id
"
disabled
=
{
this
.
state
.
schedulingUnit
.
observation_strategy_template_id
}
tooltip
=
"
Observation Strategy Template to be used to create the Scheduling Unit and Tasks
"
tooltipOptions
=
{
this
.
tooltipOptions
}
options
=
{
this
.
observStrategies
}
value
=
{
this
.
state
.
schedulingUnit
.
observation_strategy_template_id
}
onChange
=
{(
e
)
=>
{
this
.
changeStrategy
(
e
.
value
)}}
disabled
=
{
this
.
state
.
schedulingUnit
.
observation_strategy_template_id
}
placeholder
=
"
Select Strategy
"
/>
options
=
{
this
.
observStrategies
}
<
/div
>
onChange
=
{(
e
)
=>
{
this
.
changeStrategy
(
e
.
value
)}}
placeholder
=
"
Select Strategy
"
/>
<
/div
>
<
/
>
}
<
div
className
=
"
col-lg-1 col-md-1 col-sm-12
"
><
/div
>
<
div
className
=
"
col-lg-1 col-md-1 col-sm-12
"
><
/div
>
<
/div
>
<
/div
>
...
...
This diff is collapsed.
Click to expand it.
SAS/TMSS/frontend/tmss_webapp/src/services/schedule.service.js
+
10
−
7
View file @
8497f99f
...
@@ -211,16 +211,19 @@ const ScheduleService = {
...
@@ -211,16 +211,19 @@ const ScheduleService = {
};
};
},
},
updateSUDraftFromObservStrategy
:
async
function
(
observStrategy
,
schedulingUnit
,
task
,
task
Nam
e
)
{
updateSUDraftFromObservStrategy
:
async
function
(
observStrategy
,
schedulingUnit
,
task
s
,
task
sToUpdat
e
)
{
try
{
try
{
delete
schedulingUnit
[
'
duration
'
];
delete
schedulingUnit
[
'
duration
'
];
schedulingUnit
=
await
this
.
updateSchedulingUnitDraft
(
schedulingUnit
);
schedulingUnit
=
await
this
.
updateSchedulingUnitDraft
(
schedulingUnit
);
task
.
specifications_doc
=
observStrategy
.
template
.
tasks
[
taskName
].
specifications_doc
;
for
(
const
taskToUpdate
in
tasksToUpdate
)
{
delete
task
[
'
duration
'
];
let
task
=
tasks
.
find
(
task
=>
{
return
task
.
name
===
taskToUpdate
});
delete
task
[
'
relative_start_time
'
];
task
.
specifications_doc
=
observStrategy
.
template
.
tasks
[
taskToUpdate
].
specifications_doc
;
delete
task
[
'
relative_stop_time
'
];
delete
task
[
'
duration
'
];
task
=
await
this
.
updateTask
(
task
);
delete
task
[
'
relative_start_time
'
];
return
task
;
delete
task
[
'
relative_stop_time
'
];
task
=
await
this
.
updateTask
(
task
);
}
return
schedulingUnit
;
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
error
);
console
.
error
(
error
);
return
null
;
return
null
;
...
...
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