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
eb03035f
Commit
eb03035f
authored
Dec 19, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
EE specific JS modules
parent
f457adeb
Changes
23
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
416 additions
and
363 deletions
+416
-363
app/assets/javascripts/admin_email_select.js
app/assets/javascripts/admin_email_select.js
+0
-87
app/assets/javascripts/application_settings.js
app/assets/javascripts/application_settings.js
+0
-16
app/assets/javascripts/approvals.js
app/assets/javascripts/approvals.js
+0
-70
app/assets/javascripts/boards/components/weight_select.vue
app/assets/javascripts/boards/components/weight_select.vue
+2
-2
app/assets/javascripts/dispatcher.js
app/assets/javascripts/dispatcher.js
+23
-9
app/assets/javascripts/init_issuable_sidebar.js
app/assets/javascripts/init_issuable_sidebar.js
+2
-1
app/assets/javascripts/init_legacy_filters.js
app/assets/javascripts/init_legacy_filters.js
+2
-1
app/assets/javascripts/ldap_groups_select.js
app/assets/javascripts/ldap_groups_select.js
+0
-53
app/assets/javascripts/main.js
app/assets/javascripts/main.js
+4
-7
app/assets/javascripts/path_locks.js
app/assets/javascripts/path_locks.js
+0
-26
app/assets/javascripts/weight_select.js
app/assets/javascripts/weight_select.js
+78
-84
ee/app/assets/javascripts/admin_email_select.js
ee/app/assets/javascripts/admin_email_select.js
+85
-0
ee/app/assets/javascripts/approvals.js
ee/app/assets/javascripts/approvals.js
+66
-0
ee/app/assets/javascripts/approvers_select.js
ee/app/assets/javascripts/approvers_select.js
+1
-1
ee/app/assets/javascripts/audit_logs.js
ee/app/assets/javascripts/audit_logs.js
+3
-3
ee/app/assets/javascripts/ee_trial_banner/ee_trial_banner.js
ee/app/assets/javascripts/ee_trial_banner/ee_trial_banner.js
+0
-0
ee/app/assets/javascripts/ee_trial_banner/index.js
ee/app/assets/javascripts/ee_trial_banner/index.js
+2
-2
ee/app/assets/javascripts/init_geo_info_modal.js
ee/app/assets/javascripts/init_geo_info_modal.js
+0
-0
ee/app/assets/javascripts/init_group_analytics.js
ee/app/assets/javascripts/init_group_analytics.js
+0
-0
ee/app/assets/javascripts/ldap_groups_select.js
ee/app/assets/javascripts/ldap_groups_select.js
+50
-0
ee/app/assets/javascripts/path_locks.js
ee/app/assets/javascripts/path_locks.js
+11
-0
ee/app/assets/javascripts/weight_select.js
ee/app/assets/javascripts/weight_select.js
+86
-0
spec/javascripts/approvers_select_spec.js
spec/javascripts/approvers_select_spec.js
+1
-1
No files found.
app/assets/javascripts/admin_email_select.js
deleted
100644 → 0
View file @
f457adeb
/* eslint-disable no-var, wrap-iife, func-names, space-before-function-paren, camelcase, no-unused-vars, quotes, object-shorthand, one-var, one-var-declaration-per-line, prefer-arrow-callback, comma-dangle, prefer-template, no-else-return, yoda, prefer-rest-params, prefer-spread, max-len */
import
Api
from
'
./api
'
;
var
slice
=
[].
slice
;
window
.
AdminEmailSelect
=
(
function
()
{
function
AdminEmailSelect
()
{
$
(
'
.ajax-admin-email-select
'
).
each
((
function
(
_this
)
{
return
function
(
i
,
select
)
{
var
skip_ldap
;
skip_ldap
=
$
(
select
).
hasClass
(
'
skip_ldap
'
);
return
$
(
select
).
select2
({
placeholder
:
"
Select group or project
"
,
multiple
:
$
(
select
).
hasClass
(
'
multiselect
'
),
minimumInputLength
:
0
,
query
:
function
(
query
)
{
var
group_result
,
project_result
;
group_result
=
Api
.
groups
(
query
.
term
,
{},
function
(
groups
)
{
return
groups
;
});
project_result
=
Api
.
projects
(
query
.
term
,
{
order_by
:
'
id
'
,
membership
:
false
},
function
(
projects
)
{
return
projects
;
});
return
$
.
when
(
project_result
,
group_result
).
done
(
function
(
projects
,
groups
)
{
var
all
,
data
;
all
=
{
id
:
"
all
"
};
data
=
[
all
].
concat
(
groups
[
0
],
projects
[
0
]);
return
query
.
callback
({
results
:
data
});
});
},
id
:
function
(
object
)
{
if
(
object
.
path_with_namespace
)
{
return
"
project-
"
+
object
.
id
;
}
else
if
(
object
.
path
)
{
return
"
group-
"
+
object
.
id
;
}
else
{
return
"
all
"
;
}
},
formatResult
:
function
()
{
var
args
;
args
=
1
<=
arguments
.
length
?
slice
.
call
(
arguments
,
0
)
:
[];
return
_this
.
formatResult
.
apply
(
_this
,
args
);
},
formatSelection
:
function
()
{
var
args
;
args
=
1
<=
arguments
.
length
?
slice
.
call
(
arguments
,
0
)
:
[];
return
_this
.
formatSelection
.
apply
(
_this
,
args
);
},
dropdownCssClass
:
"
ajax-admin-email-dropdown
"
,
escapeMarkup
:
function
(
m
)
{
return
m
;
}
});
};
})(
this
));
}
AdminEmailSelect
.
prototype
.
formatResult
=
function
(
object
)
{
if
(
object
.
path_with_namespace
)
{
return
"
<div class='project-result'> <div class='project-name'>
"
+
object
.
name
+
"
</div> <div class='project-path'>
"
+
object
.
path_with_namespace
+
"
</div> </div>
"
;
}
else
if
(
object
.
path
)
{
return
"
<div class='group-result'> <div class='group-name'>
"
+
object
.
name
+
"
</div> <div class='group-path'>
"
+
object
.
path
+
"
</div> </div>
"
;
}
else
{
return
"
<div class='group-result'> <div class='group-name'>All</div> <div class='group-path'>All groups and projects</div> </div>
"
;
}
};
AdminEmailSelect
.
prototype
.
formatSelection
=
function
(
object
)
{
if
(
object
.
path_with_namespace
)
{
return
"
Project:
"
+
object
.
name
;
}
else
if
(
object
.
path
)
{
return
"
Group:
"
+
object
.
name
;
}
else
{
return
"
All groups and projects
"
;
}
};
return
AdminEmailSelect
;
})();
app/assets/javascripts/application_settings.js
deleted
100644 → 0
View file @
f457adeb
function
ApplicationSettings
()
{
const
usageDataUrl
=
$
(
'
.usage-data
'
).
data
(
'
endpoint
'
);
$
.
ajax
({
type
:
'
GET
'
,
url
:
usageDataUrl
,
dataType
:
'
html
'
,
success
(
html
)
{
$
(
'
.usage-data
'
).
html
(
html
);
},
});
}
window
.
gl
=
window
.
gl
||
{};
window
.
gl
.
ApplicationSettings
=
ApplicationSettings
;
app/assets/javascripts/approvals.js
deleted
100644 → 0
View file @
f457adeb
/* eslint-disable func-names, prefer-arrow-callback, space-before-function-paren, quotes, no-var, comma-spacing, keyword-spacing, one-var, one-var-declaration-per-line, no-unused-vars, camelcase, prefer-template, max-len */
$
(
function
()
{
$
(
"
.approver-list
"
).
on
(
"
click
"
,
"
.unsaved-approvers.approver .btn-remove
"
,
function
(
ev
)
{
var
removeElement
=
$
(
this
).
closest
(
"
li
"
);
var
approverId
=
parseInt
(
removeElement
.
attr
(
"
id
"
).
replace
(
"
user_
"
,
""
),
10
);
var
approverIds
=
$
(
"
input#merge_request_approver_ids
"
);
var
skipUsers
=
approverIds
.
data
(
"
skip-users
"
)
||
[];
var
approverIndex
=
skipUsers
.
indexOf
(
approverId
);
removeElement
.
remove
();
if
(
approverIndex
>
-
1
)
{
approverIds
.
data
(
"
skip-users
"
,
skipUsers
.
splice
(
approverIndex
,
1
));
}
ev
.
preventDefault
();
});
$
(
"
.approver-list
"
).
on
(
"
click
"
,
"
.unsaved-approvers.approver-group .btn-remove
"
,
function
(
ev
)
{
var
removeElement
=
$
(
this
).
closest
(
"
li
"
);
var
approverGroupId
=
parseInt
(
removeElement
.
attr
(
"
id
"
).
replace
(
"
group_
"
,
""
),
10
);
var
approverGroupIds
=
$
(
"
input#merge_request_approver_group_ids
"
);
var
skipGroups
=
approverGroupIds
.
data
(
"
skip-groups
"
)
||
[];
var
approverGroupIndex
=
skipGroups
.
indexOf
(
approverGroupId
);
removeElement
.
remove
();
if
(
approverGroupIndex
>
-
1
)
{
approverGroupIds
.
data
(
"
skip-groups
"
,
skipGroups
.
splice
(
approverGroupIndex
,
1
));
}
ev
.
preventDefault
();
});
$
(
"
form.merge-request-form
"
).
submit
(
function
()
{
var
approverIds
,
approversInput
,
approverGroupIds
,
approverGroupsInput
;
if
(
$
(
"
input#merge_request_approver_ids
"
).
length
)
{
approverIds
=
$
.
map
(
$
(
"
li.unsaved-approvers.approver
"
).
not
(
"
.approver-template
"
),
function
(
li
,
i
)
{
return
li
.
id
.
replace
(
"
user_
"
,
""
);
});
approversInput
=
$
(
this
).
find
(
"
input#merge_request_approver_ids
"
);
approverIds
=
approverIds
.
concat
(
approversInput
.
val
().
split
(
"
,
"
));
approversInput
.
val
(
_
.
compact
(
approverIds
).
join
(
"
,
"
));
}
if
(
$
(
"
input#merge_request_approver_group_ids
"
).
length
)
{
approverGroupIds
=
$
.
map
(
$
(
"
li.unsaved-approvers.approver-group
"
),
function
(
li
,
i
)
{
return
li
.
id
.
replace
(
"
group_
"
,
""
);
});
approverGroupsInput
=
$
(
this
).
find
(
"
input#merge_request_approver_group_ids
"
);
approverGroupIds
=
approverGroupIds
.
concat
(
approverGroupsInput
.
val
().
split
(
"
,
"
));
approverGroupsInput
.
val
(
_
.
compact
(
approverGroupIds
).
join
(
"
,
"
));
}
});
return
$
(
"
.suggested-approvers a
"
).
click
(
function
()
{
var
approver_item_html
,
user_id
,
user_name
;
user_id
=
this
.
id
.
replace
(
"
user_
"
,
""
);
user_name
=
this
.
text
;
if
(
$
(
"
.approver-list #user_
"
+
user_id
).
length
)
{
return
false
;
}
approver_item_html
=
$
(
"
.unsaved-approvers.approver-template
"
).
clone
().
removeClass
(
"
hide approver-template
"
)[
0
].
outerHTML
.
replace
(
/
\{
approver_name
\}
/g
,
user_name
).
replace
(
/
\{
user_id
\}
/g
,
user_id
);
$
(
"
.no-approvers
"
).
remove
();
$
(
"
.approver-list
"
).
append
(
approver_item_html
);
return
false
;
});
});
app/assets/javascripts/boards/components/weight_select.vue
View file @
eb03035f
<
script
>
/* global BoardService
, WeightSelect
*/
/* global BoardService */
import
'
~
/weight_select
'
;
import
WeightSelect
from
'
ee
/weight_select
'
;
import
loadingIcon
from
'
~/vue_shared/components/loading_icon.vue
'
;
const
ANY_WEIGHT
=
'
Any Weight
'
;
...
...
app/assets/javascripts/dispatcher.js
View file @
eb03035f
...
...
@@ -24,15 +24,12 @@ import projectAvatar from './project_avatar';
import
MergeRequest
from
'
./merge_request
'
;
import
Compare
from
'
./compare
'
;
import
initCompareAutocomplete
from
'
./compare_autocomplete
'
;
/* global PathLocks */
import
ProjectFindFile
from
'
./project_find_file
'
;
import
ProjectNew
from
'
./project_new
'
;
import
projectImport
from
'
./project_import
'
;
import
Labels
from
'
./labels
'
;
import
LabelManager
from
'
./label_manager
'
;
import
Sidebar
from
'
./right_sidebar
'
;
/* global WeightSelect */
/* global AdminEmailSelect */
import
IssuableTemplateSelectors
from
'
./templates/issuable_template_selectors
'
;
import
Flash
from
'
./flash
'
;
...
...
@@ -100,10 +97,15 @@ import SearchAutocomplete from './search_autocomplete';
import
Activities
from
'
./activities
'
;
// EE-only
import
ApproversSelect
from
'
./approvers_select
'
;
import
AuditLogs
from
'
./audit_logs
'
;
import
initGeoInfoModal
from
'
./init_geo_info_modal
'
;
import
initGroupAnalytics
from
'
./init_group_analytics
'
;
import
ApproversSelect
from
'
ee/approvers_select
'
;
// eslint-disable-line import/first
import
AuditLogs
from
'
ee/audit_logs
'
;
// eslint-disable-line import/first
import
initGeoInfoModal
from
'
ee/init_geo_info_modal
'
;
// eslint-disable-line import/first
import
initGroupAnalytics
from
'
ee/init_group_analytics
'
;
// eslint-disable-line import/first
import
AdminEmailSelect
from
'
ee/admin_email_select
'
;
// eslint-disable-line import/first
import
initPathLocks
from
'
ee/path_locks
'
;
// eslint-disable-line import/first
import
WeightSelect
from
'
ee/weight_select
'
;
// eslint-disable-line import/first
import
initApprovals
from
'
ee/approvals
'
;
// eslint-disable-line import/first
import
initLDAPGroupsSelect
from
'
ee/ldap_groups_select
'
;
// eslint-disable-line import/first
(
function
()
{
var
Dispatcher
;
...
...
@@ -147,7 +149,7 @@ import initGroupAnalytics from './init_group_analytics';
path
,
}
=
JSON
.
parse
(
dataEl
.
innerHTML
);
PathLocks
.
init
(
toggle_path
,
path
);
initPathLocks
(
toggle_path
,
path
);
}
}
...
...
@@ -324,6 +326,8 @@ import initGroupAnalytics from './init_group_analytics';
new
MilestoneSelect
();
new
IssuableTemplateSelectors
();
new
AutoWidthDropdownSelect
(
$
(
'
.js-target-branch-select
'
)).
init
();
initApprovals
();
break
;
case
'
projects:tags:new
'
:
new
ZenMode
();
...
...
@@ -496,7 +500,7 @@ import initGroupAnalytics from './init_group_analytics';
new
NewCommitForm
(
$
(
'
.js-create-dir-form
'
));
if
(
document
.
querySelector
(
'
.js-tree-content
'
).
dataset
.
pathLocksAvailable
===
'
true
'
)
{
PathLocks
.
init
(
initPathLocks
(
document
.
querySelector
(
'
.js-tree-content
'
).
dataset
.
pathLocksToggle
,
document
.
querySelector
(
'
.js-tree-content
'
).
dataset
.
pathLocksPath
,
);
...
...
@@ -658,6 +662,9 @@ import initGroupAnalytics from './init_group_analytics';
case
'
groups:analytics:show
'
:
initGroupAnalytics
();
break
;
case
'
groups:ldap_group_links:index
'
:
initLDAPGroupsSelect
();
break
;
}
switch
(
path
[
0
])
{
case
'
sessions
'
:
...
...
@@ -684,6 +691,13 @@ import initGroupAnalytics from './init_group_analytics';
break
;
case
'
groups
'
:
new
UsersSelect
();
switch
(
path
[
2
])
{
case
'
edit
'
:
initLDAPGroupsSelect
();
break
;
}
break
;
case
'
projects
'
:
document
.
querySelectorAll
(
'
.js-namespace-select
'
)
...
...
app/assets/javascripts/init_issuable_sidebar.js
View file @
eb03035f
/* eslint-disable no-new */
/* global MilestoneSelect */
/* global WeightSelect */
import
LabelsSelect
from
'
./labels_select
'
;
import
IssuableContext
from
'
./issuable_context
'
;
import
Sidebar
from
'
./right_sidebar
'
;
import
DueDateSelectors
from
'
./due_date_select
'
;
import
WeightSelect
from
'
ee/weight_select
'
;
// eslint-disable-line import/first
export
default
()
=>
{
const
sidebarOptions
=
JSON
.
parse
(
document
.
querySelector
(
'
.js-sidebar-options
'
).
innerHTML
);
...
...
app/assets/javascripts/init_legacy_filters.js
View file @
eb03035f
/* eslint-disable no-new */
import
LabelsSelect
from
'
./labels_select
'
;
/* global MilestoneSelect */
/* global WeightSelect */
import
subscriptionSelect
from
'
./subscription_select
'
;
import
UsersSelect
from
'
./users_select
'
;
import
issueStatusSelect
from
'
./issue_status_select
'
;
import
WeightSelect
from
'
ee/weight_select
'
;
// eslint-disable-line import/first
export
default
()
=>
{
new
UsersSelect
();
new
LabelsSelect
();
...
...
app/assets/javascripts/ldap_groups_select.js
deleted
100644 → 0
View file @
f457adeb
/* eslint-disable space-before-function-paren, prefer-arrow-callback, no-var, one-var, one-var-declaration-per-line, object-shorthand, quotes, comma-dangle, consistent-return, no-unused-vars, padded-blocks, func-names, max-len */
import
Api
from
'
./api
'
;
(
function
()
{
$
(
function
()
{
var
groupFormatSelection
,
ldapGroupResult
;
ldapGroupResult
=
function
(
group
)
{
return
group
.
cn
;
};
groupFormatSelection
=
function
(
group
)
{
return
group
.
cn
;
};
$
(
'
.ajax-ldap-groups-select
'
).
each
(
function
(
i
,
select
)
{
return
$
(
select
).
select2
({
id
:
function
(
group
)
{
return
group
.
cn
;
},
placeholder
:
"
Search for a LDAP group
"
,
minimumInputLength
:
1
,
query
:
function
(
query
)
{
var
provider
;
provider
=
$
(
'
#ldap_group_link_provider
'
).
val
();
return
Api
.
ldap_groups
(
query
.
term
,
provider
,
function
(
groups
)
{
var
data
;
data
=
{
results
:
groups
};
return
query
.
callback
(
data
);
});
},
initSelection
:
function
(
element
,
callback
)
{
var
id
;
id
=
$
(
element
).
val
();
if
(
id
!==
""
)
{
return
callback
({
cn
:
id
});
}
},
formatResult
:
ldapGroupResult
,
formatSelection
:
groupFormatSelection
,
dropdownCssClass
:
"
ajax-groups-dropdown
"
,
formatNoMatches
:
function
(
nomatch
)
{
return
"
Match not found; try refining your search query.
"
;
}
});
});
return
$
(
'
#ldap_group_link_provider
'
).
on
(
'
change
'
,
function
()
{
return
$
(
'
.ajax-ldap-groups-select
'
).
select2
(
'
data
'
,
null
);
});
});
}).
call
(
window
);
app/assets/javascripts/main.js
View file @
eb03035f
...
...
@@ -61,13 +61,7 @@ import './render_gfm';
import
initBreadcrumbs
from
'
./breadcrumb
'
;
// EE-only scripts
import
'
./admin_email_select
'
;
import
'
./application_settings
'
;
import
'
./approvals
'
;
import
'
./ee_trial_banner
'
;
import
'
./ldap_groups_select
'
;
import
'
./path_locks
'
;
import
'
./weight_select
'
;
import
initEETrialBanner
from
'
ee/ee_trial_banner
'
;
import
'
./dispatcher
'
;
...
...
@@ -305,4 +299,7 @@ $(function () {
removeFlashClickListener
(
flashEl
);
});
}
// EE specific calls
initEETrialBanner
();
});
app/assets/javascripts/path_locks.js
deleted
100644 → 0
View file @
f457adeb
/* eslint-disable space-before-function-paren, wrap-iife, one-var, no-var, one-var-declaration-per-line, no-unused-vars, object-shorthand, comma-dangle, prefer-arrow-callback, padded-blocks, func-names, max-len */
(
function
()
{
this
.
PathLocks
=
(
function
()
{
function
PathLocks
()
{}
PathLocks
.
init
=
function
(
url
,
path
)
{
return
$
(
'
a.path-lock
'
).
on
(
'
click
'
,
function
(
e
)
{
var
$lockBtn
,
currentState
,
toggleAction
;
e
.
preventDefault
();
$lockBtn
=
$
(
this
);
currentState
=
$lockBtn
.
data
(
'
state
'
);
toggleAction
=
currentState
===
'
lock
'
?
'
unlock
'
:
'
lock
'
;
return
$
.
post
(
url
,
{
path
:
path
},
function
()
{
location
.
reload
();
});
});
};
return
PathLocks
;
})();
}).
call
(
window
);
app/assets/javascripts/weight_select.js
View file @
eb03035f
/* eslint-disable space-before-function-paren, wrap-iife, prefer-arrow-callback, max-len, one-var, no-var, one-var-declaration-per-line, object-shorthand, comma-dangle, no-shadow, quotes, no-unused-vars, no-else-return, consistent-return, no-param-reassign, prefer-template, padded-blocks, func-names */
(
function
()
{
this
.
WeightSelect
=
(
function
()
{
function
WeightSelect
(
els
,
options
=
{})
{
function
WeightSelect
(
els
,
options
=
{})
{
const
$els
=
$
(
els
||
'
.js-weight-select
'
);
$els
.
each
(
function
(
i
,
dropdown
)
{
...
...
@@ -83,10 +81,6 @@
}
});
});
}
return
WeightSelect
;
})();
}
}).
call
(
window
)
;
export
default
WeightSelect
;
ee/app/assets/javascripts/admin_email_select.js
0 → 100644
View file @
eb03035f
/* eslint-disable no-var, wrap-iife, func-names, space-before-function-paren, camelcase, no-unused-vars, quotes, object-shorthand, one-var, one-var-declaration-per-line, prefer-arrow-callback, comma-dangle, prefer-template, no-else-return, yoda, prefer-rest-params, prefer-spread, max-len */
import
Api
from
'
~/api
'
;
var
slice
=
[].
slice
;
function
AdminEmailSelect
()
{
$
(
'
.ajax-admin-email-select
'
).
each
((
function
(
_this
)
{
return
function
(
i
,
select
)
{
var
skip_ldap
;
skip_ldap
=
$
(
select
).
hasClass
(
'
skip_ldap
'
);
return
$
(
select
).
select2
({
placeholder
:
"
Select group or project
"
,
multiple
:
$
(
select
).
hasClass
(
'
multiselect
'
),
minimumInputLength
:
0
,
query
:
function
(
query
)
{
var
group_result
,
project_result
;
group_result
=
Api
.
groups
(
query
.
term
,
{},
function
(
groups
)
{
return
groups
;
});
project_result
=
Api
.
projects
(
query
.
term
,
{
order_by
:
'
id
'
,
membership
:
false
},
function
(
projects
)
{
return
projects
;
});
return
$
.
when
(
project_result
,
group_result
).
done
(
function
(
projects
,
groups
)
{
var
all
,
data
;
all
=
{
id
:
"
all
"
};
data
=
[
all
].
concat
(
groups
[
0
],
projects
[
0
]);
return
query
.
callback
({
results
:
data
});
});
},
id
:
function
(
object
)
{
if
(
object
.
path_with_namespace
)
{
return
"
project-
"
+
object
.
id
;
}
else
if
(
object
.
path
)
{
return
"
group-
"
+
object
.
id
;
}
else
{
return
"
all
"
;
}
},
formatResult
:
function
()
{
var
args
;
args
=
1
<=
arguments
.
length
?
slice
.
call
(
arguments
,
0
)
:
[];
return
_this
.
formatResult
.
apply
(
_this
,
args
);
},
formatSelection
:
function
()
{
var
args
;
args
=
1
<=
arguments
.
length
?
slice
.
call
(
arguments
,
0
)
:
[];
return
_this
.
formatSelection
.
apply
(
_this
,
args
);
},
dropdownCssClass
:
"
ajax-admin-email-dropdown
"
,
escapeMarkup
:
function
(
m
)
{
return
m
;
}
});
};
})(
this
));
}
AdminEmailSelect
.
prototype
.
formatResult
=
function
(
object
)
{
if
(
object
.
path_with_namespace
)
{
return
"
<div class='project-result'> <div class='project-name'>
"
+
object
.
name
+
"
</div> <div class='project-path'>
"
+
object
.
path_with_namespace
+
"
</div> </div>
"
;
}
else
if
(
object
.
path
)
{
return
"
<div class='group-result'> <div class='group-name'>
"
+
object
.
name
+
"
</div> <div class='group-path'>
"
+
object
.
path
+
"
</div> </div>
"
;
}
else
{
return
"
<div class='group-result'> <div class='group-name'>All</div> <div class='group-path'>All groups and projects</div> </div>
"
;
}
};
AdminEmailSelect
.
prototype
.
formatSelection
=
function
(
object
)
{
if
(
object
.
path_with_namespace
)
{
return
"
Project:
"
+
object
.
name
;
}
else
if
(
object
.
path
)
{
return
"
Group:
"
+
object
.
name
;
}
else
{
return
"
All groups and projects
"
;
}
};
export
default
AdminEmailSelect
;
ee/app/assets/javascripts/approvals.js
0 → 100644
View file @
eb03035f
export
default
()
=>
{
$
(
'
.approver-list
'
).
on
(
'
click
'
,
'
.unsaved-approvers.approver .btn-remove
'
,
function
approverListClickCallback
(
ev
)
{
const
removeElement
=
$
(
this
).
closest
(
'
li
'
);
const
approverId
=
parseInt
(
removeElement
.
attr
(
'
id
'
).
replace
(
'
user_
'
,
''
),
10
);
const
approverIds
=
$
(
'
input#merge_request_approver_ids
'
);
const
skipUsers
=
approverIds
.
data
(
'
skip-users
'
)
||
[];
const
approverIndex
=
skipUsers
.
indexOf
(
approverId
);
removeElement
.
remove
();
if
(
approverIndex
>
-
1
)
{
approverIds
.
data
(
'
skip-users
'
,
skipUsers
.
splice
(
approverIndex
,
1
));
}
ev
.
preventDefault
();
});
$
(
'
.approver-list
'
).
on
(
'
click
'
,
'
.unsaved-approvers.approver-group .btn-remove
'
,
function
approverListRemoveClickCallback
(
ev
)
{
const
removeElement
=
$
(
this
).
closest
(
'
li
'
);
const
approverGroupId
=
parseInt
(
removeElement
.
attr
(
'
id
'
).
replace
(
'
group_
'
,
''
),
10
);
const
approverGroupIds
=
$
(
'
input#merge_request_approver_group_ids
'
);
const
skipGroups
=
approverGroupIds
.
data
(
'
skip-groups
'
)
||
[];
const
approverGroupIndex
=
skipGroups
.
indexOf
(
approverGroupId
);
removeElement
.
remove
();
if
(
approverGroupIndex
>
-
1
)
{
approverGroupIds
.
data
(
'
skip-groups
'
,
skipGroups
.
splice
(
approverGroupIndex
,
1
));
}
ev
.
preventDefault
();
});
$
(
'
form.merge-request-form
'
).
on
(
'
submit
'
,
function
mergeRequestFormSubmitCallback
()
{
if
(
$
(
'
input#merge_request_approver_ids
'
).
length
)
{
let
approverIds
=
$
.
map
(
$
(
'
li.unsaved-approvers.approver
'
).
not
(
'
.approver-template
'
),
li
=>
li
.
id
.
replace
(
'
user_
'
,
''
));
const
approversInput
=
$
(
this
).
find
(
'
input#merge_request_approver_ids
'
);
approverIds
=
approverIds
.
concat
(
approversInput
.
val
().
split
(
'
,
'
));
approversInput
.
val
(
_
.
compact
(
approverIds
).
join
(
'
,
'
));
}
if
(
$
(
'
input#merge_request_approver_group_ids
'
).
length
)
{
let
approverGroupIds
=
$
.
map
(
$
(
'
li.unsaved-approvers.approver-group
'
),
li
=>
li
.
id
.
replace
(
'
group_
'
,
''
));
const
approverGroupsInput
=
$
(
this
).
find
(
'
input#merge_request_approver_group_ids
'
);
approverGroupIds
=
approverGroupIds
.
concat
(
approverGroupsInput
.
val
().
split
(
'
,
'
));
approverGroupsInput
.
val
(
_
.
compact
(
approverGroupIds
).
join
(
'
,
'
));
}
});
$
(
'
.suggested-approvers a
'
).
on
(
'
click
'
,
function
sugestedApproversClickCallback
()
{
const
userId
=
this
.
id
.
replace
(
'
user_
'
,
''
);
const
username
=
this
.
text
;
if
(
$
(
`.approver-list #user_
${
userId
}
`
).
length
)
{
return
false
;
}
const
approverItemHTML
=
$
(
'
.unsaved-approvers.approver-template
'
).
clone
()
.
removeClass
(
'
hide approver-template
'
)[
0
]
.
outerHTML
.
replace
(
/
\{
approver_name
\}
/g
,
username
).
replace
(
/
\{
user_id
\}
/g
,
userId
);
$
(
'
.no-approvers
'
).
remove
();
$
(
'
.approver-list
'
).
append
(
approverItemHTML
);
return
false
;
});
};
app/assets/javascripts/approvers_select.js
→
ee/
app/assets/javascripts/approvers_select.js
View file @
eb03035f
import
Api
from
'
.
/api
'
;
import
Api
from
'
~
/api
'
;
export
default
class
ApproversSelect
{
constructor
()
{
...
...
app/assets/javascripts/audit_logs.js
→
ee/
app/assets/javascripts/audit_logs.js
View file @
eb03035f
/* eslint-disable class-methods-use-this, no-unneeded-ternary, quote-props, no-new */
import
UsersSelect
from
'
.
/users_select
'
;
import
groupsSelect
from
'
.
/groups_select
'
;
import
projectSelect
from
'
.
/project_select
'
;
import
UsersSelect
from
'
~
/users_select
'
;
import
groupsSelect
from
'
~
/groups_select
'
;
import
projectSelect
from
'
~
/project_select
'
;
class
AuditLogs
{
constructor
()
{
...
...
app/assets/javascripts/ee_trial_banner/ee_trial_banner.js
→
ee/
app/assets/javascripts/ee_trial_banner/ee_trial_banner.js
View file @
eb03035f
File moved
app/assets/javascripts/ee_trial_banner/index.js
→
ee/
app/assets/javascripts/ee_trial_banner/index.js
View file @
eb03035f
import
EETrialBanner
from
'
./ee_trial_banner
'
;
$
(()
=>
{
export
default
function
initEETrialBanner
()
{
const
$trialBanner
=
$
(
'
.js-gitlab-ee-license-banner
'
);
if
(
$trialBanner
.
length
)
{
const
eeTrialBanner
=
new
EETrialBanner
(
$trialBanner
);
eeTrialBanner
.
init
();
}
}
);
}
app/assets/javascripts/init_geo_info_modal.js
→
ee/
app/assets/javascripts/init_geo_info_modal.js
View file @
eb03035f
File moved
app/assets/javascripts/init_group_analytics.js
→
ee/
app/assets/javascripts/init_group_analytics.js
View file @
eb03035f
File moved
ee/app/assets/javascripts/ldap_groups_select.js
0 → 100644
View file @
eb03035f
/* eslint-disable space-before-function-paren, prefer-arrow-callback, no-var, one-var, one-var-declaration-per-line, object-shorthand, quotes, comma-dangle, consistent-return, no-unused-vars, padded-blocks, func-names, max-len */
import
Api
from
'
~/api
'
;
export
default
function
initLDAPGroupsSelect
()
{
var
groupFormatSelection
,
ldapGroupResult
;
ldapGroupResult
=
function
(
group
)
{
return
group
.
cn
;
};
groupFormatSelection
=
function
(
group
)
{
return
group
.
cn
;
};
$
(
'
.ajax-ldap-groups-select
'
).
each
(
function
(
i
,
select
)
{
return
$
(
select
).
select2
({
id
:
function
(
group
)
{
return
group
.
cn
;
},
placeholder
:
"
Search for a LDAP group
"
,
minimumInputLength
:
1
,
query
:
function
(
query
)
{
var
provider
;
provider
=
$
(
'
#ldap_group_link_provider
'
).
val
();
return
Api
.
ldap_groups
(
query
.
term
,
provider
,
function
(
groups
)
{
var
data
;
data
=
{
results
:
groups
};
return
query
.
callback
(
data
);
});
},
initSelection
:
function
(
element
,
callback
)
{
var
id
;
id
=
$
(
element
).
val
();
if
(
id
!==
""
)
{
return
callback
({
cn
:
id
});
}
},
formatResult
:
ldapGroupResult
,
formatSelection
:
groupFormatSelection
,
dropdownCssClass
:
"
ajax-groups-dropdown
"
,
formatNoMatches
:
function
(
nomatch
)
{
return
"
Match not found; try refining your search query.
"
;
}
});
});
return
$
(
'
#ldap_group_link_provider
'
).
on
(
'
change
'
,
function
()
{
return
$
(
'
.ajax-ldap-groups-select
'
).
select2
(
'
data
'
,
null
);
});
}
ee/app/assets/javascripts/path_locks.js
0 → 100644
View file @
eb03035f
export
default
function
initPathLocks
(
url
,
path
)
{
$
(
'
a.path-lock
'
).
on
(
'
click
'
,
(
e
)
=>
{
e
.
preventDefault
();
$
.
post
(
url
,
{
path
,
},
()
=>
{
location
.
reload
();
});
});
}
ee/app/assets/javascripts/weight_select.js
0 → 100644
View file @
eb03035f
/* eslint-disable space-before-function-paren, wrap-iife, prefer-arrow-callback, max-len, one-var, no-var, one-var-declaration-per-line, object-shorthand, comma-dangle, no-shadow, quotes, no-unused-vars, no-else-return, consistent-return, no-param-reassign, prefer-template, padded-blocks, func-names */
function
WeightSelect
(
els
,
options
=
{})
{
const
$els
=
$
(
els
||
'
.js-weight-select
'
);
$els
.
each
(
function
(
i
,
dropdown
)
{
var
$block
,
$dropdown
,
$loading
,
$selectbox
,
$sidebarCollapsedValue
,
$value
,
abilityName
,
updateUrl
,
updateWeight
;
$dropdown
=
$
(
dropdown
);
updateUrl
=
$dropdown
.
data
(
'
issueUpdate
'
);
$selectbox
=
$dropdown
.
closest
(
'
.selectbox
'
);
$block
=
$selectbox
.
closest
(
'
.block
'
);
$sidebarCollapsedValue
=
$block
.
find
(
'
.sidebar-collapsed-icon span
'
);
$value
=
$block
.
find
(
'
.value
'
);
abilityName
=
$dropdown
.
data
(
'
ability-name
'
);
$loading
=
$block
.
find
(
'
.block-loading
'
).
fadeOut
();
const
fieldName
=
options
.
fieldName
||
$dropdown
.
data
(
"
field-name
"
);
const
inputField
=
$dropdown
.
closest
(
'
.selectbox
'
).
find
(
`input[name='
${
fieldName
}
']`
);
if
(
Object
.
keys
(
options
).
includes
(
'
selected
'
))
{
inputField
.
val
(
options
.
selected
);
}
updateWeight
=
function
(
selected
)
{
var
data
;
data
=
{};
data
[
abilityName
]
=
{};
data
[
abilityName
].
weight
=
selected
!=
null
?
selected
:
null
;
$loading
.
fadeIn
();
$dropdown
.
trigger
(
'
loading.gl.dropdown
'
);
return
$
.
ajax
({
type
:
'
PUT
'
,
dataType
:
'
json
'
,
url
:
updateUrl
,
data
:
data
}).
done
(
function
(
data
)
{
$dropdown
.
trigger
(
'
loaded.gl.dropdown
'
);
$loading
.
fadeOut
();
$selectbox
.
hide
();
if
(
data
.
weight
!=
null
)
{
$value
.
html
(
`<strong>
${
data
.
weight
}
</strong>`
);
}
else
{
$value
.
html
(
'
<span class="no-value">None</span>
'
);
}
return
$sidebarCollapsedValue
.
html
(
data
.
weight
);
});
};
return
$dropdown
.
glDropdown
({
selectable
:
true
,
fieldName
,
toggleLabel
:
function
(
selected
,
el
)
{
return
$
(
el
).
data
(
"
id
"
);
},
hidden
:
function
(
e
)
{
$selectbox
.
hide
();
return
$value
.
css
(
'
display
'
,
''
);
},
id
:
function
(
obj
,
el
)
{
if
(
$
(
el
).
data
(
"
none
"
)
==
null
)
{
return
$
(
el
).
data
(
"
id
"
);
}
else
{
return
''
;
}
},
clicked
:
function
(
glDropdownEvt
)
{
const
e
=
glDropdownEvt
.
e
;
let
selected
=
glDropdownEvt
.
selectedObj
;
const
inputField
=
$dropdown
.
closest
(
'
.selectbox
'
).
find
(
`input[name='
${
fieldName
}
']`
);
if
(
options
.
handleClick
)
{
e
.
preventDefault
();
selected
=
inputField
.
val
();
options
.
handleClick
(
selected
);
}
else
if
(
$
(
dropdown
).
is
(
"
.js-filter-submit
"
))
{
return
$
(
dropdown
).
parents
(
'
form
'
).
submit
();
}
else
if
(
$dropdown
.
is
(
'
.js-issuable-form-weight
'
))
{
e
.
preventDefault
();
}
else
{
selected
=
inputField
.
val
();
return
updateWeight
(
selected
);
}
}
});
});
}
export
default
WeightSelect
;
spec/javascripts/approvers_select_spec.js
View file @
eb03035f
import
ApproversSelect
from
'
~
/approvers_select
'
;
import
ApproversSelect
from
'
ee
/approvers_select
'
;
import
ClassSpecHelper
from
'
./helpers/class_spec_helper
'
;
describe
(
'
ApproversSelect
'
,
()
=>
{
...
...
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