canon
-
@datawheel/[email protected]
Published by davelandry over 5 years ago
🔥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) §ion=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 (5ebb58e4)
- suppresses allowed dropdown from top-level profile/section cards (3ac11b61)
- handles SelectorUsage states (no selectors, no inactive selectors, no active selectors) (f7cac761)
- rolls back green-highlighting changes, need to revisit (64216de6)
- fixes filtering for #570 (459cfaaf)
- replaces generic buttons in Header (703fcea0)
- styles varSwap'd vars (7c9199c6)
- replaces sticky toggle checkbox with button group (#563) (a1860b7f)
- keeps DefinitionList labels from wrapping (44a4b25f)
- scales down URL font size for long URLs in Header (921100b7)
- fixes unintentionally invisible elements (8f0cbe1c)
- adds sticky prop to tree for potential styling (b69d79b1)
- adds ability for sections to be 'sticky' (d924341e)
- cleans up const declarations (7726793b)
- auto-opens gens/mats on creation (bf3dfef4)
- changes forceOpen logic to make room for auto-open improvements (756dadb2)
- handles cases of missing default content more smoothly (542895c7)
- refactors topics to be called sections (c3a4fc93)
- moves components broadly concerned with constructing the admin panel to an interface folder (fc718cf8)
- moves components related to the formatting and display of variables into a variables folder (a4ec6045)
- deletes empty SelectorPreview file (716a4fe7)
- renames CardWrapper to Card (65a77f9a)
- moves ReorderButton to cards folder (3d7343f4)
- tweaks locale margin (e637fbc7)
- renames classNames (and a few props) from topic to section (b20d202e)
- renames Panel (formerly Section) to Accardion (a22c0faa)
- begins reorganizing components (7264a6d8)
- adds canon_const_* vars to urlswap for generator apis (2c069505)
- adds framework for previews in permalinks (disabled currently) (527bdae5)
- fixes pathing bug (a291c2cf)
- fixes red screen on topic click and fixes reload on permalink (77beafff)
- renames topics to sections in filesystem (2b99ad57)
- fixes render bug with header labels (b06b28b4)
- adds rudimentary permalinks to cms (991079bc)
- adds abiltiy to specify a materializer in variables endpoint (49aa6800)
- hacks in side by side TextCard style (476fa4b9)
- adjusts TextCard dialog to account for one language or two (b443a95e)
- fixes none status (291e990f)
- fixes selecting none in lang selector bug (44fab72a)
- styles multilingual TextCard dialog (49724ee5)
- fixes this/that lang bug (be1d9353)
- unifies text cards for profile (c8c89cd3)
- unifies textcards by lang (23144dfe)
- removes button/ability to delete titles (they can't be deleted) (7702e4a3)
- reorganizes Header markup so that the button can appear outside of the link (8b83cb4c)
- refactors node labeling to allow for selectors in tree sidebar (49958835)
- decreases randomness of key ids in toolbox (ee8e15ea)
- adds more accordion behavior to ProfileBuilder tree (82ebbc89)
- stops unique key warning, are you happy now 💁♀️ (e30c9755)
- moves mgmt of selectors out to profilebuilder so changes reflect in selectorUsage (d65866bc)
- adds slug & slug edit button to Header (0b6a27e1)
- adjusts card padding (d1d8f158)
- removes now-unnecessary margin from toolbox (3f156de1)
- styles header (474b6833)
- fixes filename case inconsistencies (59e4c88d)
- handles Header profile links when no dimensions are selected (c4d77286)
- adds profile header with title & link (WIP) (cc205542)
- cleans up toolbox output view (WIP) (d400a598)
- removes fetchvariables callback from topiceditor (689ddb9a)
- fixes bug with changing tabs between selectorUsage (70f53b0d)
- fixes bug on front end so all topics subscribe to all selectors (2d0d8240)
- fixes bug with topics not subscribing properly to selectors (f9f4e282)
- adjusts dimension card layout (4a7e9ed0)
- forks Search & FilterSearch into new PreviewSearch, implements DimensionCard redesign (4e767fa7)
- fixes white screen bug with DefinitionList and converts it to...well, to an unordered list, because styling ¯_(ツ)_/¯ (0e407c06)
- makes generators not need to hit entire api set, returns single (fe83c949)
- fixes white screen bug closes #546 (fa6bc7ac)
- styles SelectorUsage (d46e7dac)
- rearranges mortar get/post logic (f7514368)
- adds catches for objects in selectors (d5c4b88d)
- fixes git screwup from merge (f5c440ec)
- updates front-end to handle new profile-wide selectors (aaf405af)
- renames SelectorPreview to SelectorUsage, begins styling (7018797f)
- removes unused packages (e85c2db4)
- fixes bug in selector preview that prevented page updates on select (858f43c0)
- removes old topicReq (8b970c29)
- styles selector editor (e80b9c49)
- fixes && rendering 1 when varList is empty in SelectorCard (c46b57d1)
- updates onSelector in topic.jsx to work with new style (3823f79b)
- removes topic endpoint and rolls into new master profile get/post endpoint (71eda033)
- changes profile endpoint to allow POST with variables (24542d91)
- adds VarList, styles SelectorCard (fdb24fad)
- swaps out selector selector selects for Selects (00cc4171)
- styles Select component, adjusts settings menu (49ffa73b)
- adds Select component (e0db2f20)
- adds DefinitionList component, begins styling SelectorCard (eb66ab1c)
- fixes minor VarTable visual bug (dcb1935d)
- accounts for multiline VarTable error text (b3d37e76)
- cleans up VarTable, fixing weird styling issues, adds boolean ConsoleVariable type (88ef1f07)
- hooks up external delete buttons (0725396a)
- shows proper label on selectorcard dropdown (81fa0715)
- hides section header add buttons when collapsed (ffd65943)
- converts card edit button to cover button; closes #567 (8fab866d)
- fixes bug where select changes would update multiple drop downs (0c31bbf4)
- removes console log (e8cb21c2)
- adds callbacks for selectorpreview cards (e80fdcc6)
- prevents nonfunctional add selector button (bae934dd)
- tweaks selector editor "active" language and controls (4fd73a4b)
- adds selector to list of toolbox entities (1c276d00)
- creates rudimentary selector preview (e1d1f1bc)
- fixes topic endpoint bug, h4 nesting, and propmap lookup in topiceditor (5120749e)
- adds settings button & dropdown (96a6676e)
- fixes react key error (068d89bd)
- simplifies visibility switches (2ae31385)
- fixes bug in ordering selectors (1406366c)
- adds id to topic_selector and creates new selectorcard mode (fca53ae6)
- adds selectors to toolbox (e5dd9dae)
- refactors selectors to belong to profiles (60879776)
- always shows the toolbar add button & hides the big add button in toolbox sections (9e47d729)
- styles add first entity button in toolbox (872b47db)
- formats panel metadata sections consistently (fef1108c)
- hacks in accordion behavior (6c6c8332)
- hacks in new card design (c27a396c)
- tweaks card style (d2ac6e18)
- adjusts button group style (861f68c1)
- simplifies card layout and reorder button; adds delete/edit button group to cards (09da622c)
- converts filter search to a component and styles it (1fccbba3)
- adds button group component (04eb61ad)
- hides entire gen/mat/form windows on zero search results (c80a178c)
- unifies filter function (b72bf955)
- removes formattereditor and places it directly in toolbox (5cf88ca5)
- removes tree node auto collapsing because the parent node closed when clicking a child node 😅 (94ab310f)
- makes SidebarTree nodes auto expand and retract (dff003d0)
- begins styling toolbox; adjusts logic in prepartion for collapsable sections (4337f98d)
- styles status indicator like a toast (8b63df13)
- adds a bit more fudged tree styling (6c9a0702)
- makes toolbox load in more gracefully (7431d85f)
- makes various minor theme tweaks (1c133e04)
- hunts down a few manual dark mode media queries and replaces them with the mixin (a026adf0)
- hacks the add profile/story button into place (ba83ceab)
- styles button disabled state (bdfc94b5)
- updates button style (df18a078)
- styles the tree (WIP) (5ba5e1c3)
- fixes bug in filter search and adds lowercase catch (3b842283)
- begins styling navbar (bd9d95a8)
- moves formatters to toolbox (95873005)
- moves search bar into generic filter bar (7ed9a23d)
- rebalances grayscale color palette (ef77d317)
- removes soon to be unused button styles (d0f201c9)
- adds quick and dirty responsive layout for toolbar (7fe79b72)
- adds toolbox dark theme background (52bc1890)
- set toolbox max-height & overflow; enables inertia scrolling for overflow containers (4c97ab9d)
- adds filter box to varlist (c59996c7)
- shows and hides generators in toolbox (07316cec)
- adds lookup table for vars (bfb74e50)
- refactors generator placement for toolbox (2f14ec08)
- adds toolbox sidebar (2ab6d1b7)