@adminforth/user-soft-delete 1.2.1 → 1.2.3

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/build.log CHANGED
@@ -8,5 +8,5 @@ custom/DisableButton.vue
8
8
  custom/UserSoftDeleteFilterSetter.vue
9
9
  custom/tsconfig.json
10
10
 
11
- sent 2,942 bytes received 77 bytes 6,038.00 bytes/sec
12
- total size is 2,640 speedup is 0.87
11
+ sent 3,053 bytes received 77 bytes 6,260.00 bytes/sec
12
+ total size is 2,751 speedup is 0.88
@@ -13,14 +13,14 @@
13
13
  <Dialog
14
14
  ref="confirmDialog"
15
15
  class="w-96"
16
- header="Deactivate user"
16
+ :header="t('Deactivate user')"
17
17
  :buttons="[
18
- { label: 'Confirm', onclick: (dialog) => { deactivateUser(); dialog.hide(); } },
19
- { label: 'Cancel', onclick: (dialog) => dialog.hide() },
18
+ { label: t('Confirm'), onclick: (dialog) => { deactivateUser(); dialog.hide(); } },
19
+ { label: t('Cancel'), onclick: (dialog) => dialog.hide() },
20
20
  ]"
21
21
  >
22
22
  <div class="space-y-4">
23
- <p>Are you sure you want to deactivate this user?</p>
23
+ <p>{{ $t('Are you sure you want to deactivate this user?') }}</p>
24
24
  </div>
25
25
  </Dialog>
26
26
  </template>
@@ -32,7 +32,9 @@ import { AdminUser, type AdminForthResourceCommon } from '@/types';
32
32
  import adminforth from "@/adminforth"
33
33
  import { callAdminForthApi } from '@/utils';
34
34
  import { IconUserRemoveSolid } from '@iconify-prerendered/vue-flowbite';
35
+ import { useI18n } from 'vue-i18n';
35
36
 
37
+ const { t } = useI18n();
36
38
  const confirmDialog = ref(null);
37
39
 
38
40
  function openDialog() {
@@ -56,7 +58,7 @@ async function deactivateUser() {
56
58
  }
57
59
  props.updateRecords();
58
60
  } catch (e) {
59
- adminforth.alert({message: `Error deactivating user. ${e}`, variant: "warning"});
61
+ adminforth.alert({message: t(`Error deactivating user. ${e}`), variant: "warning"});
60
62
  }
61
63
  }
62
64
 
@@ -6,9 +6,12 @@
6
6
  import { onMounted } from 'vue';
7
7
  import { AdminForthFilterOperators } from '@/types/Common';
8
8
  import adminforth from "@/adminforth"
9
+ import { useFiltersStore } from '@/stores/filters';
10
+
11
+ const filtersStore = useFiltersStore();
12
+
9
13
  onMounted(async () => {
10
- await new Promise((resolve) => setTimeout(resolve, 50));
11
- adminforth?.list?.updateFilter?.({
14
+ filtersStore.setFilter({
12
15
  field: props.meta.field,
13
16
  operator: AdminForthFilterOperators.EQ,
14
17
  value: true,
@@ -13,14 +13,14 @@
13
13
  <Dialog
14
14
  ref="confirmDialog"
15
15
  class="w-96"
16
- header="Deactivate user"
16
+ :header="t('Deactivate user')"
17
17
  :buttons="[
18
- { label: 'Confirm', onclick: (dialog) => { deactivateUser(); dialog.hide(); } },
19
- { label: 'Cancel', onclick: (dialog) => dialog.hide() },
18
+ { label: t('Confirm'), onclick: (dialog) => { deactivateUser(); dialog.hide(); } },
19
+ { label: t('Cancel'), onclick: (dialog) => dialog.hide() },
20
20
  ]"
21
21
  >
22
22
  <div class="space-y-4">
23
- <p>Are you sure you want to deactivate this user?</p>
23
+ <p>{{ $t('Are you sure you want to deactivate this user?') }}</p>
24
24
  </div>
25
25
  </Dialog>
26
26
  </template>
@@ -32,7 +32,9 @@ import { AdminUser, type AdminForthResourceCommon } from '@/types';
32
32
  import adminforth from "@/adminforth"
33
33
  import { callAdminForthApi } from '@/utils';
34
34
  import { IconUserRemoveSolid } from '@iconify-prerendered/vue-flowbite';
35
+ import { useI18n } from 'vue-i18n';
35
36
 
37
+ const { t } = useI18n();
36
38
  const confirmDialog = ref(null);
37
39
 
38
40
  function openDialog() {
@@ -56,7 +58,7 @@ async function deactivateUser() {
56
58
  }
57
59
  props.updateRecords();
58
60
  } catch (e) {
59
- adminforth.alert({message: `Error deactivating user. ${e}`, variant: "warning"});
61
+ adminforth.alert({message: t(`Error deactivating user. ${e}`), variant: "warning"});
60
62
  }
61
63
  }
62
64
 
@@ -6,9 +6,12 @@
6
6
  import { onMounted } from 'vue';
7
7
  import { AdminForthFilterOperators } from '@/types/Common';
8
8
  import adminforth from "@/adminforth"
9
+ import { useFiltersStore } from '@/stores/filters';
10
+
11
+ const filtersStore = useFiltersStore();
12
+
9
13
  onMounted(async () => {
10
- await new Promise((resolve) => setTimeout(resolve, 50));
11
- adminforth?.list?.updateFilter?.({
14
+ filtersStore.setFilter({
12
15
  field: props.meta.field,
13
16
  operator: AdminForthFilterOperators.EQ,
14
17
  value: true,
package/dist/index.js CHANGED
@@ -121,7 +121,7 @@ export default class UserSoftDelete extends AdminForthPlugin {
121
121
  if (oldUser[primaryKeyColumn.name] === adminUser.dbUser[primaryKeyColumn.name]) {
122
122
  return { ok: false, error: "You cannot deactivate your own account" };
123
123
  }
124
- const newUser = Object.assign(Object.assign({}, oldUser), { [this.options.activeFieldName]: false });
124
+ const newUser = { [this.options.activeFieldName]: false };
125
125
  yield this.adminforth.updateResourceRecord({
126
126
  resource: this.resourceConfig,
127
127
  recordId: id,
package/index.ts CHANGED
@@ -134,8 +134,8 @@ export default class UserSoftDelete extends AdminForthPlugin {
134
134
  return {ok: false, error: "You cannot deactivate your own account"}
135
135
  }
136
136
 
137
- const newUser = { ...oldUser, [this.options.activeFieldName]: false };
138
-
137
+ const newUser = { [this.options.activeFieldName]: false };
138
+
139
139
  await this.adminforth.updateResourceRecord({
140
140
  resource: this.resourceConfig,
141
141
  recordId: id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/user-soft-delete",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -21,7 +21,7 @@
21
21
  "typescript": "^5.7.3"
22
22
  },
23
23
  "dependencies": {
24
- "adminforth": "^2.4.0-next.227"
24
+ "adminforth": "^2.4.0-next.254"
25
25
  },
26
26
  "release": {
27
27
  "plugins": [