update model for PackagesInstalled
This commit is contained in:
@@ -75,14 +75,30 @@ paths:
|
||||
$ref: '#/components/schemas/ProblemDetails'
|
||||
/manifests/packages:
|
||||
get:
|
||||
operationId: Packages
|
||||
operationId: ManifestsPackages
|
||||
responses:
|
||||
'200':
|
||||
description: 200 response
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/PackagesResponse'
|
||||
type: object
|
||||
default:
|
||||
description: default response
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ProblemDetails'
|
||||
/manifests/packages/installed:
|
||||
get:
|
||||
operationId: ManifestsPackagesInstalled
|
||||
responses:
|
||||
'200':
|
||||
description: 200 response
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ManifestsPackagesInstalledResponse'
|
||||
default:
|
||||
description: default response
|
||||
content:
|
||||
@@ -663,26 +679,40 @@ components:
|
||||
$ref: '#/components/schemas/Manifest'
|
||||
required:
|
||||
- manifests
|
||||
Package:
|
||||
PackageInstalled:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
alias:
|
||||
type: string
|
||||
version:
|
||||
type: string
|
||||
hasMigrations:
|
||||
type: boolean
|
||||
hasPendingMigrations:
|
||||
type: boolean
|
||||
plans:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
- name
|
||||
- alias
|
||||
- version
|
||||
PackagesResponse:
|
||||
- hasMigrations
|
||||
- hasPendingMigrations
|
||||
- plans
|
||||
ManifestsPackagesInstalledResponse:
|
||||
type: object
|
||||
properties:
|
||||
packages:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Package'
|
||||
$ref: '#/components/schemas/PackageInstalled'
|
||||
required:
|
||||
- packages
|
||||
ServerStatus:
|
||||
|
||||
@@ -17,7 +17,10 @@ export interface paths {
|
||||
get: operations["Manifests"];
|
||||
};
|
||||
"/manifests/packages": {
|
||||
get: operations["Packages"];
|
||||
get: operations["ManifestsPackages"];
|
||||
};
|
||||
"/manifests/packages/installed": {
|
||||
get: operations["ManifestsPackagesInstalled"];
|
||||
};
|
||||
"/server/status": {
|
||||
get: operations["GetStatus"];
|
||||
@@ -225,13 +228,17 @@ export interface components {
|
||||
ManifestsResponse: {
|
||||
manifests: components["schemas"]["Manifest"][];
|
||||
};
|
||||
Package: {
|
||||
PackageInstalled: {
|
||||
id: string;
|
||||
name: string;
|
||||
alias: string;
|
||||
version: string;
|
||||
hasMigrations: boolean;
|
||||
hasPendingMigrations: boolean;
|
||||
plans: { [key: string]: unknown }[];
|
||||
};
|
||||
PackagesResponse: {
|
||||
packages: components["schemas"]["Package"][];
|
||||
ManifestsPackagesInstalledResponse: {
|
||||
packages: components["schemas"]["PackageInstalled"][];
|
||||
};
|
||||
/** @enum {string} */
|
||||
ServerStatus: "running" | "must-install" | "must-upgrade";
|
||||
@@ -332,12 +339,28 @@ export interface operations {
|
||||
};
|
||||
};
|
||||
};
|
||||
Packages: {
|
||||
ManifestsPackages: {
|
||||
responses: {
|
||||
/** 200 response */
|
||||
200: {
|
||||
content: {
|
||||
"application/json": components["schemas"]["PackagesResponse"];
|
||||
"application/json": { [key: string]: unknown };
|
||||
};
|
||||
};
|
||||
/** default response */
|
||||
default: {
|
||||
content: {
|
||||
"application/json": components["schemas"]["ProblemDetails"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
ManifestsPackagesInstalled: {
|
||||
responses: {
|
||||
/** 200 response */
|
||||
200: {
|
||||
content: {
|
||||
"application/json": components["schemas"]["ManifestsPackagesInstalledResponse"];
|
||||
};
|
||||
};
|
||||
/** default response */
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { html, LitElement, nothing } from 'lit';
|
||||
import { customElement, state } from 'lit/decorators.js';
|
||||
|
||||
import { getPackages } from '../../../core/api/fetcher';
|
||||
import { getPackagesInstalled } from '../../../core/api/fetcher';
|
||||
import { UmbContextConsumerMixin } from '../../../core/context';
|
||||
|
||||
import type { Package } from '../../../core/models';
|
||||
import type { PackageInstalled } from '../../../core/models';
|
||||
|
||||
@customElement('umb-packages-installed')
|
||||
export class UmbPackagesInstalled extends UmbContextConsumerMixin(LitElement) {
|
||||
@state()
|
||||
private _installedPackages: Package[] = [];
|
||||
private _installedPackages: PackageInstalled[] = [];
|
||||
|
||||
@state()
|
||||
private _errorMessage = '';
|
||||
@@ -29,10 +29,10 @@ export class UmbPackagesInstalled extends UmbContextConsumerMixin(LitElement) {
|
||||
try {
|
||||
const {
|
||||
data: { packages },
|
||||
} = await getPackages({});
|
||||
} = await getPackagesInstalled({});
|
||||
this._installedPackages = packages;
|
||||
} catch (e) {
|
||||
if (e instanceof getPackages.Error) {
|
||||
if (e instanceof getPackagesInstalled.Error) {
|
||||
const error = e.getActualType();
|
||||
this._errorMessage = error.data.detail ?? 'An error occurred while loading the installed packages';
|
||||
}
|
||||
|
||||
@@ -20,4 +20,4 @@ export const postInstallSetup = fetcher.path('/install/setup').method('post').cr
|
||||
export const getUpgradeSettings = fetcher.path('/upgrade/settings').method('get').create();
|
||||
export const PostUpgradeAuthorize = fetcher.path('/upgrade/authorize').method('post').create();
|
||||
export const getManifests = fetcher.path('/manifests').method('get').create();
|
||||
export const getPackages = fetcher.path('/manifests/packages').method('get').create();
|
||||
export const getPackagesInstalled = fetcher.path('/manifests/packages/installed').method('get').create();
|
||||
|
||||
@@ -25,6 +25,7 @@ export type ManifestPropertyAction = components['schemas']['IManifestPropertyAct
|
||||
export type ManifestEntrypoint = components['schemas']['IManifestEntrypoint'];
|
||||
export type ManifestCustom = components['schemas']['IManifestCustom'];
|
||||
export type ManifestPackageView = components['schemas']['IManifestPackageView'];
|
||||
export type PackageInstalled = components['schemas']['PackageInstalled'];
|
||||
|
||||
export type ManifestElementType =
|
||||
| ManifestSection
|
||||
|
||||
@@ -12,9 +12,18 @@ export class Manifests {
|
||||
}
|
||||
|
||||
@endpoint({ method: 'GET', path: '/manifests/packages' })
|
||||
export class Packages {
|
||||
export class ManifestsPackages {
|
||||
@response({ status: 200 })
|
||||
response(@body body: PackagesResponse) {}
|
||||
response(@body body: {}) {}
|
||||
|
||||
@defaultResponse
|
||||
default(@body body: ProblemDetails) {}
|
||||
}
|
||||
|
||||
@endpoint({ method: 'GET', path: '/manifests/packages/installed' })
|
||||
export class ManifestsPackagesInstalled {
|
||||
@response({ status: 200 })
|
||||
response(@body body: ManifestsPackagesInstalledResponse) {}
|
||||
|
||||
@defaultResponse
|
||||
default(@body body: ProblemDetails) {}
|
||||
@@ -43,14 +52,18 @@ export interface ManifestsResponse {
|
||||
manifests: Manifest[];
|
||||
}
|
||||
|
||||
export interface PackagesResponse {
|
||||
packages: Package[];
|
||||
export interface ManifestsPackagesInstalledResponse {
|
||||
packages: PackageInstalled[];
|
||||
}
|
||||
|
||||
export interface Package {
|
||||
export interface PackageInstalled {
|
||||
id: string;
|
||||
name: string;
|
||||
alias: string;
|
||||
version: string;
|
||||
hasMigrations: boolean;
|
||||
hasPendingMigrations: boolean;
|
||||
plans: {}[];
|
||||
}
|
||||
|
||||
export interface IManifest {
|
||||
|
||||
Reference in New Issue
Block a user