mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge branch 'release_21.05' into dev
This commit is contained in:
@@ -9,7 +9,9 @@
|
||||
Library
|
||||
</b-button>
|
||||
<SearchField :typing-delay="0" @updateSearch="searchValue($event)" />
|
||||
<b-form-checkbox class="mr-1" @input="toggle_include_deleted($event)"> include deleted </b-form-checkbox>
|
||||
<b-form-checkbox v-if="isAdmin" class="mr-1" @input="toggle_include_deleted($event)">
|
||||
include deleted
|
||||
</b-form-checkbox>
|
||||
<b-form-checkbox class="mr-1" @input="toggle_exclude_restricted($event)">
|
||||
exclude restricted
|
||||
</b-form-checkbox>
|
||||
@@ -158,6 +160,7 @@
|
||||
id="paginationPerPage"
|
||||
autocomplete="off"
|
||||
type="number"
|
||||
onkeyup="this.value|=0;if(this.value<1)this.value=1"
|
||||
v-model="perPage"
|
||||
/>
|
||||
</td>
|
||||
|
||||
@@ -303,12 +303,13 @@ export default {
|
||||
// helper function to make legacy code compatible
|
||||
findCheckedItems: async function (idOnly = true) {
|
||||
const datasets = [];
|
||||
const folder = [];
|
||||
const folders = [];
|
||||
const selected = await this.getSelected();
|
||||
selected.forEach((item) => {
|
||||
item.type === "file" ? datasets.push(idOnly ? item.id : item) : idOnly ? item.id : item;
|
||||
const selected_item = idOnly ? item.id : item;
|
||||
item.type === "file" ? datasets.push(selected_item) : folders.push(selected_item);
|
||||
});
|
||||
return { datasets: datasets, folders: folder };
|
||||
return { datasets: datasets, folders: folders };
|
||||
},
|
||||
importToHistoryModal: function (isCollection) {
|
||||
this.findCheckedItems(!isCollection).then(({ datasets, folders }) => {
|
||||
|
||||
+2
-2
@@ -79,13 +79,13 @@ var ImportDatasetModal = Backbone.View.extend({
|
||||
Toast.error("An error occurred.");
|
||||
})
|
||||
.always(() => {
|
||||
this.modal.enableButton("Import");
|
||||
this.modal.disableButton("Import");
|
||||
});
|
||||
} else {
|
||||
var history_id = $("select[name=import_to_history] option:selected").val();
|
||||
var history_name = $("select[name=import_to_history] option:selected").text();
|
||||
this.processImportToHistory(history_id, history_name);
|
||||
this.modal.enableButton("Import");
|
||||
this.modal.disableButton("Import");
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -13,9 +13,12 @@ export function onError(error) {
|
||||
// legacy code
|
||||
export function extractRoles(role_list) {
|
||||
const selected_roles = [];
|
||||
role_list.forEach((item) => {
|
||||
selected_roles.push({ name: item[0], id: item[1] });
|
||||
});
|
||||
|
||||
if (role_list) {
|
||||
role_list.forEach((item) => {
|
||||
selected_roles.push({ name: item[0], id: item[1] });
|
||||
});
|
||||
}
|
||||
|
||||
return selected_roles;
|
||||
}
|
||||
|
||||
@@ -242,6 +242,7 @@ export default {
|
||||
file_mode: file.mode || "local",
|
||||
file_path: file.path,
|
||||
file_data: file,
|
||||
file_uri: file.uri,
|
||||
extension: this.extension,
|
||||
genome: this.genome,
|
||||
};
|
||||
|
||||
@@ -249,6 +249,7 @@ export default {
|
||||
file_size: file.size,
|
||||
file_mode: file.mode || "local",
|
||||
file_path: file.path,
|
||||
file_uri: file.uri,
|
||||
file_data: file,
|
||||
};
|
||||
},
|
||||
|
||||
@@ -242,6 +242,7 @@ export default {
|
||||
name: ftp_file.path,
|
||||
size: ftp_file.size,
|
||||
path: ftp_file.path,
|
||||
uri: ftp_file.uri,
|
||||
},
|
||||
]);
|
||||
},
|
||||
|
||||
@@ -292,24 +292,23 @@ export default {
|
||||
auto_decompress: true,
|
||||
};
|
||||
|
||||
// Composite does not use the fetch API, so we can just
|
||||
// index into the first element of items
|
||||
const item = items[0];
|
||||
let urls;
|
||||
if (item.get("file_mode") == "ftp") {
|
||||
urls = [item.get("file_path")];
|
||||
} else {
|
||||
urls = item.get("url_paste").split("\n");
|
||||
}
|
||||
urls.forEach((url) => {
|
||||
if (url != "") {
|
||||
data.targets[0].elements.push({
|
||||
url: url.trim(),
|
||||
src: "url",
|
||||
dbkey: item.get("genome", "?"),
|
||||
ext: item.get("extension", "auto"),
|
||||
});
|
||||
items.forEach((item) => {
|
||||
let urls;
|
||||
if (item.get("file_mode") == "ftp") {
|
||||
urls = [item.get("file_uri") || item.get("file_path")];
|
||||
} else {
|
||||
urls = item.get("url_paste").split("\n");
|
||||
}
|
||||
urls.forEach((url) => {
|
||||
if (url != "") {
|
||||
data.targets[0].elements.push({
|
||||
url: url.trim(),
|
||||
src: "url",
|
||||
dbkey: item.get("genome", "?"),
|
||||
ext: item.get("extension", "auto"),
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
return data;
|
||||
},
|
||||
|
||||
@@ -469,7 +469,7 @@ export default {
|
||||
}
|
||||
},
|
||||
onUpgrade() {
|
||||
this.attemptRefactor([{ action_type: "upgrade_all_steps" }]);
|
||||
this.onAttemptRefactor([{ action_type: "upgrade_all_steps" }]);
|
||||
},
|
||||
onEdit() {
|
||||
this.isCanvas = true;
|
||||
|
||||
@@ -105,9 +105,20 @@ export default {
|
||||
this.trsTool = tool;
|
||||
this.errorMessage = null;
|
||||
if (this.isAutoImport) {
|
||||
const version = this.trsTool.versions.find((version) => version.id === this.queryTrsVersionId);
|
||||
/* Resolve discrepancy between workflowhub, which sends an id as query parameter,
|
||||
and dockstore, which uses the version name as the query parameter.
|
||||
Should just be one of them eventually. */
|
||||
let versionField = "name";
|
||||
const version = this.trsTool.versions.find((version) => {
|
||||
if (version.name === this.queryTrsVersionId) {
|
||||
return true;
|
||||
} else if (version.id === this.queryTrsVersionId) {
|
||||
versionField = "id";
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if (version) {
|
||||
this.importVersion(this.trsTool.id, version, this.isRun);
|
||||
this.importVersion(this.trsTool.id, version[versionField], this.isRun);
|
||||
} else {
|
||||
Toast.warning(`Specified version: ${this.queryTrsVersionId} doesn't exist`);
|
||||
this.isAutoImport = false;
|
||||
|
||||
@@ -11,7 +11,7 @@ export default {
|
||||
methods: {
|
||||
importVersion(toolId, version, isRunFormRedirect = false) {
|
||||
this.services
|
||||
.importTrsTool(this.trsSelection.id, toolId, version.name)
|
||||
.importTrsTool(this.trsSelection.id, toolId, version)
|
||||
.then((response_data) => {
|
||||
redirectOnImport(getAppRoot(), response_data, isRunFormRedirect);
|
||||
})
|
||||
|
||||
@@ -492,12 +492,12 @@ var LibraryDatasetView = Backbone.View.extend({
|
||||
<!-- BREADCRUMBS -->
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item">
|
||||
<a title="Return to the list of libraries" href="<% rootPath %>libraries">Libraries</a>
|
||||
<a title="Return to the list of libraries" href="<% rootPath %>/libraries">Libraries</a>
|
||||
</li>
|
||||
<% _.each(item.get("full_path"), function(path_item) { %>
|
||||
<% if (path_item[0] != item.id) { %>
|
||||
<li class="breadcrumb-item">
|
||||
<a title="Return to this folder" href="<% rootPath %>folders/<%- path_item[0] %>">
|
||||
<a title="Return to this folder" href="<% rootPath %>/libraries/folders/<%- path_item[0] %>">
|
||||
<%- path_item[1] %>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -12,6 +12,7 @@ var Model = Backbone.Model.extend({
|
||||
file_size: 0,
|
||||
file_type: null,
|
||||
file_path: "",
|
||||
file_uri: null,
|
||||
file_data: null,
|
||||
percentage: 0,
|
||||
space_to_tab: false,
|
||||
|
||||
@@ -147,32 +147,35 @@ class LibraryManager:
|
||||
query = query.filter(trans.app.model.Library.table.c.deleted == false())
|
||||
else:
|
||||
# Nonadmins can't see deleted libraries
|
||||
query = query.filter(trans.app.model.Library.table.c.deleted == false())
|
||||
current_user_role_ids = [role.id for role in trans.get_current_user_roles()]
|
||||
all_actions = trans.sa_session.query(trans.model.LibraryPermissions).filter(trans.model.LibraryPermissions.table.c.role_id.in_(current_user_role_ids))
|
||||
library_add_action = trans.app.security_agent.permitted_actions.LIBRARY_ADD.action
|
||||
library_modify_action = trans.app.security_agent.permitted_actions.LIBRARY_MODIFY.action
|
||||
library_manage_action = trans.app.security_agent.permitted_actions.LIBRARY_MANAGE.action
|
||||
accessible_restricted_library_ids = set()
|
||||
allowed_library_add_ids = set()
|
||||
allowed_library_modify_ids = set()
|
||||
allowed_library_manage_ids = set()
|
||||
for action in all_actions:
|
||||
if action.action == library_access_action:
|
||||
accessible_restricted_library_ids.add(action.library_id)
|
||||
if action.action == library_add_action:
|
||||
allowed_library_add_ids.add(action.library_id)
|
||||
if action.action == library_modify_action:
|
||||
allowed_library_modify_ids.add(action.library_id)
|
||||
if action.action == library_manage_action:
|
||||
allowed_library_manage_ids.add(action.library_id)
|
||||
query = query.filter(or_(
|
||||
not_(trans.model.Library.table.c.id.in_(restricted_library_ids)),
|
||||
trans.model.Library.table.c.id.in_(accessible_restricted_library_ids)
|
||||
))
|
||||
prefetched_ids['allowed_library_add_ids'] = allowed_library_add_ids
|
||||
prefetched_ids['allowed_library_modify_ids'] = allowed_library_modify_ids
|
||||
prefetched_ids['allowed_library_manage_ids'] = allowed_library_manage_ids
|
||||
if deleted:
|
||||
raise exceptions.AdminRequiredException()
|
||||
else:
|
||||
query = query.filter(trans.app.model.Library.table.c.deleted == false())
|
||||
current_user_role_ids = [role.id for role in trans.get_current_user_roles()]
|
||||
all_actions = trans.sa_session.query(trans.model.LibraryPermissions).filter(trans.model.LibraryPermissions.table.c.role_id.in_(current_user_role_ids))
|
||||
library_add_action = trans.app.security_agent.permitted_actions.LIBRARY_ADD.action
|
||||
library_modify_action = trans.app.security_agent.permitted_actions.LIBRARY_MODIFY.action
|
||||
library_manage_action = trans.app.security_agent.permitted_actions.LIBRARY_MANAGE.action
|
||||
accessible_restricted_library_ids = set()
|
||||
allowed_library_add_ids = set()
|
||||
allowed_library_modify_ids = set()
|
||||
allowed_library_manage_ids = set()
|
||||
for action in all_actions:
|
||||
if action.action == library_access_action:
|
||||
accessible_restricted_library_ids.add(action.library_id)
|
||||
if action.action == library_add_action:
|
||||
allowed_library_add_ids.add(action.library_id)
|
||||
if action.action == library_modify_action:
|
||||
allowed_library_modify_ids.add(action.library_id)
|
||||
if action.action == library_manage_action:
|
||||
allowed_library_manage_ids.add(action.library_id)
|
||||
query = query.filter(or_(
|
||||
not_(trans.model.Library.table.c.id.in_(restricted_library_ids)),
|
||||
trans.model.Library.table.c.id.in_(accessible_restricted_library_ids)
|
||||
))
|
||||
prefetched_ids['allowed_library_add_ids'] = allowed_library_add_ids
|
||||
prefetched_ids['allowed_library_modify_ids'] = allowed_library_modify_ids
|
||||
prefetched_ids['allowed_library_manage_ids'] = allowed_library_manage_ids
|
||||
return query, prefetched_ids
|
||||
|
||||
def secure(self, trans, library, check_accessible=True):
|
||||
|
||||
@@ -20,20 +20,40 @@ class UploadFtpSeleniumIntegrationTestCase(SeleniumIntegrationTestCase):
|
||||
def ftp_dir(cls):
|
||||
return cls.temp_config_dir("ftp")
|
||||
|
||||
@selenium_test
|
||||
def test_upload_simplest(self):
|
||||
email = self.get_logged_in_user()["email"]
|
||||
user_ftp_dir = os.path.join(self.ftp_dir(), email)
|
||||
os.makedirs(user_ftp_dir)
|
||||
file_path = os.path.join(user_ftp_dir, "1.txt")
|
||||
with open(file_path, "w")as f:
|
||||
f.write("Hello World!")
|
||||
|
||||
def _upload_all(self):
|
||||
self.home()
|
||||
self.components.upload.start.wait_for_and_click()
|
||||
self.components.upload.ftp_add.wait_for_and_click()
|
||||
self.components.upload.ftp_popup.wait_for_visible()
|
||||
self.components.upload.ftp_items().all()[0].click()
|
||||
for item in self.components.upload.ftp_items().all():
|
||||
item.click()
|
||||
self.components.upload.ftp_close.wait_for_and_click()
|
||||
self.components.upload.row(n=0).wait_for_visible()
|
||||
self.upload_start()
|
||||
self.sleep_for(self.wait_types.UX_RENDER)
|
||||
self.wait_for_history()
|
||||
|
||||
def _create_ftp_dir(self):
|
||||
email = self.get_logged_in_user()["email"]
|
||||
user_ftp_dir = os.path.join(self.ftp_dir(), email)
|
||||
os.makedirs(user_ftp_dir)
|
||||
return user_ftp_dir
|
||||
|
||||
@selenium_test
|
||||
def test_upload_simplest(self):
|
||||
user_ftp_dir = self._create_ftp_dir()
|
||||
file_path = os.path.join(user_ftp_dir, "1.txt")
|
||||
with open(file_path, "w") as f:
|
||||
f.write("Hello World!")
|
||||
self._upload_all()
|
||||
|
||||
@selenium_test
|
||||
def test_upload_multiple(self):
|
||||
user_ftp_dir = self._create_ftp_dir()
|
||||
file_path = os.path.join(user_ftp_dir, "1.txt")
|
||||
with open(file_path, "w") as f:
|
||||
f.write("Hello World!")
|
||||
file_path = os.path.join(user_ftp_dir, "2.txt")
|
||||
with open(file_path, "w") as f:
|
||||
f.write("Hello Galaxy!")
|
||||
self._upload_all()
|
||||
|
||||
@@ -26,7 +26,7 @@ def safe_bed_file(infile):
|
||||
https://lists.soe.ucsc.edu/pipermail/genome/2007-May/013561.html
|
||||
"""
|
||||
fix_pat = re.compile("^(track|browser)")
|
||||
with tempfile.NamedTemporaryFile(mode='w', delete=False) as out_handle, open(infile, 'w') as in_handle:
|
||||
with tempfile.NamedTemporaryFile(mode='w', delete=False) as out_handle, open(infile, 'r') as in_handle:
|
||||
for line in in_handle:
|
||||
if fix_pat.match(line):
|
||||
line = "#" + line
|
||||
|
||||
Reference in New Issue
Block a user