Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List view order isn’t alphabetic or stable #40468

Closed
jfsiii opened this issue Jul 6, 2019 · 2 comments
Closed

List view order isn’t alphabetic or stable #40468

jfsiii opened this issue Jul 6, 2019 · 2 comments
Assignees
Labels
Feature:EPM Fleet team's Elastic Package Manager (aka Integrations) project Team:Fleet Team label for Observability Data Collection Fleet team

Comments

@jfsiii
Copy link
Contributor

jfsiii commented Jul 6, 2019

The order of the integrations on http://localhost:5601/app/integrations_manager#/?_g=()

  • has no obvious sorting
  • changes on each page load (refresh list view or go list -> detail -> list)

This is because the Integrations Registry has the same issue (repeated request to /list return different ordered items).

Sort list in the manager before returning the response.

@jfsiii jfsiii added the Feature:EPM Fleet team's Elastic Package Manager (aka Integrations) project label Jul 6, 2019
@jfsiii jfsiii self-assigned this Jul 6, 2019
jfsiii pushed a commit to jfsiii/kibana that referenced this issue Jul 7, 2019
jfsiii pushed a commit that referenced this issue Jul 9, 2019
* GET install/apache-1.0.1/dashboard installs dash (and viz, pattern, etc)

* install now saves state in new SO type. delete/apache-1.0.1 deletes ref

```
> curl --user elastic:changeme http://localhost:5601/api/saved_objects/_find?type=integrations-manager
{"page":1,"per_page":20,"total":0,"saved_objects":[]}
```

```
> curl --user elastic:changeme http://localhost:5601/api/integrations_manager/install/apache-1.0.1/dashboard
{
  "type": "integrations-manager",
  "id": "apache-1.0.1",
  "attributes": {
    "installed": [
      {
        "id": "0c610510-5cbd-11e9-8477-077ec9664dbd",
        "type": "dashboard"
      },
      {
        "id": "36f872a0-5c03-11e9-85b4-19d0072eb4f2",
        "type": "visualization"
      },
      {
        "id": "filebeat-*",
        "type": "index-pattern"
      },
      {
        "id": "80844540-5c97-11e9-8477-077ec9664dbd",
        "type": "visualization"
      },
      {
        "id": "38f96190-5c99-11e9-8477-077ec9664dbd",
        "type": "visualization"
      },
      {
        "id": "7e4084e0-5c99-11e9-8477-077ec9664dbd",
        "type": "visualization"
      },
      {
        "id": "0a994af0-5c9d-11e9-8477-077ec9664dbd",
        "type": "visualization"
      },
      {
        "id": "ab48c3f0-5ca6-11e9-8477-077ec9664dbd",
        "type": "visualization"
      }
    ]
  },
  "references": [],
  "updated_at": "2019-07-04T00:59:57.231Z",
  "version": "WzMwNiwxXQ=="
}
```

```
> curl --user elastic:changeme http://localhost:5601/api/saved_objects/_find?type=integrations-manager
{"page":1,"per_page":20,"total":1,"saved_objects":[{"type":"integrations-manager","id":"apache-1.0.1","attributes":{"installed":[{"id":"0c610510-5cbd-11e9-8477-077ec9664dbd","type":"dashboard"},{"id":"36f872a0-5c03-11e9-85b4-19d0072eb4f2","type":"visualization"},{"id":"filebeat-*","type":"index-pattern"},{"id":"80844540-5c97-11e9-8477-077ec9664dbd","type":"visualization"},{"id":"38f96190-5c99-11e9-8477-077ec9664dbd","type":"visualization"},{"id":"7e4084e0-5c99-11e9-8477-077ec9664dbd","type":"visualization"},{"id":"0a994af0-5c9d-11e9-8477-077ec9664dbd","type":"visualization"},{"id":"ab48c3f0-5ca6-11e9-8477-077ec9664dbd","type":"visualization"}]},"references":[],"updated_at":"2019-07-04T00:59:57.231Z","version":"WzMwNiwxXQ=="}]}
```

```
> curl --user elastic:changeme -X DELETE -H 'kbn-xsrf: true' http://localhost:5601/api/saved_objects/integrations-manager/apache-1.0.1
{}
```

```
> curl --user elastic:changeme http://localhost:5601/api/saved_objects/_find?type=integrations-manager
{"page":1,"per_page":20,"total":0,"saved_objects":[]}
```
```
> curl --user elastic:changeme http://localhost:5601/api/integrations_manager/install/apache-1.0.1/dashboard
{
  "type": "integrations-manager",
  "id": "apache-1.0.1",
  "attributes": {
    "installed": [
      {
        "id": "0c610510-5cbd-11e9-8477-077ec9664dbd",
        "type": "dashboard"
      },
      {
        "id": "36f872a0-5c03-11e9-85b4-19d0072eb4f2",
        "type": "visualization"
      },
      {
        "id": "filebeat-*",
        "type": "index-pattern"
      },
      {
        "id": "80844540-5c97-11e9-8477-077ec9664dbd",
        "type": "visualization"
      },
      {
        "id": "38f96190-5c99-11e9-8477-077ec9664dbd",
        "type": "visualization"
      },
      {
        "id": "7e4084e0-5c99-11e9-8477-077ec9664dbd",
        "type": "visualization"
      },
      {
        "id": "0a994af0-5c9d-11e9-8477-077ec9664dbd",
        "type": "visualization"
      },
      {
        "id": "ab48c3f0-5ca6-11e9-8477-077ec9664dbd",
        "type": "visualization"
      }
    ]
  },
  "references": [],
  "updated_at": "2019-07-04T01:00:39.373Z",
  "version": "WzMxNiwxXQ=="
}
```
```
> curl --user elastic:changeme http://localhost:5601/api/integrations_manager/install/haproxy-1.3.1/dashboard
{
  "type": "integrations-manager",
  "id": "haproxy-1.3.1",
  "attributes": {
    "installed": [
      {
        "id": "0c610510-5cbd-11e9-8477-077ec9664dbd",
        "type": "dashboard"
      },
      {
        "id": "36f872a0-5c03-11e9-85b4-19d0072eb4f2",
        "type": "visualization"
      },
      {
        "id": "filebeat-*",
        "type": "index-pattern"
      },
      {
        "id": "80844540-5c97-11e9-8477-077ec9664dbd",
        "type": "visualization"
      },
      {
        "id": "38f96190-5c99-11e9-8477-077ec9664dbd",
        "type": "visualization"
      },
      {
        "id": "7e4084e0-5c99-11e9-8477-077ec9664dbd",
        "type": "visualization"
      },
      {
        "id": "0a994af0-5c9d-11e9-8477-077ec9664dbd",
        "type": "visualization"
      },
      {
        "id": "ab48c3f0-5ca6-11e9-8477-077ec9664dbd",
        "type": "visualization"
      }
    ]
  },
  "references": [],
  "updated_at": "2019-07-04T01:00:53.429Z",
  "version": "WzMyNSwxXQ=="
}
```

```
> curl --user elastic:changeme http://localhost:5601/api/saved_objects/_find?type=integrations-manager
{"page":1,"per_page":20,"total":2,"saved_objects":[
  ...
  {"id":"ab48c3f0-5ca6-11e9-8477-077ec9664dbd","type":"visualization"}]},"references":[],"updated_at":"2019-07-04T01:00:53.429Z","version":"WzMyNSwxXQ=="}]}
```

* Update /list to look for installed items

```
curl --user elastic:changeme http://localhost:5601/api/integrations_manager/list
[
  {
    "id": "docker-1.2.3",
    "type": "integrations-manager",
    "error": {
      "statusCode": 404,
      "message": "Not found"
    }
  },
  {
    "id": "haproxy-1.3.1",
    "type": "integrations-manager",
    "updated_at": "2019-07-04T12:07:14.115Z",
    "version": "WzM0OSwxXQ==",
    "attributes": {
      "installed": [
        {
          "id": "0c610510-5cbd-11e9-8477-077ec9664dbd",
          "type": "dashboard"
        },
        {
          "id": "36f872a0-5c03-11e9-85b4-19d0072eb4f2",
          "type": "visualization"
        },
        {
          "id": "filebeat-*",
          "type": "index-pattern"
        },
        {
          "id": "80844540-5c97-11e9-8477-077ec9664dbd",
          "type": "visualization"
        },
        {
          "id": "38f96190-5c99-11e9-8477-077ec9664dbd",
          "type": "visualization"
        },
        {
          "id": "7e4084e0-5c99-11e9-8477-077ec9664dbd",
          "type": "visualization"
        },
        {
          "id": "0a994af0-5c9d-11e9-8477-077ec9664dbd",
          "type": "visualization"
        },
        {
          "id": "ab48c3f0-5ca6-11e9-8477-077ec9664dbd",
          "type": "visualization"
        }
      ]
    },
    "references": []
  },
  {
    "id": "rabbitmq-1.0.2",
    "type": "integrations-manager",
    "error": {
      "statusCode": 404,
      "message": "Not found"
    }
  },
  {
    "id": "traefik-1.0.2",
    "type": "integrations-manager",
    "error": {
      "statusCode": 404,
      "message": "Not found"
    }
  },
  {
    "id": "apache-1.0.1",
    "type": "integrations-manager",
    "updated_at": "2019-07-04T12:06:26.993Z",
    "version": "WzM0MCwxXQ==",
    "attributes": {
      "installed": [
        {
          "id": "0c610510-5cbd-11e9-8477-077ec9664dbd",
          "type": "dashboard"
        },
        {
          "id": "36f872a0-5c03-11e9-85b4-19d0072eb4f2",
          "type": "visualization"
        },
        {
          "id": "filebeat-*",
          "type": "index-pattern"
        },
        {
          "id": "80844540-5c97-11e9-8477-077ec9664dbd",
          "type": "visualization"
        },
        {
          "id": "38f96190-5c99-11e9-8477-077ec9664dbd",
          "type": "visualization"
        },
        {
          "id": "7e4084e0-5c99-11e9-8477-077ec9664dbd",
          "type": "visualization"
        },
        {
          "id": "0a994af0-5c9d-11e9-8477-077ec9664dbd",
          "type": "visualization"
        },
        {
          "id": "ab48c3f0-5ca6-11e9-8477-077ec9664dbd",
          "type": "visualization"
        }
      ]
    },
    "references": []
  },
  {
    "id": "kafka-1.0.1",
    "type": "integrations-manager",
    "error": {
      "statusCode": 404,
      "message": "Not found"
    }
  },
  {
    "id": "kibana-1.3.2",
    "type": "integrations-manager",
    "error": {
      "statusCode": 404,
      "message": "Not found"
    }
  },
  {
    "id": "mongodb-1.0.1",
    "type": "integrations-manager",
    "error": {
      "statusCode": 404,
      "message": "Not found"
    }
  },
  {
    "id": "mysql-1.0.2",
    "type": "integrations-manager",
    "error": {
      "statusCode": 404,
      "message": "Not found"
    }
  },
  {
    "id": "postgresql-1.0.2",
    "type": "integrations-manager",
    "error": {
      "statusCode": 404,
      "message": "Not found"
    }
  },
  {
    "id": "system-2.0.1",
    "type": "integrations-manager",
    "error": {
      "statusCode": 404,
      "message": "Not found"
    }
  },
  {
    "id": "elasticsearch-1.3.1",
    "type": "integrations-manager",
    "error": {
      "statusCode": 404,
      "message": "Not found"
    }
  }
]
```

* Guard against undefined value

* DRY out function which collects saved objects. Move out of routes.js.

Probably shouldn't be in registry.js either, but Works For Now.

* Add type for the state saved object.

* Fix list & info API points. Add `status` & `savedObject` to response.

Won't pass CI b/c of type stuff, but fixes the views.

* More info API fixes. Don't 500 if integration isn't installed.

* Define separate types for registry vs public http responses.

* Move all integration handlers to integrations.js as handle* functions.

* Move integration-related functions from registry.ts to integrations.ts

* Sort integrations list alphabetically closes #40468

* Use generics for installed vs not installed.

* Replace for loop + array.push with array.map

* Update collectReferences to use reduce vs for loops.

Won't pass CI b/c of some TS issues around implicit any but will fix that shortly.

* Drop one type as requested. Add one to fix failures.
@jfsiii
Copy link
Contributor Author

jfsiii commented Jul 9, 2019

closed in #40355 / dfff472

@jfsiii jfsiii closed this as completed Jul 9, 2019
@sgrodzicki sgrodzicki added the Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services label Oct 21, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/logs-metrics-ui (Team:logs-metrics-ui)

@jen-huang jen-huang added Team:Fleet Team label for Observability Data Collection Fleet team and removed Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services labels Mar 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:EPM Fleet team's Elastic Package Manager (aka Integrations) project Team:Fleet Team label for Observability Data Collection Fleet team
Projects
None yet
Development

No branches or pull requests

4 participants