diff --git a/admin/frontend/src/components/NewStory.vue b/admin/frontend/src/components/NewStory.vue
index 81501c9..18856cf 100644
--- a/admin/frontend/src/components/NewStory.vue
+++ b/admin/frontend/src/components/NewStory.vue
@@ -28,7 +28,7 @@
-
@@ -46,13 +46,9 @@
export default Vue.extend({
data() {
return {
- storyName: '',
- storyInfo: {
- source: {type: 'click to set', settings: '{}'},
- sink: {type: 'click to set', settings: '{}'},
- status: 'INIT',
- operators: []
- } as StoryInfo
+ storyName: this.$route.params.storyName || '',
+ storyInfo: {} as StoryInfo,
+ showButtons: false
}
},
@@ -60,7 +56,31 @@
StoryGraph
},
+ created() {
+ this.fetchData()
+ },
+
methods: {
+ fetchData() {
+ let storyName = this.storyName
+ if (storyName != '') {
+ this.storyName += '_copy'
+ this.showButtons = true
+ request.getStory(storyName)
+ .then(storyInfo => {
+ this.storyInfo = storyInfo
+ })
+ }
+ else {
+ this.storyInfo = {
+ source: {type: 'click to set', settings: '{}'},
+ sink: {type: 'click to set', settings: '{}'},
+ status: 'INIT',
+ operators: []
+ } as StoryInfo
+ }
+ },
+
onSaveStory(newStoryInfo: StoryInfo) {
let storyNameCheck = StoryUtils.checkStoryName(this.storyName)
if (storyNameCheck !== true) {
diff --git a/admin/frontend/src/components/Stories.vue b/admin/frontend/src/components/Stories.vue
index df1ee60..5398365 100644
--- a/admin/frontend/src/components/Stories.vue
+++ b/admin/frontend/src/components/Stories.vue
@@ -27,6 +27,10 @@ import {RunnerStatus} from '../lib/runner-utils';
diff --git a/admin/frontend/src/components/StoryGraph.vue b/admin/frontend/src/components/StoryGraph.vue
index 6a0e2eb..cb90e06 100644
--- a/admin/frontend/src/components/StoryGraph.vue
+++ b/admin/frontend/src/components/StoryGraph.vue
@@ -121,11 +121,11 @@ import {OpExecPos} from "../lib/story-utils";
import ConfirmationBox from './ConfirmationBox.vue'
export default Vue.extend({
- props: ['info'],
+ props: ['info', 'showButtons'],
data() {
return {
- changed: false,
+ changed: this.showButtons || false,
storyInfo: StoryUtils.copyStoryInfo(this.info),
taskEditor: {show: false, title: '', action: {} as TaskEditAction},
confirmation: {
diff --git a/admin/frontend/src/index.ts b/admin/frontend/src/index.ts
index 2e8e5ab..167badb 100644
--- a/admin/frontend/src/index.ts
+++ b/admin/frontend/src/index.ts
@@ -20,6 +20,7 @@ const router = new VueRouter({
{path: `${URL_PREFIX}/runner/:runnerName`, component: Runner, name: 'runner'},
{path: `${URL_PREFIX}/stories`, component: Stories, name: 'stories'},
{path: `${URL_PREFIX}/newstory`, component: NewStory, name: 'newstory'},
+ {path: `${URL_PREFIX}/newstory/from/:storyName`, component: NewStory, name: 'duplicate-story'},
{path: `${URL_PREFIX}/story/:storyName`, component: Story, name: 'story'},
{path: `${URL_PREFIX}/story/:storyName/runner`, component: Story, name: 'story-runners'},
{path: `${URL_PREFIX}/story/:storyName/statistics`, component: Story, name: 'story-statistics'},