Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/metabase/metabase. Pull mirroring updated .
  1. Aug 03, 2021
    • Dalton's avatar
      Add the ability to verify/unverify questions (#17030) · b7fa2f34
      Dalton authored
      * rmv old bucm icons and remove verified fill color
      
      * add moderation action section to sidebar
      
      * add moderation review icon to the saved question header button
      
      * hide moderation section when is not a moderator
      
      * add UI for ModerationReviewBanner
      
      * Backend for moderation-review
      
      - create table moderation_review. Same as before but also has a
        "most_recent" boolean flag for the most recent moderation for easy
        lookup
      - POST /moderation-review/ . Status can be "verified" or nil
      - must be an admin to post
      - No PUT or edit route yet. Not sure if this is even
        necessary. _MAYBE_ to edit the text, but certainly not for the
        status, ids, etc. If there's to be history, let's build some history
      - Ensure we never have more than 10 reviews. Adding a new review will
        delete the older ones, mark all old ones as not `most_recent`, and
        add the newest one as `most_recent true`
      - Ensure the card actually exists before creating the mod review
      - Since admin only at this time, don't need to check moderate
        permission or view permission
      - When hydrating ensure reviews are ordered by id desc. Should mimic
        the created_at desc
      
      * fix moderation review banner tooltip offset
      
      * disable verification button when already verified
      
      * rmv iconOnly prop because it seems to do nothing
      
      * update getLatestModerationReview to rely on most_recent boolean
      
      * Return 400 on invalid status to post /moderation-review
      
      the schema was using keywords on the left hand side rather than the
      symbols. Required a change to the docstring generator, when it made a
      docstring for enums, it would call (sort (:vs enum)) and need to
      string em.
      
      * Add ModerationReview model to models.clj and copy infra
      
      * hydrate moderation reviews on cards
      
      * clean up + wire up to BE + ensure mod buttons don't show for normal users
      
      * rmv unused moderation redux logic from QuestionDetailsSidebarPanel
      
      * finish writing unit tests for FE
      
      * ensure getIconForReview returns an object
      
      * enable/disable verify button tooltip when unverified/verified
      
      * add e2e tests
      
      * fix tests
      
      * styling tweaks
      
      * more styling on moderationReviewBanner
      
      * add function for abbreviated timestamp
      
      * increase fontsize of timestamp back to 12
      
      * fix tooltip offset
      
      * ensure custom locale is separate from 'en' and not used for other languages
      
      * Deletion moderation reviews when deleting cards
      
      i had actually thought this was a much larger problem. But it turns
      out we almost never delete cards (thanks comment!). And so we won't
      really generate a lot of garbage.
      
      I was worried that since we aren't using actual foreign keys but just
      `moderated_item_type "card"` and `moderated_item_id 2` we would have
      deleted cards with these moderation reviews but that is not the case
      as the cards aren't deleted.
      
      * hide verify disabled button when a question is verified
      
      * update test to use queryByTestId
      
      * Hydrate moderation reviews on cards on ordered cards
      
      * Handle mysql's lack of offset functionality
      
      mysql cannot handle just a `offset` clause, it also needs a limit
      
      clause grammar from
      https://dev.mysql.com/doc/refman/8.0/en/select.html:
      
      [LIMIT {[offset,] row_count | row_count OFFSET offset}]
      
      select id, name from metabase_field offset 5;         -- errors
      select id, name from metabase_field limit 2 offset 5; -- works
      
      Since our numbers are so small here there is no worry and just do the
      offset in memory rather than jump through hoops for different dbs.
      
      * Batch hydrate moderation reviews
      
      * Don't let /api/user/:userId failure conceal moderation banner
      
      * fix moderation cy tests
      
      * work around possible bug in toucan hydration
      
      dashboards hydrate ordered cards
      (hydrate [:ordered_cards [:card :moderation_reviews] :series])
      
      Ordered_cards are dashboard_cards which have an optional card_id. But
      toucan hydration doesn't filter out the nils as they go down. It seems
      toucan returns a nil card, and then when hydrating the
      moderation_review, passes the collection of all "cards" including the
      nil ones into the hydration function for moderation_reviews
      
      This feels like a bug to me
      
      * Cleanup moderation warnings
      
      * Docstring in moderation review
      
      * include hoisted moderated_status on cards in collections api
      
      * Expect unverified in test :wrench:
      
      
      
      Co-authored-by: default avatardan sutton <dan@dpsutton.com>
      Co-authored-by: default avatarMaz Ameli <maz@metabase.com>
      Co-authored-by: default avataralxnddr <alxnddr@gmail.com>
      Unverified
      b7fa2f34
    • Dalton's avatar
      Handle mutation of vizSetting column when syncing columns in a native question (#17279) · dee19dfb
      Dalton authored
      * Handle mutation of vizSetting column when syncing columns of a native question
      
      When calling Question's _syncNativeQuerySettings method we need to treat
      existing, mutated columns as invalid so that they are filtered out and a
      new column takes the existing column's place.
      
      The function we use to find valid columns, findColumnIndexForColumnSetting,
      will return true if it finds a matching field_ref OR a matching name, so we
      also need to check the addedColumns array we just created in order to remove
      any columns from vizSettings that also exist there, since we combine the two
      at the end of this method.
      
      * add unit tests for _syncNativeQuerySettings
      Unverified
      dee19dfb
  2. Aug 02, 2021
  3. Jul 30, 2021
    • Noah Moss's avatar
    • Dalton's avatar
      Upgrade babel to 7.x.x and jest to 27.x.x (#17137) · 3a7c3987
      Dalton authored
      * Update babel dependencies to latest
      
      * Remove some old babel dependencies
      
      The dependencies in this commit include dependencies that have been
      renamed, such as babel-cli which is now @babel/cli. It also includes
      dependencies that have been replaced, such as babel-preset-stage-0 and
      its ilk, which have been replaced with @babel/preset-env.
      
      * Remove babel-register dependency
      
      This is referenced in our webpack.config.js file. I don't think we need
      Babel in our Node envionment, but I could be wrong, so leaving this as a
      separate commit.
      
      * Remove @babel/standalone and dependent code
      
      We're using @babel/standalone to support the writing of JSX in our
      internal-only ScratchApp editor. Unfortunately, this dependency is
      large--1.5mb not gzipped--and our current build does not intelligently
      split bundles, meaning our users our burdened by the size of this
      dependency whenever they must redownload the Metabase JS bundle.
      
      I'm removing it. We should still be able to write JS in the ScratchApp,
      but JSX no longer.
      
      * Add @babel/node to dev deps
      
      Needed by a cypress command
      
      * Add browserslist config
      
      Babel's preset-env dep needs this config to determine how to transform
      our JavaScript. By default I believe it ends up defaulting to
      "defaults."
      
      "defaults" is equivalent to the following rules:
      > 0.5%, last 2 versions, Firefox ESR, not dead
      
      A comma between rules represents a UNION operator.
      
      Per
      https://www.metabase.com/docs/latest/faq/general/supported-browsers.html
      
      
      we have deprecated IE 11 so I am including that explicitly in our
      browserslist.
      
      * Update babelrc plugins and presets
      
      - Replaced presets with preset-env and preset-react
      - Updated the names of some plugins, like transform-decorators-legacy,
        which is now @babel/plugin-proposal-decorators with an explicit
        "legacy: true" passed in the config.
      - Removed add-react-displayname because it is included in preset-react
      - Removed transform-builtin-extend because it is included in preset-env*
      - Removed syntax-trailing-function-commas because it is supported by
        all browsers we support
      
      * note: There is a "loose" config option for handling the extension of builtin
      classes. We may need it, but I am not sure.
      
      * Update babel cli args
      
      Replace -q with --quiet because -q no longer exists
      
      * Fix circular dep in auth.js by making it async
      
      Our app unfortunately contains MANY circular dependencies. Some, like
      this one, caused problems when the app instantiates because the
      "refreshCurrentUser" method is undefined when auth.js is initially run.
      
      While we should in the future avoid having circular deps in the first
      place, making them run async by requiring the dep and function run-time
      fixes this particular issue.
      
      * Fix circular dependency in metabase/redux/requests.js
      
      The handleActions and createAction methods imported from
      "metabase/lib/redux" are actually just methods from the "redux-actions"
      dependency... so importing those methods directly from that dep fixes
      this circular dependency problem.
      
      * Remove references to global.services and exports in metabase/services
      
      This line breaks the build. Git blame says the line is 5 years old, and
      I wouldn't expect such code to be used with how our app now requires
      deps.
      
      * Fix MBQLArrayClause problem caused by Array extension
      
      * Explicitly pass args from flatMap to function via anonymous cb
      
      I think the old Array.prototype.flatMap prototype must've had different
      args. They are now "currentValue, index, array" so when we passed it
      "enumeratePaths" as a callback, the second arg of enumeratePaths gets
      set to a number. This breaks the logic of enumeratePaths because it is a
      recursive function that depends on that second arg getting initialized
      as an empty array by default.
      
      * Remove code that spreads non-iterable value in array
      
      New Babel is stricter about handling this sort of code that doesn't
      match the JS spec. You can't spread an undefined value inside of an
      iterator.
      
      * Update jest and babel-jest to latest
      
      Updating Babel breaks our unit tests. Updating nothing causes every test
      to fail due to a Babel version mismatch. Updating only babel-jest causes
      the following error:
      
      TypeError: Jest: a transform must export a `process` function
      
      There may be a way around updating Jest, but updating it does not appear
      to be too difficult.
      
      * Set the testEnvironment to jsdom
      
      This was the default testEnvironment in our old version of jest. At some
      point the default was changed to node.
      
      * Remove unfinished "pending" unit tests
      
      I'm unfamiliar with this pending function, but the function no longer
      exists, causing the tests to fail.
      
      * don't pass async callback to describe
      
      * Update name of runTimersToTime to advanceTimersByTime
      
      * Fix incorrectly nested unit test
      
      * mock SVGElement.prototype.getBBox method
      
      * Don't return values in describe callback
      
      * Move variable declaration to above usage
      
      * Fix prettier error
      
      * Upgrade `documentation` library to the latest version (13.x.x)
      
      This library was the only one left that was still using Babel 6.
      
      * Return an MBQLClause instance after using Array methods
      
      * remove 'not IE 11' from browserslist
      
      * Remove mock that breaks unit test
      
      Co-authored-by: default avatarNemanja <31325167+nemanjaglumac@users.noreply.github.com>
      Unverified
      3a7c3987
  4. Jul 29, 2021
  5. Jul 28, 2021
    • Anton Kulyk's avatar
    • Anton Kulyk's avatar
      47dadae0
    • Anton Kulyk's avatar
      Fix horizontal FormField label · 3051de19
      Anton Kulyk authored
      3051de19
    • Anton Kulyk's avatar
      Allow only admins to edit collection types, hide form field for personal collections (#17170) · a728bafe
      Anton Kulyk authored
      * Rename collection's plugin `formFields`
      
      * Add tests for collection type field visibility
      
      * Limit collection types visibility
      
      * Fix cypress tests
      a728bafe
    • Anton Kulyk's avatar
      Display official question's badge when it's in regular dashboard (#17167) · 0f4597d7
      Anton Kulyk authored
      * Add icon prop to LegendItem
      
      * Add icon prop to LegendHeader components
      
      * Add headerIcon prop to Visualization
      
      * Add headerIcon prop to DashCard
      
      * Display official badge on questions in regular dashboards
      
      * Add headerIcon prop to Funnel
      
      * Add headerIcon prop to LineAreaBarChart
      
      * Extract hasLegendHeader variable
      
      * Pass headerIcon to visualisations with custom header
      
      * Add E2E tests
      
      * Add Icon prop-types
      
      * Use imported Icon prop-types
      
      * Fix post-rebase issue
      0f4597d7
    • Anton Kulyk's avatar
      Display official badge throughout the application (#17125) · 32a88aa4
      Anton Kulyk authored
      * Add getCollectionIcon function
      
      * Add isRegularCollection function
      
      * Display official badge in collections sidebar
      
      * Don't dim official badge icon in collections sidebar
      
      * Show root collection icon
      
      * Use `CollectionsList.Icon` for "All personal collections"
      
      * Fix CollectionBadge icon color
      
      * Display official collection badge in search results
      
      * Test official badge displayed correctly in sidebar
      
      * Test official badge is shown throughout the app
      
      * Show official badge icon in SavedQuestionPicker
      
      * Use existing isPersonalCollection utility
      
      * Show official badge icon in QuestionPicker
      
      * Show official badge icon in CollectionPicker
      
      * Minor CollectionIcon refactoring
      
      * Use function declaration for isRegularCollection
      
      * Add editCollection test helper
      
      * Add changeCollectionTypeTo helper
      
      * Remove duplicated assertions
      
      * Add helper to create official collection
      
      * Add testOfficialBadgeInSearch helper
      32a88aa4
    • Anton Kulyk's avatar
      Bootstrap collections plugin, add collection types form (#17071) · 0a687782
      Anton Kulyk authored
      * Add badge icon
      
      * Add empty PLUGIN_FORM_WIDGETS
      
      * Add empty PLUGIN_COLLECTIONS
      
      * Extract `getWidgetComponent` from FormWidget
      
      * Allow adding EE-only form widgets
      
      * Add `authority_level` field to collections
      
      * Fix SegmentedControl's `value` prop-type
      
      * Specify icon sizes for SegmentedControl's options
      
      * Add FormCollectionAuthorityLevel form widget
      
      * Add `PLUGIN_COLLECTION_COMPONENTS`
      
      * Add CollectionAuthorityLevelIcon
      
      * Move ToggleMobileSidebarIcon out of PageHeading
      
      * Display official badge on collection page
      
      * Add authority level to collections plugin
      
      * Rename `AUTHORITY_LEVELS` to `EE_AUTHORITY_LEVELS`
      
      * Patch collections plugin with EE authority levels
      
      * Fix authority level value for new collection form
      
      * Add `cy.createCollection` command
      
      * Add `describeWithoutToken` Cypress helper
      
      * Test user can manage collection authority level
      
      * Test collection types available only in EE
      
      * Run prettier
      
      * Keep regular collection opts in AUTHORITY_LEVEL
      
      * Fix test comment
      
      * Translate collection type names
      
      * Avoid aliasing regular authority level
      0a687782
  6. Jul 27, 2021
  7. Jul 26, 2021
  8. Jul 23, 2021
    • Dalton's avatar
      add question details sidebar (#16803) · bc90e069
      Dalton authored
      
      * add question details sidebar (code from bucm)
      
      update some cy tests
      
      rmv moderation-related code
      
      rmv padding on description
      
      merge history button logic into label
      
      lint fix
      
      update some clicks in cy tests
      
      update styles to use styled-components
      
      fix more cy tests
      
      rmv unused component
      
      rmv unused reference
      
      rmv unused prop
      
      remove styling code that is no longer necessary
      
      rmv extraneous space
      
      fix translation
      
      rmv added util class
      
      move styled component to own file
      
      * add revision util tests
      
      * rmv some unneeded question panel styling
      
      * move files into query_builder directory
      
      * rearrange stuff in file
      
      * ClampedDescription unit test
      
      * add QuestionActionButtons unit tests
      
      * add SavedQuestionHeaderButton test
      
      * add QuestionActivityTimeline tests
      
      * tweak/improve props/propTypes
      
      * fix cy test referencing question description
      
      * fix revision history cy test
      
      * Question sidebar visual polish (#16942)
      
      * style tweaks
      
      * restyle Revert button
      
      * add a little breadcrumb spacing
      
      * make LastEditInfoLabel use Badge instead of TextButton
      
      * bring back TextButton
      
      * Revision History => History
      
      * fix activity timeline unit test
      
      * rmv unused styled components
      
      Co-authored-by: default avatarDalton Johnson <daltojohnso@users.noreply.github.com>
      
      * hide 'add a description' button when read only
      
      * update permissions cy tests
      
      * update ClampedDescription unit test
      
      * use size enum instead of boolean
      
      * move export to bottom of file
      
      * move modal magic strings to a constants file
      
      * clobber all qb state when reloading
      
      * Fix reversion cy tests
      
      Co-authored-by: default avatarMaz Ameli <maz@metabase.com>
      Unverified
      bc90e069
    • Jeff Evans's avatar
      Add support for driver deprecation (#17028) · 3ddcb263
      Jeff Evans authored
      
      # Backend changes
      
      Introducing new `superseded-by` property to plugin manifest YAML, which will indicate the driver that is to eventually replace this one (and will drive UI/UX behavior).  If a driver declares this property, then it's considered to be deprecated in favor of the specified one.
      
      Adding top level `test_modules` directory (with the same structure as modules) for the sole purpose of module/plugin testing of YAML files, which will not be included with the driver build
      
      Updating `driver-plugin-manifest` to look for the new `test_modules` directory in addition to `modules`, when loading the driver manifest
      
      # Frontend changes
      
      Calculate `supersededBy` and supersedes maps from the "superseded-by" property for each engine
      
      Change the options for the engine field to use a function to dynamically show the legacy driver if allowed by rules (either the new driver is selected, or the legacy driver was already selected for an existing DB, or the driver is not superseded by anything)
      
      Add new `DriverWarning` component to show these warnings based on supersede status
      
      Co-authored-by: default avatarAnton Kulyk <kuliks.anton@gmail.com>
      Unverified
      3ddcb263
    • Gustavo Saiani's avatar
    • Gustavo Saiani's avatar
  9. Jul 22, 2021
  10. Jul 21, 2021
  11. Jul 20, 2021
  12. Jul 19, 2021
Loading