netcreateorg / netcreate-2018

Please report bugs, problems, ideas in the project Issues page: https://github.com/netcreateorg/netcreate-2018/issues
Other
11 stars 2 forks source link

Feature: Filtering #113

Closed benloh closed 4 years ago

benloh commented 4 years ago

Feature: Filtering

This is a first pass prototype of filtering.

To Test

  1. Install

    git branch dev-bl/config-ip-filter
    npm ci
  2. Update your template

Either add type definitions to your existing template, or if you are using the _default.template in your project, replace your current template with a copy of build/app/assets/templates/_default.template. See the _default.template file for an example.

  1. Start NetCreate

    ./nc.js --dataset=tacitus
  2. Select the "Filters" tab

  3. Enter a search value. The graph will immediately update.

  4. Click on the "Graph" tab to close the Tab Panel. A summary of the currently selected filter should be displayed at the bottom of the Tab Panel.

  5. Click "Clear Filters" to clear the form and restore all nodes and edges.


Details

Filters

Filtering provides the ability to show and hide nodes and edges based on filter criteria.

Filters are set via the "Filters" tab panel.

The graph will immediately update with any changes made by the user to a filter.

Specifying Filters via the Template Spec

The groups of available filters are drawn directly from the current database's template file, e.g. tacitus.template. It will reflect any customizations made to the labels and hidden/shown status.

Filter Types

In order for a filter to be defined for any given object key, it must have a "type" specified, e.g.

_default.template

    "notes": {
                "type":     "string",
                "label":    "Significance",
                ...
             },

The available types are:

Each type has specific operations associated with it, e.g. "string" supports "contains" and "not contains", whereas "number" supports ">" and "!=" etc.

How Filtering Works

How are filters applied?

Filters are applied via an implicit AND: An item matches the filter if EVERY filter that is active matches. For example, if we have:

Node: Label contains ab Node: Type contains Person

...then person Abraham Lincoln will be displayed, but event Abolition will not.

A few notes:

How are Nodes/Edges hidden?

Programmatically, any node or edge that is filtered is marked with a isFilteredOut flag. If isFilteredOut is true, the object is hidden. If isFilteredOut is absent or is false, the object is displayed.

Hiding is simply done by setting the opacity of the node or edge. Nodes and edges are not actually removed from the graph.

Storyboard

With the Filtering system, we introduce a new development toolkit storybook.js. This is primarily used for the basic component development and data architecture design.

To run storybook, use npm run storybook.


Known Issues / Future Work

The issues below will probably not be addressed with this release and may have to be saved for future funding.

benloh commented 4 years ago

@jdanish @kalanicraig Here's a first pass at filtering. Please try it out, especially on large databases! This has only gone through very basic QA at this point, so there are probably issues. Please report any problems in this thread.