Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
Metabase
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
funding
Metabase
Commits
7ec4c929
Commit
7ec4c929
authored
Aug 26, 2020
by
fengjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改数据库编码时区 + Ding BUG
parent
f7994e6c
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
46 additions
and
39 deletions
+46
-39
alert.js
frontend/src/metabase/alert/alert.js
+23
-20
AlertModals.jsx
...end/src/metabase/query_builder/components/AlertModals.jsx
+16
-13
run_timezone_tests
frontend/test/__runner__/run_timezone_tests
+1
-1
timeseriesScale.unit.spec.js
.../metabase/visualizations/lib/timeseriesScale.unit.spec.js
+1
-1
DingTalk.java
java/metabase/db/liquibase/DingTalk.java
+1
-0
sample-dataset.db.mv.db
resources/sample-dataset.db.mv.db
+0
-0
common.clj
src/metabase/models/common.clj
+1
-1
timezones_test.clj
test/metabase/query_processor_test/timezones_test.clj
+1
-1
date_2_test.clj
test/metabase/util/date_2_test.clj
+2
-2
No files found.
frontend/src/metabase/alert/alert.js
View file @
7ec4c929
...
@@ -110,32 +110,35 @@ export const updateAlert = alert => {
...
@@ -110,32 +110,35 @@ export const updateAlert = alert => {
export
const
updateDingTalk
=
(
token
,
question
)
=>
{
export
const
updateDingTalk
=
(
token
,
question
)
=>
{
// token
// token
console
.
log
(
'
2222222---?
'
,
token
,
question
.
_card
.
original_card_id
);
if
(
question
&&
question
.
_card
&&
question
.
_card
.
original_card_id
){
let
req
=
new
XMLHttpRequest
();
let
req
=
new
XMLHttpRequest
();
req
.
open
(
"
POST
"
,
"
http://dev-fund.quantgroups.com/card/dingtalk/token/
"
+
question
.
_card
.
original_card_id
,
true
);
req
.
open
(
"
POST
"
,
"
http://dev-fund.quantgroups.com/card/dingtalk/token/
"
+
question
.
_card
.
original_card_id
,
true
);
req
.
setRequestHeader
(
'
Control-Allow-Origin
'
,
'
*
'
);
req
.
setRequestHeader
(
'
Control-Allow-Origin
'
,
'
*
'
);
req
.
setRequestHeader
(
'
content-type
'
,
'
application/json
'
);
req
.
setRequestHeader
(
'
content-type
'
,
'
application/json
'
);
req
.
send
(
JSON
.
stringify
(
token
));
req
.
send
(
JSON
.
stringify
(
token
));
req
.
onreadystatechange
=
(
e
)
=>
{
req
.
onreadystatechange
=
(
e
)
=>
{
console
.
log
(
req
.
responseText
);
console
.
log
(
req
.
responseText
);
}
}
}
};
};
export
const
queryDingTalk
=
question
=>
{
export
const
queryDingTalk
=
question
=>
{
let
req
=
new
XMLHttpRequest
();
if
(
question
&&
question
.
_card
&&
question
.
_card
.
original_card_id
){
req
.
open
(
"
GET
"
,
"
http://dev-fund.quantgroups.com/card/
"
+
question
.
_card
.
original_card_id
+
"
/dingtalk/token
"
,
false
);
let
req
=
new
XMLHttpRequest
();
let
result
;
req
.
open
(
"
GET
"
,
"
http://dev-fund.quantgroups.com/card/
"
+
question
.
_card
.
original_card_id
+
"
/dingtalk/token
"
,
false
);
req
.
setRequestHeader
(
'
Control-Allow-Origin
'
,
'
*
'
);
let
result
;
req
.
onreadystatechange
=
function
()
{
req
.
setRequestHeader
(
'
Control-Allow-Origin
'
,
'
*
'
);
if
(
req
.
readyState
===
4
&&
req
.
status
===
200
)
{
req
.
onreadystatechange
=
function
()
{
// 同步请求成功
if
(
req
.
readyState
===
4
&&
req
.
status
===
200
)
{
var
_resp
=
JSON
.
parse
(
req
.
responseText
);
// 同步请求成功
result
=
_resp
.
data
;
var
_resp
=
JSON
.
parse
(
req
.
responseText
);
result
=
_resp
.
data
;
}
};
req
.
send
();
return
result
;
}
}
};
};
req
.
send
();
return
result
;
};
export
const
UNSUBSCRIBE_FROM_ALERT
=
"
metabase/alerts/UNSUBSCRIBE_FROM_ALERT
"
;
export
const
UNSUBSCRIBE_FROM_ALERT
=
"
metabase/alerts/UNSUBSCRIBE_FROM_ALERT
"
;
export
const
UNSUBSCRIBE_FROM_ALERT_CLEANUP
=
export
const
UNSUBSCRIBE_FROM_ALERT_CLEANUP
=
...
...
frontend/src/metabase/query_builder/components/AlertModals.jsx
View file @
7ec4c929
...
@@ -578,14 +578,18 @@ export class AlertEditSchedule extends Component {
...
@@ -578,14 +578,18 @@ export class AlertEditSchedule extends Component {
@
User
.
loadList
()
@
User
.
loadList
()
@
connect
(
@
connect
(
(
state
,
props
)
=>
({
function
(
state
,
props
)
{
user
:
getUser
(
state
),
let
_q
=
getQuestion
(
state
);
formInput
:
getPulseFormInput
(
state
),
let
_dt
=
queryDingTalk
(
_q
);
question
:
getQuestion
(
state
),
return
{
dingToken
:
queryDingTalk
(
getQuestion
(
state
)),
user
:
getUser
(
state
),
dingTokenInput
:
''
,
formInput
:
getPulseFormInput
(
state
),
dingTextInput
:
''
,
question
:
_q
,
}),
dingToken
:
_dt
,
dingTokenInput
:
''
,
dingTextInput
:
''
,
}
},
{
{
fetchPulseFormInput
,
updateDingTalk
fetchPulseFormInput
,
updateDingTalk
},
},
...
@@ -602,7 +606,6 @@ export class AlertEditChannels extends Component {
...
@@ -602,7 +606,6 @@ export class AlertEditChannels extends Component {
onUpdateDingTalk
=
()
=>
{
onUpdateDingTalk
=
()
=>
{
// const { updateDingTalk } = this.props;
// const { updateDingTalk } = this.props;
const
{
question
}
=
this
.
props
;
const
{
question
}
=
this
.
props
;
console
.
log
(
'
-------->>>
'
,
{
token
:
this
.
refs
.
ding_token
.
value
,
message
:
this
.
refs
.
ding_message
.
value
});
updateDingTalk
({
token
:
this
.
refs
.
ding_token
.
value
,
message
:
this
.
refs
.
ding_message
.
value
},
question
);
updateDingTalk
({
token
:
this
.
refs
.
ding_token
.
value
,
message
:
this
.
refs
.
ding_message
.
value
},
question
);
};
};
...
@@ -626,7 +629,7 @@ export class AlertEditChannels extends Component {
...
@@ -626,7 +629,7 @@ export class AlertEditChannels extends Component {
render
()
{
render
()
{
const
{
alert
,
user
,
users
,
formInput
,
dingToken
}
=
this
.
props
;
const
{
alert
,
user
,
users
,
formInput
,
dingToken
}
=
this
.
props
;
const
dingContent
=
'
<b>消息内容:</b>
可以使用表达式{0},{1}...表示取结果集的第N列值,使用{count}表示取数据总条数;
'
;
const
dingContent
=
'
可以使用表达式{0},{1}...表示取结果集的第N列值,使用{count}表示取数据总条数;
'
;
return
(
return
(
<
div
className=
"mt4 pt2"
>
<
div
className=
"mt4 pt2"
>
<
h3
className=
"text-dark mb3"
>
{
jt
`Where do you want to send these alerts?`
}
</
h3
>
<
h3
className=
"text-dark mb3"
>
{
jt
`Where do you want to send these alerts?`
}
</
h3
>
...
@@ -652,17 +655,17 @@ export class AlertEditChannels extends Component {
...
@@ -652,17 +655,17 @@ export class AlertEditChannels extends Component {
<
input
<
input
className=
"Form-input"
className=
"Form-input"
type=
"text"
type=
"text"
defaultValue=
{
dingToken
.
token
}
defaultValue=
{
dingToken
?
dingToken
.
token
:
''
}
style=
{
{}
}
style=
{
{}
}
ref
=
"
ding_token
"
ref
=
"
ding_token
"
placeholder=
"填写一个钉钉TOKEN"
placeholder=
"填写一个钉钉TOKEN"
/>
/>
</
div
>
</
div
>
<
div
>
<
div
>
<
p
>
{
dingContent
}
</
p
>
<
p
>
<
b
>
消息内容:
</
b
>
{
dingContent
}
</
p
>
<
textarea
className=
"Form-input mt1 full"
<
textarea
className=
"Form-input mt1 full"
style=
{
{
width
:
"
100%
"
,
height
:
"
120px
"
}
}
style=
{
{
width
:
"
100%
"
,
height
:
"
120px
"
}
}
defaultValue=
{
dingToken
.
message
}
defaultValue=
{
dingToken
?
dingToken
.
message
:
''
}
ref
=
"
ding_message
"
ref
=
"
ding_message
"
></
textarea
>
></
textarea
>
</
div
>
</
div
>
...
...
frontend/test/__runner__/run_timezone_tests
View file @
7ec4c929
...
@@ -15,7 +15,7 @@ set -eu
...
@@ -15,7 +15,7 @@ set -eu
# Asia/Hong_Kong +08:00 +08:00
# Asia/Hong_Kong +08:00 +08:00
DEFAULT_TIMEZONES
=
"Etc/UTC Europe/London America/Los_Angeles America/Phoenix Asia/Kathmandu Asia/
Hong_Kong
"
DEFAULT_TIMEZONES
=
"Etc/UTC Europe/London America/Los_Angeles America/Phoenix Asia/Kathmandu Asia/
Shanghai
"
tzs
=
${
TIMEZONES
:-
$DEFAULT_TIMEZONES
}
tzs
=
${
TIMEZONES
:-
$DEFAULT_TIMEZONES
}
...
...
frontend/test/metabase/visualizations/lib/timeseriesScale.unit.spec.js
View file @
7ec4c929
...
@@ -132,7 +132,7 @@ describe("timeseriesScale", () => {
...
@@ -132,7 +132,7 @@ describe("timeseriesScale", () => {
const
scale
=
timeseriesScale
({
const
scale
=
timeseriesScale
({
interval
:
"
month
"
,
interval
:
"
month
"
,
count
:
1
,
count
:
1
,
timezone
:
"
Asia/
Hong_kong
"
,
timezone
:
"
Asia/
Shanghai
"
,
}).
domain
([
}).
domain
([
moment
(
"
2019-03-07T12:34:56.789Z
"
),
moment
(
"
2019-03-07T12:34:56.789Z
"
),
moment
(
"
2019-04-12T12:34:56.789Z
"
),
moment
(
"
2019-04-12T12:34:56.789Z
"
),
...
...
java/metabase/db/liquibase/DingTalk.java
View file @
7ec4c929
...
@@ -26,6 +26,7 @@ public class DingTalk {
...
@@ -26,6 +26,7 @@ public class DingTalk {
public
static
void
sendToDad
(
String
json
)
{
public
static
void
sendToDad
(
String
json
)
{
String
body
=
new
String
(
Base64
.
getEncoder
().
encode
(
json
.
getBytes
()));
String
body
=
new
String
(
Base64
.
getEncoder
().
encode
(
json
.
getBytes
()));
System
.
out
.
println
(
"发送消息到DD:"
+
body
);
doPost
(
DD_ROBOT_HOOK_URL
,
String
.
format
(
TMPL
,
body
,
""
));
doPost
(
DD_ROBOT_HOOK_URL
,
String
.
format
(
TMPL
,
body
,
""
));
}
}
...
...
resources/sample-dataset.db.mv.db
View file @
7ec4c929
No preview for this file type
src/metabase/models/common.clj
View file @
7ec4c929
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
"Asia/Calcutta"
"Asia/Calcutta"
"Asia/Colombo"
"Asia/Colombo"
"Asia/Dhaka"
"Asia/Dhaka"
"Asia/
Hong_Kong
"
"Asia/
Shanghai
"
"Asia/Irkutsk"
"Asia/Irkutsk"
"Asia/Jerusalem"
"Asia/Jerusalem"
"Asia/Kabul"
"Asia/Kabul"
...
...
test/metabase/query_processor_test/timezones_test.clj
View file @
7ec4c929
...
@@ -231,7 +231,7 @@
...
@@ -231,7 +231,7 @@
;; Oracle doesn't have a time type
;; Oracle doesn't have a time type
(
datasets/test-drivers
(
set-timezone-drivers
)
(
datasets/test-drivers
(
set-timezone-drivers
)
(
data/dataset
attempted-murders
(
data/dataset
attempted-murders
(
doseq
[
timezone
[
nil
"US/Pacific"
"US/Eastern"
"Asia/
Hong_Kong
"
]]
(
doseq
[
timezone
[
nil
"US/Pacific"
"US/Eastern"
"Asia/
Shanghai
"
]]
(
tu/with-temporary-setting-values
[
report-timezone
timezone
]
(
tu/with-temporary-setting-values
[
report-timezone
timezone
]
(
let
[
expected
(
expected-attempts
)]
(
let
[
expected
(
expected-attempts
)]
(
is
(
=
expected
(
is
(
=
expected
...
...
test/metabase/util/date_2_test.clj
View file @
7ec4c929
...
@@ -113,8 +113,8 @@
...
@@ -113,8 +113,8 @@
(
testing
"Should be able to parse SQL-style literals where Zone ID is separated by a space, without brackets"
(
testing
"Should be able to parse SQL-style literals where Zone ID is separated by a space, without brackets"
(
is
(
=
(
t/zoned-date-time
"2014-08-01T10:00Z[UTC]"
)
(
is
(
=
(
t/zoned-date-time
"2014-08-01T10:00Z[UTC]"
)
(
u.date/parse
"2014-08-01 10:00:00.000 UTC"
)))
(
u.date/parse
"2014-08-01 10:00:00.000 UTC"
)))
(
is
(
=
(
t/zoned-date-time
"2014-08-02T00:00+08:00[Asia/
Hong_Kong
]"
)
(
is
(
=
(
t/zoned-date-time
"2014-08-02T00:00+08:00[Asia/
Shanghai
]"
)
(
u.date/parse
"2014-08-02 00:00:00.000 Asia/
Hong_Kong
"
))))
(
u.date/parse
"2014-08-02 00:00:00.000 Asia/
Shanghai
"
))))
(
testing
"Should be able to parse strings with hour-only offsets e.g. '+00'"
(
testing
"Should be able to parse strings with hour-only offsets e.g. '+00'"
(
is
(
=
(
t/offset-time
"07:23:18.331Z"
)
(
is
(
=
(
t/offset-time
"07:23:18.331Z"
)
(
u.date/parse
"07:23:18.331-00"
)))
(
u.date/parse
"07:23:18.331-00"
)))
...
...
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