Skip to content

Commit

Permalink
fix: admin-shell-io support
Browse files Browse the repository at this point in the history
  • Loading branch information
ralfaron committed Jul 28, 2024
1 parent ec767dc commit 31d91cd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 22 deletions.
11 changes: 3 additions & 8 deletions projects/aas-lib/src/lib/aas-tree/aas-tree.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,16 @@
<div class="ms-1 w-9 rounded bg-info text-white ts-small text-center">
{{node.abbreviation}}</div>

@if (node.hasSemantic) {
<div class="ms-1 flex-grow-1 text-nowrap">
@if (node.hasSemantic) {
<a (click)="openSubmodel(node.submodel)" href="javascript:void(0);">{{node.name}}</a>
<span class="text-secondary">&nbsp;[</span>
<span class="text-secondary text-nowrap">{{node.typeInfo}}</span>
<span class="text-secondary">]</span>
</div>
}@else {
<div class="ms-1 flex-grow-1 text-nowrap">
}@else {
<b>{{node.name}}</b>
}
<span class="text-secondary">&nbsp;[</span>
<span class="text-secondary text-nowrap">{{node.typeInfo}}</span>
<span class="text-secondary">]</span>
</div>
}
</div>
</td>
@if (node.isLeaf) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import cloneDeep from 'lodash-es/cloneDeep';
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { NgbActiveModal, NgbToast } from '@ng-bootstrap/ng-bootstrap';
import { TranslateService } from '@ngx-translate/core';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { AASTreeApiService } from '../aas-tree-api.service';
import { messageToString } from '../../convert';
import { ERRORS } from '../../types/errors';
Expand Down Expand Up @@ -42,7 +42,7 @@ export interface VariableItem {
templateUrl: './operation-call-form.component.html',
styleUrls: ['./operation-call-form.component.scss'],
standalone: true,
imports: [NgbToast, FormsModule],
imports: [NgbToast, FormsModule, TranslateModule],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class OperationCallFormComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import {
import { encodeBase64Url } from '../../convert.js';
import { AASApiClient } from './aas-api-client.js';
import { Logger } from '../../logging/logger.js';
import { JsonWriterV3 } from '../json-writer-v3.js';
import * as aasv2 from '../../types/aas-v2.js';
import { JsonReaderV2 } from '../json-reader-v2.js';
import { JsonWriterV2 } from '../json-writer-v2.js';

interface PackageDescriptor {
aasIds: string[];
Expand Down Expand Up @@ -51,7 +51,7 @@ export class AASApiClientV1 extends AASApiClient {
super(logger, url, name);
}

public override readonly version = 'v3';
public override readonly version = 'v1';

public readonly readOnly = false;

Expand Down Expand Up @@ -79,7 +79,10 @@ export class AASApiClientV1 extends AASApiClient {
}
}

const result = await this.message.get<aasv2.ConceptDescription[]>(this.resolve(`concept-descriptions`));
const conceptDescriptions = await this.message.get<aasv2.ConceptDescription[]>(
this.resolve(`concept-descriptions`),
);

const asset: aasv2.Asset = {
kind: 'Instance',
identification: { idType: shell.asset.keys[0].idType, id: shell.asset.keys[0].value },
Expand All @@ -91,7 +94,7 @@ export class AASApiClientV1 extends AASApiClient {
assetAdministrationShells: [shell],
assets: [asset],
submodels,
conceptDescriptions: result,
conceptDescriptions,
};

return new JsonReaderV2(sourceEnv).readEnvironment();
Expand Down Expand Up @@ -204,21 +207,21 @@ export class AASApiClientV1 extends AASApiClient {

private async putShellAsync(shell: aas.AssetAdministrationShell): Promise<string> {
const aasId = encodeBase64Url(shell.id);
return await this.message.put(this.resolve(`shells/${aasId}`), new JsonWriterV3().convert(shell));
return await this.message.put(this.resolve(`shells/${aasId}`), new JsonWriterV2().convert(shell));
}

private async putSubmodelAsync(aasId: string, submodel: aas.Submodel): Promise<string> {
const smId = encodeBase64Url(submodel.id);
return await this.message.put(
this.resolve(`shells/${aasId}/submodels/${smId}`),
new JsonWriterV3().convert(submodel),
this.resolve(`shells/${aasId}/submodels/${smId}/submodel`),
new JsonWriterV2().convert(submodel),
);
}

private async postSubmodelAsync(aasId: string, submodel: aas.Submodel): Promise<string> {
return await this.message.post(
this.resolve(`submodels?aasIdentifier=${aasId}`),
new JsonWriterV3().convert(submodel),
new JsonWriterV2().convert(submodel),
);
}

Expand All @@ -233,8 +236,8 @@ export class AASApiClientV1 extends AASApiClient {
const smId = encodeBase64Url(submodel.id);
const path = getIdShortPath(submodelElement);
return await this.message.put(
this.resolve(`submodels/${smId}/submodel-elements/${path}`),
new JsonWriterV3().convert(submodelElement),
this.resolve(`submodels/${smId}/submodel/submodel-elements/${path}`),
new JsonWriterV2().convert(submodelElement),
);
}

Expand All @@ -245,8 +248,8 @@ export class AASApiClientV1 extends AASApiClient {
const smId = encodeBase64Url(submodel.id);
const path = getIdShortPath(submodelElement);
return await this.message.post(
this.resolve(`submodels/${smId}/submodel-elements/${path}`),
new JsonWriterV3().convert(submodelElement),
this.resolve(`submodels/${smId}/submodel/submodel-elements/${path}`),
new JsonWriterV2().convert(submodelElement),
);
}

Expand Down

0 comments on commit 31d91cd

Please sign in to comment.