Rework renaming in the workflow editor to unify things into Index.vue

This commit is contained in:
John Chilton
2020-12-28 00:50:44 -05:00
parent 001dfb4218
commit 68f005e3ba
4 changed files with 51 additions and 21 deletions
@@ -6,7 +6,7 @@
<div id="workflow-name-area">
<b>Name</b>
<meta itemprop="name" :content="name" />
<b-input id="workflow-name" :value="name" @change="onRename" />
<b-input id="workflow-name" v-model="nameCurrent" @keyup="$emit('update:nameCurrent', nameCurrent)" />
</div>
<div id="workflow-version-area" class="mt-2">
<b>Version</b>
@@ -115,6 +115,7 @@ export default {
tagsCurrent: this.tags,
versionCurrent: this.version,
annotationCurrent: this.annotation,
nameCurrent: this.name,
};
},
created() {
@@ -163,8 +164,11 @@ export default {
}
this.creatorCurrent = creator;
},
annotation(newAnnotation) {
this.annotationCurrent = newAnnotation;
annotation() {
this.annotationCurrent = this.annotation;
},
name() {
this.nameCurrent = this.name;
},
},
methods: {
@@ -172,10 +176,6 @@ export default {
this.tagsCurrent = tags;
this.onAttributes({ tags });
},
onRename(name) {
this.onAttributes({ name });
this.$emit("onRename", name);
},
onVersion() {
this.$emit("onVersion", this.versionCurrent);
},
@@ -100,11 +100,12 @@
<div class="m-1">
<WorkflowAttributes
:id="id"
:name="name"
:tags="tags"
:parameters="parameters"
:annotationCurrent.sync="annotation"
:annotation="annotation"
:nameCurrent.sync="name"
:name="name"
:version="version"
:versions="versions"
:license="license"
@@ -168,10 +169,6 @@ export default {
type: Number,
required: true,
},
name: {
type: String,
required: true,
},
tags: {
type: Array,
required: true,
@@ -213,6 +210,7 @@ export default {
license: null,
creator: null,
annotation: null,
name: null,
};
},
created() {
@@ -238,6 +236,11 @@ export default {
this.hasChanges = true;
}
},
name: function (newName, oldName) {
if (newName != oldName) {
this.hasChanges = true;
}
},
},
methods: {
onActivate(node) {
@@ -117,7 +117,8 @@ export function toSimple(workflow) {
const license = workflow.license;
const creator = workflow.creator;
const annotation = workflow.annotation;
return { steps: nodes, report, license, creator, annotation };
const name = workflow.name;
return { steps: nodes, report, license, creator, annotation, name };
}
function _scaledBoundingClientRect(element, canvasZoom) {
@@ -27,14 +27,17 @@ class WorkflowEditorTestCase(SeleniumTestCase):
editor = self.components.workflow_editor
annotation = "basic_test"
name = self.workflow_create_new(annotation=annotation)
edit_name_element = self.components.workflow_editor.edit_name.wait_for_visible()
actual_name = edit_name_element.get_attribute("value")
assert name in actual_name, f"'{name}' unequal name '{actual_name}'"
self.assert_wf_name_is(name)
self.assert_wf_annotation_is(annotation)
editor.canvas_body.wait_for_visible()
editor.tool_menu.wait_for_visible()
# shouldn't have changes on fresh load
save_button = self.components.workflow_editor.save_button
save_button.wait_for_visible()
assert save_button.has_class("disabled")
self.screenshot("workflow_editor_blank")
self.components._.left_panel_drag.wait_for_visible()
@@ -61,17 +64,27 @@ class WorkflowEditorTestCase(SeleniumTestCase):
editor.canvas_body.wait_for_visible()
save_button = self.components.workflow_editor.save_button
save_button.wait_for_visible()
assert save_button.has_class("disabled")
new_annotation = 'look new annotation'
edit_annotation.wait_for_and_send_keys(new_annotation)
save_button.wait_for_and_click()
self.assert_has_changes_and_save()
self.sleep_for(self.wait_types.UX_RENDER)
self.workflow_index_open_with_name(name)
self.assert_wf_annotation_is(new_annotation)
@selenium_test
def test_edit_name(self):
editor = self.components.workflow_editor
name = self.workflow_create_new()
editor.canvas_body.wait_for_visible()
new_name = self._get_random_name()
edit_name = self.components.workflow_editor.edit_name
edit_name.wait_for_and_send_keys(new_name)
self.assert_has_changes_and_save()
self.sleep_for(self.wait_types.UX_RENDER)
self.workflow_index_open_with_name(new_name)
self.assert_wf_name_is(name)
@selenium_test
def test_data_input(self):
editor = self.components.workflow_editor
@@ -500,6 +513,19 @@ steps:
form_element.click()
return name
@retry_assertion_during_transitions
def assert_has_changes_and_save(self):
save_button = self.components.workflow_editor.save_button
save_button.wait_for_visible()
assert not save_button.has_class("disabled")
save_button.wait_for_and_click()
@retry_assertion_during_transitions
def assert_wf_name_is(self, expected_name):
edit_name_element = self.components.workflow_editor.edit_name.wait_for_visible()
actual_name = edit_name_element.get_attribute("value")
assert expected_name in actual_name, f"'{expected_name}' unequal name '{actual_name}'"
@retry_assertion_during_transitions
def assert_wf_annotation_is(self, expected_annotation):
edit_annotation = self.components.workflow_editor.edit_annotation