Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Query Source page to React: metadata, schedule and description blocks #4476

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions client/app/pages/queries/QuerySource.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,14 @@ import QueryExecutionStatus from "./components/QueryExecutionStatus";
import SchemaBrowser from "./components/SchemaBrowser";
import useVisualizationTabHandler from "./utils/useVisualizationTabHandler";
import useQueryExecute from "./utils/useQueryExecute";
import { updateQuery, deleteQueryVisualization, addQueryVisualization, editQueryVisualization } from "./utils";
import {
updateQuery,
updateQueryDescription,
updateQuerySchedule,
deleteQueryVisualization,
addQueryVisualization,
editQueryVisualization,
} from "./utils";

import "./query-source.less";

Expand Down Expand Up @@ -244,13 +251,13 @@ function QuerySource(props) {
schedule: query.schedule,
refreshOptions,
}).result.then(schedule => {
updateQuery(query, { schedule }).then(setQuery);
updateQuerySchedule(query, schedule).then(setQuery);
kravets-levko marked this conversation as resolved.
Show resolved Hide resolved
});
}, [query]);

const updateQueryDescription = useCallback(
const doUpdateQueryDescription = useCallback(
description => {
updateQuery(query, { description }).then(setQuery);
updateQueryDescription(query, description).then(setQuery);
},
[query]
);
Expand Down Expand Up @@ -340,7 +347,7 @@ function QuerySource(props) {
ignoreBlanks={false}
placeholder="Add description"
value={query.description}
onDone={updateQueryDescription}
onDone={doUpdateQueryDescription}
/>
</div>
)}
Expand Down
1 change: 1 addition & 0 deletions client/app/pages/queries/components/QueryMetadata.less
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
margin-bottom: 8px;

&:last-child {
margin-top: 20px;
margin-bottom: 0;
}

Expand Down
12 changes: 12 additions & 0 deletions client/app/pages/queries/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,25 @@ function renameQuery(query, name) {
return updateQuery(query, changes, options);
}

function updateQueryDescription(query, description) {
recordEvent("edit_description", "query", query.id);
return updateQuery(query, { description });
}

function updateQuerySchedule(query, schedule) {
recordEvent("edit_schedule", "query", query.id);
return updateQuery(query, { schedule });
}

export {
updateQuery,
archiveQuery,
duplicateQuery,
publishQuery,
unpublishQuery,
renameQuery,
updateQueryDescription,
updateQuerySchedule,
deleteQueryVisualization,
addQueryVisualization,
editQueryVisualization,
Expand Down