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
01f8cb8e
Commit
01f8cb8e
authored
Oct 23, 2020
by
Paul Slaughter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch '233447-fix-sourcegraph-not-loading-from-asset-host' into 'master'"
This reverts merge request !45850
parent
5ece8a52
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
70 deletions
+3
-70
app/assets/javascripts/sourcegraph/index.js
app/assets/javascripts/sourcegraph/index.js
+3
-6
spec/frontend/sourcegraph/index_spec.js
spec/frontend/sourcegraph/index_spec.js
+0
-64
No files found.
app/assets/javascripts/sourcegraph/index.js
View file @
01f8cb8e
import
{
joinPaths
}
from
'
~/lib/utils/url_utility
'
;
function
loadScript
(
path
)
{
const
script
=
document
.
createElement
(
'
script
'
);
script
.
type
=
'
application/javascript
'
;
...
...
@@ -19,11 +17,10 @@ export default function initSourcegraph() {
return
;
}
const
base
=
gon
.
asset_host
||
gon
.
gitlab_url
;
const
assetsUrl
=
joinPaths
(
base
,
'
/assets/webpack/sourcegraph/
'
);
const
scriptPath
=
joinPaths
(
assetsUrl
,
'
scripts/integration.bundle.js
'
);
const
assetsUrl
=
new
URL
(
'
/assets/webpack/sourcegraph/
'
,
window
.
location
.
href
);
const
scriptPath
=
new
URL
(
'
scripts/integration.bundle.js
'
,
assetsUrl
).
href
;
window
.
SOURCEGRAPH_ASSETS_URL
=
assetsUrl
;
window
.
SOURCEGRAPH_ASSETS_URL
=
assetsUrl
.
href
;
window
.
SOURCEGRAPH_URL
=
url
;
window
.
SOURCEGRAPH_INTEGRATION
=
'
gitlab-integration
'
;
...
...
spec/frontend/sourcegraph/index_spec.js
deleted
100644 → 0
View file @
5ece8a52
import
initSourcegraph
from
'
~/sourcegraph
'
;
const
TEST_SOURCEGRAPH_URL
=
'
https://sourcegraph.test:9000
'
;
const
TEST_GITLAB_URL
=
'
https://gitlab.example.com/test
'
;
const
TEST_ASSET_HOST
=
'
https://gitlab-assets.example.com/
'
;
describe
(
'
~/sourcegraph/index
'
,
()
=>
{
let
origGon
;
beforeEach
(()
=>
{
origGon
=
window
.
gon
;
window
.
gon
=
{
sourcegraph
:
{},
gitlab_url
:
TEST_GITLAB_URL
,
};
});
afterEach
(()
=>
{
document
.
head
.
innerHTML
=
''
;
document
.
body
.
innerHTML
=
''
;
window
.
gon
=
origGon
;
});
const
findScript
=
()
=>
document
.
querySelector
(
'
script
'
);
it
(
'
with no sourcegraph url, does nothing
'
,
()
=>
{
initSourcegraph
();
expect
(
findScript
()).
toBeNull
();
});
describe
.
each
`
assetHost | assetsUrl | scriptPath
${
null
}
|
${
`
${
TEST_GITLAB_URL
}
/assets/webpack/sourcegraph/`
}
|
${
`
${
TEST_GITLAB_URL
}
/assets/webpack/sourcegraph/scripts/integration.bundle.js`
}
${
TEST_ASSET_HOST
}
|
${
`
${
TEST_ASSET_HOST
}
assets/webpack/sourcegraph/`
}
|
${
`
${
TEST_ASSET_HOST
}
assets/webpack/sourcegraph/scripts/integration.bundle.js`
}
`
(
'
loads sourcegraph (assetHost=$assetHost)
'
,
({
assetHost
,
assetsUrl
,
scriptPath
})
=>
{
beforeEach
(()
=>
{
Object
.
assign
(
window
.
gon
,
{
sourcegraph
:
{
url
:
TEST_SOURCEGRAPH_URL
,
},
asset_host
:
assetHost
,
});
initSourcegraph
();
});
it
(
'
should add sourcegraph config constants to window
'
,
()
=>
{
expect
(
window
).
toMatchObject
({
SOURCEGRAPH_ASSETS_URL
:
assetsUrl
,
SOURCEGRAPH_URL
:
TEST_SOURCEGRAPH_URL
,
SOURCEGRAPH_INTEGRATION
:
'
gitlab-integration
'
,
});
});
it
(
'
should add script tag
'
,
()
=>
{
expect
(
findScript
()).
toMatchObject
({
src
:
scriptPath
,
defer
:
true
,
type
:
'
application/javascript
'
,
});
});
});
});
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