Skip to content

Commit

Permalink
Parameter feedback - #3 Added in Widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
ranbena committed Oct 31, 2019
1 parent a5be5d1 commit b0b1a83
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ RefreshIndicator.defaultProps = { refreshStartedAt: null };

function VisualizationWidgetHeader({ widget, refreshStartedAt, parameters, onParametersUpdate }) {
const canViewQuery = currentUser.hasPermission('view_query');
const queryResult = widget.getQueryResult();
const errorData = queryResult && queryResult.getErrorData();

return (
<>
Expand All @@ -90,8 +92,8 @@ function VisualizationWidgetHeader({ widget, refreshStartedAt, parameters, onPar
</div>
</div>
{!isEmpty(parameters) && (
<div className="m-b-10">
<Parameters parameters={parameters} onValuesChange={onParametersUpdate} />
<div className="m-b-5">
<Parameters parameters={parameters} queryResultErrorData={errorData} onValuesChange={onParametersUpdate} />
</div>
)}
</>
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/queries/visualization-embed.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h3>

<div class="col-md-12 query__vis">
<div class="p-t-15 p-b-10" ng-if="$ctrl.query.hasParameters() && !$ctrl.hideParametersUI">
<parameters parameters="$ctrl.query.getParametersDefs()" on-values-change="$ctrl.refreshQueryResults"></parameters>
<parameters parameters="$ctrl.query.getParametersDefs()" query-result-error-data="$ctrl.errorData" on-values-change="$ctrl.refreshQueryResults"></parameters>
</div>

<div ng-if="$ctrl.error">
Expand Down
2 changes: 2 additions & 0 deletions client/app/components/queries/visualization-embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const VisualizationEmbed = {
this.refreshQueryResults = () => {
this.loading = true;
this.error = null;
this.errorData = {};
this.refreshStartedAt = moment();
this.query
.getQueryResultPromise()
Expand All @@ -24,6 +25,7 @@ const VisualizationEmbed = {
.catch((error) => {
this.loading = false;
this.error = error.getError();
this.errorData = error.getErrorData();
});
};

Expand Down

0 comments on commit b0b1a83

Please sign in to comment.