Commit 7d93f386 authored by davelopez's avatar davelopez
Browse files

Add href links to some history item actions

This will allow to right click and open the action in a new tab or window.
parent b308b9fc
Loading
Loading
Loading
Loading
+26 −7
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@
                    :is-history-item="isHistoryItem"
                    :is-visible="item.visible"
                    :state="state"
                    :item-urls="itemUrls"
                    @delete="$emit('delete')"
                    @display="onDisplay"
                    @edit="onEdit"
@@ -81,6 +82,7 @@
                v-if="expandDataset"
                :dataset="item"
                :show-highlight="isHistoryItem"
                :item-urls="itemUrls"
                @edit="onEdit"
                @toggleHighlights="toggleHighlights" />
        </b-collapse>
@@ -99,9 +101,12 @@ import { JobStateSummary } from "./Collection/JobStateSummary";
import { library } from "@fortawesome/fontawesome-svg-core";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import { faArrowCircleUp, faMinusCircle, faCheckCircle } from "@fortawesome/free-solid-svg-icons";
import { getAppRoot } from "onload/loadConfig";

library.add(faArrowCircleUp, faMinusCircle, faCheckCircle);

const root = getAppRoot();

export default {
    components: {
        CollectionDescription,
@@ -165,6 +170,25 @@ export default {
        tagsDisabled() {
            return !this.expandDataset || !this.isHistoryItem;
        },
        isCollection() {
            return "collection_type" in this.item;
        },
        itemUrls() {
            const id = this.item.id;
            if (this.isCollection) {
                return {
                    edit: `${root}collection/edit/${id}`,
                };
            }
            return {
                display: `${root}datasets/${id}/display/?preview=True`,
                edit: `${root}datasets/edit?dataset_id=${id}`,
                showDetails: `${root}datasets/${id}/details`,
                reportError: `${root}datasets/error?dataset_id=${id}`,
                rerun: `${root}tool_runner/rerun?id=${id}`,
                visualize: `visualizations?dataset_id=${id}`,
            };
        },
    },
    methods: {
        onClick() {
@@ -175,8 +199,7 @@ export default {
            }
        },
        onDisplay() {
            const url = `datasets/${this.item.id}/display/?preview=True`;
            iframeAdd({ path: url, title: this.name });
            iframeAdd({ path: this.itemUrls.display, title: this.name });
        },
        onDragStart(evt) {
            evt.dataTransfer.dropEffect = "move";
@@ -184,11 +207,7 @@ export default {
            evt.dataTransfer.setData("text", JSON.stringify([this.item]));
        },
        onEdit() {
            if (this.item.collection_type) {
                backboneRoute(`collection/edit/${this.item.id}`);
            } else {
                backboneRoute("datasets/edit", { dataset_id: this.item.id });
            }
            backboneRoute(this.itemUrls.edit);
        },
        onTags(newTags) {
            this.$emit("tag-change", this.item, newTags);
+5 −2
Original line number Diff line number Diff line
@@ -7,7 +7,8 @@
            class="px-1"
            size="sm"
            variant="link"
            @click.stop="$emit('display')">
            :href="itemUrls.display"
            @click.prevent.stop="$emit('display')">
            <icon icon="eye" />
        </b-button>
        <b-button
@@ -17,7 +18,8 @@
            class="px-1"
            size="sm"
            variant="link"
            @click.stop="$emit('edit')">
            :href="itemUrls.edit"
            @click.prevent.stop="$emit('edit')">
            <icon icon="pen" />
        </b-button>
        <b-button
@@ -58,6 +60,7 @@ export default {
        isHistoryItem: { type: Boolean, required: true },
        isVisible: { type: Boolean, default: true },
        state: { type: String, default: "" },
        itemUrls: { type: Object, required: true },
    },
    computed: {
        displayButtonTitle() {
+18 −7
Original line number Diff line number Diff line
@@ -2,7 +2,14 @@
    <div class="dataset-actions mb-1">
        <div class="clearfix">
            <div class="btn-group float-left">
                <b-button v-if="showError" class="px-1" title="Error" size="sm" variant="link" @click.stop="onError">
                <b-button
                    v-if="showError"
                    class="px-1"
                    title="Error"
                    size="sm"
                    variant="link"
                    :href="itemUrls.reportError"
                    @click.prevent.stop="onError">
                    <span class="fa fa-bug" />
                </b-button>
                <dataset-download v-if="showDownloads" :item="item" @on-download="onDownload" />
@@ -21,7 +28,8 @@
                    title="Dataset Details"
                    size="sm"
                    variant="link"
                    @click.stop="onInfo">
                    :href="itemUrls.showDetails"
                    @click.prevent.stop="onInfo">
                    <span class="fa fa-info-circle" />
                </b-button>
                <b-button
@@ -30,7 +38,8 @@
                    title="Run Job Again"
                    size="sm"
                    variant="link"
                    @click.stop="onRerun">
                    :href="itemUrls.rerun"
                    @click.prevent.stop="onRerun">
                    <span class="fa fa-redo" />
                </b-button>
                <b-button
@@ -39,7 +48,8 @@
                    title="Visualize"
                    size="sm"
                    variant="link"
                    @click.stop="onVisualize">
                    :href="itemUrls.visualize"
                    @click.prevent.stop="onVisualize">
                    <span class="fa fa-bar-chart-o" />
                </b-button>
                <b-button
@@ -74,6 +84,7 @@ export default {
    props: {
        item: { type: Object, required: true },
        showHighlight: { type: Boolean, default: false },
        itemUrls: { type: Object, required: true },
    },
    computed: {
        showDownloads() {
@@ -107,10 +118,10 @@ export default {
            window.location.href = resource;
        },
        onError() {
            this.backboneRoute("datasets/error", { dataset_id: this.item.id });
            this.backboneRoute(this.itemUrls.reportError);
        },
        onInfo() {
            this.backboneRoute(`datasets/${this.item.id}/details`);
            this.backboneRoute(this.itemUrls.showDetails);
        },
        onRerun() {
            this.backboneRoute(`root?job_id=${this.item.creating_job}`);
@@ -118,7 +129,7 @@ export default {
        onVisualize() {
            const name = this.item.name || "";
            const title = `Visualization of ${name}`;
            const path = `visualizations?dataset_id=${this.item.id}`;
            const path = this.itemUrls.visualize;
            const redirectParams = {
                path: path,
                title: title,
+6 −1
Original line number Diff line number Diff line
@@ -21,7 +21,11 @@
                        <span class="value">{{ result.misc_info }}</span>
                    </div>
                </div>
                <DatasetActions :item="result" :show-highlight="showHighlight" @toggleHighlights="toggleHighlights" />
                <DatasetActions
                    :item="result"
                    :show-highlight="showHighlight"
                    :item-urls="itemUrls"
                    @toggleHighlights="toggleHighlights" />
                <pre v-if="result.peek" class="dataset-peek p-1" v-html="result.peek" />
            </div>
        </div>
@@ -94,6 +98,7 @@ export default {
    props: {
        dataset: { type: Object, required: true },
        showHighlight: { type: Boolean, default: false },
        itemUrls: { type: Object, required: true },
    },
    computed: {
        stateText() {