Remove legacy grid shared module

This commit is contained in:
guerler
2023-11-15 17:37:43 +03:00
parent c70f09ed9d
commit 659ef8ad68
5 changed files with 2 additions and 105 deletions
-33
View File
@@ -1,33 +0,0 @@
<template>
<div ref="target" />
</template>
<script>
import GridShared from "mvc/grid/grid-shared";
export default {
props: {
actionId: {
type: String,
default: null,
},
plural: {
type: String,
default: null,
},
item: {
type: String,
default: null,
},
},
mounted() {
const activeTab = this.actionId == "list_published" ? "shared" : "user";
new GridShared.View({
action_id: this.actionId,
plural: this.plural,
item: this.item,
active_tab: activeTab,
}).$el.appendTo(this.$refs.target);
},
};
</script>
@@ -1,5 +1,5 @@
import { fetcher } from "@/api/schema";
import Filtering, { contains, equals, expandNameTag, toBool, type ValidFilter } from "@/utils/filtering";
import Filtering, { contains, expandNameTag, type ValidFilter } from "@/utils/filtering";
import { withPrefix } from "@/utils/redirect";
/**
-1
View File
@@ -9,7 +9,6 @@ import DatasetError from "components/DatasetInformation/DatasetError";
import FormGeneric from "components/Form/FormGeneric";
import GridHistory from "components/Grid/GridHistory";
import GridList from "components/Grid/GridList";
import GridShared from "components/Grid/GridShared";
import HistoryExportTasks from "components/History/Export/HistoryExport";
import HistoryPublished from "components/History/HistoryPublished";
import HistoryPublishedList from "components/History/HistoryPublishedList";
-69
View File
@@ -1,69 +0,0 @@
/** This class renders the grid list with shared section. */
import { getGalaxyInstance } from "app";
import Backbone from "backbone";
import $ from "jquery";
import GridView from "mvc/grid/grid-view";
import { getAppRoot } from "onload/loadConfig";
import LoadingIndicator from "ui/loading-indicator";
import _ from "underscore";
var View = Backbone.View.extend({
initialize: function (options) {
var self = this;
const Galaxy = getGalaxyInstance();
LoadingIndicator.markViewAsLoading(this);
this.model = new Backbone.Model(options);
this.item = this.model.get("item");
this.title = this.model.get("plural");
if (options && options.active_tab) {
this.active_tab = options.active_tab;
}
$.ajax({
url: `${getAppRoot() + this.item}/${this.model.get("action_id")}?${$.param(Galaxy.params)}`,
success: function (response) {
self.model.set(response);
self.render();
},
});
},
render: function () {
var grid = new GridView(this.model.attributes);
this.$el.empty().append(grid.$el);
this.$el.append(this._templateShared());
},
_templateShared: function () {
var self = this;
var $tmpl = $(`<div><br/><h2>${this.model.get("plural")} shared with you by others</h2></div>`);
var options = this.model.attributes;
if (options.shared_by_others && options.shared_by_others.length > 0) {
var $table = $(
'<table class="colored" border="0" cellspacing="0" cellpadding="0" width="100%">' +
'<tr class="header">' +
"<th>Title</th>" +
"<th>Owner</th>" +
"</tr>" +
"</table>"
);
_.each(options.shared_by_others, (it, index) => {
var display_url = `${getAppRoot() + self.item}/display_by_username_and_slug?username=${
it.username
}&slug=${it.slug}`;
$table.append(
`<tr><td><a href="${display_url}">${_.escape(it.title)}</a></td><td>${_.escape(
it.username
)}</td></tr>`
);
});
$tmpl.append($table);
} else {
$tmpl.append(`No ${this.model.get("plural").toLowerCase()} have been shared with you.`);
}
return $tmpl;
},
});
export default {
View: View,
};
+1 -1
View File
@@ -9946,7 +9946,7 @@ class Visualization(Base, HasTags, Dictifiable, RepresentById):
@property
def annotation(self):
if (len(self.annotations) == 1):
if len(self.annotations) == 1:
return self.annotations[0].annotation
return None