Skip to content

Commit

Permalink
Merge branch 'galaxyproject:dev' into port-history-panel-to-compositi…
Browse files Browse the repository at this point in the history
…on-api-and-typescript
  • Loading branch information
Renni771 authored Jan 18, 2024
2 parents a94add7 + f12984b commit 8d2ad5c
Show file tree
Hide file tree
Showing 122 changed files with 4,607 additions and 1,610 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/test_galaxy_packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ jobs:
- uses: actions/checkout@v3
with:
path: 'galaxy root'
- uses: actions/setup-node@v3
with:
node-version: '18.12.1'
cache: 'yarn'
cache-dependency-path: 'galaxy root/client/yarn.lock'
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
Expand Down
3 changes: 2 additions & 1 deletion client/src/api/histories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ import { fetcher } from "@/api/schema";

export const historiesFetcher = fetcher.path("/api/histories").method("get").create();
export const archivedHistoriesFetcher = fetcher.path("/api/histories/archived").method("get").create();
export const deleteHistory = fetcher.path("/api/histories/{history_id}").method("delete").create();
export const undeleteHistory = fetcher.path("/api/histories/deleted/{history_id}/undelete").method("post").create();
export const purgeHistory = fetcher.path("/api/histories/{history_id}").method("delete").create();
export const historiesQuery = fetcher.path("/api/histories/query").method("get").create();
440 changes: 430 additions & 10 deletions client/src/api/schema/schema.ts

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ function listCollectionCreatorModal(elements, options) {
*/
function createListCollection(contents, defaultHideSourceItems = true) {
const elements = contents.toJSON();
let copyElements;
const promise = listCollectionCreatorModal(elements, {
defaultHideSourceItems: defaultHideSourceItems,
creationFn: function (elements, name, hideSourceItems) {
Expand All @@ -39,8 +38,7 @@ function createListCollection(contents, defaultHideSourceItems = true) {
//TODO: this allows for list:list even if the filter above does not - reconcile
src: element.src || (element.history_content_type == "dataset" ? "hda" : "hdca"),
}));
copyElements = !hideSourceItems;
return contents.createHDCA(elements, "list", name, hideSourceItems, copyElements);
return contents.createHDCA(elements, "list", name, hideSourceItems);
},
});
return promise;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,14 @@ function pairCollectionCreatorModal(elements, options) {
}
function createPairCollection(contents, defaultHideSourceItems = true) {
var elements = contents.toJSON();
var copyElements;
var promise = pairCollectionCreatorModal(elements, {
defaultHideSourceItems: defaultHideSourceItems,
creationFn: function (elements, name, hideSourceItems) {
elements = [
{ name: "forward", src: elements[0].src || "hda", id: elements[0].id },
{ name: "reverse", src: elements[1].src || "hda", id: elements[1].id },
];
copyElements = !hideSourceItems;
return contents.createHDCA(elements, "paired", name, hideSourceItems, copyElements);
return contents.createHDCA(elements, "paired", name, hideSourceItems);
},
});
return promise;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ function pairedListCollectionCreatorModal(elements, options) {
*/
function createPairedListCollection(contents, defaultHideSourceItems) {
const elements = contents.toJSON();
var copyElements;
const promise = pairedListCollectionCreatorModal(elements, {
defaultHideSourceItems: defaultHideSourceItems,
creationFn: function (elements, name, hideSourceItems) {
Expand All @@ -50,8 +49,7 @@ function createPairedListCollection(contents, defaultHideSourceItems) {
},
],
}));
copyElements = !hideSourceItems;
return contents.createHDCA(elements, "list:paired", name, hideSourceItems, copyElements);
return contents.createHDCA(elements, "list:paired", name, hideSourceItems);
},
});
return promise;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ function createCollectionViaRules(selection, defaultHideSourceItems = true) {
let elementsType;
let importType;
const selectionType = selection.selectionType;
const copyElements = !defaultHideSourceItems;
if (!selectionType) {
// Have HDAs from the history panel.
elements = selection.toJSON();
Expand Down Expand Up @@ -82,7 +81,7 @@ function createCollectionViaRules(selection, defaultHideSourceItems = true) {
ftpUploadSite: selection.ftpUploadSite,
defaultHideSourceItems: defaultHideSourceItems,
creationFn: function (elements, collectionType, name, hideSourceItems) {
return selection.createHDCA(elements, collectionType, name, hideSourceItems, copyElements);
return selection.createHDCA(elements, collectionType, name, hideSourceItems);
},
});
return promise;
Expand Down
82 changes: 82 additions & 0 deletions client/src/components/Grid/GridElements/GridDatasets.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<script setup lang="ts">
import axios from "axios";
import { onMounted, type Ref, ref } from "vue";
import { withPrefix } from "@/utils/redirect";
import { rethrowSimple } from "@/utils/simple-error";
interface Props {
historyId?: string;
}
const props = defineProps<Props>();
interface HistoryStats {
nice_size: string;
contents_active: {
deleted?: number;
hidden?: number;
active?: number;
};
contents_states: {
error?: number;
ok?: number;
new?: number;
running?: number;
queued?: number;
};
}
const historyStats: Ref<HistoryStats | null> = ref(null);
async function getCounts() {
if (props.historyId) {
try {
const { data } = await axios.get(
withPrefix(`/api/histories/${props.historyId}?keys=nice_size,contents_active,contents_states`)
);
historyStats.value = data;
} catch (e) {
rethrowSimple(e);
}
}
}
onMounted(() => {
getCounts();
});
</script>

<template>
<span v-if="historyStats" class="grid-datasets">
<span v-if="historyStats.nice_size" class="mr-2">
{{ historyStats.nice_size }}
</span>
<span
v-for="(stateCount, state) of historyStats.contents_states"
:key="state"
:class="`stats state-color-${state}`"
:title="`${state} datasets`">
{{ stateCount }}
</span>
<span v-if="historyStats.contents_active.deleted" class="stats state-color-deleted" title="Deleted datasets">
{{ historyStats.contents_active.deleted }}
</span>
<span v-if="historyStats.contents_active.hidden" class="stats state-color-hidden" title="Hidden datasets">
{{ historyStats.contents_active.hidden }}
</span>
</span>
</template>

<style lang="scss" scoped>
@import "~bootstrap/scss/bootstrap.scss";
.grid-datasets {
@extend .d-flex;
@extend .text-nowrap;
.stats {
@extend .rounded;
@extend .px-1;
@extend .mr-1;
border-width: 1px;
border-style: solid;
}
}
</style>
5 changes: 3 additions & 2 deletions client/src/components/Grid/GridElements/GridOperations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,16 @@ function hasCondition(conditionHandler: (rowData: RowData, config: GalaxyConfigu
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false"
class="ui-link font-weight-bold">
class="ui-link font-weight-bold text-nowrap">
<FontAwesomeIcon icon="caret-down" class="fa-lg" />
<span class="font-weight-bold">{{ title }}</span>
</button>
<div class="dropdown-menu" aria-labelledby="dataset-dropdown">
<span v-for="(operation, operationIndex) in operations" :key="operationIndex">
<button
v-if="operation && operation.condition && hasCondition(operation.condition)"
v-if="operation && (!operation.condition || hasCondition(operation.condition))"
class="dropdown-item"
:data-description="`grid operation ${operation.title.toLowerCase()}`"
@click.prevent="emit('execute', operation)">
<icon :icon="operation.icon" />
<span v-localize>{{ operation.title }}</span>
Expand Down
21 changes: 0 additions & 21 deletions client/src/components/Grid/GridHistory.vue

This file was deleted.

10 changes: 5 additions & 5 deletions client/src/components/Grid/GridList.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,15 @@ describe("GridList", () => {
expect(wrapper.find("[data-description='grid cell 0-1'] > button").text()).toBe("link-1");
expect(wrapper.find("[data-description='grid cell 1-1'] > button").text()).toBe("link-2");
const firstHeader = wrapper.find("[data-description='grid header 0']");
expect(firstHeader.find("a").text()).toBe("id");
await firstHeader.find("[data-description='grid sort asc']").trigger("click");
expect(firstHeader.find("button").text()).toBe("id");
await firstHeader.find("[data-description='grid sort desc']").trigger("click");
expect(testGrid.getData).toHaveBeenCalledTimes(2);
expect(testGrid.getData.mock.calls[1]).toEqual([0, 25, "", "id", false]);
expect(firstHeader.find("[data-description='grid sort asc']").exists()).toBeFalsy();
expect(firstHeader.find("[data-description='grid sort desc']").exists()).toBeTruthy();
expect(firstHeader.find("[data-description='grid sort desc']").exists()).toBeFalsy();
expect(firstHeader.find("[data-description='grid sort asc']").exists()).toBeTruthy();
const secondHeader = wrapper.find("[data-description='grid header 1']");
expect(secondHeader.find("[data-description='grid sort asc']").exists()).toBeFalsy();
expect(secondHeader.find("[data-description='grid sort desc']").exists()).toBeFalsy();
expect(secondHeader.find("[data-description='grid sort asc']").exists()).toBeFalsy();
});

it("header rendering", async () => {
Expand Down
25 changes: 13 additions & 12 deletions client/src/components/Grid/GridList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import { library } from "@fortawesome/fontawesome-svg-core";
import { faCaretDown, faCaretUp, faShieldAlt } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import { useDebounceFn, useEventBus } from "@vueuse/core";
import { BAlert, BButton, BLink, BPagination } from "bootstrap-vue";
import { BAlert, BButton, BPagination } from "bootstrap-vue";
import { computed, onMounted, onUnmounted, ref, watch } from "vue";
import { useRouter } from "vue-router/composables";
import { FieldHandler, GridConfig, Operation, RowData } from "./configs/types";
import GridBoolean from "./GridElements/GridBoolean.vue";
import GridDatasets from "./GridElements/GridDatasets.vue";
import GridLink from "./GridElements/GridLink.vue";
import GridOperations from "./GridElements/GridOperations.vue";
import GridText from "./GridElements/GridText.vue";
Expand Down Expand Up @@ -150,6 +151,7 @@ function onSearch(query: string) {
function onSort(sortKey: string) {
if (sortBy.value !== sortKey) {
sortBy.value = sortKey;
sortDesc.value = false;
} else {
sortDesc.value = !sortDesc.value;
}
Expand Down Expand Up @@ -246,13 +248,17 @@ watch(operationMessage, () => {
class="text-nowrap px-2"
:data-description="`grid header ${fieldIndex}`">
<span v-if="gridConfig.sortKeys.includes(fieldEntry.key)">
<BLink @click="onSort(fieldEntry.key)">
<BButton
variant="link"
class="text-nowrap font-weight-bold"
:data-description="`grid sort key ${fieldEntry.key}`"
@click="onSort(fieldEntry.key)">
<span>{{ fieldEntry.title || fieldEntry.key }}</span>
<span v-if="sortBy === fieldEntry.key">
<FontAwesomeIcon v-if="sortDesc" icon="caret-up" data-description="grid sort asc" />
<FontAwesomeIcon v-else icon="caret-down" data-description="grid sort desc" />
<FontAwesomeIcon v-if="sortDesc" icon="caret-down" data-description="grid sort desc" />
<FontAwesomeIcon v-else icon="caret-up" data-description="grid sort asc" />
</span>
</BLink>
</BButton>
</span>
<span v-else>{{ fieldEntry.title || fieldEntry.key }}</span>
</th>
Expand All @@ -273,6 +279,7 @@ watch(operationMessage, () => {
:title="rowData[fieldEntry.key]"
@execute="onOperation($event, rowData)" />
<GridBoolean v-else-if="fieldEntry.type == 'boolean'" :value="rowData[fieldEntry.key]" />
<GridDatasets v-else-if="fieldEntry.type == 'datasets'" :historyId="rowData[fieldEntry.key]" />
<GridText v-else-if="fieldEntry.type == 'text'" :text="rowData[fieldEntry.key]" />
<GridLink
v-else-if="fieldEntry.type == 'link'"
Expand All @@ -298,13 +305,7 @@ watch(operationMessage, () => {
</table>
<div class="flex-grow-1 h-100" />
<div v-if="isAvailable" class="grid-footer d-flex justify-content-center pt-3">
<BPagination
v-model="currentPage"
:total-rows="totalRows"
:per-page="limit"
class="m-0"
size="sm"
aria-controls="grid-table" />
<BPagination v-model="currentPage" :total-rows="totalRows" :per-page="limit" class="m-0" size="sm" />
</div>
</div>
</template>
Expand Down
Loading

0 comments on commit 8d2ad5c

Please sign in to comment.