@xh/hoist 60.1.0 → 60.1.1

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 60.1.1 - 2024-01-29
4
+
5
+ ### ⚙️ Technical
6
+ * Improve unique constraint validation of Roles and Role Members in Admin UI.
7
+ * Minor UI tweaks to admin UI
8
+
3
9
  ## 60.1.0 - 2024-01-18
4
10
 
5
11
  ### 🐞 Bug Fixes
@@ -137,7 +137,7 @@ export class RoleFormModel extends HoistModel {
137
137
  rules: [
138
138
  required,
139
139
  ({value}) =>
140
- this.invalidNames.includes(value)
140
+ this.invalidNames.some(it => it.toLowerCase() === value?.toLowerCase())
141
141
  ? `Role "${value}" already exists.`
142
142
  : null
143
143
  ]
@@ -159,7 +159,20 @@ export class RoleFormModel extends HoistModel {
159
159
  },
160
160
  columns: [
161
161
  {
162
- field: {name: 'name', rules: [required]},
162
+ field: {
163
+ name: 'name',
164
+ rules: [
165
+ required,
166
+ ({value, record}) =>
167
+ record.store.allRecords.some(
168
+ it =>
169
+ it !== record &&
170
+ it.get('name')?.toLowerCase() === value?.toLowerCase()
171
+ )
172
+ ? `${value} already added.`
173
+ : null
174
+ ]
175
+ },
163
176
  flex: 1,
164
177
  editable: true,
165
178
  editor: props => {
@@ -15,7 +15,8 @@ export class RoleGraphModel extends HoistModel {
15
15
  get relatedRoles(): EffectiveRoleMember[] {
16
16
  const {role, relationship} = this;
17
17
  if (!role) return [];
18
- return relationship === 'effective' ? role.effectiveRoles : role.inheritedRoles;
18
+ const ret = relationship === 'effective' ? role.effectiveRoles : role.inheritedRoles;
19
+ return ret.filter(it => it.name !== role.name);
19
20
  }
20
21
 
21
22
  get role(): HoistRole {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "60.1.0",
3
+ "version": "60.1.1",
4
4
  "description": "Hoist add-on for building and deploying React Applications.",
5
5
  "repository": "github:xh/hoist-react",
6
6
  "homepage": "https://xh.io",