Skip to content

Commit

Permalink
Revert "fix(ui): properly handle view type on namespace files (#4138)"
Browse files Browse the repository at this point in the history
This reverts commit dcec04e.
  • Loading branch information
loicmathieu committed Jun 27, 2024
1 parent f9f33b9 commit c3b1ceb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 32 deletions.
14 changes: 3 additions & 11 deletions ui/src/components/inputs/EditorView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -587,10 +587,8 @@
timer.value = setTimeout(() => onEdit(event, isFlow), 500);
};
const switchViewType = (event, shouldPersist = true) => {
if(shouldPersist) persistViewType(event)
else viewType.value = event
const switchViewType = (event) => {
persistViewType(event);
if (
[editorViewTypes.TOPOLOGY, editorViewTypes.SOURCE_TOPOLOGY].includes(
viewType.value
Expand Down Expand Up @@ -881,13 +879,7 @@
return tab.name === currentTab.value.name;
}
watch(currentTab, (current, previous) => {
const isCurrentFlow = current?.name === "Flow";
const isPreviousFlow = previous?.name === "Flow";
if(isPreviousFlow) persistViewType(viewType.value);
switchViewType(isCurrentFlow ? loadViewType() : editorViewTypes.SOURCE, false)
watch(currentTab, () => {
nextTick(() => {
const activeTabElement = tabsScrollRef.value.wrapRef.querySelector(".tab-active");
const rightMostCurrentTabPixel = activeTabElement.offsetLeft + activeTabElement.clientWidth;
Expand Down
26 changes: 9 additions & 17 deletions ui/src/components/inputs/SwitchView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
<el-tooltip :content="$t('source')" transition="" :hide-after="0" :persistent="false" effect="light">
<el-button :type="buttonType(editorViewTypes.SOURCE)" @click="switchView(editorViewTypes.SOURCE)" :icon="FileDocumentEditOutline" />
</el-tooltip>
<el-tooltip :content="!isFlow ? $t('flow_only') : $t('source and doc')" transition="" :hide-after="0" :persistent="false" effect="light">
<el-button :disabled="!isFlow" :type="buttonType(editorViewTypes.SOURCE_DOC)" @click="switchView(editorViewTypes.SOURCE_DOC)" :icon="BookOpenOutline" />
<el-tooltip :content="$t('source and doc')" transition="" :hide-after="0" :persistent="false" effect="light">
<el-button :type="buttonType(editorViewTypes.SOURCE_DOC)" @click="switchView(editorViewTypes.SOURCE_DOC)" :icon="BookOpenOutline" />
</el-tooltip>
<el-tooltip :content="!isFlow ? $t('flow_only') : $t('source and topology')" transition="" :hide-after="0" :persistent="false" effect="light">
<el-button :disabled="!isFlow" :type="buttonType(editorViewTypes.SOURCE_TOPOLOGY)" @click="switchView(editorViewTypes.SOURCE_TOPOLOGY)" :icon="FileTableOutline" />
<el-tooltip :content="$t('source and topology')" transition="" :hide-after="0" :persistent="false" effect="light">
<el-button :type="buttonType(editorViewTypes.SOURCE_TOPOLOGY)" @click="switchView(editorViewTypes.SOURCE_TOPOLOGY)" :icon="FileTableOutline" />
</el-tooltip>
<el-tooltip :content="!isFlow ? $t('flow_only') : $t('topology')" transition="" :hide-after="0" :persistent="false" effect="light">
<el-button :disabled="!isFlow" :type="buttonType(editorViewTypes.TOPOLOGY)" @click="switchView(editorViewTypes.TOPOLOGY)" :icon="FileTreeOutline" />
<el-tooltip :content="$t('topology')" transition="" :hide-after="0" :persistent="false" effect="light">
<el-button :type="buttonType(editorViewTypes.TOPOLOGY)" @click="switchView(editorViewTypes.TOPOLOGY)" :icon="FileTreeOutline" />
</el-tooltip>
<el-tooltip :content="!isFlow ? $t('flow_only') : $t('source and blueprints')" transition="" :hide-after="0" :persistent="false" effect="light">
<el-button :disabled="!isFlow" :type="buttonType(editorViewTypes.SOURCE_BLUEPRINTS)" @click="switchView(editorViewTypes.SOURCE_BLUEPRINTS)" :icon="BallotOutline" />
<el-tooltip :content="$t('source and blueprints')" transition="" :hide-after="0" :persistent="false" effect="light">
<el-button :type="buttonType(editorViewTypes.SOURCE_BLUEPRINTS)" @click="switchView(editorViewTypes.SOURCE_BLUEPRINTS)" :icon="BallotOutline" />
</el-tooltip>
</el-button-group>
</template>
Expand All @@ -28,7 +28,7 @@
</script>

<script>
import {mapState, mapMutations} from "vuex";
import {mapMutations} from "vuex";
export default {
props: {
Expand All @@ -38,14 +38,6 @@
}
},
emits: ["switch-view"],
computed: {
...mapState({
currentTab: (state) => state.editor.current
}),
isFlow(){
return this.currentTab?.name === "Flow"
}
},
methods: {
...mapMutations("editor", ["changeView"]),
Expand Down
3 changes: 1 addition & 2 deletions ui/src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,6 @@
"ee-tooltip": {
"features-blocked": "This feature requires Enterprise Edition.",
"button": "Talk to us"
},
"flow_only": "Only available on Flow tab."
}
}
}
3 changes: 1 addition & 2 deletions ui/src/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,6 @@
"ee-tooltip": {
"features-blocked": "Cette fonctionnalité nécessite l'édition Enterprise.",
"button": "Contactez-nous"
},
"flow_only": "Disponible uniquement sur l'onglet Flow."
}
}
}

0 comments on commit c3b1ceb

Please sign in to comment.