xref: /openbmc/webui-vue/src/views/HardwareStatus/Inventory/InventoryTableSystem.vue (revision 223fe5b50ee91e95bb3d19b4ae379b99a86eb570)
17affc529SSandeepa Singh<template>
27affc529SSandeepa Singh  <page-section :section-title="$t('pageInventory.system')">
37affc529SSandeepa Singh    <b-table
47affc529SSandeepa Singh      responsive="md"
57affc529SSandeepa Singh      hover
67affc529SSandeepa Singh      show-empty
77affc529SSandeepa Singh      :items="systems"
87affc529SSandeepa Singh      :fields="fields"
97affc529SSandeepa Singh      :empty-text="$t('global.table.emptyMessage')"
1041057853SKenneth Fullbright      :busy="isBusy"
117affc529SSandeepa Singh    >
127affc529SSandeepa Singh      <!-- Expand chevron icon -->
137affc529SSandeepa Singh      <template #cell(expandRow)="row">
147affc529SSandeepa Singh        <b-button
157affc529SSandeepa Singh          variant="link"
167affc529SSandeepa Singh          data-test-id="hardwareStatus-button-expandSystem"
177affc529SSandeepa Singh          :title="expandRowLabel"
187affc529SSandeepa Singh          class="btn-icon-only"
197affc529SSandeepa Singh          @click="toggleRowDetails(row)"
207affc529SSandeepa Singh        >
217affc529SSandeepa Singh          <icon-chevron />
227affc529SSandeepa Singh          <span class="sr-only">{{ expandRowLabel }}</span>
237affc529SSandeepa Singh        </b-button>
247affc529SSandeepa Singh      </template>
257affc529SSandeepa Singh
267affc529SSandeepa Singh      <!-- Health -->
277affc529SSandeepa Singh      <template #cell(health)="{ value }">
287affc529SSandeepa Singh        <status-icon :status="statusIcon(value)" />
297affc529SSandeepa Singh        {{ value }}
307affc529SSandeepa Singh      </template>
317affc529SSandeepa Singh
327affc529SSandeepa Singh      <template #cell(locationIndicatorActive)="{ item }">
337affc529SSandeepa Singh        <b-form-checkbox
3405388966SSukanya Pandey          id="identifyLedSwitchSystem"
357affc529SSandeepa Singh          v-model="item.locationIndicatorActive"
3605388966SSukanya Pandey          data-test-id="inventorySystem-toggle-identifyLed"
377affc529SSandeepa Singh          switch
387affc529SSandeepa Singh          @change="toggleIdentifyLedSwitch"
397affc529SSandeepa Singh        >
4005388966SSukanya Pandey          <span v-if="item.locationIndicatorActive">
4105388966SSukanya Pandey            {{ $t('global.status.on') }}
4205388966SSukanya Pandey          </span>
4305388966SSukanya Pandey          <span v-else>{{ $t('global.status.off') }}</span>
447affc529SSandeepa Singh        </b-form-checkbox>
457affc529SSandeepa Singh      </template>
467affc529SSandeepa Singh
477affc529SSandeepa Singh      <template #row-details="{ item }">
487affc529SSandeepa Singh        <b-container fluid>
497affc529SSandeepa Singh          <b-row>
507affc529SSandeepa Singh            <b-col class="mt-2" sm="6">
517affc529SSandeepa Singh              <dl>
527affc529SSandeepa Singh                <!-- Serial number -->
537affc529SSandeepa Singh                <dt>{{ $t('pageInventory.table.serialNumber') }}:</dt>
549726f9a7SDixsie Wolmers                <dd>{{ dataFormatter(item.serialNumber) }}</dd>
557affc529SSandeepa Singh                <!-- Model -->
567affc529SSandeepa Singh                <dt>{{ $t('pageInventory.table.model') }}:</dt>
579726f9a7SDixsie Wolmers                <dd>{{ dataFormatter(item.model) }}</dd>
587affc529SSandeepa Singh                <!-- Asset tag -->
597affc529SSandeepa Singh                <dt>{{ $t('pageInventory.table.assetTag') }}:</dt>
607affc529SSandeepa Singh                <dd class="mb-2">
619726f9a7SDixsie Wolmers                  {{ dataFormatter(item.assetTag) }}
627affc529SSandeepa Singh                </dd>
637affc529SSandeepa Singh              </dl>
647affc529SSandeepa Singh            </b-col>
657affc529SSandeepa Singh            <b-col class="mt-2" sm="6">
667affc529SSandeepa Singh              <dl>
677affc529SSandeepa Singh                <!-- Status state -->
687affc529SSandeepa Singh                <dt>{{ $t('pageInventory.table.statusState') }}:</dt>
699726f9a7SDixsie Wolmers                <dd>{{ dataFormatter(item.statusState) }}</dd>
707affc529SSandeepa Singh                <!-- Power state -->
717affc529SSandeepa Singh                <dt>{{ $t('pageInventory.table.power') }}:</dt>
729726f9a7SDixsie Wolmers                <dd>{{ dataFormatter(item.powerState) }}</dd>
737affc529SSandeepa Singh                <!-- Health rollup -->
747affc529SSandeepa Singh                <dt>{{ $t('pageInventory.table.healthRollup') }}:</dt>
759726f9a7SDixsie Wolmers                <dd>{{ dataFormatter(item.healthRollup) }}</dd>
767affc529SSandeepa Singh              </dl>
777affc529SSandeepa Singh            </b-col>
787affc529SSandeepa Singh          </b-row>
797affc529SSandeepa Singh          <div class="section-divider mb-3 mt-3"></div>
807affc529SSandeepa Singh          <b-row>
817affc529SSandeepa Singh            <b-col class="mt-1" sm="6">
827affc529SSandeepa Singh              <dl>
837affc529SSandeepa Singh                <!-- Manufacturer -->
847affc529SSandeepa Singh                <dt>{{ $t('pageInventory.table.manufacturer') }}:</dt>
85c6899362SThang Q. Nguyen                <dd>{{ dataFormatter(item.manufacturer) }}</dd>
867affc529SSandeepa Singh                <!-- Description -->
877affc529SSandeepa Singh                <dt>{{ $t('pageInventory.table.description') }}:</dt>
889726f9a7SDixsie Wolmers                <dd>{{ dataFormatter(item.description) }}</dd>
897affc529SSandeepa Singh                <!-- Sub Model -->
907affc529SSandeepa Singh                <dt>{{ $t('pageInventory.table.subModel') }}:</dt>
917affc529SSandeepa Singh                <dd>
929726f9a7SDixsie Wolmers                  {{ dataFormatter(item.subModel) }}
937affc529SSandeepa Singh                </dd>
947affc529SSandeepa Singh                <!-- System Type -->
957affc529SSandeepa Singh                <dt>{{ $t('pageInventory.table.systemType') }}:</dt>
967affc529SSandeepa Singh                <dd>
979726f9a7SDixsie Wolmers                  {{ dataFormatter(item.systemType) }}
987affc529SSandeepa Singh                </dd>
997affc529SSandeepa Singh              </dl>
1007affc529SSandeepa Singh            </b-col>
1017affc529SSandeepa Singh            <b-col sm="6">
1027affc529SSandeepa Singh              <!-- Memory Summary -->
1031908ac90SSandeepa Singh              <p class="mt-1 mb-2 h6 float-none m-0">
1047affc529SSandeepa Singh                {{ $t('pageInventory.table.memorySummary') }}
1051908ac90SSandeepa Singh              </p>
1061908ac90SSandeepa Singh              <dl class="ml-4">
10718cde3ceSNikhil Ashoka                <!-- Total system memory -->
10818cde3ceSNikhil Ashoka                <dt>{{ $t('pageInventory.table.totalSystemMemoryGiB') }}:</dt>
109d0b078f6SGlukhov Mikhail                <dd>
110d0b078f6SGlukhov Mikhail                  {{ dataFormatter(item.totalSystemMemoryGiB) }}
111d0b078f6SGlukhov Mikhail                  {{ $t('unit.GiB') }}
112d0b078f6SGlukhov Mikhail                </dd>
1131908ac90SSandeepa Singh              </dl>
1147affc529SSandeepa Singh              <!-- Processor Summary -->
1151908ac90SSandeepa Singh              <p class="mt-1 mb-2 h6 float-none m-0">
1167affc529SSandeepa Singh                {{ $t('pageInventory.table.processorSummary') }}
1171908ac90SSandeepa Singh              </p>
1181908ac90SSandeepa Singh              <dl class="ml-4">
1197affc529SSandeepa Singh                <!-- Count -->
1207affc529SSandeepa Singh                <dt>{{ $t('pageInventory.table.count') }}:</dt>
1219726f9a7SDixsie Wolmers                <dd>{{ dataFormatter(item.processorSummaryCount) }}</dd>
12218cde3ceSNikhil Ashoka                <!-- Core Count -->
12318cde3ceSNikhil Ashoka                <dt>{{ $t('pageInventory.table.coreCount') }}:</dt>
12418cde3ceSNikhil Ashoka                <dd>{{ dataFormatter(item.processorSummaryCoreCount) }}</dd>
1257affc529SSandeepa Singh              </dl>
126*223fe5b5STan Siewert              <!-- Serial console -->
127*223fe5b5STan Siewert              <p class="mt-1 mb-2 h6 float-none m-0">
128*223fe5b5STan Siewert                {{ $t('pageInventory.table.serialConsole') }}
129*223fe5b5STan Siewert              </p>
130*223fe5b5STan Siewert              <dl class="ml-4">
131*223fe5b5STan Siewert                <dt>{{ $t('pageInventory.table.maxConcurrentSessions') }}:</dt>
132*223fe5b5STan Siewert                <dd>{{ dataFormatter(item.serialConsoleMaxSessions) }}</dd>
133*223fe5b5STan Siewert                <dt>{{ $t('pageInventory.table.serviceEnabled') }}:</dt>
134*223fe5b5STan Siewert                <dd>{{ dataFormatter(item.serialConsoleEnabled) }}</dd>
135*223fe5b5STan Siewert              </dl>
1367affc529SSandeepa Singh            </b-col>
1377affc529SSandeepa Singh          </b-row>
1387affc529SSandeepa Singh        </b-container>
1397affc529SSandeepa Singh      </template>
1407affc529SSandeepa Singh    </b-table>
1417affc529SSandeepa Singh  </page-section>
1427affc529SSandeepa Singh</template>
1437affc529SSandeepa Singh
1447affc529SSandeepa Singh<script>
1457affc529SSandeepa Singhimport BVToastMixin from '@/components/Mixins/BVToastMixin';
1467affc529SSandeepa Singhimport PageSection from '@/components/Global/PageSection';
1477affc529SSandeepa Singhimport IconChevron from '@carbon/icons-vue/es/chevron--down/20';
1487affc529SSandeepa Singh
1497affc529SSandeepa Singhimport StatusIcon from '@/components/Global/StatusIcon';
1507affc529SSandeepa Singh
1517affc529SSandeepa Singhimport TableRowExpandMixin, {
1527affc529SSandeepa Singh  expandRowLabel,
1537affc529SSandeepa Singh} from '@/components/Mixins/TableRowExpandMixin';
1549726f9a7SDixsie Wolmersimport DataFormatterMixin from '@/components/Mixins/DataFormatterMixin';
155de23ea23SSurya Vimport { useI18n } from 'vue-i18n';
156de23ea23SSurya Vimport i18n from '@/i18n';
1577affc529SSandeepa Singh
1587affc529SSandeepa Singhexport default {
1597affc529SSandeepa Singh  components: { IconChevron, PageSection, StatusIcon },
1609726f9a7SDixsie Wolmers  mixins: [BVToastMixin, TableRowExpandMixin, DataFormatterMixin],
1617affc529SSandeepa Singh  data() {
1627affc529SSandeepa Singh    return {
163de23ea23SSurya V      $t: useI18n().t,
16441057853SKenneth Fullbright      isBusy: true,
1657affc529SSandeepa Singh      fields: [
1667affc529SSandeepa Singh        {
1677affc529SSandeepa Singh          key: 'expandRow',
1687affc529SSandeepa Singh          label: '',
1697affc529SSandeepa Singh          tdClass: 'table-row-expand',
1707affc529SSandeepa Singh        },
1717affc529SSandeepa Singh        {
1727affc529SSandeepa Singh          key: 'id',
173de23ea23SSurya V          label: i18n.global.t('pageInventory.table.id'),
1749726f9a7SDixsie Wolmers          formatter: this.dataFormatter,
1757affc529SSandeepa Singh        },
1767affc529SSandeepa Singh        {
1777affc529SSandeepa Singh          key: 'hardwareType',
178de23ea23SSurya V          label: i18n.global.t('pageInventory.table.hardwareType'),
1799726f9a7SDixsie Wolmers          formatter: this.dataFormatter,
1807affc529SSandeepa Singh          tdClass: 'text-nowrap',
1817affc529SSandeepa Singh        },
1827affc529SSandeepa Singh        {
1837affc529SSandeepa Singh          key: 'health',
184de23ea23SSurya V          label: i18n.global.t('pageInventory.table.health'),
1859726f9a7SDixsie Wolmers          formatter: this.dataFormatter,
1867affc529SSandeepa Singh          tdClass: 'text-nowrap',
1877affc529SSandeepa Singh        },
1887affc529SSandeepa Singh        {
1897affc529SSandeepa Singh          key: 'locationNumber',
190de23ea23SSurya V          label: i18n.global.t('pageInventory.table.locationNumber'),
1919726f9a7SDixsie Wolmers          formatter: this.dataFormatter,
1927affc529SSandeepa Singh        },
1937affc529SSandeepa Singh        {
1947affc529SSandeepa Singh          key: 'locationIndicatorActive',
195de23ea23SSurya V          label: i18n.global.t('pageInventory.table.identifyLed'),
1969726f9a7SDixsie Wolmers          formatter: this.dataFormatter,
1977affc529SSandeepa Singh        },
1987affc529SSandeepa Singh      ],
1997affc529SSandeepa Singh      expandRowLabel: expandRowLabel,
2007affc529SSandeepa Singh    };
2017affc529SSandeepa Singh  },
2027affc529SSandeepa Singh  computed: {
2037affc529SSandeepa Singh    systems() {
2047affc529SSandeepa Singh      return this.$store.getters['system/systems'];
2057affc529SSandeepa Singh    },
2067affc529SSandeepa Singh  },
2077affc529SSandeepa Singh  created() {
2087affc529SSandeepa Singh    this.$store.dispatch('system/getSystem').finally(() => {
2097affc529SSandeepa Singh      // Emit initial data fetch complete to parent component
2107affc529SSandeepa Singh      this.$root.$emit('hardware-status-system-complete');
21141057853SKenneth Fullbright      this.isBusy = false;
2127affc529SSandeepa Singh    });
2137affc529SSandeepa Singh  },
2147affc529SSandeepa Singh  methods: {
2157affc529SSandeepa Singh    toggleIdentifyLedSwitch(state) {
2167affc529SSandeepa Singh      this.$store
2177affc529SSandeepa Singh        .dispatch('system/changeIdentifyLedState', state)
218f11a1901SNikhil Ashoka        .then((message) => this.successToast(message))
2197affc529SSandeepa Singh        .catch(({ message }) => this.errorToast(message));
2207affc529SSandeepa Singh    },
2217affc529SSandeepa Singh  },
2227affc529SSandeepa Singh};
2237affc529SSandeepa Singh</script>
224