Skip to content
Snippets Groups Projects
Unverified Commit 7ca77203 authored by Lukas Eipert's avatar Lukas Eipert
Browse files

Replace runtime isEE check with compile time one

This has the benefit that CE bundles will remove dead code in CE only
builds.

We have a follow-up issue to get rid of this completely:

https://gitlab.com/gitlab-org/gitlab-ce/issues/64173
parent de6c2f70
No related branches found
No related tags found
No related merge requests found
Showing
with 25 additions and 41 deletions
Loading
Loading
@@ -5,6 +5,7 @@ globals:
gl: false
gon: false
localStorage: false
IS_EE: false
plugins:
- import
- html
Loading
Loading
Loading
Loading
@@ -2,7 +2,6 @@ import IssuableFilteredSearchTokenKeys from 'ee_else_ce/filtered_search/issuable
import FilteredSearchContainer from '../filtered_search/container';
import FilteredSearchManager from '../filtered_search/filtered_search_manager';
import boardsStore from './stores/boards_store';
import { isEE } from '~/lib/utils/common_utils';
 
export default class FilteredSearchBoards extends FilteredSearchManager {
constructor(store, updateUrl = false, cantEdit = []) {
Loading
Loading
@@ -10,7 +9,7 @@ export default class FilteredSearchBoards extends FilteredSearchManager {
page: 'boards',
isGroupDecendent: true,
stateFiltersSelector: '.issues-state-filters',
isGroup: isEE(),
isGroup: IS_EE,
filteredSearchTokenKeys: IssuableFilteredSearchTokenKeys,
});
 
Loading
Loading
Loading
Loading
@@ -5,7 +5,7 @@
 
import Vue from 'vue';
import './label';
import { isEE, convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import IssueProject from './project';
import boardsStore from '../stores/boards_store';
 
Loading
Loading
@@ -91,13 +91,13 @@ class ListIssue {
 
addMilestone(milestone) {
const miletoneId = this.milestone ? this.milestone.id : null;
if (isEE && milestone.id !== miletoneId) {
if (IS_EE && milestone.id !== miletoneId) {
this.milestone = new ListMilestone(milestone);
}
}
 
removeMilestone(removeMilestone) {
if (isEE && removeMilestone && removeMilestone.id === this.milestone.id) {
if (IS_EE && removeMilestone && removeMilestone.id === this.milestone.id) {
this.milestone = {};
}
}
Loading
Loading
Loading
Loading
@@ -4,7 +4,7 @@
import { __ } from '~/locale';
import ListLabel from './label';
import ListAssignee from './assignee';
import { isEE, urlParamsToObject } from '~/lib/utils/common_utils';
import { urlParamsToObject } from '~/lib/utils/common_utils';
import boardsStore from '../stores/boards_store';
import ListMilestone from './milestone';
 
Loading
Loading
@@ -58,7 +58,7 @@ class List {
} else if (obj.user) {
this.assignee = new ListAssignee(obj.user);
this.title = this.assignee.name;
} else if (isEE && obj.milestone) {
} else if (IS_EE && obj.milestone) {
this.milestone = new ListMilestone(obj.milestone);
this.title = this.milestone.title;
}
Loading
Loading
@@ -85,7 +85,7 @@ class List {
entityType = 'label_id';
} else if (this.assignee) {
entityType = 'assignee_id';
} else if (isEE && this.milestone) {
} else if (IS_EE && this.milestone) {
entityType = 'milestone_id';
}
 
Loading
Loading
@@ -205,7 +205,7 @@ class List {
issue.addAssignee(this.assignee);
}
 
if (isEE && this.milestone) {
if (IS_EE && this.milestone) {
if (listFrom && listFrom.type === 'milestone') {
issue.removeMilestone(listFrom.milestone);
}
Loading
Loading
import { isEE } from '~/lib/utils/common_utils';
export default class ListMilestone {
constructor(obj) {
this.id = obj.id;
this.title = obj.title;
 
if (isEE) {
if (IS_EE) {
this.path = obj.path;
this.state = obj.state;
this.webUrl = obj.web_url || obj.webUrl;
Loading
Loading
// Noop function which has a EE counter-part
export default () => {};
Loading
Loading
@@ -11,7 +11,7 @@ import CreateLabelDropdown from './create_label';
import flash from './flash';
import ModalStore from './boards/stores/modal_store';
import boardsStore from './boards/stores/boards_store';
import { isEE, isScopedLabel } from '~/lib/utils/common_utils';
import { isScopedLabel } from '~/lib/utils/common_utils';
 
export default class LabelsSelect {
constructor(els, options = {}) {
Loading
Loading
@@ -140,7 +140,7 @@ export default class LabelsSelect {
labelCount = data.labels.length;
 
// EE Specific
if (isEE) {
if (IS_EE) {
/**
* For Scoped labels, the last label selected with the
* same key will be applied to the current issueable.
Loading
Loading
Loading
Loading
@@ -726,14 +726,6 @@ 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;
/**
* Checks if the given Label has a special syntax `::` in
* it's title.
Loading
Loading
Loading
Loading
@@ -4,7 +4,6 @@ import _ from 'underscore';
import { mapActions, mapState } from 'vuex';
import { s__ } from '~/locale';
import Icon from '~/vue_shared/components/icon.vue';
import '~/vue_shared/mixins/is_ee';
import { getParameterValues } from '~/lib/utils/url_utility';
import invalidUrl from '~/lib/utils/invalid_url';
import MonitorAreaChart from './charts/area.vue';
Loading
Loading
@@ -160,6 +159,12 @@ export default {
selectedDashboardText() {
return this.currentDashboard || (this.allDashboards[0] && this.allDashboards[0].display_name);
},
addingMetricsAvailable() {
return IS_EE && this.canAddMetrics && !this.showEmptyState;
},
alertWidgetAvailable() {
return IS_EE && this.prometheusAlertsAvailable && this.alertsEndpoint;
},
},
created() {
this.setEndpoints({
Loading
Loading
@@ -313,7 +318,7 @@ export default {
</div>
</div>
<div class="d-flex">
<div v-if="isEE && canAddMetrics && !showEmptyState">
<div v-if="addingMetricsAvailable">
<gl-button
v-gl-modal-directive="$options.addMetric.modalId"
class="js-add-metric-button text-success border-success"
Loading
Loading
@@ -372,7 +377,7 @@ export default {
group-id="monitor-area-chart"
>
<alert-widget
v-if="isEE && prometheusAlertsAvailable && alertsEndpoint && graphData"
v-if="alertWidgetAvailable && graphData"
:alerts-endpoint="alertsEndpoint"
:relevant-queries="graphData.queries"
:alerts-to-manage="getGraphAlerts(graphData.queries)"
Loading
Loading
import Vue from 'vue';
import { isEE } from '~/lib/utils/common_utils';
import initNoteStats from 'ee_else_ce/event_tracking/notes';
import notesApp from './components/notes_app.vue';
import initDiscussionFilters from './discussion_filters';
Loading
Loading
@@ -41,9 +40,7 @@ document.addEventListener('DOMContentLoaded', () => {
};
},
mounted() {
if (isEE) {
initNoteStats();
}
initNoteStats();
},
render(createElement) {
return createElement('notes-app', {
Loading
Loading
import Vue from 'vue';
import { isEE } from '~/lib/utils/common_utils';
Vue.mixin({
computed: {
isEE() {
return isEE();
},
},
});
Loading
Loading
@@ -322,7 +322,10 @@ module.exports = {
}),
 
new webpack.DefinePlugin({
// This one is used to define window.gon.ee and other things properly in tests:
'process.env.IS_GITLAB_EE': JSON.stringify(IS_EE),
// This one is used to check against "EE" properly in application code
IS_EE: IS_EE ? 'window.gon && window.gon.ee' : JSON.stringify(false),
}),
].filter(Boolean),
 
Loading
Loading
Loading
Loading
@@ -8,7 +8,6 @@ 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 { config as testUtilsConfig } from '@vue/test-utils';
 
Loading
Loading
@@ -48,7 +47,6 @@ Vue.config.errorHandler = function(err) {
 
Vue.use(VueResource);
Vue.use(Translate);
Vue.use(CheckEE);
 
// enable test fixtures
jasmine.getFixtures().fixturesPath = FIXTURES_PATH;
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment