# All files / components BertaDashboard.vue

97.61% Statements 41/42
70% Branches 7/10
90% Functions 9/10
97.61% Lines 41/42

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169

    1x

    1x

    1x

    5x

    5x

    5x

    5x

    5x

    5x

    5x

    2x
    2x

    5x
    1x

    5x
    1x

    5x

     <template>
      <div>
        <Searchbar
          :tabs="tabsstored"
          @filteredTabs="updateFilteredTabs"
        />
        <div class="overflow-tabs-container">
          <div>
            <div
              v-if="tabs.length > 0"
              class="nav nav-tabs"
            >
              <div
                v-for="tab in tabs"
                :key="tab.id"
                class="nav-item"
              >
                <a
                  :class="['nav-link', { 'active': activeTab === tab.id }]"
                  @click="changeTab(tab.id)"
                >
                  {{ tab.name }}
                </a>
              </div>
            </div>
            <div v-else>
              <div class="nav nav-tabs">
                <SkeletonTab
                  v-for="index in 3"
                  :key="index"
                />
              </div>
            </div>
          </div>
        </div>
        <transition
          name="fade"
          mode="out-in"
        >
          <div
            v-if="content"
            class="content-container"
          >
            <p
              v-if="content.name"
              class="mb-0"
            >
              <strong>Name:</strong> {{ content.name }}
            </p>
            <p
              v-if="content.coursecount"
              class="mb-0"
            >
              <strong>Course Count:</strong> {{ content.coursecount }}
            </p>
            <p
              v-if="content.path"
              class="mb-0"
            >
              <strong>Path:</strong> {{ content.path }}
            </p>
            <CapabilityButtons @capabilityClicked="handleCapabilityClicked" />
            <CapabilityOptions :selectedcapability="selectedCapability" />
          </div>
          <div
            v-else
            class="content-container"
          >
            <SkeletonContent />
          </div>
        </transition>
      </div>
    </template>

    <script setup>
      import { ref, onMounted, watch } from 'vue'
      import Searchbar from '../components/FilterSearchbar.vue'
      import { useStore } from 'vuex'
      import SkeletonTab from '../components/helper/SkeletonTab.vue';
      import SkeletonContent from '../components/helper/SkeletonContent.vue';
      import CapabilityButtons from '../components/helper/CapabilityButtons.vue';
      import CapabilityOptions from '../components/helper/CapabilityOptions.vue';

      const content = ref()
      const store = useStore()
      const tabsstored = ref([]);
      const tabs = ref([]);
      const activeTab = ref(0);
      const selectedCapability = ref(null)

      // Trigger web services on mount
      onMounted(() => {
        store.dispatch('fetchTabs')
        store.dispatch('fetchParentContent', 0)
        tabsstored.value = store.state.tabs;
        tabs.value = store.state.tabs;
        content.value = store.state.content;
      });

      watch(() => store.state.tabs, async () => {
        tabsstored.value = store.state.tabs
        tabs.value = store.state.tabs
      }, { deep: true } );

      watch(() => store.state.content, async () => {
        content.value = null
        setTimeout(() => {
          content.value = store.state.content
        }, 200);
      }, { deep: true } );

      function changeTab(index) {
        activeTab.value = index;
        store.dispatch('fetchParentContent', index);
      }

      const updateFilteredTabs = (filteredTabsFromSearchbar) => {
        tabs.value = filteredTabsFromSearchbar;
      }

      const handleCapabilityClicked = (capability) => {
        selectedCapability.value = capability
      }
    </script>

    <style scoped>

    .fade-enter-active, .fade-leave-active {
      transition: all 0.5s ease;
    }

    .fade-enter-from, .fade-leave-to /* .fade-leave-active in <2.1.8 */ {
      opacity: 0;
      transform: translateX(30px);
    }
    .overflow-tabs-container {
      overflow-x: auto;
      white-space: nowrap;
    }

    .nav-item{
      margin-right: 2px;
    }
    .nav-tabs {
      display: flex !important;
      flex-wrap: nowrap !important;
      border-bottom: 1px solid #e0e0e0; /* Light gray bottom border */
    }

    .nav-link {
      background-color: #bdb5b5; /* White background */
      padding: 0.5rem 1rem;
      color: #555555c7; /* Dark gray text color */
    }

    .nav-link.active {
      background-color: #528cef; /* Blue background for active tab */
      color: #fff; /* White text color for active tab */
    }

    .content-container {
      width: 100%;
      background: #f5f5f5; /* Light gray background for content */
      min-height: 300px;
      border-bottom-left-radius: 3rem;
      border-bottom-right-radius: 3rem;
      padding: 1rem;
    }
    </style>