Skip to content

Commit

Permalink
Merge branch 'feature_stdout_live_reporting' of github.com:gecage952/…
Browse files Browse the repository at this point in the history
…galaxy into feature_stdout_live_reporting
  • Loading branch information
gecage952 committed May 13, 2024
2 parents 6faf683 + f1f8eec commit beb5d5b
Show file tree
Hide file tree
Showing 576 changed files with 18,076 additions and 7,977 deletions.
3 changes: 2 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@galaxyproject/galaxy-client",
"version": "23.1.1",
"version": "24.0.0",
"description": "Galaxy client application build system",
"keywords": [
"galaxy"
Expand Down Expand Up @@ -43,6 +43,7 @@
"@sentry/browser": "^7.74.1",
"@types/jest": "^29.5.6",
"@vueuse/core": "^10.5.0",
"@vueuse/math": "^10.9.0",
"assert": "^2.1.0",
"axios": "^1.6.2",
"babel-runtime": "^6.26.0",
Expand Down
13 changes: 11 additions & 2 deletions client/src/api/datasetCollections.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CollectionEntry, DCESummary, HDCADetailed, isHDCA } from "@/api";
import { CollectionEntry, DCESummary, HDCADetailed, HDCASummary, isHDCA } from "@/api";
import { fetcher } from "@/api/schema";

const DEFAULT_LIMIT = 50;
Expand All @@ -11,7 +11,16 @@ const getCollectionDetails = fetcher.path("/api/dataset_collections/{id}").metho
*/
export async function fetchCollectionDetails(params: { id: string }): Promise<HDCADetailed> {
const { data } = await getCollectionDetails({ id: params.id });
return data;
return data as HDCADetailed;
}

/**
* Fetches the details of a collection.
* @param params.id The ID of the collection (HDCA) to fetch.
*/
export async function fetchCollectionSummary(params: { id: string }): Promise<HDCASummary> {
const { data } = await getCollectionDetails({ id: params.id, view: "collection" });
return data as HDCASummary;
}

const getCollectionContents = fetcher
Expand Down
33 changes: 18 additions & 15 deletions client/src/api/datasets.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import axios from "axios";
import type { FetchArgType } from "openapi-typescript-fetch";

import { DatasetDetails } from "@/api";
import { HDADetailed } from "@/api";
import { components, fetcher } from "@/api/schema";
import { withPrefix } from "@/utils/redirect";

Expand All @@ -11,7 +12,7 @@ type GetDatasetsQuery = Pick<GetDatasetsApiOptions, "limit" | "offset">;
// custom interface for how we use getDatasets
interface GetDatasetsOptions extends GetDatasetsQuery {
sortBy?: string;
sortDesc?: string;
sortDesc?: boolean;
query?: string;
}

Expand Down Expand Up @@ -40,32 +41,28 @@ export const fetchDataset = fetcher.path("/api/datasets/{dataset_id}").method("g

export const fetchDatasetStorage = fetcher.path("/api/datasets/{dataset_id}/storage").method("get").create();

export async function fetchDatasetDetails(params: { id: string }): Promise<DatasetDetails> {
export async function fetchDatasetDetails(params: { id: string }): Promise<HDADetailed> {
const { data } = await fetchDataset({ dataset_id: params.id, view: "detailed" });
// We know that the server will return a DatasetDetails object because of the view parameter
// but the type system doesn't, so we have to cast it.
return data as unknown as DatasetDetails;
return data as unknown as HDADetailed;
}

const updateHistoryDataset = fetcher.path("/api/histories/{history_id}/contents/{type}s/{id}").method("put").create();
const updateDataset = fetcher.path("/api/datasets/{dataset_id}").method("put").create();

export async function undeleteHistoryDataset(historyId: string, datasetId: string) {
const { data } = await updateHistoryDataset({
history_id: historyId,
id: datasetId,
export async function undeleteDataset(datasetId: string) {
const { data } = await updateDataset({
dataset_id: datasetId,
type: "dataset",
deleted: false,
});
return data;
}

const deleteHistoryDataset = fetcher
.path("/api/histories/{history_id}/contents/{type}s/{id}")
.method("delete")
.create();
const deleteDataset = fetcher.path("/api/datasets/{dataset_id}").method("delete").create();

export async function purgeHistoryDataset(historyId: string, datasetId: string) {
const { data } = await deleteHistoryDataset({ history_id: historyId, id: datasetId, type: "dataset", purge: true });
export async function purgeDataset(datasetId: string) {
const { data } = await deleteDataset({ dataset_id: datasetId, purge: true });
return data;
}

Expand All @@ -92,3 +89,9 @@ export function getCompositeDatasetLink(historyDatasetId: string, path: string)

export type DatasetExtraFiles = components["schemas"]["DatasetExtraFiles"];
export const fetchDatasetExtraFiles = fetcher.path("/api/datasets/{dataset_id}/extra_files").method("get").create();

export async function fetchDatasetAttributes(datasetId: string) {
const { data } = await axios.get(withPrefix(`/dataset/get_edit?dataset_id=${datasetId}`));

return data;
}
2 changes: 2 additions & 0 deletions client/src/api/histories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ export const updateHistoryItemsInBulk = fetcher
.path("/api/histories/{history_id}/contents/bulk")
.method("put")
.create();
export const sharing = fetcher.path("/api/histories/{history_id}/sharing").method("get").create();
export const enableLink = fetcher.path("/api/histories/{history_id}/enable_link_access").method("put").create();
82 changes: 74 additions & 8 deletions client/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,72 @@ import { components } from "@/api/schema";
*/
export type HistorySummary = components["schemas"]["HistorySummary"];

export interface HistorySummaryExtended extends HistorySummary {
/**
* Contains minimal information about a History with additional content stats.
* This is a subset of information that can be relatively frequently updated after
* certain actions are performed on the history.
*/
export interface HistoryContentsStats {
id: string;
update_time: string;
size: number;
contents_active: components["schemas"]["HistoryActiveContentCounts"];
}

/**
* Contains summary information plus additional details about the contents and owner of a History.
* This is used by the client API to simplify the handling of History objects.
*
* Data returned by the API when requesting `?view=summary&keys=size,contents_active,user_id`.
*/
export interface HistorySummaryExtended extends HistorySummary, HistoryContentsStats {
user_id: string;
}

type HistoryDetailedModel = components["schemas"]["HistoryDetailed"];

/**
* Contains additional details about a History.
*
* Data returned by the API when requesting `?view=detailed`.
*/
export interface HistoryDetailed extends HistoryDetailedModel {
// TODO: these fields are not present in the backend schema model `HistoryDetailedModel` but are serialized by the API
// when requesting ?view=detailed. We should consider adding them to the backend schema.
email_hash?: string;
empty: boolean;
hid_counter: number;
}

type HistoryDetailedCommon = Omit<
HistoryDetailed,
"username" | "state" | "state_ids" | "state_details" | "email_hash" | "empty"
>;

/**
* Alternative representation of history details used by the client API.
* Shares most of the fields with HistoryDetailed but not all and adds some additional fields.
*
* Data returned by the API when requesting `?view=dev-detailed`.
*/
export type HistoryDetailed = components["schemas"]["HistoryDetailed"];
export interface HistoryDevDetailed extends HistoryDetailedCommon {
contents_active: components["schemas"]["HistoryActiveContentCounts"];
}

export type AnyHistory = HistorySummary | HistorySummaryExtended | HistoryDetailed;
/**
* Contains all available information about a History.
*/
export type HistoryExtended = HistoryDevDetailed & HistoryDetailed;

/**
* Represents any amount of information about a History with the minimal being a HistorySummary.
*/
export type AnyHistory =
| HistorySummary
| HistorySummaryExtended
| HistoryDetailed
| HistoryDevDetailed
| HistoryExtended;

/**
* Contains minimal information about a HistoryContentItem.
Expand All @@ -28,12 +82,17 @@ export type HistoryContentItemBase = components["schemas"]["EncodedHistoryConten
/**
* Contains summary information about a HistoryDatasetAssociation.
*/
export type DatasetSummary = components["schemas"]["HDASummary"];
export type HDASummary = components["schemas"]["HDASummary"];

/**
* Contains additional details about a HistoryDatasetAssociation.
*/
export type DatasetDetails = components["schemas"]["HDADetailed"];
export type HDADetailed = components["schemas"]["HDADetailed"];

/**
* Represents either an HDA or an HDCA with minimal information.
*/
export type HistoryItemSummary = HDASummary | HDCASummary;

/**
* Contains storage (object store, quota, etc..) details for a dataset.
Expand All @@ -43,7 +102,7 @@ export type DatasetStorageDetails = components["schemas"]["DatasetStorageDetails
/**
* Represents a HistoryDatasetAssociation with either summary or detailed information.
*/
export type DatasetEntry = DatasetSummary | DatasetDetails;
export type DatasetEntry = HDASummary | HDADetailed;

/**
* Contains summary information about a DCE (DatasetCollectionElement).
Expand Down Expand Up @@ -125,7 +184,7 @@ export function isCollectionElement(element: DCESummary): element is DCECollecti
/**
* Returns true if the given dataset entry is an instance of DatasetDetails.
*/
export function hasDetails(entry: DatasetEntry): entry is DatasetDetails {
export function hasDetails(entry: DatasetEntry): entry is HDADetailed {
return "peek" in entry;
}

Expand Down Expand Up @@ -174,5 +233,12 @@ export function userOwnsHistory(user: User | AnonymousUser | null, history: AnyH
}

function hasOwner(history: AnyHistory): history is HistorySummaryExtended {
return "user_id" in history;
return "user_id" in history && history.user_id !== null;
}

export type DatasetHash = components["schemas"]["DatasetHash"];

export type DatasetTransform = {
action: "to_posix_lines" | "spaces_to_tabs" | "datatype_groom";
datatype_ext: "bam" | "qname_sorted.bam" | "qname_input_sorted.bam" | "isa-tab" | "isa-json";
};
11 changes: 11 additions & 0 deletions client/src/api/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,20 @@ import { components, fetcher } from "@/api/schema";

export type JobDestinationParams = components["schemas"]["JobDestinationParams"];

export const getJobDetails = fetcher.path("/api/jobs/{job_id}").method("get").create();

export const jobLockStatus = fetcher.path("/api/job_lock").method("get").create();
export const jobLockUpdate = fetcher.path("/api/job_lock").method("put").create();

export const fetchJobDestinationParams = fetcher.path("/api/jobs/{job_id}/destination_params").method("get").create();

export const jobsFetcher = fetcher.path("/api/jobs").method("get").create();

export type ShowFullJobResponse = components["schemas"]["ShowFullJobResponse"];
export type JobDetails = components["schemas"]["ShowFullJobResponse"] | components["schemas"]["EncodedJobDetails"];
export const fetchJobDetails = fetcher.path("/api/jobs/{job_id}").method("get").create();

export type JobInputSummary = components["schemas"]["JobInputSummary"];
export const fetchJobCommonProblems = fetcher.path("/api/jobs/{job_id}/common_problems").method("get").create();

export const postJobErrorReport = fetcher.path("/api/jobs/{job_id}/error").method("post").create();
15 changes: 11 additions & 4 deletions client/src/api/notifications.preferences.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import { type components, fetcher } from "@/api/schema";

export type UserNotificationPreferences = components["schemas"]["UserNotificationPreferences"];
type UserNotificationPreferences = components["schemas"]["UserNotificationPreferences"];

export interface UserNotificationPreferencesExtended extends UserNotificationPreferences {
supportedChannels: string[];
}

const getNotificationsPreferences = fetcher.path("/api/notifications/preferences").method("get").create();
export async function getNotificationsPreferencesFromServer() {
const { data } = await getNotificationsPreferences({});
return data;
export async function getNotificationsPreferencesFromServer(): Promise<UserNotificationPreferencesExtended> {
const { data, headers } = await getNotificationsPreferences({});
return {
...data,
supportedChannels: headers.get("supported-channels")?.split(",") ?? [],
};
}

type UpdateUserNotificationPreferencesRequest = components["schemas"]["UpdateUserNotificationPreferencesRequest"];
Expand Down
2 changes: 1 addition & 1 deletion client/src/api/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type NewSharedItemNotificationContentItemType =

type UserNotificationUpdateRequest = components["schemas"]["UserNotificationUpdateRequest"];

type NotificationCreateRequest = components["schemas"]["NotificationCreateRequest"];
export type NotificationCreateRequest = components["schemas"]["NotificationCreateRequest"];

type NotificationResponse = components["schemas"]["NotificationResponse"];

Expand Down
Loading

0 comments on commit beb5d5b

Please sign in to comment.