diff --git a/webroot/css/co-grouper-plugin.css b/webroot/css/co-grouper-plugin.css
index 4736499..9b1cebf 100644
--- a/webroot/css/co-grouper-plugin.css
+++ b/webroot/css/co-grouper-plugin.css
@@ -327,4 +327,12 @@ a.list-group-item-action:hover .fa {
right: 38px;
bottom: 10px;
margin-right: -26px;
+}
+
+.grouper_groups #co-loading span,
+.grouper_groups #co-loading-redirect span,
+.grouper_groups .co-loading-mini span {
+ animation: 1.2s linear infinite both loading;
+ background-color: var(--teal);
+ display: inline-block;
}
\ No newline at end of file
diff --git a/webroot/js/groups-table.js b/webroot/js/groups-table.js
index 49fe26a..89ba9fd 100644
--- a/webroot/js/groups-table.js
+++ b/webroot/js/groups-table.js
@@ -6,7 +6,10 @@ export default {
Table
],
data() {},
- computed: {
+ methods: {
+ groupStatus(status) {
+ return status === 'T' ? 'Enabled' : 'Disabled'
+ }
},
created() {},
template: /*html*/`
@@ -25,9 +28,10 @@ export default {
— |
{{ group.description || txt.descrZeroState }} |
- {{ group.enabled && group.enabled === 'T' ? 'Enabled' : 'Disabled' }} |
+ {{ groupStatus(group?.enabled) }} |
+
+
-
+
+
+
+
{{ txt.grouper }}
link
diff --git a/webroot/js/page/UserManager.js b/webroot/js/page/UserManager.js
index 7d9cd80..256f868 100644
--- a/webroot/js/page/UserManager.js
+++ b/webroot/js/page/UserManager.js
@@ -17,17 +17,51 @@ export default {
data() {
return {
loading: false,
- result: [],
+ results: [],
+ user: {},
+ rowLoading: false,
+ searched: false
}
},
inject: ['api', 'txt'],
methods: {
- dummy() {
- console.log('hi from dummy')
+ reset() {
+ this.searched = false
+ // If you are in the middle of a row action we do not want to clear
+ // the results because we are breaking the user experience
+ if(!this.rowLoading) {
+ this.results = []
+ }
+ },
+ async removeUser(group) {
+ const {name, displayExtension} = group;
+ const { identifier: id, label: username, email } = this.user;
+ // This will trigger the inline loader
+ group.loading = true;
+ this.rowLoading = true;
+ const resp = await fetch(`${this.api.remove}?group=${(name)}&userId=${id}`, {
+ method: "DELETE",
+ headers: {
+ "Accept": "application/json"
+ }
+ });
+ if (resp.ok) {
+ this.subscribers = [];
+ await this.findGroupsForManagedUser(this.user);
+ generateFlash(`${username ?? email} ${this.txt.removeSubscriberSuccess} ${(displayExtension)}`, 'success');
+ } else {
+ this.disabled = [ ...this.disabled, id ];
+ generateFlash(this.txt.removeSubscriberError, 'error');
+ let errorResponse = await resp.json();
+ generateFlash(`${errorResponse.message}`, 'error');
+ }
},
- async findManagedUsers(user) {
- const { identifier: id, label } = user;
- this.loading = true;
+ async findGroupsForManagedUser(user) {
+ this.user = user
+ // Reset
+ this.reset()
+ const { identifier: id } = user;
+ this.loading = !this.rowLoading && true;
const resp = await fetch(`${this.api.managing}?memberid=${id}`, {
headers: {
"Accept": "application/json",
@@ -35,31 +69,35 @@ export default {
method: "GET"
});
if (resp.ok) {
- this.result = await resp.json();
- console.log('result', this.result)
- generateFlash(`${id} has ${this.result.length} ${this.txt.memberships}`, 'success');
+ this.results = await resp.json();
+ generateFlash(`${id} has ${this.results.length} ${this.txt.memberships}`, 'success');
} else {
let errorResponse = await resp.json();
generateFlash(`${errorResponse.message}`, 'error');
}
+ this.searched = true;
this.loading = false;
}
},
template: /*html*/`
- findManagedUsers(item)"
+ findGroupsForManagedUser(item)"
icon="search"
- action="findManagedUsers"
+ action="findGroupsForManagedUser"
:activeBtn="loading"
/>
-
+
+ @remove-user="removeUser">
+
`
diff --git a/webroot/js/pagecount.js b/webroot/js/pagecount.js
index 1b41421..5f9c83e 100644
--- a/webroot/js/pagecount.js
+++ b/webroot/js/pagecount.js
@@ -11,12 +11,16 @@ export default {
total: {
type: Number,
default: 100
+ },
+ searched: {
+ type: Boolean,
+ default: true
}
},
inject: ['txt'],
template: /*html*/`
- |