Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
238d9c7b
Commit
238d9c7b
authored
Sep 01, 2017
by
Piotr Gawron
Browse files
when there is a problem with uploading data then info in Gui appears
parent
96b3d0c1
Changes
7
Hide whitespace changes
Inline
Side-by-side
frontend-js/.gitignore
View file @
238d9c7b
.idea/workspace.xml
/dist/
/coverage/
/node_modules/
...
...
frontend-js/.idea/frontend-js.iml
0 → 100644
View file @
238d9c7b
<?xml version="1.0" encoding="UTF-8"?>
<module
type=
"WEB_MODULE"
version=
"4"
>
<component
name=
"NewModuleRootManager"
>
<content
url=
"file://$MODULE_DIR$"
>
<excludeFolder
url=
"file://$MODULE_DIR$/.tmp"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/temp"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/tmp"
/>
</content>
<orderEntry
type=
"inheritedJdk"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
</component>
</module>
\ No newline at end of file
frontend-js/.idea/modules.xml
0 → 100644
View file @
238d9c7b
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ProjectModuleManager"
>
<modules>
<module
fileurl=
"file://$PROJECT_DIR$/.idea/frontend-js.iml"
filepath=
"$PROJECT_DIR$/.idea/frontend-js.iml"
/>
</modules>
</component>
</project>
\ No newline at end of file
frontend-js/.idea/vcs.xml
0 → 100644
View file @
238d9c7b
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"VcsDirectoryMappings"
>
<mapping
directory=
"$PROJECT_DIR$/.."
vcs=
"Git"
/>
</component>
</project>
\ No newline at end of file
frontend-js/src/main/js/GuiConnector.js
View file @
238d9c7b
...
...
@@ -4,6 +4,7 @@ var logger = require('./logger');
var
Functions
=
require
(
'
./Functions
'
);
var
SecurityError
=
require
(
'
./SecurityError
'
);
var
NetworkError
=
require
(
'
./NetworkError
'
);
/**
* This static global object contains set of functions that returns/set data in
...
...
@@ -25,11 +26,11 @@ GuiConnector.yPos = 0;
* List of GET params passed via url.
*/
GuiConnector
.
init
=
function
()
{
GuiConnector
.
init
=
function
()
{
var
self
=
this
;
if
(
!
String
.
prototype
.
endsWith
)
{
String
.
prototype
.
endsWith
=
function
(
pattern
)
{
String
.
prototype
.
endsWith
=
function
(
pattern
)
{
var
d
=
this
.
length
-
pattern
.
length
;
return
d
>=
0
&&
this
.
lastIndexOf
(
pattern
)
===
d
;
};
...
...
@@ -40,7 +41,7 @@ GuiConnector.init = function() {
alert
(
"
This webpage works well with Chrome, Firefox and Safari.
"
);
}
// bootstrap tab initialization
$
(
"
ul.nav-tabs a
"
).
click
(
function
(
e
)
{
$
(
"
ul.nav-tabs a
"
).
click
(
function
(
e
)
{
e
.
preventDefault
();
$
(
this
).
tab
(
'
show
'
);
});
...
...
@@ -48,16 +49,17 @@ GuiConnector.init = function() {
self
.
getParams
=
[];
// find GuiConnector.getParams
window
.
location
.
search
.
replace
(
/
\??(?:([^
=
]
+
)
=
([^
&
]
*
)
&
?)
/g
,
function
()
{
window
.
location
.
search
.
replace
(
/
\??(?:([^
=
]
+
)
=
([^
&
]
*
)
&
?)
/g
,
function
()
{
function
decode
(
s
)
{
return
decodeURIComponent
(
s
.
split
(
"
+
"
).
join
(
"
"
));
}
GuiConnector
.
getParams
[
decode
(
arguments
[
1
])]
=
decode
(
arguments
[
2
]);
});
// forser browser to update mouse coordinates whenever mouse move
jQuery
(
document
).
ready
(
function
()
{
$
(
document
).
mousemove
(
function
(
e
)
{
jQuery
(
document
).
ready
(
function
()
{
$
(
document
).
mousemove
(
function
(
e
)
{
GuiConnector
.
updateMouseCoordinates
(
e
.
pageX
,
e
.
pageY
);
});
});
...
...
@@ -69,7 +71,7 @@ GuiConnector.init = function() {
self
.
addWindowResizeEvent
(
window
.
onresize
);
}
window
.
onresize
=
function
()
{
window
.
onresize
=
function
()
{
for
(
var
i
=
0
;
i
<
self
.
_windowResizeEvents
.
length
;
i
++
)
{
self
.
_windowResizeEvents
[
i
]();
}
...
...
@@ -77,18 +79,18 @@ GuiConnector.init = function() {
}
};
GuiConnector
.
addWindowResizeEvent
=
function
(
handler
)
{
GuiConnector
.
addWindowResizeEvent
=
function
(
handler
)
{
this
.
_windowResizeEvents
.
push
(
handler
);
};
/**
* Returns name of the file with LCSB logo.
*
*
* @param bigLogo
* {@link Boolean} value determining if we want to have big logo or
* small one
*/
GuiConnector
.
getLcsbLogoImg
=
function
(
bigLogo
)
{
GuiConnector
.
getLcsbLogoImg
=
function
(
bigLogo
)
{
if
(
bigLogo
)
{
return
'
lcsb_logo_mid.png
'
;
}
else
{
...
...
@@ -100,26 +102,26 @@ GuiConnector.getLcsbLogoImg = function(bigLogo) {
* Returns name of the file with image that should be presented when we are
* wainting for data to be loaded.
*/
GuiConnector
.
getLoadingImg
=
function
()
{
GuiConnector
.
getLoadingImg
=
function
()
{
return
"
icons/ajax-loader.gif
"
;
};
/**
* Returns home directory for images in the application.
*/
GuiConnector
.
getImgPrefix
=
function
()
{
GuiConnector
.
getImgPrefix
=
function
()
{
return
"
resources/images/
"
;
};
/**
* Updates coordinates of the mouse in the browser.
*/
GuiConnector
.
updateMouseCoordinates
=
function
(
x
,
y
)
{
GuiConnector
.
updateMouseCoordinates
=
function
(
x
,
y
)
{
this
.
xPos
=
x
;
this
.
yPos
=
y
;
};
GuiConnector
.
showProcessing
=
function
(
messageText
)
{
GuiConnector
.
showProcessing
=
function
(
messageText
)
{
var
self
=
GuiConnector
;
if
(
self
.
_processingDialog
===
undefined
)
{
self
.
_processingDialog
=
document
.
createElement
(
"
div
"
);
...
...
@@ -127,11 +129,11 @@ GuiConnector.showProcessing = function(messageText) {
self
.
_processingDialog
.
appendChild
(
self
.
_errorDialogContent
);
document
.
body
.
appendChild
(
self
.
_processingDialog
);
$
(
self
.
_processingDialog
).
dialog
({
modal
:
true
,
title
:
"
PROCESSING
"
,
width
:
"
150px
"
,
closeOnEscape
:
false
,
open
:
function
(
event
,
ui
)
{
modal
:
true
,
title
:
"
PROCESSING
"
,
width
:
"
150px
"
,
closeOnEscape
:
false
,
open
:
function
(
event
,
ui
)
{
$
(
"
.ui-dialog-titlebar-close
"
,
ui
).
hide
();
},
});
...
...
@@ -140,8 +142,8 @@ GuiConnector.showProcessing = function(messageText) {
messageText
=
"
PROCESSING
"
;
}
var
messageImg
=
Functions
.
createElement
({
type
:
"
img
"
,
src
:
'
resources/images/icons/ajax-loader.gif
'
,
type
:
"
img
"
,
src
:
'
resources/images/icons/ajax-loader.gif
'
,
});
self
.
_errorDialogContent
.
innerHTML
=
""
;
self
.
_errorDialogContent
.
style
.
textAlign
=
"
center
"
;
...
...
@@ -152,12 +154,12 @@ GuiConnector.showProcessing = function(messageText) {
$
(
self
.
_processingDialog
).
dialog
(
"
open
"
);
};
GuiConnector
.
hideProcessing
=
function
()
{
GuiConnector
.
hideProcessing
=
function
()
{
var
self
=
GuiConnector
;
$
(
self
.
_processingDialog
).
dialog
(
"
close
"
);
};
GuiConnector
.
alert
=
function
(
error
)
{
GuiConnector
.
alert
=
function
(
error
)
{
var
self
=
GuiConnector
;
logger
.
error
(
error
);
if
(
self
.
_errorDialog
===
undefined
)
{
...
...
@@ -166,18 +168,20 @@ GuiConnector.alert = function(error) {
self
.
_errorDialog
.
appendChild
(
self
.
_errorDialogContent
);
document
.
body
.
appendChild
(
self
.
_errorDialog
);
$
(
self
.
_errorDialog
).
dialog
({
classes
:
{
"
ui-dialog
"
:
"
ui-state-error
"
classes
:
{
"
ui-dialog
"
:
"
ui-state-error
"
},
modal
:
true
,
title
:
"
ERROR
"
modal
:
true
,
title
:
"
ERROR
"
}).
siblings
(
'
.ui-dialog-titlebar
'
).
css
(
"
background
"
,
"
red
"
);
}
var
message
=
error
;
if
(
message
instanceof
SecurityError
)
{
message
=
error
.
message
+
"
<p>Please <a href=
\"
login.xhtml
\"
>login</a> to access this resuorce</p>
"
;
message
=
error
.
message
+
"
<p>Please <a href=
\"
login.xhtml
\"
>login</a> to access this resource</p>
"
;
}
else
if
(
message
instanceof
NetworkError
&&
(
error
.
message
===
"
XHR error
"
||
error
.
message
===
"
Failed to fetch
"
))
{
message
=
"
File to big.<br>Please reduce file size or contact administrators.
"
;
}
else
if
(
message
instanceof
Error
)
{
message
=
"
Unexpected error occured:<p>
"
+
error
.
message
+
"
</p>
"
;
message
=
"
Unexpected error occur
r
ed:<p>
"
+
error
.
message
+
"
</p>
"
;
}
self
.
_errorDialogContent
.
innerHTML
=
message
;
$
(
self
.
_errorDialog
).
dialog
(
"
open
"
);
...
...
frontend-js/src/main/js/ServerConnector.js
View file @
238d9c7b
...
...
@@ -155,7 +155,7 @@ ServerConnector.sendPostRequest = function (url, params) {
form
:
params
},
function
(
error
,
response
,
body
)
{
if
(
error
)
{
reject
(
new
NetworkError
(
error
,
{
reject
(
new
NetworkError
(
error
.
message
,
{
content
:
body
,
url
:
url
}));
...
...
frontend-js/src/main/js/gui/leftPanel/OverlayPanel.js
View file @
238d9c7b
...
...
@@ -449,7 +449,7 @@ OverlayPanel.prototype.openAddOverlayDialog = function () {
}
}
if
(
fileContent
===
null
)
{
GuiConnector
.
alert
(
"
Neither file was selected nor data was enterd
"
);
GuiConnector
.
alert
(
"
Neither file was selected nor data was enter
e
d
"
);
}
else
{
var
data
=
{
name
:
nameInput
.
value
,
...
...
@@ -466,15 +466,11 @@ OverlayPanel.prototype.openAddOverlayDialog = function () {
$
(
dialog
).
dialog
(
"
close
"
);
},
function
(
error
)
{
GuiConnector
.
hideProcessing
();
if
(
error
instanceof
NetworkError
)
{
if
(
error
.
statusCode
===
HttpStatus
.
BAD_REQUEST
)
{
var
errorMessage
=
JSON
.
parse
(
error
.
content
);
GuiConnector
.
alert
(
"
Problematic input: <br/>
"
+
errorMessage
.
reason
);
}
else
{
throw
error
;
}
if
(
error
instanceof
NetworkError
&&
error
.
statusCode
===
HttpStatus
.
BAD_REQUEST
)
{
var
errorMessage
=
JSON
.
parse
(
error
.
content
);
GuiConnector
.
alert
(
"
Problematic input: <br/>
"
+
errorMessage
.
reason
);
}
else
{
throw
error
;
GuiConnector
.
alert
(
error
)
;
}
});
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment