-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VMO-4138 Unified Message Block #109
Changes from 24 commits
29cc712
1b0c54d
d7cd50b
32e4715
61a8d95
999ec5d
b6680b1
c59f9ac
01f9c73
01c9a00
7e9a0e7
1e5870a
0abf890
5d8f9c0
e16defa
17541a6
5dd86ff
99725c8
a620530
d953d66
542e3d2
b17c64d
a1ce240
e947755
210abde
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
<template> | ||
<div> | ||
<label v-if="label">{{ label }}</label> | ||
<h6 v-if="label">{{ label }}</h6> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reporter: ESLint Expected 1 line break before closing tag (`</h6>`), but no line breaks found. (vue/singleline-html-element-content-newline)
|
||
<textarea | ||
class="form-control" | ||
:class="{ 'is-invalid': isInvalid }" | ||
:placeholder="placeholder" | ||
:value="value" | ||
:rows="rows" | ||
@keydown="$emit('keydown', $event)" | ||
@input="$emit('input', $event.target.value)" /> | ||
<slot /> | ||
|
@@ -33,6 +34,11 @@ export default { | |
default: null, | ||
required: false, | ||
}, | ||
rows: { | ||
type: Number, | ||
required: false, | ||
default: 1, | ||
}, | ||
}, | ||
computed: { | ||
isInvalid() { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,36 @@ | ||
<template> | ||
<validation-message | ||
#input-control="{ isValid }" | ||
:message-key="`block/${block.uuid}/label`"> | ||
<div class="block-label"> | ||
<text-editor | ||
v-model="label" | ||
:label="'flow-builder.block-label' | trans" | ||
:placeholder="'flow-builder.enter-block-label' | trans" | ||
:valid-state="isValid" /> | ||
</div> | ||
</validation-message> | ||
<section class="mb-3"> | ||
<label class="text-primary">{{ 'flow-builder.title' | trans }}</label> | ||
<validation-message | ||
#input-control="{ isValid }" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reporter: ESLint Named slots must use '<template>' on a custom element. (vue/valid-v-slot)
|
||
:message-key="`block/${block.uuid}/label`"> | ||
<div class="d-flex"> | ||
<text-editor | ||
v-model="blockLabel" | ||
class="w-100" | ||
:label="''" | ||
:placeholder="'flow-builder.enter-title' | trans" | ||
:valid-state="isValid" /> | ||
<span | ||
class="btn btn-outline-primary btn-xs align-self-center ml-2" | ||
@click="emitGearClickedEvent"> | ||
<font-awesome-icon | ||
:icon="['fac', 'settings']" | ||
class="fa-btn text-primary" /> | ||
</span> | ||
</div> | ||
</validation-message> | ||
</section> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import {Component, Prop} from 'vue-property-decorator' | ||
import TextEditor from '@/components/common/TextEditor.vue' | ||
import ValidationMessage from '@/components/common/ValidationMessage.vue' | ||
import {mixins} from 'vue-class-component' | ||
import Lang from '@/lib/filters/lang' | ||
import {Component, Prop} from 'vue-property-decorator' | ||
import {IBlock} from '@floip/flow-runner' | ||
import {namespace} from 'vuex-class' | ||
import {mixins} from 'vue-class-component' | ||
import ValidationMessage from '@/components/common/ValidationMessage.vue' | ||
|
||
const flowVuexNamespace = namespace('flow') | ||
|
||
|
@@ -29,17 +40,22 @@ const flowVuexNamespace = namespace('flow') | |
ValidationMessage, | ||
}, | ||
}) | ||
export default class LabelEditor extends mixins(Lang) { | ||
@Prop() block!: IBlock | ||
class LabelEditor extends mixins(Lang) { | ||
@Prop() readonly block!: IBlock | ||
|
||
get label(): IBlock['label'] { | ||
get blockLabel(): IBlock['label'] { | ||
return this.block.label | ||
} | ||
|
||
set label(value: IBlock['label']) { | ||
set blockLabel(value: IBlock['label']) { | ||
this.block_setLabel({blockId: this.block.uuid, value}) | ||
} | ||
|
||
@flowVuexNamespace.Mutation block_setLabel!: ({blockId, value}: { blockId: IBlock['uuid'], value: IBlock['label'] }) => void | ||
emitGearClickedEvent(): void { | ||
this.$emit('gearClicked') | ||
} | ||
|
||
@flowVuexNamespace.Action block_setLabel!: ({blockId, value}: { blockId: IBlock['uuid'], value: IBlock['label'] }) => void | ||
} | ||
export default LabelEditor | ||
</script> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,85 @@ | ||
<template> | ||
<validation-message | ||
#input-control="{ isValid }" | ||
:message-key="`block/${block.uuid}/name`"> | ||
<div class="block-name"> | ||
<text-editor | ||
v-model="name" | ||
:label="'flow-builder.block-name' | trans" | ||
:placeholder="'flow-builder.enter-block-name' | trans" | ||
:valid-state="isValid" | ||
@keydown="filterName"> | ||
<small class="text-muted"> | ||
{{ 'flow-builder.only-accepts-word-characters' | trans }} | ||
</small> | ||
</text-editor> | ||
</div> | ||
</validation-message> | ||
<div class="mt-3"> | ||
<validation-message | ||
#input-control="{ isValid }" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reporter: ESLint Named slots must use '<template>' on a custom element. (vue/valid-v-slot)
|
||
:message-key="`block/${block.uuid}/name`"> | ||
<div v-if="editBlockName || isValid === false"> | ||
<h6>{{ 'flow-builder.edit-block-code' | trans }}</h6> | ||
<div class="d-flex"> | ||
<text-editor | ||
v-model="blockName" | ||
class="w-100" | ||
:label="''" | ||
:placeholder="'flow-builder.enter-block-code' | trans" | ||
:valid-state="isValid" | ||
@keydown="filterName" /> | ||
<span | ||
class="btn btn-primary btn-xs align-self-center ml-2" | ||
@click="editBlockName = false"> | ||
<font-awesome-icon | ||
:icon="['fas', 'check']" | ||
class="fa-btn" /> | ||
</span> | ||
</div> | ||
</div> | ||
<div v-else class="d-flex justify-content-between"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reporter: ESLint 'class' should be on a new line. (vue/max-attributes-per-line)
|
||
<div class="block-code align-self-center"> | ||
<h6 class="d-inline">{{'flow-builder.code' | trans}}:</h6> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reporter: ESLint Expected 1 line break after opening tag (`<h6>`), but no line breaks found. (vue/singleline-html-element-content-newline)
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reporter: ESLint Expected 1 line break before closing tag (`</h6>`), but no line breaks found. (vue/singleline-html-element-content-newline)
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reporter: ESLint Expected 1 space after '{{', but not found. (vue/mustache-interpolation-spacing)
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reporter: ESLint Expected 1 space before '}}', but not found. (vue/mustache-interpolation-spacing)
|
||
<span> {{ blockName }} </span> | ||
</div> | ||
<span class="btn btn-primary btn-xs align-self-baseline ml-2" @click="editBlockName = true"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reporter: ESLint '@click' should be on a new line. (vue/max-attributes-per-line)
|
||
<font-awesome-icon | ||
:icon="['far', 'edit']" | ||
class="fa-btn" /> | ||
</span> | ||
</div> | ||
</validation-message> | ||
</div> | ||
</template> | ||
|
||
<script lang="js"> | ||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types,@typescript-eslint/strict-boolean-expressions */ | ||
import {mapMutations} from 'vuex' | ||
import TextEditor from '@/components/common/TextEditor' | ||
import {lang} from '@/lib/filters/lang' | ||
import ValidationMessage from '@/components/common/ValidationMessage' | ||
<script lang="ts"> | ||
import {Component, Prop} from 'vue-property-decorator' | ||
import ValidationMessage from '@/components/common/ValidationMessage.vue' | ||
import {mixins} from 'vue-class-component' | ||
import Lang from '@/lib/filters/lang' | ||
import {IBlock} from '@floip/flow-runner' | ||
import {namespace} from 'vuex-class' | ||
import TextEditor from '@/components/common/TextEditor.vue' | ||
|
||
export default { | ||
const flowVuexNamespace = namespace('flow') | ||
|
||
@Component({ | ||
components: { | ||
TextEditor, | ||
ValidationMessage, | ||
}, | ||
mixins: [lang], | ||
props: { | ||
block: { | ||
type: Object, | ||
required: true, | ||
}, | ||
}, | ||
computed: { | ||
name: { | ||
get() { | ||
return this.block.name | ||
}, | ||
set(value) { | ||
this.block_setName({blockId: this.block.uuid, value}) | ||
}, | ||
}, | ||
}, | ||
methods: { | ||
...mapMutations('flow', ['block_setName']), | ||
filterName(e) { | ||
if (e.key.match(/\W+|Enter/g)) { | ||
e.preventDefault() | ||
} | ||
}, | ||
}, | ||
}) | ||
class NameEditor extends mixins(Lang) { | ||
editBlockName = false | ||
|
||
@Prop() readonly block!: IBlock | ||
|
||
get blockName(): IBlock['name'] { | ||
return this.block.name | ||
} | ||
|
||
set blockName(value: IBlock['name']) { | ||
this.block_setName({blockId: this.block.uuid, value}) | ||
} | ||
|
||
filterName(e: KeyboardEvent): void { | ||
if (e.key.match(/\W+|Enter/g)) { | ||
e.preventDefault() | ||
} | ||
} | ||
|
||
@flowVuexNamespace.Mutation block_setName!: ({blockId, value}: {blockId: IBlock['uuid'], value: IBlock['name']}) => void | ||
} | ||
export default NameEditor | ||
</script> | ||
|
||
<style scoped> | ||
.block-code { | ||
word-break: break-all; | ||
} | ||
</style> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: ESLint
Rule: eslint.rules.vue/singleline-html-element-content-newline
Severity: WARN
File: src/components/common/TextEditor.vue L3
Expected 1 line break after opening tag (`<h6>`), but no line breaks found. (vue/singleline-html-element-content-newline)