Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
523d47b2
Commit
523d47b2
authored
Oct 25, 2018
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master' into ce-to-ee-2018-10-25
parents
e7469c9e
bcbaccb9
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
170 additions
and
3 deletions
+170
-3
app/assets/javascripts/lib/utils/datetime_utility.js
app/assets/javascripts/lib/utils/datetime_utility.js
+12
-0
app/assets/javascripts/monitoring/components/graph.vue
app/assets/javascripts/monitoring/components/graph.vue
+3
-2
app/assets/javascripts/vue_shared/components/gl_countdown.vue
...assets/javascripts/vue_shared/components/gl_countdown.vue
+49
-0
changelogs/unreleased/40372-prometheus-dashboard-broken-on-firefox.yml
...released/40372-prometheus-dashboard-broken-on-firefox.yml
+5
-0
changelogs/unreleased/52993-ldap-rename_provider-rake-task-broken.yml
...nreleased/52993-ldap-rename_provider-rake-task-broken.yml
+5
-0
lib/tasks/gitlab/ldap.rake
lib/tasks/gitlab/ldap.rake
+1
-1
spec/javascripts/lib/utils/datetime_utility_spec.js
spec/javascripts/lib/utils/datetime_utility_spec.js
+18
-0
spec/javascripts/vue_shared/components/gl_countdown_spec.js
spec/javascripts/vue_shared/components/gl_countdown_spec.js
+77
-0
No files found.
app/assets/javascripts/lib/utils/datetime_utility.js
View file @
523d47b2
...
@@ -473,3 +473,15 @@ export const stringifyTime = timeObject => {
...
@@ -473,3 +473,15 @@ export const stringifyTime = timeObject => {
*/
*/
export
const
abbreviateTime
=
timeStr
=>
export
const
abbreviateTime
=
timeStr
=>
timeStr
.
split
(
'
'
).
filter
(
unitStr
=>
unitStr
.
charAt
(
0
)
!==
'
0
'
)[
0
];
timeStr
.
split
(
'
'
).
filter
(
unitStr
=>
unitStr
.
charAt
(
0
)
!==
'
0
'
)[
0
];
/**
* Calculates the milliseconds between now and a given date string.
* The result cannot become negative.
*
* @param endDate date string that the time difference is calculated for
* @return {number} number of milliseconds remaining until the given date
*/
export
const
calculateRemainingMilliseconds
=
endDate
=>
{
const
remainingMilliseconds
=
new
Date
(
endDate
).
getTime
()
-
Date
.
now
();
return
Math
.
max
(
remainingMilliseconds
,
0
);
};
app/assets/javascripts/monitoring/components/graph.vue
View file @
523d47b2
...
@@ -121,6 +121,7 @@ export default {
...
@@ -121,6 +121,7 @@ export default {
draw
()
{
draw
()
{
const
breakpointSize
=
bp
.
getBreakpointSize
();
const
breakpointSize
=
bp
.
getBreakpointSize
();
const
query
=
this
.
graphData
.
queries
[
0
];
const
query
=
this
.
graphData
.
queries
[
0
];
const
svgWidth
=
this
.
$refs
.
baseSvg
.
getBoundingClientRect
().
width
;
this
.
margin
=
measurements
.
large
.
margin
;
this
.
margin
=
measurements
.
large
.
margin
;
if
(
this
.
smallGraph
||
breakpointSize
===
'
xs
'
||
breakpointSize
===
'
sm
'
)
{
if
(
this
.
smallGraph
||
breakpointSize
===
'
xs
'
||
breakpointSize
===
'
sm
'
)
{
this
.
graphHeight
=
300
;
this
.
graphHeight
=
300
;
...
@@ -130,13 +131,13 @@ export default {
...
@@ -130,13 +131,13 @@ export default {
this
.
unitOfDisplay
=
query
.
unit
||
''
;
this
.
unitOfDisplay
=
query
.
unit
||
''
;
this
.
yAxisLabel
=
this
.
graphData
.
y_label
||
'
Values
'
;
this
.
yAxisLabel
=
this
.
graphData
.
y_label
||
'
Values
'
;
this
.
legendTitle
=
query
.
label
||
'
Average
'
;
this
.
legendTitle
=
query
.
label
||
'
Average
'
;
this
.
graphWidth
=
this
.
$refs
.
baseSvg
.
client
Width
-
this
.
margin
.
left
-
this
.
margin
.
right
;
this
.
graphWidth
=
svg
Width
-
this
.
margin
.
left
-
this
.
margin
.
right
;
this
.
graphHeight
=
this
.
graphHeight
-
this
.
margin
.
top
-
this
.
margin
.
bottom
;
this
.
graphHeight
=
this
.
graphHeight
-
this
.
margin
.
top
-
this
.
margin
.
bottom
;
this
.
baseGraphHeight
=
this
.
graphHeight
-
50
;
this
.
baseGraphHeight
=
this
.
graphHeight
-
50
;
this
.
baseGraphWidth
=
this
.
graphWidth
;
this
.
baseGraphWidth
=
this
.
graphWidth
;
// pixel offsets inside the svg and outside are not 1:1
// pixel offsets inside the svg and outside are not 1:1
this
.
realPixelRatio
=
this
.
$refs
.
baseSvg
.
client
Width
/
this
.
baseGraphWidth
;
this
.
realPixelRatio
=
svg
Width
/
this
.
baseGraphWidth
;
this
.
renderAxesPaths
();
this
.
renderAxesPaths
();
this
.
formatDeployments
();
this
.
formatDeployments
();
...
...
app/assets/javascripts/vue_shared/components/gl_countdown.vue
0 → 100644
View file @
523d47b2
<
script
>
import
{
calculateRemainingMilliseconds
,
formatTime
}
from
'
~/lib/utils/datetime_utility
'
;
/**
* Counts down to a given end date.
*/
export
default
{
props
:
{
endDateString
:
{
type
:
String
,
required
:
true
,
validator
(
value
)
{
return
!
Number
.
isNaN
(
new
Date
(
value
).
getTime
());
},
},
},
data
()
{
return
{
remainingTime
:
formatTime
(
0
),
countdownUpdateIntervalId
:
null
,
};
},
mounted
()
{
const
updateRemainingTime
=
()
=>
{
const
remainingMilliseconds
=
calculateRemainingMilliseconds
(
this
.
endDateString
);
this
.
remainingTime
=
formatTime
(
remainingMilliseconds
);
};
updateRemainingTime
();
this
.
countdownUpdateIntervalId
=
window
.
setInterval
(
updateRemainingTime
,
1000
);
},
beforeDestroy
()
{
window
.
clearInterval
(
this
.
countdownUpdateIntervalId
);
},
};
</
script
>
<
template
>
<time
v-gl-tooltip
:datetime=
"endDateString"
:title=
"endDateString"
>
{{
remainingTime
}}
</time>
</
template
>
changelogs/unreleased/40372-prometheus-dashboard-broken-on-firefox.yml
0 → 100644
View file @
523d47b2
---
title
:
Fix prometheus graphs in firefox
merge_request
:
22400
author
:
type
:
fixed
changelogs/unreleased/52993-ldap-rename_provider-rake-task-broken.yml
0 → 100644
View file @
523d47b2
---
title
:
Use gitlab_environment for ldap rake task
merge_request
:
22582
author
:
type
:
fixed
lib/tasks/gitlab/ldap.rake
View file @
523d47b2
namespace
:gitlab
do
namespace
:gitlab
do
namespace
:ldap
do
namespace
:ldap
do
desc
'GitLab | LDAP | Rename provider'
desc
'GitLab | LDAP | Rename provider'
task
:rename_provider
,
[
:old_provider
,
:new_provider
]
=>
:
environment
do
|
_
,
args
|
task
:rename_provider
,
[
:old_provider
,
:new_provider
]
=>
:
gitlab_environment
do
|
_
,
args
|
old_provider
=
args
[
:old_provider
]
||
old_provider
=
args
[
:old_provider
]
||
prompt
(
'What is the old provider? Ex. \'ldapmain\': '
.
color
(
:blue
))
prompt
(
'What is the old provider? Ex. \'ldapmain\': '
.
color
(
:blue
))
new_provider
=
args
[
:new_provider
]
||
new_provider
=
args
[
:new_provider
]
||
...
...
spec/javascripts/datetime_utility_spec.js
→
spec/javascripts/
lib/utils/
datetime_utility_spec.js
View file @
523d47b2
...
@@ -352,3 +352,21 @@ describe('prettyTime methods', () => {
...
@@ -352,3 +352,21 @@ describe('prettyTime methods', () => {
});
});
});
});
});
});
describe
(
'
calculateRemainingMilliseconds
'
,
()
=>
{
beforeEach
(()
=>
{
spyOn
(
Date
,
'
now
'
).
and
.
callFake
(()
=>
new
Date
(
'
2063-04-04T00:42:00Z
'
).
getTime
());
});
it
(
'
calculates the remaining time for a given end date
'
,
()
=>
{
const
milliseconds
=
datetimeUtility
.
calculateRemainingMilliseconds
(
'
2063-04-04T01:44:03Z
'
);
expect
(
milliseconds
).
toBe
(
3723000
);
});
it
(
'
returns 0 if the end date has passed
'
,
()
=>
{
const
milliseconds
=
datetimeUtility
.
calculateRemainingMilliseconds
(
'
2063-04-03T00:00:00Z
'
);
expect
(
milliseconds
).
toBe
(
0
);
});
});
spec/javascripts/vue_shared/components/gl_countdown_spec.js
0 → 100644
View file @
523d47b2
import
mountComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
import
Vue
from
'
vue
'
;
import
GlCountdown
from
'
~/vue_shared/components/gl_countdown.vue
'
;
describe
(
'
GlCountdown
'
,
()
=>
{
const
Component
=
Vue
.
extend
(
GlCountdown
);
let
vm
;
let
now
=
'
2000-01-01T00:00:00Z
'
;
beforeEach
(()
=>
{
spyOn
(
Date
,
'
now
'
).
and
.
callFake
(()
=>
new
Date
(
now
).
getTime
());
jasmine
.
clock
().
install
();
});
afterEach
(()
=>
{
vm
.
$destroy
();
jasmine
.
clock
().
uninstall
();
});
describe
(
'
when there is time remaining
'
,
()
=>
{
beforeEach
(
done
=>
{
vm
=
mountComponent
(
Component
,
{
endDateString
:
'
2000-01-01T01:02:03Z
'
,
});
Vue
.
nextTick
()
.
then
(
done
)
.
catch
(
done
.
fail
);
});
it
(
'
displays remaining time
'
,
()
=>
{
expect
(
vm
.
$el
).
toContainText
(
'
01:02:03
'
);
});
it
(
'
updates remaining time
'
,
done
=>
{
now
=
'
2000-01-01T00:00:01Z
'
;
jasmine
.
clock
().
tick
(
1000
);
Vue
.
nextTick
()
.
then
(()
=>
{
expect
(
vm
.
$el
).
toContainText
(
'
01:02:02
'
);
done
();
})
.
catch
(
done
.
fail
);
});
});
describe
(
'
when there is no time remaining
'
,
()
=>
{
beforeEach
(
done
=>
{
vm
=
mountComponent
(
Component
,
{
endDateString
:
'
1900-01-01T00:00:00Z
'
,
});
Vue
.
nextTick
()
.
then
(
done
)
.
catch
(
done
.
fail
);
});
it
(
'
displays 00:00:00
'
,
()
=>
{
expect
(
vm
.
$el
).
toContainText
(
'
00:00:00
'
);
});
});
describe
(
'
when an invalid date is passed
'
,
()
=>
{
it
(
'
throws a validation error
'
,
()
=>
{
spyOn
(
Vue
.
config
,
'
warnHandler
'
).
and
.
stub
();
vm
=
mountComponent
(
Component
,
{
endDateString
:
'
this is invalid
'
,
});
expect
(
Vue
.
config
.
warnHandler
).
toHaveBeenCalledTimes
(
1
);
const
[
errorMessage
]
=
Vue
.
config
.
warnHandler
.
calls
.
argsFor
(
0
);
expect
(
errorMessage
).
toMatch
(
/^Invalid prop: .* "endDateString"/
);
});
});
});
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