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
Loading
...@@ -14,6 +14,16 @@ import { generateQueryDescription } from "metabase-lib/queries/utils/description ...@@ -14,6 +14,16 @@ import { generateQueryDescription } from "metabase-lib/queries/utils/description
import "./SaveQuestionModal.css"; 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 { export default class SaveQuestionModal extends Component {
static propTypes = { static propTypes = {
card: PropTypes.object.isRequired, card: PropTypes.object.isRequired,
...@@ -104,17 +114,16 @@ export default class SaveQuestionModal extends Component { ...@@ -104,17 +114,16 @@ export default class SaveQuestionModal extends Component {
? t`First, save your question` ? t`First, save your question`
: t`First, save your model`; : t`First, save your model`;
const singleStepTitle =
questionType === "question" ? t`Save question` : t`Save model`;
const title = this.props.multiStep ? multiStepTitle : singleStepTitle;
const showSaveType = const showSaveType =
!card.id && !card.id &&
!!originalCard && !!originalCard &&
!originalCard.dataset && !originalCard.dataset &&
originalCard.can_write; originalCard.can_write;
const singleStepTitle = getSingleStepTitle(questionType, showSaveType);
const title = this.props.multiStep ? multiStepTitle : singleStepTitle;
const nameInputPlaceholder = const nameInputPlaceholder =
questionType === "question" questionType === "question"
? t`What is the name of your question?` ? t`What is the name of your question?`
......
...@@ -21,9 +21,11 @@ describe("scenarios > question > native > mongo", { tags: "@external" }, () => { ...@@ -21,9 +21,11 @@ describe("scenarios > question > native > mongo", { tags: "@external" }, () => {
}); });
it("can save a native MongoDB query", () => { it("can save a native MongoDB query", () => {
cy.get(".ace_content").type(`[ { $count: "Total" } ]`, { cy.get(".ace_content")
parseSpecialCharSequences: false, .should("be.visible")
}); .type(`[ { $count: "Total" } ]`, {
parseSpecialCharSequences: false,
});
cy.get(".NativeQueryEditor .Icon-play").click(); cy.get(".NativeQueryEditor .Icon-play").click();
cy.wait("@dataset"); cy.wait("@dataset");
...@@ -32,7 +34,7 @@ describe("scenarios > question > native > mongo", { tags: "@external" }, () => { ...@@ -32,7 +34,7 @@ describe("scenarios > question > native > mongo", { tags: "@external" }, () => {
cy.findByText("Save").click(); cy.findByText("Save").click();
cy.findByTextEnsureVisible("Save question"); cy.findByTextEnsureVisible("Save new question");
modal().within(() => { modal().within(() => {
cy.findByLabelText("Name").clear().should("be.empty").type("mongo count"); 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