Skip to content

Commit

Permalink
Merge pull request #492 from AudiovisualMetadataPlatform/AMP-3016_eva…
Browse files Browse the repository at this point in the history
…lLink

Amp 3016 eval link
  • Loading branch information
yingfeng-iu authored Oct 18, 2023
2 parents 82cbe2d + f3b4940 commit 3ea1e2a
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 48 deletions.
16 changes: 8 additions & 8 deletions src/components/dashboard/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -647,17 +647,17 @@
(item) => {
if (parent === 'TestResults')
return (
item.field !== 'dateCreated' &&
// item.field !== 'dateCreated' &&
item.field !== 'status' &&
item.field !== 'actions' &&
item.field !== 'addToTest'
);
else
return (
item.field !== 'testDate' &&
item.field !== 'outputDate' &&
// item.field !== 'dateCreated' &&
item.field !== 'groundTruth' &&
item.field !== 'outputTest' &&
item.field !== 'scores' &&
item.field !== 'addToTest'
);
}
Expand Down Expand Up @@ -1194,7 +1194,7 @@ export default {
}
return (
column.field !== "dateCreated" &&
//column.field !== "dateCreated" &&
column.field !== "status" &&
column.field !== "actions"
);
Expand All @@ -1211,9 +1211,9 @@ export default {
return (
column.field !== "testDate" &&
column.field !== "outputDate" &&
//column.field !== "dateCreated" &&
column.field !== "groundTruth" &&
column.field !== "outputTest" &&
column.field !== "scores" &&
column.field !== "status" &&
column.field !== "actions"
);
Expand All @@ -1230,12 +1230,12 @@ export default {
this.columns = this.columns.filter((column) => {
return (
column.field !== "testDate" &&
column.field !== "outputDate" &&
//column.field !== "dateCreated" &&
column.field !== "unit" &&
column.field !== "externalSource" &&
column.field !== "workflowStep" &&
column.field !== "groundTruth" &&
column.field !== "outputTest" &&
column.field !== "scores" &&
column.field !== "actions" &&
column.field !== "addToTest"
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/dashboard/DashboardFilters/DateFilter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
v-on:click="setFilterFlags"
>
{{
label ? label : parent === "TestResults" ? "Output Date" : "Date range"
label ? label : parent === "TestResults" ? "Date" : "Date"
}}
</button>
<div
Expand Down
40 changes: 11 additions & 29 deletions src/components/dashboard/DashboardTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@
</td>
<td v-if="checkAvailability('testDate')">
{{ new Date(rec.testDate) | LOCAL_DATE_VALUE }}
</td>
<td v-if="checkAvailability('outputDate')">
{{ new Date(rec.outputDate) | LOCAL_DATE_VALUE }}
</td>
</td><!--
<td v-if="checkAvailability('dateCreated')">
{{ new Date(rec.dateCreated) | LOCAL_DATE_VALUE }}
</td>-->
<td v-if="checkAvailability('submitter')">{{ rec.submitter }}</td>
<td v-if="checkAvailability('unit')">{{ rec.unitName }}</td>
<td v-if="checkAvailability('collectionName')">
Expand All @@ -132,7 +132,7 @@
<td v-if="checkAvailability('itemName')">{{ rec.itemName }}</td>
<td v-if="checkAvailability('primaryfileName') && canAccessLink(rec, true)">
<a
@click="workflowResultService.getSymlinkContent(rec, false, $event)"
@click="workflowResultService.getSymlinkContent(rec, false, parent, $event)"
target="_blank"
class="complete-output"
>{{ rec.primaryfileName }}</a
Expand All @@ -153,7 +153,7 @@
outputReady(rec)"
>
<a
@click="workflowResultService.getSymlinkContent(rec, true, $event)"
@click="workflowResultService.getSymlinkContent(rec, true, parent, $event)"
target="_blank"
class="complete-output"
>{{ rec.outputName }}</a
Expand All @@ -171,7 +171,7 @@
outputReady(rec)"
>
<a
@click="workflowResultService.getSymlinkContent(rec, true, $event)"
@click="workflowResultService.getSymlinkContent(rec, true, parent, $event)"
target="_blank"
class="complete-output"
>{{ rec.outputLabel }}</a
Expand All @@ -186,8 +186,8 @@
<td v-if="checkAvailability('groundTruth')">
{{ rec.groundTruth }}
</td>
<td v-if="checkAvailability('outputTest')">
{{ rec.outputTest }}
<td v-if="checkAvailability('scores')">
{{ rec.scores }}
</td>
<td
v-if="
Expand Down Expand Up @@ -473,25 +473,6 @@ export default {
},
},
methods: {
// async getMedia(rec, event) {
// // let link = doc.getElementById(rec.id + '-M');
// let link = event.target;
// if (!link.href) {
// let symlink = await this.workflowResultService.getMediaSymlink(rec.primaryfileId);
// link.href = symlink;
// link.click();
// console.log("media symlink = " + symlink)
// }
// },
async getOutput(rec) {
let link = document.getElementById(rec.id + '-O');
if (!link.href) {
let symlink = await this.workflowResultService.getOutputSymlink(rec.Id);
link.href = symlink;
link.click();
console.log("output symlink = " + symlink)
}
},
async setWorkflowResultFinal(workflowResultId) {
for (
var r = 0;
Expand Down Expand Up @@ -520,7 +501,8 @@ export default {
else return true;
},
outputReady(wr) {
return wr.outputPath != null && wr.status == 'COMPLETE'
return this.parent === "TestResults" || this.parent === "NewTest" ||
wr.outputPath != null && wr.status == 'COMPLETE'
},
// canAccessLink(result, forMedia) {
// let actionType = env.getEnv("VUE_APP_AC_ACTIONTYPE_READ");
Expand Down
19 changes: 15 additions & 4 deletions src/service/workflow-result-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default class WorkflowResultService extends BaseService {
});
return data;
}

async setWorkflowResultFinal(id, isFinal) {
var data = await super
.patch_auth("/workflowResults/" + id + "?isFinal=" + isFinal, null)
Expand All @@ -38,6 +39,7 @@ export default class WorkflowResultService extends BaseService {
});
return data;
}

async updateWorkflowResult(id, outputLabel) {
var data = await super
.patch_auth(
Expand Down Expand Up @@ -74,27 +76,36 @@ export default class WorkflowResultService extends BaseService {
// onclick event handler for media/output links:
// get content of media or output based on forOutput boolean
// note that this method is shared across multiple components.
async getSymlinkContent(result, forOutput, event) {
async getSymlinkContent(result, forOutput, parent, event) {
// get the link element being clicked
let link = event.target;

// only process the event when the link href hasm't been populated
if (!link.href) {
if (!link.href) {
// for TestResults, the passed in result is MET result; otherwise, it is WFR result;
// the WFR ID field name differs in above cases.
// note that primaryfile ID field name remains the same regardless of which parent page
let wfrId = parent === "TestResults" ? result.workflowResultId : result.id;
console.log("parent = " + parent + ", result.id = " + result.id);

// get symlink URL via API call
let symlink = ""
if (forOutput) {
symlink = await this.getOutputSymlink(result.id);
// WFR output symlink
symlink = await this.getOutputSymlink(wfrId);
console.log("workflowResultId = " + wfrId + ", symlink = " + symlink)
}
else {
// PFile symlink
symlink = await this.getMediaSymlink(result.primaryfileId);
console.log("workflowResultId = " + wfrId + ", primaryfileId = " + result.primaryfileId + ", symlink = " + symlink)
}

// TODO handle error resposne

// initialize the link URL and trigger a click to request the content
link.href = symlink;
link.click();
console.log("forOutput = " + forOutput + ", symlink = " + symlink)
}
// otherwise do nothing and just let browser handle the link click
}
Expand Down
8 changes: 4 additions & 4 deletions src/store/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ const state = {
mgmCategories: [],

dashboardColumns: [
{ order: "a", label: "Date", field: "dateCreated" },
{ order: "b", label: "Test Date", field: "testDate" },
{ order: "c", label: "Output Date", field: "outputDate" },
{ order: "a", label: "Test Date", field: "testDate" },
{ order: "b", label: "Date", field: "dateCreated" },
//{ order: "c", label: "Workflow Date", field: "dateCreated" },
{ order: "d", label: "Submitter", field: "submitter" },
{ order: "e", label: "Unit", field: "unit" },
{ order: "f", label: "Collection", field: "collectionName" },
Expand All @@ -138,7 +138,7 @@ const state = {
{ order: "m", label: "Output", field: "outputName" },
{ order: "n", label: "Alias", field: "outputLabel" },
{ order: "o", label: "Ground Truth", field: "groundTruth" },
{ order: "p", label: "Test Output", field: "outputTest" },
{ order: "p", label: "Test Scores", field: "scores" },
{ order: "q", label: "Status", field: "status" },
{ order: "r", label: "Actions", field: "actions" },
{ order: "s", label: "Add to Test", field: "addToTest" },
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/components/dashboard/Dashboard.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe('Dashboard.vue', () => {
dashboardColumns: [
{ order: "a", label: "Date", field: "dateCreated" },
{ order: "b", label: "Test Date", field: "testDate" },
{ order: "c", label: "Output Date", field: "outputDate" },
//{ order: "c", label: "Output Date", field: "outputDate" },
{ order: "d", label: "Submitter", field: "submitter" },
{ order: "e", label: "Unit", field: "unit" },
{ order: "f", label: "Collection", field: "collectionName" },
Expand All @@ -104,7 +104,7 @@ describe('Dashboard.vue', () => {
{ order: "m", label: "Output", field: "outputName" },
{ order: "n", label: "Alias", field: "outputLabel" },
{ order: "o", label: "Ground Truth", field: "groundTruth" },
{ order: "p", label: "Test Output", field: "outputTest" },
{ order: "p", label: "Test Scores", field: "scores" },
{ order: "q", label: "Status", field: "status" },
{ order: "r", label: "Actions", field: "actions" },
{ order: "s", label: "Add to Test", field: "addToTest" },
Expand Down

0 comments on commit 3ea1e2a

Please sign in to comment.