Giter VIP home page Giter VIP logo

kveditor's People

Contributors

dependabot[bot] avatar marcusschiesser avatar thucpn avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

kveditor's Issues

Implement sorting of columns

Requirement

  • Specify a list of columns in the definition.json via the attribute sortable
  • If the property is set make the specified columns sortable (alphanumeric)

Notes

We need to add/modify events of the current Table component such as:

  • Click on the column header to trigger a sort
  • Click a page number to change the page
  • Click on a cell of the table

The Table component might not be sufficient, so we probably have to extend the currently unused ReadOnlyTable

Add functionality to upload a CSV

All entries of the CSV must be stored in the Splunk KV Store Collection.

There's already a method to modify one entry: https://github.com/marcusschiesser/kveditor/blob/44d5f0505593bf28b54d28cd19cc53f606d9d160/packages/edit-table/src/data.js

Here's the REST API to modify a Splunk Collection:
https://dev.splunk.com/enterprise/docs/developapps/manageknowledge/kvstore/usetherestapitomanagekv/

There's a batch operation which should be helpful to store multiple entries

Implement search functionality

Requirement

  • Specify a list of columns in the definition.json via the attribute searchable
  • If the property is set, add a search box to the component - the user can type in a query into the box
  • A server-side query is called based on the specified search

Implementation

  • This ticket requires to implement #7 first
  • Use collection API to get entries by the query.

Currently, the endpoint supports pagination, sorting, projection, and query by exact string. The API also support sort and search by one or multiple fields. The API didn't support query by a substring (we have to wait here for a new Splunk release).

Eg: To get the first 10 entries which have "Title"="Mean" and sort by "Score". We can use this query:
/storage/collections/data/${collection}?sort=Score&skip=0&limit=10&query={"Title":"Mean"}

Add devcontainer env environment

  • add devcontainer that can run docker containers (similar to como)
  • add a docker-compose file with a single Splunk 8.2.9 instance that is running the Splunk app generated by yarn start - Dockerfile of the Splunk instance will be in the root container here and be similar to the one of the splunk folder in como

Set up project structure: CSS module, constant, handling error pattern

As recommendation by @splunk/react-ui, we can use inline css for simple style, for example: <P style={{ width: 500 }}>.

For complex CSS with multiple properties such as:

<div
    style={{
        display: 'flex',
        width: 'fit-content',
        marginLeft: 'auto',
        marginTop: '2rem',
    }}
>

We should use styled component to make the code cleaner:

const ButtonActionGroup = styled.div`
    display: flex;
    width: fit-content;
    margin-left: auto;
    margin-top: 2rem;
`;

Load data with collection API

Situation

Currently, the data is updated by calling updateKVEntry(COLLECTION_NAME..., but it is loaded by the SPL query | inputlookup example_kv defined in the definition.json.
The DashboardExample.jsx is using the definition.json to call this query at run-time (actually the DashboardCore component of the Splunk UI framework is doing this) and forwarding the retrieved data via the dataSources property to the EditTable component as an array.

It is important to remember that DashboardCore is calling the SPL queries - the components in definition.json are just rendering data - they are not retrieving data from Splunk.

To force a data refresh (re-loading the modified data), EditTable is calling api.refreshVisualization(id) which triggers that the DashboardCore should reload the data.

The name of the collection that we're using is specified in

Goal

  1. Data should be loaded from the collection API that is updating the data - dataSources can then be removed.
  2. We only keep doing the backups of the kv stores via search jobs (see
    const createBackupForKvStore = async (splunkApp, kvStore, errorMessage) => {
    const backupJob = SearchJob.create(
    { search: `|inputlookup ${kvStore} |outputlookup ${kvStore}.bak.csv` },
    { app: splunkApp }
    );
    return executeJob(backupJob, errorMessage);
    };
    const restoreKvStoreFromBackup = async (splunkApp, kvStore, errorMessage) => {
    const restoreJob = SearchJob.create(
    {
    search: `|inputlookup ${kvStore}.bak.csv |outputlookup ${kvStore}`,
    },
    { app: splunkApp }
    );
    return executeJob(restoreJob, errorMessage);
    };
    ) - the reason is that the endpoints for restoring/backing up kv stores (https://docs.splunk.com/Documentation/Splunk/9.0.5/RESTREF/RESTkvstore#kvstore.2Fbackup.2Fcreate) require special permissions.

Note

Because we won't use the data from datasources in the dashboard definition file, we need to refactor Editable component. Because datasources are currently being used in many places (including download/upload feature), so refactoring will take some effort.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.