7 changed files with 232 additions and 21 deletions
File diff suppressed because one or more lines are too long
@ -0,0 +1,30 @@ |
|||||
|
<!-- |
||||
|
|
||||
|
Copyright © 2016-2026 The Thingsboard Authors |
||||
|
|
||||
|
Licensed under the Apache License, Version 2.0 (the "License"); |
||||
|
you may not use this file except in compliance with the License. |
||||
|
You may obtain a copy of the License at |
||||
|
|
||||
|
http://www.apache.org/licenses/LICENSE-2.0 |
||||
|
|
||||
|
Unless required by applicable law or agreed to in writing, software |
||||
|
distributed under the License is distributed on an "AS IS" BASIS, |
||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
|
See the License for the specific language governing permissions and |
||||
|
limitations under the License. |
||||
|
|
||||
|
--> |
||||
|
<div class="tb-card-content flex flex-col gap-2"> |
||||
|
@if (hasIotHubAccess) { |
||||
|
<div class="tb-card-header flex flex-col gap-2.5"> |
||||
|
<div class="tb-card-title-text">{{ 'widgets.iot-hub.title-text' | translate }} <a routerLink="/iot-hub">IoT Hub</a></div> |
||||
|
<mat-divider></mat-divider> |
||||
|
</div> |
||||
|
} @else { |
||||
|
<div class="tb-no-data-available"> |
||||
|
<div class="tb-no-data-bg"></div> |
||||
|
<div class="tb-no-data-text" translate>widgets.home.no-data-available</div> |
||||
|
</div> |
||||
|
} |
||||
|
</div> |
||||
@ -0,0 +1,46 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2026 The Thingsboard Authors |
||||
|
* |
||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
|
* you may not use this file except in compliance with the License. |
||||
|
* You may obtain a copy of the License at |
||||
|
* |
||||
|
* http://www.apache.org/licenses/LICENSE-2.0 |
||||
|
* |
||||
|
* Unless required by applicable law or agreed to in writing, software |
||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
|
* See the License for the specific language governing permissions and |
||||
|
* limitations under the License. |
||||
|
*/ |
||||
|
@import "../../../../../../../scss/constants"; |
||||
|
|
||||
|
:host { |
||||
|
.tb-card-header { |
||||
|
.tb-card-title-text { |
||||
|
font-size: 14px; |
||||
|
font-style: normal; |
||||
|
font-weight: 500; |
||||
|
line-height: 20px; |
||||
|
color: rgba(0, 0, 0, 0.76); |
||||
|
a { |
||||
|
display: inline-block; |
||||
|
font-weight: 500; |
||||
|
border: none; |
||||
|
color: $tb-primary-color; |
||||
|
} |
||||
|
} |
||||
|
.mat-divider { |
||||
|
margin-left: -16px; |
||||
|
margin-right: -16px; |
||||
|
@media #{$mat-md-lg} { |
||||
|
margin-left: -8px; |
||||
|
margin-right: -8px; |
||||
|
@media #{$mat-lt-lg} { |
||||
|
margin-left: -2px; |
||||
|
margin-right: -2px; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,57 @@ |
|||||
|
///
|
||||
|
/// Copyright © 2016-2026 The Thingsboard Authors
|
||||
|
///
|
||||
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
/// you may not use this file except in compliance with the License.
|
||||
|
/// You may obtain a copy of the License at
|
||||
|
///
|
||||
|
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
///
|
||||
|
/// Unless required by applicable law or agreed to in writing, software
|
||||
|
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
/// See the License for the specific language governing permissions and
|
||||
|
/// limitations under the License.
|
||||
|
///
|
||||
|
|
||||
|
import { Component, Input, OnInit } from '@angular/core'; |
||||
|
import { PageComponent } from '@shared/components/page.component'; |
||||
|
import { Authority } from '@shared/models/authority.enum'; |
||||
|
import { getCurrentAuthUser } from '@core/auth/auth.selectors'; |
||||
|
import { WidgetContext } from '@home/models/widget-component.models'; |
||||
|
|
||||
|
@Component({ |
||||
|
selector: 'tb-iot-hub-widget', |
||||
|
templateUrl: './iot-hub-widget.component.html', |
||||
|
styleUrls: ['./home-page-widget.scss', './iot-hub-widget.component.scss'], |
||||
|
standalone: false |
||||
|
}) |
||||
|
export class IotHubWidgetComponent extends PageComponent implements OnInit { |
||||
|
|
||||
|
@Input() |
||||
|
ctx: WidgetContext; |
||||
|
|
||||
|
authority = Authority; |
||||
|
|
||||
|
authUser = getCurrentAuthUser(this.store); |
||||
|
|
||||
|
hasIotHubAccess = true; |
||||
|
|
||||
|
constructor() { |
||||
|
super(); |
||||
|
} |
||||
|
|
||||
|
ngOnInit() { |
||||
|
this.ctx.overflowVisible = true; |
||||
|
this.hasIotHubAccess = [Authority.TENANT_ADMIN].includes(this.authUser.authority); |
||||
|
if (this.hasIotHubAccess) { |
||||
|
this.load(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private load() { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
Loading…
Reference in new issue