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
175bd38e
Commit
175bd38e
authored
Jun 04, 2021
by
Vitaly Slobodin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set cookie to hide an alert for N days
parent
1eb0500c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
14 deletions
+10
-14
ee/app/assets/javascripts/admin/components/qrtly_reconciliation_alert.vue
...vascripts/admin/components/qrtly_reconciliation_alert.vue
+8
-5
ee/app/assets/javascripts/admin/init_qrtly_reconciliation_alert.js
...sets/javascripts/admin/init_qrtly_reconciliation_alert.js
+2
-9
No files found.
ee/app/assets/javascripts/admin/components/qrtly_reconciliation_alert.vue
View file @
175bd38e
<
script
>
import
Cookie
from
'
js-cookie
'
;
import
{
GlAlert
,
GlSprintf
}
from
'
@gitlab/ui
'
;
import
Cookie
from
'
js-cookie
'
;
import
{
formatDate
,
getDayDifference
}
from
'
~/lib/utils/datetime_utility
'
;
...
...
@@ -26,17 +27,20 @@ export default {
},
props
:
{
date
:
{
type
:
Date
,
type
:
Number
,
required
:
true
,
},
cookie
Id
:
{
cookie
Key
:
{
type
:
String
,
required
:
true
,
},
},
computed
:
{
alertTitle
()
{
return
sprintf
(
this
.
$options
.
i18n
.
title
,
{
qrtlyDate
:
this
.
date
});
return
sprintf
(
this
.
$options
.
i18n
.
title
,
{
qrtlyDate
:
this
.
formattedDate
});
},
formattedDate
()
{
return
formatDate
(
this
.
date
,
'
isoDate
'
);
},
},
methods
:
{
...
...
@@ -53,7 +57,6 @@ export default {
<
template
>
<gl-alert
ref=
"alert"
data-testid=
"qrtly-reconciliation-alert"
variant=
"info"
:title=
"alertTitle"
...
...
@@ -64,7 +67,7 @@ export default {
>
<gl-sprintf
:message=
"$options.i18n.description"
>
<template
#qrtlyDate
>
<span>
{{
d
ate
}}
</span>
<span>
{{
formattedD
ate
}}
</span>
</
template
>
</gl-sprintf>
</gl-alert>
...
...
ee/app/assets/javascripts/admin/init_qrtly_reconciliation_alert.js
View file @
175bd38e
import
Cookie
from
'
js-cookie
'
;
import
Vue
from
'
vue
'
;
import
QrtlyReconciliationAlert
from
'
./components/qrtly_reconciliation_alert.vue
'
;
function
shouldShowAlert
(
userId
=
null
,
namespaceId
=
null
)
{
const
cookieName
=
[
userId
,
namespaceId
].
filter
(
Boolean
);
const
cookieValue
=
Cookie
.
get
(
'
qrtly_reconciliation_alert_#{}
'
);
return
Cookie
.
get
(
'
qrtly_reconciliation_alert_#{}
'
);
}
export
const
initQrtlyReconciliationAlert
=
(
selector
=
'
#js-qrtly-reconciliation-alert
'
)
=>
{
const
el
=
document
.
querySelector
(
selector
);
...
...
@@ -21,7 +13,8 @@ export const initQrtlyReconciliationAlert = (selector = '#js-qrtly-reconciliatio
render
(
createElement
)
{
return
createElement
(
QrtlyReconciliationAlert
,
{
props
:
{
date
:
new
Date
(
el
.
dataset
.
date
),
date
:
Date
.
parse
(
el
.
dataset
.
reconciliationDate
),
cookieKey
:
el
.
dataset
.
cookieKey
,
},
});
},
...
...
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