Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
e8949a1e
Commit
e8949a1e
authored
Mar 22, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated notebooklab library
Added error handling [ci skip]
parent
313258fa
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1779 additions
and
196 deletions
+1779
-196
app/assets/javascripts/blob/notebook_viewer.js
app/assets/javascripts/blob/notebook_viewer.js
+40
-16
vendor/assets/javascripts/notebooklab.js
vendor/assets/javascripts/notebooklab.js
+1739
-180
No files found.
app/assets/javascripts/blob/notebook_viewer.js
View file @
e8949a1e
...
@@ -5,11 +5,7 @@ import NotebookLab from 'vendor/notebooklab';
...
@@ -5,11 +5,7 @@ import NotebookLab from 'vendor/notebooklab';
Vue
.
use
(
VueResource
);
Vue
.
use
(
VueResource
);
Vue
.
use
(
NotebookLab
);
Vue
.
use
(
NotebookLab
);
Vue
.
config
.
errorHandler
=
(
err
)
=>
{
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
console
.
log
(
err
);
}
$
(()
=>
{
const
el
=
document
.
getElementById
(
'
js-notebook-viewer
'
);
const
el
=
document
.
getElementById
(
'
js-notebook-viewer
'
);
new
Vue
({
new
Vue
({
...
@@ -17,21 +13,53 @@ $(() => {
...
@@ -17,21 +13,53 @@ $(() => {
data
()
{
data
()
{
return
{
return
{
error
:
false
,
error
:
false
,
loadError
:
false
,
loading
:
true
,
loading
:
true
,
json
:
{},
json
:
{},
};
};
},
},
template
:
`
template
:
`
<div class="container-fluid">
<div class="container-fluid md prepend-top-default append-bottom-default">
<i
<div
class="fa fa-spinner fa-spin"
class="text-center loading"
v-if="loading">
v-if="loading && !error">
</i>
<i
class="fa fa-spinner fa-spin"
aria-hidden="true"
aria-label="iPython notebook loading">
</i>
</div>
<notebook-lab
<notebook-lab
v-if="!loading"
v-if="!loading
&& !error
"
:notebook="json" />
:notebook="json" />
<p
class="text-center"
v-if="error">
<span v-if="loadError">
An error occured whilst loading the file. Please try again later.
</span>
<span v-else>
An error occured whilst parsing the file.
</span>
</p>
</div>
</div>
`
,
`
,
methods
:
{
loadFile
()
{
this
.
$http
.
get
(
el
.
dataset
.
endpoint
)
.
then
((
res
)
=>
{
this
.
json
=
res
.
json
();
this
.
loading
=
false
;
})
.
catch
((
e
)
=>
{
if
(
e
.
status
)
{
this
.
loadError
=
true
;
}
this
.
error
=
true
;
});
},
},
mounted
()
{
mounted
()
{
$
(
'
<link>
'
,
{
$
(
'
<link>
'
,
{
rel
:
'
stylesheet
'
,
rel
:
'
stylesheet
'
,
...
@@ -40,11 +68,7 @@ $(() => {
...
@@ -40,11 +68,7 @@ $(() => {
}).
appendTo
(
'
head
'
);
}).
appendTo
(
'
head
'
);
$
.
getScript
(
gon
.
katex_js_url
,
()
=>
{
$
.
getScript
(
gon
.
katex_js_url
,
()
=>
{
this
.
$http
.
get
(
el
.
dataset
.
endpoint
)
this
.
loadFile
();
.
then
((
res
)
=>
{
this
.
json
=
res
.
json
();
this
.
loading
=
false
;
});
});
});
},
},
});
});
...
...
vendor/assets/javascripts/notebooklab.js
View file @
e8949a1e
This diff is collapsed.
Click to expand it.
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