move registry component to shared marketplace lib

This commit is contained in:
Lucy Cifferello
2024-09-19 13:18:16 -04:00
parent 751ceab04e
commit f868a454d9
3 changed files with 11 additions and 10 deletions

View File

@@ -1,12 +1,7 @@
import { import { ChangeDetectionStrategy, Component, Input } from '@angular/core'
ChangeDetectionStrategy,
Component,
inject,
Input,
} from '@angular/core'
import { StoreIconComponentModule } from '@start9labs/marketplace'
import { TuiIcon, TuiTitle } from '@taiga-ui/core' import { TuiIcon, TuiTitle } from '@taiga-ui/core'
import { ConfigService } from 'src/app/services/config.service' import { StoreIconComponentModule } from './store-icon/store-icon.component.module'
import { MarketplaceConfig } from '@start9labs/shared'
@Component({ @Component({
standalone: true, standalone: true,
@@ -28,7 +23,8 @@ import { ConfigService } from 'src/app/services/config.service'
imports: [StoreIconComponentModule, TuiIcon, TuiTitle], imports: [StoreIconComponentModule, TuiIcon, TuiTitle],
}) })
export class MarketplaceRegistryComponent { export class MarketplaceRegistryComponent {
readonly marketplace = inject(ConfigService).marketplace @Input()
marketplace!: MarketplaceConfig
@Input() @Input()
registry!: { url: string; selected: boolean; name?: string } registry!: { url: string; selected: boolean; name?: string }

View File

@@ -27,6 +27,7 @@ export * from './components/store-icon/store-icon.component.module'
export * from './components/store-icon/store-icon.component' export * from './components/store-icon/store-icon.component'
export * from './components/menu/menu.component.module' export * from './components/menu/menu.component.module'
export * from './components/menu/menu.component' export * from './components/menu/menu.component'
export * from './components/registry.component'
export * from './services/marketplace.service' export * from './services/marketplace.service'
export * from './services/category.service' export * from './services/category.service'

View File

@@ -11,6 +11,7 @@ import {
import { import {
AbstractMarketplaceService, AbstractMarketplaceService,
StoreIconComponentModule, StoreIconComponentModule,
MarketplaceRegistryComponent,
} from '@start9labs/marketplace' } from '@start9labs/marketplace'
import { TuiDialogService, TuiIcon, TuiTitle, TuiButton } from '@taiga-ui/core' import { TuiDialogService, TuiIcon, TuiTitle, TuiButton } from '@taiga-ui/core'
import { PolymorpheusComponent } from '@taiga-ui/polymorpheus' import { PolymorpheusComponent } from '@taiga-ui/polymorpheus'
@@ -21,8 +22,8 @@ import { ApiService } from 'src/app/services/api/embassy-api.service'
import { DataModel, UIStore } from 'src/app/services/patch-db/data-model' import { DataModel, UIStore } from 'src/app/services/patch-db/data-model'
import { MarketplaceService } from 'src/app/services/marketplace.service' import { MarketplaceService } from 'src/app/services/marketplace.service'
import { FormDialogService } from 'src/app/services/form-dialog.service' import { FormDialogService } from 'src/app/services/form-dialog.service'
import { MarketplaceRegistryComponent } from '../components/registry.component'
import { getMarketplaceValueSpec, getPromptOptions } from '../utils/registry' import { getMarketplaceValueSpec, getPromptOptions } from '../utils/registry'
import { ConfigService } from 'src/app/services/config.service'
@Component({ @Component({
standalone: true, standalone: true,
@@ -33,6 +34,7 @@ import { getMarketplaceValueSpec, getPromptOptions } from '../utils/registry'
<button <button
tuiCell tuiCell
[disabled]="registry.selected" [disabled]="registry.selected"
[marketplace]="marketplaceConfig"
[registry]="registry" [registry]="registry"
(click)="connect(registry.url)" (click)="connect(registry.url)"
></button> ></button>
@@ -47,6 +49,7 @@ import { getMarketplaceValueSpec, getPromptOptions } from '../utils/registry'
<button <button
tuiCell tuiCell
[registry]="registry" [registry]="registry"
[marketplace]="marketplaceConfig"
(click)="connect(registry.url)" (click)="connect(registry.url)"
></button> ></button>
<button <button
@@ -95,6 +98,7 @@ export class MarketplaceRegistryModal {
'marketplace', 'marketplace',
'knownHosts', 'knownHosts',
) )
readonly marketplaceConfig = inject(ConfigService).marketplace
readonly stores$ = combineLatest([ readonly stores$ = combineLatest([
this.marketplace.getKnownHosts$(), this.marketplace.getKnownHosts$(),