Skip to content

Commit

Permalink
Merge pull request mozilla#3 from Avey777/dev
Browse files Browse the repository at this point in the history
Code optimization
  • Loading branch information
Avey777 authored Jun 13, 2023
2 parents e417302 + e1d118e commit 6963ab2
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions client/app/pages/dashboards/components/ShareDashboardDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,20 @@ class ShareDashboardDialog extends React.Component {
};

render() {
const { dialog, dashboard } = this.props;

const { dialog, dashboard, hasOnlySafeQueries } = this.props;
const headerContent = this.constructor.headerContent;
return (
<Modal {...dialog.props} title={this.constructor.headerContent} footer={null}>
<Modal {...dialog.props} title={headerContent} footer={null}>
<Form layout="horizontal">
{!this.props.hasOnlySafeQueries && (
{!hasOnlySafeQueries && (
<Form.Item>
<Alert
message="For your security, sharing is currently not supported for dashboards containing queries with text parameters. Consider changing the text parameters in your query to a different type."
type="error"
/>
</Form.Item>
)}

<Form.Item label="Allow public access" {...this.formItemProps}>
<Switch
checked={dashboard.publicAccessEnabled}
Expand All @@ -117,14 +118,31 @@ class ShareDashboardDialog extends React.Component {
/>
</Form.Item>
{dashboard.public_url && (
<Form.Item label="Secret address" {...this.formItemProps}>
<InputWithCopy value={dashboard.public_url} data-test="SecretAddress" />
</Form.Item>
<>
<Form.Item>
<Alert
message={
<div>
Custom rule for hiding filter components when sharing links:
<br />
You can hide filter components by appending `&hide_filter={"{{"} component_name{"}}"}` to thesharing URL.
<br />
Example: http://{"{{"}ip{"}}"}:{"{{"}port{"}}"}/public/dashboards/{"{{"}id{"}}"}?p_country=ghana&p_site=10&hide_filter=country
</div>
}
type="warning"
/>
</Form.Item>

<Form.Item label="Secret address" {...this.formItemProps}>
<InputWithCopy value={dashboard.public_url} data-test="SecretAddress" />
</Form.Item>
</>
)}
</Form>
</Modal>
);
}
}

export default wrapDialog(ShareDashboardDialog);
export default wrapDialog(ShareDashboardDialog);

0 comments on commit 6963ab2

Please sign in to comment.