Kubernetes Web View to list and view all Kubernetes resources https://kube-web-view.readthedocs.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.5 KiB

{% extends "base.html" %}
{% block title %}Clusters{% endblock %}
{% block content %}
<h1 class="title">Clusters</h1>
<form action="#" method="get" class="tools-form is-active">
<input type="hidden" name="selector" value="{{ rel_url.query.selector }}">
<div class="field is-horizontal">
<div class="field-body">
<div class="field has-addons">
<p class="control is-expanded has-icons-left">
<input class="input" type="text" placeholder="Filter clusters" name="filter" value="{{ rel_url.query.filter }}">
<span class="icon is-small is-left">
<i class="fas fa-filter"></i>
<div class="control">
<button class="button is-primary" type="submit">Filter!</button>
function toggleSearchButton() {
const $checked = document.querySelectorAll('input[name=cluster]:checked');
const $button = document.getElementById("search-clusters-button");
if ($checked.length > 0) {
$button.disabled = false;
} else {
$button.disabled = true;
<form action="/search" method="get">
<table class="table is-stripped is-fullwidth has-bottom-controls">
<th>API URL</th>
{% for cluster in clusters: %}
<td><input type="checkbox" name="cluster" value="{{ cluster.name }}" onclick="toggleSearchButton()"></td>
<td><a href="/clusters/{{ cluster.name }}">{{ cluster.name }}</a></td>
<td>{{ cluster.api.url }}</td>
{% for key, val in cluster.labels.items()|sort: %}
<a href="/clusters?selector={{ key }}={{ val }}"><span class="tag is-link">{{ key }}: {{ val }}</span></a>
{% endfor %}
{% else: %}
<td colspan="4">No clusters found.</td>
{% endfor %}
<div class="control bottom-controls">
<button class="button is-primary" type="submit" id="search-clusters-button" disabled>
<span class="icon">
<i class="fas fa-search"></i>
<span>Search in selected clusters</span></button>
{% endblock %}