mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #9368 from guerler/add_label_filters
Fix success message in user preferences, add help text to toolbox filter page
This commit is contained in:
@@ -1,21 +1,22 @@
|
||||
<template>
|
||||
<b-container fluid class="p-0">
|
||||
<h2>User preferences</h2>
|
||||
<b-alert :variant="messageVariant" :show="!!message">
|
||||
{{ message }}
|
||||
</b-alert>
|
||||
<p>
|
||||
You are logged in as <strong>{{ email }}</strong
|
||||
>.
|
||||
</p>
|
||||
<b-row class="ml-3 mb-1" v-for="(link, index) in activeLinks" :key="index">
|
||||
<i :class="`pref-icon pt-1 fa fa-lg ${link.icon}`"></i>
|
||||
<i :class="['pref-icon pt-1 fa fa-lg', link.icon]" />
|
||||
<div class="pref-content pr-1">
|
||||
<div>
|
||||
<a v-if="link.onclick" @click="link.onclick" href="javascript:void(0)"
|
||||
><b>{{ link.title }}</b></a
|
||||
>
|
||||
<a v-else :href="`${baseUrl}/${link.action}`"
|
||||
><b>{{ link.title }}</b></a
|
||||
>
|
||||
</div>
|
||||
<a v-if="link.onclick" @click="link.onclick" href="javascript:void(0)"
|
||||
><b>{{ link.title }}</b></a
|
||||
>
|
||||
<a v-else :href="`${baseUrl}/${link.action}`"
|
||||
><b>{{ link.title }}</b></a
|
||||
>
|
||||
<div class="form-text text-muted">
|
||||
{{ link.description }}
|
||||
</div>
|
||||
@@ -32,44 +33,49 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Vue from "vue";
|
||||
import BootstrapVue from "bootstrap-vue";
|
||||
import { getGalaxyInstance } from "app";
|
||||
import { getAppRoot } from "onload/loadConfig";
|
||||
import _l from "utils/localization";
|
||||
import axios from "axios";
|
||||
import Ui from "mvc/ui/ui-misc";
|
||||
import QueryStringParsing from "utils/query-string-parsing";
|
||||
import { getUserPreferencesModel } from "components/User/UserPreferencesModel";
|
||||
import Vue from "vue";
|
||||
import BootstrapVue from "bootstrap-vue";
|
||||
import $ from "jquery";
|
||||
|
||||
Vue.use(BootstrapVue);
|
||||
|
||||
export default {
|
||||
props: {
|
||||
userId: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
enableQuotas: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
const Galaxy = getGalaxyInstance();
|
||||
return {
|
||||
user: Galaxy.user,
|
||||
email: "",
|
||||
diskUsage: "",
|
||||
quotaUsageString: "",
|
||||
baseUrl: `${getAppRoot()}user`
|
||||
baseUrl: `${getAppRoot()}user`,
|
||||
messageVariant: null,
|
||||
message: null
|
||||
};
|
||||
},
|
||||
created() {
|
||||
const Galaxy = getGalaxyInstance();
|
||||
const config = Galaxy.config;
|
||||
const message = QueryStringParsing.get("message");
|
||||
const status = QueryStringParsing.get("status");
|
||||
|
||||
if (message && status) {
|
||||
$(this.$el).prepend(new Ui.Message({ message: message, status: status }).$el);
|
||||
this.message = message;
|
||||
this.messageVariant = status;
|
||||
}
|
||||
|
||||
axios.get(`${getAppRoot()}api/users/${Galaxy.user.id}`).then(response => {
|
||||
axios.get(`${getAppRoot()}api/users/${this.userId}`).then(response => {
|
||||
this.email = response.data.email;
|
||||
this.diskUsage = response.data.nice_total_disk_usage;
|
||||
this.quotaUsageString = config.enable_quotas
|
||||
this.quotaUsageString = this.enableQuotas
|
||||
? `Your disk quota is: <strong>${response.data.quota}</strong>.`
|
||||
: "";
|
||||
});
|
||||
@@ -78,23 +84,21 @@ export default {
|
||||
activeLinks() {
|
||||
const activeLinks = {};
|
||||
const UserPreferencesModel = getUserPreferencesModel();
|
||||
|
||||
for (const key in UserPreferencesModel) {
|
||||
if (UserPreferencesModel[key].shouldRender !== false) {
|
||||
activeLinks[key] = UserPreferencesModel[key];
|
||||
|
||||
switch (key) {
|
||||
case "make_data_private":
|
||||
activeLinks[key]["onclick"] = this.makeDataPrivate;
|
||||
activeLinks[key].onclick = this.makeDataPrivate;
|
||||
break;
|
||||
case "custom_builds":
|
||||
activeLinks[key]["onclick"] = this.openManageCustomBuilds;
|
||||
activeLinks[key].onclick = this.openManageCustomBuilds;
|
||||
break;
|
||||
case "logout":
|
||||
activeLinks[key]["onclick"] = this.signOut;
|
||||
activeLinks[key].onclick = this.signOut;
|
||||
break;
|
||||
default:
|
||||
activeLinks[key]["action"] = key;
|
||||
activeLinks[key].action = key;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,12 +126,12 @@ export default {
|
||||
)
|
||||
)
|
||||
) {
|
||||
$.post(`${Galaxy.root}history/make_private`, { all_histories: true }, () => {
|
||||
axios.post(`${getAppRoot()}history/make_private?all_histories=true`).then(response => {
|
||||
Galaxy.modal.show({
|
||||
title: _l("Datasets are now private"),
|
||||
body: `All of your histories and datsets have been made private. If you'd like to make all *future* histories private please use the <a href="${Galaxy.root}user/permissions">User Permissions</a> interface.`,
|
||||
buttons: {
|
||||
Close: function() {
|
||||
Close: () => {
|
||||
Galaxy.modal.hide();
|
||||
}
|
||||
}
|
||||
@@ -156,11 +160,11 @@ export default {
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
<style scoped>
|
||||
.pref-content {
|
||||
width: calc(100% - 40px);
|
||||
width: calc(100% - 3rem);
|
||||
}
|
||||
.pref-icon {
|
||||
width: 40px;
|
||||
width: 3rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -6,7 +6,7 @@ export const getUserPreferencesModel = () => {
|
||||
const config = Galaxy.config;
|
||||
return {
|
||||
information: {
|
||||
title: _l("Manage information"),
|
||||
title: _l("Manage Information"),
|
||||
description: "Edit your email, addresses and custom parameters or change your public name.",
|
||||
url: `api/users/${Galaxy.user.id}/information/inputs`,
|
||||
icon: "fa-user",
|
||||
@@ -14,16 +14,16 @@ export const getUserPreferencesModel = () => {
|
||||
shouldRender: !config.use_remote_user
|
||||
},
|
||||
password: {
|
||||
title: _l("Change password"),
|
||||
title: _l("Change Password"),
|
||||
description: _l("Allows you to change your login credentials."),
|
||||
icon: "fa-unlock-alt",
|
||||
url: `api/users/${Galaxy.user.id}/password/inputs`,
|
||||
submit_title: "Save password",
|
||||
submit_title: "Save Password",
|
||||
redirect: "user",
|
||||
shouldRender: !config.use_remote_user
|
||||
},
|
||||
communication: {
|
||||
title: _l("Change communication settings"),
|
||||
title: _l("Change Communication Settings"),
|
||||
description: _l("Enable or disable the communication feature to chat with other users."),
|
||||
url: `api/users/${Galaxy.user.id}/communication/inputs`,
|
||||
icon: "fa-comments-o",
|
||||
@@ -31,50 +31,50 @@ export const getUserPreferencesModel = () => {
|
||||
shouldRender: !!config.enable_communication_server
|
||||
},
|
||||
permissions: {
|
||||
title: _l("Set dataset permissions for new histories"),
|
||||
title: _l("Set Dataset Permissions for new Histories"),
|
||||
description:
|
||||
"Grant others default access to newly created histories. Changes made here will only affect histories created after these settings have been stored.",
|
||||
url: `api/users/${Galaxy.user.id}/permissions/inputs`,
|
||||
icon: "fa-users",
|
||||
submit_title: "Save permissions",
|
||||
submit_title: "Save Permissions",
|
||||
redirect: "user"
|
||||
},
|
||||
make_data_private: {
|
||||
title: _l("Make all data private"),
|
||||
title: _l("Make all Data Private"),
|
||||
description: _l("Click here to make all data private."),
|
||||
icon: "fa-lock"
|
||||
},
|
||||
api_key: {
|
||||
title: _l("Manage API key"),
|
||||
title: _l("Manage API Key"),
|
||||
description: _l("Access your current API key or create a new one."),
|
||||
url: `api/users/${Galaxy.user.id}/api_key/inputs`,
|
||||
icon: "fa-key",
|
||||
submit_title: "Create a new key",
|
||||
submit_title: "Create a new Key",
|
||||
submit_icon: "fa-check"
|
||||
},
|
||||
cloud_auth: {
|
||||
title: _l("Manage Cloud Authorization"),
|
||||
description: _l("Add or modify the configuration that grants Galaxy to access your cloud-based resources."),
|
||||
icon: "fa-cloud",
|
||||
submit_title: "Create a new key",
|
||||
submit_title: "Create a new Key",
|
||||
submit_icon: "fa-check"
|
||||
},
|
||||
toolbox_filters: {
|
||||
title: _l("Manage Toolbox filters"),
|
||||
title: _l("Manage Toolbox Filters"),
|
||||
description: _l("Customize your Toolbox by displaying or omitting sets of Tools."),
|
||||
url: `api/users/${Galaxy.user.id}/toolbox_filters/inputs`,
|
||||
icon: "fa-filter",
|
||||
submit_title: "Save filters",
|
||||
submit_title: "Save Filters",
|
||||
redirect: "user",
|
||||
shouldRender: !!config.has_user_tool_filters
|
||||
},
|
||||
custom_builds: {
|
||||
title: _l("Manage custom builds"),
|
||||
title: _l("Manage Custom Builds"),
|
||||
description: _l("Add or remove custom builds using history datasets."),
|
||||
icon: "fa-cubes"
|
||||
},
|
||||
logout: {
|
||||
title: _l("Sign out"),
|
||||
title: _l("Sign Out"),
|
||||
description: _l("Click here to sign out of all sessions."),
|
||||
icon: "fa-sign-out",
|
||||
shouldRender: !!Galaxy.session_csrf_token
|
||||
|
||||
@@ -111,10 +111,11 @@ export const getAnalysisRouter = Galaxy =>
|
||||
},
|
||||
|
||||
show_user: function() {
|
||||
const UserPreferencesInstance = Vue.extend(UserPreferences);
|
||||
const vm = document.createElement("div");
|
||||
this.page.display(vm);
|
||||
new UserPreferencesInstance().$mount(vm);
|
||||
const Galaxy = getGalaxyInstance();
|
||||
this._display_vue_helper(UserPreferences, {
|
||||
enableQuotas: Galaxy.config.enable_quotas,
|
||||
userId: Galaxy.user.id
|
||||
});
|
||||
},
|
||||
|
||||
show_user_form: function(form_id) {
|
||||
|
||||
@@ -100,7 +100,7 @@ class AdminActions(object):
|
||||
else:
|
||||
try:
|
||||
new_amount = util.size_to_bytes(params.amount)
|
||||
except AssertionError:
|
||||
except (AssertionError, ValueError):
|
||||
new_amount = False
|
||||
if not params.amount:
|
||||
raise ActionInputError('Enter a valid amount.')
|
||||
|
||||
@@ -644,7 +644,11 @@ class UserAPIController(BaseAPIController, UsesTagsMixin, CreatesApiKeysMixin, B
|
||||
for name, value in user.preferences.items():
|
||||
if name in filter_types:
|
||||
saved_values[name] = listify(value, do_strip=True)
|
||||
inputs = []
|
||||
inputs = [{
|
||||
'type': 'hidden',
|
||||
'name': 'helptext',
|
||||
'label': 'In this section you may enable or disable Toolbox filters. Please contact your admin to configure filters as necessary.'
|
||||
}]
|
||||
errors = {}
|
||||
factory = FilterFactory(trans.app.toolbox)
|
||||
for filter_type in filter_types:
|
||||
|
||||
@@ -29,6 +29,7 @@ from galaxy.util import (
|
||||
Params,
|
||||
parse_int,
|
||||
sanitize_text,
|
||||
string_as_bool,
|
||||
unicodify
|
||||
)
|
||||
from galaxy.web import url_for
|
||||
@@ -456,8 +457,8 @@ class HistoryController(BaseUIController, SharableMixin, UsesAnnotations, UsesIt
|
||||
return trans.fill_template_mako(
|
||||
"history/as_xml.mako",
|
||||
history=history,
|
||||
show_deleted=galaxy.util.string_as_bool(show_deleted),
|
||||
show_hidden=galaxy.util.string_as_bool(show_hidden))
|
||||
show_deleted=string_as_bool(show_deleted),
|
||||
show_hidden=string_as_bool(show_hidden))
|
||||
|
||||
@web.expose
|
||||
@web.json
|
||||
@@ -554,9 +555,9 @@ class HistoryController(BaseUIController, SharableMixin, UsesAnnotations, UsesIt
|
||||
"""
|
||||
View a history. If a history is importable, then it is viewable by any user.
|
||||
"""
|
||||
show_deleted = galaxy.util.string_as_bool(show_deleted)
|
||||
show_hidden = galaxy.util.string_as_bool(show_hidden)
|
||||
use_panels = galaxy.util.string_as_bool(use_panels)
|
||||
show_deleted = string_as_bool(show_deleted)
|
||||
show_hidden = string_as_bool(show_hidden)
|
||||
use_panels = string_as_bool(use_panels)
|
||||
|
||||
history_dictionary = {}
|
||||
user_is_owner = False
|
||||
@@ -602,7 +603,7 @@ class HistoryController(BaseUIController, SharableMixin, UsesAnnotations, UsesIt
|
||||
"""
|
||||
current_history_id = trans.security.encode_id(trans.history.id)
|
||||
# TODO: allow specifying user_id for admin?
|
||||
include_deleted_histories = galaxy.util.string_as_bool(include_deleted_histories)
|
||||
include_deleted_histories = string_as_bool(include_deleted_histories)
|
||||
limit = parse_int(limit, min_val=1, default=10, allow_none=True)
|
||||
|
||||
return trans.fill_template_mako("history/view_multiple.mako", current_history_id=current_history_id,
|
||||
@@ -690,6 +691,7 @@ class HistoryController(BaseUIController, SharableMixin, UsesAnnotations, UsesIt
|
||||
permissions for the history to private, for future datasets.
|
||||
"""
|
||||
histories = []
|
||||
all_histories = string_as_bool(all_histories)
|
||||
if all_histories:
|
||||
histories = trans.user.histories
|
||||
elif history_id:
|
||||
@@ -1074,7 +1076,7 @@ class HistoryController(BaseUIController, SharableMixin, UsesAnnotations, UsesIt
|
||||
@web.expose
|
||||
def resume_paused_jobs(self, trans, current=False, ids=None):
|
||||
"""Resume paused jobs the active history -- this does not require a logged in user."""
|
||||
if not ids and galaxy.util.string_as_bool(current):
|
||||
if not ids and string_as_bool(current):
|
||||
histories = [trans.get_history()]
|
||||
refresh_frames = ['history']
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user