Fixing group and images

This commit is contained in:
Axel 2021-12-20 11:27:19 +01:00
parent ee16a6f8f7
commit 10ef2dd4e8
4 changed files with 19 additions and 17 deletions

View file

@ -40,13 +40,15 @@ class ApiController extends Controller
$group_id = $t->group_id; $group_id = $t->group_id;
$group_name = $t->group_name; $group_name = $t->group_name;
} }
$tasks[$group_id] = [
'id' => $group_id, if (empty($tasks[$group_id])) {
'name' => $group_name, $tasks[$group_id] = [
'tasks' => [ 'id' => $group_id,
$t->id => $t 'name' => $group_name,
] 'tasks' => null
]; ];
}
$tasks[$group_id]['tasks'][$t->id] = $t;
} }
return response()->json($tasks); return response()->json($tasks);

File diff suppressed because one or more lines are too long

View file

@ -8,7 +8,7 @@
<a :name="'group-'+group.id"></a> <a :name="'group-'+group.id"></a>
<h3> <h3>
Tasks for group <span class="highlight">{{ group.name }} <small>(#{{ group.id }})</small></span> Tasks for group <span class="highlight">{{ group.name }} <small>(#{{ group.id }})</small></span>
<!-- <p class="context-menu"><img src="img/menu.svg" width="40" /></p> --> <!-- <p class="context-menu"><img src="/img/menu.svg" width="40" /></p> -->
</h3> </h3>
<div class="block-content"> <div class="block-content">
@ -30,21 +30,21 @@
v-bind:key="task.id" v-bind:key="task.id"
> >
<td :class="statusText(task.status)"> <td :class="statusText(task.status)">
<img :src="'img/'+statusText(task.status)+'.svg'" width="16" alt="Status" /> <img :src="'/img/'+statusText(task.status)+'.svg'" width="16" alt="Status" />
</td> </td>
<td> <td>
<img src="/img/external.svg" alt="View host" width="16"> <img src="/img/external.svg" alt="View host" width="16">
<a :href="task.host" target="_blank">{{ task.host }}</a> <a :href="task.host" target="_blank">{{ task.host }}</a>
</td> </td>
<td> <td>
<img :src="task.type == 'http' ? 'img/http.svg' : 'img/ping.svg'" width="16" alt="Type of check" :title="'Type: '+task.type" /> <img :src="task.type == 'http' ? '/img/http.svg' : '/img/ping.svg'" width="16" alt="Type of check" :title="'Type: '+task.type" />
</td> </td>
<td> <td>
<span <span
v-if="task.last_execution" v-if="task.last_execution"
> >
{{ moment(task.last_execution).fromNow() }} {{ moment(task.last_execution).fromNow() }}
<img src="img/info.svg" alt="Infos" width="16" :title="'Result: '+task.output" /> <img src="/img/info.svg" alt="Infos" width="16" :title="'Result: '+task.output" />
</span> </span>
<span <span
v-else v-else
@ -63,7 +63,7 @@
</td> </td>
<td> <td>
<router-link :to="{ name: 'taskdetails', params: { id: task.id }}"> <router-link :to="{ name: 'taskdetails', params: { id: task.id }}">
<img src="img/see.svg" alt="Details" width="20" /> <img src="/img/see.svg" alt="Details" width="20" />
</router-link> </router-link>
</td> </td>
</tr> </tr>

View file

@ -2,7 +2,7 @@
<div> <div>
<h3> <h3>
Task Task
<!-- <p class="context-menu"><img src="img/menu.svg" width="40" /></p> --> <!-- <p class="context-menu"><img src="/img/menu.svg" width="40" /></p> -->
</h3> </h3>
</div> </div>
</template> </template>