Skip to content

MindSphere Web Components
Asset View

The Asset View displays assets available in the current tenant.

The view mode can be configured to display the assets as listed items, in a responsive grid container, or as tree using the parentId property. A search field and an asset count field are displayed by default, but can be hidden.

Example

The following pictures show the Asset View in different view modes.

List

List

Cards

Cards

Tree

Tree

Interface

Selector

1
<mdsp-asset-view></mdsp-asset-view>

Properties

Name Type Corresponding attribute Default Description Allowed Values
assetTypeFilter AssetTypeFilter Configures the asset types to be displayed, refer to AssetTypeFilter model.

Note that viewMode=Tree does not work in combination with assetTypeFilter.
cardColumnCount Number card-column-count 3 Configures the number of cards per row if view-mode is Card. 1-12
context string context Configures the context of the component. See also here.
countHidden boolean count-hidden false Hides the asset count field if true.
errorNotification boolean error-notification Enables error control if an error is thrown. This can be used for debug purposes.

For productive use, the error event should be caught and handled in the application. See also here.
locale string locale Specifies the locale in which the component is displayed.
The locales en and de are provided by default.
See also here.
localeManager LocaleManager Returns a LocaleManager object.

This can be used to add locales or to get the locale settings. See also here.
model IDataModel Returns an object for data model handling, refer to IDataModel model.
searchHidden boolean search-hidden false Hides the search field if true.
searchText string search-text Specifies the text in the search field (read or write).
selectedAsset IAsset Specifies the selected asset, refer to IAsset model.
selectedAssetId string selected-asset-id Specifies the ID of the selected asset.
sharedAssets boolean shared-assets false Specifies whether shared assets from other tenants are displayed.
subtenantFilter string subtenant-filter null Specifies whether only assets of a specific subtenant should be displayed.
Please use the subtenant id and not an asset id as the value.
view IViewModel Returns an object for view handling, refer to IViewModel model.
viewMode ViewMode view-mode List Configures the view mode. - List
- Card
- Tree

Events

Name Type Description
selectedAssetChanged EventEmitter<IAsset> Triggered when a new asset is selected.
searchTextChanged EventEmitter<string> Triggered when the search text changes.
connected EventEmitter<any> Triggered after the component is created, initialized and appended to the DOM tree.
error EventEmitter<MdspUiError> Triggered when an error occurs in the component or while accessing APIs. See also here.

Models

AssetTypeFilter
1
2
3
4
5
type AssetTypeFilter = AssetTypeFilterOptions | string[]
interface AssetTypeFilterOptions {
  supportedTypes: string[];  
  includeInheritance?: boolean;
}
IAsset
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
interface IAsset {
  assetId: string;
  tenantId: string;
  name: string;
  etag: number;
  externalId: string;
  t2Tenant: string;
  description: string;
  parentId: string;
  typeId: string;
  location: ILocation;
  variables: any[];
  aspects: any[];
  deleted: string;
  _links: any;
}
IDataModel
1
2
3
4
interface IDataModel {
  // forces reload of data // forces reload of data, e.g. re-loading the assets
  refresh(): void;
}
ILocation
1
2
3
4
5
6
7
8
9
interface ILocation {
  country: string;
  region: string;
  locality: string;
  streetAddress: string;
  postalCode: string;
  longitude: number;
  latitude: number;
}
IViewModel
1
2
3
interface IViewModel {
  refresh(): void;
}

Remarks

  • The Asset View currently supports up to 20,000 assets in list or tiles view mode.
  • The tree view mode currently supports up to 1,000 assets.
  • Virtually deleted assets are not displayed.

Roles

  • mdsp:core.AssetManagement.xxx (Asset Management API is used)

Snippets

Display Assets of a Specific Type

Use the assetypefilter parameter to only display assets of a specific type or of types derived from it.

1
2
3
// Set a filter for a specific asset type:
assetViewComp.assetTypeFilter = ["core.mcnano"];
// This displays all assets of type 'core.mcnano'.
1
2
3
4
5
// Set a filter for multiple asset types:
assetViewComp.assetTypeFilter = {
  supportedTypes: ["core.mcnano", "core.basicagent"]
};
// This displays all assets of type 'core.mcnano' or 'core.basicagent'.
1
2
3
4
5
6
// Set a filter to a specific asset type and all types derived from it:
assetViewComp.assetTypeFilter = {
  supportedTypes: ["core.basicagent"],
  includeInheritance: true
};
// This displays all assets of type 'core.basicagent' and types derived from it.

Refresh

The data model of the component can be refreshed, for example to update the view cyclically to get the latest asset changes:

1
assetViewComp.model.refresh();

Any questions left?

Ask the community


Except where otherwise noted, content on this site is licensed under the MindSphere Development License Agreement.