Skip to content

Commit

Permalink
#20: adds official release version select to install dialog (#30)
Browse files Browse the repository at this point in the history
* #20: adds official release version select to install dialog

* adds git repo references to package

* #28: renames install dialog field labels

* #28: renames tenant field label

* removes logging

* bump to v 2.1.1

---------

Co-authored-by: Dirk Peter <dirk.peter@softwareg.com>
  • Loading branch information
dirk-peter-c8y and Dirk Peter authored Feb 13, 2024
1 parent 78b0405 commit e1f3d13
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@

<loading-spinner [loading]="loadingReleases" [title]="'Loading latest release information'"></loading-spinner>

<div class="form-group">
<label for="release">{{'Official Releases' | translate }}</label>
<select id="release" [disabled]="!offcialReleases" [(ngModel)]="selectedRelease" (change)="setRelease()">
<option *ngFor="let release of offcialReleases" [ngValue]="release">{{ release.name }}</option>
</select>
</div>

<div class="form-group">
<label for="agent_url_connector">{{ 'Connector Jar' | translate }}</label>
<div class="input-group">
Expand Down Expand Up @@ -58,7 +65,7 @@ <h1 class="c8y-icon c8y-icon-duocolor c8y-icon-device-protocols"></h1>
</fieldset>

<fieldset>
<div class="legend form-block">{{' Talk2M Device Credentials' | translate }}</div>
<div class="legend form-block">{{'Device Credentials' | translate }}</div>

<div class="form-group">
<label for="agent_deviceuser">{{ 'Device Username' | translate }}</label>
Expand Down Expand Up @@ -99,23 +106,23 @@ <h1 class="c8y-icon c8y-icon-duocolor c8y-icon-device-protocols"></h1>
</div>

<div class="form-group">
<label for="c8y_tenant">{{ 'Tenant' | translate }}</label>
<label for="c8y_tenant">{{ 'Bootstrap Tenant' | translate }}</label>
<div class="input-group">
<input id="c8y_tenant" type="text" name="tenant" class="form-control" placeholder="management"
[(ngModel)]="config.c8yTenant" />
</div>
</div>

<div class="form-group">
<label for="c8y_user">{{ 'Username' | translate }}</label>
<label for="c8y_user">{{ 'Bootstrap Username' | translate }}</label>
<div class="input-group">
<input id="c8y_user" type="text" name="username" autocomplete="username" class="form-control" placeholder="devicebootstrap"
[(ngModel)]="config.c8yUsername" />
<input id="c8y_user" type="text" name="username" autocomplete="username" class="form-control"
placeholder="devicebootstrap" [(ngModel)]="config.c8yUsername" />
</div>
</div>

<div class="form-group">
<label for="c8y_pass">{{ 'Device Password' | translate }}</label>
<label for="c8y_pass">{{ 'Bootstrap Password' | translate }}</label>
<div class="input-group">
<input id="c8y_pass" name="password" autocomplete="current-password" class="form-control" placeholder="password"
[type]="showC8YPassword ? 'text' : 'password'" [(ngModel)]="config.c8yPassword" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export class AgentInstallOverlayComponent implements OnInit {
showPassword = false;
showC8YPassword = false;
loadingReleases = false;
offcialReleases: FlexyConnectorRelease[];
selectedRelease: FlexyConnectorRelease;
labels: ModalLabels = {
ok: 'Install Agent',
cancel: 'Cancel'
Expand Down Expand Up @@ -125,20 +127,21 @@ export class AgentInstallOverlayComponent implements OnInit {
this.closeSubject.next(null);
}

setRelease(release = this.selectedRelease): void {
this._config.url = {
connector: release.jar.download_url,
jvmrun: release.jvmRun.download_url,
cumulocity: release.configuration.download_url
};
}

private async fetchReleases(): Promise<void> {
this.loadingReleases = true;

try {
const releases = await this.flexyService.fetchConnectorReleases();
let latestRelease: FlexyConnectorRelease;

if (releases) latestRelease = releases[0];

this._config.url = {
connector: latestRelease.jar.download_url,
jvmrun: latestRelease.jvmRun.download_url,
cumulocity: latestRelease.configuration.download_url
};
this.offcialReleases = await this.flexyService.fetchConnectorReleases();
this.selectedRelease = this.offcialReleases[0];
this.setRelease();
} catch (err) {
console.warn('Could not load release list');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class BulkRegistrationComponent {
// actions
reboot(devices: EwonFlexyStructure[]): void {
const reboots: Promise<string>[] = [];
const config = { ...this.config, ...{ deviceUsername: 'adm', devicePassword: 'adm' } };
const config = { ...this.config, ...{ deviceUsername: 'adm', devicePassword: 'adm' } }; // TODO remove

devices.forEach((device) => reboots.push(this.flexyService.reboot(device.encodedName, config)));

Expand Down
23 changes: 1 addition & 22 deletions flexy-integration/services/flexy.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import { DeviceRegistrationService, IExternalIdentity, IManagedObject } from '@c
import {
EXTERNALID_FLEXY_SERIALTYPE,
EXTERNALID_TALK2M_SERIALTYPE,
FLEXY_CONNECTOR_RELEASE_LIST_URL,
FLEXY_CONNECTOR_VERSION,
FLEXY_EXTERNALID_FLEXY_PREFIX,
FLEXY_CONNECTOR_RELEASE_LIST_URL, FLEXY_EXTERNALID_FLEXY_PREFIX,
FLEXY_EXTERNALID_TALK2M_PREFIX
} from '@flexy/constants/flexy-integration.constants';
import {
Expand Down Expand Up @@ -162,7 +160,6 @@ export class FlexyService implements OnDestroy {
return this.externalIDService.getDeviceByExternalID(externalID, EXTERNALID_FLEXY_SERIALTYPE);
}

// TODO – CORS on request
async fetchConnectorReleases(): Promise<FlexyConnectorRelease[]> {
const releases: FlexyConnectorRelease[] = [];

Expand All @@ -184,24 +181,6 @@ export class FlexyService implements OnDestroy {
console.log('fetchConnectorReleases|error', error.message);
}

// TODO remove on successful data pull
const version = FLEXY_CONNECTOR_VERSION;
releases.push({
name: `v${version}`,
jar: {
name: `flexy-cumulocity-connector-${version}-full.jar`,
download_url: `https://cumulocity-connector.s3.eu-central-1.amazonaws.com/v${version}/flexy-cumulocity-connector-${version}-full.jar`
},
configuration: {
name: 'CumulocityConnectorConfig.json',
download_url: `https://cumulocity-connector.s3.eu-central-1.amazonaws.com/v${version}/CumulocityConnectorConfig.json`
},
jvmRun: {
name: 'jvmrun',
download_url: `https://cumulocity-connector.s3.eu-central-1.amazonaws.com/v${version}/jvmrun`
}
});

return releases;
}

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hms-flexy-integration-plugin",
"version": "2.0.11",
"version": "2.1.1",
"description": "Provides an interface to register HMS Flexy devices from Talk2M into Cumulocity.",
"scripts": {
"start": "c8ycli server -u https://devicecert-testtenant.eu-latest.cumulocity.com",
Expand All @@ -13,6 +13,14 @@
"keywords": ["cumulocity", "cumulocity-iot", "hms-flexy", "talk2m", "device-registration"],
"author": "softwareAG",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/SoftwareAG/cumulocity-flexy-integration-ui.git"
},
"bugs": {
"url": "https://github.com/SoftwareAG/cumulocity-flexy-integration-ui/issues"
},
"homepage": "https://github.com/SoftwareAG/cumulocity-flexy-integration-ui#readme",
"dependencies": {
"@angular/animations": "14.0.6",
"@angular/cdk": "14.1.2",
Expand Down

0 comments on commit e1f3d13

Please sign in to comment.