Skip to content

Commit

Permalink
remove hb-ui card from plugins page (#1830)
Browse files Browse the repository at this point in the history
  • Loading branch information
bwp91 committed Nov 25, 2023
1 parent fa209b3 commit dc45313
Show file tree
Hide file tree
Showing 45 changed files with 242 additions and 47 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All notable changes to homebridge-config-ui-x will be documented in this file.
### UI Changes

- add power options modal (#1820)
- remove hb-ui card from plugins page (#1830)

### Translation Changes

Expand Down
4 changes: 4 additions & 0 deletions ui/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ const routes: Routes = [
loadChildren: () => import('./modules/settings/settings.module').then(m => m.SettingsModule),
canActivate: [AdminGuard],
},
{
path: 'support',
loadChildren: () => import('./modules/support/support.module').then(m => m.SupportModule),
},
{
path: 'platform-tools',
loadChildren: () => import('./modules/platform-tools/platform-tools.module').then(m => m.PlatformToolsModule),
Expand Down
2 changes: 2 additions & 0 deletions ui/src/app/core/manage-plugins/manage-plugins.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { NgxMdModule } from 'ngx-md';
import { MonacoEditorModule } from 'ngx-monaco-editor';
import { BridgePluginsModalComponent } from './bridge-plugins-modal/bridge-plugins-modal.component';
import { CustomPluginsModule } from './custom-plugins/custom-plugins.module';
import { DonateModalComponent } from './donate-modal/donate-modal.component';
import { InterpolateMdPipe } from './interpolate-md.pipe';
import { ManagePluginsModalComponent } from './manage-plugins-modal/manage-plugins-modal.component';
import { ManagePluginsService } from './manage-plugins.service';
Expand All @@ -27,6 +28,7 @@ import { CoreModule } from '@/app/core/core.module';
ManualPluginConfigModalComponent,
SelectPreviousVersionComponent,
BridgePluginsModalComponent,
DonateModalComponent,
],
imports: [
CommonModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ <h5 class="modal-title">
</div>
<div class="modal-body">
<div>
<markdown class="plugin-md" [data]="schema.headerDisplay | interpolateMd"
*ngIf="schema.headerDisplay"></markdown>
<markdown class="plugin-md" [data]="schema.headerDisplay | interpolateMd" *ngIf="schema.headerDisplay"></markdown>
</div>
<div class="text-center mb-4" *ngIf="plugin.name === 'homebridge-config-ui-x'">
<button class="btn btn-primary" type="button" (click)="openFundingModalForUi()">
<i class="fa fa-fw fa-heart red-text pr-2"></i>
<span translate="plugins.donate.ui" [translateParams]="{ author: 'oznu' }"></span>
</button>
</div>

<!-- MULTIPLE CONFIG BLOCKS-->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Component, Input, OnInit } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { TranslateService } from '@ngx-translate/core';
import { ToastrService } from 'ngx-toastr';
import { v4 as uuid } from 'uuid';
import { ApiService } from '@/app/core/api.service';
import { NotificationService } from '@/app/core/notification.service';
import { SettingsService } from '@/app/core/settings.service';
import { DonateModalComponent } from '@/app/core/manage-plugins/donate-modal/donate-modal.component';

Check warning on line 9 in ui/src/app/core/manage-plugins/settings-plugins-modal/settings-plugins-modal.component.ts

View workflow job for this annotation

GitHub Actions / lint / ESLint

`@/app/core/manage-plugins/donate-modal/donate-modal.component` import should occur before import of `@/app/core/notification.service`

Check warning on line 9 in ui/src/app/core/manage-plugins/settings-plugins-modal/settings-plugins-modal.component.ts

View workflow job for this annotation

GitHub Actions / publish / publish_npm

`@/app/core/manage-plugins/donate-modal/donate-modal.component` import should occur before import of `@/app/core/notification.service`

export interface PluginConfigBlock {
config: Record<string, any>;
Expand All @@ -32,16 +33,13 @@ export class SettingsPluginsModalComponent implements OnInit {
constructor(
public activeModal: NgbActiveModal,
private $api: ApiService,
private $modal: NgbModal,
private $settings: SettingsService,
private $notification: NotificationService,
private $toastr: ToastrService,
private translate: TranslateService,
) {}

get arrayKey() {
return this.pluginType === 'accessory' ? 'accessories' : 'platforms';
}

ngOnInit() {
this.pluginAlias = this.schema.pluginAlias;
this.pluginType = this.schema.pluginType;
Expand Down Expand Up @@ -149,4 +147,16 @@ export class SettingsPluginsModalComponent implements OnInit {
};
}
}

openFundingModalForUi() {
try {
this.$api.get('/plugins').subscribe((plugins) => {
this.activeModal.dismiss();
const ref = this.$modal.open(DonateModalComponent);
ref.componentInstance.plugin = plugins.find((x) => x.name === 'homebridge-config-ui-x');
});
} catch (e) {
// ignore
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ <h4 class="card-title mb-0">
<div class="dropdown-divider" *ngIf="plugin.links.homepage || plugin.links.npm"></div>
<a ngbDropdownItem target="_blank" rel="noopener noreferrer" class="text-decoration-none"
*ngIf="plugin.name === 'homebridge-config-ui-x'" href="/swagger">
<i class="fas fa-fw fa-passport"></i> {{ 'plugins.button_api_documentation' | translate }}
<i class="fas fa-fw fa-passport"></i> API Documentation
</a>
<a ngbDropdownItem target="_blank" rel="noopener noreferrer" class="text-decoration-none"
*ngIf="plugin.links.homepage || plugin.links.npm" [href]="plugin.links.homepage || plugin.links.npm">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { ToastrService } from 'ngx-toastr';
import { ApiService } from '@/app/core/api.service';
import { ConfirmComponent } from '@/app/core/components/confirm/confirm.component';
import { InformationComponent } from '@/app/core/components/information/information.component';
import { DonateModalComponent } from '@/app/core/manage-plugins/donate-modal/donate-modal.component';
import { ManagePluginsService } from '@/app/core/manage-plugins/manage-plugins.service';
import { MobileDetectService } from '@/app/core/mobile-detect.service';
import { NotificationService } from '@/app/core/notification.service';
import { WsService } from '@/app/core/ws.service';
import { DonateModalComponent } from '@/app/modules/plugins/donate-modal/donate-modal.component';

@Component({
selector: 'app-plugin-card',
Expand Down
7 changes: 5 additions & 2 deletions ui/src/app/modules/plugins/plugins.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@
<a class="hb-npm-search-clear" href="javascript:void(0)" (click)="onClearSearch()">
<i class="far fa-fw fa-times-circle" *ngIf="form.controls['query'].value"></i>
</a>

</form>
</div>
</div>

<div class="d-flex flex-wrap justify-content-between">
<div class="hb-plugin-space-between" *ngFor="let plugin of installedPlugins">
<app-plugin-card [plugin]="plugin" [childBridges]="getPluginChildBridges(plugin)"></app-plugin-card>
<app-plugin-card [plugin]="plugin" [childBridges]="getPluginChildBridges(plugin)" *ngIf="plugin.name !== 'homebridge-config-ui-x'"></app-plugin-card>
</div>
<div class="alert alert-info mt-4 text-center w-100" *ngIf="installedPlugins.length <= 1 && !loading">
<i class="fas fa-fw fa-magnifying-glass primary-text my-3" style="font-size: 75px;"></i>
<p>{{ 'plugins.placeholder_search_first' | translate }}</p>
</div>
</div>
2 changes: 0 additions & 2 deletions ui/src/app/modules/plugins/plugins.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { TranslateModule } from '@ngx-translate/core';
import { DonateModalComponent } from './donate-modal/donate-modal.component';
import { PluginCardComponent } from './plugin-card/plugin-card.component';
import { PluginsRoutingModule } from './plugins-routing.module';
import { PluginsComponent } from './plugins.component';
Expand All @@ -13,7 +12,6 @@ import { ManagePluginsModule } from '@/app/core/manage-plugins/manage-plugins.mo
@NgModule({
declarations: [
PluginsComponent,
DonateModalComponent,
PluginCardComponent,
],
imports: [
Expand Down
16 changes: 16 additions & 0 deletions ui/src/app/modules/support/support-routing.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { SupportComponent } from './support.component';

const routes: Routes = [
{
path: '',
component: SupportComponent,
},
];

@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class SupportRoutingModule {}
14 changes: 14 additions & 0 deletions ui/src/app/modules/support/support.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<div class="d-flex justify-content-between">
<h3 class="primary-text m-0">{{ 'support.title' | translate }}</h3>
</div>
<div class="mb-3">
<h5 class="primary-text mt-3">{{ 'support.developers.title' | translate }}</h5>
<ul class="list-group mt-2">
<li class="list-group-item d-flex justify-content-between align-items-center">
<span class="pr-2">{{ 'support.developers.item_swagger' | translate }}</span>
<a class="btn btn-primary waves-effect m-0" href="/swagger" target="_blank" rel="noopener noreferrer">
<i class="fas fa-fw fa-external-link-alt"></i>
</a>
</li>
</ul>
</div>
Empty file.
15 changes: 15 additions & 0 deletions ui/src/app/modules/support/support.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
import { SettingsService } from '@/app/core/settings.service';

@Component({
selector: 'app-support',
templateUrl: './support.component.html',
styleUrls: ['./support.component.scss'],
})
export class SupportComponent implements OnInit {
constructor(
public $settings: SettingsService,
) {}

ngOnInit(): void {}
}
21 changes: 21 additions & 0 deletions ui/src/app/modules/support/support.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { ReactiveFormsModule } from '@angular/forms';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { TranslateModule } from '@ngx-translate/core';
import { SupportRoutingModule } from './support-routing.module';
import { SupportComponent } from './support.component';

@NgModule({
declarations: [
SupportComponent,
],
imports: [
CommonModule,
SupportRoutingModule,
NgbModule,
ReactiveFormsModule,
TranslateModule,
],
})
export class SupportModule {}
10 changes: 4 additions & 6 deletions ui/src/app/shared/layout/layout.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,13 @@
<a class="dropdown-item waves-effect waves-light" routerLink="/users" *ngIf=" $auth.user.admin">
{{'menu.tooltip_user_accounts' | translate}}
</a>


<div class="dropdown-divider waves-effect waves-light" *ngIf="$auth.user.admin"></div>
<div class="dropdown-divider" *ngIf="$auth.user.admin"></div>
<a class="dropdown-item waves-effect waves-light" routerLink="/support">
{{ 'support.title' | translate }}
</a>
<a href="javascript:void(0)" class="dropdown-item waves-effect waves-light" (click)="openRestartModal()" *ngIf="$auth.user.admin">
{{ 'menu.restart.title' | translate }}
</a>


<div class="dropdown-divider" *ngIf="$settings.formAuth && $auth.user.admin"></div>
<a href="javascript:void(0)" class="dropdown-item waves-effect waves-light" (click)="$auth.logout()" *ngIf="$settings.formAuth">
{{ 'menu.tooltip_logout' | translate }} - {{ $auth.user.username }}
</a>
Expand Down
6 changes: 5 additions & 1 deletion ui/src/i18n/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@
"platform.linux.shutdown.title_shutting_down_server": "Сървъра се изключва",
"platform.version.message_service_restart_required": "Homebridge UI v{{ uiVersion }} has been installed, but the server service is still running v{{ serverVersion }}.",
"platform.version.title_service_restart_required": "Service Restart Required",
"plugins.button_api_documentation": "API Documentation",
"plugins.button_homepage": "Plugin Homepage",
"plugins.button_install": "Инсталирай",
"plugins.button_settings": "Настройки",
Expand All @@ -188,6 +187,7 @@
"plugins.donate.button_verified": "Проверен",
"plugins.donate.message_learn_more": "Learn more about donation links on plugins",
"plugins.donate.tile_donate_to": "Donate to {{ author }}",
"plugins.donate.ui": "UI developed by {{ author }}",
"plugins.manage.button_restart_now": "Рестартирай Homebridge сега",
"plugins.manage.child_bridge_button_restart_now": "Restart Child Bridges",
"plugins.manage.child_bridge_button_restart_now_one": "Restart Child Bridge",
Expand Down Expand Up @@ -225,6 +225,7 @@
"plugins.node_update.update_anyway": "Update Anyway",
"plugins.node_update_homebridge_ui_upgrade_and_try_again": "Please upgrade Node.js before updating Homebridge UI.",
"plugins.node_update_homebridge_upgrade_and_try_again": "Please upgrade Node.js before updating Homebridge.",
"plugins.placeholder_search_first": "Use the search bar above to find your first plugin",
"plugins.placeholder_search_plugin": "Търсете добавки, които да инсталирате…",
"plugins.settings.custom.homebridge-gsh.label_account_linked": "Account Linked",
"plugins.settings.custom.homebridge-gsh.label_link_account": "Link Account",
Expand Down Expand Up @@ -381,6 +382,9 @@
"status.widget.weather.label_config_required_help": "Please select your city in the widget settings.",
"status.widget.weather.label_search_for_your_city": "Search for your city:",
"status.widget.weather.title_weather": "Weather",
"support.developers.item_swagger": "Swagger Docs",
"support.developers.title": "Developers",
"support.title": "Support",
"toast.title_error": "Грешка",
"toast.title_success": "Успешно",
"toast.title_warning": "Внимание",
Expand Down
6 changes: 5 additions & 1 deletion ui/src/i18n/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@
"platform.linux.shutdown.title_shutting_down_server": "Apagant el servidor",
"platform.version.message_service_restart_required": "Homebridge UI v{{uiVersion}} ha estat instal·lat, però el servei encara segueix executant la v{{serverVersion}}.",
"platform.version.title_service_restart_required": "Reinici del servei obligatori",
"plugins.button_api_documentation": "Documentació de l'API",
"plugins.button_homepage": "Plugin Homepage",
"plugins.button_install": "Instal·lar",
"plugins.button_settings": "Ajustos",
Expand All @@ -188,6 +187,7 @@
"plugins.donate.button_verified": "Verificat",
"plugins.donate.message_learn_more": "Obteniu més informació sobre els enllaços de donació als plugins",
"plugins.donate.tile_donate_to": "Donar a {{ author }}",
"plugins.donate.ui": "UI developed by {{ author }}",
"plugins.manage.button_restart_now": "Reiniciar Homebridge",
"plugins.manage.child_bridge_button_restart_now": "Reiniciar Ponts Fills",
"plugins.manage.child_bridge_button_restart_now_one": "Reiniciar Pont Fill",
Expand Down Expand Up @@ -225,6 +225,7 @@
"plugins.node_update.update_anyway": "Actualitzar de totes maneres",
"plugins.node_update_homebridge_ui_upgrade_and_try_again": "Si us plau actualitza Node.js abans d'actualitzar Homebridge UI.",
"plugins.node_update_homebridge_upgrade_and_try_again": "Si us plau actualitza Node.js abans d'actualitzar Homebridge.",
"plugins.placeholder_search_first": "Use the search bar above to find your first plugin",
"plugins.placeholder_search_plugin": "Cercar plugins per instal·lar…",
"plugins.settings.custom.homebridge-gsh.label_account_linked": "Compte vinculada",
"plugins.settings.custom.homebridge-gsh.label_link_account": "Vincular compte",
Expand Down Expand Up @@ -381,6 +382,9 @@
"status.widget.weather.label_config_required_help": "Si us plau, selecciona la teva ciutat en la configuració del widget",
"status.widget.weather.label_search_for_your_city": "Cerca la teva ciutat:",
"status.widget.weather.title_weather": "Clima",
"support.developers.item_swagger": "Swagger Docs",
"support.developers.title": "Developers",
"support.title": "Support",
"toast.title_error": "Error",
"toast.title_success": "Èxit",
"toast.title_warning": "Avís",
Expand Down
6 changes: 5 additions & 1 deletion ui/src/i18n/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@
"platform.linux.shutdown.title_shutting_down_server": "Vypnutí serveru",
"platform.version.message_service_restart_required": "Homebridge UI verze{{ uiVersion }} bylo nainstalováno, ale server stále běží na verzi{{ serverVersion }}.",
"platform.version.title_service_restart_required": "Je Vyžadován Restart Služby",
"plugins.button_api_documentation": "API Documentation",
"plugins.button_homepage": "Plugin Homepage",
"plugins.button_install": "Instalovat",
"plugins.button_settings": "Nastavení",
Expand All @@ -188,6 +187,7 @@
"plugins.donate.button_verified": "Ověřeno",
"plugins.donate.message_learn_more": "Zjistěte více o odkazech podpory na pluginech",
"plugins.donate.tile_donate_to": "Podpořit {{ author }}",
"plugins.donate.ui": "UI developed by {{ author }}",
"plugins.manage.button_restart_now": "Restartujte Homebridge nyní",
"plugins.manage.child_bridge_button_restart_now": "Restart Child Bridges",
"plugins.manage.child_bridge_button_restart_now_one": "Restart Child Bridge",
Expand Down Expand Up @@ -225,6 +225,7 @@
"plugins.node_update.update_anyway": "Přesto aktualizovat",
"plugins.node_update_homebridge_ui_upgrade_and_try_again": "Před aktualizací Homebridge UI aktualizujte Node.js.",
"plugins.node_update_homebridge_upgrade_and_try_again": "Před aktualizací Homebridge aktualizujte Node.js.",
"plugins.placeholder_search_first": "Use the search bar above to find your first plugin",
"plugins.placeholder_search_plugin": "Vyhledejte pluginy k instalaci…",
"plugins.settings.custom.homebridge-gsh.label_account_linked": "Účet propojen",
"plugins.settings.custom.homebridge-gsh.label_link_account": "Propojit účet",
Expand Down Expand Up @@ -381,6 +382,9 @@
"status.widget.weather.label_config_required_help": "Vyberte své město v nastavení widgetu.",
"status.widget.weather.label_search_for_your_city": "Najděte své město:",
"status.widget.weather.title_weather": "Počasí",
"support.developers.item_swagger": "Swagger Docs",
"support.developers.title": "Developers",
"support.title": "Support",
"toast.title_error": "Chyba",
"toast.title_success": "Úspěch",
"toast.title_warning": "Varování",
Expand Down
6 changes: 5 additions & 1 deletion ui/src/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@
"platform.linux.shutdown.title_shutting_down_server": "Herunterfahren des Servers",
"platform.version.message_service_restart_required": "Homebridge UI v{{ uiVersion }} wurde installiert, aber der Serverdienst läuft immer noch mit v{{ serverVersion }}.",
"platform.version.title_service_restart_required": "Dienst-Neustart erforderlich",
"plugins.button_api_documentation": "API Documentation",
"plugins.button_homepage": "Plugin Homepage",
"plugins.button_install": "Installieren",
"plugins.button_settings": "Einstellungen",
Expand All @@ -188,6 +187,7 @@
"plugins.donate.button_verified": "Verifiziert",
"plugins.donate.message_learn_more": "Erfahre mehr über Spenden-Links bei Plugins",
"plugins.donate.tile_donate_to": "An {{ author }} spenden",
"plugins.donate.ui": "UI developed by {{ author }}",
"plugins.manage.button_restart_now": "Jetzt neustarten",
"plugins.manage.child_bridge_button_restart_now": "Restart Child Bridges",
"plugins.manage.child_bridge_button_restart_now_one": "Restart Child Bridge",
Expand Down Expand Up @@ -225,6 +225,7 @@
"plugins.node_update.update_anyway": "Dennoch updaten",
"plugins.node_update_homebridge_ui_upgrade_and_try_again": "Bitte update Node.js, bevor du Homebridge UI updatest.",
"plugins.node_update_homebridge_upgrade_and_try_again": "Bitte update Node.js, bevor du Homebridge updatest.",
"plugins.placeholder_search_first": "Use the search bar above to find your first plugin",
"plugins.placeholder_search_plugin": "Suche nach installierbaren Plugins …",
"plugins.settings.custom.homebridge-gsh.label_account_linked": "Konto verbunden",
"plugins.settings.custom.homebridge-gsh.label_link_account": "Konto verbinden",
Expand Down Expand Up @@ -381,6 +382,9 @@
"status.widget.weather.label_config_required_help": "Bitte wähle deine Stadt in den Widget-Einstellungen.",
"status.widget.weather.label_search_for_your_city": "Suche nach deiner Stadt:",
"status.widget.weather.title_weather": "Wetter",
"support.developers.item_swagger": "Swagger Docs",
"support.developers.title": "Developers",
"support.title": "Support",
"toast.title_error": "Fehler",
"toast.title_success": "Erfolgreich durchgeführt",
"toast.title_warning": "Warnung",
Expand Down
Loading

0 comments on commit dc45313

Please sign in to comment.