debian-mirror-gitlab/app/assets/javascripts/environments/components/environments_table.vue

131 lines
3 KiB
Vue
Raw Normal View History

2017-08-17 22:00:37 +05:30
<script>
/**
* Render environments table.
*/
2018-03-27 19:54:05 +05:30
import loadingIcon from '~/vue_shared/components/loading_icon.vue';
2018-03-17 18:26:18 +05:30
import environmentItem from './environment_item.vue';
2017-08-17 22:00:37 +05:30
export default {
components: {
2018-03-17 18:26:18 +05:30
environmentItem,
2017-09-10 17:25:29 +05:30
loadingIcon,
2017-08-17 22:00:37 +05:30
},
props: {
environments: {
type: Array,
required: true,
default: () => ([]),
},
canReadEnvironment: {
type: Boolean,
required: false,
default: false,
},
canCreateDeployment: {
type: Boolean,
required: false,
default: false,
},
},
methods: {
folderUrl(model) {
return `${window.location.pathname}/folders/${model.folderName}`;
},
2018-03-17 18:26:18 +05:30
shouldRenderFolderContent(env) {
return env.isFolder &&
env.isOpen &&
env.children &&
env.children.length > 0;
},
2017-08-17 22:00:37 +05:30
},
};
</script>
<template>
2018-03-17 18:26:18 +05:30
<div
class="ci-table"
role="grid"
>
<div
class="gl-responsive-table-row table-row-header"
role="row"
>
<div
class="table-section section-10 environments-name"
role="columnheader"
>
{{ s__("Environments|Environment") }}
2017-09-10 17:25:29 +05:30
</div>
2018-03-17 18:26:18 +05:30
<div
class="table-section section-10 environments-deploy"
role="columnheader"
>
{{ s__("Environments|Deployment") }}
2017-09-10 17:25:29 +05:30
</div>
2018-03-17 18:26:18 +05:30
<div
class="table-section section-15 environments-build"
role="columnheader"
>
{{ s__("Environments|Job") }}
2017-09-10 17:25:29 +05:30
</div>
2018-03-17 18:26:18 +05:30
<div
class="table-section section-25 environments-commit"
role="columnheader"
>
{{ s__("Environments|Commit") }}
2017-09-10 17:25:29 +05:30
</div>
2018-03-17 18:26:18 +05:30
<div
class="table-section section-10 environments-date"
role="columnheader"
>
{{ s__("Environments|Updated") }}
2017-09-10 17:25:29 +05:30
</div>
</div>
<template
2018-03-17 18:26:18 +05:30
v-for="(model, i) in environments"
:model="model">
2017-09-10 17:25:29 +05:30
<div
is="environment-item"
:model="model"
:can-create-deployment="canCreateDeployment"
:can-read-environment="canReadEnvironment"
2018-03-17 18:26:18 +05:30
:key="i"
/>
2017-08-17 22:00:37 +05:30
2018-03-17 18:26:18 +05:30
<template
v-if="shouldRenderFolderContent(model)"
>
<div
v-if="model.isLoadingFolderContent"
:key="`loading-item-${i}`">
2017-09-10 17:25:29 +05:30
<loading-icon size="2" />
</div>
2017-08-17 22:00:37 +05:30
2017-09-10 17:25:29 +05:30
<template v-else>
<div
is="environment-item"
2018-03-17 18:26:18 +05:30
v-for="(children, index) in model.children"
2017-09-10 17:25:29 +05:30
:model="children"
:can-create-deployment="canCreateDeployment"
:can-read-environment="canReadEnvironment"
2018-03-17 18:26:18 +05:30
:key="`env-item-${i}-${index}`"
/>
2017-08-17 22:00:37 +05:30
2018-03-17 18:26:18 +05:30
<div :key="`sub-div-${i}`">
2017-09-10 17:25:29 +05:30
<div class="text-center prepend-top-10">
<a
:href="folderUrl(model)"
2018-03-17 18:26:18 +05:30
class="btn btn-default"
>
{{ s__("Environments|Show all") }}
2017-09-10 17:25:29 +05:30
</a>
</div>
</div>
2017-08-17 22:00:37 +05:30
</template>
</template>
2017-09-10 17:25:29 +05:30
</template>
</div>
2017-08-17 22:00:37 +05:30
</template>