Coder Social home page Coder Social logo

trento-project / web Goto Github PK

View Code? Open in Web Editor NEW
21.0 21.0 14.0 189.17 MB

An open cloud-native web console improving on the work day of SAP Applications administrators.

Home Page: https://trento-project.io

License: Other

Elixir 53.56% CSS 0.06% JavaScript 44.96% HTML 0.79% Dockerfile 0.09% Shell 0.12% Batchfile 0.01% SCSS 0.32% Python 0.10%
elixir kubernetes monitoring sap web-application

web's People

Contributors

abravosuse avatar ajaeger avatar arbulu89 avatar cdimonaco avatar dependabot[bot] avatar dottorblaster avatar emaksy avatar fabriziosestito avatar isimluk avatar jagabomb avatar jamie-suse avatar mpagot avatar nelsonkopliku avatar rtorrero avatar stefanotorresi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

web's Issues

Remove extra query in projectors when updating read models

changeset =
  HostReadModel
  |> Repo.get(id)
  |> HostReadModel.changeset(%{
    heartbeat: :critical
  })

Ecto.Multi.update(multi, :host, changeset)

can be written

changeset =
  %HostReadModel{id: host_id}
  |> HostReadModel.changeset(%{
    heartbeat: :critical
  })

Ecto.Multi.update(multi, :host, changeset)

Refactor Tagging

Now we have several controllers

  • cluster_controller
  • host_controller
  • sap_system_controller
  • database_controller

defining these two functions

  • create_tag
  • delete_tag
@spec create_tag(Plug.Conn.t(), map) :: Plug.Conn.t()
def create_tag(conn, %{
      "id" => id,
      "value" => value
    }) do
  case Tags.create_tag(value, id, "host") do
    {:ok, _} ->
      conn
      |> put_status(:accepted)
      |> json(%{})

    {:error, _} ->
      conn
      |> put_status(:bad_request)
      |> json(%{error: "tag creation failed"})
  end
end

@spec delete_tag(Plug.Conn.t(), map) :: Plug.Conn.t()
def delete_tag(conn, %{
      "id" => resource_id,
      "value" => value
    }) do
  case Tags.delete_tag(value, resource_id) do
    :ok ->
      conn
      |> put_status(:accepted)
      |> json(%{})

    :not_found ->
      conn
      |> put_status(:not_found)
      |> json(%{})
  end
end

The point is that delete_tag is exactly the same for all the controllers while create_tag only differs on the third argument of Tags.create_tag/3, being the resource_type (host, cluster, database, sap_system).

I believe we can improve a bit by:

  • having clearer function names like tag_host, tag_sap_system, etc... and delegate the detail of the resource type
  • putting delete_tag in a module to reduce duplication ๐Ÿค”
  • having a TaggingController where to route the various POST /<resourceType>/<resourceId>/tags and DELETE /<resourceType>/<resourceId>/tags/<value>

Add crosslink from SAP System Detail to Database Detail and vice-versa

In sap system detail we don't know anything about the related database and the same is true the other way around.

Options are:

  • we show db related info in sapsystem detail, and the other way around when available
  • we provide a link to the Database detail in sapsystem detail and a link to the sapsystem detail in the Database detail when possible.

Correctly detect Pacemaker Site details in ClusterDetails

assets/js/components/ClusterDetails/ClusterDetails.jsx

<div className="mt-8">
  <div>
    <h2 className="text-2xl font-bold">Pacemaker Site details</h2>
  </div>
</div>
<div className="mt-2">
  <h3 className="text-l font-bold">NBG</h3>
  <Table
    config={siteDetailsConfig}
    data={renderedNodes.filter(({ site }) => site === 'NBG')} // fix hardcoded
  />
  <h3 className="text-l font-bold">WDF</h3>
  <Table
    config={siteDetailsConfig}
    data={renderedNodes.filter(({ site }) => site === 'WDF')} // fix hardcoded
  />
</div>

Display prominent notification messages

In order to get the user attention is important events, having a prominent notification message option would come handy.

For example, when the runner is not available and I want to display some sort of big message, where the user has the option do something like close, try again, etc.

The current toast notifications look a bit small for this kind of business

Host overview could reuse the already existing getInstancesOnHost selector

The Host overview right now collects the sap systems each host belongs to using:

const getSapSystemsByHost = (sapSystems, hostId) => {
  const appInstances = sapSystems
    .flatMap((sapSystem) => sapSystem.application_instances)
    .filter((sapSystem) => sapSystem.host_id === hostId)
    .map((sapSystem) => ({ type: 'sap-systems', instance: sapSystem }));
  const dbInstances = sapSystems
    .flatMap((sapSystem) => sapSystem.database_instances)
    .filter((sapSystem) => sapSystem.host_id === hostId)
    .map((sapSystem) => ({ type: 'databases', instance: sapSystem }));

  return appInstances.concat(dbInstances);
};

we could instead use the getInstancesOnHost from @state/selectors. I did a quick try but it seems that calling useSelector on each host iteration on the list breaks the app after a refresh.

We should improve this.

Tags don't have autocomplete feature

In order to reach parity, the tags creation should offer an autocomplete feature with the already existing tags of this resource (host, clusters, etc).

Besides this, tags "edition mode" doesn't go away unless enter key is pressed. I don't know if this is desired or not

Refactor module names to reflect component location in architecture

Module names should reflect their location in the architecture.

For instance the application service Trento.SapSystems.HealthSummaryService should be Trento.Application.UseCases.SapSystems.HealthSummaryService.

It doesn't have to be prescriptive, yet clear and useful.
Let's have a discussion about this.

For instance the dto located in lib/trento/application/usecases/sap_systems/dto/health_summary_dto.ex

could be
Trento.Application.UseCases.SapSystems.Dto.HealthSummary or
Trento.Application.UseCases.SapSystems.Dto.HealthSummaryDto ๐Ÿ‘Ž

or simply
Trento.Application.UseCases.SapSystems.HealthSummaryDto

which is also acceptable.

Guard against empty tags

Currently our tagging system allows empty tags.
If I press enter on a tag input without typing any text, trento allows that tag to be created.

I would argue about the usefulness of an empty tag already here.

Then this opens the issue of not being able to delete those tags.
When I refresh the page I get the items with the empty tag pill, and when I try to delete it, the backend goes 404 because of a non-existent deletion endpoint.

Simply put

the deletion endpoint should be something like

DELETE /api/clusters/6bd7ec60-8cb1-5c6b-a892-29e1fd2f8380/tags/<the-tag-value>

When <the-tag-value> is empty, the computed enpoint being called is

DELETE /api/clusters/6bd7ec60-8cb1-5c6b-a892-29e1fd2f8380/tags/

which does not exist.

tags-bug

Allow local configurations for development

In order to make development easier, when configuration flags are involved, the application should allow the usage of local configurations.

An use case:

  • I want to use the real runner adapter in dev environment

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.