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
Boxiang Sun
gitlab-ce
Commits
b49c400a
Commit
b49c400a
authored
Oct 10, 2018
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prettify performance_bar notes and profile modules
parent
d87e88a6
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
134 additions
and
142 deletions
+134
-142
app/assets/javascripts/notes/components/note_awards_list.vue
app/assets/javascripts/notes/components/note_awards_list.vue
+6
-19
app/assets/javascripts/notes/stores/collapse_utils.js
app/assets/javascripts/notes/stores/collapse_utils.js
+1
-4
app/assets/javascripts/notes/stores/index.js
app/assets/javascripts/notes/stores/index.js
+1
-2
app/assets/javascripts/performance_bar/components/simple_metric.vue
.../javascripts/performance_bar/components/simple_metric.vue
+23
-23
app/assets/javascripts/performance_bar/index.js
app/assets/javascripts/performance_bar/index.js
+1
-2
app/assets/javascripts/performance_bar/services/performance_bar_service.js
...ripts/performance_bar/services/performance_bar_service.js
+5
-6
app/assets/javascripts/performance_bar/stores/performance_bar_store.js
...vascripts/performance_bar/stores/performance_bar_store.js
+1
-3
app/assets/javascripts/profile/account/components/delete_account_modal.vue
...ripts/profile/account/components/delete_account_modal.vue
+63
-63
app/assets/javascripts/profile/gl_crop.js
app/assets/javascripts/profile/gl_crop.js
+32
-15
app/assets/javascripts/profile/profile.js
app/assets/javascripts/profile/profile.js
+1
-5
No files found.
app/assets/javascripts/notes/components/note_awards_list.vue
View file @
b49c400a
...
@@ -95,29 +95,20 @@ export default {
...
@@ -95,29 +95,20 @@ export default {
return
awardList
.
filter
(
award
=>
award
.
user
.
id
===
this
.
getUserData
.
id
).
length
;
return
awardList
.
filter
(
award
=>
award
.
user
.
id
===
this
.
getUserData
.
id
).
length
;
},
},
awardTitle
(
awardsList
)
{
awardTitle
(
awardsList
)
{
const
hasReactionByCurrentUser
=
this
.
hasReactionByCurrentUser
(
const
hasReactionByCurrentUser
=
this
.
hasReactionByCurrentUser
(
awardsList
);
awardsList
,
);
const
TOOLTIP_NAME_COUNT
=
hasReactionByCurrentUser
?
9
:
10
;
const
TOOLTIP_NAME_COUNT
=
hasReactionByCurrentUser
?
9
:
10
;
let
awardList
=
awardsList
;
let
awardList
=
awardsList
;
// Filter myself from list if I am awarded.
// Filter myself from list if I am awarded.
if
(
hasReactionByCurrentUser
)
{
if
(
hasReactionByCurrentUser
)
{
awardList
=
awardList
.
filter
(
awardList
=
awardList
.
filter
(
award
=>
award
.
user
.
id
!==
this
.
getUserData
.
id
);
award
=>
award
.
user
.
id
!==
this
.
getUserData
.
id
,
);
}
}
// Get only 9-10 usernames to show in tooltip text.
// Get only 9-10 usernames to show in tooltip text.
const
namesToShow
=
awardList
const
namesToShow
=
awardList
.
slice
(
0
,
TOOLTIP_NAME_COUNT
).
map
(
award
=>
award
.
user
.
name
);
.
slice
(
0
,
TOOLTIP_NAME_COUNT
)
.
map
(
award
=>
award
.
user
.
name
);
// Get the remaining list to use in `and x more` text.
// Get the remaining list to use in `and x more` text.
const
remainingAwardList
=
awardList
.
slice
(
const
remainingAwardList
=
awardList
.
slice
(
TOOLTIP_NAME_COUNT
,
awardList
.
length
);
TOOLTIP_NAME_COUNT
,
awardList
.
length
,
);
// Add myself to the begining of the list so title will start with You.
// Add myself to the begining of the list so title will start with You.
if
(
hasReactionByCurrentUser
)
{
if
(
hasReactionByCurrentUser
)
{
...
@@ -128,9 +119,7 @@ export default {
...
@@ -128,9 +119,7 @@ export default {
// We have 10+ awarded user, join them with comma and add `and x more`.
// We have 10+ awarded user, join them with comma and add `and x more`.
if
(
remainingAwardList
.
length
)
{
if
(
remainingAwardList
.
length
)
{
title
=
`
${
namesToShow
.
join
(
'
,
'
)}
, and
${
title
=
`
${
namesToShow
.
join
(
'
,
'
)}
, and
${
remainingAwardList
.
length
}
more.`
;
remainingAwardList
.
length
}
more.`
;
}
else
if
(
namesToShow
.
length
>
1
)
{
}
else
if
(
namesToShow
.
length
>
1
)
{
// Join all names with comma but not the last one, it will be added with and text.
// Join all names with comma but not the last one, it will be added with and text.
title
=
namesToShow
.
slice
(
0
,
namesToShow
.
length
-
1
).
join
(
'
,
'
);
title
=
namesToShow
.
slice
(
0
,
namesToShow
.
length
-
1
).
join
(
'
,
'
);
...
@@ -170,9 +159,7 @@ export default {
...
@@ -170,9 +159,7 @@ export default {
awardName
:
parsedName
,
awardName
:
parsedName
,
};
};
this
.
toggleAwardRequest
(
data
).
catch
(()
=>
this
.
toggleAwardRequest
(
data
).
catch
(()
=>
Flash
(
'
Something went wrong on our end.
'
));
Flash
(
'
Something went wrong on our end.
'
),
);
},
},
},
},
};
};
...
...
app/assets/javascripts/notes/stores/collapse_utils.js
View file @
b49c400a
...
@@ -68,10 +68,7 @@ export const collapseSystemNotes = notes => {
...
@@ -68,10 +68,7 @@ export const collapseSystemNotes = notes => {
lastDescriptionSystemNote
=
note
;
lastDescriptionSystemNote
=
note
;
lastDescriptionSystemNoteIndex
=
acc
.
length
;
lastDescriptionSystemNoteIndex
=
acc
.
length
;
}
else
if
(
lastDescriptionSystemNote
)
{
}
else
if
(
lastDescriptionSystemNote
)
{
const
timeDifferenceMinutes
=
getTimeDifferenceMinutes
(
const
timeDifferenceMinutes
=
getTimeDifferenceMinutes
(
lastDescriptionSystemNote
,
note
);
lastDescriptionSystemNote
,
note
,
);
// are they less than 10 minutes appart?
// are they less than 10 minutes appart?
if
(
timeDifferenceMinutes
>
10
)
{
if
(
timeDifferenceMinutes
>
10
)
{
...
...
app/assets/javascripts/notes/stores/index.js
View file @
b49c400a
...
@@ -4,5 +4,4 @@ import notesModule from './modules';
...
@@ -4,5 +4,4 @@ import notesModule from './modules';
Vue
.
use
(
Vuex
);
Vue
.
use
(
Vuex
);
export
default
()
=>
export
default
()
=>
new
Vuex
.
Store
(
notesModule
());
new
Vuex
.
Store
(
notesModule
());
app/assets/javascripts/performance_bar/components/simple_metric.vue
View file @
b49c400a
<
script
>
<
script
>
export
default
{
export
default
{
props
:
{
props
:
{
currentRequest
:
{
currentRequest
:
{
type
:
Object
,
type
:
Object
,
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
);
);
},
},
},
},
};
};
</
script
>
</
script
>
<
template
>
<
template
>
<div
<div
...
...
app/assets/javascripts/performance_bar/index.js
View file @
b49c400a
...
@@ -9,8 +9,7 @@ export default ({ container }) =>
...
@@ -9,8 +9,7 @@ export default ({ container }) =>
performanceBarApp
:
()
=>
import
(
'
./components/performance_bar_app.vue
'
),
performanceBarApp
:
()
=>
import
(
'
./components/performance_bar_app.vue
'
),
},
},
data
()
{
data
()
{
const
performanceBarData
=
document
.
querySelector
(
this
.
$options
.
el
)
const
performanceBarData
=
document
.
querySelector
(
this
.
$options
.
el
).
dataset
;
.
dataset
;
const
store
=
new
PerformanceBarStore
();
const
store
=
new
PerformanceBarStore
();
return
{
return
{
...
...
app/assets/javascripts/performance_bar/services/performance_bar_service.js
View file @
b49c400a
...
@@ -11,8 +11,10 @@ export default class PerformanceBarService {
...
@@ -11,8 +11,10 @@ export default class PerformanceBarService {
static
registerInterceptor
(
peekUrl
,
callback
)
{
static
registerInterceptor
(
peekUrl
,
callback
)
{
const
interceptor
=
response
=>
{
const
interceptor
=
response
=>
{
const
[
fireCallback
,
requestId
,
requestUrl
]
=
const
[
fireCallback
,
requestId
,
requestUrl
]
=
PerformanceBarService
.
callbackParams
(
PerformanceBarService
.
callbackParams
(
response
,
peekUrl
);
response
,
peekUrl
,
);
if
(
fireCallback
)
{
if
(
fireCallback
)
{
callback
(
requestId
,
requestUrl
);
callback
(
requestId
,
requestUrl
);
...
@@ -30,10 +32,7 @@ export default class PerformanceBarService {
...
@@ -30,10 +32,7 @@ export default class PerformanceBarService {
static
removeInterceptor
(
interceptor
)
{
static
removeInterceptor
(
interceptor
)
{
axios
.
interceptors
.
response
.
eject
(
interceptor
);
axios
.
interceptors
.
response
.
eject
(
interceptor
);
Vue
.
http
.
interceptors
=
_
.
without
(
Vue
.
http
.
interceptors
=
_
.
without
(
Vue
.
http
.
interceptors
,
vueResourceInterceptor
);
Vue
.
http
.
interceptors
,
vueResourceInterceptor
,
);
}
}
static
callbackParams
(
response
,
peekUrl
)
{
static
callbackParams
(
response
,
peekUrl
)
{
...
...
app/assets/javascripts/performance_bar/stores/performance_bar_store.js
View file @
b49c400a
...
@@ -32,8 +32,6 @@ export default class PerformanceBarStore {
...
@@ -32,8 +32,6 @@ export default class PerformanceBarStore {
}
}
canTrackRequest
(
requestUrl
)
{
canTrackRequest
(
requestUrl
)
{
return
(
return
this
.
requests
.
filter
(
request
=>
request
.
url
===
requestUrl
).
length
<
2
;
this
.
requests
.
filter
(
request
=>
request
.
url
===
requestUrl
).
length
<
2
);
}
}
}
}
app/assets/javascripts/profile/account/components/delete_account_modal.vue
View file @
b49c400a
<
script
>
<
script
>
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
'
;
import
csrf
from
'
~/lib/utils/csrf
'
;
import
csrf
from
'
~/lib/utils/csrf
'
;
export
default
{
export
default
{
components
:
{
components
:
{
DeprecatedModal
,
DeprecatedModal
,
},
},
...
@@ -72,7 +72,7 @@ Once you confirm %{deleteAccount}, it cannot be undone or recovered.`),
...
@@ -72,7 +72,7 @@ Once you confirm %{deleteAccount}, it cannot be undone or recovered.`),
this
.
$refs
.
form
.
submit
();
this
.
$refs
.
form
.
submit
();
},
},
},
},
};
};
</
script
>
</
script
>
<
template
>
<
template
>
...
...
app/assets/javascripts/profile/gl_crop.js
View file @
b49c400a
...
@@ -4,20 +4,35 @@ import $ from 'jquery';
...
@@ -4,20 +4,35 @@ import $ from 'jquery';
import
'
cropper
'
;
import
'
cropper
'
;
import
_
from
'
underscore
'
;
import
_
from
'
underscore
'
;
(
(
global
)
=>
{
(
global
=>
{
// Matches everything but the file name
// Matches everything but the file name
const
FILENAMEREGEX
=
/^.*
[\\\/]
/
;
const
FILENAMEREGEX
=
/^.*
[\\\/]
/
;
class
GitLabCrop
{
class
GitLabCrop
{
constructor
(
input
,
{
filename
,
previewImage
,
modalCrop
,
pickImageEl
,
uploadImageBtn
,
modalCropImg
,
constructor
(
exportWidth
=
200
,
exportHeight
=
200
,
cropBoxWidth
=
200
,
cropBoxHeight
=
200
}
=
{})
{
input
,
{
filename
,
previewImage
,
modalCrop
,
pickImageEl
,
uploadImageBtn
,
modalCropImg
,
exportWidth
=
200
,
exportHeight
=
200
,
cropBoxWidth
=
200
,
cropBoxHeight
=
200
,
}
=
{},
)
{
this
.
onUploadImageBtnClick
=
this
.
onUploadImageBtnClick
.
bind
(
this
);
this
.
onUploadImageBtnClick
=
this
.
onUploadImageBtnClick
.
bind
(
this
);
this
.
onModalHide
=
this
.
onModalHide
.
bind
(
this
);
this
.
onModalHide
=
this
.
onModalHide
.
bind
(
this
);
this
.
onModalShow
=
this
.
onModalShow
.
bind
(
this
);
this
.
onModalShow
=
this
.
onModalShow
.
bind
(
this
);
this
.
onPickImageClick
=
this
.
onPickImageClick
.
bind
(
this
);
this
.
onPickImageClick
=
this
.
onPickImageClick
.
bind
(
this
);
this
.
fileInput
=
$
(
input
);
this
.
fileInput
=
$
(
input
);
this
.
modalCropImg
=
_
.
isString
(
this
.
modalCropImg
)
?
$
(
this
.
modalCropImg
)
:
this
.
modalCropImg
;
this
.
modalCropImg
=
_
.
isString
(
this
.
modalCropImg
)
?
$
(
this
.
modalCropImg
)
:
this
.
modalCropImg
;
this
.
fileInput
.
attr
(
'
name
'
,
`
${
this
.
fileInput
.
attr
(
'
name
'
)}
-trigger`
).
attr
(
'
id
'
,
`
${
this
.
fileInput
.
attr
(
'
id
'
)}
-trigger`
);
this
.
fileInput
.
attr
(
'
name
'
,
`
${
this
.
fileInput
.
attr
(
'
name
'
)}
-trigger`
)
.
attr
(
'
id
'
,
`
${
this
.
fileInput
.
attr
(
'
id
'
)}
-trigger`
);
this
.
exportWidth
=
exportWidth
;
this
.
exportWidth
=
exportWidth
;
this
.
exportHeight
=
exportHeight
;
this
.
exportHeight
=
exportHeight
;
this
.
cropBoxWidth
=
cropBoxWidth
;
this
.
cropBoxWidth
=
cropBoxWidth
;
...
@@ -59,7 +74,7 @@ import _ from 'underscore';
...
@@ -59,7 +74,7 @@ import _ from 'underscore';
btn
=
this
;
btn
=
this
;
return
_this
.
onActionBtnClick
(
btn
);
return
_this
.
onActionBtnClick
(
btn
);
});
});
return
this
.
croppedImageBlob
=
null
;
return
(
this
.
croppedImageBlob
=
null
)
;
}
}
onPickImageClick
()
{
onPickImageClick
()
{
...
@@ -94,9 +109,9 @@ import _ from 'underscore';
...
@@ -94,9 +109,9 @@ import _ from 'underscore';
width
:
cropBoxWidth
,
width
:
cropBoxWidth
,
height
:
cropBoxHeight
,
height
:
cropBoxHeight
,
left
:
(
container
.
width
-
cropBoxWidth
)
/
2
,
left
:
(
container
.
width
-
cropBoxWidth
)
/
2
,
top
:
(
container
.
height
-
cropBoxHeight
)
/
2
top
:
(
container
.
height
-
cropBoxHeight
)
/
2
,
});
});
}
}
,
});
});
}
}
...
@@ -116,7 +131,7 @@ import _ from 'underscore';
...
@@ -116,7 +131,7 @@ import _ from 'underscore';
var
data
,
result
;
var
data
,
result
;
data
=
$
(
btn
).
data
();
data
=
$
(
btn
).
data
();
if
(
this
.
modalCropImg
.
data
(
'
cropper
'
)
&&
data
.
method
)
{
if
(
this
.
modalCropImg
.
data
(
'
cropper
'
)
&&
data
.
method
)
{
return
result
=
this
.
modalCropImg
.
cropper
(
data
.
method
,
data
.
option
);
return
(
result
=
this
.
modalCropImg
.
cropper
(
data
.
method
,
data
.
option
)
);
}
}
}
}
...
@@ -127,7 +142,7 @@ import _ from 'underscore';
...
@@ -127,7 +142,7 @@ import _ from 'underscore';
readFile
(
input
)
{
readFile
(
input
)
{
var
_this
,
reader
;
var
_this
,
reader
;
_this
=
this
;
_this
=
this
;
reader
=
new
FileReader
;
reader
=
new
FileReader
()
;
reader
.
onload
=
()
=>
{
reader
.
onload
=
()
=>
{
_this
.
modalCropImg
.
attr
(
'
src
'
,
reader
.
result
);
_this
.
modalCropImg
.
attr
(
'
src
'
,
reader
.
result
);
return
_this
.
modalCrop
.
modal
(
'
show
'
);
return
_this
.
modalCrop
.
modal
(
'
show
'
);
...
@@ -145,7 +160,7 @@ import _ from 'underscore';
...
@@ -145,7 +160,7 @@ import _ from 'underscore';
array
.
push
(
binary
.
charCodeAt
(
i
));
array
.
push
(
binary
.
charCodeAt
(
i
));
}
}
return
new
Blob
([
new
Uint8Array
(
array
)],
{
return
new
Blob
([
new
Uint8Array
(
array
)],
{
type
:
'
image/png
'
type
:
'
image/png
'
,
});
});
}
}
...
@@ -157,11 +172,13 @@ import _ from 'underscore';
...
@@ -157,11 +172,13 @@ import _ from 'underscore';
}
}
setBlob
()
{
setBlob
()
{
this
.
dataURL
=
this
.
modalCropImg
.
cropper
(
'
getCroppedCanvas
'
,
{
this
.
dataURL
=
this
.
modalCropImg
.
cropper
(
'
getCroppedCanvas
'
,
{
width
:
200
,
width
:
200
,
height
:
200
height
:
200
,
}).
toDataURL
(
'
image/png
'
);
})
return
this
.
croppedImageBlob
=
this
.
dataURLtoBlob
(
this
.
dataURL
);
.
toDataURL
(
'
image/png
'
);
return
(
this
.
croppedImageBlob
=
this
.
dataURLtoBlob
(
this
.
dataURL
));
}
}
getBlob
()
{
getBlob
()
{
...
...
app/assets/javascripts/profile/profile.js
View file @
b49c400a
...
@@ -26,11 +26,7 @@ export default class Profile {
...
@@ -26,11 +26,7 @@ export default class Profile {
}
}
bindEvents
()
{
bindEvents
()
{
$
(
'
.js-preferences-form
'
).
on
(
$
(
'
.js-preferences-form
'
).
on
(
'
change.preference
'
,
'
input[type=radio]
'
,
this
.
submitForm
);
'
change.preference
'
,
'
input[type=radio]
'
,
this
.
submitForm
,
);
$
(
'
#user_notification_email
'
).
on
(
'
change
'
,
this
.
submitForm
);
$
(
'
#user_notification_email
'
).
on
(
'
change
'
,
this
.
submitForm
);
$
(
'
#user_notified_of_own_activity
'
).
on
(
'
change
'
,
this
.
submitForm
);
$
(
'
#user_notified_of_own_activity
'
).
on
(
'
change
'
,
this
.
submitForm
);
this
.
form
.
on
(
'
submit
'
,
this
.
onSubmitForm
);
this
.
form
.
on
(
'
submit
'
,
this
.
onSubmitForm
);
...
...
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