Skip to content

Commit

Permalink
Merge pull request #534 from oxixes/mac-v2
Browse files Browse the repository at this point in the history
Add v2-web components based widgets and get rid of iframes in operators.
  • Loading branch information
aarranz authored Mar 7, 2024
2 parents 28fec83 + f3b24df commit 01e171a
Show file tree
Hide file tree
Showing 61 changed files with 3,335 additions and 1,649 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
pip install -r requirements.txt
pip install -r requirements-dev.txt
python manage.py collectstatic -v 0 -c --noinput
coverage run -a --branch --source wirecloud --omit="*/wirecloud/semanticwiring/*,*/wirecloud/guidebuilder/*,*/tests/*,*/tests.py" manage.py test --noinput --nologcapture -v 2 -a tags='wirecloud-noselenium'
coverage run -a --branch --source wirecloud --omit="*/wirecloud/semanticwiring/*,*/wirecloud/guidebuilder/*,*/tests/*,*/tests.py,*/wirecloud/commons/utils/remote.py" manage.py test --noinput --nologcapture -v 2 -a tags='wirecloud-noselenium'
- name: Coveralls Parallel
uses: AndreMiras/coveralls-python-action@develop
with:
Expand Down Expand Up @@ -170,7 +170,7 @@ jobs:
django-selenium-tests:

runs-on: ubuntu-20.04

steps:
- name: Setup PostgreSQL
run: |
Expand Down Expand Up @@ -216,9 +216,9 @@ jobs:
- django-search-indexes-tests
- django-selenium-tests
- js-unit-tests

runs-on: ubuntu-20.04

steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
Expand Down
17 changes: 12 additions & 5 deletions docs.ja/development/macdl_rdf.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ Application Mashup GE は、MAC 情報を RDF として表現する手段を提

- **URI**: `http://wirecloud.conwet.fi.upm.es/ns/widget#Widget`

- **Properties include**: `dcterms:title`, `dcterms:description`, `dcterms:creator`, `usdl:hasProvider`,
`usdl:utilizedResource`, `foaf:page`, `wire:hasPlatformPreference`, `wire:hasPlatformWiring`,
- **Properties include**: `wire:macVersion`, `dcterms:title`, `dcterms:description`, `dcterms:creator`,
`usdl:hasProvider`, `usdl:utilizedResource`, `foaf:page`, `wire:hasPlatformPreference`, `wire:hasPlatformWiring`,
`wire:hasPlatformRendering`, `wire:hasPlatformStateProperty`, `usdl:versionInfo`, `wire:hasImageUri`,
`wire.hasiPhoneImageUri`, `wire:displayName`, `vcard:addr`

Expand All @@ -49,8 +49,8 @@ Application Mashup GE は、MAC 情報を RDF として表現する手段を提

- **URI**: `http://wirecloud.conwet.fi.upm.es/ns/widget#Operator`

- **Properties include**: `dcterms:title`, `dcterms:description`, `dcterms:creator`, `usdl:hasProvider`,
`usdl:utilizedResource`, `foaf: page`, `wire:hasPlatformPreference`, `wire:hasPlatformWiring`,
- **Properties include**: `wire:macVersion`, `dcterms:title`, `dcterms:description`, `dcterms:creator`,
`usdl:hasProvider`, `usdl:utilizedResource`, `foaf: page`, `wire:hasPlatformPreference`, `wire:hasPlatformWiring`,
`wire:hasPlatformRendering`, `wire:hasPlatformStateProperty`, `usdl:versionInfo`, `wire:hasImageUri`,
`wire.hasiPhoneImageUri`, `wire:displayName`, `vcard:addr`

Expand Down Expand Up @@ -140,6 +140,13 @@ Application Mashup GE は、MAC 情報を RDF として表現する手段を提

### プロパティ

#### `wire:macVersion` プロパティ

このプロパティは、ウィジェットまたはオペレータを記述するために使用されるMACDLのバージョンを示す。 現在、サポートされているのはの値は`1`である。 このプロパティは必須ではないが、使用すべきである。 このプロパティがない場合、バージョン`1`はを想定している。

- **URI**: `http://wirecloud.conwet.fi.upm.es/ns/Widget#macVersion`
- **Domain**: `wire:Widget``wire:Operator`
- **Range**: `rdfs:Literal`

#### `wire:hasPlatformPreference` プロパティ

Expand Down Expand Up @@ -340,7 +347,7 @@ Application Mashup GE は、MAC 情報を RDF として表現する手段を提

- **URI**: `http://wirecloud.conwet.fi.upm.es/ns/mashup#Mashup`

- **Properties include**: `wire-m:hasMashupPreference`, `wire-m:hasMashupParam`, `wire-m:hasTab`,
- **Properties include**: `wire:macVersion`, `wire-m:hasMashupPreference`, `wire-m:hasMashupParam`, `wire-m:hasTab`,
`wire-m:hasMashupWiring`, `wire:hasImageUri`, `wire:hasiPhoneImageUri`, `wire:version`

- **subClassOf**: `usdl:CompositeService`
Expand Down
6 changes: 6 additions & 0 deletions docs.ja/development/macdl_xml.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@

## 共通のメタデータ

### `macversion` 要素

`macversion`要素はMACが使用するApplication Mashup GE仕様のバージョンを宣言するために使用される。 この要素は、Application Mashup GE仕様の古いバージョンと互換性を保つために必須では ないが、すべての新しいMACsに含めるべきである。

現在、この要素でサポートされている値は`1`だけである。 この要素がない場合、値`1`が仮定される。

### `details` 要素

![](../../docs/images/mac_description_details_element.png)
Expand Down
33 changes: 24 additions & 9 deletions docs/development/macdl_rdf.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@ This class represents a widget. This is, jointly with `wire:Operator`, one of th

- **URI**: `http://wirecloud.conwet.fi.upm.es/ns/widget#Widget`

- **Properties include**: `dcterms:title`, `dcterms:description`, `dcterms:creator`, `usdl:hasProvider`,
`usdl:utilizedResource`, `foaf:page`, `wire:hasPlatformPreference`, `wire:hasPlatformWiring`,
`wire:hasPlatformRendering`, `wire:hasPlatformStateProperty`, `usdl:versionInfo`, `wire:hasImageUri`,
`wire.hasiPhoneImageUri`, `wire:displayName`, `vcard:addr`
- **Properties include**: `wire:macVersion`, `dcterms:title`, `dcterms:description`, `dcterms:creator`,
`usdl:hasProvider`, `usdl:utilizedResource`, `wire:entryPoint`, `foaf:page`, `wire:hasPlatformPreference`, `wire:hasPlatformWiring`, `wire:hasPlatformRendering`, `wire:hasPlatformStateProperty`, `usdl:versionInfo`, `wire:hasImageUri`, `wire.hasiPhoneImageUri`, `wire:displayName`, `vcard:addr`

- **Subclassof**: `usdl-core:Service`

Expand All @@ -47,10 +45,8 @@ This class represents a operator. This is, jointly with `wire:Widget`, one of th

- **URI**: `http://wirecloud.conwet.fi.upm.es/ns/widget#Operator`

- **Properties include**: `dcterms:title`, `dcterms:description`, `dcterms:creator`, `usdl:hasProvider`,
`usdl:utilizedResource`, `foaf: page`, `wire:hasPlatformPreference`, `wire:hasPlatformWiring`,
`wire:hasPlatformRendering`, `wire:hasPlatformStateProperty`, `usdl:versionInfo`, `wire:hasImageUri`,
`wire.hasiPhoneImageUri`, `wire:displayName`, `vcard:addr`
- **Properties include**: `wire:macVersion`, `dcterms:title`, `dcterms:description`, `dcterms:creator`,
`usdl:hasProvider`, `usdl:utilizedResource`, `wire:entryPoint`, `foaf:page`, `wire:hasPlatformPreference`, `wire:hasPlatformWiring`, `wire:hasPlatformRendering`, `wire:hasPlatformStateProperty`, `usdl:versionInfo`, `wire:hasImageUri`, `wire.hasiPhoneImageUri`, `wire:displayName`, `vcard:addr`

- **Subclassof**: `usdl-core:Service`

Expand Down Expand Up @@ -130,6 +126,16 @@ This class represents an input endpoint.

### Properties

#### The `wire:macVersion` property

This property states the version of the MACDL used to describe the widget or operator. Currently, the only supported
value is `1`. This property is NOT mandatory but SHOULD be used. In absence of this property, the version `1` is
assumed.

- **URI**: `http://wirecloud.conwet.fi.upm.es/ns/Widget#macVersion`
- **Domain**: `wire:Widget` and `wire:Operator`
- **Range**: `rdfs:Literal`

#### The `wire:hasPlatformPreference` property

This property states a user widget preference.
Expand Down Expand Up @@ -285,6 +291,15 @@ This property states whether or not the widget code is cacheable.
- **Domain**: `usdl-core:Resource`
- **Range**: `rdfs:Literal`

#### The `wire:entryPoint` property

v2 widgets and operators need to define the entry point of the component. This property states the entry point of the
widget or operator. The entrypoint is the name of a class that the MAC scripts will define in the `window` object that will be instantiated whenever the MAC is loaded, receiving as parameters the objects neccessary for the MAC to work correctly ([more info here](./widget_and_operators.md)). Therefore, it must be unique in the global scope.

- **URI**: `http://wirecloud.conwet.fi.upm.es/ns/Widget#entryPoint`
- **Domain**: `wire:Widget` and `wire:Operator`
- **Range**: `rdfs:Literal`

## WIRE-M vocabulary

The diagram below shows the WIRE-M vocabulary.
Expand All @@ -304,7 +319,7 @@ This class represents a mashup. It will be implemented as a workspace.

- **URI**: `http://wirecloud.conwet.fi.upm.es/ns/mashup#Mashup`

- **Properties include**: `wire-m:hasMashupPreference`, `wire-m:hasMashupParam`, `wire-m:hasTab`,
- **Properties include**: `wire:macVersion`, `wire-m:hasMashupPreference`, `wire-m:hasMashupParam`, `wire-m:hasTab`,
`wire-m:hasMashupWiring`, `wire:hasImageUri`, `wire:hasiPhoneImageUri`, `wire:version`

- **subClassOf**: `usdl:CompositeService`
Expand Down
18 changes: 15 additions & 3 deletions docs/development/macdl_xml.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ operators, ...).

## Common metadata

### macversion element

The `macversion` element is used for declaring the version of the Application Mashup GE specification used by the
mashable application component. This element is NOT required in order to be compatible with older versions of the
Application Mashup GE specification, but it SHOULD be included in all new mashable application components.

Currently, the only supported values for this element are `1` and `2`. In absence of this element, the value `1` is assumed.

### details element

![](../images/mac_description_details_element.png)
Expand Down Expand Up @@ -234,13 +242,17 @@ operator descriptions):

### The `scripts` element

While in widgets define it code entry point, in general, through an HTML file, operators, as they do not provide an user
interface, need to declare directly the list of javascript files to use. This script list is declared using the
`scripts` element that is composed of one or more `script` sub-elements. `script` elements supports the following
Widgets (v2 onwards) and operators need to define the list of scripts they need to use, so that they are included when loading the MAC. This script list is declared using the `scripts` element that is composed of one or more `script` sub-elements. `script` elements supports the following
attributes:

- `src`: description-file-relative URL of the JavaScript file.

### The `entrypoint` element

v2 widgets and operators need to define the entry point of the component. This is done using the `entrypoint` element.
The entrypoint is the name of a class that the MAC scripts will define in the `window` object that will be instantiated whenever the MAC is loaded, receiving as parameters the objects neccessary for the MAC to work correctly ([more info here](./widget_and_operators.md)). Therefore, it must be unique in the global scope. The `entrypoint` element supports the following attributes:
- `name`: name of the entrypoint class.

## Specific Mashup metadata

The figure below depicts the structure followed by `mashup` elements (and therefore, the structure followed by mashup
Expand Down
11 changes: 9 additions & 2 deletions docs/development/widget_and_operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,15 @@ figure shows one possible structure of files for a widget:
> `config.xml` file MUST be at the root of the zip file.
Operators are created in the same way as widgets, the only difference is that the descriptor file (`config.xml`) does
not link to an initial HTML document (as operators doesn't have a visual component). Instead, you will have to link the
list of used JavaScript files from the `config.xml` file.
not link to an initial HTML document (as operators don't have a visual component).

Both widgets and operators need to specify a list of scripts that will be executed when the widget/operator is loaded.
These scripts must define a class in the window object that will be instantiated by the WireCloud platform. This class
receives 3 parameters in the case of widgets and 2 in the case of operators:
- The first parameter is the MashupPlatform object.
- The second parameter is a reference to a shadowDOM that contains the widget code (not present on operators).
- The third parameter is an object containing any extra objects as defined by the descriptor file (such as
the NGSI API, the ContextManager API...).

Operators can be classified using three types:

Expand Down
4 changes: 4 additions & 0 deletions docs/widgetapi/widgetapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ This specification is licensed under the

## Widget API

### MashupPlatform.location

Allows to retrieve the current loaded location of the widget/operator.

### MashupPlatform.http

This module provides some methods for handling HTTP requests including support for using the cross domain proxy.
Expand Down
15 changes: 14 additions & 1 deletion src/GruntFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ var WirecloudFiles = [
'wirecloud/platform/static/js/wirecloud/ui/WidgetViewDraggable.js',
'wirecloud/platform/static/js/wirecloud/ui/WidgetViewResizeHandle.js',
'wirecloud/platform/static/js/wirecloud/ui/WidgetView.js',
'wirecloud/platform/static/js/wirecloud/ui/WidgetElement.js',
'wirecloud/platform/static/js/wirecloud/ui/WidgetViewMenuItems.js',
'wirecloud/platform/static/js/wirecloud/ui/WiringEditor.js',
'wirecloud/platform/static/js/wirecloud/ui/WiringEditor/Behaviour.js',
Expand Down Expand Up @@ -171,6 +172,18 @@ var WirecloudFiles = [
'wirecloud/platform/static/js/wirecloud/wiring/Connection.js'
];

var WirecloudAPIFiles = [
'wirecloud/platform/static/js/WirecloudAPI/WirecloudAPIBootstrap.js',
'wirecloud/platform/static/js/WirecloudAPI/WirecloudWidgetAPI.js',
'wirecloud/platform/static/js/WirecloudAPI/WirecloudOperatorAPI.js',
'wirecloud/platform/static/js/WirecloudAPI/WirecloudAPICommon.js',
'wirecloud/platform/static/js/WirecloudAPI/StyledElements.js',
'wirecloud/platform/static/js/WirecloudAPI/ComponentManagementAPI.js',
'wirecloud/platform/static/js/WirecloudAPI/DashboardManagementAPI.js',
'wirecloud/platform/static/js/WirecloudAPI/WirecloudAPIClosure.js',
'wirecloud/platform/static/js/WirecloudAPI/WirecloudAPIV2Bootstrap.js'
];

module.exports = function (grunt) {

'use strict';
Expand All @@ -182,7 +195,7 @@ module.exports = function (grunt) {
src: styledElementsFiles
},
wirecloud: {
src: WirecloudFiles
src: WirecloudFiles.concat(WirecloudAPIFiles)
},
specs: {
options: {
Expand Down
Loading

0 comments on commit 01e171a

Please sign in to comment.