From d1b9a9fb222b543877562ddf9075c5db9716fd06 Mon Sep 17 00:00:00 2001 From: thomas duval Date: Wed, 9 Jan 2019 09:32:13 +1000 Subject: [PATCH 1/8] h5 to h1 --- frontend/src/metabase/containers/Overworld.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/metabase/containers/Overworld.jsx b/frontend/src/metabase/containers/Overworld.jsx index b68ac312b7d1..2e9db758697c 100644 --- a/frontend/src/metabase/containers/Overworld.jsx +++ b/frontend/src/metabase/containers/Overworld.jsx @@ -229,11 +229,11 @@ export class AdminPinMessage extends React.Component { const SectionHeading = ({ children }) => ( -
{children} -
+
); From 2a820bf1db455eaff66282571c0feff0d476910e Mon Sep 17 00:00:00 2001 From: thomas duval Date: Wed, 27 Feb 2019 17:47:00 +1000 Subject: [PATCH 2/8] add pulse --- .../src/metabase/nav/containers/Navbar.jsx | 346 +++++++++--------- 1 file changed, 180 insertions(+), 166 deletions(-) diff --git a/frontend/src/metabase/nav/containers/Navbar.jsx b/frontend/src/metabase/nav/containers/Navbar.jsx index 68982c809026..5d226f51e982 100644 --- a/frontend/src/metabase/nav/containers/Navbar.jsx +++ b/frontend/src/metabase/nav/containers/Navbar.jsx @@ -29,11 +29,13 @@ import ProfileLink from "metabase/nav/components/ProfileLink.jsx"; import { getPath, getContext, getUser } from "../selectors"; import { entityListLoader } from "metabase/entities/containers/EntityListLoader"; +import {getMetadata} from "metabase/selectors/metadata"; const mapStateToProps = (state, props) => ({ path: getPath(state, props), context: getContext(state, props), user: getUser(state), + metadata: getMetadata(state) }); const mapDispatchToProps = { @@ -41,29 +43,29 @@ const mapDispatchToProps = { }; const AdminNavItem = ({ name, path, currentPath }) => ( -
  • - - {name} - -
  • +
  • + + {name} + +
  • ); const DefaultSearchColor = color(colors.brand) - .lighten(0.07) - .string(); + .lighten(0.07) + .string(); const ActiveSearchColor = color(colors.brand) - .lighten(0.1) - .string(); + .lighten(0.1) + .string(); const SearchWrapper = Flex.extend` ${width} background-color: ${props => - props.active ? ActiveSearchColor : DefaultSearchColor}; + props.active ? ActiveSearchColor : DefaultSearchColor}; border-radius: 6px; align-items: center; color: white; @@ -114,34 +116,34 @@ class SearchBar extends React.Component { render() { const { active, searchText } = this.state; return ( - this.setState({ active: false })} - > - this.setState({ active: true })} - active={active} + this.setState({ active: false })} > - - this.setState({ active: true })} - onChange={e => this.setState({ searchText: e.target.value })} - onKeyPress={e => { - if (e.key === "Enter" && (searchText || "").trim().length > 0) { - this.props.onChangeLocation({ - pathname: "search", - query: { q: searchText }, - }); - } - }} - /> - - + this.setState({ active: true })} + active={active} + > + + this.setState({ active: true })} + onChange={e => this.setState({ searchText: e.target.value })} + onKeyPress={e => { + if (e.key === "Enter" && (searchText || "").trim().length > 0) { + this.props.onChangeLocation({ + pathname: "search", + query: { q: searchText }, + }); + } + }} + /> + + ); } } @@ -187,138 +189,150 @@ export default class Navbar extends Component { renderAdminNav() { return ( - // NOTE: DO NOT REMOVE `Nav` CLASS FOR NOW, USED BY MODALS, FULLSCREEN DASHBOARD, ETC - // TODO: hide nav using state in redux instead? - ); } renderEmptyNav() { return ( - // NOTE: DO NOT REMOVE `Nav` CLASS FOR NOW, USED BY MODALS, FULLSCREEN DASHBOARD, ETC - // TODO: hide nav using state in redux instead? - + // NOTE: DO NOT REMOVE `Nav` CLASS FOR NOW, USED BY MODALS, FULLSCREEN DASHBOARD, ETC + // TODO: hide nav using state in redux instead? + ); } renderMainNav() { const hasDataAccess = - this.props.databases && this.props.databases.length > 0; + this.props.databases && this.props.databases.length > 0; + const hasSQLPermission = db => db.native_permissions === "write"; + console.log(this.props.databases); + const showSQLOption = this.props.databases && + this.props.databases.filter(hasSQLPermission).length > 0; + const itemsNav = [ + { + title: t`New dashboard`, + icon: `dashboard`, + action: () => this.setModal(MODAL_NEW_DASHBOARD), + event: `NavBar;New Dashboard Click;`, + }]; + if (showSQLOption) { + itemsNav.push({ + title: t`New pulse`, + icon: `pulse`, + link: Urls.newPulse(), + event: `NavBar;New Pulse Click;`, + }); + } return ( - - - - - - + + + + + + + + + {hasDataAccess && ( + + + + )} + - - - - {hasDataAccess && ( - - - - )} - this.setModal(MODAL_NEW_DASHBOARD), - event: `NavBar;New Dashboard Click;`, - }, - ]} - /> - + + + {this.renderModal()} - {this.renderModal()} - ); } @@ -326,14 +340,14 @@ export default class Navbar extends Component { const { modal } = this.state; if (modal) { return ( - this.setState({ modal: null })}> - {modal === MODAL_NEW_DASHBOARD ? ( - this.setState({ modal: null })} - /> - ) : null} - + this.setState({ modal: null })}> + {modal === MODAL_NEW_DASHBOARD ? ( + this.setState({ modal: null })} + /> + ) : null} + ); } else { return null; From b15a60a265b918d81a65c9c96327713e701173de Mon Sep 17 00:00:00 2001 From: thomas duval Date: Mon, 11 Mar 2019 07:52:13 +1000 Subject: [PATCH 3/8] add pulse --- frontend/src/metabase/components/CollectionLanding.jsx | 2 +- frontend/src/metabase/components/ItemTypeFilterBar.jsx | 5 +++++ .../src/metabase/pulse/components/PulseEditChannels.jsx | 1 - .../src/metabase/pulse/components/RecipientPicker.jsx | 8 -------- src/metabase/api/collection.clj | 1 + src/metabase/models/pulse.clj | 2 +- 6 files changed, 8 insertions(+), 11 deletions(-) diff --git a/frontend/src/metabase/components/CollectionLanding.jsx b/frontend/src/metabase/components/CollectionLanding.jsx index 7a732dbbfa8e..643edc5c634f 100644 --- a/frontend/src/metabase/components/CollectionLanding.jsx +++ b/frontend/src/metabase/components/CollectionLanding.jsx @@ -72,7 +72,7 @@ const DashboardEmptyState = () => ( const PulseEmptyState = () => ( } /> diff --git a/frontend/src/metabase/components/ItemTypeFilterBar.jsx b/frontend/src/metabase/components/ItemTypeFilterBar.jsx index d3fb6527fdd0..df69cd7b9b60 100644 --- a/frontend/src/metabase/components/ItemTypeFilterBar.jsx +++ b/frontend/src/metabase/components/ItemTypeFilterBar.jsx @@ -23,6 +23,11 @@ export const FILTERS = [ name: t`Questions`, filter: "card", icon: "beaker", + }, + { + name: t`Pulses`, + filter: "pulse", + icon: "pulse", } ]; diff --git a/frontend/src/metabase/pulse/components/PulseEditChannels.jsx b/frontend/src/metabase/pulse/components/PulseEditChannels.jsx index 69f5caf18735..9b9c29b4cf28 100644 --- a/frontend/src/metabase/pulse/components/PulseEditChannels.jsx +++ b/frontend/src/metabase/pulse/components/PulseEditChannels.jsx @@ -296,7 +296,6 @@ export default class PulseEditChannels extends Component { // Default to show the default channels until full formInput is loaded let channels = formInput.channels || { email: { name: t`Email`, type: "email" }, - slack: { name: t`Slack`, type: "slack" }, }; return (
      diff --git a/frontend/src/metabase/pulse/components/RecipientPicker.jsx b/frontend/src/metabase/pulse/components/RecipientPicker.jsx index e881c477ea06..1dd01bb58413 100644 --- a/frontend/src/metabase/pulse/components/RecipientPicker.jsx +++ b/frontend/src/metabase/pulse/components/RecipientPicker.jsx @@ -59,7 +59,6 @@ export default class RecipientPicker extends Component { ? users.map(user => ({ label: user.common_name, value: user })) : [] } - onChange={this.handleOnChange} placeholder={ recipients.length === 0 ? t`Enter email addresses you'd like this data to go to` @@ -76,13 +75,6 @@ export default class RecipientPicker extends Component { {option.value.common_name} )} - filterOption={(option, filterString) => - // case insensitive search of name or email - ~option.value.common_name - .toLowerCase() - .indexOf(filterString.toLowerCase()) || - ~option.value.email.toLowerCase().indexOf(filterString.toLowerCase()) - } parseFreeformValue={inputValue => { if (VALID_EMAIL_REGEX.test(inputValue)) { return { email: inputValue }; diff --git a/src/metabase/api/collection.clj b/src/metabase/api/collection.clj index 672d053d997a..ceab17255d3c 100644 --- a/src/metabase/api/collection.clj +++ b/src/metabase/api/collection.clj @@ -78,6 +78,7 @@ (db/select [Pulse :id :name :collection_position] :collection_id (:id collection) :archived archived? + :simpro_removed false ;; exclude Alerts :alert_condition nil)) diff --git a/src/metabase/models/pulse.clj b/src/metabase/models/pulse.clj index dfbaa5897320..2abb296fecd2 100644 --- a/src/metabase/models/pulse.clj +++ b/src/metabase/models/pulse.clj @@ -198,7 +198,7 @@ (retrieve-pulses nil)) ([{:keys [archived?] :or {archived? false}}] - (for [pulse (db/select Pulse, :alert_condition nil, :archived archived?, {:order-by [[:%lower.name :asc]]})] + (for [pulse (db/select Pulse,:simpro_removed false, :alert_condition nil, :archived archived?, {:order-by [[:%lower.name :asc]]})] (-> pulse hydrate-notification notification->pulse)))) From 7cf26b1ca4b6f3dd216cac85091692dd0736d8b0 Mon Sep 17 00:00:00 2001 From: thomas duval Date: Mon, 18 Mar 2019 11:38:27 +1000 Subject: [PATCH 4/8] simpro-pulse : add pulse and remove slack --- .../components/ChannelSetupMessage.jsx | 2 +- .../metabase/components/ChannelSetupModal.jsx | 2 +- .../src/metabase/nav/containers/Navbar.jsx | 1 - .../pulse/components/PulseEditChannels.jsx | 62 ++++++++++--------- .../pulse/components/RecipientPicker.jsx | 5 +- .../metabase/pulse/components/WhatsAPulse.jsx | 2 +- .../query_builder/components/AlertModals.jsx | 2 +- .../template_tags/TagEditorHelp.jsx | 8 --- src/metabase/models/pulse_channel.clj | 11 +--- 9 files changed, 39 insertions(+), 56 deletions(-) diff --git a/frontend/src/metabase/components/ChannelSetupMessage.jsx b/frontend/src/metabase/components/ChannelSetupMessage.jsx index 136d229ce525..e089faf87c89 100644 --- a/frontend/src/metabase/components/ChannelSetupMessage.jsx +++ b/frontend/src/metabase/components/ChannelSetupMessage.jsx @@ -13,7 +13,7 @@ export default class ChannelSetupMessage extends Component { }; static defaultProps = { - channels: ["email", "Slack"], + channels: ["email"], }; render() { diff --git a/frontend/src/metabase/components/ChannelSetupModal.jsx b/frontend/src/metabase/components/ChannelSetupModal.jsx index 667e97c2f9e3..a270a7ad79d5 100644 --- a/frontend/src/metabase/components/ChannelSetupModal.jsx +++ b/frontend/src/metabase/components/ChannelSetupModal.jsx @@ -16,7 +16,7 @@ export default class ChannelSetupModal extends Component { }; static defaultProps = { - channels: ["email", "Slack"], + channels: ["email"], }; render() { diff --git a/frontend/src/metabase/nav/containers/Navbar.jsx b/frontend/src/metabase/nav/containers/Navbar.jsx index 5d226f51e982..1e6d8cb55a35 100644 --- a/frontend/src/metabase/nav/containers/Navbar.jsx +++ b/frontend/src/metabase/nav/containers/Navbar.jsx @@ -263,7 +263,6 @@ export default class Navbar extends Component { const hasDataAccess = this.props.databases && this.props.databases.length > 0; const hasSQLPermission = db => db.native_permissions === "write"; - console.log(this.props.databases); const showSQLOption = this.props.databases && this.props.databases.filter(hasSQLPermission).length > 0; const itemsNav = [ diff --git a/frontend/src/metabase/pulse/components/PulseEditChannels.jsx b/frontend/src/metabase/pulse/components/PulseEditChannels.jsx index 9b9c29b4cf28..f70a5bda5cd0 100644 --- a/frontend/src/metabase/pulse/components/PulseEditChannels.jsx +++ b/frontend/src/metabase/pulse/components/PulseEditChannels.jsx @@ -256,39 +256,41 @@ export default class PulseEditChannels extends Component { let { pulse, user } = this.props; let channels = pulse.channels .map((c, i) => [c, i]) - .filter(([c, i]) => c.enabled && c.channel_type === channelSpec.type) + .filter(([c, i]) => c.enabled && c.channel_type === channelSpec.type && c.channel_type !== 'slack') .map(([channel, index]) => this.renderChannel(channel, index, channelSpec), ); - return ( -
    • -
      - {CHANNEL_ICONS[channelSpec.type] && ( - - )} -

      {channelSpec.name}

      - 0} - onChange={this.toggleChannel.bind(this, channelSpec.type)} - /> -
      - {channels.length > 0 && channelSpec.configured ? ( -
        {channels}
      - ) : channels.length > 0 && !channelSpec.configured ? ( -
      -

      {t`${ - channelSpec.name - } needs to be set up by an administrator.`}

      - -
      - ) : null} -
    • - ); + if (channelSpec.type === 'email') { + return ( +
    • +
      + {CHANNEL_ICONS[channelSpec.type] && ( + + )} +

      {channelSpec.name}

      + 0} + onChange={this.toggleChannel.bind(this, channelSpec.type)} + /> +
      + {channels.length > 0 && channelSpec.configured ? ( +
        {channels}
      + ) : channels.length > 0 && !channelSpec.configured ? ( +
      +

      {t`${ + channelSpec.name + } needs to be set up by an administrator.`}

      + +
      + ) : null} +
    • + ); + } } render() { diff --git a/frontend/src/metabase/pulse/components/RecipientPicker.jsx b/frontend/src/metabase/pulse/components/RecipientPicker.jsx index 1dd01bb58413..9567d506f90c 100644 --- a/frontend/src/metabase/pulse/components/RecipientPicker.jsx +++ b/frontend/src/metabase/pulse/components/RecipientPicker.jsx @@ -55,10 +55,9 @@ export default class RecipientPicker extends Component { ({ label: user.common_name, value: user })) - : [] + [] } + onChange={this.handleOnChange} placeholder={ recipients.length === 0 ? t`Enter email addresses you'd like this data to go to` diff --git a/frontend/src/metabase/pulse/components/WhatsAPulse.jsx b/frontend/src/metabase/pulse/components/WhatsAPulse.jsx index c57b3844c9ab..6cdab6bac84d 100644 --- a/frontend/src/metabase/pulse/components/WhatsAPulse.jsx +++ b/frontend/src/metabase/pulse/components/WhatsAPulse.jsx @@ -27,7 +27,7 @@ export default class WhatsAPulse extends Component { className="h3 my3 text-centered text-light text-bold" style={{ maxWidth: "500px" }} > - {t`Pulses let you send data from Metabase to email or Slack on the schedule of your choice.`} + {t`Pulses let you send data from Report builder to email on the schedule of your choice.`} {this.props.button} diff --git a/frontend/src/metabase/query_builder/components/AlertModals.jsx b/frontend/src/metabase/query_builder/components/AlertModals.jsx index 19648d5b0e58..ea51e7c2f5a7 100644 --- a/frontend/src/metabase/query_builder/components/AlertModals.jsx +++ b/frontend/src/metabase/query_builder/components/AlertModals.jsx @@ -159,7 +159,7 @@ export class CreateAlertModalContent extends Component { user={user} onClose={onCancel} entityNamePlural={t`alerts`} - channels={isAdmin ? ["email", "Slack"] : ["email"]} + channels={isAdmin ? ["email"] : ["email"]} fullPageModal /> ); diff --git a/frontend/src/metabase/query_builder/components/template_tags/TagEditorHelp.jsx b/frontend/src/metabase/query_builder/components/template_tags/TagEditorHelp.jsx index a19cf356bdb3..74b924c4c2ec 100644 --- a/frontend/src/metabase/query_builder/components/template_tags/TagEditorHelp.jsx +++ b/frontend/src/metabase/query_builder/components/template_tags/TagEditorHelp.jsx @@ -145,14 +145,6 @@ const TagEditorHelp = ({ setDatasetQuery, sampleDatasetId }) => { datasetQuery={EXAMPLES.multipleOptional} setDatasetQuery={setQueryWithSampleDatasetId} /> - -

      - {t`Read the full documentation`} -

      ); }; diff --git a/src/metabase/models/pulse_channel.clj b/src/metabase/models/pulse_channel.clj index e6f2e110c3b1..dd74a78789a0 100644 --- a/src/metabase/models/pulse_channel.clj +++ b/src/metabase/models/pulse_channel.clj @@ -85,16 +85,7 @@ :name "Email" :allows_recipients true :recipients ["user", "email"] - :schedules [:daily :weekly :monthly]} - :slack {:type "slack" - :name "Slack" - :allows_recipients false - :schedules [:hourly :daily :weekly :monthly] - :fields [{:name "channel" - :type "select" - :displayName "Post to" - :options ["#general"] - :required true}]}}) + :schedules [:daily :weekly :monthly]}}) (defn channel-type? "Is CHANNEL-TYPE a valid value as a channel type? :tv:" From 78ea8128ec4677667744a161a4b8ed4610c50f56 Mon Sep 17 00:00:00 2001 From: thomas duval Date: Mon, 1 Apr 2019 11:00:00 +1000 Subject: [PATCH 5/8] simpro-pulse : remove quote and logo --- src/metabase/email/_footer.mustache | 8 -------- src/metabase/email/_footer_pulse.mustache | 9 +-------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/metabase/email/_footer.mustache b/src/metabase/email/_footer.mustache index fffd414890ec..f5471aad90d5 100644 --- a/src/metabase/email/_footer.mustache +++ b/src/metabase/email/_footer.mustache @@ -1,11 +1,3 @@ - {{#quotation}} -
      "{{quotation}}"
      - {{quotationAuthor}}
      - {{/quotation}} - {{#logoFooter}} -
      - -
      - {{/logoFooter}} diff --git a/src/metabase/email/_footer_pulse.mustache b/src/metabase/email/_footer_pulse.mustache index a0a2e699733f..b495a61b6748 100644 --- a/src/metabase/email/_footer_pulse.mustache +++ b/src/metabase/email/_footer_pulse.mustache @@ -1,11 +1,4 @@ - {{#quotation}} -
      "{{quotation}}"
      - {{quotationAuthor}}
      - {{/quotation}} - {{#logoFooter}} -
      - -
      - {{/logoFooter}} + From f5cdd4f20ad0b452651b9a927bcfad795a9238bd Mon Sep 17 00:00:00 2001 From: thomas duval Date: Fri, 5 Apr 2019 13:19:53 +1000 Subject: [PATCH 6/8] add walk me --- resources/frontend_client/index_template.html | 2 + src/metabase/middleware.clj | 48 +++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/resources/frontend_client/index_template.html b/resources/frontend_client/index_template.html index 9ebd190dbf69..1a776dfb14b7 100644 --- a/resources/frontend_client/index_template.html +++ b/resources/frontend_client/index_template.html @@ -27,6 +27,8 @@ }); + + - - - +