@mongodb-js/compass-crud
Compass Plugin for CRUD Operations
Last updated 4 days ago by addaleax .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @mongodb-js/compass-crud 
SYNC missed versions from official npm registry.

Compass CRUD Plugin

Provide functionality shown in the "Documents" tab in the Collection view in Compass. compass-crud

Usage

Definitions

Key Description
CRUD.Document Renders a single document.
CRUD.DocumentList Renders a list of documents.

Actions

Key Description
CRUD.Actions All the CRUD related actions.

Stores

Key Description
CRUD.InsertDocumentStore Triggers when a document is inserted.
CRUD.ResetDocumentListStore Triggers when the query filter is reset.
CRUD.LoadMoreDocumentsStore Triggers when more documents are fetched via scrolling.

Components from this plugin can be interracted with using hadron-app and hadron-app-registry. Here are a few examples of working with compass-crud's Action and Roles.

Render an editable document in a React component.

const app = require('hadron-app');
const React = require('react');

class MyComponent extends React.Component {
  constructor(props) {
    super(props);
    this.Document = app.appRegistry.getRole('CRUD.Document')[0].component;
  }
  render() {
    return (<this.Document doc={this.props.document} editable />);
  }
}

Render a non-editable pre-expanded document in a React component.

const app = require('hadron-app');
const React = require('react');

class MyComponent extends React.Component {
  constructor(props) {
    super(props);
    this.Document = app.appRegistry.getRole('CRUD.Document')[0].component;
  }
  render() {
    return (<this.Document doc={this.props.document} expandAll />);
  }
}

Listen to the various CRUD actions.

const app = require('hadron-app');
const CrudActions = app.appRegistry.getAction('CRUD.Actions');

CrudActions.documentRemoved.listen((id) => {
  console.log(`Document with _id ${id} removed.`);
});

CrudActions.openInsertDocumentDialog((doc, clone) => {
  if (clone) {
    console.log('Opening insert dialog with cloned document');
  }
});

CrudActions.insertDocument((doc) => {
  console.log('Inserting document into db');
});

App Registry Events Emmitted

Various actions within this plugin will emit events for other parts of the application can be listened to via hadron-app-registry. Local events are scoped to a Tab. Global events are scoped to the whole Compass application.

Global

  • 'compass:status:show-progress-bar': indicates to compass to show the progress bar. Called when refreshing documents and when paginating.
  • 'document-view-changed', view: indicates document view changed. view can be either JSON, List, or Table.
  • 'compass:status:done': indicates process is finished, this will remove the progress bar in compass. Called after refreshing document and pagination are complete.
  • 'documents-paginated': indicates when pagination is complete. Called when calling the next or previous pages in pagination.
  • 'documents-refreshed': indicates documents were refreshed.
  • 'document-inserted': indicates documents were inserted. Called when insertMany and insertOne complete.
  • 'document-updated': indicates a document was updated.
  • 'document-deleted': indicates a document was deleted.

Local

  • 'document-view-changed', view: indicates document view changed. view can be either JSON, List, or Table.
  • 'documents-paginated': indicates when pagination is complete. Called when calling the next or previous pages in pagination.
  • 'documents-refreshed': indicates documents were refreshed.
  • 'document-inserted': indicates documents were inserted. Called when insertMany and insertOne complete.
  • 'document-updated': indicates a document was updated.
  • 'document-deleted': indicates a document was deleted.

App Registry Events Received

Local

  • 'import-finished': received when import in the import-export plugin is finished. Refreshes documents.
  • 'query-changed': received when query was changed in the query bar. Handles updates to crud plugin's query state, and refreshes documents.
  • 'refresh-data': received when other plugins need documents refreshed. Refreshes documents.

Global

  • 'instance-refreshed': received when compass instance was refreshed
  • 'refresh-data': received when other plugins need documents refreshed. Refreshes documents. (reloaded). Refreshes instance state: dataLake variables.

Metrics Events

  • document-view-changed
  • documents-paginated
  • documents-refreshed
  • document-inserted
  • document-updated
  • document-deleted

Development

Code Tour

Compass Crud uses React, and Reflux for state management. There are two stores we manage: crud-store(./src/stores/crud-store.js) and grid-store(./src/stores/grid-store.js). Overall structure of this repo:

  • ./config: webpack configurations for dev, prod, and testing
  • ./electron: electron setup to run this plugin locally.
  • ./lib: webpack-compiled version of this plugin.
  • ./scripts: scripts to link and unlink React version to compass when developing this locally in Compass.
  • ./src/actions: reflux actions that are available throughout this plugin.
  • ./src/assets: css assets, such as variables and styles from compass.
  • ./src/components: react components that make up this plugin. Almost all components have a .jsx, .spec.js, .less and .js files.
  • ./src/stores: home to reflux stores.
  • ./src/utils: util .js files to be used throughout the plugin.

Running locally

./electron directory contains an Electron instance that allows for this plugin to be developed in isolation from other Compass plugins. By default it sets up a MongoDB connection to echo database and artists collection. To get it to work with a db and collection of your choice, change db variable here and collection variable here.

Install

npm install -S @mongodb-js/compass-crud

See Also

License

Apache 2.0

Current Tags

  • 10.0.3                                ...           latest (4 days ago)

157 Versions

  • 10.0.3                                ...           4 days ago
  • 10.0.2                                ...           5 days ago
  • 10.0.1                                ...           7 days ago
  • 10.0.0                                ...           22 days ago
  • 9.0.8                                ...           4 months ago
  • 9.0.7                                ...           6 months ago
  • 9.0.6                                ...           6 months ago
  • 9.0.5                                ...           7 months ago
  • 9.0.4                                ...           8 months ago
  • 9.0.3                                ...           8 months ago
  • 9.0.2                                ...           9 months ago
  • 9.0.1                                ...           9 months ago
  • 9.0.0                                ...           9 months ago
  • 8.3.0                                ...           9 months ago
  • 8.2.0                                ...           9 months ago
  • 8.1.5                                ...           10 months ago
  • 8.1.4                                ...           a year ago
  • 8.1.3                                ...           a year ago
  • 8.1.2                                ...           a year ago
  • 8.1.1                                ...           a year ago
  • 8.1.0                                ...           a year ago
  • 8.0.2                                ...           a year ago
  • 8.0.1                                ...           a year ago
  • 8.0.0                                ...           a year ago
  • 7.1.7                                ...           a year ago
  • 7.1.6                                ...           a year ago
  • 7.1.5                                ...           a year ago
  • 7.1.4                                ...           a year ago
  • 7.1.3                                ...           a year ago
  • 7.1.2                                ...           a year ago
  • 7.1.1                                ...           a year ago
  • 7.1.0                                ...           a year ago
  • 7.0.4                                ...           a year ago
  • 7.0.3                                ...           a year ago
  • 7.0.2                                ...           a year ago
  • 7.0.1                                ...           a year ago
  • 7.0.0                                ...           a year ago
  • 6.3.5                                ...           a year ago
  • 6.3.4                                ...           a year ago
  • 6.3.3                                ...           a year ago
  • 6.3.2                                ...           a year ago
  • 6.3.1                                ...           a year ago
  • 6.3.0                                ...           a year ago
  • 6.2.7                                ...           2 years ago
  • 6.2.6                                ...           2 years ago
  • 6.2.5                                ...           2 years ago
  • 6.2.4                                ...           2 years ago
  • 6.2.3                                ...           2 years ago
  • 6.2.2                                ...           2 years ago
  • 6.2.1                                ...           2 years ago
  • 6.2.0                                ...           2 years ago
  • 6.1.2                                ...           2 years ago
  • 6.1.1                                ...           2 years ago
  • 6.1.0                                ...           2 years ago
  • 6.0.2                                ...           2 years ago
  • 6.0.1                                ...           2 years ago
  • 6.0.0                                ...           2 years ago
  • 5.6.3                                ...           2 years ago
  • 5.6.2                                ...           2 years ago
  • 5.6.1                                ...           2 years ago
  • 5.6.0                                ...           2 years ago
  • 5.5.0                                ...           2 years ago
  • 5.4.0                                ...           2 years ago
  • 5.3.8                                ...           2 years ago
  • 5.3.7                                ...           2 years ago
  • 5.3.5                                ...           2 years ago
  • 5.3.4                                ...           2 years ago
  • 5.3.3                                ...           2 years ago
  • 5.3.2                                ...           2 years ago
  • 5.3.1                                ...           2 years ago
  • 5.3.0                                ...           2 years ago
  • 5.2.1                                ...           2 years ago
  • 5.2.0                                ...           2 years ago
  • 5.1.2                                ...           2 years ago
  • 5.1.1                                ...           2 years ago
  • 5.1.0                                ...           2 years ago
  • 5.0.0                                ...           2 years ago
  • 4.1.2                                ...           2 years ago
  • 4.1.1                                ...           3 years ago
  • 4.1.0                                ...           3 years ago
  • 4.0.0                                ...           3 years ago
  • 3.1.7                                ...           3 years ago
  • 3.1.6                                ...           3 years ago
  • 3.1.5                                ...           3 years ago
  • 3.1.3                                ...           3 years ago
  • 3.1.2                                ...           3 years ago
  • 3.1.1                                ...           3 years ago
  • 3.1.0                                ...           3 years ago
  • 3.0.5                                ...           3 years ago
  • 3.0.4                                ...           3 years ago
  • 3.0.3                                ...           3 years ago
  • 3.0.2                                ...           3 years ago
  • 1.2.4                                ...           3 years ago
  • 3.0.1                                ...           3 years ago
  • 3.0.0                                ...           3 years ago
  • 2.0.10                                ...           3 years ago
  • 2.0.9                                ...           3 years ago
  • 2.0.8                                ...           3 years ago
  • 2.0.7                                ...           3 years ago
  • 2.0.6                                ...           3 years ago
  • 2.0.5                                ...           3 years ago
  • 2.0.4                                ...           3 years ago
  • 2.0.3                                ...           3 years ago
  • 2.0.2                                ...           3 years ago
  • 2.0.1                                ...           3 years ago
  • 2.0.0                                ...           3 years ago
  • 1.6.1                                ...           3 years ago
  • 1.6.0                                ...           3 years ago
  • 1.5.0                                ...           3 years ago
  • 1.4.0                                ...           3 years ago
  • 1.3.0                                ...           3 years ago
  • 1.2.3                                ...           3 years ago
  • 1.2.2                                ...           3 years ago
  • 1.2.1                                ...           3 years ago
  • 1.2.0                                ...           3 years ago
  • 1.1.5                                ...           3 years ago
  • 1.1.4                                ...           3 years ago
  • 1.1.3                                ...           3 years ago
  • 1.1.2                                ...           3 years ago
  • 1.1.1                                ...           3 years ago
  • 1.1.0                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
  • 0.10.0                                ...           3 years ago
  • 0.7.5                                ...           3 years ago
  • 0.9.1                                ...           3 years ago
  • 0.9.0                                ...           3 years ago
  • 0.8.0                                ...           3 years ago
  • 0.7.4                                ...           3 years ago
  • 0.7.3                                ...           3 years ago
  • 0.7.2                                ...           3 years ago
  • 0.7.1                                ...           3 years ago
  • 0.7.0                                ...           3 years ago
  • 0.6.0                                ...           3 years ago
  • 0.5.1                                ...           3 years ago
  • 0.5.0                                ...           3 years ago
  • 0.5.0-5                                ...           3 years ago
  • 0.5.0-4                                ...           3 years ago
  • 0.5.0-3                                ...           3 years ago
  • 0.5.0-2                                ...           3 years ago
  • 0.5.0-1                                ...           3 years ago
  • 0.4.2                                ...           3 years ago
  • 0.5.0-0                                ...           3 years ago
  • 0.4.1                                ...           3 years ago
  • 0.4.0                                ...           3 years ago
  • 0.3.0                                ...           3 years ago
  • 0.3.0-0                                ...           3 years ago
  • 0.2.2                                ...           3 years ago
  • 0.2.1                                ...           3 years ago
  • 0.2.0                                ...           3 years ago
  • 0.1.1                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
  • 0.0.6                                ...           3 years ago
  • 0.0.5                                ...           3 years ago
  • 0.0.4                                ...           3 years ago
  • 0.0.3                                ...           3 years ago
  • 0.0.2                                ...           3 years ago
  • 0.0.1                                ...           3 years ago
Downloads
Today 0
This Week 2
This Month 30
Last Day 2
Last Week 26
Last Month 28
Dependencies (16)
Dev Dependencies (103)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |