Skip to content
Open
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ const validationVuexNamespace = namespace('validation')
// TreeUpdateConflictModal,
// InteractionTotalsDateRangeConfiguration
},

})
export default class TreeBuilderToolbar extends mixins(Routes, Permissions, Lang) {
isImporterVisible = false
Expand Down Expand Up @@ -496,12 +495,7 @@ export default class TreeBuilderToolbar extends mixins(Routes, Permissions, Lang
return (this.can('view-result-totals') && this.isFeatureViewResultsEnabled)

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.@typescript-eslint/strict-boolean-expressions
Severity: ERROR
File: src/components/interaction-designer/toolbar/TreeBuilderToolbar.vue L495

Unexpected any value in conditional. An explicit comparison or type cast is required. (@typescript-eslint/strict-boolean-expressions)

}

get hasSimulator() {
return this.hasOfflineMode && this.isFeatureSimulatorEnabled
}

// Methods #####################

async handleAddBlockByTypeSelected({type}: { type: IBlock['type'] }): Promise<void> {
const {uuid: blockId} = await this.flow_addBlankBlockByType({
type,
Expand Down Expand Up @@ -667,6 +661,7 @@ export default class TreeBuilderToolbar extends mixins(Routes, Permissions, Lang

// Clipboard
@clipboardVuexNamespace.Action setSimulatorActive!: (value: boolean) => void
@clipboardVuexNamespace.Getter hasSimulator!: boolean

@validationVuexNamespace.Action remove_block_validation!: ({blockId}: { blockId: IBlock['uuid'] | undefined}) => void
}
Expand Down
5 changes: 5 additions & 0 deletions src/router/trees.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ export const routes = [
name: 'flow-details',
meta: {isFlowEditorShown: true},
},
{
path: 'simulator',
name: 'flow-simulator',
meta: { isSidebarShown: true },

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.object-curly-spacing
Severity: ERROR
File: src/router/trees.js L38

There should be no space after '{'. (object-curly-spacing)

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.object-curly-spacing
Severity: ERROR
File: src/router/trees.js L38

There should be no space before '}'. (object-curly-spacing)

},
{
path: 'block/:blockId',
name: 'block-selected',
Expand Down
10 changes: 8 additions & 2 deletions src/store/clipboard/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import {
ActionTree, GetterTree, Module, MutationTree,
} from 'vuex'
import { IRootState } from '@/store'

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.object-curly-spacing
Severity: ERROR
File: src/store/clipboard/index.ts L4

There should be no space after '{'. (object-curly-spacing)

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.object-curly-spacing
Severity: ERROR
File: src/store/clipboard/index.ts L4

There should be no space before '}'. (object-curly-spacing)

import { IPrompt } from '@floip/flow-runner';
import { router } from '@/router'

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.object-curly-spacing
Severity: ERROR
File: src/store/clipboard/index.ts L5

There should be no space after '{'. (object-curly-spacing)

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.object-curly-spacing
Severity: ERROR
File: src/store/clipboard/index.ts L5

There should be no space before '}'. (object-curly-spacing)

import { IPrompt } from '@floip/flow-runner'

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.object-curly-spacing
Severity: ERROR
File: src/store/clipboard/index.ts L6

There should be no space after '{'. (object-curly-spacing)

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.object-curly-spacing
Severity: ERROR
File: src/store/clipboard/index.ts L6

There should be no space before '}'. (object-curly-spacing)


export interface BlocksData {
isFocused: boolean;

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.@typescript-eslint/member-delimiter-style
Severity: WARN
File: src/store/clipboard/index.ts L9

Expected a comma. (@typescript-eslint/member-delimiter-style)

Expand All @@ -24,6 +25,7 @@ export const getters: GetterTree<IClipboardState, IRootState> = {
blocksData: (state) => state.blocksData,
getBlockPrompt: (state) => (index: number) => state.blocksData[index].prompt,
isBlockFocused: (state) => (index: number) => state.blocksData[index].isFocused,
hasSimulator: (_, _2, _3, rootGetters) => rootGetters['flow/hasOfflineMode'] && rootGetters.isFeatureSimulatorEnabled && !rootGetters['builder/isEditable'],

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.max-len
Severity: WARN
File: src/store/clipboard/index.ts L28

This line has a length of 158. Maximum allowed is 140. (max-len)

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.@typescript-eslint/strict-boolean-expressions
Severity: ERROR
File: src/store/clipboard/index.ts L28

Unexpected any value in conditional. An explicit comparison or type cast is required. (@typescript-eslint/strict-boolean-expressions)

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.@typescript-eslint/strict-boolean-expressions
Severity: ERROR
File: src/store/clipboard/index.ts L28

Unexpected any value in conditional. An explicit comparison or type cast is required. (@typescript-eslint/strict-boolean-expressions)

}

export const mutations: MutationTree<IClipboardState> = {
Expand All @@ -38,6 +40,10 @@ export const mutations: MutationTree<IClipboardState> = {
export const actions: ActionTree<IClipboardState, IRootState> = {
setSimulatorActive({ commit }, value) {

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.object-curly-spacing
Severity: ERROR
File: src/store/clipboard/index.ts L41

There should be no space after '{'. (object-curly-spacing)

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.object-curly-spacing
Severity: ERROR
File: src/store/clipboard/index.ts L41

There should be no space before '}'. (object-curly-spacing)

commit('setSimulatorActive', value)
const routeName = value ? 'flow-simulator' : 'flow-canvas'
router.replace({
name: routeName,
})
},
resetBlocksData({ state }) {

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.object-curly-spacing
Severity: ERROR
File: src/store/clipboard/index.ts L48

There should be no space after '{'. (object-curly-spacing)

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.object-curly-spacing
Severity: ERROR
File: src/store/clipboard/index.ts L48

There should be no space before '}'. (object-curly-spacing)

state.blocksData = []
Expand All @@ -58,7 +64,7 @@ export const actions: ActionTree<IClipboardState, IRootState> = {
},
removeFromBlocksData({ state }, index: number) {

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.object-curly-spacing
Severity: ERROR
File: src/store/clipboard/index.ts L65

There should be no space after '{'. (object-curly-spacing)

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.object-curly-spacing
Severity: ERROR
File: src/store/clipboard/index.ts L65

There should be no space before '}'. (object-curly-spacing)

state.blocksData.splice(index)
}
},
}

export const store: Module<IClipboardState, IRootState> = {
Expand Down
23 changes: 6 additions & 17 deletions src/views/InteractionDesigner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,7 @@
v-if="isSimulatorActive"
class="tree-sidebar-container"
:class="{ 'slide-out': !$route.meta.isSidebarShown,}">
<div
class="sidebar-cue"
:class="{'sidebar-close': $route.meta.isSidebarShown}"
@click="showOrHideSidebar">
<font-awesome-icon
v-if="$route.meta.isSidebarShown"
:icon="['fac', 'minimize']"
class="fa-btn" />
<font-awesome-icon
v-else
:icon="['fac', 'expand']"
class="fa-btn" />
</div>

<div
class="tree-sidebar">
<div v-if="$route.name === 'flow-simulator' && hasSimulator" class="tree-sidebar">

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/max-attributes-per-line
Severity: WARN
File: src/views/InteractionDesigner.vue L14

'class' should be on a new line. (vue/max-attributes-per-line)

<clipboard-root />
</div>
</aside>
Expand Down Expand Up @@ -148,7 +133,7 @@ export default {

...mapGetters('flow', ['activeFlow']),
...mapGetters('builder', ['activeBlock', 'isEditable', 'interactionDesignerBoundingClientRect']),
...mapGetters('clipboard', ['isSimulatorActive']),
...mapGetters('clipboard', ['hasSimulator', 'isSimulatorActive']),

jsKey() {

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.@typescript-eslint/explicit-module-boundary-types
Severity: WARN
File: src/views/InteractionDesigner.vue L138

Missing return type on function. (@typescript-eslint/explicit-module-boundary-types)

return get(this.selectedBlock, 'jsKey')
Expand Down Expand Up @@ -221,6 +206,9 @@ export default {
if (this.$route.meta?.isBlockEditorShown) {

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.@typescript-eslint/strict-boolean-expressions
Severity: ERROR
File: src/views/InteractionDesigner.vue L206

Unexpected any value in conditional. An explicit comparison or type cast is required. (@typescript-eslint/strict-boolean-expressions)

this.setIsBlockEditorOpen(true)
}
if (this.$route.name === 'flow-simulator' && this.hasSimulator()) {
Copy link
Member

@safydy-r safydy-r Jun 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we already have this condition here, what if we change <div v-if="$route.name === 'flow-simulator' && hasSimulator" class="tree-sidebar"> from this line
https://github.com/FLOIP/flow-builder/blob/VMO-3852-deep-linking-simulator/src/views/InteractionDesigner.vue#L21 with <div v-if="isSimulatorActive" class="tree-sidebar">

Would that work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@safydy-r This condition has been added here to open up the simulator when the URL says /simulator. This is needed here specifically to handle UI refresh and the URL being pasted in a new tab/window of the browser.
In order to use isSimulatorActive, it needs to be set true already. but as you can see I am setting it below after catching the simulator URL.
I agree comparing the route name isn't ideal, but I cannot think of any better solution. Let me know your thoughts?

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.@typescript-eslint/strict-boolean-expressions
Severity: ERROR
File: src/views/InteractionDesigner.vue L209

Unexpected any value in conditional. An explicit comparison or type cast is required. (@typescript-eslint/strict-boolean-expressions)

this.setSimulatorActive(true)
}
}, 500)
console.debug('Vuej tree interaction designer mounted!')

Expand All @@ -242,6 +230,7 @@ export default {
...mapMutations('builder', ['activateBlock', 'setIsBlockEditorOpen', 'setInteractionDesignerBoundingClientRect']),
...mapActions('builder', ['setIsEditable']),
...mapMutations('flow', ['flow_setActiveFlowId']),
...mapActions('clipboard', ['setSimulatorActive']),

...mapActions([
'attemptSaveTree',
Expand Down