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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
d2ee2eab
Commit
d2ee2eab
authored
Oct 10, 2018
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prettify app/assets/javascripts/pages
parent
d87e88a6
Changes
46
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
46 changed files
with
1001 additions
and
780 deletions
+1001
-780
app/assets/javascripts/pages/admin/abuse_reports/abuse_reports.js
...ts/javascripts/pages/admin/abuse_reports/abuse_reports.js
+1
-1
app/assets/javascripts/pages/admin/admin.js
app/assets/javascripts/pages/admin/admin.js
+9
-6
app/assets/javascripts/pages/admin/application_settings/account_and_limits.js
...ts/pages/admin/application_settings/account_and_limits.js
+6
-2
app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js
...ripts/pages/admin/broadcast_messages/broadcast_message.js
+20
-16
app/assets/javascripts/pages/admin/jobs/index/components/stop_jobs_modal.vue
...pts/pages/admin/jobs/index/components/stop_jobs_modal.vue
+34
-31
app/assets/javascripts/pages/admin/projects/index.js
app/assets/javascripts/pages/admin/projects/index.js
+2
-1
app/assets/javascripts/pages/admin/projects/index/components/delete_project_modal.vue
.../admin/projects/index/components/delete_project_modal.vue
+71
-68
app/assets/javascripts/pages/admin/projects/index/index.js
app/assets/javascripts/pages/admin/projects/index/index.js
+1
-1
app/assets/javascripts/pages/admin/users/components/delete_user_modal.vue
...cripts/pages/admin/users/components/delete_user_modal.vue
+96
-91
app/assets/javascripts/pages/admin/users/index.js
app/assets/javascripts/pages/admin/users/index.js
+4
-2
app/assets/javascripts/pages/admin/users/new/index.js
app/assets/javascripts/pages/admin/users/new/index.js
+4
-2
app/assets/javascripts/pages/dashboard/todos/index/todos.js
app/assets/javascripts/pages/dashboard/todos/index/todos.js
+9
-6
app/assets/javascripts/pages/milestones/shared/components/delete_milestone_modal.vue
...s/milestones/shared/components/delete_milestone_modal.vue
+96
-73
app/assets/javascripts/pages/milestones/shared/delete_milestone_modal_init.js
...ts/pages/milestones/shared/delete_milestone_modal_init.js
+10
-6
app/assets/javascripts/pages/milestones/shared/promote_milestone_modal_init.js
...s/pages/milestones/shared/promote_milestone_modal_init.js
+10
-6
app/assets/javascripts/pages/profiles/index.js
app/assets/javascripts/pages/profiles/index.js
+5
-2
app/assets/javascripts/pages/profiles/two_factor_auths/index.js
...sets/javascripts/pages/profiles/two_factor_auths/index.js
+3
-1
app/assets/javascripts/pages/projects/branches/new/index.js
app/assets/javascripts/pages/projects/branches/new/index.js
+8
-3
app/assets/javascripts/pages/projects/graphs/charts/index.js
app/assets/javascripts/pages/projects/graphs/charts/index.js
+13
-9
app/assets/javascripts/pages/projects/graphs/show/index.js
app/assets/javascripts/pages/projects/graphs/show/index.js
+2
-1
app/assets/javascripts/pages/projects/graphs/show/stat_graph_contributors.js
...pts/pages/projects/graphs/show/stat_graph_contributors.js
+51
-40
app/assets/javascripts/pages/projects/graphs/show/stat_graph_contributors_graph.js
...ges/projects/graphs/show/stat_graph_contributors_graph.js
+148
-73
app/assets/javascripts/pages/projects/graphs/show/stat_graph_contributors_util.js
...ages/projects/graphs/show/stat_graph_contributors_util.js
+35
-29
app/assets/javascripts/pages/projects/init_blob.js
app/assets/javascripts/pages/projects/init_blob.js
+2
-1
app/assets/javascripts/pages/projects/init_form.js
app/assets/javascripts/pages/projects/init_form.js
+1
-1
app/assets/javascripts/pages/projects/issues/show.js
app/assets/javascripts/pages/projects/issues/show.js
+1
-1
app/assets/javascripts/pages/projects/labels/components/promote_label_modal.vue
.../pages/projects/labels/components/promote_label_modal.vue
+69
-55
app/assets/javascripts/pages/projects/labels/index/index.js
app/assets/javascripts/pages/projects/labels/index/index.js
+10
-6
app/assets/javascripts/pages/projects/network/network.js
app/assets/javascripts/pages/projects/network/network.js
+6
-4
app/assets/javascripts/pages/projects/pipeline_schedules/index/index.js
...ascripts/pages/projects/pipeline_schedules/index/index.js
+13
-9
app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/interval_pattern_input.vue
...ne_schedules/shared/components/interval_pattern_input.vue
+51
-51
app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/pipeline_schedules_callout.vue
...chedules/shared/components/pipeline_schedules_callout.vue
+23
-23
app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/target_branch_dropdown.js
...ine_schedules/shared/components/target_branch_dropdown.js
+1
-2
app/assets/javascripts/pages/projects/pipeline_schedules/shared/init_form.js
...pts/pages/projects/pipeline_schedules/shared/init_form.js
+3
-1
app/assets/javascripts/pages/projects/pipelines/charts/index.js
...sets/javascripts/pages/projects/pipelines/charts/index.js
+34
-25
app/assets/javascripts/pages/projects/pipelines/index/index.js
...ssets/javascripts/pages/projects/pipelines/index/index.js
+35
-31
app/assets/javascripts/pages/projects/pipelines/init_pipelines.js
...ts/javascripts/pages/projects/pipelines/init_pipelines.js
+5
-2
app/assets/javascripts/pages/projects/shared/permissions/components/project_feature_setting.vue
...shared/permissions/components/project_feature_setting.vue
+56
-58
app/assets/javascripts/pages/projects/shared/permissions/components/project_setting_row.vue
...cts/shared/permissions/components/project_setting_row.vue
+18
-18
app/assets/javascripts/pages/projects/shared/permissions/constants.js
...avascripts/pages/projects/shared/permissions/constants.js
+4
-2
app/assets/javascripts/pages/projects/shared/project_avatar.js
...ssets/javascripts/pages/projects/shared/project_avatar.js
+3
-2
app/assets/javascripts/pages/projects/wikis/index.js
app/assets/javascripts/pages/projects/wikis/index.js
+2
-1
app/assets/javascripts/pages/search/show/search.js
app/assets/javascripts/pages/search/show/search.js
+16
-9
app/assets/javascripts/pages/sessions/new/signin_tabs_memoizer.js
...ts/javascripts/pages/sessions/new/signin_tabs_memoizer.js
+1
-1
app/assets/javascripts/pages/sessions/new/username_validator.js
...sets/javascripts/pages/sessions/new/username_validator.js
+5
-5
app/assets/javascripts/pages/users/index.js
app/assets/javascripts/pages/users/index.js
+4
-2
No files found.
app/assets/javascripts/pages/admin/abuse_reports/abuse_reports.js
View file @
d2ee2eab
...
@@ -31,7 +31,7 @@ export default class AbuseReports {
...
@@ -31,7 +31,7 @@ export default class AbuseReports {
$messageCellElement
.
text
(
originalMessage
);
$messageCellElement
.
text
(
originalMessage
);
}
else
{
}
else
{
$messageCellElement
.
data
(
'
messageTruncated
'
,
'
true
'
);
$messageCellElement
.
data
(
'
messageTruncated
'
,
'
true
'
);
$messageCellElement
.
text
(
`
${
originalMessage
.
substr
(
0
,
(
MAX_MESSAGE_LENGTH
-
3
)
)}
...`
);
$messageCellElement
.
text
(
`
${
originalMessage
.
substr
(
0
,
MAX_MESSAGE_LENGTH
-
3
)}
...`
);
}
}
}
}
}
}
app/assets/javascripts/pages/admin/admin.js
View file @
d2ee2eab
...
@@ -23,7 +23,7 @@ export default function adminInit() {
...
@@ -23,7 +23,7 @@ export default function adminInit() {
}
}
});
});
$
(
'
body
'
).
on
(
'
click
'
,
'
.js-toggle-colors-link
'
,
(
e
)
=>
{
$
(
'
body
'
).
on
(
'
click
'
,
'
.js-toggle-colors-link
'
,
e
=>
{
e
.
preventDefault
();
e
.
preventDefault
();
$
(
'
.js-toggle-colors-container
'
).
toggleClass
(
'
hide
'
);
$
(
'
.js-toggle-colors-container
'
).
toggleClass
(
'
hide
'
);
});
});
...
@@ -33,12 +33,15 @@ export default function adminInit() {
...
@@ -33,12 +33,15 @@ export default function adminInit() {
$
(
this
).
tab
(
'
show
'
);
$
(
this
).
tab
(
'
show
'
);
});
});
$
(
'
.log-bottom
'
).
on
(
'
click
'
,
(
e
)
=>
{
$
(
'
.log-bottom
'
).
on
(
'
click
'
,
e
=>
{
e
.
preventDefault
();
e
.
preventDefault
();
const
$visibleLog
=
$
(
'
.file-content:visible
'
);
const
$visibleLog
=
$
(
'
.file-content:visible
'
);
$visibleLog
.
animate
({
$visibleLog
.
animate
(
{
scrollTop
:
$visibleLog
.
find
(
'
ol
'
).
height
(),
scrollTop
:
$visibleLog
.
find
(
'
ol
'
).
height
(),
},
'
fast
'
);
},
'
fast
'
,
);
});
});
$
(
'
.change-owner-link
'
).
on
(
'
click
'
,
function
changeOwnerLinkClick
(
e
)
{
$
(
'
.change-owner-link
'
).
on
(
'
click
'
,
function
changeOwnerLinkClick
(
e
)
{
...
@@ -47,7 +50,7 @@ export default function adminInit() {
...
@@ -47,7 +50,7 @@ export default function adminInit() {
modal
.
show
();
modal
.
show
();
});
});
$
(
'
.change-owner-cancel-link
'
).
on
(
'
click
'
,
(
e
)
=>
{
$
(
'
.change-owner-cancel-link
'
).
on
(
'
click
'
,
e
=>
{
e
.
preventDefault
();
e
.
preventDefault
();
modal
.
hide
();
modal
.
hide
();
$
(
'
.change-owner-link
'
).
show
();
$
(
'
.change-owner-link
'
).
show
();
...
...
app/assets/javascripts/pages/admin/application_settings/account_and_limits.js
View file @
d2ee2eab
import
{
__
}
from
'
~/locale
'
;
import
{
__
}
from
'
~/locale
'
;
export
const
PLACEHOLDER_USER_EXTERNAL_DEFAULT_TRUE
=
__
(
'
Regex pattern
'
);
export
const
PLACEHOLDER_USER_EXTERNAL_DEFAULT_TRUE
=
__
(
'
Regex pattern
'
);
export
const
PLACEHOLDER_USER_EXTERNAL_DEFAULT_FALSE
=
__
(
'
To define internal users, first enable new users set to external
'
);
export
const
PLACEHOLDER_USER_EXTERNAL_DEFAULT_FALSE
=
__
(
'
To define internal users, first enable new users set to external
'
,
);
function
setUserInternalRegexPlaceholder
(
checkbox
)
{
function
setUserInternalRegexPlaceholder
(
checkbox
)
{
const
userInternalRegex
=
document
.
getElementById
(
'
application_setting_user_default_internal_regex
'
);
const
userInternalRegex
=
document
.
getElementById
(
'
application_setting_user_default_internal_regex
'
,
);
if
(
checkbox
&&
userInternalRegex
)
{
if
(
checkbox
&&
userInternalRegex
)
{
if
(
checkbox
.
checked
)
{
if
(
checkbox
.
checked
)
{
userInternalRegex
.
readOnly
=
false
;
userInternalRegex
.
readOnly
=
false
;
...
...
app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js
View file @
d2ee2eab
...
@@ -17,12 +17,15 @@ export default () => {
...
@@ -17,12 +17,15 @@ export default () => {
const
previewPath
=
$
(
'
textarea#broadcast_message_message
'
).
data
(
'
previewPath
'
);
const
previewPath
=
$
(
'
textarea#broadcast_message_message
'
).
data
(
'
previewPath
'
);
$
(
'
textarea#broadcast_message_message
'
).
on
(
'
input
'
,
_
.
debounce
(
function
onMessageInput
()
{
$
(
'
textarea#broadcast_message_message
'
).
on
(
'
input
'
,
_
.
debounce
(
function
onMessageInput
()
{
const
message
=
$
(
this
).
val
();
const
message
=
$
(
this
).
val
();
if
(
message
===
''
)
{
if
(
message
===
''
)
{
$
(
'
.js-broadcast-message-preview
'
).
text
(
'
Your message here
'
);
$
(
'
.js-broadcast-message-preview
'
).
text
(
'
Your message here
'
);
}
else
{
}
else
{
axios
.
post
(
previewPath
,
{
axios
.
post
(
previewPath
,
{
broadcast_message
:
{
broadcast_message
:
{
message
,
message
,
},
},
...
@@ -32,5 +35,6 @@ export default () => {
...
@@ -32,5 +35,6 @@ export default () => {
})
})
.
catch
(()
=>
flash
(
__
(
'
An error occurred while rendering preview broadcast message
'
)));
.
catch
(()
=>
flash
(
__
(
'
An error occurred while rendering preview broadcast message
'
)));
}
}
},
250
));
},
250
),
);
};
};
app/assets/javascripts/pages/admin/jobs/index/components/stop_jobs_modal.vue
View file @
d2ee2eab
<
script
>
<
script
>
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
createFlash
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
GlModal
from
'
~/vue_shared/components/gl_modal.vue
'
;
import
GlModal
from
'
~/vue_shared/components/gl_modal.vue
'
;
import
{
redirectTo
}
from
'
~/lib/utils/url_utility
'
;
import
{
redirectTo
}
from
'
~/lib/utils/url_utility
'
;
import
{
s__
}
from
'
~/locale
'
;
import
{
s__
}
from
'
~/locale
'
;
export
default
{
export
default
{
components
:
{
components
:
{
GlModal
,
GlModal
,
},
},
...
@@ -17,23 +17,26 @@
...
@@ -17,23 +17,26 @@
},
},
computed
:
{
computed
:
{
text
()
{
text
()
{
return
s__
(
'
AdminArea|You’re about to stop all jobs.This will halt all current jobs that are running.
'
);
return
s__
(
'
AdminArea|You’re about to stop all jobs.This will halt all current jobs that are running.
'
,
);
},
},
},
},
methods
:
{
methods
:
{
onSubmit
()
{
onSubmit
()
{
return
axios
.
post
(
this
.
url
)
return
axios
.
then
((
response
)
=>
{
.
post
(
this
.
url
)
.
then
(
response
=>
{
// follow the rediect to refresh the page
// follow the rediect to refresh the page
redirectTo
(
response
.
request
.
responseURL
);
redirectTo
(
response
.
request
.
responseURL
);
})
})
.
catch
((
error
)
=>
{
.
catch
(
error
=>
{
createFlash
(
s__
(
'
AdminArea|Stopping jobs failed
'
));
createFlash
(
s__
(
'
AdminArea|Stopping jobs failed
'
));
throw
error
;
throw
error
;
});
});
},
},
},
},
};
};
</
script
>
</
script
>
<
template
>
<
template
>
...
...
app/assets/javascripts/pages/admin/projects/index.js
View file @
d2ee2eab
...
@@ -4,6 +4,7 @@ import NamespaceSelect from '../../../namespace_select';
...
@@ -4,6 +4,7 @@ import NamespaceSelect from '../../../namespace_select';
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
new
ProjectsList
();
// eslint-disable-line no-new
new
ProjectsList
();
// eslint-disable-line no-new
document
.
querySelectorAll
(
'
.js-namespace-select
'
)
document
.
querySelectorAll
(
'
.js-namespace-select
'
)
.
forEach
(
dropdown
=>
new
NamespaceSelect
({
dropdown
}));
.
forEach
(
dropdown
=>
new
NamespaceSelect
({
dropdown
}));
});
});
app/assets/javascripts/pages/admin/projects/index/components/delete_project_modal.vue
View file @
d2ee2eab
<
script
>
<
script
>
import
_
from
'
underscore
'
;
import
_
from
'
underscore
'
;
import
DeprecatedModal
from
'
~/vue_shared/components/deprecated_modal.vue
'
;
import
DeprecatedModal
from
'
~/vue_shared/components/deprecated_modal.vue
'
;
import
{
s__
,
sprintf
}
from
'
~/locale
'
;
import
{
s__
,
sprintf
}
from
'
~/locale
'
;
export
default
{
export
default
{
components
:
{
components
:
{
DeprecatedModal
,
DeprecatedModal
,
},
},
...
@@ -31,7 +31,8 @@
...
@@ -31,7 +31,8 @@
},
},
computed
:
{
computed
:
{
title
()
{
title
()
{
return
sprintf
(
s__
(
'
AdminProjects|Delete Project %{projectName}?
'
),
return
sprintf
(
s__
(
'
AdminProjects|Delete Project %{projectName}?
'
),
{
{
projectName
:
`'
${
_
.
escape
(
this
.
projectName
)}
'`
,
projectName
:
`'
${
_
.
escape
(
this
.
projectName
)}
'`
,
},
},
...
@@ -39,7 +40,8 @@
...
@@ -39,7 +40,8 @@
);
);
},
},
text
()
{
text
()
{
return
sprintf
(
s__
(
`AdminProjects|
return
sprintf
(
s__
(
`AdminProjects|
You’re about to permanently delete the project %{projectName}, its repository,
You’re about to permanently delete the project %{projectName}, its repository,
and all related resources including issues, merge requests, etc.. Once you confirm and press
and all related resources including issues, merge requests, etc.. Once you confirm and press
%{strong_start}Delete project%{strong_end}, it cannot be undone or recovered.`
),
%{strong_start}Delete project%{strong_end}, it cannot be undone or recovered.`
),
...
@@ -52,7 +54,8 @@
...
@@ -52,7 +54,8 @@
);
);
},
},
confirmationTextLabel
()
{
confirmationTextLabel
()
{
return
sprintf
(
s__
(
'
AdminUsers|To confirm, type %{projectName}
'
),
return
sprintf
(
s__
(
'
AdminUsers|To confirm, type %{projectName}
'
),
{
{
projectName
:
`<code>
${
_
.
escape
(
this
.
projectName
)}
</code>`
,
projectName
:
`<code>
${
_
.
escape
(
this
.
projectName
)}
</code>`
,
},
},
...
@@ -75,7 +78,7 @@
...
@@ -75,7 +78,7 @@
this
.
enteredProjectName
=
''
;
this
.
enteredProjectName
=
''
;
},
},
},
},
};
};
</
script
>
</
script
>
<
template
>
<
template
>
...
...
app/assets/javascripts/pages/admin/projects/index/index.js
View file @
d2ee2eab
...
@@ -28,7 +28,7 @@ document.addEventListener('DOMContentLoaded', () => {
...
@@ -28,7 +28,7 @@ document.addEventListener('DOMContentLoaded', () => {
},
},
});
});
$
(
document
).
on
(
'
shown.bs.modal
'
,
(
event
)
=>
{
$
(
document
).
on
(
'
shown.bs.modal
'
,
event
=>
{
if
(
event
.
relatedTarget
.
classList
.
contains
(
'
delete-project-button
'
))
{
if
(
event
.
relatedTarget
.
classList
.
contains
(
'
delete-project-button
'
))
{
const
buttonProps
=
event
.
relatedTarget
.
dataset
;
const
buttonProps
=
event
.
relatedTarget
.
dataset
;
deleteModal
.
deleteProjectUrl
=
buttonProps
.
deleteProjectUrl
;
deleteModal
.
deleteProjectUrl
=
buttonProps
.
deleteProjectUrl
;
...
...
app/assets/javascripts/pages/admin/users/components/delete_user_modal.vue
View file @
d2ee2eab
<
script
>
<
script
>
import
_
from
'
underscore
'
;
import
_
from
'
underscore
'
;
import
DeprecatedModal
from
'
~/vue_shared/components/deprecated_modal.vue
'
;
import
DeprecatedModal
from
'
~/vue_shared/components/deprecated_modal.vue
'
;
import
{
s__
,
sprintf
}
from
'
~/locale
'
;
import
{
s__
,
sprintf
}
from
'
~/locale
'
;
export
default
{
export
default
{
components
:
{
components
:
{
DeprecatedModal
,
DeprecatedModal
,
},
},
...
@@ -45,9 +45,12 @@
...
@@ -45,9 +45,12 @@
const
deleteContributionsTitle
=
s__
(
'
AdminUsers|Delete User %{username} and contributions?
'
);
const
deleteContributionsTitle
=
s__
(
'
AdminUsers|Delete User %{username} and contributions?
'
);
return
sprintf
(
return
sprintf
(
this
.
deleteContributions
?
deleteContributionsTitle
:
keepContributionsTitle
,
{
this
.
deleteContributions
?
deleteContributionsTitle
:
keepContributionsTitle
,
{
username
:
`'
${
_
.
escape
(
this
.
username
)}
'`
,
username
:
`'
${
_
.
escape
(
this
.
username
)}
'`
,
},
false
);
},
false
,
);
},
},
text
()
{
text
()
{
const
keepContributionsText
=
s__
(
`AdminArea|
const
keepContributionsText
=
s__
(
`AdminArea|
...
@@ -61,7 +64,8 @@
...
@@ -61,7 +64,8 @@
This will delete all of the issues, merge requests, and groups linked to them.
This will delete all of the issues, merge requests, and groups linked to them.
To avoid data loss, consider using the %{strong_start}block user%{strong_end} feature instead.
To avoid data loss, consider using the %{strong_start}block user%{strong_end} feature instead.
Once you %{strong_start}Delete user%{strong_end}, it cannot be undone or recovered.`
);
Once you %{strong_start}Delete user%{strong_end}, it cannot be undone or recovered.`
);
return
sprintf
(
this
.
deleteContributions
?
deleteContributionsText
:
keepContributionsText
,
return
sprintf
(
this
.
deleteContributions
?
deleteContributionsText
:
keepContributionsText
,
{
{
username
:
`<strong>
${
_
.
escape
(
this
.
username
)}
</strong>`
,
username
:
`<strong>
${
_
.
escape
(
this
.
username
)}
</strong>`
,
strong_start
:
'
<strong>
'
,
strong_start
:
'
<strong>
'
,
...
@@ -71,7 +75,8 @@
...
@@ -71,7 +75,8 @@
);
);
},
},
confirmationTextLabel
()
{
confirmationTextLabel
()
{
return
sprintf
(
s__
(
'
AdminUsers|To confirm, type %{username}
'
),
return
sprintf
(
s__
(
'
AdminUsers|To confirm, type %{username}
'
),
{
{
username
:
`<code>
${
_
.
escape
(
this
.
username
)}
</code>`
,
username
:
`<code>
${
_
.
escape
(
this
.
username
)}
</code>`
,
},
},
...
@@ -108,7 +113,7 @@
...
@@ -108,7 +113,7 @@
this
.
enteredUsername
=
''
;
this
.
enteredUsername
=
''
;
},
},
},
},
};
};
</
script
>
</
script
>
<
template
>
<
template
>
...
...
app/assets/javascripts/pages/admin/users/index.js
View file @
d2ee2eab
...
@@ -32,12 +32,14 @@ document.addEventListener('DOMContentLoaded', () => {
...
@@ -32,12 +32,14 @@ document.addEventListener('DOMContentLoaded', () => {
},
},
});
});
$
(
document
).
on
(
'
shown.bs.modal
'
,
(
event
)
=>
{
$
(
document
).
on
(
'
shown.bs.modal
'
,
event
=>
{
if
(
event
.
relatedTarget
.
classList
.
contains
(
'
delete-user-button
'
))
{
if
(
event
.
relatedTarget
.
classList
.
contains
(
'
delete-user-button
'
))
{
const
buttonProps
=
event
.
relatedTarget
.
dataset
;
const
buttonProps
=
event
.
relatedTarget
.
dataset
;
deleteModal
.
deleteUserUrl
=
buttonProps
.
deleteUserUrl
;
deleteModal
.
deleteUserUrl
=
buttonProps
.
deleteUserUrl
;
deleteModal
.
blockUserUrl
=
buttonProps
.
blockUserUrl
;
deleteModal
.
blockUserUrl
=
buttonProps
.
blockUserUrl
;
deleteModal
.
deleteContributions
=
event
.
relatedTarget
.
hasAttribute
(
'
data-delete-contributions
'
);
deleteModal
.
deleteContributions
=
event
.
relatedTarget
.
hasAttribute
(
'
data-delete-contributions
'
,
);
deleteModal
.
username
=
buttonProps
.
username
;
deleteModal
.
username
=
buttonProps
.
username
;
}
}
});
});
...
...
app/assets/javascripts/pages/admin/users/new/index.js
View file @
d2ee2eab
...
@@ -4,7 +4,9 @@ export default class UserInternalRegexHandler {
...
@@ -4,7 +4,9 @@ export default class UserInternalRegexHandler {
constructor
()
{
constructor
()
{
this
.
regexPattern
=
$
(
'
[data-user-internal-regex-pattern]
'
).
data
(
'
user-internal-regex-pattern
'
);
this
.
regexPattern
=
$
(
'
[data-user-internal-regex-pattern]
'
).
data
(
'
user-internal-regex-pattern
'
);
if
(
this
.
regexPattern
&&
this
.
regexPattern
!==
''
)
{
if
(
this
.
regexPattern
&&
this
.
regexPattern
!==
''
)
{
this
.
regexOptions
=
$
(
'
[data-user-internal-regex-options]
'
).
data
(
'
user-internal-regex-options
'
);
this
.
regexOptions
=
$
(
'
[data-user-internal-regex-options]
'
).
data
(
'
user-internal-regex-options
'
,
);
this
.
external
=
$
(
'
#user_external
'
);
this
.
external
=
$
(
'
#user_external
'
);
this
.
warningMessage
=
$
(
'
#warning_external_automatically_set
'
);
this
.
warningMessage
=
$
(
'
#warning_external_automatically_set
'
);
this
.
addListenerToEmailField
();
this
.
addListenerToEmailField
();
...
@@ -13,7 +15,7 @@ export default class UserInternalRegexHandler {
...
@@ -13,7 +15,7 @@ export default class UserInternalRegexHandler {
}
}
addListenerToEmailField
()
{
addListenerToEmailField
()
{
$
(
'
#user_email
'
).
on
(
'
input
'
,
(
event
)
=>
{
$
(
'
#user_email
'
).
on
(
'
input
'
,
event
=>
{
this
.
setExternalCheckbox
(
event
.
currentTarget
.
value
);
this
.
setExternalCheckbox
(
event
.
currentTarget
.
value
);
});
});
}
}
...
...
app/assets/javascripts/pages/dashboard/todos/index/todos.js
View file @
d2ee2eab
...
@@ -79,7 +79,8 @@ export default class Todos {
...
@@ -79,7 +79,8 @@ export default class Todos {
.
then
(({
data
})
=>
{
.
then
(({
data
})
=>
{
this
.
updateRowState
(
target
);
this
.
updateRowState
(
target
);
this
.
updateBadges
(
data
);
this
.
updateBadges
(
data
);
}).
catch
(()
=>
{
})
.
catch
(()
=>
{
this
.
updateRowState
(
target
,
true
);
this
.
updateRowState
(
target
,
true
);
return
flash
(
__
(
'
Error updating todo status.
'
));
return
flash
(
__
(
'
Error updating todo status.
'
));
});
});
...
@@ -118,10 +119,12 @@ export default class Todos {
...
@@ -118,10 +119,12 @@ export default class Todos {
axios
[
target
.
dataset
.
method
](
target
.
dataset
.
href
,
{
axios
[
target
.
dataset
.
method
](
target
.
dataset
.
href
,
{
ids
:
this
.
todo_ids
,
ids
:
this
.
todo_ids
,
}).
then
(({
data
})
=>
{
})
.
then
(({
data
})
=>
{
this
.
updateAllState
(
target
,
data
);
this
.
updateAllState
(
target
,
data
);
this
.
updateBadges
(
data
);
this
.
updateBadges
(
data
);
}).
catch
(()
=>
flash
(
__
(
'
Error updating status for all todos.
'
)));
})
.
catch
(()
=>
flash
(
__
(
'
Error updating status for all todos.
'
)));
}
}
updateAllState
(
target
,
data
)
{
updateAllState
(
target
,
data
)
{
...
@@ -133,7 +136,7 @@ export default class Todos {
...
@@ -133,7 +136,7 @@ export default class Todos {
target
.
removeAttribute
(
'
disabled
'
);
target
.
removeAttribute
(
'
disabled
'
);
target
.
classList
.
remove
(
'
disabled
'
);
target
.
classList
.
remove
(
'
disabled
'
);
this
.
todo_ids
=
(
target
===
markAllDoneBtn
)
?
data
.
updated_ids
:
[];
this
.
todo_ids
=
target
===
markAllDoneBtn
?
data
.
updated_ids
:
[];
undoAllBtn
.
classList
.
toggle
(
'
hidden
'
);
undoAllBtn
.
classList
.
toggle
(
'
hidden
'
);
markAllDoneBtn
.
classList
.
toggle
(
'
hidden
'
);
markAllDoneBtn
.
classList
.
toggle
(
'
hidden
'
);
todoListContainer
.
classList
.
toggle
(
'
hidden
'
);
todoListContainer
.
classList
.
toggle
(
'
hidden
'
);
...
...
app/assets/javascripts/pages/milestones/shared/components/delete_milestone_modal.vue
View file @
d2ee2eab
<
script
>
<
script
>
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
Flash
from
'
~/flash
'
;
import
Flash
from
'
~/flash
'
;
import
DeprecatedModal
from
'
~/vue_shared/components/deprecated_modal.vue
'
;
import
DeprecatedModal
from
'
~/vue_shared/components/deprecated_modal.vue
'
;
import
{
n__
,
s__
,
sprintf
}
from
'
~/locale
'
;
import
{
n__
,
s__
,
sprintf
}
from
'
~/locale
'
;
import
{
redirectTo
}
from
'
~/lib/utils/url_utility
'
;
import
{
redirectTo
}
from
'
~/lib/utils/url_utility
'
;
import
eventHub
from
'
../event_hub
'
;
import
eventHub
from
'
../event_hub
'
;
export
default
{
export
default
{
components
:
{
components
:
{
DeprecatedModal
,
DeprecatedModal
,
},
},
...
@@ -35,7 +35,9 @@
...
@@ -35,7 +35,9 @@
},
},
computed
:
{
computed
:
{
text
()
{
text
()
{
const
milestoneTitle
=
sprintf
(
'
<strong>%{milestoneTitle}</strong>
'
,
{
milestoneTitle
:
this
.
milestoneTitle
});
const
milestoneTitle
=
sprintf
(
'
<strong>%{milestoneTitle}</strong>
'
,
{
milestoneTitle
:
this
.
milestoneTitle
,
});
if
(
this
.
issueCount
===
0
&&
this
.
mergeRequestCount
===
0
)
{
if
(
this
.
issueCount
===
0
&&
this
.
mergeRequestCount
===
0
)
{
return
sprintf
(
return
sprintf
(
...
@@ -56,39 +58,60 @@ Once deleted, it cannot be undone or recovered.`),
...
@@ -56,39 +58,60 @@ Once deleted, it cannot be undone or recovered.`),
{
{
milestoneTitle
,
milestoneTitle
,
issuesWithCount
:
n__
(
'
%d issue
'
,
'
%d issues
'
,
this
.
issueCount
),
issuesWithCount
:
n__
(
'
%d issue
'
,
'
%d issues
'
,
this
.
issueCount
),
mergeRequestsWithCount
:
n__
(
'
%d merge request
'
,
'
%d merge requests
'
,
this
.
mergeRequestCount
),
mergeRequestsWithCount
:
n__
(
'
%d merge request
'
,
'
%d merge requests
'
,
this
.
mergeRequestCount
,
),
},
},
false
,
false
,
);
);
},
},
title
()
{
title
()
{
return
sprintf
(
s__
(
'
Milestones|Delete milestone %{milestoneTitle}?
'
),
{
milestoneTitle
:
this
.
milestoneTitle
});
return
sprintf
(
s__
(
'
Milestones|Delete milestone %{milestoneTitle}?
'
),
{
milestoneTitle
:
this
.
milestoneTitle
,
});
},
},
},
},
methods
:
{
methods
:
{
onSubmit
()
{
onSubmit
()
{
eventHub
.
$emit
(
'
deleteMilestoneModal.requestStarted
'
,
this
.
milestoneUrl
);
eventHub
.
$emit
(
'
deleteMilestoneModal.requestStarted
'
,
this
.
milestoneUrl
);
return
axios
.
delete
(
this
.
milestoneUrl
)
return
axios
.
then
((
response
)
=>
{
.
delete
(
this
.
milestoneUrl
)
eventHub
.
$emit
(
'
deleteMilestoneModal.requestFinished
'
,
{
milestoneUrl
:
this
.
milestoneUrl
,
successful
:
true
});
.
then
(
response
=>
{
eventHub
.
$emit
(
'
deleteMilestoneModal.requestFinished
'
,
{
milestoneUrl
:
this
.
milestoneUrl
,
successful
:
true
,
});
// follow the rediect to milestones overview page
// follow the rediect to milestones overview page
redirectTo
(
response
.
request
.
responseURL
);
redirectTo
(
response
.
request
.
responseURL
);
})
})
.
catch
((
error
)
=>
{
.
catch
(
error
=>
{
eventHub
.
$emit
(
'
deleteMilestoneModal.requestFinished
'
,
{
milestoneUrl
:
this
.
milestoneUrl
,
successful
:
false
});
eventHub
.
$emit
(
'
deleteMilestoneModal.requestFinished
'
,
{
milestoneUrl
:
this
.
milestoneUrl
,
successful
:
false
,
});
if
(
error
.
response
&&
error
.
response
.
status
===
404
)
{
if
(
error
.
response
&&
error
.
response
.
status
===
404
)
{
Flash
(
sprintf
(
s__
(
'
Milestones|Milestone %{milestoneTitle} was not found
'
),
{
milestoneTitle
:
this
.
milestoneTitle
}));
Flash
(
sprintf
(
s__
(
'
Milestones|Milestone %{milestoneTitle} was not found
'
),
{
milestoneTitle
:
this
.
milestoneTitle
,
}),
);
}
else
{
}
else
{
Flash
(
sprintf
(
s__
(
'
Milestones|Failed to delete milestone %{milestoneTitle}
'
),
{
milestoneTitle
:
this
.
milestoneTitle
}));
Flash
(
sprintf
(
s__
(
'
Milestones|Failed to delete milestone %{milestoneTitle}
'
),
{
milestoneTitle
:
this
.
milestoneTitle
,
}),
);
}
}
throw
error
;
throw
error
;
});
});
},
},
},
},
};
};
</
script
>
</
script
>
<
template
>
<
template
>
...
...
app/assets/javascripts/pages/milestones/shared/delete_milestone_modal_init.js
View file @
d2ee2eab
...
@@ -7,7 +7,9 @@ export default () => {
...
@@ -7,7 +7,9 @@ export default () => {
Vue
.
use
(
Translate
);
Vue
.
use
(
Translate
);
const
onRequestFinished
=
({
milestoneUrl
,
successful
})
=>
{
const
onRequestFinished
=
({
milestoneUrl
,
successful
})
=>
{
const
button
=
document
.
querySelector
(
`.js-delete-milestone-button[data-milestone-url="
${
milestoneUrl
}
"]`
);
const
button
=
document
.
querySelector
(
`.js-delete-milestone-button[data-milestone-url="
${
milestoneUrl
}
"]`
,
);
if
(
!
successful
)
{
if
(
!
successful
)
{
button
.
removeAttribute
(
'
disabled
'
);
button
.
removeAttribute
(
'
disabled
'
);
...
@@ -16,14 +18,16 @@ export default () => {
...
@@ -16,14 +18,16 @@ export default () => {
button
.
querySelector
(
'
.js-loading-icon
'
).
classList
.
add
(
'
hidden
'
);
button
.
querySelector
(
'
.js-loading-icon
'
).
classList
.
add
(
'
hidden
'
);
};
};
const
onRequestStarted
=
(
milestoneUrl
)
=>
{
const
onRequestStarted
=
milestoneUrl
=>
{
const
button
=
document
.
querySelector
(
`.js-delete-milestone-button[data-milestone-url="
${
milestoneUrl
}
"]`
);
const
button
=
document
.
querySelector
(
`.js-delete-milestone-button[data-milestone-url="
${
milestoneUrl
}
"]`
,
);
button
.
setAttribute
(
'
disabled
'
,
''
);
button
.
setAttribute
(
'
disabled
'
,
''
);
button
.
querySelector
(
'
.js-loading-icon
'
).
classList
.
remove
(
'
hidden
'
);
button
.
querySelector
(
'
.js-loading-icon
'
).
classList
.
remove
(
'
hidden
'
);
eventHub
.
$once
(
'
deleteMilestoneModal.requestFinished
'
,
onRequestFinished
);
eventHub
.
$once
(
'
deleteMilestoneModal.requestFinished
'
,
onRequestFinished
);
};
};
const
onDeleteButtonClick
=
(
event
)
=>
{
const
onDeleteButtonClick
=
event
=>
{
const
button
=
event
.
currentTarget
;
const
button
=
event
.
currentTarget
;
const
modalProps
=
{
const
modalProps
=
{
milestoneId
:
parseInt
(
button
.
dataset
.
milestoneId
,
10
),
milestoneId
:
parseInt
(
button
.
dataset
.
milestoneId
,
10
),
...
@@ -37,12 +41,12 @@ export default () => {
...
@@ -37,12 +41,12 @@ export default () => {
};
};
const
deleteMilestoneButtons
=
document
.
querySelectorAll
(
'
.js-delete-milestone-button
'
);
const
deleteMilestoneButtons
=
document
.
querySelectorAll
(
'
.js-delete-milestone-button
'
);
deleteMilestoneButtons
.
forEach
(
(
button
)
=>
{
deleteMilestoneButtons
.
forEach
(
button
=>
{
button
.
addEventListener
(
'
click
'
,
onDeleteButtonClick
);
button
.
addEventListener
(
'
click
'
,
onDeleteButtonClick
);
});
});
eventHub
.
$once
(
'
deleteMilestoneModal.mounted
'
,
()
=>
{
eventHub
.
$once
(
'
deleteMilestoneModal.mounted
'
,
()
=>
{
deleteMilestoneButtons
.
forEach
(
(
button
)
=>
{
deleteMilestoneButtons
.
forEach
(
button
=>
{
button
.
removeAttribute
(
'
disabled
'
);
button
.
removeAttribute
(
'
disabled
'
);
});
});
});
});
...
...
app/assets/javascripts/pages/milestones/shared/promote_milestone_modal_init.js
View file @
d2ee2eab
...
@@ -7,20 +7,24 @@ Vue.use(Translate);
...
@@ -7,20 +7,24 @@ Vue.use(Translate);
export
default
()
=>
{
export
default
()
=>
{
const
onRequestFinished
=
({
milestoneUrl
,
successful
})
=>
{
const
onRequestFinished
=
({
milestoneUrl
,
successful
})
=>
{
const
button
=
document
.
querySelector
(
`.js-promote-project-milestone-button[data-url="
${
milestoneUrl
}
"]`
);
const
button
=
document
.
querySelector
(
`.js-promote-project-milestone-button[data-url="
${
milestoneUrl
}
"]`
,
);
if
(
!
successful
)
{
if
(
!
successful
)
{
button
.
removeAttribute
(
'
disabled
'
);
button
.
removeAttribute
(
'
disabled
'
);
}
}
};
};
const
onRequestStarted
=
(
milestoneUrl
)
=>
{
const
onRequestStarted
=
milestoneUrl
=>
{
const
button
=
document
.
querySelector
(
`.js-promote-project-milestone-button[data-url="
${
milestoneUrl
}
"]`
);
const
button
=
document
.
querySelector
(
`.js-promote-project-milestone-button[data-url="
${
milestoneUrl
}
"]`
,
);
button
.
setAttribute
(
'
disabled
'
,
''
);
button
.
setAttribute
(
'
disabled
'
,
''
);
eventHub
.
$once
(
'
promoteMilestoneModal.requestFinished
'
,
onRequestFinished
);
eventHub
.
$once
(
'
promoteMilestoneModal.requestFinished
'
,
onRequestFinished
);
};
};
const
onDeleteButtonClick
=
(
event
)
=>
{
const
onDeleteButtonClick
=
event
=>
{
const
button
=
event
.
currentTarget
;
const
button
=
event
.
currentTarget
;
const
modalProps
=
{
const
modalProps
=
{
milestoneTitle
:
button
.
dataset
.
milestoneTitle
,
milestoneTitle
:
button
.
dataset
.
milestoneTitle
,
...
@@ -32,12 +36,12 @@ export default () => {
...
@@ -32,12 +36,12 @@ export default () => {
};
};
const
promoteMilestoneButtons
=
document
.
querySelectorAll
(
'
.js-promote-project-milestone-button
'
);
const
promoteMilestoneButtons
=
document
.
querySelectorAll
(
'
.js-promote-project-milestone-button
'
);
promoteMilestoneButtons
.
forEach
(
(
button
)
=>
{
promoteMilestoneButtons
.
forEach
(
button
=>
{
button
.
addEventListener
(
'
click
'
,
onDeleteButtonClick
);
button
.
addEventListener
(
'
click
'
,
onDeleteButtonClick
);
});
});
eventHub
.
$once
(
'
promoteMilestoneModal.mounted
'
,
()
=>
{
eventHub
.
$once
(
'
promoteMilestoneModal.mounted
'
,
()
=>
{
promoteMilestoneButtons
.
forEach
(
(
button
)
=>
{
promoteMilestoneButtons
.
forEach
(
button
=>
{
button
.
removeAttribute
(
'
disabled
'
);
button
.
removeAttribute
(
'
disabled
'
);
});
});
});
});
...
...
app/assets/javascripts/pages/profiles/index.js
View file @
d2ee2eab
...
@@ -3,9 +3,12 @@ import '~/profile/gl_crop';
...
@@ -3,9 +3,12 @@ import '~/profile/gl_crop';
import
Profile
from
'
~/profile/profile
'
;
import
Profile
from
'
~/profile/profile
'
;
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
$
(
document
).
on
(
'
input.ssh_key
'
,
'
#key_key
'
,
function
()
{
// eslint-disable-line func-names
// eslint-disable-next-line func-names
$
(
document
).
on
(
'
input.ssh_key
'
,
'
#key_key
'
,
function
()
{
const
$title
=
$
(
'
#key_title
'
);
const
$title
=
$
(
'
#key_title
'
);
const
comment
=
$
(
this
).
val
().
match
(
/^
\S
+
\S
+
(
.+
)\n?
$/
);
const
comment
=
$
(
this
)
.
val
()
.
match
(
/^
\S
+
\S
+
(
.+
)\n?
$/
);
// Extract the SSH Key title from its comment
// Extract the SSH Key title from its comment
if
(
comment
&&
comment
.
length
>
1
)
{
if
(
comment
&&
comment
.
length
>
1
)
{
...
...
app/assets/javascripts/pages/profiles/two_factor_auths/index.js
View file @
d2ee2eab
...
@@ -5,7 +5,9 @@ document.addEventListener('DOMContentLoaded', () => {
...
@@ -5,7 +5,9 @@ document.addEventListener('DOMContentLoaded', () => {
const
twoFactorNode
=
document
.
querySelector
(
'
.js-two-factor-auth
'
);
const
twoFactorNode
=
document
.
querySelector
(
'
.js-two-factor-auth
'
);
const
skippable
=
twoFactorNode
.
dataset
.
twoFactorSkippable
===
'
true
'
;
const
skippable
=
twoFactorNode
.
dataset
.
twoFactorSkippable
===
'
true
'
;
if
(
skippable
)
{
if
(
skippable
)
{
const
button
=
`<a class="btn btn-sm btn-warning float-right" data-method="patch" href="
${
twoFactorNode
.
dataset
.
two_factor_skip_url
}
">Configure it later</a>`
;
const
button
=
`<a class="btn btn-sm btn-warning float-right" data-method="patch" href="
${
twoFactorNode
.
dataset
.
two_factor_skip_url
}
">Configure it later</a>`
;
const
flashAlert
=
document
.
querySelector
(
'
.flash-alert .container-fluid
'
);
const
flashAlert
=
document
.
querySelector
(
'
.flash-alert .container-fluid
'
);
if
(
flashAlert
)
flashAlert
.
insertAdjacentHTML
(
'
beforeend
'
,
button
);
if
(
flashAlert
)
flashAlert
.
insertAdjacentHTML
(
'
beforeend
'
,
button
);
}
}
...
...
app/assets/javascripts/pages/projects/branches/new/index.js
View file @
d2ee2eab
import
$
from
'
jquery
'
;
import
$
from
'
jquery
'
;
import
NewBranchForm
from
'
~/new_branch_form
'
;
import
NewBranchForm
from
'
~/new_branch_form
'
;
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
(
document
.
addEventListener
(
new
NewBranchForm
(
$
(
'
.js-create-branch-form
'
),
JSON
.
parse
(
document
.
getElementById
(
'
availableRefs
'
).
innerHTML
))
'
DOMContentLoaded
'
,
));
()
=>
new
NewBranchForm
(
$
(
'
.js-create-branch-form
'
),
JSON
.
parse
(
document
.
getElementById
(
'
availableRefs
'
).
innerHTML
),
),
);
app/assets/javascripts/pages/projects/graphs/charts/index.js
View file @
d2ee2eab
...
@@ -31,14 +31,16 @@ document.addEventListener('DOMContentLoaded', () => {
...
@@ -31,14 +31,16 @@ document.addEventListener('DOMContentLoaded', () => {
const
chartData
=
data
=>
({
const
chartData
=
data
=>
({
labels
:
Object
.
keys
(
data
),
labels
:
Object
.
keys
(
data
),
datasets
:
[{
datasets
:
[
{
fillColor
:
'
rgba(220,220,220,0.5)
'
,
fillColor
:
'
rgba(220,220,220,0.5)
'
,
strokeColor
:
'
rgba(220,220,220,1)
'
,
strokeColor
:
'
rgba(220,220,220,1)
'
,
barStrokeWidth
:
1
,
barStrokeWidth
:
1
,
barValueSpacing
:
1
,
barValueSpacing
:
1
,
barDatasetSpacing
:
1
,
barDatasetSpacing
:
1
,
data
:
_
.
values
(
data
),
data
:
_
.
values
(
data
),
}],
},
],
});
});
const
hourData
=
chartData
(
projectChartData
.
hour
);
const
hourData
=
chartData
(
projectChartData
.
hour
);
...
@@ -51,7 +53,9 @@ document.addEventListener('DOMContentLoaded', () => {
...
@@ -51,7 +53,9 @@ document.addEventListener('DOMContentLoaded', () => {
responsiveChart
(
$
(
'
#month-chart
'
),
monthData
);
responsiveChart
(
$
(
'
#month-chart
'
),
monthData
);
const
data
=
projectChartData
.
languages
;
const
data
=
projectChartData
.
languages
;
const
ctx
=
$
(
'
#languages-chart
'
).
get
(
0
).
getContext
(
'
2d
'
);
const
ctx
=
$
(
'
#languages-chart
'
)
.
get
(
0
)
.
getContext
(
'
2d
'
);
const
options
=
{
const
options
=
{
scaleOverlay
:
true
,
scaleOverlay
:
true
,
responsive
:
true
,
responsive
:
true
,
...
...
app/assets/javascripts/pages/projects/graphs/show/index.js
View file @
d2ee2eab
...
@@ -7,7 +7,8 @@ import ContributorsStatGraph from './stat_graph_contributors';
...
@@ -7,7 +7,8 @@ import ContributorsStatGraph from './stat_graph_contributors';
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
const
url
=
document
.
querySelector
(
'
.js-graphs-show
'
).
dataset
.
projectGraphPath
;
const
url
=
document
.
querySelector
(
'
.js-graphs-show
'
).
dataset
.
projectGraphPath
;
axios
.
get
(
url
)
axios
.
get
(
url
)
.
then
(({
data
})
=>
{
.
then
(({
data
})
=>
{
const
graph
=
new
ContributorsStatGraph
();
const
graph
=
new
ContributorsStatGraph
();
graph
.
init
(
data
);
graph
.
init
(
data
);
...
...
app/assets/javascripts/pages/projects/graphs/show/stat_graph_contributors.js
View file @
d2ee2eab
...
@@ -3,7 +3,11 @@
...
@@ -3,7 +3,11 @@
import
$
from
'
jquery
'
;
import
$
from
'
jquery
'
;
import
_
from
'
underscore
'
;
import
_
from
'
underscore
'
;
import
{
n__
,
s__
,
createDateTimeFormat
,
sprintf
}
from
'
~/locale
'
;
import
{
n__
,
s__
,
createDateTimeFormat
,
sprintf
}
from
'
~/locale
'
;
import
{
ContributorsGraph
,
ContributorsAuthorGraph
,
ContributorsMasterGraph
}
from
'
./stat_graph_contributors_graph
'
;
import
{
ContributorsGraph
,
ContributorsAuthorGraph
,
ContributorsMasterGraph
,
}
from
'
./stat_graph_contributors_graph
'
;
import
ContributorsStatGraphUtil
from
'
./stat_graph_contributors_util
'
;
import
ContributorsStatGraphUtil
from
'
./stat_graph_contributors_util
'
;
export
default
(
function
()
{
export
default
(
function
()
{
...
@@ -14,7 +18,7 @@ export default (function() {
...
@@ -14,7 +18,7 @@ export default (function() {
ContributorsStatGraph
.
prototype
.
init
=
function
(
log
)
{
ContributorsStatGraph
.
prototype
.
init
=
function
(
log
)
{
var
author_commits
,
total_commits
;
var
author_commits
,
total_commits
;
this
.
parsed_log
=
ContributorsStatGraphUtil
.
parse_log
(
log
);
this
.
parsed_log
=
ContributorsStatGraphUtil
.
parse_log
(
log
);
this
.
set_current_field
(
"
commits
"
);
this
.
set_current_field
(
'
commits
'
);
total_commits
=
ContributorsStatGraphUtil
.
get_total_data
(
this
.
parsed_log
,
this
.
field
);
total_commits
=
ContributorsStatGraphUtil
.
get_total_data
(
this
.
parsed_log
,
this
.
field
);
author_commits
=
ContributorsStatGraphUtil
.
get_author_data
(
this
.
parsed_log
,
this
.
field
);
author_commits
=
ContributorsStatGraphUtil
.
get_author_data
(
this
.
parsed_log
,
this
.
field
);
this
.
add_master_graph
(
total_commits
);
this
.
add_master_graph
(
total_commits
);
...
@@ -31,23 +35,26 @@ export default (function() {
...
@@ -31,23 +35,26 @@ export default (function() {
var
limited_author_data
;
var
limited_author_data
;
this
.
authors
=
[];
this
.
authors
=
[];
limited_author_data
=
author_data
.
slice
(
0
,
100
);
limited_author_data
=
author_data
.
slice
(
0
,
100
);
return
_
.
each
(
limited_author_data
,
(
function
(
_this
)
{
return
_
.
each
(
limited_author_data
,
(
function
(
_this
)
{
return
function
(
d
)
{
return
function
(
d
)
{
var
author_graph
,
author_header
;
var
author_graph
,
author_header
;
author_header
=
_this
.
create_author_header
(
d
);
author_header
=
_this
.
create_author_header
(
d
);
$
(
"
.contributors-list
"
).
append
(
author_header
);
$
(
'
.contributors-list
'
).
append
(
author_header
);
author_graph
=
new
ContributorsAuthorGraph
(
d
.
dates
);
author_graph
=
new
ContributorsAuthorGraph
(
d
.
dates
);
_this
.
authors
[
d
.
author_name
]
=
author_graph
;
_this
.
authors
[
d
.
author_name
]
=
author_graph
;
return
author_graph
.
draw
();
return
author_graph
.
draw
();
};
};
})(
this
));
})(
this
),
);
};
};
ContributorsStatGraph
.
prototype
.
format_author_commit_info
=
function
(
author
)
{
ContributorsStatGraph
.
prototype
.
format_author_commit_info
=
function
(
author
)
{
var
commits
;
var
commits
;
commits
=
$
(
'
<span/>
'
,
{
commits
=
$
(
'
<span/>
'
,
{
"
class
"
:
'
graph-author-commits-count
'
class
:
'
graph-author-commits-count
'
,
});
});
commits
.
text
(
n__
(
'
%d commit
'
,
'
%d commits
'
,
author
.
commits
));
commits
.
text
(
n__
(
'
%d commit
'
,
'
%d commits
'
,
author
.
commits
));
return
$
(
'
<span/>
'
).
append
(
commits
);
return
$
(
'
<span/>
'
).
append
(
commits
);
...
@@ -56,13 +63,13 @@ export default (function() {
...
@@ -56,13 +63,13 @@ export default (function() {
ContributorsStatGraph
.
prototype
.
create_author_header
=
function
(
author
)
{
ContributorsStatGraph
.
prototype
.
create_author_header
=
function
(
author
)
{
var
author_commit_info
,
author_commit_info_span
,
author_email
,
author_name
,
list_item
;
var
author_commit_info
,
author_commit_info_span
,
author_email
,
author_name
,
list_item
;
list_item
=
$
(
'
<li/>
'
,
{
list_item
=
$
(
'
<li/>
'
,
{
"
class
"
:
'
person
'
,
class
:
'
person
'
,
style
:
'
display: block;
'
style
:
'
display: block;
'
,
});
});
author_name
=
$
(
'
<h4>
'
+
author
.
author_name
+
'
</h4>
'
);
author_name
=
$
(
'
<h4>
'
+
author
.
author_name
+
'
</h4>
'
);
author_email
=
$
(
'
<p class="graph-author-email">
'
+
author
.
author_email
+
'
</p>
'
);
author_email
=
$
(
'
<p class="graph-author-email">
'
+
author
.
author_email
+
'
</p>
'
);
author_commit_info_span
=
$
(
'
<span/>
'
,
{
author_commit_info_span
=
$
(
'
<span/>
'
,
{
"
class
"
:
'
commits
'
class
:
'
commits
'
,
});
});
author_commit_info
=
this
.
format_author_commit_info
(
author
);
author_commit_info
=
this
.
format_author_commit_info
(
author
);
author_commit_info_span
.
html
(
author_commit_info
);
author_commit_info_span
.
html
(
author_commit_info
);
...
@@ -80,37 +87,41 @@ export default (function() {
...
@@ -80,37 +87,41 @@ export default (function() {
};
};
ContributorsStatGraph
.
prototype
.
redraw_authors
=
function
()
{
ContributorsStatGraph
.
prototype
.
redraw_authors
=
function
()
{
$
(
"
ol
"
).
html
(
""
);
$
(
'
ol
'
).
html
(
''
);
const
{
x_domain
}
=
ContributorsGraph
.
prototype
;
const
{
x_domain
}
=
ContributorsGraph
.
prototype
;
const
author_commits
=
ContributorsStatGraphUtil
.
get_author_data
(
this
.
parsed_log
,
this
.
field
,
x_domain
);
const
author_commits
=
ContributorsStatGraphUtil
.
get_author_data
(
this
.
parsed_log
,
this
.
field
,
x_domain
,
);
return
_
.
each
(
author_commits
,
(
function
(
_this
)
{
return
_
.
each
(
author_commits
,
(
function
(
_this
)
{
return
function
(
d
)
{
return
function
(
d
)
{
_this
.
redraw_author_commit_info
(
d
);
_this
.
redraw_author_commit_info
(
d
);
if
(
_this
.
authors
[
d
.
author_name
]
!=
null
)
{
if
(
_this
.
authors
[
d
.
author_name
]
!=
null
)
{
$
(
_this
.
authors
[
d
.
author_name
].
list_item
).
appendTo
(
"
ol
"
);
$
(
_this
.
authors
[
d
.
author_name
].
list_item
).
appendTo
(
'
ol
'
);
_this
.
authors
[
d
.
author_name
].
set_data
(
d
.
dates
);
_this
.
authors
[
d
.
author_name
].
set_data
(
d
.
dates
);
return
_this
.
authors
[
d
.
author_name
].
redraw
();
return
_this
.
authors
[
d
.
author_name
].
redraw
();
}
}
return
''
;
return
''
;
};
};
})(
this
));
})(
this
),
);
};
};
ContributorsStatGraph
.
prototype
.
set_current_field
=
function
(
field
)
{
ContributorsStatGraph
.
prototype
.
set_current_field
=
function
(
field
)
{
return
this
.
field
=
field
;
return
(
this
.
field
=
field
)
;
};
};
ContributorsStatGraph
.
prototype
.
change_date_header
=
function
()
{
ContributorsStatGraph
.
prototype
.
change_date_header
=
function
()
{
const
{
x_domain
}
=
ContributorsGraph
.
prototype
;
const
{
x_domain
}
=
ContributorsGraph
.
prototype
;
const
formattedDateRange
=
sprintf
(
const
formattedDateRange
=
sprintf
(
s__
(
'
ContributorsPage|%{startDate} – %{endDate}
'
),
{
s__
(
'
ContributorsPage|%{startDate} – %{endDate}
'
),
{
startDate
:
this
.
dateFormat
.
format
(
new
Date
(
x_domain
[
0
])),
startDate
:
this
.
dateFormat
.
format
(
new
Date
(
x_domain
[
0
])),
endDate
:
this
.
dateFormat
.
format
(
new
Date
(
x_domain
[
1
])),
endDate
:
this
.
dateFormat
.
format
(
new
Date
(
x_domain
[
1
])),
},
});
);
return
$
(
'
#date_header
'
).
text
(
formattedDateRange
);
return
$
(
'
#date_header
'
).
text
(
formattedDateRange
);
};
};
...
@@ -120,7 +131,7 @@ export default (function() {
...
@@ -120,7 +131,7 @@ export default (function() {
if
(
$author
!=
null
)
{
if
(
$author
!=
null
)
{
author_list_item
=
$
(
this
.
authors
[
author
.
author_name
].
list_item
);
author_list_item
=
$
(
this
.
authors
[
author
.
author_name
].
list_item
);
author_commit_info
=
this
.
format_author_commit_info
(
author
);
author_commit_info
=
this
.
format_author_commit_info
(
author
);
return
author_list_item
.
find
(
"
span
"
).
html
(
author_commit_info
);
return
author_list_item
.
find
(
'
span
'
).
html
(
author_commit_info
);
}
}
return
''
;
return
''
;
};
};
...
...
app/assets/javascripts/pages/projects/graphs/show/stat_graph_contributors_graph.js
View file @
d2ee2eab
This diff is collapsed.
Click to expand it.
app/assets/javascripts/pages/projects/graphs/show/stat_graph_contributors_util.js
View file @
d2ee2eab
...
@@ -26,12 +26,12 @@ export default {
...
@@ -26,12 +26,12 @@ export default {
by_author
=
_
.
toArray
(
by_author
);
by_author
=
_
.
toArray
(
by_author
);
return
{
return
{
total
:
total
,
total
:
total
,
by_author
:
by_author
by_author
:
by_author
,
};
};
},
},
add_date
:
function
(
date
,
collection
)
{
add_date
:
function
(
date
,
collection
)
{
collection
[
date
]
=
{};
collection
[
date
]
=
{};
return
collection
[
date
].
date
=
date
;
return
(
collection
[
date
].
date
=
date
)
;
},
},
add_author
:
function
(
author
,
by_author
,
by_email
)
{
add_author
:
function
(
author
,
by_author
,
by_email
)
{
var
data
,
normalized_email
;
var
data
,
normalized_email
;
...
@@ -49,28 +49,28 @@ export default {
...
@@ -49,28 +49,28 @@ export default {
return
this
.
store_deletions
(
entry
,
total
,
by_author
);
return
this
.
store_deletions
(
entry
,
total
,
by_author
);
},
},
store_commits
:
function
(
total
,
by_author
)
{
store_commits
:
function
(
total
,
by_author
)
{
this
.
add
(
total
,
"
commits
"
,
1
);
this
.
add
(
total
,
'
commits
'
,
1
);
return
this
.
add
(
by_author
,
"
commits
"
,
1
);
return
this
.
add
(
by_author
,
'
commits
'
,
1
);
},
},
add
:
function
(
collection
,
field
,
value
)
{
add
:
function
(
collection
,
field
,
value
)
{
if
(
collection
[
field
]
==
null
)
{
if
(
collection
[
field
]
==
null
)
{
collection
[
field
]
=
0
;
collection
[
field
]
=
0
;
}
}
return
collection
[
field
]
+=
value
;
return
(
collection
[
field
]
+=
value
)
;
},
},
store_additions
:
function
(
entry
,
total
,
by_author
)
{
store_additions
:
function
(
entry
,
total
,
by_author
)
{
if
(
entry
.
additions
==
null
)
{
if
(
entry
.
additions
==
null
)
{
entry
.
additions
=
0
;
entry
.
additions
=
0
;
}
}
this
.
add
(
total
,
"
additions
"
,
entry
.
additions
);
this
.
add
(
total
,
'
additions
'
,
entry
.
additions
);
return
this
.
add
(
by_author
,
"
additions
"
,
entry
.
additions
);
return
this
.
add
(
by_author
,
'
additions
'
,
entry
.
additions
);
},
},
store_deletions
:
function
(
entry
,
total
,
by_author
)
{
store_deletions
:
function
(
entry
,
total
,
by_author
)
{
if
(
entry
.
deletions
==
null
)
{
if
(
entry
.
deletions
==
null
)
{
entry
.
deletions
=
0
;
entry
.
deletions
=
0
;
}
}
this
.
add
(
total
,
"
deletions
"
,
entry
.
deletions
);
this
.
add
(
total
,
'
deletions
'
,
entry
.
deletions
);
return
this
.
add
(
by_author
,
"
deletions
"
,
entry
.
deletions
);
return
this
.
add
(
by_author
,
'
deletions
'
,
entry
.
deletions
);
},
},
get_total_data
:
function
(
parsed_log
,
field
)
{
get_total_data
:
function
(
parsed_log
,
field
)
{
var
log
,
total_data
;
var
log
,
total_data
;
...
@@ -95,7 +95,9 @@ export default {
...
@@ -95,7 +95,9 @@ export default {
}
}
log
=
parsed_log
.
by_author
;
log
=
parsed_log
.
by_author
;
author_data
=
[];
author_data
=
[];
_
.
each
(
log
,
(
function
(
_this
)
{
_
.
each
(
log
,
(
function
(
_this
)
{
return
function
(
log_entry
)
{
return
function
(
log_entry
)
{
var
parsed_log_entry
;
var
parsed_log_entry
;
parsed_log_entry
=
_this
.
parse_log_entry
(
log_entry
,
field
,
date_range
);
parsed_log_entry
=
_this
.
parse_log_entry
(
log_entry
,
field
,
date_range
);
...
@@ -103,7 +105,8 @@ export default {
...
@@ -103,7 +105,8 @@ export default {
return
author_data
.
push
(
parsed_log_entry
);
return
author_data
.
push
(
parsed_log_entry
);
}
}
};
};
})(
this
));
})(
this
),
);
return
_
.
sortBy
(
author_data
,
function
(
d
)
{
return
_
.
sortBy
(
author_data
,
function
(
d
)
{
return
d
[
field
];
return
d
[
field
];
}).
reverse
();
}).
reverse
();
...
@@ -120,16 +123,19 @@ export default {
...
@@ -120,16 +123,19 @@ export default {
parsed_entry
.
additions
=
0
;
parsed_entry
.
additions
=
0
;
parsed_entry
.
deletions
=
0
;
parsed_entry
.
deletions
=
0
;
_
.
each
(
_
.
omit
(
log_entry
,
'
author_name
'
,
'
author_email
'
),
(
function
(
_this
)
{
_
.
each
(
_
.
omit
(
log_entry
,
'
author_name
'
,
'
author_email
'
),
(
function
(
_this
)
{
return
function
(
value
,
key
)
{
return
function
(
value
,
key
)
{
if
(
_this
.
in_range
(
value
.
date
,
date_range
))
{
if
(
_this
.
in_range
(
value
.
date
,
date_range
))
{
parsed_entry
.
dates
[
value
.
date
]
=
value
[
field
];
parsed_entry
.
dates
[
value
.
date
]
=
value
[
field
];
parsed_entry
.
commits
+=
value
.
commits
;
parsed_entry
.
commits
+=
value
.
commits
;
parsed_entry
.
additions
+=
value
.
additions
;
parsed_entry
.
additions
+=
value
.
additions
;
return
parsed_entry
.
deletions
+=
value
.
deletions
;
return
(
parsed_entry
.
deletions
+=
value
.
deletions
)
;
}
}
};
};
})(
this
));
})(
this
),
);
return
parsed_entry
;
return
parsed_entry
;
},
},
in_range
:
function
(
date
,
date_range
)
{
in_range
:
function
(
date
,
date_range
)
{
...
@@ -139,5 +145,5 @@ export default {
...
@@ -139,5 +145,5 @@ export default {
}
else
{
}
else
{
return
false
;
return
false
;
}
}
}
}
,
};
};
app/assets/javascripts/pages/projects/init_blob.js
View file @
d2ee2eab
...
@@ -16,7 +16,8 @@ export default () => {
...
@@ -16,7 +16,8 @@ export default () => {
);
);
const
fileBlobPermalinkUrlElement
=
document
.
querySelector
(
'
.js-data-file-blob-permalink-url
'
);
const
fileBlobPermalinkUrlElement
=
document
.
querySelector
(
'
.js-data-file-blob-permalink-url
'
);
const
fileBlobPermalinkUrl
=
fileBlobPermalinkUrlElement
&&
fileBlobPermalinkUrlElement
.
getAttribute
(
'
href
'
);
const
fileBlobPermalinkUrl
=
fileBlobPermalinkUrlElement
&&
fileBlobPermalinkUrlElement
.
getAttribute
(
'
href
'
);
new
ShortcutsNavigation
();
// eslint-disable-line no-new
new
ShortcutsNavigation
();
// eslint-disable-line no-new
...
...
app/assets/javascripts/pages/projects/init_form.js
View file @
d2ee2eab
import
ZenMode
from
'
~/zen_mode
'
;
import
ZenMode
from
'
~/zen_mode
'
;
import
GLForm
from
'
~/gl_form
'
;
import
GLForm
from
'
~/gl_form
'
;
export
default
function
(
$formEl
)
{
export
default
function
(
$formEl
)
{
new
ZenMode
();
// eslint-disable-line no-new
new
ZenMode
();
// eslint-disable-line no-new
new
GLForm
(
$formEl
);
// eslint-disable-line no-new
new
GLForm
(
$formEl
);
// eslint-disable-line no-new
}
}
app/assets/javascripts/pages/projects/issues/show.js
View file @
d2ee2eab
...
@@ -5,7 +5,7 @@ import ZenMode from '~/zen_mode';
...
@@ -5,7 +5,7 @@ import ZenMode from '~/zen_mode';
import
'
~/notes/index
'
;
import
'
~/notes/index
'
;
import
initIssueableApp
from
'
~/issue_show
'
;
import
initIssueableApp
from
'
~/issue_show
'
;
export
default
function
()
{
export
default
function
()
{
initIssueableApp
();
initIssueableApp
();
new
Issue
();
// eslint-disable-line no-new
new
Issue
();
// eslint-disable-line no-new
new
ShortcutsIssuable
();
// eslint-disable-line no-new
new
ShortcutsIssuable
();
// eslint-disable-line no-new
...
...
app/assets/javascripts/pages/projects/labels/components/promote_label_modal.vue
View file @
d2ee2eab
<
script
>
<
script
>
import
_
from
'
underscore
'
;
import
_
from
'
underscore
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
createFlash
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
GlModal
from
'
~/vue_shared/components/gl_modal.vue
'
;
import
GlModal
from
'
~/vue_shared/components/gl_modal.vue
'
;
import
{
s__
,
sprintf
}
from
'
~/locale
'
;
import
{
s__
,
sprintf
}
from
'
~/locale
'
;
import
{
visitUrl
}
from
'
~/lib/utils/url_utility
'
;
import
{
visitUrl
}
from
'
~/lib/utils/url_utility
'
;
import
eventHub
from
'
../event_hub
'
;
import
eventHub
from
'
../event_hub
'
;
export
default
{
export
default
{
components
:
{
components
:
{
GlModal
,
GlModal
,
},
},
...
@@ -35,11 +35,14 @@
...
@@ -35,11 +35,14 @@
},
},
computed
:
{
computed
:
{
text
()
{
text
()
{
return
sprintf
(
s__
(
`Labels|Promoting %{labelTitle} will make it available for all projects inside %{groupName}.
return
sprintf
(
Existing project labels with the same title will be merged. This action cannot be reversed.`
),
{
s__
(
`Labels|Promoting %{labelTitle} will make it available for all projects inside %{groupName}.
Existing project labels with the same title will be merged. This action cannot be reversed.`
),
{
labelTitle
:
this
.
labelTitle
,
labelTitle
:
this
.
labelTitle
,
groupName
:
this
.
groupName
,
groupName
:
this
.
groupName
,
});
},
);
},
},
title
()
{
title
()
{
const
label
=
`<span
const
label
=
`<span
...
@@ -47,26 +50,37 @@
...
@@ -47,26 +50,37 @@
style="background-color:
${
this
.
labelColor
}
; color:
${
this
.
labelTextColor
}
;"
style="background-color:
${
this
.
labelColor
}
; color:
${
this
.
labelTextColor
}
;"
>
${
_
.
escape
(
this
.
labelTitle
)}
</span>`
;
>
${
_
.
escape
(
this
.
labelTitle
)}
</span>`
;
return
sprintf
(
s__
(
'
Labels|<span>Promote label</span> %{labelTitle} <span>to Group Label?</span>
'
),
{
return
sprintf
(
s__
(
'
Labels|<span>Promote label</span> %{labelTitle} <span>to Group Label?</span>
'
),
{
labelTitle
:
label
,
labelTitle
:
label
,
},
false
);
},
false
,
);
},
},
},
},
methods
:
{
methods
:
{
onSubmit
()
{
onSubmit
()
{
eventHub
.
$emit
(
'
promoteLabelModal.requestStarted
'
,
this
.
url
);
eventHub
.
$emit
(
'
promoteLabelModal.requestStarted
'
,
this
.
url
);
return
axios
.
post
(
this
.
url
,
{
params
:
{
format
:
'
json
'
}
})
return
axios
.
then
((
response
)
=>
{
.
post
(
this
.
url
,
{
params
:
{
format
:
'
json
'
}
})
eventHub
.
$emit
(
'
promoteLabelModal.requestFinished
'
,
{
labelUrl
:
this
.
url
,
successful
:
true
});
.
then
(
response
=>
{
eventHub
.
$emit
(
'
promoteLabelModal.requestFinished
'
,
{
labelUrl
:
this
.
url
,
successful
:
true
,
});
visitUrl
(
response
.
data
.
url
);
visitUrl
(
response
.
data
.
url
);
})
})
.
catch
((
error
)
=>
{
.
catch
(
error
=>
{
eventHub
.
$emit
(
'
promoteLabelModal.requestFinished
'
,
{
labelUrl
:
this
.
url
,
successful
:
false
});
eventHub
.
$emit
(
'
promoteLabelModal.requestFinished
'
,
{
labelUrl
:
this
.
url
,
successful
:
false
,
});
createFlash
(
error
);
createFlash
(
error
);
});
});
},
},
},
},
};
};
</
script
>
</
script
>
<
template
>
<
template
>
<gl-modal
<gl-modal
...
...
app/assets/javascripts/pages/projects/labels/index/index.js
View file @
d2ee2eab
...
@@ -10,20 +10,24 @@ const initLabelIndex = () => {
...
@@ -10,20 +10,24 @@ const initLabelIndex = () => {
initLabels
();
initLabels
();
const
onRequestFinished
=
({
labelUrl
,
successful
})
=>
{
const
onRequestFinished
=
({
labelUrl
,
successful
})
=>
{
const
button
=
document
.
querySelector
(
`.js-promote-project-label-button[data-url="
${
labelUrl
}
"]`
);
const
button
=
document
.
querySelector
(
`.js-promote-project-label-button[data-url="
${
labelUrl
}
"]`
,
);
if
(
!
successful
)
{
if
(
!
successful
)
{
button
.
removeAttribute
(
'
disabled
'
);
button
.
removeAttribute
(
'
disabled
'
);
}
}
};
};
const
onRequestStarted
=
(
labelUrl
)
=>
{
const
onRequestStarted
=
labelUrl
=>
{
const
button
=
document
.
querySelector
(
`.js-promote-project-label-button[data-url="
${
labelUrl
}
"]`
);
const
button
=
document
.
querySelector
(
`.js-promote-project-label-button[data-url="
${
labelUrl
}
"]`
,
);
button
.
setAttribute
(
'
disabled
'
,
''
);
button
.
setAttribute
(
'
disabled
'
,
''
);
eventHub
.
$once
(
'
promoteLabelModal.requestFinished
'
,
onRequestFinished
);
eventHub
.
$once
(
'
promoteLabelModal.requestFinished
'
,
onRequestFinished
);
};
};
const
onDeleteButtonClick
=
(
event
)
=>
{
const
onDeleteButtonClick
=
event
=>
{
const
button
=
event
.
currentTarget
;
const
button
=
event
.
currentTarget
;
const
modalProps
=
{
const
modalProps
=
{
labelTitle
:
button
.
dataset
.
labelTitle
,
labelTitle
:
button
.
dataset
.
labelTitle
,
...
@@ -37,12 +41,12 @@ const initLabelIndex = () => {
...
@@ -37,12 +41,12 @@ const initLabelIndex = () => {
};
};
const
promoteLabelButtons
=
document
.
querySelectorAll
(
'
.js-promote-project-label-button
'
);
const
promoteLabelButtons
=
document
.
querySelectorAll
(
'
.js-promote-project-label-button
'
);
promoteLabelButtons
.
forEach
(
(
button
)
=>
{
promoteLabelButtons
.
forEach
(
button
=>
{
button
.
addEventListener
(
'
click
'
,
onDeleteButtonClick
);
button
.
addEventListener
(
'
click
'
,
onDeleteButtonClick
);
});
});
eventHub
.
$once
(
'
promoteLabelModal.mounted
'
,
()
=>
{
eventHub
.
$once
(
'
promoteLabelModal.mounted
'
,
()
=>
{
promoteLabelButtons
.
forEach
(
(
button
)
=>
{
promoteLabelButtons
.
forEach
(
button
=>
{
button
.
removeAttribute
(
'
disabled
'
);
button
.
removeAttribute
(
'
disabled
'
);
});
});
});
});
...
...
app/assets/javascripts/pages/projects/network/network.js
View file @
d2ee2eab
...
@@ -6,13 +6,15 @@ import BranchGraph from '../../../network/branch_graph';
...
@@ -6,13 +6,15 @@ import BranchGraph from '../../../network/branch_graph';
export
default
(
function
()
{
export
default
(
function
()
{
function
Network
(
opts
)
{
function
Network
(
opts
)
{
var
vph
;
var
vph
;
$
(
"
#filter_ref
"
).
click
(
function
()
{
$
(
'
#filter_ref
'
).
click
(
function
()
{
return
$
(
this
).
closest
(
'
form
'
).
submit
();
return
$
(
this
)
.
closest
(
'
form
'
)
.
submit
();
});
});
this
.
branch_graph
=
new
BranchGraph
(
$
(
"
.network-graph
"
),
opts
);
this
.
branch_graph
=
new
BranchGraph
(
$
(
'
.network-graph
'
),
opts
);
vph
=
$
(
window
).
height
()
-
250
;
vph
=
$
(
window
).
height
()
-
250
;
$
(
'
.network-graph
'
).
css
({
$
(
'
.network-graph
'
).
css
({
'
height
'
:
vph
+
'
px
'
height
:
vph
+
'
px
'
,
});
});
}
}
...
...
app/assets/javascripts/pages/projects/pipeline_schedules/index/index.js
View file @
d2ee2eab
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
PipelineSchedulesCallout
from
'
../shared/components/pipeline_schedules_callout.vue
'
;
import
PipelineSchedulesCallout
from
'
../shared/components/pipeline_schedules_callout.vue
'
;
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
new
Vue
({
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
new
Vue
({
el
:
'
#pipeline-schedules-callout
'
,
el
:
'
#pipeline-schedules-callout
'
,
components
:
{
components
:
{
'
pipeline-schedules-callout
'
:
PipelineSchedulesCallout
,
'
pipeline-schedules-callout
'
:
PipelineSchedulesCallout
,
...
@@ -9,4 +12,5 @@ document.addEventListener('DOMContentLoaded', () => new Vue({
...
@@ -9,4 +12,5 @@ document.addEventListener('DOMContentLoaded', () => new Vue({
render
(
createElement
)
{
render
(
createElement
)
{
return
createElement
(
'
pipeline-schedules-callout
'
);
return
createElement
(
'
pipeline-schedules-callout
'
);
},
},
}));
}),
);
app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/interval_pattern_input.vue
View file @
d2ee2eab
<
script
>
<
script
>
import
_
from
'
underscore
'
;
import
_
from
'
underscore
'
;
export
default
{
export
default
{
props
:
{
props
:
{
initialCronInterval
:
{
initialCronInterval
:
{
type
:
String
,
type
:
String
,
...
@@ -57,7 +57,7 @@
...
@@ -57,7 +57,7 @@
}
}
},
},
},
},
};
};
</
script
>
</
script
>
<
template
>
<
template
>
...
...
app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/pipeline_schedules_callout.vue
View file @
d2ee2eab
<
script
>
<
script
>
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
Cookies
from
'
js-cookie
'
;
import
Cookies
from
'
js-cookie
'
;
import
Translate
from
'
../../../../../vue_shared/translate
'
;
import
Translate
from
'
../../../../../vue_shared/translate
'
;
import
illustrationSvg
from
'
../icons/intro_illustration.svg
'
;
import
illustrationSvg
from
'
../icons/intro_illustration.svg
'
;
Vue
.
use
(
Translate
);
Vue
.
use
(
Translate
);
const
cookieKey
=
'
pipeline_schedules_callout_dismissed
'
;
const
cookieKey
=
'
pipeline_schedules_callout_dismissed
'
;
export
default
{
export
default
{
name
:
'
PipelineSchedulesCallout
'
,
name
:
'
PipelineSchedulesCallout
'
,
data
()
{
data
()
{
return
{
return
{
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
Cookies
.
set
(
cookieKey
,
this
.
calloutDismissed
,
{
expires
:
365
});
Cookies
.
set
(
cookieKey
,
this
.
calloutDismissed
,
{
expires
:
365
});
},
},
},
},
};
};
</
script
>
</
script
>
<
template
>
<
template
>
<div
<div
...
...
app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/target_branch_dropdown.js
View file @
d2ee2eab
...
@@ -26,8 +26,7 @@ export default class TargetBranchDropdown {
...
@@ -26,8 +26,7 @@ export default class TargetBranchDropdown {
}
}
formatBranchesList
()
{
formatBranchesList
()
{
return
this
.
$dropdown
.
data
(
'
data
'
)
return
this
.
$dropdown
.
data
(
'
data
'
).
map
(
val
=>
({
name
:
val
}));
.
map
(
val
=>
({
name
:
val
}));
}
}
setDropdownToggle
()
{
setDropdownToggle
()
{
...
...
app/assets/javascripts/pages/projects/pipeline_schedules/shared/init_form.js
View file @
d2ee2eab
...
@@ -11,7 +11,9 @@ Vue.use(Translate);
...
@@ -11,7 +11,9 @@ Vue.use(Translate);
function
initIntervalPatternInput
()
{
function
initIntervalPatternInput
()
{
const
intervalPatternMount
=
document
.
getElementById
(
'
interval-pattern-input
'
);
const
intervalPatternMount
=
document
.
getElementById
(
'
interval-pattern-input
'
);
const
initialCronInterval
=
intervalPatternMount
?
intervalPatternMount
.
dataset
.
initialInterval
:
''
;
const
initialCronInterval
=
intervalPatternMount
?
intervalPatternMount
.
dataset
.
initialInterval
:
''
;
return
new
Vue
({
return
new
Vue
({
el
:
intervalPatternMount
,
el
:
intervalPatternMount
,
...
...
app/assets/javascripts/pages/projects/pipelines/charts/index.js
View file @
d2ee2eab
...
@@ -7,10 +7,11 @@ const options = {
...
@@ -7,10 +7,11 @@ const options = {
maintainAspectRatio
:
false
,
maintainAspectRatio
:
false
,
};
};
const
buildChart
=
(
chartScope
)
=>
{
const
buildChart
=
chartScope
=>
{
const
data
=
{
const
data
=
{
labels
:
chartScope
.
labels
,
labels
:
chartScope
.
labels
,
datasets
:
[{
datasets
:
[
{
fillColor
:
'
#707070
'
,
fillColor
:
'
#707070
'
,
strokeColor
:
'
#707070
'
,
strokeColor
:
'
#707070
'
,
pointColor
:
'
#707070
'
,
pointColor
:
'
#707070
'
,
...
@@ -26,7 +27,9 @@ const buildChart = (chartScope) => {
...
@@ -26,7 +27,9 @@ const buildChart = (chartScope) => {
},
},
],
],
};
};
const
ctx
=
$
(
`#
${
chartScope
.
scope
}
Chart`
).
get
(
0
).
getContext
(
'
2d
'
);
const
ctx
=
$
(
`#
${
chartScope
.
scope
}
Chart`
)
.
get
(
0
)
.
getContext
(
'
2d
'
);
new
Chart
(
ctx
).
Line
(
data
,
options
);
new
Chart
(
ctx
).
Line
(
data
,
options
);
};
};
...
@@ -36,14 +39,16 @@ document.addEventListener('DOMContentLoaded', () => {
...
@@ -36,14 +39,16 @@ document.addEventListener('DOMContentLoaded', () => {
const
chartsData
=
JSON
.
parse
(
document
.
getElementById
(
'
pipelinesChartsData
'
).
innerHTML
);
const
chartsData
=
JSON
.
parse
(
document
.
getElementById
(
'
pipelinesChartsData
'
).
innerHTML
);
const
data
=
{
const
data
=
{
labels
:
chartTimesData
.
labels
,
labels
:
chartTimesData
.
labels
,
datasets
:
[{
datasets
:
[
{
fillColor
:
'
rgba(220,220,220,0.5)
'
,
fillColor
:
'
rgba(220,220,220,0.5)
'
,
strokeColor
:
'
rgba(220,220,220,1)
'
,
strokeColor
:
'
rgba(220,220,220,1)
'
,
barStrokeWidth
:
1
,
barStrokeWidth
:
1
,
barValueSpacing
:
1
,
barValueSpacing
:
1
,
barDatasetSpacing
:
1
,
barDatasetSpacing
:
1
,
data
:
chartTimesData
.
values
,
data
:
chartTimesData
.
values
,
}],
},
],
};
};
if
(
window
.
innerWidth
<
768
)
{
if
(
window
.
innerWidth
<
768
)
{
...
@@ -51,7 +56,11 @@ document.addEventListener('DOMContentLoaded', () => {
...
@@ -51,7 +56,11 @@ document.addEventListener('DOMContentLoaded', () => {
options
.
scaleFontSize
=
8
;
options
.
scaleFontSize
=
8
;
}
}
new
Chart
(
$
(
'
#build_timesChart
'
).
get
(
0
).
getContext
(
'
2d
'
)).
Bar
(
data
,
options
);
new
Chart
(
$
(
'
#build_timesChart
'
)
.
get
(
0
)
.
getContext
(
'
2d
'
),
).
Bar
(
data
,
options
);
chartsData
.
forEach
(
scope
=>
buildChart
(
scope
));
chartsData
.
forEach
(
scope
=>
buildChart
(
scope
));
});
});
app/assets/javascripts/pages/projects/pipelines/index/index.js
View file @
d2ee2eab
...
@@ -6,7 +6,10 @@ import { convertPermissionToBoolean } from '../../../../lib/utils/common_utils';
...
@@ -6,7 +6,10 @@ import { convertPermissionToBoolean } from '../../../../lib/utils/common_utils';
Vue
.
use
(
Translate
);
Vue
.
use
(
Translate
);
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
new
Vue
({
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
new
Vue
({
el
:
'
#pipelines-list-vue
'
,
el
:
'
#pipelines-list-vue
'
,
components
:
{
components
:
{
pipelinesComponent
,
pipelinesComponent
,
...
@@ -37,4 +40,5 @@ document.addEventListener('DOMContentLoaded', () => new Vue({
...
@@ -37,4 +40,5 @@ document.addEventListener('DOMContentLoaded', () => new Vue({
},
},
});
});
},
},
}));
}),
);
app/assets/javascripts/pages/projects/pipelines/init_pipelines.js
View file @
d2ee2eab
...
@@ -2,9 +2,12 @@ import Pipelines from '~/pipelines';
...
@@ -2,9 +2,12 @@ import Pipelines from '~/pipelines';
export
default
()
=>
{
export
default
()
=>
{
const
{
controllerAction
}
=
document
.
querySelector
(
'
.js-pipeline-container
'
).
dataset
;
const
{
controllerAction
}
=
document
.
querySelector
(
'
.js-pipeline-container
'
).
dataset
;
const
pipelineStatusUrl
=
`
${
document
.
querySelector
(
'
.js-pipeline-tab-link a
'
).
getAttribute
(
'
href
'
)}
/status.json`
;
const
pipelineStatusUrl
=
`
${
document
.
querySelector
(
'
.js-pipeline-tab-link a
'
)
.
getAttribute
(
'
href
'
)}
/status.json`
;
new
Pipelines
({
// eslint-disable-line no-new
// eslint-disable-next-line no-new
new
Pipelines
({
initTabs
:
true
,
initTabs
:
true
,
pipelineStatusUrl
,
pipelineStatusUrl
,
tabsOptions
:
{
tabsOptions
:
{
...
...
app/assets/javascripts/pages/projects/shared/permissions/components/project_feature_setting.vue
View file @
d2ee2eab
<
script
>
<
script
>
import
projectFeatureToggle
from
'
../../../../../vue_shared/components/toggle_button.vue
'
;
import
projectFeatureToggle
from
'
../../../../../vue_shared/components/toggle_button.vue
'
;
export
default
{
export
default
{
components
:
{
components
:
{
projectFeatureToggle
,
projectFeatureToggle
,
},
},
...
@@ -43,9 +43,7 @@
...
@@ -43,9 +43,7 @@
if
(
this
.
featureEnabled
)
{
if
(
this
.
featureEnabled
)
{
return
this
.
options
;
return
this
.
options
;
}
}
return
[
return
[[
0
,
'
Enable feature to choose access level
'
]];
[
0
,
'
Enable feature to choose access level
'
],
];
},
},
displaySelectInput
()
{
displaySelectInput
()
{
...
@@ -67,7 +65,7 @@
...
@@ -67,7 +65,7 @@
this
.
$emit
(
'
change
'
,
Number
(
e
.
target
.
value
));
this
.
$emit
(
'
change
'
,
Number
(
e
.
target
.
value
));
},
},
},
},
};
};
</
script
>
</
script
>
<
template
>
<
template
>
...
...
app/assets/javascripts/pages/projects/shared/permissions/components/project_setting_row.vue
View file @
d2ee2eab
<
script
>
<
script
>
export
default
{
export
default
{
props
:
{
props
:
{
label
:
{
label
:
{
type
:
String
,
type
:
String
,
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
default
:
null
,
default
:
null
,
},
},
},
},
};
};
</
script
>
</
script
>
<
template
>
<
template
>
...
...
app/assets/javascripts/pages/projects/shared/permissions/constants.js
View file @
d2ee2eab
...
@@ -5,7 +5,9 @@ export const visibilityOptions = {
...
@@ -5,7 +5,9 @@ export const visibilityOptions = {
};
};
export
const
visibilityLevelDescriptions
=
{
export
const
visibilityLevelDescriptions
=
{
[
visibilityOptions
.
PRIVATE
]:
'
The project is accessible only by members of the project. Access must be granted explicitly to each user.
'
,
[
visibilityOptions
.
PRIVATE
]:
'
The project is accessible only by members of the project. Access must be granted explicitly to each user.
'
,
[
visibilityOptions
.
INTERNAL
]:
'
The project can be accessed by any user who is logged in.
'
,
[
visibilityOptions
.
INTERNAL
]:
'
The project can be accessed by any user who is logged in.
'
,
[
visibilityOptions
.
PUBLIC
]:
'
The project can be accessed by anyone, regardless of authentication.
'
,
[
visibilityOptions
.
PUBLIC
]:
'
The project can be accessed by anyone, regardless of authentication.
'
,
};
};
app/assets/javascripts/pages/projects/shared/project_avatar.js
View file @
d2ee2eab
...
@@ -8,8 +8,9 @@ export default function projectAvatar() {
...
@@ -8,8 +8,9 @@ export default function projectAvatar() {
$
(
'
.js-project-avatar-input
'
).
bind
(
'
change
'
,
function
onClickAvatarInput
()
{
$
(
'
.js-project-avatar-input
'
).
bind
(
'
change
'
,
function
onClickAvatarInput
()
{
const
form
=
$
(
this
).
closest
(
'
form
'
);
const
form
=
$
(
this
).
closest
(
'
form
'
);
// eslint-disable-next-line no-useless-escape
const
filename
=
$
(
this
)
const
filename
=
$
(
this
).
val
().
replace
(
/^.*
[\\\/]
/
,
''
);
.
val
()
.
replace
(
/^.*
[\\\/]
/
,
''
);
// eslint-disable-line no-useless-escape
return
form
.
find
(
'
.js-avatar-filename
'
).
text
(
filename
);
return
form
.
find
(
'
.js-avatar-filename
'
).
text
(
filename
);
});
});
}
}
app/assets/javascripts/pages/projects/wikis/index.js
View file @
d2ee2eab
...
@@ -21,7 +21,8 @@ document.addEventListener('DOMContentLoaded', () => {
...
@@ -21,7 +21,8 @@ document.addEventListener('DOMContentLoaded', () => {
const
{
deleteWikiUrl
,
pageTitle
}
=
deleteWikiModalWrapperEl
.
dataset
;
const
{
deleteWikiUrl
,
pageTitle
}
=
deleteWikiModalWrapperEl
.
dataset
;
new
Vue
({
// eslint-disable-line no-new
// eslint-disable-next-line no-new
new
Vue
({
el
:
deleteWikiModalWrapperEl
,
el
:
deleteWikiModalWrapperEl
,
data
:
{
data
:
{
deleteWikiUrl
:
''
,
deleteWikiUrl
:
''
,
...
...
app/assets/javascripts/pages/search/show/search.js
View file @
d2ee2eab
...
@@ -22,7 +22,7 @@ export default class Search {
...
@@ -22,7 +22,7 @@ export default class Search {
fields
:
[
'
full_name
'
],
fields
:
[
'
full_name
'
],
},
},
data
(
term
,
callback
)
{
data
(
term
,
callback
)
{
return
Api
.
groups
(
term
,
{},
(
data
)
=>
{
return
Api
.
groups
(
term
,
{},
data
=>
{
data
.
unshift
({
data
.
unshift
({
full_name
:
'
Any
'
,
full_name
:
'
Any
'
,
});
});
...
@@ -37,7 +37,7 @@ export default class Search {
...
@@ -37,7 +37,7 @@ export default class Search {
return
obj
.
full_name
;
return
obj
.
full_name
;
},
},
toggleLabel
(
obj
)
{
toggleLabel
(
obj
)
{
return
`
${
(
$groupDropdown
.
data
(
'
defaultLabel
'
)
)}
${
obj
.
full_name
}
`
;
return
`
${
$groupDropdown
.
data
(
'
defaultLabel
'
)}
${
obj
.
full_name
}
`
;
},
},
clicked
:
()
=>
Search
.
submitSearch
(),
clicked
:
()
=>
Search
.
submitSearch
(),
});
});
...
@@ -52,7 +52,7 @@ export default class Search {
...
@@ -52,7 +52,7 @@ export default class Search {
},
},
data
:
(
term
,
callback
)
=>
{
data
:
(
term
,
callback
)
=>
{
this
.
getProjectsData
(
term
)
this
.
getProjectsData
(
term
)
.
then
(
(
data
)
=>
{
.
then
(
data
=>
{
data
.
unshift
({
data
.
unshift
({
name_with_namespace
:
'
Any
'
,
name_with_namespace
:
'
Any
'
,
});
});
...
@@ -70,7 +70,7 @@ export default class Search {
...
@@ -70,7 +70,7 @@ export default class Search {
return
obj
.
name_with_namespace
;
return
obj
.
name_with_namespace
;
},
},
toggleLabel
(
obj
)
{
toggleLabel
(
obj
)
{
return
`
${
(
$projectDropdown
.
data
(
'
defaultLabel
'
)
)}
${
obj
.
name_with_namespace
}
`
;
return
`
${
$projectDropdown
.
data
(
'
defaultLabel
'
)}
${
obj
.
name_with_namespace
}
`
;
},
},
clicked
:
()
=>
Search
.
submitSearch
(),
clicked
:
()
=>
Search
.
submitSearch
(),
});
});
...
@@ -99,17 +99,24 @@ export default class Search {
...
@@ -99,17 +99,24 @@ export default class Search {
}
}
clearSearchField
()
{
clearSearchField
()
{
return
$
(
this
.
searchInput
).
val
(
''
).
trigger
(
'
keyup
'
).
focus
();
return
$
(
this
.
searchInput
)
.
val
(
''
)
.
trigger
(
'
keyup
'
)
.
focus
();
}
}
getProjectsData
(
term
)
{
getProjectsData
(
term
)
{
return
new
Promise
(
(
resolve
)
=>
{
return
new
Promise
(
resolve
=>
{
if
(
this
.
groupId
)
{
if
(
this
.
groupId
)
{
Api
.
groupProjects
(
this
.
groupId
,
term
,
{},
resolve
);
Api
.
groupProjects
(
this
.
groupId
,
term
,
{},
resolve
);
}
else
{
}
else
{
Api
.
projects
(
term
,
{
Api
.
projects
(
term
,
{
order_by
:
'
id
'
,
order_by
:
'
id
'
,
},
resolve
);
},
resolve
,
);
}
}
});
});
}
}
...
...
app/assets/javascripts/pages/sessions/new/signin_tabs_memoizer.js
View file @
d2ee2eab
...
@@ -20,7 +20,7 @@ export default class SigninTabsMemoizer {
...
@@ -20,7 +20,7 @@ export default class SigninTabsMemoizer {
bootstrap
()
{
bootstrap
()
{
const
tabs
=
document
.
querySelectorAll
(
this
.
tabSelector
);
const
tabs
=
document
.
querySelectorAll
(
this
.
tabSelector
);
if
(
tabs
.
length
>
0
)
{
if
(
tabs
.
length
>
0
)
{
tabs
[
0
].
addEventListener
(
'
click
'
,
(
e
)
=>
{
tabs
[
0
].
addEventListener
(
'
click
'
,
e
=>
{
if
(
e
.
target
&&
e
.
target
.
nodeName
===
'
A
'
)
{
if
(
e
.
target
&&
e
.
target
.
nodeName
===
'
A
'
)
{
const
anchorName
=
e
.
target
.
getAttribute
(
'
href
'
);
const
anchorName
=
e
.
target
.
getAttribute
(
'
href
'
);
this
.
saveData
(
anchorName
);
this
.
saveData
(
anchorName
);
...
...
app/assets/javascripts/pages/sessions/new/username_validator.js
View file @
d2ee2eab
...
@@ -22,10 +22,10 @@ export default class UsernameValidator {
...
@@ -22,10 +22,10 @@ export default class UsernameValidator {
available
:
false
,
available
:
false
,
valid
:
false
,
valid
:
false
,
pending
:
false
,
pending
:
false
,
empty
:
true
empty
:
true
,
};
};
const
debounceTimeout
=
_
.
debounce
(
(
username
)
=>
{
const
debounceTimeout
=
_
.
debounce
(
username
=>
{
this
.
validateUsername
(
username
);
this
.
validateUsername
(
username
);
},
debounceTimeoutDuration
);
},
debounceTimeoutDuration
);
...
@@ -81,7 +81,8 @@ export default class UsernameValidator {
...
@@ -81,7 +81,8 @@ export default class UsernameValidator {
this
.
state
.
pending
=
true
;
this
.
state
.
pending
=
true
;
this
.
state
.
available
=
false
;
this
.
state
.
available
=
false
;
this
.
renderState
();
this
.
renderState
();
axios
.
get
(
`
${
gon
.
relative_url_root
}
/users/
${
username
}
/exists`
)
axios
.
get
(
`
${
gon
.
relative_url_root
}
/users/
${
username
}
/exists`
)
.
then
(({
data
})
=>
this
.
setAvailabilityState
(
data
.
exists
))
.
then
(({
data
})
=>
this
.
setAvailabilityState
(
data
.
exists
))
.
catch
(()
=>
flash
(
__
(
'
An error occurred while validating username
'
)));
.
catch
(()
=>
flash
(
__
(
'
An error occurred while validating username
'
)));
}
}
...
@@ -100,8 +101,7 @@ export default class UsernameValidator {
...
@@ -100,8 +101,7 @@ export default class UsernameValidator {
clearFieldValidationState
()
{
clearFieldValidationState
()
{
this
.
inputElement
.
siblings
(
'
p
'
).
hide
();
this
.
inputElement
.
siblings
(
'
p
'
).
hide
();
this
.
inputElement
.
removeClass
(
invalidInputClass
)
this
.
inputElement
.
removeClass
(
invalidInputClass
).
removeClass
(
successInputClass
);
.
removeClass
(
successInputClass
);
}
}
setUnavailableState
()
{
setUnavailableState
()
{
...
...
app/assets/javascripts/pages/users/index.js
View file @
d2ee2eab
...
@@ -13,10 +13,12 @@ function initUserProfile(action) {
...
@@ -13,10 +13,12 @@ function initUserProfile(action) {
new
UserTabs
({
parentEl
:
'
.user-profile
'
,
action
});
new
UserTabs
({
parentEl
:
'
.user-profile
'
,
action
});
// hide project limit message
// hide project limit message
$
(
'
.hide-project-limit-message
'
).
on
(
'
click
'
,
(
e
)
=>
{
$
(
'
.hide-project-limit-message
'
).
on
(
'
click
'
,
e
=>
{
e
.
preventDefault
();
e
.
preventDefault
();
Cookies
.
set
(
'
hide_project_limit_message
'
,
'
false
'
);
Cookies
.
set
(
'
hide_project_limit_message
'
,
'
false
'
);
$
(
this
).
parents
(
'
.project-limit-message
'
).
remove
();
$
(
this
)
.
parents
(
'
.project-limit-message
'
)
.
remove
();
});
});
}
}
...
...
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