mirror of
https://github.com/getredash/redash.git
synced 2026-05-11 00:00:57 -04:00
* Migrate TypePicker to React
* Migrate DataSources and Destinations List
* Fixes to DestinationsList
* Add CreateDataSource (testing with Steps)
* Render the form after type selection
* Add HELP_LINKS to CreateDataSource
* Add Done behavior
* Add scrollToTop to CreateDataSource
* TypePicker styling adjusts
* Add CreateDestination
* Update resouce gets to componentDidMount
* Create EditForm components
* Migrate Edit pages
* Remove angular logic from DynamicForm
* Add actions to EditPages
* TypePicker title style adjustments
* Add Empty and Loading state
* UX improvements
* Review changes
* Styling updates on TypePicker, forms background fix
* Add blank line removed by mistaken
* Reorganize TypePicker
* Hide Search on List Pages
* Fix spacing in Forms
* Update Create Data Source and Destination to be a Dialog
* Remove max-height from the form
* Fix DynamicForm import in CreateUserDialog
* Route /new to open CreateSourceDialog
* Add HelpTrigger + refine styling and Edit Pages
* Remove help links from data source resource
* Update Cypress specs
* TypePicker -> CardsList
* Remove old TypePicker styling and change CardsList styling to less
* Test if Percy shows Dialogs
* Personal review cleanup
* CR
* Remove unnecessary query on dialog success
* Handle resource errors in Edit Pages
* Add CreateDestination policy
* Add placeholder and separator to the Name field
* Use cy.click instead of cy.wait
* Revert "Use cy.click instead of cy.wait" (Didn't work)
This reverts commit 77285d9fa3.
* Align help trigger on the right and rename Steps
* Refine behavior for long names
* Update toastr calls to use notification instead
* Redirect to target after creation
* Remove autoFocus on DynamicForm for Edit Pages
* Add eslint-disable for cy.wait
89 lines
2.3 KiB
JavaScript
89 lines
2.3 KiB
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import classNames from 'classnames';
|
|
|
|
// PreviewCard
|
|
|
|
export function PreviewCard({ imageUrl, roundedImage, title, body, children, className, ...props }) {
|
|
return (
|
|
<div {...props} className={className + ' w-100 d-flex align-items-center'}>
|
|
<img
|
|
src={imageUrl}
|
|
width="32"
|
|
height="32"
|
|
className={classNames({ 'profile__image--settings': roundedImage }, 'm-r-5')}
|
|
alt="Logo/Avatar"
|
|
/>
|
|
<div className="flex-fill">
|
|
<div>{title}</div>
|
|
{body && <div className="text-muted">{body}</div>}
|
|
</div>
|
|
{children}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
PreviewCard.propTypes = {
|
|
imageUrl: PropTypes.string.isRequired,
|
|
title: PropTypes.node.isRequired,
|
|
body: PropTypes.node,
|
|
roundedImage: PropTypes.bool,
|
|
className: PropTypes.string,
|
|
children: PropTypes.node,
|
|
};
|
|
|
|
PreviewCard.defaultProps = {
|
|
body: null,
|
|
roundedImage: true,
|
|
className: '',
|
|
children: null,
|
|
};
|
|
|
|
// UserPreviewCard
|
|
|
|
export function UserPreviewCard({ user, withLink, children, ...props }) {
|
|
const title = withLink ? <a href={'users/' + user.id}>{user.name}</a> : user.name;
|
|
return (
|
|
<PreviewCard {...props} imageUrl={user.profile_image_url} title={title} body={user.email}>
|
|
{children}
|
|
</PreviewCard>
|
|
);
|
|
}
|
|
|
|
UserPreviewCard.propTypes = {
|
|
user: PropTypes.shape({
|
|
profile_image_url: PropTypes.string.isRequired,
|
|
name: PropTypes.string.isRequired,
|
|
email: PropTypes.string.isRequired,
|
|
}).isRequired,
|
|
withLink: PropTypes.bool,
|
|
children: PropTypes.node,
|
|
};
|
|
|
|
UserPreviewCard.defaultProps = {
|
|
withLink: false,
|
|
children: null,
|
|
};
|
|
|
|
// DataSourcePreviewCard
|
|
|
|
export function DataSourcePreviewCard({ dataSource, withLink, children, ...props }) {
|
|
const imageUrl = `/static/images/db-logos/${dataSource.type}.png`;
|
|
const title = withLink ? <a href={'data_sources/' + dataSource.id}>{dataSource.name}</a> : dataSource.name;
|
|
return <PreviewCard {...props} imageUrl={imageUrl} title={title}>{children}</PreviewCard>;
|
|
}
|
|
|
|
DataSourcePreviewCard.propTypes = {
|
|
dataSource: PropTypes.shape({
|
|
name: PropTypes.string.isRequired,
|
|
type: PropTypes.string.isRequired,
|
|
}).isRequired,
|
|
withLink: PropTypes.bool,
|
|
children: PropTypes.node,
|
|
};
|
|
|
|
DataSourcePreviewCard.defaultProps = {
|
|
withLink: false,
|
|
children: null,
|
|
};
|