Skip to content

@datawheel/canon-cms@0.7.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@davelandry davelandry released this 02 Jul 20:32
· 2848 commits to master since this release

🔥Breaking Database Changes! 🔥

Several DB changes have been made that are incompatible with past versions of the CMS.

  • Topics have been renamed to Sections
  • Sections now have a column named sticky for scroll-resistant sections
  • Selectors now belong to Profiles, and Sections subscribe to Selectors

Upgrading to this version will require a (forthcoming) import script for old CMS DBs.

Issues Closed

  • Moves generators, materializers, selectors, and formatters to a new sidebar called the Toolbox, avoiding the need to change view to the top-level profile to make changes to these elements (closes #529)
  • Selectors no longer belong to individual sections - they are top-level entities that belong to profiles. Individual sections now "subscribe" to these global selectors (closes #562)
  • Renames "topics" to "selectors" at all application levels (closes #561)
  • Adds a "sticky" toggle for sections, allowing for them to stick to the page while scrolling, until the next "sticky" section scrolls by (closes #563)
  • The topic (now section) endpoint has been removed entirely, replaced with a unified /api/profile endpoint (closes #516).

New API Format

There is now a single unified /api/profile endpoint, which receives all options via query parameters.

The usual way of retrieving a profile via GET, with a list of slug/id pairs, remains the same: /api/profile?slug1=geo&id1=Massachusetts&slug2=cip&id2=Metalworkers.

However, a POST endpoint has been added at the same endpoint, /api/profile, with the following properties:

  • The user must provide their own variables object in the post - the one that they received on page load.
  • The user must provide a profile id as a query param &profile=123 to return the entire profile, or a section id (for just a single section for embeds) &section=123 to return a single section instead of the entire profile.

So if the user changed a dropdown on the page, the new profile request might look like this (pseudocode):

const {variables} = this.state  // saved from initial load
const {id} = this.state.profile   // saved from initial load
const {someSelectorState} = this.state;   // received from onSelector change
const selectorString = makeQueryParamsFrom(someSelectorState);
const url = `/api/profile?profile=<id>&${selectorString}`;
const payload = {variables};
axios.post(url, variables).then(resp => this.setState({profile: resp.data});

Other improvements

  • Adds ability to search the Toolbox by variable name, and directly open the generator or materializer that created it
  • Updating generators in the CMS only fetches the data for that single generator, improving performance by skipping a full reload
  • Unifies TextCards to contain both languages side by side for easier translation
  • Changing the state of selectors actually properly renders and previews the content
  • Select Canon vars, and all CANON_CONST_* are available to use in generator APIs (e.g., CANON_CONST_MYVAR can be used in a generator API with /api/?var=<MYVAR> (for you @cnavarreteliz)
  • Automatically opens generators and materializers on creation
  • Innumerable wonderful UX improvements by the incomparable @perpetualgrimace

Full Changelog

  • removes console.log (5ebb58e)
  • suppresses allowed dropdown from top-level profile/section cards (3ac11b6)
  • handles SelectorUsage states (no selectors, no inactive selectors, no active selectors) (f7cac76)
  • rolls back green-highlighting changes, need to revisit (64216de)
  • fixes filtering for #570 (459cfaa)
  • replaces generic buttons in Header (703fcea)
  • styles varSwap'd vars (7c9199c)
  • replaces sticky toggle checkbox with button group (#563) (a1860b7)
  • keeps DefinitionList labels from wrapping (44a4b25)
  • scales down URL font size for long URLs in Header (921100b)
  • fixes unintentionally invisible elements (8f0cbe1)
  • adds sticky prop to tree for potential styling (b69d79b)
  • adds ability for sections to be 'sticky' (d924341)
  • cleans up const declarations (7726793)
  • auto-opens gens/mats on creation (bf3dfef)
  • changes forceOpen logic to make room for auto-open improvements (756dadb)
  • handles cases of missing default content more smoothly (542895c)
  • refactors topics to be called sections (c3a4fc9)
  • moves components broadly concerned with constructing the admin panel to an interface folder (fc718cf)
  • moves components related to the formatting and display of variables into a variables folder (a4ec604)
  • deletes empty SelectorPreview file (716a4fe)
  • renames CardWrapper to Card (65a77f9)
  • moves ReorderButton to cards folder (3d7343f)
  • tweaks locale margin (e637fbc)
  • renames classNames (and a few props) from topic to section (b20d202)
  • renames Panel (formerly Section) to Accardion (a22c0fa)
  • begins reorganizing components (7264a6d)
  • adds canon_const_* vars to urlswap for generator apis (2c06950)
  • adds framework for previews in permalinks (disabled currently) (527bdae)
  • fixes pathing bug (a291c2c)
  • fixes red screen on topic click and fixes reload on permalink (77beaff)
  • renames topics to sections in filesystem (2b99ad5)
  • fixes render bug with header labels (b06b28b)
  • adds rudimentary permalinks to cms (991079b)
  • adds abiltiy to specify a materializer in variables endpoint (49aa680)
  • hacks in side by side TextCard style (476fa4b)
  • adjusts TextCard dialog to account for one language or two (b443a95)
  • fixes none status (291e990)
  • fixes selecting none in lang selector bug (44fab72)
  • styles multilingual TextCard dialog (49724ee)
  • fixes this/that lang bug (be1d935)
  • unifies text cards for profile (c8c89cd)
  • unifies textcards by lang (23144df)
  • removes button/ability to delete titles (they can't be deleted) (7702e4a)
  • reorganizes Header markup so that the button can appear outside of the link (8b83cb4)
  • refactors node labeling to allow for selectors in tree sidebar (4995883)
  • decreases randomness of key ids in toolbox (ee8e15e)
  • adds more accordion behavior to ProfileBuilder tree (82ebbc8)
  • stops unique key warning, are you happy now 💁‍♀️ (e30c975)
  • moves mgmt of selectors out to profilebuilder so changes reflect in selectorUsage (d65866b)
  • adds slug & slug edit button to Header (0b6a27e)
  • adjusts card padding (d1d8f15)
  • removes now-unnecessary margin from toolbox (3f156de)
  • styles header (474b683)
  • fixes filename case inconsistencies (59e4c88)
  • handles Header profile links when no dimensions are selected (c4d7728)
  • adds profile header with title & link (WIP) (cc20554)
  • cleans up toolbox output view (WIP) (d400a59)
  • removes fetchvariables callback from topiceditor (689ddb9)
  • fixes bug with changing tabs between selectorUsage (70f53b0)
  • fixes bug on front end so all topics subscribe to all selectors (2d0d824)
  • fixes bug with topics not subscribing properly to selectors (f9f4e28)
  • adjusts dimension card layout (4a7e9ed)
  • forks Search & FilterSearch into new PreviewSearch, implements DimensionCard redesign (4e767fa)
  • fixes white screen bug with DefinitionList and converts it to...well, to an unordered list, because styling ¯_(ツ)_/¯ (0e407c0)
  • makes generators not need to hit entire api set, returns single (fe83c94)
  • fixes white screen bug closes #546 (fa6bc7a)
  • styles SelectorUsage (d46e7da)
  • rearranges mortar get/post logic (f751436)
  • adds catches for objects in selectors (d5c4b88)
  • fixes git screwup from merge (f5c440e)
  • updates front-end to handle new profile-wide selectors (aaf405a)
  • renames SelectorPreview to SelectorUsage, begins styling (7018797)
  • removes unused packages (e85c2db)
  • fixes bug in selector preview that prevented page updates on select (858f43c)
  • removes old topicReq (8b970c2)
  • styles selector editor (e80b9c4)
  • fixes && rendering 1 when varList is empty in SelectorCard (c46b57d)
  • updates onSelector in topic.jsx to work with new style (3823f79)
  • removes topic endpoint and rolls into new master profile get/post endpoint (71eda03)
  • changes profile endpoint to allow POST with variables (24542d9)
  • adds VarList, styles SelectorCard (fdb24fa)
  • swaps out selector selector selects for Selects (00cc417)
  • styles Select component, adjusts settings menu (49ffa73)
  • adds Select component (e0db2f2)
  • adds DefinitionList component, begins styling SelectorCard (eb66ab1)
  • fixes minor VarTable visual bug (dcb1935)
  • accounts for multiline VarTable error text (b3d37e7)
  • cleans up VarTable, fixing weird styling issues, adds boolean ConsoleVariable type (88ef1f0)
  • hooks up external delete buttons (0725396)
  • shows proper label on selectorcard dropdown (81fa071)
  • hides section header add buttons when collapsed (ffd6594)
  • converts card edit button to cover button; closes #567 (8fab866)
  • fixes bug where select changes would update multiple drop downs (0c31bbf)
  • removes console log (e8cb21c)
  • adds callbacks for selectorpreview cards (e80fdcc)
  • prevents nonfunctional add selector button (bae934d)
  • tweaks selector editor "active" language and controls (4fd73a4)
  • adds selector to list of toolbox entities (1c276d0)
  • creates rudimentary selector preview (e1d1f1b)
  • fixes topic endpoint bug, h4 nesting, and propmap lookup in topiceditor (5120749)
  • adds settings button & dropdown (96a6676)
  • fixes react key error (068d89b)
  • simplifies visibility switches (2ae3138)
  • fixes bug in ordering selectors (1406366)
  • adds id to topic_selector and creates new selectorcard mode (fca53ae)
  • adds selectors to toolbox (e5dd9da)
  • refactors selectors to belong to profiles (6087977)
  • always shows the toolbar add button & hides the big add button in toolbox sections (9e47d72)
  • styles add first entity button in toolbox (872b47d)
  • formats panel metadata sections consistently (fef1108)
  • hacks in accordion behavior (6c6c833)
  • hacks in new card design (c27a396)
  • tweaks card style (d2ac6e1)
  • adjusts button group style (861f68c)
  • simplifies card layout and reorder button; adds delete/edit button group to cards (09da622)
  • converts filter search to a component and styles it (1fccbba)
  • adds button group component (04eb61a)
  • hides entire gen/mat/form windows on zero search results (c80a178)
  • unifies filter function (b72bf95)
  • removes formattereditor and places it directly in toolbox (5cf88ca)
  • removes tree node auto collapsing because the parent node closed when clicking a child node 😅 (94ab310)
  • makes SidebarTree nodes auto expand and retract (dff003d)
  • begins styling toolbox; adjusts logic in prepartion for collapsable sections (4337f98)
  • styles status indicator like a toast (8b63df1)
  • adds a bit more fudged tree styling (6c9a070)
  • makes toolbox load in more gracefully (7431d85)
  • makes various minor theme tweaks (1c133e0)
  • hunts down a few manual dark mode media queries and replaces them with the mixin (a026adf)
  • hacks the add profile/story button into place (ba83cea)
  • styles button disabled state (bdfc94b)
  • updates button style (df18a07)
  • styles the tree (WIP) (5ba5e1c)
  • fixes bug in filter search and adds lowercase catch (3b84228)
  • begins styling navbar (bd9d95a)
  • moves formatters to toolbox (9587300)
  • moves search bar into generic filter bar (7ed9a23)
  • rebalances grayscale color palette (ef77d31)
  • removes soon to be unused button styles (d0f201c)
  • adds quick and dirty responsive layout for toolbar (7fe79b7)
  • adds toolbox dark theme background (52bc189)
  • set toolbox max-height & overflow; enables inertia scrolling for overflow containers (4c97ab9)
  • adds filter box to varlist (c59996c)
  • shows and hides generators in toolbox (07316ce)
  • adds lookup table for vars (bfb74e5)
  • refactors generator placement for toolbox (2f14ec0)
  • adds toolbox sidebar (2ab6d1b)