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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
ce4dd19e
Commit
ce4dd19e
authored
Mar 01, 2018
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
migrate stl_viewer to dynamic import
parent
9d9d0105
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
6 deletions
+5
-6
app/assets/javascripts/blob/stl_viewer.js
app/assets/javascripts/blob/stl_viewer.js
+2
-2
app/assets/javascripts/blob/viewer/index.js
app/assets/javascripts/blob/viewer/index.js
+3
-0
app/views/projects/blob/viewers/_stl.html.haml
app/views/projects/blob/viewers/_stl.html.haml
+0
-3
config/webpack.config.js
config/webpack.config.js
+0
-1
No files found.
app/assets/javascripts/blob/stl_viewer.js
View file @
ce4dd19e
import
Renderer
from
'
./3d_viewer
'
;
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
export
default
()
=>
{
const
viewer
=
new
Renderer
(
document
.
getElementById
(
'
js-stl-viewer
'
));
[].
slice
.
call
(
document
.
querySelectorAll
(
'
.js-material-changer
'
)).
forEach
((
el
)
=>
{
...
...
@@ -16,4 +16,4 @@ document.addEventListener('DOMContentLoaded', () => {
viewer
.
changeObjectMaterials
(
target
.
dataset
.
type
);
});
});
}
)
;
};
app/assets/javascripts/blob/viewer/index.js
View file @
ce4dd19e
...
...
@@ -41,6 +41,9 @@ export default class BlobViewer {
case
'
sketch
'
:
initViewer
(
import
(
/* webpackChunkName: 'sketch_viewer' */
'
../sketch_viewer
'
));
break
;
case
'
stl
'
:
initViewer
(
import
(
/* webpackChunkName: 'stl_viewer' */
'
../stl_viewer
'
));
break
;
default
:
break
;
}
...
...
app/views/projects/blob/viewers/_stl.html.haml
View file @
ce4dd19e
-
content_for
:page_specific_javascripts
do
=
webpack_bundle_tag
(
'stl_viewer'
)
.file-content.is-stl-loading
.text-center
#js-stl-viewer
{
data:
{
endpoint:
blob_raw_path
}
}
=
icon
(
'spinner spin 2x'
,
class:
'prepend-top-default append-bottom-default'
,
'aria-hidden'
=>
'true'
,
'aria-label'
=>
'Loading'
)
...
...
config/webpack.config.js
View file @
ce4dd19e
...
...
@@ -47,7 +47,6 @@ function generateEntries() {
mr_notes
:
'
./mr_notes/index.js
'
,
protected_branches
:
'
./protected_branches
'
,
registry_list
:
'
./registry/index.js
'
,
stl_viewer
:
'
./blob/stl_viewer.js
'
,
terminal
:
'
./terminal/terminal_bundle.js
'
,
two_factor_auth
:
'
./two_factor_auth.js
'
,
...
...
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