Skip to content

Commit

Permalink
Merge pull request galaxyproject#17345 from jdavcs/dev_merge_23.2
Browse files Browse the repository at this point in the history
Merge 23.2 into dev
  • Loading branch information
jdavcs authored Jan 24, 2024
2 parents 726e648 + 568480f commit fb41f4f
Show file tree
Hide file tree
Showing 21 changed files with 1,958 additions and 109 deletions.
54 changes: 20 additions & 34 deletions client/src/components/Page/PageList.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import MockAdapter from "axios-mock-adapter";
import { formatDistanceToNow, parseISO } from "date-fns";
import flushPromises from "flush-promises";
import { PiniaVuePlugin } from "pinia";
import { useUserStore } from "stores/userStore";
import { getLocalVue, wait } from "tests/jest/helpers";

import PageList from "./PageList.vue";
Expand Down Expand Up @@ -98,16 +99,29 @@ describe("PgeList.vue", () => {
const mockPublishedPageData = [publishedPage];
const mockTwoPageData = [privatePage, pageA];

function mountPersonalGrid() {
function mountGrid(propsData) {
const pinia = createTestingPinia();
const userStore = useUserStore();
userStore.currentUser = { username: "jimmyPage", tags_used: [] };

wrapper = mount(PageList, {
propsData: propsDataPersonalGrid,
propsData,
localVue,
pinia,
stubs: {
icon: { template: "<div></div>" },
},
});
}

function mountPersonalGrid() {
mountGrid(propsDataPersonalGrid);
}

function mountPublishedGrid() {
mountGrid(propsDataPublishedGrid);
}

describe(" with empty page list", () => {
beforeEach(async () => {
axiosMock.onAny().reply(200, [], { total_matches: "0" });
Expand Down Expand Up @@ -145,14 +159,7 @@ describe("PgeList.vue", () => {
jest.spyOn(PageList.methods, "decorateData").mockImplementation((page) => {
page.shared = false;
});
wrapper = mount(PageList, {
propsData: propsDataPersonalGrid,
localVue,
pinia: createTestingPinia(),
stubs: {
icon: { template: "<div></div>" },
},
});
mountPersonalGrid();
await flushPromises();
});

Expand Down Expand Up @@ -215,14 +222,7 @@ describe("PgeList.vue", () => {
jest.spyOn(PageList.methods, "decorateData").mockImplementation((page) => {
page.shared = true;
});
wrapper = mount(PageList, {
propsData: propsDataPersonalGrid,
localVue,
pinia: createTestingPinia(),
stubs: {
icon: { template: "<div></div>" },
},
});
mountPersonalGrid();
await flushPromises();
});
it("updates filter when published icon is clicked", async () => {
Expand Down Expand Up @@ -257,14 +257,7 @@ describe("PgeList.vue", () => {
jest.spyOn(PageList.methods, "decorateData").mockImplementation((page) => {
page.shared = false;
});
wrapper = mount(PageList, {
propsData: propsDataPublishedGrid,
localVue,
pinia: createTestingPinia(),
stubs: {
icon: { template: "<div></div>" },
},
});
mountPublishedGrid();
await flushPromises();
});

Expand Down Expand Up @@ -301,14 +294,7 @@ describe("PgeList.vue", () => {
jest.spyOn(PageList.methods, "decorateData").mockImplementation((page) => {
page.shared = false;
});
wrapper = mount(PageList, {
propsData: propsDataPublishedGrid,
localVue,
pinia: createTestingPinia(),
stubs: {
icon: { template: "<div></div>" },
},
});
mountPublishedGrid();
await flushPromises();
});

Expand Down
9 changes: 8 additions & 1 deletion client/src/components/Page/PageList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
clickable
:value="row.item.tags"
:index="row.index"
:disabled="published"
:disabled="published || !currentUserOwnsItem(row.item)"
@input="(tags) => onTags(tags, row.index)"
@tag-click="(tag) => applyFilter('tag', tag, true)" />
</template>
Expand Down Expand Up @@ -100,11 +100,13 @@ import StatelessTags from "components/TagsMultiselect/StatelessTags";
import UtcDate from "components/UtcDate";
import paginationMixin from "components/Workflow/paginationMixin";
import { getAppRoot } from "onload/loadConfig";
import { storeToRefs } from "pinia";
import Filtering, { contains, equals, expandNameTag, toBool } from "utils/filtering";
import _l from "utils/localization";
import { useRouter } from "vue-router/composables";
import { updateTags } from "@/api/tags";
import { useUserStore } from "@/stores/userStore";
import { absPath } from "@/utils/redirect";
import PageDropdown from "./PageDropdown";
Expand Down Expand Up @@ -224,8 +226,10 @@ export default {
},
setup() {
const router = useRouter();
const { currentUser } = storeToRefs(useUserStore());
return {
router,
currentUser,
};
},
data() {
Expand Down Expand Up @@ -304,6 +308,9 @@ export default {
shareLink: function (item) {
this.router.push(`sharing?id=${item.id}`);
},
currentUserOwnsItem: function (item) {
return item.username === this.currentUser.username;
},
decorateData(page) {
const Galaxy = getGalaxyInstance();
page.shared = page.username !== Galaxy.user.attributes.username;
Expand Down
14 changes: 9 additions & 5 deletions client/src/components/Workflow/Editor/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -689,11 +689,15 @@ export default {
const runUrl = `/workflows/run?id=${this.id}`;
this.onNavigate(runUrl);
},
onNavigate(url) {
this.onSave(true).then(() => {
this.hasChanges = false;
this.$router.push(url);
});
async onNavigate(url) {
if (this.isNewTempWorkflow) {
await this.onCreate();
} else {
await this.onSave(true);
}
this.hasChanges = false;
this.$router.push(url);
},
onSave(hideProgress = false) {
if (!this.nameValidate()) {
Expand Down
117 changes: 60 additions & 57 deletions client/src/entry/analysis/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,49 @@
<div id="app" :style="theme">
<div id="everything">
<div id="background" />
<Masthead
v-if="showMasthead"
id="masthead"
:brand="config.brand"
:logo-url="config.logo_url"
:logo-src="theme?.['--masthead-logo-img'] ?? config.logo_src"
:logo-src-secondary="theme?.['--masthead-logo-img-secondary'] ?? config.logo_src_secondary"
:tabs="tabs"
:window-tab="windowTab"
@open-url="openUrl" />
<Alert
v-if="showAlerts && config.message_box_visible && config.message_box_content"
id="messagebox"
class="rounded-0 m-0 p-2"
:variant="config.message_box_class || 'info'">
<span class="fa fa-fw mr-1 fa-exclamation" />
<!-- eslint-disable-next-line vue/no-v-html -->
<span v-html="config.message_box_content"></span>
</Alert>
<Alert
v-if="showAlerts && config.show_inactivity_warning && config.inactivity_box_content"
id="inactivebox"
class="rounded-0 m-0 p-2"
variant="warning">
<span class="fa fa-fw mr-1 fa-exclamation-triangle" />
<span>{{ config.inactivity_box_content }}</span>
<span>
<a class="ml-1" :href="resendUrl">Resend Verification</a>
</span>
</Alert>
<template v-if="!embedded">
<Masthead
v-if="showMasthead"
id="masthead"
:brand="config.brand"
:logo-url="config.logo_url"
:logo-src="theme?.['--masthead-logo-img'] ?? config.logo_src"
:logo-src-secondary="theme?.['--masthead-logo-img-secondary'] ?? config.logo_src_secondary"
:tabs="tabs"
:window-tab="windowTab"
@open-url="openUrl" />
<Alert
v-if="config.message_box_visible && config.message_box_content"
id="messagebox"
class="rounded-0 m-0 p-2"
:variant="config.message_box_class || 'info'">
<span class="fa fa-fw mr-1 fa-exclamation" />
<!-- eslint-disable-next-line vue/no-v-html -->
<span v-html="config.message_box_content"></span>
</Alert>
<Alert
v-if="config.show_inactivity_warning && config.inactivity_box_content"
id="inactivebox"
class="rounded-0 m-0 p-2"
variant="warning">
<span class="fa fa-fw mr-1 fa-exclamation-triangle" />
<span>{{ config.inactivity_box_content }}</span>
<span>
<a class="ml-1" :href="resendUrl">Resend Verification</a>
</span>
</Alert>
</template>
<router-view @update:confirmation="confirmation = $event" />
</div>
<div id="dd-helper" />
<Toast ref="toastRef" />
<ConfirmDialog ref="confirmDialogRef" />
<UploadModal ref="uploadModal" />
<BroadcastsOverlay v-if="showBroadcasts" />
<DragGhost />
<template v-if="!embedded">
<div id="dd-helper" />
<Toast ref="toastRef" />
<ConfirmDialog ref="confirmDialogRef" />
<UploadModal ref="uploadModal" />
<BroadcastsOverlay />
<DragGhost />
</template>
</div>
</template>
<script>
Expand All @@ -56,7 +61,7 @@ import Modal from "mvc/ui/ui-modal";
import { getAppRoot } from "onload";
import { storeToRefs } from "pinia";
import { withPrefix } from "utils/redirect";
import { computed, ref, watch } from "vue";
import { ref, watch } from "vue";
import { useRouteQueryBool } from "@/composables/route";
import { useHistoryStore } from "@/stores/historyStore";
Expand Down Expand Up @@ -94,8 +99,6 @@ export default {
setGlobalUploadModal(uploadModal);
const embedded = useRouteQueryBool("embed");
const showBroadcasts = computed(() => !embedded.value);
const showAlerts = computed(() => !embedded.value);
watch(
() => embedded.value,
Expand All @@ -116,27 +119,21 @@ export default {
currentTheme,
currentHistory,
embedded,
showBroadcasts,
showAlerts,
};
},
data() {
return {
config: getGalaxyInstance().config,
confirmation: null,
resendUrl: `${getAppRoot()}user/resend_verification`,
windowManager: new WindowManager(),
windowManager: null,
};
},
computed: {
tabs() {
return fetchMenu(this.config);
},
showMasthead() {
if (this.embedded) {
return false;
}
const masthead = this.$route.query.hide_masthead;
if (masthead !== undefined) {
return masthead.toLowerCase() != "true";
Expand Down Expand Up @@ -170,20 +167,26 @@ export default {
},
},
mounted() {
this.Galaxy = getGalaxyInstance();
this.Galaxy.currHistoryPanel = new HistoryPanelProxy();
this.Galaxy.modal = new Modal.View();
this.Galaxy.frame = this.windowManager;
if (this.Galaxy.config.enable_notification_system) {
this.startNotificationsPolling();
if (!this.embedded) {
this.Galaxy = getGalaxyInstance();
this.Galaxy.currHistoryPanel = new HistoryPanelProxy();
this.Galaxy.modal = new Modal.View();
this.Galaxy.frame = this.windowManager;
if (this.Galaxy.config.enable_notification_system) {
this.startNotificationsPolling();
}
}
},
created() {
window.onbeforeunload = () => {
if (this.confirmation || this.windowManager.beforeUnload()) {
return "Are you sure you want to leave the page?";
}
};
if (!this.embedded) {
this.windowManager = new WindowManager();
window.onbeforeunload = () => {
if (this.confirmation || this.windowManager.beforeUnload()) {
return "Are you sure you want to leave the page?";
}
};
}
},
methods: {
startNotificationsPolling() {
Expand Down
28 changes: 22 additions & 6 deletions client/src/entry/analysis/modules/WorkflowEditor.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<Editor
v-if="editorConfig"
:key="editorReloadKey"
:workflow-id="editorConfig.id"
:data-managers="editorConfig.dataManagers"
:initial-version="editorConfig.initialVersion"
Expand All @@ -23,6 +24,7 @@ export default {
storedWorkflowId: null,
workflowId: null,
editorConfig: null,
editorReloadKey: 0,
};
},
watch: {
Expand All @@ -35,15 +37,29 @@ export default {
},
methods: {
async getEditorConfig() {
const storedWorkflowId = Query.get("id");
const workflowId = Query.get("workflow_id");
let reloadEditor = true;
// this will only be the case the first time the route updates from a new workflow
if (!this.storedWorkflowId && !this.workflowId) {
reloadEditor = false;
}
this.storedWorkflowId = Query.get("id");
this.workflowId = Query.get("workflow_id");
const params = {};
if (workflowId) {
params.workflow_id = workflowId;
} else if (storedWorkflowId) {
params.id = storedWorkflowId;
if (this.workflowId) {
params.workflow_id = this.workflowId;
} else if (this.storedWorkflowId) {
params.id = this.storedWorkflowId;
}
this.editorConfig = await urlData({ url: "/workflow/editor", params });
if (reloadEditor) {
this.editorReloadKey += 1;
}
},
},
};
Expand Down
Loading

0 comments on commit fb41f4f

Please sign in to comment.