Skip to content

[FR] [plugin] ui integrated plugin installing #2318

Closed

Description

@matmair

What is missing now for this to be merge-ready?
...

  • ui integrated plugin installing?
    ...

Originally posted by @matmair in #2074 (comment)

Activity

  1. self-assigned this
    on Nov 17, 2021
  2. added
    api
    plugin
    on Nov 17, 2021
  3. added this to the 0.6.0 milestone on Nov 17, 2021
  4. matmair commented on Nov 17, 2021

    @matmair
    MemberAuthor

    This is easy to implement via subprocess 'pip install '... but there needs to be some infrastructure in place to get that package name.

    Also there should be support for third party sources and signature verification.

  5. removed
    api
    on Nov 17, 2021
  6. matmair commented on Nov 18, 2021

    @matmair
    MemberAuthor

    @SchrodingersGat any pointers for turning an API endpoint into a form? Struggling with adding helper texts atm

    class PluginInstall(generics.CreateAPIView):
    """
    Endpoint for installing a new plugin
    """
    queryset = PluginConfig.objects.none()
    serializer_class = PluginSerializers.PluginConfigInstallSerializer
    def create(self, request, *args, **kwargs):
    serializer = self.get_serializer(data=request.data)
    serializer.is_valid(raise_exception=True)
    result = self.perform_create(serializer)
    result['input'] = serializer.data
    headers = self.get_success_headers(serializer.data)
    return Response(result, status=status.HTTP_201_CREATED, headers=headers)
    def perform_create(self, serializer):
    return serializer.save()

  7. SchrodingersGat commented on Nov 18, 2021

    @SchrodingersGat
    Member

    @matmair the API forms implementation is pretty complex, I must admit.

    The client side stuff is all found in forms.js

    If you want to add data about a field, it should be done either in the model, or in the serializer.

    The API should automatically report (to the client) some metadata about the available fields, for example:

    • label: The "name" of the field (translated)
    • *help_text: Extra description (translated) about the field

    e.g.

    image

    The "metadata" is read out by performing an OPTIONS request to the API endpoint, e.g.

    image

    This provides the client (i.e. javascript) all the information it needs to render the forms.

    Read the code here to see how the metadata is constructed:

    https://github.com/inventree/InvenTree/blob/master/InvenTree/InvenTree/metadata.py

    That should be sufficient background - let me know if you have any specific questions!

  8. matmair commented on Nov 18, 2021

    @matmair
    MemberAuthor

    @SchrodingersGat is the confirm button on the forms not submitted to the api?

  9. added a commit that references this issue on Nov 18, 2021
  10. SchrodingersGat commented on Nov 18, 2021

    @SchrodingersGat
    Member

    Correct, it only enables the "submit" button

  11. Repository owner moved this from In review to Done in Pers. Overview for InvenTreeon Dec 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

plugin

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions