Repository: hashicorp/vault
File: ui/app/components/clients/page/counts.ts (TypeScript)

Code before:
            'In order to get the most from this data, please enter a start month above. Vault will calculate new clients starting from that month.',
        };
  }

  // path of the filtered namespace OR current one, for filtering relevant data
  get namespacePathForFilter() {
    const { namespace } = this.args;
    const currentNs = this.namespace.currentNamespace;
    return sanitizePath(namespace || currentNs || 'root');
  }

  // activityForNamespace gets the byNamespace data for the selected or current namespace so we can get the list of mounts from that namespace for attribution
  get activityForNamespace() {
    const { activity } = this.args;
    const nsPath = this.namespacePathForFilter;
    // we always return activity for namespace, either the selected filter or the current
    return activity?.byNamespace?.find((ns) => sanitizePath(ns.label) === nsPath);
  }

  // duplicate of the method found in the activity component, so that we render the child only when there is activity to view
  get totalUsageCounts(): TotalClients | undefined {
    const { namespace, mountPath, activity } = this.args;
    if (mountPath) {
      // only do this if we have a mountPath filter.
      // namespace is filtered on API layer
      return filteredTotalForMount(activity.byMonth, namespace, mountPath);
    }
    return activity?.newClientTotal;
  }

  // namespace list for the search-select filter
  get namespaces() {
    return this.args.activity?.byNamespace
      ? this.args.activity.byNamespace
          .map((namespace) => ({
            name: namespace.label,
            id: namespace.label,
          }))
          .filter((ns) => sanitizePath(ns.name) !== this.namespacePathForFilter)
      : [];
  }

  // mounts within the current/filtered namespace for the sesarch-select filter
  get mountPaths() {
    return (
      this.activityForNamespace?.mounts.map((mount) => ({
        id: mount.label,
        name: mount.label,
      })) || []
    );
  }

Review comment (suggestion):
same comment here, this should still be `byNamespace` I believe

Code after:
            'In order to get the most from this data, please enter a start month above. Vault will calculate new clients starting from that month.',
        };
  }

  // path of the filtered namespace OR current one, for filtering relevant data
  get namespacePathForFilter() {
    const { namespace } = this.args;
    const currentNs = this.namespace.currentNamespace;
    return sanitizePath(namespace || currentNs || 'root');
  }

  // activityForNamespace gets the byNamespace data for the selected or current namespace so we can get the list of mounts from that namespace for attribution
  get activityForNamespace() {
    const { activity } = this.args;
    const nsPath = this.namespacePathForFilter;
    // we always return activity for namespace, either the selected filter or the current
    return activity?.byNamespace?.find((ns) => sanitizePath(ns.label) === nsPath);
  }

  // duplicate of the method found in the activity component, so that we render the child only when there is activity to view
  get totalUsageCounts(): TotalClients | undefined {
    const { namespace, mountPath, activity } = this.args;
    if (mountPath) {
      // only do this if we have a mountPath filter.
      // namespace is filtered on API layer
      return filteredTotalForMount(activity.byNamespace, namespace, mountPath);
    }
    return activity?.total;
  }

  // namespace list for the search-select filter
  get namespaces() {
    return this.args.activity?.byNamespace
      ? this.args.activity.byNamespace
          .map((namespace) => ({
            name: namespace.label,
            id: namespace.label,
          }))
          .filter((ns) => sanitizePath(ns.name) !== this.namespacePathForFilter)
      : [];
  }

  // mounts within the current/filtered namespace for the sesarch-select filter
  get mountPaths() {
    return (
      this.activityForNamespace?.mounts.map((mount) => ({
        id: mount.label,
        name: mount.label,
      })) || []
    );
  }