mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2026-01-27 22:41:46 +01:00
move list filter preset to url
This commit is contained in:
@@ -456,7 +456,7 @@ func HandleSearchBar(rw http.ResponseWriter, r *http.Request, buildInfo web.Buil
|
||||
http.Redirect(rw, r, "/monitoring/jobs/?startTime="+fromTime+"-"+untilTime+"&arrayJobId="+url.QueryEscape(strings.Trim(splitSearch[1], " ")), http.StatusFound) // All Users: Redirect to Tablequery
|
||||
case "username":
|
||||
if user.HasAnyRole([]schema.Role{schema.RoleAdmin, schema.RoleSupport, schema.RoleManager}) {
|
||||
http.Redirect(rw, r, "/monitoring/users/?user="+url.QueryEscape(strings.Trim(splitSearch[1], " ")), http.StatusFound)
|
||||
http.Redirect(rw, r, "/monitoring/users/?user="+url.QueryEscape(strings.Trim(splitSearch[1], " "))+"&startTime=last30d", http.StatusFound)
|
||||
} else {
|
||||
web.RenderTemplate(rw, "message.tmpl", &web.Page{Title: "Error", MsgType: "alert-danger", Message: "Missing Access Rights", User: *user, Roles: availableRoles, Build: buildInfo})
|
||||
}
|
||||
@@ -464,10 +464,10 @@ func HandleSearchBar(rw http.ResponseWriter, r *http.Request, buildInfo web.Buil
|
||||
usernames, _ := repo.FindColumnValues(user, strings.Trim(splitSearch[1], " "), "user", "username", "name")
|
||||
if len(usernames) != 0 {
|
||||
joinedNames := strings.Join(usernames, "&user=")
|
||||
http.Redirect(rw, r, "/monitoring/users/?user="+joinedNames, http.StatusFound)
|
||||
http.Redirect(rw, r, "/monitoring/users/?user="+joinedNames+"&startTime=last30d", http.StatusFound)
|
||||
} else {
|
||||
if user.HasAnyRole([]schema.Role{schema.RoleAdmin, schema.RoleSupport, schema.RoleManager}) {
|
||||
http.Redirect(rw, r, "/monitoring/users/?user=NoUserNameFound", http.StatusPermanentRedirect)
|
||||
http.Redirect(rw, r, "/monitoring/users/?user=NoUserNameFound&startTime=last30d", http.StatusPermanentRedirect)
|
||||
} else {
|
||||
web.RenderTemplate(rw, "message.tmpl", &web.Page{Title: "Error", MsgType: "alert-danger", Message: "Missing Access Rights", User: *user, Roles: availableRoles, Build: buildInfo})
|
||||
}
|
||||
|
||||
@@ -95,19 +95,7 @@
|
||||
}
|
||||
|
||||
/* On Mount */
|
||||
onMount(() => {
|
||||
// By default, look at the jobs of the last 30 days:
|
||||
if (filterPresets?.startTime == null) {
|
||||
if (filterPresets == null) filterPresets = {};
|
||||
|
||||
filterPresets.startTime = {
|
||||
range: "last30d",
|
||||
text: "Last 30 Days",
|
||||
};
|
||||
};
|
||||
// Init Filter
|
||||
filterComponent.updateFilters();
|
||||
});
|
||||
onMount(() => filterComponent.updateFilters());
|
||||
</script>
|
||||
|
||||
<Row cols={{ xs: 1, md: 2}}>
|
||||
|
||||
@@ -91,38 +91,38 @@
|
||||
/* State Init */
|
||||
// svelte-ignore state_referenced_locally
|
||||
let filters = $state({
|
||||
dbId: filterPresets.dbId || [],
|
||||
jobId: filterPresets.jobId || "",
|
||||
jobIdMatch: filterPresets.jobIdMatch || "eq",
|
||||
arrayJobId: filterPresets.arrayJobId || null,
|
||||
jobName: filterPresets.jobName || "",
|
||||
project: filterPresets.project || "",
|
||||
projectMatch: filterPresets.projectMatch || "contains",
|
||||
user: filterPresets.user || "",
|
||||
userMatch: filterPresets.userMatch || "contains",
|
||||
cluster: filterPresets.cluster || null,
|
||||
partition: filterPresets.partition || null,
|
||||
dbId: filterPresets?.dbId || [],
|
||||
jobId: filterPresets?.jobId || "",
|
||||
jobIdMatch: filterPresets?.jobIdMatch || "eq",
|
||||
arrayJobId: filterPresets?.arrayJobId || null,
|
||||
jobName: filterPresets?.jobName || "",
|
||||
project: filterPresets?.project || "",
|
||||
projectMatch: filterPresets?.projectMatch || "contains",
|
||||
user: filterPresets?.user || "",
|
||||
userMatch: filterPresets?.userMatch || "contains",
|
||||
cluster: filterPresets?.cluster || null,
|
||||
partition: filterPresets?.partition || null,
|
||||
states:
|
||||
filterPresets.states || filterPresets.state
|
||||
filterPresets?.states || filterPresets?.state
|
||||
? [filterPresets.state].flat()
|
||||
: allJobStates,
|
||||
shared: filterPresets.shared || "",
|
||||
schedule: filterPresets.schedule || "",
|
||||
startTime: filterPresets.startTime || { from: null, to: null, range: ""},
|
||||
duration: filterPresets.duration || {
|
||||
shared: filterPresets?.shared || "",
|
||||
schedule: filterPresets?.schedule || "",
|
||||
startTime: filterPresets?.startTime || { from: null, to: null, range: ""},
|
||||
duration: filterPresets?.duration || {
|
||||
lessThan: null,
|
||||
moreThan: null,
|
||||
from: null,
|
||||
to: null,
|
||||
},
|
||||
tags: filterPresets.tags || [],
|
||||
numNodes: filterPresets.numNodes || { from: null, to: null },
|
||||
numHWThreads: filterPresets.numHWThreads || { from: null, to: null },
|
||||
numAccelerators: filterPresets.numAccelerators || { from: null, to: null },
|
||||
node: filterPresets.node || null,
|
||||
nodeMatch: filterPresets.nodeMatch || "eq",
|
||||
energy: filterPresets.energy || { from: null, to: null },
|
||||
stats: filterPresets.stats || [],
|
||||
tags: filterPresets?.tags || [],
|
||||
numNodes: filterPresets?.numNodes || { from: null, to: null },
|
||||
numHWThreads: filterPresets?.numHWThreads || { from: null, to: null },
|
||||
numAccelerators: filterPresets?.numAccelerators || { from: null, to: null },
|
||||
node: filterPresets?.node || null,
|
||||
nodeMatch: filterPresets?.nodeMatch || "eq",
|
||||
energy: filterPresets?.energy || { from: null, to: null },
|
||||
stats: filterPresets?.stats || [],
|
||||
});
|
||||
|
||||
/* Opened States */
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
{/each}
|
||||
</DropdownMenu>
|
||||
</Dropdown>
|
||||
{:else}
|
||||
{:else} <!-- Lists -->
|
||||
<Dropdown nav inNavbar {direction}>
|
||||
<DropdownToggle nav caret>
|
||||
<Icon name={item.icon} />
|
||||
@@ -100,7 +100,7 @@
|
||||
</DropdownToggle>
|
||||
<DropdownMenu class="dropdown-menu-lg-end">
|
||||
<DropdownItem
|
||||
href={item.href}
|
||||
href={`${item.href}?startTime=last30d`}
|
||||
>
|
||||
All Clusters
|
||||
</DropdownItem>
|
||||
@@ -112,12 +112,12 @@
|
||||
</DropdownToggle>
|
||||
<DropdownMenu>
|
||||
<DropdownItem class="py-1 px-2"
|
||||
href={`${item.href}?cluster=${cn}`}
|
||||
href={`${item.href}?cluster=${cn}&startTime=last30d`}
|
||||
>
|
||||
All Jobs
|
||||
</DropdownItem>
|
||||
<DropdownItem class="py-1 px-2"
|
||||
href={`${item.href}?cluster=${cn}&state=running`}
|
||||
href={`${item.href}?cluster=${cn}&state=running&startTime=last30d`}
|
||||
>
|
||||
Running Jobs
|
||||
</DropdownItem>
|
||||
|
||||
@@ -171,7 +171,7 @@
|
||||
Users
|
||||
</InputGroupText>
|
||||
<Input class="flex-grow-1" style="background-color: white;" type="text" value="{userList?.length || 0} User{(userList?.length == 1) ? '': 's'}" disabled />
|
||||
<a title="Show users active on this node" href="/monitoring/users/?cluster={cluster}&state=running&node={hostname}" target="_blank" class="btn btn-outline-primary" role="button" aria-disabled="true" >
|
||||
<a title="Show users active on this node" href="/monitoring/users/?cluster={cluster}&state=running&startTime=last30d&node={hostname}" target="_blank" class="btn btn-outline-primary" role="button" aria-disabled="true" >
|
||||
<Icon name="view-list" />
|
||||
List
|
||||
</a>
|
||||
@@ -192,7 +192,7 @@
|
||||
Projects
|
||||
</InputGroupText>
|
||||
<Input class="flex-grow-1" style="background-color: white;" type="text" value="{projectList?.length || 0} Project{(projectList?.length == 1) ? '': 's'}" disabled />
|
||||
<a title="Show projects active on this node" href="/monitoring/projects/?cluster={cluster}&state=running&node={hostname}" target="_blank" class="btn btn-outline-primary" role="button" aria-disabled="true" >
|
||||
<a title="Show projects active on this node" href="/monitoring/projects/?cluster={cluster}&state=running&startTime=last30d&node={hostname}" target="_blank" class="btn btn-outline-primary" role="button" aria-disabled="true" >
|
||||
<Icon name="view-list" />
|
||||
List
|
||||
</a>
|
||||
|
||||
Reference in New Issue
Block a user