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
75036954
Commit
75036954
authored
Nov 17, 2017
by
Filipa Lacerda
Committed by
Phil Hughes
Nov 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exports a couple of project related code as es6 modules
parent
46a45e65
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
282 additions
and
320 deletions
+282
-320
app/assets/javascripts/audit_logs.js
app/assets/javascripts/audit_logs.js
+2
-3
app/assets/javascripts/dispatcher.js
app/assets/javascripts/dispatcher.js
+9
-9
app/assets/javascripts/main.js
app/assets/javascripts/main.js
+0
-5
app/assets/javascripts/project.js
app/assets/javascripts/project.js
+2
-2
app/assets/javascripts/project_label_subscription.js
app/assets/javascripts/project_label_subscription.js
+37
-42
app/assets/javascripts/project_new.js
app/assets/javascripts/project_new.js
+138
-144
app/assets/javascripts/project_select.js
app/assets/javascripts/project_select.js
+64
-70
app/assets/javascripts/project_show.js
app/assets/javascripts/project_show.js
+0
-11
app/assets/javascripts/project_variables.js
app/assets/javascripts/project_variables.js
+28
-32
spec/javascripts/project_new_spec.js
spec/javascripts/project_new_spec.js
+2
-2
No files found.
app/assets/javascripts/audit_logs.js
View file @
75036954
/* eslint-disable class-methods-use-this, no-unneeded-ternary, quote-props, no-new */
/* global ProjectSelect */
import
UsersSelect
from
'
./users_select
'
;
import
groupsSelect
from
'
./groups_select
'
;
import
'
./project_select
'
;
import
projectSelect
from
'
./project_select
'
;
class
AuditLogs
{
constructor
()
{
...
...
@@ -11,7 +10,7 @@ class AuditLogs {
}
initFilters
()
{
new
P
rojectSelect
();
p
rojectSelect
();
groupsSelect
();
new
UsersSelect
();
...
...
app/assets/javascripts/dispatcher.js
View file @
75036954
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-arrow-callback, wrap-iife, no-shadow, consistent-return, one-var, one-var-declaration-per-line, camelcase, default-case, no-new, quotes, no-duplicate-case, no-case-declarations, no-fallthrough, max-len */
import
{
s__
}
from
'
./locale
'
;
/* global ProjectSelect */
import
projectSelect
from
'
./project_select
'
;
import
IssuableIndex
from
'
./issuable_index
'
;
/* global Milestone */
import
IssuableForm
from
'
./issuable_form
'
;
...
...
@@ -27,8 +27,7 @@ import projectAvatar from './project_avatar';
/* global CompareAutocomplete */
/* global PathLocks */
/* global ProjectFindFile */
/* global ProjectNew */
/* global ProjectShow */
import
ProjectNew
from
'
./project_new
'
;
import
projectImport
from
'
./project_import
'
;
import
Labels
from
'
./labels
'
;
import
LabelManager
from
'
./label_manager
'
;
...
...
@@ -95,6 +94,8 @@ import Members from './members';
import
memberExpirationDate
from
'
./member_expiration_date
'
;
import
DueDateSelectors
from
'
./due_date_select
'
;
import
Diff
from
'
./diff
'
;
import
ProjectLabelSubscription
from
'
./project_label_subscription
'
;
import
ProjectVariables
from
'
./project_variables
'
;
// EE-only
import
ApproversSelect
from
'
./approvers_select
'
;
...
...
@@ -212,7 +213,7 @@ import initGroupAnalytics from './init_group_analytics';
initIssuableSidebar
();
break
;
case
'
dashboard:milestones:index
'
:
new
P
rojectSelect
();
p
rojectSelect
();
break
;
case
'
projects:milestones:show
'
:
new
UserCallout
();
...
...
@@ -223,7 +224,7 @@ import initGroupAnalytics from './init_group_analytics';
break
;
case
'
dashboard:issues
'
:
case
'
dashboard:merge_requests
'
:
new
P
rojectSelect
();
p
rojectSelect
();
initLegacyFilters
();
break
;
case
'
groups:issues
'
:
...
...
@@ -232,7 +233,7 @@ import initGroupAnalytics from './init_group_analytics';
const
filteredSearchManager
=
new
gl
.
FilteredSearchManager
(
page
===
'
groups:issues
'
?
'
issues
'
:
'
merge_requests
'
);
filteredSearchManager
.
setup
();
}
new
P
rojectSelect
();
p
rojectSelect
();
break
;
case
'
dashboard:todos:index
'
:
new
Todos
();
...
...
@@ -530,7 +531,7 @@ import initGroupAnalytics from './init_group_analytics';
if
(
$el
.
find
(
'
.dropdown-group-label
'
).
length
)
{
new
GroupLabelSubscription
(
$el
);
}
else
{
new
gl
.
ProjectLabelSubscription
(
$el
);
new
ProjectLabelSubscription
(
$el
);
}
});
break
;
...
...
@@ -579,7 +580,7 @@ import initGroupAnalytics from './init_group_analytics';
// Initialize expandable settings panels
initSettingsPanels
();
case
'
groups:settings:ci_cd:show
'
:
new
gl
.
ProjectVariables
();
new
ProjectVariables
();
break
;
case
'
ci:lints:create
'
:
case
'
ci:lints:show
'
:
...
...
@@ -706,7 +707,6 @@ import initGroupAnalytics from './init_group_analytics';
case
'
show
'
:
new
Star
();
new
ProjectNew
();
new
ProjectShow
();
new
NotificationsDropdown
();
break
;
case
'
wikis
'
:
...
...
app/assets/javascripts/main.js
View file @
75036954
...
...
@@ -73,11 +73,6 @@ import './pager';
import
'
./preview_markdown
'
;
import
'
./project_find_file
'
;
import
'
./project_import
'
;
import
'
./project_label_subscription
'
;
import
'
./project_new
'
;
import
'
./project_select
'
;
import
'
./project_show
'
;
import
'
./project_variables
'
;
import
'
./projects_dropdown
'
;
import
'
./projects_list
'
;
import
'
./syntax_highlight
'
;
...
...
app/assets/javascripts/project.js
View file @
75036954
/* eslint-disable func-names, space-before-function-paren, no-var, consistent-return, no-new, prefer-arrow-callback, no-return-assign, one-var, one-var-declaration-per-line, object-shorthand, no-else-return, newline-per-chained-call, no-shadow, vars-on-top, prefer-template, max-len */
/* global ProjectSelect */
import
Cookies
from
'
js-cookie
'
;
import
projectSelect
from
'
./project_select
'
;
export
default
class
Project
{
constructor
()
{
...
...
@@ -58,7 +58,7 @@ export default class Project {
}
static
projectSelectDropdown
()
{
new
P
rojectSelect
();
p
rojectSelect
();
$
(
'
.project-item-select
'
).
on
(
'
click
'
,
e
=>
Project
.
changeProject
(
$
(
e
.
currentTarget
).
val
()));
}
...
...
app/assets/javascripts/project_label_subscription.js
View file @
75036954
/* eslint-disable wrap-iife, func-names, space-before-function-paren, object-shorthand, comma-dangle, one-var, one-var-declaration-per-line, no-restricted-syntax, max-len, no-param-reassign */
export
default
class
ProjectLabelSubscription
{
constructor
(
container
)
{
this
.
$container
=
$
(
container
);
this
.
$buttons
=
this
.
$container
.
find
(
'
.js-subscribe-button
'
);
(
function
(
global
)
{
class
ProjectLabelSubscription
{
constructor
(
container
)
{
this
.
$container
=
$
(
container
);
this
.
$buttons
=
this
.
$container
.
find
(
'
.js-subscribe-button
'
);
this
.
$buttons
.
on
(
'
click
'
,
this
.
toggleSubscription
.
bind
(
this
));
}
this
.
$buttons
.
on
(
'
click
'
,
this
.
toggleSubscription
.
bind
(
this
));
}
toggleSubscription
(
event
)
{
event
.
preventDefault
();
toggleSubscription
(
event
)
{
event
.
preventDefault
();
const
$btn
=
$
(
event
.
currentTarget
);
const
$span
=
$btn
.
find
(
'
span
'
);
const
url
=
$btn
.
attr
(
'
data-url
'
);
const
oldStatus
=
$btn
.
attr
(
'
data-status
'
);
const
$btn
=
$
(
event
.
currentTarget
);
const
$span
=
$btn
.
find
(
'
span
'
);
const
url
=
$btn
.
attr
(
'
data-url
'
);
const
oldStatus
=
$btn
.
attr
(
'
data-status
'
);
$btn
.
addClass
(
'
disabled
'
);
$span
.
toggleClass
(
'
hidden
'
);
$btn
.
addClass
(
'
disabled
'
);
$span
.
toggleClass
(
'
hidden
'
);
$
.
ajax
({
type
:
'
POST
'
,
url
:
url
}).
done
(()
=>
{
let
newStatus
,
newAction
;
$
.
ajax
({
type
:
'
POST
'
,
url
,
}).
done
(()
=>
{
let
newStatus
;
let
newAction
;
if
(
oldStatus
===
'
unsubscribed
'
)
{
[
newStatus
,
newAction
]
=
[
'
subscribed
'
,
'
Unsubscribe
'
];
}
else
{
[
newStatus
,
newAction
]
=
[
'
unsubscribed
'
,
'
Subscribe
'
];
}
if
(
oldStatus
===
'
unsubscribed
'
)
{
[
newStatus
,
newAction
]
=
[
'
subscribed
'
,
'
Unsubscribe
'
];
}
else
{
[
newStatus
,
newAction
]
=
[
'
unsubscribed
'
,
'
Subscribe
'
];
}
$span
.
toggleClass
(
'
hidden
'
);
$btn
.
removeClass
(
'
disabled
'
);
$span
.
toggleClass
(
'
hidden
'
);
$btn
.
removeClass
(
'
disabled
'
);
this
.
$buttons
.
attr
(
'
data-status
'
,
newStatus
);
this
.
$buttons
.
find
(
'
> span
'
).
text
(
newAction
);
this
.
$buttons
.
attr
(
'
data-status
'
,
newStatus
);
this
.
$buttons
.
find
(
'
> span
'
).
text
(
newAction
);
this
.
$buttons
.
map
((
button
)
=>
{
const
$button
=
$
(
button
);
this
.
$buttons
.
map
((
button
)
=>
{
const
$button
=
$
(
button
);
if
(
$button
.
attr
(
'
data-original-title
'
))
{
$button
.
tooltip
(
'
hide
'
).
attr
(
'
data-original-title
'
,
newAction
).
tooltip
(
'
fixTitle
'
);
}
if
(
$button
.
attr
(
'
data-original-title
'
))
{
$button
.
tooltip
(
'
hide
'
).
attr
(
'
data-original-title
'
,
newAction
).
tooltip
(
'
fixTitle
'
);
}
return
button
;
});
return
button
;
});
}
}
);
}
global
.
ProjectLabelSubscription
=
ProjectLabelSubscription
;
})(
window
.
gl
||
(
window
.
gl
=
{}));
}
app/assets/javascripts/project_new.js
View file @
75036954
This diff is collapsed.
Click to expand it.
app/assets/javascripts/project_select.js
View file @
75036954
...
...
@@ -2,79 +2,73 @@
import
Api
from
'
./api
'
;
import
ProjectSelectComboButton
from
'
./project_select_combo_button
'
;
(
function
()
{
this
.
ProjectSelect
=
(
function
()
{
function
ProjectSelect
()
{
$
(
'
.ajax-project-select
'
).
each
(
function
(
i
,
select
)
{
var
placeholder
;
const
simpleFilter
=
$
(
select
).
data
(
'
simple-filter
'
)
||
false
;
this
.
groupId
=
$
(
select
).
data
(
'
group-id
'
);
this
.
includeGroups
=
$
(
select
).
data
(
'
include-groups
'
);
this
.
allProjects
=
$
(
select
).
data
(
'
all-projects
'
)
||
false
;
this
.
orderBy
=
$
(
select
).
data
(
'
order-by
'
)
||
'
id
'
;
this
.
withIssuesEnabled
=
$
(
select
).
data
(
'
with-issues-enabled
'
);
this
.
withMergeRequestsEnabled
=
$
(
select
).
data
(
'
with-merge-requests-enabled
'
);
export
default
function
projectSelect
()
{
$
(
'
.ajax-project-select
'
).
each
(
function
(
i
,
select
)
{
var
placeholder
;
const
simpleFilter
=
$
(
select
).
data
(
'
simple-filter
'
)
||
false
;
this
.
groupId
=
$
(
select
).
data
(
'
group-id
'
);
this
.
includeGroups
=
$
(
select
).
data
(
'
include-groups
'
);
this
.
allProjects
=
$
(
select
).
data
(
'
all-projects
'
)
||
false
;
this
.
orderBy
=
$
(
select
).
data
(
'
order-by
'
)
||
'
id
'
;
this
.
withIssuesEnabled
=
$
(
select
).
data
(
'
with-issues-enabled
'
);
this
.
withMergeRequestsEnabled
=
$
(
select
).
data
(
'
with-merge-requests-enabled
'
);
placeholder
=
"
Search for project
"
;
if
(
this
.
includeGroups
)
{
placeholder
+=
"
or group
"
;
}
placeholder
=
"
Search for project
"
;
if
(
this
.
includeGroups
)
{
placeholder
+=
"
or group
"
;
}
$
(
select
).
select2
({
placeholder
:
placeholder
,
minimumInputLength
:
0
,
query
:
(
function
(
_this
)
{
return
function
(
query
)
{
var
finalCallback
,
projectsCallback
;
finalCallback
=
function
(
projects
)
{
$
(
select
).
select2
({
placeholder
:
placeholder
,
minimumInputLength
:
0
,
query
:
(
function
(
_this
)
{
return
function
(
query
)
{
var
finalCallback
,
projectsCallback
;
finalCallback
=
function
(
projects
)
{
var
data
;
data
=
{
results
:
projects
};
return
query
.
callback
(
data
);
};
if
(
_this
.
includeGroups
)
{
projectsCallback
=
function
(
projects
)
{
var
groupsCallback
;
groupsCallback
=
function
(
groups
)
{
var
data
;
data
=
{
results
:
projects
};
return
query
.
callback
(
data
);
data
=
groups
.
concat
(
projects
);
return
finalCallback
(
data
);
};
if
(
_this
.
includeGroups
)
{
projectsCallback
=
function
(
projects
)
{
var
groupsCallback
;
groupsCallback
=
function
(
groups
)
{
var
data
;
data
=
groups
.
concat
(
projects
);
return
finalCallback
(
data
);
};
return
Api
.
groups
(
query
.
term
,
{},
groupsCallback
);
};
}
else
{
projectsCallback
=
finalCallback
;
}
if
(
_this
.
groupId
)
{
return
Api
.
groupProjects
(
_this
.
groupId
,
query
.
term
,
projectsCallback
);
}
else
{
return
Api
.
projects
(
query
.
term
,
{
order_by
:
_this
.
orderBy
,
with_issues_enabled
:
_this
.
withIssuesEnabled
,
with_merge_requests_enabled
:
_this
.
withMergeRequestsEnabled
,
membership
:
!
_this
.
allProjects
,
},
projectsCallback
);
}
return
Api
.
groups
(
query
.
term
,
{},
groupsCallback
);
};
})(
this
),
id
:
function
(
project
)
{
if
(
simpleFilter
)
return
project
.
id
;
return
JSON
.
stringify
({
name
:
project
.
name
,
url
:
project
.
web_url
,
});
},
text
:
function
(
project
)
{
return
project
.
name_with_namespace
||
project
.
name
;
},
dropdownCssClass
:
"
ajax-project-dropdown
"
}
else
{
projectsCallback
=
finalCallback
;
}
if
(
_this
.
groupId
)
{
return
Api
.
groupProjects
(
_this
.
groupId
,
query
.
term
,
projectsCallback
);
}
else
{
return
Api
.
projects
(
query
.
term
,
{
order_by
:
_this
.
orderBy
,
with_issues_enabled
:
_this
.
withIssuesEnabled
,
with_merge_requests_enabled
:
_this
.
withMergeRequestsEnabled
,
membership
:
!
_this
.
allProjects
,
},
projectsCallback
);
}
};
})(
this
),
id
:
function
(
project
)
{
if
(
simpleFilter
)
return
project
.
id
;
return
JSON
.
stringify
({
name
:
project
.
name
,
url
:
project
.
web_url
,
});
if
(
simpleFilter
)
return
select
;
return
new
ProjectSelectComboButton
(
select
);
});
}
return
ProjectSelect
;
})();
}).
call
(
window
);
},
text
:
function
(
project
)
{
return
project
.
name_with_namespace
||
project
.
name
;
},
dropdownCssClass
:
"
ajax-project-dropdown
"
});
if
(
simpleFilter
)
return
select
;
return
new
ProjectSelectComboButton
(
select
);
});
}
app/assets/javascripts/project_show.js
deleted
100644 → 0
View file @
46a45e65
/* eslint-disable func-names, space-before-function-paren, wrap-iife */
(
function
()
{
this
.
ProjectShow
=
(
function
()
{
function
ProjectShow
()
{}
return
ProjectShow
;
})();
}).
call
(
window
);
// I kept class for future
app/assets/javascripts/project_variables.js
View file @
75036954
(()
=>
{
const
HIDDEN_VALUE_TEXT
=
'
******
'
;
class
ProjectVariables
{
constructor
()
{
this
.
$revealBtn
=
$
(
'
.js-btn-toggle-reveal-values
'
);
this
.
$revealBtn
.
on
(
'
click
'
,
this
.
toggleRevealState
.
bind
(
this
));
}
const
HIDDEN_VALUE_TEXT
=
'
******
'
;
export
default
class
ProjectVariables
{
constructor
()
{
this
.
$revealBtn
=
$
(
'
.js-btn-toggle-reveal-values
'
);
this
.
$revealBtn
.
on
(
'
click
'
,
this
.
toggleRevealState
.
bind
(
this
));
}
toggleRevealState
(
e
)
{
e
.
preventDefault
();
toggleRevealState
(
e
)
{
e
.
preventDefault
();
const
oldStatus
=
this
.
$revealBtn
.
attr
(
'
data-status
'
);
let
newStatus
=
'
hidden
'
;
let
newAction
=
'
Reveal Values
'
;
const
oldStatus
=
this
.
$revealBtn
.
attr
(
'
data-status
'
);
let
newStatus
=
'
hidden
'
;
let
newAction
=
'
Reveal Values
'
;
if
(
oldStatus
===
'
hidden
'
)
{
newStatus
=
'
revealed
'
;
newAction
=
'
Hide Values
'
;
}
if
(
oldStatus
===
'
hidden
'
)
{
newStatus
=
'
revealed
'
;
newAction
=
'
Hide Values
'
;
}
this
.
$revealBtn
.
attr
(
'
data-status
'
,
newStatus
);
this
.
$revealBtn
.
attr
(
'
data-status
'
,
newStatus
);
const
$variables
=
$
(
'
.variable-value
'
);
const
$variables
=
$
(
'
.variable-value
'
);
$variables
.
each
((
_
,
variable
)
=>
{
const
$variable
=
$
(
variable
);
let
newText
=
HIDDEN_VALUE_TEXT
;
$variables
.
each
((
_
,
variable
)
=>
{
const
$variable
=
$
(
variable
);
let
newText
=
HIDDEN_VALUE_TEXT
;
if
(
newStatus
===
'
revealed
'
)
{
newText
=
$variable
.
attr
(
'
data-value
'
);
}
if
(
newStatus
===
'
revealed
'
)
{
newText
=
$variable
.
attr
(
'
data-value
'
);
}
$variable
.
text
(
newText
);
});
$variable
.
text
(
newText
);
});
this
.
$revealBtn
.
text
(
newAction
);
}
this
.
$revealBtn
.
text
(
newAction
);
}
window
.
gl
=
window
.
gl
||
{};
window
.
gl
.
ProjectVariables
=
ProjectVariables
;
})();
}
spec/javascripts/project_new_spec.js
View file @
75036954
import
'
~/project_new
'
;
import
ProjectNew
from
'
~/project_new
'
;
describe
(
'
ApproversSelect
'
,
function
()
{
const
projectSettingsTemplate
=
'
projects/edit.html.raw
'
;
...
...
@@ -7,7 +7,7 @@ describe('ApproversSelect', function () {
beforeEach
(()
=>
{
loadFixtures
(
projectSettingsTemplate
);
this
.
$requireApprovalsToggle
=
$
(
'
.js-require-approvals-toggle
'
);
this
.
project
=
new
window
.
ProjectNew
();
this
.
project
=
new
ProjectNew
();
});
it
(
'
shows approver settings if enabled
'
,
()
=>
{
...
...
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