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
5d350be7
Unverified
Commit
5d350be7
authored
3 years ago
by
Gustavo Saiani
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Reorder imports in NativeQueryEditor (#18582)
parent
6fc3c973
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/src/metabase/query_builder/components/NativeQueryEditor.jsx
+24
-23
24 additions, 23 deletions
...c/metabase/query_builder/components/NativeQueryEditor.jsx
with
24 additions
and
23 deletions
frontend/src/metabase/query_builder/components/NativeQueryEditor.jsx
+
24
−
23
View file @
5d350be7
...
...
@@ -3,10 +3,6 @@
import
React
,
{
Component
}
from
"
react
"
;
import
cx
from
"
classnames
"
;
import
"
./NativeQueryEditor.css
"
;
import
{
ResizableBox
}
from
"
react-resizable
"
;
import
"
ace/ace
"
;
import
"
ace/ext-language_tools
"
;
...
...
@@ -22,15 +18,19 @@ import "ace/snippets/mysql";
import
"
ace/snippets/pgsql
"
;
import
"
ace/snippets/sqlserver
"
;
import
"
ace/snippets/json
"
;
import
{
t
}
from
"
ttag
"
;
import
_
from
"
underscore
"
;
import
{
ResizableBox
}
from
"
react-resizable
"
;
import
"
./NativeQueryEditor.css
"
;
import
{
isMac
}
from
"
metabase/lib/browser
"
;
import
{
isEventOverElement
}
from
"
metabase/lib/dom
"
;
import
{
delay
}
from
"
metabase/lib/promise
"
;
import
{
SQLBehaviour
}
from
"
metabase/lib/ace/sql_behaviour
"
;
import
_
from
"
underscore
"
;
import
Icon
from
"
metabase/components/Icon
"
;
import
ExplicitSize
from
"
metabase/components/ExplicitSize
"
;
import
Popover
from
"
metabase/components/Popover
"
;
...
...
@@ -39,26 +39,9 @@ import Snippets from "metabase/entities/snippets";
import
SnippetCollections
from
"
metabase/entities/snippet-collections
"
;
import
Parameters
from
"
metabase/parameters/components/Parameters/Parameters
"
;
const
SCROLL_MARGIN
=
8
;
const
LINE_HEIGHT
=
16
;
const
MIN_HEIGHT_LINES
=
13
;
const
ICON_SIZE
=
18
;
const
getEditorLineHeight
=
lines
=>
lines
*
LINE_HEIGHT
+
2
*
SCROLL_MARGIN
;
const
getLinesForHeight
=
height
=>
(
height
-
2
*
SCROLL_MARGIN
)
/
LINE_HEIGHT
;
import
Question
from
"
metabase-lib/lib/Question
"
;
import
NativeQuery
from
"
metabase-lib/lib/queries/NativeQuery
"
;
import
type
{
DatasetQuery
}
from
"
metabase-types/types/Card
"
;
import
type
{
DatabaseId
}
from
"
metabase-types/types/Database
"
;
import
type
{
TableId
}
from
"
metabase-types/types/Table
"
;
import
type
{
ParameterId
}
from
"
metabase-types/types/Parameter
"
;
import
type
{
LocationDescriptor
}
from
"
metabase-types/types
"
;
import
type
{
RunQueryParams
}
from
"
metabase/query_builder/actions
"
;
import
{
DatabaseDataSelector
,
SchemaAndTableDataSelector
,
...
...
@@ -70,6 +53,13 @@ import DataReferenceButton from "./view/DataReferenceButton";
import
NativeVariablesButton
from
"
./view/NativeVariablesButton
"
;
import
SnippetSidebarButton
from
"
./view/SnippetSidebarButton
"
;
import
type
{
DatasetQuery
}
from
"
metabase-types/types/Card
"
;
import
type
{
DatabaseId
}
from
"
metabase-types/types/Database
"
;
import
type
{
TableId
}
from
"
metabase-types/types/Table
"
;
import
type
{
ParameterId
}
from
"
metabase-types/types/Parameter
"
;
import
type
{
LocationDescriptor
}
from
"
metabase-types/types
"
;
import
type
{
RunQueryParams
}
from
"
metabase/query_builder/actions
"
;
type
AutoCompleteResult
=
[
string
,
string
,
string
];
type
AceEditor
=
any
;
// TODO;
...
...
@@ -111,11 +101,22 @@ type Props = {
snippets
:
{
name
:
string
}[],
snippetCollections
:
{
can_write
:
boolean
}[],
};
type
State
=
{
initialHeight
:
number
,
isSelectedTextPopoverOpen
:
boolean
,
};
const
SCROLL_MARGIN
=
8
;
const
LINE_HEIGHT
=
16
;
const
MIN_HEIGHT_LINES
=
13
;
const
ICON_SIZE
=
18
;
const
getEditorLineHeight
=
lines
=>
lines
*
LINE_HEIGHT
+
2
*
SCROLL_MARGIN
;
const
getLinesForHeight
=
height
=>
(
height
-
2
*
SCROLL_MARGIN
)
/
LINE_HEIGHT
;
@
ExplicitSize
()
@
Snippets
.
loadList
({
loadingAndErrorWrapper
:
false
})
@
SnippetCollections
.
loadList
({
loadingAndErrorWrapper
:
false
})
...
...
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