mirror of
				https://github.com/ClusterCockpit/cc-backend
				synced 2025-11-03 17:15:06 +01:00 
			
		
		
		
	fix: add name scrambling demo mode to all views
- was missing for analysis, status and nodelist
This commit is contained in:
		@@ -26,6 +26,8 @@
 | 
			
		||||
    init,
 | 
			
		||||
    convert2uplot,
 | 
			
		||||
    binsFromFootprint,
 | 
			
		||||
    scramble,
 | 
			
		||||
    scrambleNames,
 | 
			
		||||
  } from "./generic/utils.js";
 | 
			
		||||
  import PlotSelection from "./analysis/PlotSelection.svelte";
 | 
			
		||||
  import Filters from "./generic/Filters.svelte";
 | 
			
		||||
@@ -395,7 +397,7 @@
 | 
			
		||||
              quantities={$topQuery.data.topList.map(
 | 
			
		||||
                (t) => t[sortSelection.key],
 | 
			
		||||
              )}
 | 
			
		||||
              entities={$topQuery.data.topList.map((t) => t.id)}
 | 
			
		||||
              entities={$topQuery.data.topList.map((t) => scrambleNames ? scramble(t.id) : t.id)}
 | 
			
		||||
            />
 | 
			
		||||
          {/if}
 | 
			
		||||
        {/key}
 | 
			
		||||
@@ -428,21 +430,21 @@
 | 
			
		||||
                {#if groupSelection.key == "user"}
 | 
			
		||||
                  <th scope="col" id="topName-{te.id}"
 | 
			
		||||
                    ><a href="/monitoring/user/{te.id}?cluster={clusterName}"
 | 
			
		||||
                      >{te.id}</a
 | 
			
		||||
                      >{scrambleNames ? scramble(te.id) : te.id}</a
 | 
			
		||||
                    ></th
 | 
			
		||||
                  >
 | 
			
		||||
                  {#if te?.name}
 | 
			
		||||
                    <Tooltip
 | 
			
		||||
                      target={`topName-${te.id}`}
 | 
			
		||||
                      placement="left"
 | 
			
		||||
                      >{te.name}</Tooltip
 | 
			
		||||
                      >{scrambleNames ? scramble(te.name) : te.name}</Tooltip
 | 
			
		||||
                    >
 | 
			
		||||
                  {/if}
 | 
			
		||||
                {:else}
 | 
			
		||||
                  <th scope="col"
 | 
			
		||||
                    ><a
 | 
			
		||||
                      href="/monitoring/jobs/?cluster={clusterName}&project={te.id}&projectMatch=eq"
 | 
			
		||||
                      >{te.id}</a
 | 
			
		||||
                      >{scrambleNames ? scramble(te.id) : te.id}</a
 | 
			
		||||
                    ></th
 | 
			
		||||
                  >
 | 
			
		||||
                {/if}
 | 
			
		||||
 
 | 
			
		||||
@@ -31,6 +31,8 @@
 | 
			
		||||
    init,
 | 
			
		||||
    convert2uplot,
 | 
			
		||||
    transformPerNodeDataForRoofline,
 | 
			
		||||
    scramble,
 | 
			
		||||
    scrambleNames,
 | 
			
		||||
  } from "./generic/utils.js";
 | 
			
		||||
  import { scaleNumbers } from "./generic/units.js";
 | 
			
		||||
  import PlotGrid from "./generic/PlotGrid.svelte";
 | 
			
		||||
@@ -486,7 +488,7 @@
 | 
			
		||||
              quantities={$topUserQuery.data.topUser.map(
 | 
			
		||||
                (tu) => tu[topUserSelection.key],
 | 
			
		||||
              )}
 | 
			
		||||
              entities={$topUserQuery.data.topUser.map((tu) => tu.id)}
 | 
			
		||||
              entities={$topUserQuery.data.topUser.map((tu) => scrambleNames ? scramble(tu.id) : tu.id)}
 | 
			
		||||
            />
 | 
			
		||||
          {/if}
 | 
			
		||||
        {/key}
 | 
			
		||||
@@ -520,14 +522,14 @@
 | 
			
		||||
                <th scope="col" id="topName-{tu.id}"
 | 
			
		||||
                  ><a
 | 
			
		||||
                    href="/monitoring/user/{tu.id}?cluster={cluster}&state=running"
 | 
			
		||||
                    >{tu.id}</a
 | 
			
		||||
                    >{scrambleNames ? scramble(tu.id) : tu.id}</a
 | 
			
		||||
                  ></th
 | 
			
		||||
                >
 | 
			
		||||
                {#if tu?.name}
 | 
			
		||||
                  <Tooltip
 | 
			
		||||
                    target={`topName-${tu.id}`}
 | 
			
		||||
                    placement="left"
 | 
			
		||||
                    >{tu.name}</Tooltip
 | 
			
		||||
                    >{scrambleNames ? scramble(tu.name) : tu.name}</Tooltip
 | 
			
		||||
                  >
 | 
			
		||||
                {/if}
 | 
			
		||||
                <td>{tu[topUserSelection.key]}</td>
 | 
			
		||||
@@ -553,7 +555,7 @@
 | 
			
		||||
            quantities={$topProjectQuery.data.topProjects.map(
 | 
			
		||||
              (tp) => tp[topProjectSelection.key],
 | 
			
		||||
            )}
 | 
			
		||||
            entities={$topProjectQuery.data.topProjects.map((tp) => tp.id)}
 | 
			
		||||
            entities={$topProjectQuery.data.topProjects.map((tp) => scrambleNames ? scramble(tp.id) : tp.id)}
 | 
			
		||||
          />
 | 
			
		||||
        {/if}
 | 
			
		||||
      {/key}
 | 
			
		||||
@@ -586,7 +588,7 @@
 | 
			
		||||
                <th scope="col"
 | 
			
		||||
                  ><a
 | 
			
		||||
                    href="/monitoring/jobs/?cluster={cluster}&state=running&project={tp.id}&projectMatch=eq"
 | 
			
		||||
                    >{tp.id}</a
 | 
			
		||||
                    >{scrambleNames ? scramble(tp.id) : tp.id}</a
 | 
			
		||||
                  ></th
 | 
			
		||||
                >
 | 
			
		||||
                <td>{tp[topProjectSelection.key]}</td>
 | 
			
		||||
 
 | 
			
		||||
@@ -17,6 +17,9 @@
 | 
			
		||||
    Input,
 | 
			
		||||
    InputGroup,
 | 
			
		||||
    InputGroupText, } from "@sveltestrap/sveltestrap";
 | 
			
		||||
  import { 
 | 
			
		||||
    scramble,
 | 
			
		||||
    scrambleNames, } from "../../generic/utils.js";
 | 
			
		||||
 | 
			
		||||
  export let cluster;
 | 
			
		||||
  export let subCluster
 | 
			
		||||
@@ -32,8 +35,8 @@
 | 
			
		||||
  let userList;
 | 
			
		||||
  let projectList;
 | 
			
		||||
  $: if (nodeJobsData) {
 | 
			
		||||
    userList = Array.from(new Set(nodeJobsData.jobs.items.map((j) => j.user))).sort((a, b) => a.localeCompare(b));
 | 
			
		||||
    projectList = Array.from(new Set(nodeJobsData.jobs.items.map((j) => j.project))).sort((a, b) => a.localeCompare(b));
 | 
			
		||||
    userList = Array.from(new Set(nodeJobsData.jobs.items.map((j) => scrambleNames ? scramble(j.user) : j.user))).sort((a, b) => a.localeCompare(b));
 | 
			
		||||
    projectList = Array.from(new Set(nodeJobsData.jobs.items.map((j) => scrambleNames ? scramble(j.project) : j.project))).sort((a, b) => a.localeCompare(b));
 | 
			
		||||
  }
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
    getContextClient,
 | 
			
		||||
  } from "@urql/svelte";
 | 
			
		||||
  import { Card, CardBody, Spinner } from "@sveltestrap/sveltestrap";
 | 
			
		||||
  import { maxScope, checkMetricDisabled } from "../../generic/utils.js";
 | 
			
		||||
  import { maxScope, checkMetricDisabled, scramble, scrambleNames } from "../../generic/utils.js";
 | 
			
		||||
  import MetricPlot from "../../generic/plots/MetricPlot.svelte";
 | 
			
		||||
  import NodeInfo from "./NodeInfo.svelte";
 | 
			
		||||
 | 
			
		||||
@@ -110,9 +110,12 @@
 | 
			
		||||
      extendedLegendData = {}
 | 
			
		||||
      for (const accId of accSet) {
 | 
			
		||||
        const matchJob = $nodeJobsData.data.jobs.items.find((i) => i.resources.find((r) => r.accelerators.includes(accId)))
 | 
			
		||||
        const matchUser = matchJob?.user ? matchJob.user : null
 | 
			
		||||
        extendedLegendData[accId] = {
 | 
			
		||||
          user: matchJob?.user  ? matchJob?.user  : '-',
 | 
			
		||||
          job:  matchJob?.jobId ? matchJob?.jobId : '-',
 | 
			
		||||
          user: (scrambleNames && matchUser)
 | 
			
		||||
            ? scramble(matchUser) 
 | 
			
		||||
            : (matchUser ? matchUser : '-'),
 | 
			
		||||
          job:  matchJob?.jobId ? matchJob.jobId : '-',
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      // Theoretically extendable for hwthreadIDs
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user