mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 18:31:52 +00:00
config actions and eos version marketplace
This commit is contained in:
committed by
Aiden McClelland
parent
54a65e465a
commit
bb72bdb9d1
@@ -56,15 +56,7 @@ export class AppActionsPage {
|
||||
|
||||
async handleAction (action: { key: string, value: Action }) {
|
||||
const status = this.pkg.installed.status
|
||||
if (!status.configured) {
|
||||
const alert = await this.alertCtrl.create({
|
||||
header: 'Forbidden',
|
||||
message: `Service must be properly configured in order to run "${action.value.name}"`,
|
||||
buttons: ['OK'],
|
||||
cssClass: 'alert-error-message enter-click',
|
||||
})
|
||||
await alert.present()
|
||||
} else if ((action.value['allowed-statuses'] as PackageMainStatus[]).includes(status.main.status)) {
|
||||
if ((action.value['allowed-statuses'] as PackageMainStatus[]).includes(status.main.status)) {
|
||||
if (!isEmptyObject(action.value['input-spec'])) {
|
||||
const modal = await this.modalCtrl.create({
|
||||
component: GenericFormPage,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { MarketplaceData, MarketplaceEOS, MarketplacePkg } from 'src/app/services/api/api.types'
|
||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
import { ConfigService } from 'src/app/services/config.service'
|
||||
import { Emver } from 'src/app/services/emver.service'
|
||||
import { PackageDataEntry } from 'src/app/services/patch-db/data-model'
|
||||
|
||||
@@ -18,12 +19,15 @@ export class MarketplaceService {
|
||||
constructor (
|
||||
private readonly api: ApiService,
|
||||
private readonly emver: Emver,
|
||||
private readonly config: ConfigService,
|
||||
) { }
|
||||
|
||||
async load (): Promise<void> {
|
||||
const [data, eos, pkgs] = await Promise.all([
|
||||
this.api.getMarketplaceData({ }),
|
||||
this.api.getEos({ }),
|
||||
this.api.getEos({
|
||||
'eos-version': this.config.version,
|
||||
}),
|
||||
this.getPkgs(1, 100),
|
||||
])
|
||||
this.data = data
|
||||
@@ -35,6 +39,7 @@ export class MarketplaceService {
|
||||
const idAndCurrentVersions = Object.keys(localPkgs).map(key => ({ id: key, version: localPkgs[key].manifest.version }))
|
||||
const latestPkgs = await this.api.getMarketplacePkgs({
|
||||
ids: idAndCurrentVersions,
|
||||
'eos-version': this.config.version,
|
||||
})
|
||||
|
||||
return latestPkgs.filter(latestPkg => {
|
||||
@@ -47,6 +52,7 @@ export class MarketplaceService {
|
||||
async getPkg (id: string, version?: string): Promise<MarketplacePkg> {
|
||||
const pkgs = await this.api.getMarketplacePkgs({
|
||||
ids: [{ id, version: version || '*' }],
|
||||
'eos-version': this.config.version,
|
||||
})
|
||||
const pkg = pkgs.find(pkg => pkg.manifest.id == id)
|
||||
|
||||
@@ -65,6 +71,7 @@ export class MarketplaceService {
|
||||
const pkgs = await this.api.getMarketplacePkgs({
|
||||
page: String(page),
|
||||
'per-page': String(perPage),
|
||||
'eos-version': this.config.version,
|
||||
})
|
||||
|
||||
return pkgs
|
||||
|
||||
@@ -193,12 +193,15 @@ export module RR {
|
||||
export type GetMarketplaceDataReq = { }
|
||||
export type GetMarketplaceDataRes = MarketplaceData
|
||||
|
||||
export type GetMarketplaceEOSReq = { }
|
||||
export type GetMarketplaceEOSReq = {
|
||||
'eos-version': string
|
||||
}
|
||||
export type GetMarketplaceEOSRes = MarketplaceEOS
|
||||
|
||||
export type GetMarketplacePackagesReq = {
|
||||
ids?: { id: string, version: string }[]
|
||||
// iff !id
|
||||
'eos-version': string
|
||||
category?: string
|
||||
query?: string
|
||||
page?: string
|
||||
|
||||
@@ -115,7 +115,9 @@ export class StartupAlertsService {
|
||||
// ** check **
|
||||
|
||||
private async osUpdateCheck (): Promise<RR.GetMarketplaceEOSRes | undefined> {
|
||||
const res = await this.api.getEos({ })
|
||||
const res = await this.api.getEos({
|
||||
'eos-version': this.config.version,
|
||||
})
|
||||
|
||||
if (this.emver.compare(this.config.version, res.version) === -1) {
|
||||
return res
|
||||
|
||||
Reference in New Issue
Block a user