2018-10-15 14:42:47 +05:30
|
|
|
<script>
|
2022-04-04 11:22:00 +05:30
|
|
|
import { GlIcon, GlTooltipDirective, GlBadge } from '@gitlab/ui';
|
2021-03-11 19:13:27 +05:30
|
|
|
import { mapActions, mapState } from 'vuex';
|
|
|
|
import { BV_HIDE_TOOLTIP } from '~/lib/utils/constants';
|
2020-03-13 15:44:24 +05:30
|
|
|
import { leftSidebarViews } from '../constants';
|
2018-10-15 14:42:47 +05:30
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
2020-11-24 15:15:51 +05:30
|
|
|
GlIcon,
|
2022-04-04 11:22:00 +05:30
|
|
|
GlBadge,
|
2018-10-15 14:42:47 +05:30
|
|
|
},
|
|
|
|
directives: {
|
2021-01-03 14:25:43 +05:30
|
|
|
GlTooltip: GlTooltipDirective,
|
2018-10-15 14:42:47 +05:30
|
|
|
},
|
|
|
|
computed: {
|
2021-03-11 19:13:27 +05:30
|
|
|
...mapState(['currentActivityView', 'stagedFiles']),
|
2018-10-15 14:42:47 +05:30
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
...mapActions(['updateActivityBarView']),
|
2018-11-08 19:23:39 +05:30
|
|
|
changedActivityView(e, view) {
|
|
|
|
e.currentTarget.blur();
|
|
|
|
|
|
|
|
this.updateActivityBarView(view);
|
|
|
|
|
2021-03-11 19:13:27 +05:30
|
|
|
this.$root.$emit(BV_HIDE_TOOLTIP);
|
2018-11-08 19:23:39 +05:30
|
|
|
},
|
2018-10-15 14:42:47 +05:30
|
|
|
},
|
2020-03-13 15:44:24 +05:30
|
|
|
leftSidebarViews,
|
2018-10-15 14:42:47 +05:30
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2021-01-03 14:25:43 +05:30
|
|
|
<nav class="ide-activity-bar" data-testid="left-sidebar">
|
2018-10-15 14:42:47 +05:30
|
|
|
<ul class="list-unstyled">
|
|
|
|
<li>
|
|
|
|
<button
|
2021-01-03 14:25:43 +05:30
|
|
|
v-gl-tooltip.right.viewport
|
2018-10-15 14:42:47 +05:30
|
|
|
:class="{
|
2020-03-13 15:44:24 +05:30
|
|
|
active: currentActivityView === $options.leftSidebarViews.edit.name,
|
2018-10-15 14:42:47 +05:30
|
|
|
}"
|
|
|
|
:title="s__('IDE|Edit')"
|
|
|
|
:aria-label="s__('IDE|Edit')"
|
2018-11-08 19:23:39 +05:30
|
|
|
data-container="body"
|
|
|
|
data-placement="right"
|
2020-11-24 15:15:51 +05:30
|
|
|
data-qa-selector="edit_mode_tab"
|
2023-06-20 00:43:36 +05:30
|
|
|
data-testid="edit-mode-button"
|
2018-11-08 19:23:39 +05:30
|
|
|
type="button"
|
|
|
|
class="ide-sidebar-link js-ide-edit-mode"
|
2020-03-13 15:44:24 +05:30
|
|
|
@click.prevent="changedActivityView($event, $options.leftSidebarViews.edit.name)"
|
2018-10-15 14:42:47 +05:30
|
|
|
>
|
2020-11-24 15:15:51 +05:30
|
|
|
<gl-icon name="code" />
|
2018-10-15 14:42:47 +05:30
|
|
|
</button>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<button
|
2021-01-03 14:25:43 +05:30
|
|
|
v-gl-tooltip.right.viewport
|
2018-10-15 14:42:47 +05:30
|
|
|
:class="{
|
2020-03-13 15:44:24 +05:30
|
|
|
active: currentActivityView === $options.leftSidebarViews.review.name,
|
2018-10-15 14:42:47 +05:30
|
|
|
}"
|
|
|
|
:title="s__('IDE|Review')"
|
|
|
|
:aria-label="s__('IDE|Review')"
|
2018-11-08 19:23:39 +05:30
|
|
|
data-container="body"
|
|
|
|
data-placement="right"
|
2023-06-20 00:43:36 +05:30
|
|
|
data-testid="review-mode-button"
|
2018-11-08 19:23:39 +05:30
|
|
|
type="button"
|
|
|
|
class="ide-sidebar-link js-ide-review-mode"
|
2020-03-13 15:44:24 +05:30
|
|
|
@click.prevent="changedActivityView($event, $options.leftSidebarViews.review.name)"
|
2018-10-15 14:42:47 +05:30
|
|
|
>
|
2022-01-26 12:08:38 +05:30
|
|
|
<gl-icon name="review-list" />
|
2018-10-15 14:42:47 +05:30
|
|
|
</button>
|
|
|
|
</li>
|
2020-06-23 00:09:42 +05:30
|
|
|
<li>
|
2018-10-15 14:42:47 +05:30
|
|
|
<button
|
2021-01-03 14:25:43 +05:30
|
|
|
v-gl-tooltip.right.viewport
|
2018-10-15 14:42:47 +05:30
|
|
|
:class="{
|
2020-03-13 15:44:24 +05:30
|
|
|
active: currentActivityView === $options.leftSidebarViews.commit.name,
|
2018-10-15 14:42:47 +05:30
|
|
|
}"
|
|
|
|
:title="s__('IDE|Commit')"
|
|
|
|
:aria-label="s__('IDE|Commit')"
|
2018-11-08 19:23:39 +05:30
|
|
|
data-container="body"
|
|
|
|
data-placement="right"
|
2020-11-24 15:15:51 +05:30
|
|
|
data-qa-selector="commit_mode_tab"
|
2023-06-20 00:43:36 +05:30
|
|
|
data-testid="commit-mode-button"
|
2018-11-08 19:23:39 +05:30
|
|
|
type="button"
|
2020-11-24 15:15:51 +05:30
|
|
|
class="ide-sidebar-link js-ide-commit-mode"
|
2020-03-13 15:44:24 +05:30
|
|
|
@click.prevent="changedActivityView($event, $options.leftSidebarViews.commit.name)"
|
2018-10-15 14:42:47 +05:30
|
|
|
>
|
2020-11-24 15:15:51 +05:30
|
|
|
<gl-icon name="commit" />
|
2022-04-04 11:22:00 +05:30
|
|
|
<gl-badge
|
|
|
|
v-if="stagedFiles.length"
|
|
|
|
class="gl-absolute gl-px-2 gl-top-3 gl-right-3 gl-font-weight-bold gl-bg-gray-900! gl-text-white!"
|
|
|
|
size="sm"
|
|
|
|
>
|
2021-03-11 19:13:27 +05:30
|
|
|
{{ stagedFiles.length }}
|
2022-04-04 11:22:00 +05:30
|
|
|
</gl-badge>
|
2018-10-15 14:42:47 +05:30
|
|
|
</button>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
</template>
|