Skip to content

Commit

Permalink
feat(ui): add copy button to clone a flow
Browse files Browse the repository at this point in the history
close #460
  • Loading branch information
tchiotludo committed Aug 2, 2022
1 parent b42d401 commit 1ac584b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ui/src/components/flows/FlowEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@

<trigger-flow v-if="flow && canExecute" :disabled="flow.disabled" :flow-id="flow.id" :namespace="flow.namespace" />


<router-link v-if="flow" :to="{name: 'flows/create', query: {copy: true}}">
<b-button variant="primary">
<kicon>
<content-copy />
{{ $t('copy') }}
</kicon>
</b-button>
</router-link>

<b-button @click="save" v-if="canSave" variant="primary">
<kicon :tooltip="'(Ctrl + s)'">
<content-save />
Expand All @@ -31,11 +41,13 @@
import {mapGetters} from "vuex";
import TriggerFlow from "./TriggerFlow"
import Kicon from "../Kicon"
import ContentCopy from "vue-material-design-icons/ContentCopy";
export default {
components: {
TriggerFlow,
Kicon,
ContentCopy,
},
mixins: [flowTemplateEdit],
data() {
Expand Down
6 changes: 6 additions & 0 deletions ui/src/mixins/flowTemplateEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ export default {
},
methods: {
loadFile() {
if (this.$route.query.copy) {
this.item.id = "";
this.item.namespace = "";
delete this.item.revision;
}

this.content = YamlUtils.stringify(this.item);
this.previousContent = this.content;
if (this.isEdit) {
Expand Down
2 changes: 2 additions & 0 deletions ui/src/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"Select namespace": "Namespace",
"Add flow": "Add flow",
"add": "Add",
"copy": "Copy",
"Per page": "Per page",
"new": "New",
"edit": "Edit",
Expand Down Expand Up @@ -264,6 +265,7 @@
"Select namespace": "Espace de nom",
"Add flow": "Ajouter un flow",
"add": "Ajouter",
"copy": "Copier",
"Per page": "Par page",
"new": "Nouveau",
"edit": "Modifier",
Expand Down

0 comments on commit 1ac584b

Please sign in to comment.