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
f84b69de
Commit
f84b69de
authored
3 years ago
by
Muthukrishnanmatriot
Browse files
Options
Downloads
Patches
Plain Diff
TMSS-997
- updated the code for copy to clipboard function
parent
0cd27c9d
No related branches found
No related tags found
2 merge requests
!634
WIP: COBALT commissioning delta
,
!573
Resolve TMSS-997
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
SAS/TMSS/frontend/tmss_webapp/src/layout/_overrides.scss
+2
-2
2 additions, 2 deletions
SAS/TMSS/frontend/tmss_webapp/src/layout/_overrides.scss
SAS/TMSS/frontend/tmss_webapp/src/show.error.details.js
+29
-2
29 additions, 2 deletions
SAS/TMSS/frontend/tmss_webapp/src/show.error.details.js
with
31 additions
and
4 deletions
SAS/TMSS/frontend/tmss_webapp/src/layout/_overrides.scss
+
2
−
2
View file @
f84b69de
...
@@ -199,6 +199,7 @@
...
@@ -199,6 +199,7 @@
}
}
.p-growl
{
.p-growl
{
z-index
:
3000
!
important
;
z-index
:
3000
!
important
;
width
:
40em
;
}
}
.viewtable
.p-hidden-accessible
{
.viewtable
.p-hidden-accessible
{
position
:
relative
;
position
:
relative
;
...
@@ -282,9 +283,8 @@ In Excel View the for Accordion background color override
...
@@ -282,9 +283,8 @@ In Excel View the for Accordion background color override
padding-left
:
10px
;
padding-left
:
10px
;
background-color
:
black
;
background-color
:
black
;
margin-left
:
-3px
;
margin-left
:
-3px
;
}
}
.show_error
{
.show_error
{
width
:
40em
;
margin-left
:
67em
;
margin-left
:
67em
;
height
:
auto
!
important
;
height
:
auto
!
important
;
}
}
...
...
This diff is collapsed.
Click to expand it.
SAS/TMSS/frontend/tmss_webapp/src/show.error.details.js
+
29
−
2
View file @
f84b69de
import
React
,
{
Component
}
from
'
react
'
;
import
React
,
{
Component
}
from
'
react
'
;
import
UIConstants
from
'
./utils/ui.constants
'
;
import
UIConstants
from
'
./utils/ui.constants
'
;
import
{
Growl
}
from
'
primereact/components/growl/Growl
'
;
export
class
ShowErrorDetails
extends
Component
{
export
class
ShowErrorDetails
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
...
@@ -9,6 +10,7 @@ export class ShowErrorDetails extends Component {
...
@@ -9,6 +10,7 @@ export class ShowErrorDetails extends Component {
showDetails
:
false
showDetails
:
false
}
}
this
.
showHideErrorDetails
=
this
.
showHideErrorDetails
.
bind
(
this
);
this
.
showHideErrorDetails
=
this
.
showHideErrorDetails
.
bind
(
this
);
this
.
copyErrorDetailsToClipboard
=
this
.
copyErrorDetailsToClipboard
.
bind
(
this
);
}
}
/**
/**
...
@@ -30,23 +32,48 @@ export class ShowErrorDetails extends Component {
...
@@ -30,23 +32,48 @@ export class ShowErrorDetails extends Component {
}
}
}
}
/**
* Copy the error details to clipboard
*/
async
copyErrorDetailsToClipboard
()
{
try
{
const
queryOpts
=
{
name
:
'
clipboard-write
'
,
allowWithoutGesture
:
true
};
await
navigator
.
permissions
.
query
(
queryOpts
);
await
navigator
.
clipboard
.
writeText
(
this
.
props
.
response
.
request
.
response
);
}
catch
(
error
)
{
try
{
const
elem
=
document
.
createElement
(
'
textarea
'
);
elem
.
value
=
this
.
props
.
response
.
request
.
response
;
document
.
body
.
appendChild
(
elem
);
elem
.
select
();
document
.
execCommand
(
'
copy
'
);
document
.
body
.
removeChild
(
elem
);
}
catch
(
error
)
{
this
.
growl
.
show
({
severity
:
'
error
'
,
summary
:
'
Warning
'
,
detail
:
'
Unable to copy the data to clipboard
'
});
}
}
this
.
growl
.
show
({
severity
:
'
success
'
,
summary
:
''
,
detail
:
'
Error details is copied to clipboard
'
});
}
render
()
{
render
()
{
const
httpStatusMsg
=
UIConstants
.
httpStatusMessages
[
this
.
props
.
response
.
status
];
const
httpStatusMsg
=
UIConstants
.
httpStatusMessages
[
this
.
props
.
response
.
status
];
const
data
=
httpStatusMsg
?
httpStatusMsg
.
detail
:
''
;
const
data
=
httpStatusMsg
?
httpStatusMsg
.
detail
:
''
;
var
message
=
'
[
'
+
this
.
props
.
response
.
status
+
'
]
'
+
JSON
.
stringify
(
this
.
props
.
response
.
statusText
)
+
'
[
'
+
data
+
'
]
'
;
var
message
=
'
[
'
+
this
.
props
.
response
.
status
+
'
]
'
+
JSON
.
stringify
(
this
.
props
.
response
.
statusText
)
+
'
[
'
+
data
+
'
]
'
;
return
(
return
(
<
div
>
<
div
>
<
Growl
ref
=
{(
el
)
=>
this
.
growl
=
el
}
/
>
<
div
>
<
div
>
{
message
}
{
message
}
<
/div
>
<
/div
>
<
div
>
<
div
>
<
div
className
=
"
show_error_hide
"
>
<
div
className
=
"
show_error_hide
"
>
<
a
href
=
'
#
'
onClick
=
{
this
.
showHideErrorDetails
}
>
{
this
.
state
.
buttonLabel
}
<
/a
>
<
a
href
=
'
#
'
onClick
=
{
this
.
showHideErrorDetails
}
>
{
this
.
state
.
buttonLabel
}
<
/a
>
<
a
href
=
'
#
'
onClick
=
{
this
.
copyErrorDetailsToClipboard
}
style
=
{{
marginLeft
:
'
1em
'
}}
title
=
"
Copy the error details to clipboard
"
>
<
i
class
=
"
fas fa-copy
"
><
/i> </
a
>
<
/div
>
<
/div
>
{
this
.
state
.
showDetails
&&
{
this
.
state
.
showDetails
&&
<
div
>
<
div
>
<
p
style
=
{{
fontWeight
:
'
bold
'
}}
>
Error
Details
:
<
/p
>
<
p
style
=
{{
fontWeight
:
'
bold
'
}}
>
Error
Details
:
<
/p
>
<
div
className
=
"
show_error_details
"
>
<
div
id
=
"
showError
"
className
=
"
show_error_details
"
>
{
this
.
props
.
response
.
request
.
response
}
{
this
.
props
.
response
.
request
.
response
}
<
/div
>
<
/div
>
<
/div
>
<
/div
>
...
...
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