summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/serverless/components/functions.vue
blob: 9606a78410eee88d4ecf3f2161088617d523b666 (plain)
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
<script>
import { GlSkeletonLoading } from '@gitlab/ui';
import FunctionRow from './function_row.vue';
import EmptyState from './empty_state.vue';

export default {
  components: {
    FunctionRow,
    EmptyState,
    GlSkeletonLoading,
  },
  props: {
    functions: {
      type: Array,
      required: true,
      default: () => [],
    },
    installed: {
      type: Boolean,
      required: true,
    },
    clustersPath: {
      type: String,
      required: true,
    },
    helpPath: {
      type: String,
      required: true,
    },
    loadingData: {
      type: Boolean,
      required: false,
      default: true,
    },
    hasFunctionData: {
      type: Boolean,
      required: false,
      default: true,
    },
  },
};
</script>

<template>
  <section id="serverless-functions">
    <div v-if="installed">
      <div v-if="hasFunctionData">
        <div class="ci-table js-services-list function-element">
          <div class="gl-responsive-table-row table-row-header" role="row">
            <div class="table-section section-20" role="rowheader">
              {{ s__('Serverless|Function') }}
            </div>
            <div class="table-section section-10" role="rowheader">
              {{ s__('Serverless|Cluster Env') }}
            </div>
            <div class="table-section section-40" role="rowheader">
              {{ s__('Serverless|Description') }}
            </div>
            <div class="table-section section-20" role="rowheader">
              {{ s__('Serverless|Runtime') }}
            </div>
            <div class="table-section section-10" role="rowheader">
              {{ s__('Serverless|Last Update') }}
            </div>
          </div>
          <template v-if="loadingData">
            <div v-for="j in 3" :key="j" class="gl-responsive-table-row">
              <gl-skeleton-loading />
            </div>
          </template>
          <template v-else>
            <function-row v-for="f in functions" :key="f.name" :func="f" />
          </template>
        </div>
      </div>
      <div v-else class="empty-state js-empty-state">
        <div class="text-content">
          <h4 class="state-title text-center">{{ s__('Serverless|No functions available') }}</h4>
          <p class="state-description">
            {{
              s__(`Serverless|There is currently no function data available from Knative.
                   This could be for a variety of reasons including:`)
            }}
          </p>
          <ul>
            <li>Your repository does not have a corresponding <code>serverless.yml</code> file.</li>
            <li>Your <code>.gitlab-ci.yml</code> file is not properly configured.</li>
            <li>
              The functions listed in the <code>serverless.yml</code> file don't match the namespace
              of your cluster.
            </li>
            <li>The deploy job has not finished.</li>
          </ul>

          <p>
            {{
              s__(`Serverless|If you believe none of these apply, please check
                   back later as the function data may be in the process of becoming
                   available.`)
            }}
          </p>
          <div class="text-center">
            <a :href="helpPath" class="btn btn-success">
              {{ s__('Serverless|Learn more about Serverless') }}
            </a>
          </div>
        </div>
      </div>
    </div>

    <empty-state v-else :clusters-path="clustersPath" :help-path="helpPath" />
  </section>
</template>

<style>
.top-area {
  border-bottom: 0;
}

.function-element {
  border-bottom: 1px solid #e5e5e5;
  border-bottom-color: rgb(229, 229, 229);
  border-bottom-style: solid;
  border-bottom-width: 1px;
}
</style>