Skip to content
GitLab
Explore
Sign in
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
7ea40adb
Commit
7ea40adb
authored
4 years ago
by
Nithya
Browse files
Options
Downloads
Patches
Plain Diff
TMSS-494
Milliseconds updated on SU
parent
4e2dd40e
No related branches found
No related tags found
1 merge request
!374
Resolve TMSS-494
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
SAS/TMSS/frontend/tmss_webapp/src/components/JSONEditor/JEditor.js
+6
-8
6 additions, 8 deletions
...frontend/tmss_webapp/src/components/JSONEditor/JEditor.js
SAS/TMSS/frontend/tmss_webapp/src/utils/unit.converter.js
+31
-10
31 additions, 10 deletions
SAS/TMSS/frontend/tmss_webapp/src/utils/unit.converter.js
with
37 additions
and
18 deletions
SAS/TMSS/frontend/tmss_webapp/src/components/JSONEditor/JEditor.js
+
6
−
8
View file @
7ea40adb
...
@@ -5,12 +5,10 @@
...
@@ -5,12 +5,10 @@
/* eslint-disable react-hooks/exhaustive-deps */
/* eslint-disable react-hooks/exhaustive-deps */
import
React
,
{
useEffect
,
useRef
}
from
'
react
'
;
import
React
,
{
useEffect
,
useRef
}
from
'
react
'
;
import
_
from
'
lodash
'
;
import
_
from
'
lodash
'
;
import
flatpickr
from
'
flatpickr
'
;
import
UnitConverter
from
'
../../utils/unit.converter
'
import
UnitConverter
from
'
../../utils/unit.converter
'
import
$RefParser
from
"
@apidevtools/json-schema-ref-parser
"
;
import
$RefParser
from
"
@apidevtools/json-schema-ref-parser
"
;
import
"
@fortawesome/fontawesome-free/css/all.css
"
;
import
"
@fortawesome/fontawesome-free/css/all.css
"
;
import
"
flatpickr/dist/flatpickr.css
"
;
import
"
flatpickr/dist/flatpickr.css
"
;
import
UtilService
from
'
../../services/util.service
'
;
const
JSONEditor
=
require
(
"
@json-editor/json-editor
"
).
JSONEditor
;
const
JSONEditor
=
require
(
"
@json-editor/json-editor
"
).
JSONEditor
;
function
Jeditor
(
props
)
{
function
Jeditor
(
props
)
{
...
@@ -267,7 +265,7 @@ function Jeditor(props) {
...
@@ -267,7 +265,7 @@ function Jeditor(props) {
"
cleave
"
:
{
"
cleave
"
:
{
numericOnly
:
true
,
numericOnly
:
true
,
blocks
:
[
2
,
2
,
2
,
4
],
blocks
:
[
2
,
2
,
2
,
4
],
delimiters
:
[
'
:
'
,
'
:
'
,
'
.
'
],
delimiters
:
isDegree
?
[
'
:
'
,
'
:
'
,
'
.
'
]
:
[
'
:
'
,
'
:
'
,
'
:
'
]
,
delimiterLazyShow
:
true
delimiterLazyShow
:
true
}
}
}
}
...
@@ -442,15 +440,15 @@ function Jeditor(props) {
...
@@ -442,15 +440,15 @@ function Jeditor(props) {
*/
*/
function
validateTime
(
prpOutput
)
{
function
validateTime
(
prpOutput
)
{
const
splitOutput
=
prpOutput
.
split
(
'
:
'
);
const
splitOutput
=
prpOutput
.
split
(
'
:
'
);
const
isMilliSecondsPresent
=
prp
Output
.
split
(
'
.
'
)
;
const
isMilliSecondsPresent
=
split
Output
[
3
]
;
if
(
splitOutput
.
length
<
3
||
isMilliSecondsPresent
.
length
===
1
||
isMilliSecondsPresent
[
1
].
length
!==
4
)
{
if
(
splitOutput
.
length
<
3
||
(
isMilliSecondsPresent
[
1
]
&&
isMilliSecondsPresent
[
1
].
length
>
4
)
)
{
// if (splitOutput.length < 3) {
// if (splitOutput.length < 3) {
return
false
;
return
false
;
}
else
{
}
else
{
if
(
parseInt
(
splitOutput
[
0
])
>
23
||
parseInt
(
splitOutput
[
1
])
>
59
||
parseInt
(
splitOutput
[
2
])
>
59
||
parseInt
(
splitOutput
[
3
])
>
999
)
{
if
(
parseInt
(
splitOutput
[
0
])
>
23
||
parseInt
(
splitOutput
[
1
])
>
59
||
parseInt
(
splitOutput
[
2
])
>
59
)
{
return
false
;
return
false
;
}
}
const
timeValue
=
parseInt
(
splitOutput
[
0
]
*
60
*
60
)
+
parseInt
(
splitOutput
[
1
]
*
60
)
+
parseInt
(
splitOutput
[
2
]
*
1000
+
parseInt
(
splitOutput
[
3
])
);
const
timeValue
=
parseInt
(
splitOutput
[
0
]
*
60
*
60
)
+
parseInt
(
splitOutput
[
1
]
*
60
)
+
parseInt
(
splitOutput
[
2
]
*
1000
);
if
(
timeValue
>=
86400
)
{
if
(
timeValue
>=
86400
)
{
return
false
;
return
false
;
}
}
...
@@ -465,7 +463,7 @@ function Jeditor(props) {
...
@@ -465,7 +463,7 @@ function Jeditor(props) {
function
validateAngle
(
prpOutput
)
{
function
validateAngle
(
prpOutput
)
{
const
splitOutput
=
prpOutput
.
split
(
'
:
'
);
const
splitOutput
=
prpOutput
.
split
(
'
:
'
);
const
isMilliSecondsPresent
=
prpOutput
.
split
(
'
.
'
);
const
isMilliSecondsPresent
=
prpOutput
.
split
(
'
.
'
);
if
(
splitOutput
.
length
<
3
||
isMilliSecondsPresent
.
length
===
1
||
isMilliSecondsPresent
[
1
].
length
!==
4
)
{
if
(
splitOutput
.
length
<
3
||
isMilliSecondsPresent
[
1
].
length
>
4
)
{
//if (splitOutput.length < 3) {
//if (splitOutput.length < 3) {
return
false
;
return
false
;
}
else
{
}
else
{
...
...
This diff is collapsed.
Click to expand it.
SAS/TMSS/frontend/tmss_webapp/src/utils/unit.converter.js
+
31
−
10
View file @
7ea40adb
...
@@ -70,14 +70,26 @@ const UnitConverter = {
...
@@ -70,14 +70,26 @@ const UnitConverter = {
const
dd
=
Math
.
floor
(
prpInput
*
180
/
Math
.
PI
);
const
dd
=
Math
.
floor
(
prpInput
*
180
/
Math
.
PI
);
const
mm
=
Math
.
floor
((
degrees
-
dd
)
*
60
);
const
mm
=
Math
.
floor
((
degrees
-
dd
)
*
60
);
const
ss
=
+
((
degrees
-
dd
-
(
mm
/
60
))
*
3600
).
toFixed
(
0
);
const
ss
=
+
((
degrees
-
dd
-
(
mm
/
60
))
*
3600
).
toFixed
(
0
);
const
ssss
=
round
(((
degrees
-
dd
-
(
mm
/
60
)
-
(
ss
/
3600
))
*
3600000
),
4
)
const
ssss
=
round
(((
degrees
-
dd
-
(
mm
/
60
)
-
(
ss
/
3600
))
*
36000000
),
4
);
return
(
dd
<
10
?
`0
${
dd
}
`
:
`
${
dd
}
`
)
+
'
:
'
+
(
mm
<
10
?
`0
${
mm
}
`
:
`
${
mm
}
`
)
+
'
:
'
+
(
ss
<
10
?
`0
${
ss
}
`
:
`
${
ss
}
`
)
+
'
.
'
+
(
ssss
<
10
?
`0
${
ssss
}
`
:
`
${
ssss
}
`
);
let
milliSeconds
=
(
ssss
*
10000
).
toString
().
substr
(
0
,
4
);
if
(
milliSeconds
<
1
)
{
milliSeconds
=
this
.
padDigits
(
milliSeconds
.
substr
(
1
),
4
);
}
else
{
milliSeconds
=
this
.
padDigits
(
milliSeconds
,
4
);
}
return
(
dd
<
10
?
`0
${
dd
}
`
:
`
${
dd
}
`
)
+
'
:
'
+
(
mm
<
10
?
`0
${
mm
}
`
:
`
${
mm
}
`
)
+
'
:
'
+
(
ss
<
10
?
`0
${
ss
}
`
:
`
${
ss
}
`
)
+
'
.
'
+
milliSeconds
;
}
else
{
}
else
{
const
hh
=
Math
.
floor
(
degrees
/
15
);
const
hh
=
Math
.
floor
(
degrees
/
15
);
const
mm
=
Math
.
floor
((
degrees
-
(
hh
*
15
))
/
15
*
60
);
const
mm
=
Math
.
floor
((
degrees
-
(
hh
*
15
))
/
15
*
60
);
const
ss
=
+
((
degrees
-
(
hh
*
15
)
-
(
mm
*
15
/
60
))
/
15
*
3600
).
toFixed
(
0
);
const
ss
=
+
((
degrees
-
(
hh
*
15
)
-
(
mm
*
15
/
60
))
/
15
*
3600
).
toFixed
(
0
);
const
ssss
=
round
(((
degrees
-
(
hh
*
15
)
-
(
mm
/
4
)
-
(
ss
/
240
))
*
240000
),
4
);
const
ssss
=
round
(((
degrees
-
(
hh
*
15
)
-
(
mm
/
4
)
-
(
ss
/
240
))
*
2400000
),
4
);
return
(
hh
<
10
?
`0
${
hh
}
`
:
`
${
hh
}
`
)
+
'
:
'
+
(
mm
<
10
?
`0
${
mm
}
`
:
`
${
mm
}
`
)
+
'
:
'
+
(
ss
<
10
?
`0
${
ss
}
`
:
`
${
ss
}
`
)
+
'
:
'
+
(
ssss
<
10
?
`0
${
ssss
}
`
:
`
${
ssss
}
`
);
let
milliSeconds
=
(
ssss
*
10000
).
toString
().
substr
(
0
,
4
);
if
(
milliSeconds
<
1
)
{
milliSeconds
=
this
.
padDigits
(
milliSeconds
.
substr
(
1
),
4
);
}
else
{
milliSeconds
=
this
.
padDigits
(
milliSeconds
,
4
);
}
return
(
hh
<
10
?
`0
${
hh
}
`
:
`
${
hh
}
`
)
+
'
:
'
+
(
mm
<
10
?
`0
${
mm
}
`
:
`
${
mm
}
`
)
+
'
:
'
+
(
ss
<
10
?
`0
${
ss
}
`
:
`
${
ss
}
`
)
+
'
:
'
+
milliSeconds
;
}
}
}
else
{
}
else
{
return
"
00:00:00
"
;
return
"
00:00:00
"
;
...
@@ -90,15 +102,24 @@ const UnitConverter = {
...
@@ -90,15 +102,24 @@ const UnitConverter = {
getAngleOutput
(
prpOutput
,
isDegree
)
{
getAngleOutput
(
prpOutput
,
isDegree
)
{
if
(
prpOutput
){
if
(
prpOutput
){
const
splitOutput
=
prpOutput
.
split
(
'
:
'
);
const
splitOutput
=
prpOutput
.
split
(
'
:
'
);
const
milliSeconds
=
prpOutput
.
split
(
'
.
'
)[
1
]
||
'
0000
'
;
if
(
isDegree
)
{
if
(
isDegree
)
{
return
((
splitOutput
[
0
]
*
1
+
splitOutput
[
1
]
/
60
+
splitOutput
[
2
]
/
3600
+
splitOutput
[
3
]
/
3600000
)
*
Math
.
PI
/
180
);
return
((
splitOutput
[
0
]
*
1
+
splitOutput
[
1
]
/
60
+
splitOutput
[
2
]
.
split
(
'
.
'
)[
0
]
/
3600
+
milliSeconds
/
3600000
0
)
*
Math
.
PI
/
180
);
}
else
{
}
else
{
return
((
splitOutput
[
0
]
*
15
+
splitOutput
[
1
]
/
4
+
splitOutput
[
2
]
/
240
+
splitOutput
[
3
]
/
240000
)
*
Math
.
PI
/
180
);
return
((
splitOutput
[
0
]
*
15
+
splitOutput
[
1
]
/
4
+
splitOutput
[
2
]
/
240
+
splitOutput
[
3
]
/
240000
0
)
*
Math
.
PI
/
180
);
}
}
}
else
{
}
else
{
return
"
00:00:00.0000
"
;
return
"
00:00:00.0000
"
;
}
}
},
/**
* Function to add leading zeros in end
* @param {*} number
* @param {*} digits
*/
padDigits
(
number
,
digits
)
{
return
number
+
Array
(
Math
.
max
(
digits
-
String
(
number
).
length
+
1
,
0
)).
join
(
0
);
}
}
};
};
...
...
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