Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
1acdc3b9
Commit
1acdc3b9
authored
6 years ago
by
Simon Belak
Browse files
Options
Downloads
Patches
Plain Diff
Wrap rules in a delay
parent
5cb2c11b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/metabase/automagic_dashboards/rules.clj
+10
-10
10 additions, 10 deletions
src/metabase/automagic_dashboards/rules.clj
test/metabase/automagic_dashboards/core_test.clj
+1
-1
1 addition, 1 deletion
test/metabase/automagic_dashboards/core_test.clj
with
11 additions
and
11 deletions
src/metabase/automagic_dashboards/rules.clj
+
10
−
10
View file @
1acdc3b9
...
...
@@ -329,20 +329,20 @@
(
let
[
~
identifier
(
.getPath
(
FileSystems/getDefault
)
(
.getPath
~
path
)
(
into-array
String
[]))]
~@
body
))))
(
def
^
:private
rules
(
with-resource
[
path
(
->
rules-dir
io/resource
.toURI
)]
(
into
{}
(
load-rule-dir
path
))))
(
def
^
:private
rules
(
delay
(
with-resource
[
path
(
->
rules-dir
io/resource
.toURI
)]
(
into
{}
(
load-rule-dir
path
))))
)
(
defn
get-rules
"Get all rules with prefix `p
ath
`.
Path needs to match the entire prefix
, so [\"table\"] will match table/TransactionTable.yaml,
but not
table/TransactionTable/ByCountry.yaml"
[
p
ath
]
(
->>
p
ath
(
get-in
rules
)
"Get all rules with prefix `p
refix
`.
prefix is greedy
, so [\"table\"] will match table/TransactionTable.yaml,
but not
table/TransactionTable/ByCountry.yaml"
[
p
refix
]
(
->>
p
refix
(
get-in
@
rules
)
(
keep
(
comp
::leaf
val
))))
(
defn
get-rule
"Get rule at path `path`."
[
path
]
(
get-in
rules
(
concat
path
[
::leaf
])))
(
get-in
@
rules
(
concat
path
[
::leaf
])))
This diff is collapsed.
Click to expand it.
test/metabase/automagic_dashboards/core_test.clj
+
1
−
1
View file @
1acdc3b9
...
...
@@ -50,7 +50,7 @@
(
->>
(
data/id
:users
)
Table
(
#
'magic/->root
)
(
#
'magic/matching-rules
(
rules/
load
-rules
"table"
))
(
#
'magic/matching-rules
(
rules/
get
-rules
[
"table"
]
))
(
map
(
comp
first
:applies_to
))))
(
defn-
collect-urls
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment