fix(fe): task log dialog

This commit is contained in:
Denis Gukov 2020-11-21 00:53:54 +05:00
parent 943994e7a6
commit 7a7f43024a
2 changed files with 76 additions and 9 deletions

View File

@ -1,5 +1,5 @@
<template>
<div v-if="item != null && output != null && user != null">
<div>
<v-container class="pa-0 mb-2">
<v-row no-gutters>
<v-col>
@ -88,15 +88,32 @@ export default {
},
data() {
return {
item: null,
output: null,
user: null,
item: {},
output: [],
user: {},
};
},
watch: {
async itemId() {
this.reset();
await this.loadData();
},
async projectId() {
this.reset();
await this.loadData();
},
},
async created() {
await this.loadData();
},
methods: {
reset() {
this.item = {};
this.output = [];
this.user = {};
},
async loadData() {
this.item = (await axios({
method: 'get',

View File

@ -1,5 +1,11 @@
<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
<div v-if="item != null && tasks != null">
<div v-if="!isLoaded">
<v-progress-linear
indeterminate
color="primary darken-2"
></v-progress-linear>
</div>
<div v-else>
<EditDialog
v-model="editDialog"
save-button-text="Save"
@ -94,7 +100,9 @@
<v-list-item>
<v-list-item-content>
<v-list-item-title>SSH Key</v-list-item-title>
<v-list-item-subtitle>{{ item.ssh_key_id }}</v-list-item-subtitle>
<v-list-item-subtitle>
{{ keys.find((x) => x.id === item.ssh_key_id).name }}
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
</v-list>
@ -104,21 +112,27 @@
<v-list-item>
<v-list-item-content>
<v-list-item-title>Inventory</v-list-item-title>
<v-list-item-subtitle>{{ item.inventory_id }}</v-list-item-subtitle>
<v-list-item-subtitle>
{{ inventory.find((x) => x.id === item.inventory_id).name }}
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
<v-list-item>
<v-list-item-content>
<v-list-item-title>Environment</v-list-item-title>
<v-list-item-subtitle>{{ item.environment_id }}</v-list-item-subtitle>
<v-list-item-subtitle>
{{ environment.find((x) => x.id === item.environment_id).name }}
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
<v-list-item>
<v-list-item-content>
<v-list-item-title>Repository</v-list-item-title>
<v-list-item-subtitle>{{ item.repository_id }}</v-list-item-subtitle>
<v-list-item-subtitle>
{{ repositories.find((x) => x.id === item.repository_id).name }}
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
</v-list>
@ -205,6 +219,10 @@ export default {
],
tasks: null,
item: null,
keys: null,
inventory: null,
environment: null,
repositories: null,
deleteDialog: null,
editDialog: null,
copyDialog: null,
@ -220,6 +238,14 @@ export default {
isNew() {
return this.itemId === 'new';
},
isLoaded() {
return this.item
&& this.tasks
&& this.keys
&& this.inventory
&& this.environment
&& this.repositories;
},
},
async created() {
@ -281,6 +307,30 @@ export default {
url: `/api/project/${this.projectId}/templates/${this.itemId}/tasks/last`,
responseType: 'json',
})).data;
this.inventory = (await axios({
method: 'get',
url: `/api/project/${this.projectId}/inventory`,
responseType: 'json',
})).data;
this.environment = (await axios({
method: 'get',
url: `/api/project/${this.projectId}/environment`,
responseType: 'json',
})).data;
this.keys = (await axios({
method: 'get',
url: `/api/project/${this.projectId}/keys`,
responseType: 'json',
})).data;
this.repositories = (await axios({
method: 'get',
url: `/api/project/${this.projectId}/repositories`,
responseType: 'json',
})).data;
},
},
};