@7365admin1/layer-common 4.35.1-staging.391 → 4.35.1-staging.393

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -73,11 +73,19 @@
73
73
  <template #item.nature="{ item }">
74
74
  {{ replaceMatch(item.nature, "_", " ") }}
75
75
  </template>
76
- <!-- The role is a soft pill in the design, not a plain word. Same
77
- text, same column, same source field. -->
76
+ <!-- The role is a soft pill in the design, not a plain word. The
77
+ member's REAL role name; a deleted / other-organisation / missing
78
+ role says so instead of reading as a working grant
79
+ (memberRoleChip in utils/role.ts, server roleState). -->
78
80
  <template #item.roleName="{ item }">
79
- <StatusChip v-if="item.roleName" :dot="false" pill tone="info">
80
- {{ item.roleName }}
81
+ <StatusChip
82
+ v-if="memberRoleChip(item)"
83
+ :dot="false"
84
+ pill
85
+ :tone="memberRoleChip(item)?.tone"
86
+ data-test="member-role-chip"
87
+ >
88
+ {{ memberRoleChip(item)?.text }}
81
89
  </StatusChip>
82
90
  </template>
83
91
  <template #item.dateInvited="{ item }">
@@ -113,8 +121,20 @@
113
121
  />
114
122
  </template>
115
123
  <v-list>
124
+ <!-- Highlighted when the row's role chip is a warning (no /
125
+ deleted / other org / other site role): this is the fix. -->
116
126
  <v-list-item
117
127
  v-if="props.assignRole"
128
+ :class="{
129
+ 'text-warning font-weight-bold':
130
+ memberRoleChip(item)?.tone === 'warn',
131
+ }"
132
+ :prepend-icon="
133
+ memberRoleChip(item)?.tone === 'warn'
134
+ ? 'mdi-alert-circle-outline'
135
+ : undefined
136
+ "
137
+ data-test="member-assign-role"
118
138
  @click="
119
139
  setMember({
120
140
  dialog: true,
@@ -258,7 +278,7 @@
258
278
  </template>
259
279
 
260
280
  <script setup lang="ts">
261
- import { withCurrentRole } from "../utils/role";
281
+ import { memberRoleChip, withCurrentRole } from "../utils/role";
262
282
 
263
283
  const props = defineProps({
264
284
  /** The design's page title. Every app that mounts this screen calls it
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@7365admin1/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "4.35.1-staging.391",
5
+ "version": "4.35.1-staging.393",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
package/utils/role.ts CHANGED
@@ -26,3 +26,37 @@ export function withCurrentRole<T extends { _id?: unknown; name?: unknown }>(
26
26
  if (!currentId || list.some((r) => String(r?._id) === currentId)) return list;
27
27
  return [...list, { _id: currentId, name: currentName || currentId }];
28
28
  }
29
+
30
+ /**
31
+ * What the Members list's "Roles and Permission" chip says for one row.
32
+ *
33
+ * The server's `roleState` (core 2026-09-25) says whether `roleName` is a role
34
+ * the member can really use. A bare name for a deleted role, another
35
+ * organisation's role, or no role at all read as a working grant (owner report:
36
+ * a member showed "Security" and Assign Role could not fix it). Rows from an
37
+ * older server carry no `roleState` and render exactly as before.
38
+ */
39
+ export function memberRoleChip(item: {
40
+ roleName?: unknown;
41
+ roleState?: unknown;
42
+ roleSiteName?: unknown;
43
+ }): { text: string; tone: "info" | "warn" } | null {
44
+ const name = typeof item?.roleName === "string" ? item.roleName : "";
45
+ switch (item?.roleState) {
46
+ case "missing":
47
+ return { text: "No role assigned - assign one", tone: "warn" };
48
+ case "deleted":
49
+ return { text: `${name || "Role"} (deleted) - assign a new role`, tone: "warn" };
50
+ case "other-org":
51
+ return { text: "Invalid role - assign a new role", tone: "warn" };
52
+ // The organisation's own role, but pinned to a different site than this
53
+ // membership's (owner report 2026-09-25: a Newton 200 member showed
54
+ // "Security", a role of The Loft).
55
+ case "other-site": {
56
+ const site = typeof item?.roleSiteName === "string" && item.roleSiteName ? item.roleSiteName : "another site";
57
+ return { text: `${name || "Role"} — belongs to ${site}. Assign a role for this site.`, tone: "warn" };
58
+ }
59
+ default:
60
+ return name ? { text: name, tone: "info" } : null;
61
+ }
62
+ }