sba-status.vue 1.94 KB
Newer Older
Johannes Edmeier committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
<!--
  - Copyright 2014-2018 the original author or authors.
  -
  - Licensed under the Apache License, Version 2.0 (the "License");
  - you may not use this file except in compliance with the License.
  - You may obtain a copy of the License at
  -
  -     http://www.apache.org/licenses/LICENSE-2.0
  -
  - Unless required by applicable law or agreed to in writing, software
  - distributed under the License is distributed on an "AS IS" BASIS,
  - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  - See the License for the specific language governing permissions and
  - limitations under the License.
  -->

<template>
18 19 20 21 22 23 24
  <div class="application-status">
    <font-awesome-icon :icon="icon" class="application-status__icon"
                       :class="`application-status__icon--${status}`"/>
    <small v-if="date">
      <sba-time-ago :date="date"/>
    </small>
  </div>
Johannes Edmeier committed
25 26 27 28 29 30
</template>

<script>
  import sbaTimeAgo from './sba-time-ago';

  const icons = {
Johannes Edmeier committed
31 32 33 34 35
    'UP': 'check',
    'RESTRICTED': 'exclamation',
    'OUT_OF_SERVICE': 'ban',
    'DOWN': 'times-circle',
    'OFFLINE': 'minus-circle',
Johannes Edmeier committed
36
    'UNKNOWN': 'question-circle'
Johannes Edmeier committed
37 38 39 40 41 42 43
  };

  export default {
    components: {
      sbaTimeAgo,
    },
    props: {
44 45 46 47 48 49 50 51
      status: {
        type: String,
        default: 'UNKNOWN'
      },
      date: {
        type: null,
        default: null
      },
Johannes Edmeier committed
52 53 54 55 56 57 58 59 60 61
    },
    computed: {
      icon() {
        return icons[this.status];
      }
    }
  }
</script>

<style lang="scss">
62
  @import "~@/assets/css/utilities";
Johannes Edmeier committed
63

64 65 66 67 68
  .application-status {
    text-align: center;
    line-height: 1rem;
    display: inline-flex;
    flex-direction: column;
Johannes Edmeier committed
69

70 71 72
    &__icon {
      color: gray;
      margin: 0 auto;
Johannes Edmeier committed
73

74 75 76
      &--UP {
        color: $success;
      }
Johannes Edmeier committed
77

78 79 80
      &--RESTRICTED {
        color: $warning;
      }
Johannes Edmeier committed
81

82 83 84 85
      &--OUT_OF_SERVICE,
      &--DOWN {
        color: $danger;
      }
Johannes Edmeier committed
86

87 88 89 90
      &--UNKNOWN,
      &--OFFLINE {
        color: $grey;
      }
Johannes Edmeier committed
91
    }
92 93
  }
</style>