Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
configuration: {
            url:      "http://localhost:3002/" (hbw_url),
            login:    user@example.com (hbw_login),
            password: renewmeplease (hbw_token)
}
  • метод, в котором ко всем параметрам запросов будут будет добавляться идентификатор пользователя, который взаимодействует с HOMS
Code Block
def with_user_identifier(parameters)
        parameters.merge(
          'user_identifier' => Lib::GetSession.(params[:payload][:token])[:session][:email]
        )
end      
 
def allow_params(*allowed_params)
        with_user_identifier(params.slice(*allowed_params))
end

...

  • методы для работы с формами заказа

 

    • получение всех заказов – GET запрос c параметрами entity_classentity_code:

...

Code Block
title/widget/users
get_request_bpm_backend('users/check')

Встраивание JS

Включить Необходимо включить в HTML страницы внешней системы JS и CSS виджета:

 

Code Block
languagejs
<script type="text/javascript" src="<%= '\<\%\= hbw_assets_path \%\>' %>assets/hbw.js"></script>
<link relreluser_identifier="stylesheet" type="text/css" href="<%= '\<\%\= hbw_assets_path \%\>' %>assets/hbw.css">

 

Добавить на страницу <div> с уникальным ID, например, bpmWidgetContainer, чтобы в нём отрендерился виджет.

 

Вызвать функцию render у объекта виджета:
 
Code Block
languagejs
titlejs code
this.widget = new (modulejs.require('HBW'))({
        widgetContainer: `#${this.widgetContainerId}`,
        widgetPath: '/widget',
        entity_class: 'your_entity_class',
        entity_type: 'operator',
        entity_code: `${id}`,
        locale: i18n.language,
        payload: {
          token: cookies.get('token'),
          variables: {
            id: {
              value: `${id}`,
              type: 'string',
            },
          },
        },
      });

this.widget.render();