@adminforth/user-soft-delete 1.2.3 → 1.2.5
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 +2 -2
- package/custom/DisableButton.vue +13 -24
- package/custom/tsconfig.json +17 -3
- package/dist/custom/DisableButton.vue +13 -24
- package/dist/custom/tsconfig.json +17 -3
- package/dist/index.js +1 -7
- package/index.ts +1 -8
- package/package.json +1 -1
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 3,
|
|
12
|
-
total size is 2,
|
|
11
|
+
sent 3,085 bytes received 77 bytes 6,324.00 bytes/sec
|
|
12
|
+
total size is 2,783 speedup is 0.88
|
package/custom/DisableButton.vue
CHANGED
|
@@ -1,44 +1,33 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Tooltip>
|
|
3
|
-
<button
|
|
4
|
-
@click="openDialog()"
|
|
5
|
-
>
|
|
3
|
+
<button @click="onClick">
|
|
6
4
|
<IconUserRemoveSolid class="w-5 h-5 me-2"/>
|
|
7
5
|
</button>
|
|
8
|
-
|
|
9
|
-
<template v-slot:tooltip>
|
|
6
|
+
<template #tooltip>
|
|
10
7
|
{{ $t('Deactivate user') }}
|
|
11
8
|
</template>
|
|
12
9
|
</Tooltip>
|
|
13
|
-
<Dialog
|
|
14
|
-
ref="confirmDialog"
|
|
15
|
-
class="w-96"
|
|
16
|
-
:header="t('Deactivate user')"
|
|
17
|
-
:buttons="[
|
|
18
|
-
{ label: t('Confirm'), onclick: (dialog) => { deactivateUser(); dialog.hide(); } },
|
|
19
|
-
{ label: t('Cancel'), onclick: (dialog) => dialog.hide() },
|
|
20
|
-
]"
|
|
21
|
-
>
|
|
22
|
-
<div class="space-y-4">
|
|
23
|
-
<p>{{ $t('Are you sure you want to deactivate this user?') }}</p>
|
|
24
|
-
</div>
|
|
25
|
-
</Dialog>
|
|
26
10
|
</template>
|
|
27
11
|
|
|
28
12
|
<script lang="ts" setup>
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import { AdminUser, type AdminForthResourceCommon } from '@/types';
|
|
13
|
+
import { Tooltip } from '@/afcl';
|
|
14
|
+
import { type AdminUser, type AdminForthResourceCommon } from '@/types/Common';
|
|
32
15
|
import adminforth from "@/adminforth"
|
|
33
16
|
import { callAdminForthApi } from '@/utils';
|
|
34
17
|
import { IconUserRemoveSolid } from '@iconify-prerendered/vue-flowbite';
|
|
35
18
|
import { useI18n } from 'vue-i18n';
|
|
36
19
|
|
|
37
20
|
const { t } = useI18n();
|
|
38
|
-
const confirmDialog = ref(null);
|
|
39
21
|
|
|
40
|
-
function
|
|
41
|
-
|
|
22
|
+
async function onClick() {
|
|
23
|
+
const confirmed = await adminforth.confirm({
|
|
24
|
+
message: t('Are you sure you want to deactivate this user?'),
|
|
25
|
+
yes: t('Confirm'),
|
|
26
|
+
no: t('Cancel'),
|
|
27
|
+
});
|
|
28
|
+
if (confirmed) {
|
|
29
|
+
await deactivateUser();
|
|
30
|
+
}
|
|
42
31
|
}
|
|
43
32
|
|
|
44
33
|
async function deactivateUser() {
|
package/custom/tsconfig.json
CHANGED
|
@@ -3,14 +3,28 @@
|
|
|
3
3
|
"baseUrl": ".", // This should point to your project root
|
|
4
4
|
"paths": {
|
|
5
5
|
"@/*": [
|
|
6
|
-
"
|
|
6
|
+
// "node_modules/adminforth/dist/spa/src/*"
|
|
7
|
+
"../../../adminforth/spa/src/*"
|
|
7
8
|
],
|
|
8
9
|
"*": [
|
|
9
|
-
"
|
|
10
|
+
// "node_modules/adminforth/dist/spa/node_modules/*"
|
|
11
|
+
"../../../adminforth/spa/node_modules/*"
|
|
10
12
|
],
|
|
11
13
|
"@@/*": [
|
|
14
|
+
// "node_modules/adminforth/dist/spa/src/*"
|
|
12
15
|
"."
|
|
13
16
|
]
|
|
14
17
|
}
|
|
15
|
-
}
|
|
18
|
+
},
|
|
19
|
+
"include": [
|
|
20
|
+
"./**/*.ts",
|
|
21
|
+
"./**/*.tsx",
|
|
22
|
+
"./**/*.vue",
|
|
23
|
+
"../**/*.ts",
|
|
24
|
+
"../**/*.tsx",
|
|
25
|
+
"../**/*.vue",
|
|
26
|
+
"../*.vue",
|
|
27
|
+
"../*.ts",
|
|
28
|
+
"../*.tsx"
|
|
29
|
+
]
|
|
16
30
|
}
|
|
@@ -1,44 +1,33 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Tooltip>
|
|
3
|
-
<button
|
|
4
|
-
@click="openDialog()"
|
|
5
|
-
>
|
|
3
|
+
<button @click="onClick">
|
|
6
4
|
<IconUserRemoveSolid class="w-5 h-5 me-2"/>
|
|
7
5
|
</button>
|
|
8
|
-
|
|
9
|
-
<template v-slot:tooltip>
|
|
6
|
+
<template #tooltip>
|
|
10
7
|
{{ $t('Deactivate user') }}
|
|
11
8
|
</template>
|
|
12
9
|
</Tooltip>
|
|
13
|
-
<Dialog
|
|
14
|
-
ref="confirmDialog"
|
|
15
|
-
class="w-96"
|
|
16
|
-
:header="t('Deactivate user')"
|
|
17
|
-
:buttons="[
|
|
18
|
-
{ label: t('Confirm'), onclick: (dialog) => { deactivateUser(); dialog.hide(); } },
|
|
19
|
-
{ label: t('Cancel'), onclick: (dialog) => dialog.hide() },
|
|
20
|
-
]"
|
|
21
|
-
>
|
|
22
|
-
<div class="space-y-4">
|
|
23
|
-
<p>{{ $t('Are you sure you want to deactivate this user?') }}</p>
|
|
24
|
-
</div>
|
|
25
|
-
</Dialog>
|
|
26
10
|
</template>
|
|
27
11
|
|
|
28
12
|
<script lang="ts" setup>
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import { AdminUser, type AdminForthResourceCommon } from '@/types';
|
|
13
|
+
import { Tooltip } from '@/afcl';
|
|
14
|
+
import { type AdminUser, type AdminForthResourceCommon } from '@/types/Common';
|
|
32
15
|
import adminforth from "@/adminforth"
|
|
33
16
|
import { callAdminForthApi } from '@/utils';
|
|
34
17
|
import { IconUserRemoveSolid } from '@iconify-prerendered/vue-flowbite';
|
|
35
18
|
import { useI18n } from 'vue-i18n';
|
|
36
19
|
|
|
37
20
|
const { t } = useI18n();
|
|
38
|
-
const confirmDialog = ref(null);
|
|
39
21
|
|
|
40
|
-
function
|
|
41
|
-
|
|
22
|
+
async function onClick() {
|
|
23
|
+
const confirmed = await adminforth.confirm({
|
|
24
|
+
message: t('Are you sure you want to deactivate this user?'),
|
|
25
|
+
yes: t('Confirm'),
|
|
26
|
+
no: t('Cancel'),
|
|
27
|
+
});
|
|
28
|
+
if (confirmed) {
|
|
29
|
+
await deactivateUser();
|
|
30
|
+
}
|
|
42
31
|
}
|
|
43
32
|
|
|
44
33
|
async function deactivateUser() {
|
|
@@ -3,14 +3,28 @@
|
|
|
3
3
|
"baseUrl": ".", // This should point to your project root
|
|
4
4
|
"paths": {
|
|
5
5
|
"@/*": [
|
|
6
|
-
"
|
|
6
|
+
// "node_modules/adminforth/dist/spa/src/*"
|
|
7
|
+
"../../../adminforth/spa/src/*"
|
|
7
8
|
],
|
|
8
9
|
"*": [
|
|
9
|
-
"
|
|
10
|
+
// "node_modules/adminforth/dist/spa/node_modules/*"
|
|
11
|
+
"../../../adminforth/spa/node_modules/*"
|
|
10
12
|
],
|
|
11
13
|
"@@/*": [
|
|
14
|
+
// "node_modules/adminforth/dist/spa/src/*"
|
|
12
15
|
"."
|
|
13
16
|
]
|
|
14
17
|
}
|
|
15
|
-
}
|
|
18
|
+
},
|
|
19
|
+
"include": [
|
|
20
|
+
"./**/*.ts",
|
|
21
|
+
"./**/*.tsx",
|
|
22
|
+
"./**/*.vue",
|
|
23
|
+
"../**/*.ts",
|
|
24
|
+
"../**/*.tsx",
|
|
25
|
+
"../**/*.vue",
|
|
26
|
+
"../*.vue",
|
|
27
|
+
"../*.ts",
|
|
28
|
+
"../*.tsx"
|
|
29
|
+
]
|
|
16
30
|
}
|
package/dist/index.js
CHANGED
|
@@ -122,13 +122,7 @@ export default class UserSoftDelete extends AdminForthPlugin {
|
|
|
122
122
|
return { ok: false, error: "You cannot deactivate your own account" };
|
|
123
123
|
}
|
|
124
124
|
const newUser = { [this.options.activeFieldName]: false };
|
|
125
|
-
yield this.adminforth.
|
|
126
|
-
resource: this.resourceConfig,
|
|
127
|
-
recordId: id,
|
|
128
|
-
oldRecord: oldUser,
|
|
129
|
-
record: newUser,
|
|
130
|
-
adminUser: adminUser
|
|
131
|
-
});
|
|
125
|
+
yield this.adminforth.resource(this.resourceConfig.resourceId).update(id, newUser);
|
|
132
126
|
return { ok: true };
|
|
133
127
|
})
|
|
134
128
|
});
|
package/index.ts
CHANGED
|
@@ -135,14 +135,7 @@ export default class UserSoftDelete extends AdminForthPlugin {
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
const newUser = { [this.options.activeFieldName]: false };
|
|
138
|
-
|
|
139
|
-
await this.adminforth.updateResourceRecord({
|
|
140
|
-
resource: this.resourceConfig,
|
|
141
|
-
recordId: id,
|
|
142
|
-
oldRecord: oldUser,
|
|
143
|
-
record: newUser,
|
|
144
|
-
adminUser: adminUser
|
|
145
|
-
})
|
|
138
|
+
await this.adminforth.resource(this.resourceConfig.resourceId).update(id, newUser);
|
|
146
139
|
return {ok: true}
|
|
147
140
|
}
|
|
148
141
|
});
|