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
f88fbc72
Unverified
Commit
f88fbc72
authored
2 years ago
by
Gustavo Saiani
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Pin model if created from scratch (#26069)
parent
b3d4cd24
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/src/metabase/query_builder/containers/QueryBuilder.jsx
+7
-1
7 additions, 1 deletion
...nd/src/metabase/query_builder/containers/QueryBuilder.jsx
frontend/test/metabase/scenarios/models/create.cy.spec.js
+17
-2
17 additions, 2 deletions
frontend/test/metabase/scenarios/models/create.cy.spec.js
with
24 additions
and
3 deletions
frontend/src/metabase/query_builder/containers/QueryBuilder.jsx
+
7
−
1
View file @
f88fbc72
...
...
@@ -269,8 +269,14 @@ function QueryBuilder(props) {
const
handleCreate
=
useCallback
(
async
card
=>
{
const
questionWithUpdatedCard
=
question
.
setCard
(
card
).
setPinned
(
false
);
const
shouldBePinned
=
Boolean
(
card
.
dataset
);
const
questionWithUpdatedCard
=
question
.
setCard
(
card
)
.
setPinned
(
shouldBePinned
);
await
apiCreateQuestion
(
questionWithUpdatedCard
);
setRecentlySaved
(
"
created
"
);
},
[
question
,
apiCreateQuestion
,
setRecentlySaved
],
...
...
This diff is collapsed.
Click to expand it.
frontend/test/metabase/scenarios/models/create.cy.spec.js
+
17
−
2
View file @
f88fbc72
import
{
restore
}
from
"
__support__/e2e/helpers
"
;
import
{
restore
,
visitCollection
}
from
"
__support__/e2e/helpers
"
;
const
modelName
=
"
A name
"
;
describe
(
"
scenarios > models > create
"
,
()
=>
{
beforeEach
(()
=>
{
...
...
@@ -26,7 +28,7 @@ describe("scenarios > models > create", () => {
cy
.
findByText
(
"
Save
"
).
click
();
cy
.
findByPlaceholderText
(
"
What is the name of your model?
"
).
type
(
"
A n
ame
"
);
cy
.
findByPlaceholderText
(
"
What is the name of your model?
"
).
type
(
modelN
ame
);
cy
.
findByText
(
"
Save
"
).
click
();
...
...
@@ -34,6 +36,8 @@ describe("scenarios > models > create", () => {
// After saving, we land on view mode for the model
cy
.
findByText
(
"
Summarize
"
);
checkIfPinned
();
});
});
...
...
@@ -42,3 +46,14 @@ function goFromHomePageToNewNativeQueryModelPage() {
cy
.
findByText
(
"
Model
"
).
click
();
cy
.
findByText
(
"
Use a native query
"
).
click
();
}
function
checkIfPinned
()
{
visitCollection
(
"
root
"
);
cy
.
findByText
(
modelName
)
.
closest
(
"
a
"
)
.
find
(
"
.Icon-ellipsis
"
)
.
click
({
force
:
true
});
cy
.
findByText
(
"
Unpin
"
).
should
(
"
be.visible
"
);
}
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