Skip to content

Commit

Permalink
Add explicit ignore_true parameter to Tables.load requests in admin p…
Browse files Browse the repository at this point in the history
…anel to avoid counting the requests as a table view
  • Loading branch information
Callum Herries committed Jul 8, 2022
1 parent 4ca26ab commit f887d0d
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ class PartialQueryBuilder extends Component {
export default _.compose(
Tables.load({
id: (state, props) => props.value && props.value["source-table"],
query: { ignore_view: true },
wrapped: true,
}),
withTableMetadataLoaded,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export default _.compose(
id: (_state: State, { tableId }: { tableId: number }) => tableId,
query: {
...PLUGIN_FEATURE_LEVEL_PERMISSIONS.dataModelQueryProps,
ignore_view: true,
},
wrapped: true,
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ const MetadataTable = ({
}
};

const handleDescriptionChange: ChangeEventHandler<
HTMLInputElement
> = event => {
const handleDescriptionChange: ChangeEventHandler<HTMLInputElement> = event => {
handlePropertyUpdate("description", event.target.value);
};

Expand Down Expand Up @@ -171,6 +169,7 @@ export default _.compose(
id: (_state: State, { tableId }: { tableId: number }) => tableId,
query: {
...PLUGIN_FEATURE_LEVEL_PERMISSIONS.dataModelQueryProps,
ignore_view: true,
},
wrapped: true,
selectorName: "getObjectUnfiltered",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,5 @@ class RevisionHistory extends Component {

export default Tables.load({
id: (state, { object: { table_id } }) => table_id,
query: { ignore_view: true },
})(RevisionHistory);
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const Nav = _.compose(
id: (state, { tableId }) => tableId,
query: {
...PLUGIN_FEATURE_LEVEL_PERMISSIONS.dataModelQueryProps,
ignore_view: true,
},
selectorName: "getObjectUnfiltered",
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,6 @@ class TableSelectorInner extends React.Component {

const TableSelector = Tables.load({
id: (state, props) => props.tableId,
query: { ignore_view: true },
loadingAndErrorWrapper: false,
})(TableSelectorInner);
5 changes: 3 additions & 2 deletions src/metabase/api/table.clj
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,14 @@

(api/defendpoint GET "/:id"
"Get `Table` with ID."
[id include_editable_data_model]
[id include_editable_data_model ignore_view]
(let [api-perm-check-fn (if (Boolean/parseBoolean include_editable_data_model)
api/write-check
api/read-check)]
(u/prog1 (-> (api-perm-check-fn Table id)
(hydrate :db :pk_field))
(events/publish-event! :table-read (assoc <> :actor_id api/*current-user-id*)))))
(when-not (Boolean/parseBoolean ignore_view)
(events/publish-event! :table-read (assoc <> :actor_id api/*current-user-id*))))))

(defn- update-table!*
"Takes an existing table and the changes, updates in the database and optionally calls `table/update-field-positions!`
Expand Down

0 comments on commit f887d0d

Please sign in to comment.