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
6c6f788e
Unverified
Commit
6c6f788e
authored
2 years ago
by
Anton Kulyk
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Avoid dynamic require (#27780)
parent
15107d36
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/src/metabase/entities/revisions.js
+8
-10
8 additions, 10 deletions
frontend/src/metabase/entities/revisions.js
frontend/src/metabase/entities/search.js
+21
-9
21 additions, 9 deletions
frontend/src/metabase/entities/search.js
with
29 additions
and
19 deletions
frontend/src/metabase/entities/revisions.js
+
8
−
10
View file @
6c6f788e
...
...
@@ -2,9 +2,10 @@ import { createEntity } from "metabase/lib/entities";
import
{
GET
,
POST
}
from
"
metabase/lib/api
"
;
const
listRevisions
=
GET
(
"
/api/revision
"
);
import
Dashboards
from
"
./dashboards
"
;
import
Questions
from
"
./questions
"
;
const
ASSOCIATED_ENTITY_TYPES
=
[
"
questions
"
,
"
dashboards
"
]
;
const
listRevisions
=
GET
(
"
/api/revision
"
)
;
const
Revision
=
createEntity
({
name
:
"
revisions
"
,
...
...
@@ -35,14 +36,11 @@ const Revision = createEntity({
},
actionShouldInvalidateLists
(
action
)
{
const
entities
=
require
(
"
metabase/entities
"
);
for
(
const
type
of
ASSOCIATED_ENTITY_TYPES
)
{
if
(
entities
[
type
].
actionShouldInvalidateLists
(
action
))
{
return
true
;
}
}
return
action
.
type
===
this
.
actionTypes
.
INVALIDATE_LISTS_ACTION
;
return
(
action
.
type
===
this
.
actionTypes
.
INVALIDATE_LISTS_ACTION
||
Dashboards
.
actionShouldInvalidateLists
(
action
)
||
Questions
.
actionShouldInvalidateLists
(
action
)
);
},
});
...
...
This diff is collapsed.
Click to expand it.
frontend/src/metabase/entities/search.js
+
21
−
9
View file @
6c6f788e
...
...
@@ -3,11 +3,19 @@ import { createEntity } from "metabase/lib/entities";
import
{
GET
}
from
"
metabase/lib/api
"
;
import
{
entityTypeForObject
}
from
"
metabase/lib/schema
"
;
import
{
ObjectUnionSchema
,
ENTITIES_SCHEMA_MAP
}
from
"
metabase/schema
"
;
import
{
ObjectUnionSchema
}
from
"
metabase/schema
"
;
import
{
canonicalCollectionId
}
from
"
metabase/collections/utils
"
;
const
ENTITIES_TYPES
=
Object
.
keys
(
ENTITIES_SCHEMA_MAP
);
import
Bookmarks
from
"
./bookmarks
"
;
import
Collections
from
"
./collections
"
;
import
Dashboards
from
"
./dashboards
"
;
import
Metrics
from
"
./metrics
"
;
import
Pulses
from
"
./pulses
"
;
import
Questions
from
"
./questions
"
;
import
Segments
from
"
./segments
"
;
import
Snippets
from
"
./snippets
"
;
import
SnippetCollections
from
"
./snippet-collections
"
;
const
searchList
=
GET
(
"
/api/search
"
);
const
collectionList
=
GET
(
"
/api/collection/:collection/items
"
);
...
...
@@ -82,12 +90,16 @@ export default createEntity({
// delegate to each entity's actionShouldInvalidateLists
actionShouldInvalidateLists
(
action
)
{
const
entities
=
require
(
"
metabase/entities
"
);
for
(
const
type
of
ENTITIES_TYPES
)
{
if
(
entities
[
type
].
actionShouldInvalidateLists
(
action
))
{
return
true
;
}
}
return
false
;
return
(
Bookmarks
.
actionShouldInvalidateLists
(
action
)
||
Collections
.
actionShouldInvalidateLists
(
action
)
||
Dashboards
.
actionShouldInvalidateLists
(
action
)
||
Metrics
.
actionShouldInvalidateLists
(
action
)
||
Pulses
.
actionShouldInvalidateLists
(
action
)
||
Questions
.
actionShouldInvalidateLists
(
action
)
||
Segments
.
actionShouldInvalidateLists
(
action
)
||
Snippets
.
actionShouldInvalidateLists
(
action
)
||
SnippetCollections
.
actionShouldInvalidateLists
(
action
)
);
},
});
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