From 6ecb34bfa21463d0ac2d0e4e65a4e7878cd1aa21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Raddaoui=20Mar=C3=ADn?= Date: Thu, 28 Nov 2024 22:00:01 +0100 Subject: [PATCH] Add about dialog to dashboard - Update API generated code and client to include about service. - Add info icon to the header to open a dialog with about information. - Show information from the about API endpoint (version, pres. system, child workflow names), include the same text from the homepage and buttons to documentation, license and contributing. Unrelated changes: - Make sure padding is not added to the body when a dialog is shown. - Bold "Enduro" in the header to match dialog. - Update homepage text to match dialog. - Redirect to signin page after API authentication error. --- dashboard/index.html | 2 +- dashboard/src/client.ts | 4 +- dashboard/src/components/AboutDialog.vue | 143 +++++++++++ dashboard/src/components/Header.vue | 20 +- .../.openapi-generator/FILES | 4 + .../src/openapi-generator/apis/AboutApi.ts | 90 +++++++ dashboard/src/openapi-generator/apis/index.ts | 1 + .../openapi-generator/models/EnduroAbout.ts | 105 ++++++++ .../models/EnduroPoststorage.ts | 75 ++++++ .../models/EnduroPreprocessing.ts | 84 ++++++ .../models/EnduroStoredPackage.ts | 243 +++++++++--------- .../src/openapi-generator/models/index.ts | 3 + dashboard/src/pages/index.vue | 21 +- 13 files changed, 659 insertions(+), 136 deletions(-) create mode 100644 dashboard/src/components/AboutDialog.vue create mode 100644 dashboard/src/openapi-generator/apis/AboutApi.ts create mode 100644 dashboard/src/openapi-generator/models/EnduroAbout.ts create mode 100644 dashboard/src/openapi-generator/models/EnduroPoststorage.ts create mode 100644 dashboard/src/openapi-generator/models/EnduroPreprocessing.ts diff --git a/dashboard/index.html b/dashboard/index.html index 4df6bc5b..ffa80d14 100644 --- a/dashboard/index.html +++ b/dashboard/index.html @@ -6,7 +6,7 @@ Enduro - +
diff --git a/dashboard/src/client.ts b/dashboard/src/client.ts index e3192992..0fc50410 100644 --- a/dashboard/src/client.ts +++ b/dashboard/src/client.ts @@ -5,6 +5,7 @@ import { useAuthStore } from "@/stores/auth"; import { usePackageStore } from "./stores/package"; export interface Client { + about: api.AboutApi; package: api.PackageApi; storage: api.StorageApi; connectPackageMonitor: () => void; @@ -67,7 +68,7 @@ function createClient(): Client { if (context.response.status == 401) { useAuthStore() .removeUser() - .then(() => router.push({ name: "/" })); + .then(() => router.push({ name: "/user/signin" })); return Promise.resolve(); } return Promise.resolve(context.response); @@ -76,6 +77,7 @@ function createClient(): Client { ], }); return { + about: new api.AboutApi(config), package: new api.PackageApi(config), storage: new api.StorageApi(config), connectPackageMonitor, diff --git a/dashboard/src/components/AboutDialog.vue b/dashboard/src/components/AboutDialog.vue new file mode 100644 index 00000000..3207b6b4 --- /dev/null +++ b/dashboard/src/components/AboutDialog.vue @@ -0,0 +1,143 @@ + + + diff --git a/dashboard/src/components/Header.vue b/dashboard/src/components/Header.vue index e02c657a..c05ca35f 100644 --- a/dashboard/src/components/Header.vue +++ b/dashboard/src/components/Header.vue @@ -1,9 +1,14 @@ diff --git a/dashboard/src/openapi-generator/.openapi-generator/FILES b/dashboard/src/openapi-generator/.openapi-generator/FILES index 7958eac1..b231b67b 100644 --- a/dashboard/src/openapi-generator/.openapi-generator/FILES +++ b/dashboard/src/openapi-generator/.openapi-generator/FILES @@ -1,4 +1,5 @@ .openapi-generator-ignore +apis/AboutApi.ts apis/PackageApi.ts apis/StorageApi.ts apis/SwaggerApi.ts @@ -9,11 +10,14 @@ models/AddLocationRequestBodyConfig.ts models/AddLocationResult.ts models/ConfirmRequestBody.ts models/CreateRequestBody.ts +models/EnduroAbout.ts models/EnduroPackagePreservationAction.ts models/EnduroPackagePreservationActions.ts models/EnduroPackagePreservationTask.ts models/EnduroPackages.ts models/EnduroPage.ts +models/EnduroPoststorage.ts +models/EnduroPreprocessing.ts models/EnduroStoredPackage.ts models/Location.ts models/LocationNotFound.ts diff --git a/dashboard/src/openapi-generator/apis/AboutApi.ts b/dashboard/src/openapi-generator/apis/AboutApi.ts new file mode 100644 index 00000000..11ea7a78 --- /dev/null +++ b/dashboard/src/openapi-generator/apis/AboutApi.ts @@ -0,0 +1,90 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Enduro API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as runtime from '../runtime'; +import type { + EnduroAbout, +} from '../models/index'; +import { + EnduroAboutFromJSON, + EnduroAboutToJSON, +} from '../models/index'; + +/** + * AboutApi - interface + * + * @export + * @interface AboutApiInterface + */ +export interface AboutApiInterface { + /** + * Get information about the system + * @summary about about + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AboutApiInterface + */ + aboutAboutRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; + + /** + * Get information about the system + * about about + */ + aboutAbout(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; + +} + +/** + * + */ +export class AboutApi extends runtime.BaseAPI implements AboutApiInterface { + + /** + * Get information about the system + * about about + */ + async aboutAboutRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("jwt_header_Authorization", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + const response = await this.request({ + path: `/about`, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => EnduroAboutFromJSON(jsonValue)); + } + + /** + * Get information about the system + * about about + */ + async aboutAbout(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.aboutAboutRaw(initOverrides); + return await response.value(); + } + +} diff --git a/dashboard/src/openapi-generator/apis/index.ts b/dashboard/src/openapi-generator/apis/index.ts index 530db628..86f1a480 100644 --- a/dashboard/src/openapi-generator/apis/index.ts +++ b/dashboard/src/openapi-generator/apis/index.ts @@ -1,5 +1,6 @@ /* tslint:disable */ /* eslint-disable */ +export * from './AboutApi'; export * from './PackageApi'; export * from './StorageApi'; export * from './SwaggerApi'; diff --git a/dashboard/src/openapi-generator/models/EnduroAbout.ts b/dashboard/src/openapi-generator/models/EnduroAbout.ts new file mode 100644 index 00000000..b3b5f883 --- /dev/null +++ b/dashboard/src/openapi-generator/models/EnduroAbout.ts @@ -0,0 +1,105 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Enduro API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import type { EnduroPoststorage } from './EnduroPoststorage'; +import { + EnduroPoststorageFromJSON, + EnduroPoststorageFromJSONTyped, + EnduroPoststorageToJSON, +} from './EnduroPoststorage'; +import type { EnduroPreprocessing } from './EnduroPreprocessing'; +import { + EnduroPreprocessingFromJSON, + EnduroPreprocessingFromJSONTyped, + EnduroPreprocessingToJSON, +} from './EnduroPreprocessing'; + +/** + * + * @export + * @interface EnduroAbout + */ +export interface EnduroAbout { + /** + * + * @type {Array} + * @memberof EnduroAbout + */ + poststorage?: Array; + /** + * + * @type {EnduroPreprocessing} + * @memberof EnduroAbout + */ + preprocessing: EnduroPreprocessing; + /** + * + * @type {string} + * @memberof EnduroAbout + */ + preservationSystem: string; + /** + * + * @type {string} + * @memberof EnduroAbout + */ + version: string; +} + +/** + * Check if a given object implements the EnduroAbout interface. + */ +export function instanceOfEnduroAbout(value: object): boolean { + let isInstance = true; + isInstance = isInstance && "preprocessing" in value; + isInstance = isInstance && "preservationSystem" in value; + isInstance = isInstance && "version" in value; + + return isInstance; +} + +export function EnduroAboutFromJSON(json: any): EnduroAbout { + return EnduroAboutFromJSONTyped(json, false); +} + +export function EnduroAboutFromJSONTyped(json: any, ignoreDiscriminator: boolean): EnduroAbout { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'poststorage': !exists(json, 'poststorage') ? undefined : ((json['poststorage'] as Array).map(EnduroPoststorageFromJSON)), + 'preprocessing': EnduroPreprocessingFromJSON(json['preprocessing']), + 'preservationSystem': json['preservation_system'], + 'version': json['version'], + }; +} + +export function EnduroAboutToJSON(value?: EnduroAbout | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'poststorage': value.poststorage === undefined ? undefined : ((value.poststorage as Array).map(EnduroPoststorageToJSON)), + 'preprocessing': EnduroPreprocessingToJSON(value.preprocessing), + 'preservation_system': value.preservationSystem, + 'version': value.version, + }; +} + diff --git a/dashboard/src/openapi-generator/models/EnduroPoststorage.ts b/dashboard/src/openapi-generator/models/EnduroPoststorage.ts new file mode 100644 index 00000000..3092700b --- /dev/null +++ b/dashboard/src/openapi-generator/models/EnduroPoststorage.ts @@ -0,0 +1,75 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Enduro API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface EnduroPoststorage + */ +export interface EnduroPoststorage { + /** + * + * @type {string} + * @memberof EnduroPoststorage + */ + taskQueue: string; + /** + * + * @type {string} + * @memberof EnduroPoststorage + */ + workflowName: string; +} + +/** + * Check if a given object implements the EnduroPoststorage interface. + */ +export function instanceOfEnduroPoststorage(value: object): boolean { + let isInstance = true; + isInstance = isInstance && "taskQueue" in value; + isInstance = isInstance && "workflowName" in value; + + return isInstance; +} + +export function EnduroPoststorageFromJSON(json: any): EnduroPoststorage { + return EnduroPoststorageFromJSONTyped(json, false); +} + +export function EnduroPoststorageFromJSONTyped(json: any, ignoreDiscriminator: boolean): EnduroPoststorage { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'taskQueue': json['task_queue'], + 'workflowName': json['workflow_name'], + }; +} + +export function EnduroPoststorageToJSON(value?: EnduroPoststorage | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'task_queue': value.taskQueue, + 'workflow_name': value.workflowName, + }; +} + diff --git a/dashboard/src/openapi-generator/models/EnduroPreprocessing.ts b/dashboard/src/openapi-generator/models/EnduroPreprocessing.ts new file mode 100644 index 00000000..f4387fb4 --- /dev/null +++ b/dashboard/src/openapi-generator/models/EnduroPreprocessing.ts @@ -0,0 +1,84 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Enduro API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface EnduroPreprocessing + */ +export interface EnduroPreprocessing { + /** + * + * @type {boolean} + * @memberof EnduroPreprocessing + */ + enabled: boolean; + /** + * + * @type {string} + * @memberof EnduroPreprocessing + */ + taskQueue: string; + /** + * + * @type {string} + * @memberof EnduroPreprocessing + */ + workflowName: string; +} + +/** + * Check if a given object implements the EnduroPreprocessing interface. + */ +export function instanceOfEnduroPreprocessing(value: object): boolean { + let isInstance = true; + isInstance = isInstance && "enabled" in value; + isInstance = isInstance && "taskQueue" in value; + isInstance = isInstance && "workflowName" in value; + + return isInstance; +} + +export function EnduroPreprocessingFromJSON(json: any): EnduroPreprocessing { + return EnduroPreprocessingFromJSONTyped(json, false); +} + +export function EnduroPreprocessingFromJSONTyped(json: any, ignoreDiscriminator: boolean): EnduroPreprocessing { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'enabled': json['enabled'], + 'taskQueue': json['task_queue'], + 'workflowName': json['workflow_name'], + }; +} + +export function EnduroPreprocessingToJSON(value?: EnduroPreprocessing | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'enabled': value.enabled, + 'task_queue': value.taskQueue, + 'workflow_name': value.workflowName, + }; +} + diff --git a/dashboard/src/openapi-generator/models/EnduroStoredPackage.ts b/dashboard/src/openapi-generator/models/EnduroStoredPackage.ts index a042647d..39e3718c 100644 --- a/dashboard/src/openapi-generator/models/EnduroStoredPackage.ts +++ b/dashboard/src/openapi-generator/models/EnduroStoredPackage.ts @@ -5,162 +5,153 @@ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 0.0.1 - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -import { exists, mapValues } from "../runtime"; +import { exists, mapValues } from '../runtime'; /** * StoredPackage describes a package retrieved by the service. * @export * @interface EnduroStoredPackage */ export interface EnduroStoredPackage { - /** - * Identifier of AIP - * @type {string} - * @memberof EnduroStoredPackage - */ - aipId?: string; - /** - * Completion datetime - * @type {Date} - * @memberof EnduroStoredPackage - */ - completedAt?: Date; - /** - * Creation datetime - * @type {Date} - * @memberof EnduroStoredPackage - */ - createdAt: Date; - /** - * Identifier of package - * @type {number} - * @memberof EnduroStoredPackage - */ - id: number; - /** - * Identifier of storage location - * @type {string} - * @memberof EnduroStoredPackage - */ - locationId?: string; - /** - * Name of the package - * @type {string} - * @memberof EnduroStoredPackage - */ - name?: string; - /** - * Identifier of latest processing workflow run - * @type {string} - * @memberof EnduroStoredPackage - */ - runId?: string; - /** - * Start datetime - * @type {Date} - * @memberof EnduroStoredPackage - */ - startedAt?: Date; - /** - * Status of the package - * @type {string} - * @memberof EnduroStoredPackage - */ - status: EnduroStoredPackageStatusEnum; - /** - * Identifier of processing workflow - * @type {string} - * @memberof EnduroStoredPackage - */ - workflowId?: string; + /** + * Identifier of AIP + * @type {string} + * @memberof EnduroStoredPackage + */ + aipId?: string; + /** + * Completion datetime + * @type {Date} + * @memberof EnduroStoredPackage + */ + completedAt?: Date; + /** + * Creation datetime + * @type {Date} + * @memberof EnduroStoredPackage + */ + createdAt: Date; + /** + * Identifier of package + * @type {number} + * @memberof EnduroStoredPackage + */ + id: number; + /** + * Identifier of storage location + * @type {string} + * @memberof EnduroStoredPackage + */ + locationId?: string; + /** + * Name of the package + * @type {string} + * @memberof EnduroStoredPackage + */ + name?: string; + /** + * Identifier of latest processing workflow run + * @type {string} + * @memberof EnduroStoredPackage + */ + runId?: string; + /** + * Start datetime + * @type {Date} + * @memberof EnduroStoredPackage + */ + startedAt?: Date; + /** + * Status of the package + * @type {string} + * @memberof EnduroStoredPackage + */ + status: EnduroStoredPackageStatusEnum; + /** + * Identifier of processing workflow + * @type {string} + * @memberof EnduroStoredPackage + */ + workflowId?: string; } + /** * @export */ export const EnduroStoredPackageStatusEnum = { - New: "new", - InProgress: "in progress", - Done: "done", - Error: "error", - Unknown: "unknown", - Queued: "queued", - Abandoned: "abandoned", - Pending: "pending", + New: 'new', + InProgress: 'in progress', + Done: 'done', + Error: 'error', + Unknown: 'unknown', + Queued: 'queued', + Abandoned: 'abandoned', + Pending: 'pending' } as const; -export type EnduroStoredPackageStatusEnum = - (typeof EnduroStoredPackageStatusEnum)[keyof typeof EnduroStoredPackageStatusEnum]; +export type EnduroStoredPackageStatusEnum = typeof EnduroStoredPackageStatusEnum[keyof typeof EnduroStoredPackageStatusEnum]; + /** * Check if a given object implements the EnduroStoredPackage interface. */ export function instanceOfEnduroStoredPackage(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "createdAt" in value; - isInstance = isInstance && "id" in value; - isInstance = isInstance && "status" in value; + let isInstance = true; + isInstance = isInstance && "createdAt" in value; + isInstance = isInstance && "id" in value; + isInstance = isInstance && "status" in value; - return isInstance; + return isInstance; } export function EnduroStoredPackageFromJSON(json: any): EnduroStoredPackage { - return EnduroStoredPackageFromJSONTyped(json, false); + return EnduroStoredPackageFromJSONTyped(json, false); } -export function EnduroStoredPackageFromJSONTyped( - json: any, - ignoreDiscriminator: boolean, -): EnduroStoredPackage { - if (json === undefined || json === null) { - return json; - } - return { - aipId: !exists(json, "aip_id") ? undefined : json["aip_id"], - completedAt: !exists(json, "completed_at") - ? undefined - : new Date(json["completed_at"]), - createdAt: new Date(json["created_at"]), - id: json["id"], - locationId: !exists(json, "location_id") ? undefined : json["location_id"], - name: !exists(json, "name") ? undefined : json["name"], - runId: !exists(json, "run_id") ? undefined : json["run_id"], - startedAt: !exists(json, "started_at") - ? undefined - : new Date(json["started_at"]), - status: json["status"], - workflowId: !exists(json, "workflow_id") ? undefined : json["workflow_id"], - }; +export function EnduroStoredPackageFromJSONTyped(json: any, ignoreDiscriminator: boolean): EnduroStoredPackage { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'aipId': !exists(json, 'aip_id') ? undefined : json['aip_id'], + 'completedAt': !exists(json, 'completed_at') ? undefined : (new Date(json['completed_at'])), + 'createdAt': (new Date(json['created_at'])), + 'id': json['id'], + 'locationId': !exists(json, 'location_id') ? undefined : json['location_id'], + 'name': !exists(json, 'name') ? undefined : json['name'], + 'runId': !exists(json, 'run_id') ? undefined : json['run_id'], + 'startedAt': !exists(json, 'started_at') ? undefined : (new Date(json['started_at'])), + 'status': json['status'], + 'workflowId': !exists(json, 'workflow_id') ? undefined : json['workflow_id'], + }; } -export function EnduroStoredPackageToJSON( - value?: EnduroStoredPackage | null, -): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - aip_id: value.aipId, - completed_at: - value.completedAt === undefined - ? undefined - : value.completedAt.toISOString(), - created_at: value.createdAt.toISOString(), - id: value.id, - location_id: value.locationId, - name: value.name, - run_id: value.runId, - started_at: - value.startedAt === undefined ? undefined : value.startedAt.toISOString(), - status: value.status, - workflow_id: value.workflowId, - }; +export function EnduroStoredPackageToJSON(value?: EnduroStoredPackage | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'aip_id': value.aipId, + 'completed_at': value.completedAt === undefined ? undefined : (value.completedAt.toISOString()), + 'created_at': (value.createdAt.toISOString()), + 'id': value.id, + 'location_id': value.locationId, + 'name': value.name, + 'run_id': value.runId, + 'started_at': value.startedAt === undefined ? undefined : (value.startedAt.toISOString()), + 'status': value.status, + 'workflow_id': value.workflowId, + }; } + diff --git a/dashboard/src/openapi-generator/models/index.ts b/dashboard/src/openapi-generator/models/index.ts index 0668523c..cb6c05f3 100644 --- a/dashboard/src/openapi-generator/models/index.ts +++ b/dashboard/src/openapi-generator/models/index.ts @@ -5,11 +5,14 @@ export * from './AddLocationRequestBodyConfig'; export * from './AddLocationResult'; export * from './ConfirmRequestBody'; export * from './CreateRequestBody'; +export * from './EnduroAbout'; export * from './EnduroPackagePreservationAction'; export * from './EnduroPackagePreservationActions'; export * from './EnduroPackagePreservationTask'; export * from './EnduroPackages'; export * from './EnduroPage'; +export * from './EnduroPoststorage'; +export * from './EnduroPreprocessing'; export * from './EnduroStoredPackage'; export * from './Location'; export * from './LocationNotFound'; diff --git a/dashboard/src/pages/index.vue b/dashboard/src/pages/index.vue index 89e83734..afd0a9e7 100644 --- a/dashboard/src/pages/index.vue +++ b/dashboard/src/pages/index.vue @@ -17,13 +17,20 @@ layoutStore.updateBreadcrumb([]); >!

- Enduro is a new application under development by Artefactual Systems. - Originally created as a more stable replacement for - Archivematica's automation tools library of scripts, it has since evolved into a - flexible tool to be paired with preservation applications to provide - initial ingest activities such as content and structure validation, - packaging, and more. + Enduro is a new application under development by + Artefactual Systems. Originally created as a more stable replacement for Archivematica's + automation-tools + library of scripts, it has since evolved into a flexible tool to be paired + with preservation applications like + Archivematica + and + a3m + to provide initial ingest activities such as content and structure + validation, packaging, and more.

See the