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

IoT business scenarios only for ATL packages #475

Merged
merged 3 commits into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions cmf-cli/Handlers/PackageType/IoTPackageTypeHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ public IoTPackageTypeHandler(CmfPackage cmfPackage) : base(cmfPackage)
{
var packageLocation = "projects";

defaultSteps = this.AddAutomationTaskLibrariesStep(targetVersion, CmfPackage, defaultSteps);
defaultSteps = this.AddAutomationBusinessScenarioStep(targetVersion, CmfPackage, defaultSteps);
if (!this.IsAngularProject(cmfPackage.GetFileInfo().Directory.FullName)) {
defaultSteps = this.AddAutomationTaskLibrariesStep(targetVersion, CmfPackage, defaultSteps);
defaultSteps = this.AddAutomationBusinessScenarioStep(targetVersion, CmfPackage, defaultSteps);
}

buildCommands = new IBuildCommand[]
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"test:cover": "npx nyc -r cobertura -r lcov -r text-summary mocha test/*.test.js test/**/*.test.js -- --timeout 10000 --exit -R mocha-multi-reporters --reporter-options configFile=mocha-multi-reporters-config.json",
"pretest": "npm run build",
"watch": "npm run build -- -w | npx mocha --timeout 10000 --exit --reporter min -w test/*.test.js test/**/*.test.js",
"packagePacker": "yo @criticalmanufacturing/iot:packagePacker -o ."
"packagePacker": "packageBundler -d -o=."
},
"keywords": [
"CMF",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"test:cover": "npx nyc -r cobertura -r lcov -r text-summary mocha test/*.test.js test/**/*.test.js -- --timeout 10000 --exit -R mocha-multi-reporters --reporter-options configFile=mocha-multi-reporters-config.json",
"pretest": "npm run build",
"watch": "npm run build -- -w | npx mocha --timeout 10000 --exit --reporter min -w test/*.test.js test/**/*.test.js",
"packagePacker": "yo @criticalmanufacturing/iot:packagePacker -o ."
"packagePacker": "packageBundler -d -o=."
},
"keywords": [
"CMF",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"watch": "npm run build -- -w | npx mocha --timeout 10000 --exit --reporter min -w test/*.test.js test/**/*.test.js",
"generateTask": "cmf new iot task",
"generateConverter": "cmf new iot converter",
"packagePacker": "yo @criticalmanufacturing/iot:packagePacker -o ."
"packagePacker": "packageBundler -d -o=."
},
"keywords": [
"CMF",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Angular 17 IoT packages

Version v11 has introduced a dependency between Connect IoT customization and the GUI. This means that the GUI in order to have the Connect IoT customization, will require in compile time access to the same. If you have Connect IoT customization you must have an html package.

## IoT to HTML relation

When generating the Connect IoT customization, you will now have to pass a new parameter htmlPackageLocation:

```powershell

cmf new iot --htmlPackageLocation Cmf.Custom.Baseline.HTML

```

This will introduce an entry in the [`cmfpackage.json`](../../../03-explore/config-files/cmfpackage.json/index.md) of the iot package with the related package. When building or packing the iot package it will now build and and pack the HTML package after building the IoT package.

## HTML to IoT relation

The reverse relation from the HTML package to the iot package has to be added manually. In order to do this, in your HTML package [`cmfpackage.json`](../../../03-explore/config-files/cmfpackage.json/index.md) add an "relatedPackages" entry, e.g.:

```json

"relatedPackages": [
{
"path": "../Cmf.Custom.Baseline.IoT/Cmf.Custom.Baseline.IoT.Packages",
"preBuild": true,
"postBuild": false,
"prePack": false,
"postPack": false
}]

```

Also, in the `package.json` of the html package, a dependency for the custom iot package should be created. For example, if you created a new library called connect-iot-controller-engine-custom-tasks:

```powershell

npm install ../Cmf.Custom.Baseline.IoT/Cmf.Custom.Baseline.IoT.Packages

```

This will add an entry in the `package.json` file like:

```json

"@criticalmanufacturing/connect-iot-controller-engine-custom-tasks": "file:../Cmf.Custom.Baseline.IoT/Cmf.Custom.Baseline.IoT

```

Add it to the gui `app.config.ts`:

```ts
import { Metadata as CustomTasks } from '@criticalmanufacturing/connect-iot-controller-engine-custom-tasks/metadata';

export const appConfig: ApplicationConfig = {
providers: [
provideRouter(routes),
provideServiceWorker('ngsw-loader-worker.js', {
enabled: !isDevMode(),
registrationStrategy: 'registerWhenStable:30000'
}),
provideMesUI(
{
tasks: [
CustomTasks
]
}
),
provideMetadataRouter()
]
};
```
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ A full description of each package is available at [Layers Packages Concept](../

This section guides you through creating a traditional project scaffold. Adapt the commands based on your specific project requirements and adaptions documented on the [Layers Packages Concept](../../../concepts/layers-packages/index.md) page:

=== "MES v10 or above"
=== "MES v11 or above"

``` powershell
#Go to your project root
Expand Down Expand Up @@ -63,10 +63,47 @@ This section guides you through creating a traditional project scaffold. Adapt t
cmf new grafana

# Create IoT Package Layer (Optional)
cmf new iot --htmlPackageLocation .\Cmf.Custom.Html
cmf new iot

# Create IoT Package Layer for Angular (Optional)
cmf new iot --isAngular true --htmlPackageLocation .\Cmf.Custom.Html
```
Make sure to follow all the steps [here](../../../concepts/layers-packages/angular-17-iot-packages.md). Otherwise, you can have unexpected errors in the package. For IoT feel free to check [here](../../../../03-explore/guides/IoT-on-MES-v11/index.md).

=== "MES v10 or above"

Make sure to follow all the steps [here](../../../concepts/layers-packages/angular-15-iot-packages.md). Otherwise, you can have unexpected errors in the package.
``` powershell
#Go to your project root
cd {{project_root_path}}

#Create Business Package Layer
cmf new business

# Create Data Package Layer
cmf new data --businessPackage .\Cmf.Custom.Business\

# Create HTML Package Layer
cmf new html

# Create Help Package Layer
cmf new help

# Create Test Package Layer
cmf new test

# Create Database Package Layer (Optional)
cmf new database

# Create Microsoft Reporting Services Package (Optional)
cmf new reporting

# Create a grafana Package Layer (optional)
cmf new grafana

# Create IoT Package Layer (Optional)
cmf new iot --htmlPackageLocation .\Cmf.Custom.Html
```
Make sure to follow all the steps [here](../../../concepts/layers-packages/angular-15-iot-packages.md). Otherwise, you can have unexpected errors in the package. For IoT feel free to check [here](../../../../03-explore/guides/IoT-on-MES-v10/index.md)

=== "MES v9 or below"

Expand Down
24 changes: 13 additions & 11 deletions docs/src/03-explore/commands/new_iot.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,25 @@ cmf new iot [options] [<workingDir>] [command]

### Arguments

Name | Description
---- | -----------
`<workingDir>` | Working Directory [default: ]
| Name | Description |
| -------------- | ----------------------------- |
| `<workingDir>` | Working Directory [default: ] |

### Options

Name | Description
---- | -----------
`--version <version>` | Package Version [default: 1.0.0]
`-?, -h, --help` | Show help and usage information
| Name | Description |
| -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `--version <version>` | Package Version [default: 1.0.0] |
| `--isAngularPackage <isAngularPackage> (OPTIONAL)` | If true the Customization package is an angular package. [default: false] |
| `--htmlPackageLocation <htmlPackageLocation> (OPTIONAL)` | Location of the HTML Package (This is mandatory only if the package is an angular package and creates a link between the iot package and the UI) |
| `-?, -h, --help` | Show help and usage information |

### Commands

Name | Description
---- | -----------
`configuration <path>` | [default: .]
`customization <packagePath>` | [default: .]
| Name | Description |
| ----------------------------- | ------------ |
| `configuration <path>` | [default: .] |
| `customization <packagePath>` | [default: .] |


<!-- END USAGE -->
26 changes: 26 additions & 0 deletions docs/src/03-explore/commands/new_iot_businessScenario.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# new iot businessScenario

<!-- BEGIN USAGE -->

Usage
-----

```
cmf new iot businessScenario [options] [<workingDir>] [command]
```

This command generates a new task library (connect iot package) for business scenarios. This command should be executed inside an IoT Package generated from the cmf new iot (the iot package must not be generated as an angular package).

### Arguments

| Name | Description |
| -------------- | ----------------------------- |
| `<workingDir>` | Working Directory [default: ] |

### Options

| Name | Description |
| ---------------- | ------------------------------- |
| `-?, -h, --help` | Show help and usage information |

<!-- END USAGE -->
26 changes: 26 additions & 0 deletions docs/src/03-explore/commands/new_iot_converter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# new iot converter

<!-- BEGIN USAGE -->

Usage
-----

```
cmf new iot converter [options] [<workingDir>] [command]
```

This command generates a new connect iot converter. This command should be executed inside a task library generated from the cmf new iot taskLibrary.

### Arguments

| Name | Description |
| -------------- | ----------------------------- |
| `<workingDir>` | Working Directory [default: ] |

### Options

| Name | Description |
| ---------------- | ------------------------------- |
| `-?, -h, --help` | Show help and usage information |

<!-- END USAGE -->
26 changes: 26 additions & 0 deletions docs/src/03-explore/commands/new_iot_driver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# new iot driver

<!-- BEGIN USAGE -->

Usage
-----

```
cmf new iot driver [options] [<workingDir>] [command]
```

This command generates a new task library (connect iot package) for drivers. This command should be executed inside an IoT Package generated from the cmf new iot (the iot package must not be generated as an angular package).

### Arguments

| Name | Description |
| -------------- | ----------------------------- |
| `<workingDir>` | Working Directory [default: ] |

### Options

| Name | Description |
| ---------------- | ------------------------------- |
| `-?, -h, --help` | Show help and usage information |

<!-- END USAGE -->
26 changes: 26 additions & 0 deletions docs/src/03-explore/commands/new_iot_task.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# new iot task

<!-- BEGIN USAGE -->

Usage
-----

```
cmf new iot task [options] [<workingDir>] [command]
```

This command generates a new connect iot task. This command should be executed inside a task library generated from the cmf new iot taskLibrary.

### Arguments

| Name | Description |
| -------------- | ----------------------------- |
| `<workingDir>` | Working Directory [default: ] |

### Options

| Name | Description |
| ---------------- | ------------------------------- |
| `-?, -h, --help` | Show help and usage information |

<!-- END USAGE -->
26 changes: 26 additions & 0 deletions docs/src/03-explore/commands/new_iot_taskLibrary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# new iot taskLibrary

<!-- BEGIN USAGE -->

Usage
-----

```
cmf new iot taskLibrary [options] [<workingDir>] [command]
```

This command generates a new task library (connect iot package). This command should be executed inside an IoT Package generated from the cmf new iot (the iot package must not be generated as an angular package).

### Arguments

| Name | Description |
| -------------- | ----------------------------- |
| `<workingDir>` | Working Directory [default: ] |

### Options

| Name | Description |
| ---------------- | ------------------------------- |
| `-?, -h, --help` | Show help and usage information |

<!-- END USAGE -->
35 changes: 35 additions & 0 deletions docs/src/03-explore/guides/IoT-on-MES-v10/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,43 @@ The `IoT.Packages` should be used as the workspace to create new TasksLibraries

In a clean run where the goal would be to create a new custom task, we would do the following steps:

```bash
cmf new iot
```

![New IoT Scaffolding Demo](cmf_new_iot.gif "New IoT Scaffolding")

To generate a TaskLibrary package with a task, we would execute the following steps:

```bash
npm run generateTaskLibrary
```

```bash
npm run generateTask
```

```bash
npm run generateConverter
```

![Generate Task Library Package Demo](generate_tasklibrary.gif "Generate Task Library Package")

## For Angular

The user can still generate angular task libraries. These will not use Automation Task Libraries and will be angular components. After generating the iot package for angular. Generate the iot components.

In order to generate a new task library (connect iot package) run:

```bash
ng generate library
```

In the generated task library (connect iot package). Tasks and converters can be generated by running:
```bash
ng g @criticalmanufacturing/ngx-iot-schematics:task <name>
```

```bash
ng g @criticalmanufacturing/ngx-iot-schematics:converter <name>
```
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading