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
49ae6cd8
Commit
49ae6cd8
authored
Jan 08, 2018
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GeoNodeSyncSettings Component
parent
c3414e8f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
115 additions
and
0 deletions
+115
-0
ee/app/assets/javascripts/geo_nodes/components/geo_node_sync_settings.vue
...vascripts/geo_nodes/components/geo_node_sync_settings.vue
+115
-0
No files found.
ee/app/assets/javascripts/geo_nodes/components/geo_node_sync_settings.vue
0 → 100644
View file @
49ae6cd8
<
script
>
import
{
s__
}
from
'
~/locale
'
;
import
{
timeIntervalInWords
}
from
'
~/lib/utils/datetime_utility
'
;
import
tooltip
from
'
~/vue_shared/directives/tooltip
'
;
import
icon
from
'
~/vue_shared/components/icon.vue
'
;
import
{
TIME_DIFF
}
from
'
../constants
'
;
export
default
{
props
:
{
namespaces
:
{
type
:
Array
,
required
:
true
,
},
lastEvent
:
{
type
:
Object
,
required
:
true
,
},
cursorLastEvent
:
{
type
:
Object
,
required
:
true
,
},
},
directives
:
{
tooltip
,
},
components
:
{
icon
,
},
computed
:
{
syncType
()
{
return
this
.
namespaces
.
length
>
0
?
s__
(
'
GeoNodes|Selective
'
)
:
s__
(
'
GeoNodes|Full
'
);
},
syncLagInSeconds
()
{
return
this
.
lagInSeconds
(
this
.
lastEvent
.
timeStamp
,
this
.
cursorLastEvent
.
timeStamp
);
},
syncStatusIcon
()
{
return
this
.
statusIcon
(
this
.
syncLagInSeconds
);
},
syncStatusEventInfo
()
{
return
this
.
statusEventInfo
(
this
.
lastEvent
.
id
,
this
.
cursorLastEvent
.
id
,
this
.
syncLagInSeconds
,
);
},
syncStatusTooltip
()
{
return
this
.
statusTooltip
(
this
.
syncLagInSeconds
);
},
},
methods
:
{
lagInSeconds
(
lastEventTimeStamp
,
cursorLastEventTimeStamp
)
{
let
eventDateTime
;
let
cursorDateTime
;
if
(
lastEventTimeStamp
&&
lastEventTimeStamp
>
0
)
{
eventDateTime
=
new
Date
(
lastEventTimeStamp
*
1000
);
}
if
(
cursorLastEventTimeStamp
&&
cursorLastEventTimeStamp
>
0
)
{
cursorDateTime
=
new
Date
(
cursorLastEventTimeStamp
*
1000
);
}
return
(
cursorDateTime
-
eventDateTime
)
/
1000
;
},
statusIcon
(
syncLag
)
{
if
(
syncLag
<=
TIME_DIFF
.
FIVE_MINS
)
{
return
'
retry
'
;
}
else
if
(
syncLag
>
TIME_DIFF
.
FIVE_MINS
&&
syncLag
<=
TIME_DIFF
.
HOUR
)
{
return
'
warning
'
;
}
return
'
status_failed
'
;
},
statusEventInfo
(
lastEventId
,
cursorLastEventId
,
lagInSeconds
)
{
const
timeAgoStr
=
timeIntervalInWords
(
lagInSeconds
);
const
pendingEvents
=
lastEventId
-
cursorLastEventId
;
return
`
${
timeAgoStr
}
(
${
pendingEvents
}
events)`
;
},
statusTooltip
(
lagInSeconds
)
{
if
(
lagInSeconds
<=
TIME_DIFF
.
FIVE_MINS
)
{
return
''
;
}
else
if
(
lagInSeconds
>
TIME_DIFF
.
FIVE_MINS
&&
lagInSeconds
<=
TIME_DIFF
.
HOUR
)
{
return
s__
(
'
GeoNodeSyncStatus|Node is slow, overloaded, or it just recovered after an outage.
'
);
}
return
s__
(
'
GeoNodeSyncStatus|Node is failing or broken.
'
);
},
},
};
</
script
>
<
template
>
<div
class=
"node-detail-value"
>
<span
v-tooltip
class=
"node-sync-settings inline"
data-placement=
"bottom"
:title=
"syncStatusTooltip"
>
<strong>
{{
syncType
}}
</strong>
<icon
name=
"retry"
css-classes=
"sync-status-icon prepend-left-5"
/>
<span
class=
"sync-status-event-info prepend-left-5"
>
{{
syncStatusEventInfo
}}
</span>
</span>
</div>
</
template
>
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