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
969b0424
Commit
969b0424
authored
Mar 04, 2019
by
Filipa Lacerda
Committed by
Phil Hughes
Mar 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Creates a function to check if repo is EE
Adds EE information to gon Creates a global vue mixin
parent
437adb57
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
45 additions
and
0 deletions
+45
-0
app/assets/javascripts/lib/utils/common_utils.js
app/assets/javascripts/lib/utils/common_utils.js
+8
-0
app/assets/javascripts/vue_shared/mixins/is_ee.js
app/assets/javascripts/vue_shared/mixins/is_ee.js
+10
-0
changelogs/unreleased/8711-prep-frontend-single-repo.yml
changelogs/unreleased/8711-prep-frontend-single-repo.yml
+5
-0
lib/gitlab.rb
lib/gitlab.rb
+4
-0
lib/gitlab/gon_helper.rb
lib/gitlab/gon_helper.rb
+1
-0
spec/javascripts/test_bundle.js
spec/javascripts/test_bundle.js
+3
-0
spec/lib/gitlab_spec.rb
spec/lib/gitlab_spec.rb
+14
-0
No files found.
app/assets/javascripts/lib/utils/common_utils.js
View file @
969b0424
...
...
@@ -708,6 +708,14 @@ export const NavigationType = {
TYPE_RESERVED
:
255
,
};
/**
* Returns the value of `gon.ee`
* Used to check if it's the EE codebase or the CE one.
*
* @returns Boolean
*/
export
const
isEE
=
()
=>
window
.
gon
&&
window
.
gon
.
ee
;
window
.
gl
=
window
.
gl
||
{};
window
.
gl
.
utils
=
{
...(
window
.
gl
.
utils
||
{}),
...
...
app/assets/javascripts/vue_shared/mixins/is_ee.js
0 → 100644
View file @
969b0424
import
Vue
from
'
vue
'
;
import
{
isEE
}
from
'
~/lib/utils/common_utils
'
;
Vue
.
mixin
({
computed
:
{
isEE
()
{
return
isEE
();
},
},
});
changelogs/unreleased/8711-prep-frontend-single-repo.yml
0 → 100644
View file @
969b0424
---
title
:
Creates a helper function to check if repo is EE
merge_request
:
25647
author
:
type
:
other
lib/gitlab.rb
View file @
969b0424
...
...
@@ -58,6 +58,10 @@ module Gitlab
Rails
.
env
.
development?
||
org?
||
com?
end
def
self
.
ee?
Object
.
const_defined?
(
:License
)
end
def
self
.
process_name
return
'sidekiq'
if
Sidekiq
.
server?
return
'console'
if
defined?
(
Rails
::
Console
)
...
...
lib/gitlab/gon_helper.rb
View file @
969b0424
...
...
@@ -25,6 +25,7 @@ module Gitlab
gon
.
test_env
=
Rails
.
env
.
test?
gon
.
suggested_label_colors
=
LabelsHelper
.
suggested_colors
gon
.
first_day_of_week
=
current_user
&
.
first_day_of_week
||
Gitlab
::
CurrentSettings
.
first_day_of_week
gon
.
ee
=
Gitlab
.
ee?
if
current_user
gon
.
current_user_id
=
current_user
.
id
...
...
spec/javascripts/test_bundle.js
View file @
969b0424
...
...
@@ -8,6 +8,7 @@ import '~/commons';
import
Vue
from
'
vue
'
;
import
VueResource
from
'
vue-resource
'
;
import
Translate
from
'
~/vue_shared/translate
'
;
import
CheckEE
from
'
~/vue_shared/mixins/is_ee
'
;
import
jasmineDiff
from
'
jasmine-diff
'
;
import
{
getDefaultAdapter
}
from
'
~/lib/utils/axios_utils
'
;
...
...
@@ -43,6 +44,7 @@ Vue.config.errorHandler = function(err) {
Vue
.
use
(
VueResource
);
Vue
.
use
(
Translate
);
Vue
.
use
(
CheckEE
);
// enable test fixtures
jasmine
.
getFixtures
().
fixturesPath
=
FIXTURES_PATH
;
...
...
@@ -67,6 +69,7 @@ window.gl = window.gl || {};
window
.
gl
.
TEST_HOST
=
TEST_HOST
;
window
.
gon
=
window
.
gon
||
{};
window
.
gon
.
test_env
=
true
;
window
.
gon
.
ee
=
false
;
gon
.
relative_url_root
=
''
;
let
hasUnhandledPromiseRejections
=
false
;
...
...
spec/lib/gitlab_spec.rb
View file @
969b0424
...
...
@@ -95,4 +95,18 @@ describe Gitlab do
expect
(
described_class
.
com?
).
to
eq
false
end
end
describe
'.ee?'
do
it
'returns true when using Enterprise Edition'
do
stub_const
(
'License'
,
Class
.
new
)
expect
(
described_class
.
ee?
).
to
eq
(
true
)
end
it
'returns false when using Community Edition'
do
hide_const
(
'License'
)
expect
(
described_class
.
ee?
).
to
eq
(
false
)
end
end
end
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