Skip to content
Snippets Groups Projects
Unverified Commit 925e3c43 authored by Maz Ameli's avatar Maz Ameli Committed by GitHub
Browse files

Make it clearer you're creating a new question when saving (#26048)

* make it clearer you're creating a new question

* fix the function
parent 78d506c5
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,16 @@ import { generateQueryDescription } from "metabase-lib/queries/utils/description
import "./SaveQuestionModal.css";
const getSingleStepTitle = (questionType, showSaveType) => {
if (questionType === "model") {
return t`Save model`;
} else if (showSaveType) {
return t`Save question`;
} else {
return t`Save new question`;
}
};
export default class SaveQuestionModal extends Component {
static propTypes = {
card: PropTypes.object.isRequired,
......@@ -104,17 +114,16 @@ export default class SaveQuestionModal extends Component {
? t`First, save your question`
: t`First, save your model`;
const singleStepTitle =
questionType === "question" ? t`Save question` : t`Save model`;
const title = this.props.multiStep ? multiStepTitle : singleStepTitle;
const showSaveType =
!card.id &&
!!originalCard &&
!originalCard.dataset &&
originalCard.can_write;
const singleStepTitle = getSingleStepTitle(questionType, showSaveType);
const title = this.props.multiStep ? multiStepTitle : singleStepTitle;
const nameInputPlaceholder =
questionType === "question"
? t`What is the name of your question?`
......
......@@ -21,9 +21,11 @@ describe("scenarios > question > native > mongo", { tags: "@external" }, () => {
});
it("can save a native MongoDB query", () => {
cy.get(".ace_content").type(`[ { $count: "Total" } ]`, {
parseSpecialCharSequences: false,
});
cy.get(".ace_content")
.should("be.visible")
.type(`[ { $count: "Total" } ]`, {
parseSpecialCharSequences: false,
});
cy.get(".NativeQueryEditor .Icon-play").click();
cy.wait("@dataset");
......@@ -32,7 +34,7 @@ describe("scenarios > question > native > mongo", { tags: "@external" }, () => {
cy.findByText("Save").click();
cy.findByTextEnsureVisible("Save question");
cy.findByTextEnsureVisible("Save new question");
modal().within(() => {
cy.findByLabelText("Name").clear().should("be.empty").type("mongo count");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment