feat(marketplace): add separate package and move some entities in it (#1283)

* feat(marketplace): add separate package and move some entities in it

* feat(marketplace): refactor release notes and list

* feat(marketplace): refactor showing a package

* chore: fix install progress

* chore: fix angular.json

* chore: properly share stream
This commit is contained in:
Alex Inkin
2022-03-15 20:11:54 +03:00
committed by GitHub
parent 72cb451f5a
commit 8942c29229
115 changed files with 1848 additions and 1457 deletions

View File

@@ -20,16 +20,12 @@
</ion-item>
<ion-item
[button]="mp.id !== selectedId"
detail="false"
*ngFor="let mp of marketplaces"
detail="false"
[button]="mp.id !== selectedId"
(click)="presentAction(mp.id)"
>
<div
*ngIf="mp.id !== selectedId"
slot="start"
style="padding-right: 32px"
></div>
<div *ngIf="mp.id !== selectedId" slot="start" class="padding"></div>
<ion-icon
*ngIf="mp.id === selectedId"
slot="start"

View File

@@ -1,7 +1,12 @@
.skeleton-parts {
padding-bottom: 6px;
ion-button::part(native) {
padding-inline-start: 0;
padding-inline-end: 0;
};
padding-bottom: 6px;
}
}
}
.padding {
padding-right: 32px;
}

View File

@@ -1,19 +1,21 @@
import { Component } from '@angular/core'
import { Component, Inject } from '@angular/core'
import {
ActionSheetController,
LoadingController,
ModalController,
} from '@ionic/angular'
import { ApiService } from 'src/app/services/api/embassy-api.service'
import { ActionSheetButton } from '@ionic/core'
import { ErrorToastService } from 'src/app/services/error-toast.service'
import { ErrorToastService } from '@start9labs/shared'
import { AbstractMarketplaceService } from '@start9labs/marketplace'
import { ApiService } from 'src/app/services/api/embassy-api.service'
import { ValueSpecObject } from 'src/app/pkg-config/config-types'
import { GenericFormPage } from 'src/app/modals/generic-form/generic-form.page'
import { PatchDbService } from '../../../services/patch-db/patch-db.service'
import { v4 } from 'uuid'
import { MarketplaceService } from '../../marketplace-routes/marketplace.service'
import { UIMarketplaceData } from '../../../services/patch-db/data-model'
import { ConfigService } from '../../../services/config.service'
import { MarketplaceService } from 'src/app/services/marketplace.service'
import { finalize, first } from 'rxjs/operators'
@Component({
selector: 'marketplaces',
@@ -30,6 +32,7 @@ export class MarketplacesPage {
private readonly modalCtrl: ModalController,
private readonly errToast: ErrorToastService,
private readonly actionCtrl: ActionSheetController,
@Inject(AbstractMarketplaceService)
private readonly marketplaceService: MarketplaceService,
private readonly config: ConfigService,
public readonly patch: PatchDbService,
@@ -162,13 +165,13 @@ export class MarketplacesPage {
loader.message = 'Syncing store...'
try {
await this.marketplaceService.load()
} catch (e) {
this.errToast.present(e)
} finally {
loader.dismiss()
}
this.marketplaceService
.getPackages()
.pipe(
first(),
finalize(() => loader.dismiss()),
)
.subscribe()
}
private async delete(id: string): Promise<void> {
@@ -281,13 +284,13 @@ export class MarketplacesPage {
loader.message = 'Syncing marketplace data...'
try {
await this.marketplaceService.load()
} catch (e) {
this.errToast.present(e)
} finally {
loader.dismiss()
}
this.marketplaceService
.getPackages()
.pipe(
first(),
finalize(() => loader.dismiss()),
)
.subscribe()
}
}

View File

@@ -1,8 +1,7 @@
import { Component } from '@angular/core'
import { Metrics } from 'src/app/services/api/api.types'
import { ApiService } from 'src/app/services/api/embassy-api.service'
import { ErrorToastService } from 'src/app/services/error-toast.service'
import { pauseFor } from '@start9labs/shared'
import { pauseFor, ErrorToastService } from '@start9labs/shared'
@Component({
selector: 'server-metrics',

View File

@@ -8,13 +8,12 @@ import {
} from '@ionic/angular'
import { ApiService } from 'src/app/services/api/embassy-api.service'
import { ActivatedRoute } from '@angular/router'
import { ErrorToastService } from 'src/app/services/error-toast.service'
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
import { Observable, of } from 'rxjs'
import { filter, map, take } from 'rxjs/operators'
import { WizardBaker } from 'src/app/components/install-wizard/prebaked-wizards'
import { wizardModal } from 'src/app/components/install-wizard/install-wizard.component'
import { exists, isEmptyObject } from '@start9labs/shared'
import { exists, isEmptyObject, ErrorToastService } from '@start9labs/shared'
import { EOSService } from 'src/app/services/eos.service'
import { ServerStatus } from 'src/app/services/patch-db/data-model'

View File

@@ -1,6 +1,6 @@
import { Component } from '@angular/core'
import { AlertController, LoadingController } from '@ionic/angular'
import { ErrorToastService } from 'src/app/services/error-toast.service'
import { ErrorToastService } from '@start9labs/shared'
import { ApiService } from 'src/app/services/api/embassy-api.service'
import { PlatformType, RR } from 'src/app/services/api/api.types'
@@ -13,16 +13,16 @@ export class SessionsPage {
loading = true
sessionInfo: RR.GetSessionsRes
constructor (
constructor(
private readonly loadingCtrl: LoadingController,
private readonly errToast: ErrorToastService,
private readonly alertCtrl: AlertController,
private readonly embassyApi: ApiService,
) { }
) {}
async ngOnInit () {
async ngOnInit() {
try {
this.sessionInfo = await this.embassyApi.getSessions({ })
this.sessionInfo = await this.embassyApi.getSessions({})
} catch (e) {
this.errToast.present(e)
} finally {
@@ -30,7 +30,7 @@ export class SessionsPage {
}
}
async presentAlertKill (id: string) {
async presentAlertKill(id: string) {
const alert = await this.alertCtrl.create({
header: 'Caution',
message: `Are you sure you want to kill this session?`,
@@ -51,7 +51,7 @@ export class SessionsPage {
await alert.present()
}
async kill (id: string): Promise<void> {
async kill(id: string): Promise<void> {
const loader = await this.loadingCtrl.create({
spinner: 'lines',
message: 'Killing session...',
@@ -69,7 +69,7 @@ export class SessionsPage {
}
}
getPlatformIcon (platforms: PlatformType[]): string {
getPlatformIcon(platforms: PlatformType[]): string {
if (platforms.includes('cli')) {
return 'terminal-outline'
} else if (platforms.includes('desktop')) {
@@ -79,7 +79,7 @@ export class SessionsPage {
}
}
getPlatformName (platforms: PlatformType[]): string {
getPlatformName(platforms: PlatformType[]): string {
if (platforms.includes('cli')) {
return 'CLI'
} else if (platforms.includes('desktop')) {
@@ -97,7 +97,7 @@ export class SessionsPage {
}
}
asIsOrder (a: any, b: any) {
asIsOrder(a: any, b: any) {
return 0
}
}

View File

@@ -1,9 +1,16 @@
import { Component } from '@angular/core'
import { AlertController, LoadingController, ModalController } from '@ionic/angular'
import {
AlertController,
LoadingController,
ModalController,
} from '@ionic/angular'
import { SSHKey } from 'src/app/services/api/api.types'
import { ErrorToastService } from 'src/app/services/error-toast.service'
import { ErrorToastService } from '@start9labs/shared'
import { ApiService } from 'src/app/services/api/embassy-api.service'
import { GenericInputComponent, GenericInputOptions } from 'src/app/modals/generic-input/generic-input.component'
import {
GenericInputComponent,
GenericInputOptions,
} from 'src/app/modals/generic-input/generic-input.component'
@Component({
selector: 'ssh-keys',
@@ -15,21 +22,21 @@ export class SSHKeysPage {
sshKeys: SSHKey[] = []
readonly docsUrl = 'https://start9.com/latest/user-manual/ssh'
constructor (
constructor(
private readonly loadingCtrl: LoadingController,
private readonly modalCtrl: ModalController,
private readonly errToast: ErrorToastService,
private readonly alertCtrl: AlertController,
private readonly embassyApi: ApiService,
) { }
) {}
async ngOnInit () {
async ngOnInit() {
await this.getKeys()
}
async getKeys (): Promise<void> {
async getKeys(): Promise<void> {
try {
this.sshKeys = await this.embassyApi.getSshKeys({ })
this.sshKeys = await this.embassyApi.getSshKeys({})
} catch (e) {
this.errToast.present(e)
} finally {
@@ -37,7 +44,7 @@ export class SSHKeysPage {
}
}
async presentModalAdd () {
async presentModalAdd() {
const { name, description } = sshSpec
const options: GenericInputOptions = {
@@ -55,7 +62,7 @@ export class SSHKeysPage {
await modal.present()
}
async add (pubkey: string): Promise<void> {
async add(pubkey: string): Promise<void> {
const loader = await this.loadingCtrl.create({
spinner: 'lines',
message: 'Saving...',
@@ -71,7 +78,7 @@ export class SSHKeysPage {
}
}
async presentAlertDelete (i: number) {
async presentAlertDelete(i: number) {
const alert = await this.alertCtrl.create({
header: 'Caution',
message: `Are you sure you want to delete this key?`,
@@ -92,7 +99,7 @@ export class SSHKeysPage {
await alert.present()
}
async delete (i: number): Promise<void> {
async delete(i: number): Promise<void> {
const loader = await this.loadingCtrl.create({
spinner: 'lines',
message: 'Deleting...',
@@ -115,7 +122,8 @@ export class SSHKeysPage {
const sshSpec = {
type: 'string',
name: 'SSH Key',
description: 'Enter the SSH public key of you would like to authorize for root access to your Embassy.',
description:
'Enter the SSH public key of you would like to authorize for root access to your Embassy.',
nullable: false,
masked: false,
copyable: false,

View File

@@ -9,10 +9,9 @@ import {
import { AlertInput } from '@ionic/core'
import { ApiService } from 'src/app/services/api/embassy-api.service'
import { ActionSheetButton } from '@ionic/core'
import { ErrorToastService } from 'src/app/services/error-toast.service'
import { ValueSpecObject } from 'src/app/pkg-config/config-types'
import { RR } from 'src/app/services/api/api.types'
import { pauseFor } from '@start9labs/shared'
import { pauseFor, ErrorToastService } from '@start9labs/shared'
import { GenericFormPage } from 'src/app/modals/generic-form/generic-form.page'
import { ConfigService } from 'src/app/services/config.service'