mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-06-13 17:40:40 +00:00
Change the Subscription Logic for Socket.IO Data exchange
This commit is contained in:
@ -65,7 +65,7 @@ class CorpusFileList extends RessourceList {
|
||||
<div class="modal">
|
||||
<div class="modal-content">
|
||||
<h4>Confirm corpus deletion</h4>
|
||||
<p>Do you really want to delete the corpus file <b>${app.users[this.userId].corpora[this.corpusId].files[corpusFileId].filename}</b>? It will be permanently deleted!</p>
|
||||
<p>Do you really want to delete the corpus file <b>${app.data.users[this.userId].corpora[this.corpusId].files[corpusFileId].filename}</b>? It will be permanently deleted!</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="#!" class="btn modal-close waves-effect waves-light">Cancel</a>
|
||||
@ -97,6 +97,8 @@ class CorpusFileList extends RessourceList {
|
||||
}
|
||||
|
||||
onPATCH(patch) {
|
||||
if (!this.isInitialized) {return;}
|
||||
|
||||
let corpusFileId;
|
||||
let filteredPatch;
|
||||
let match;
|
||||
|
@ -60,7 +60,7 @@ class CorpusList extends RessourceList {
|
||||
<div class="modal">
|
||||
<div class="modal-content">
|
||||
<h4>Confirm corpus deletion</h4>
|
||||
<p>Do you really want to delete the corpus <b>${app.users[this.userId].corpora[corpusId].title}</b>? All files will be permanently deleted!</p>
|
||||
<p>Do you really want to delete the corpus <b>${app.data.users[this.userId].corpora[corpusId].title}</b>? All files will be permanently deleted!</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="#!" class="btn modal-close waves-effect waves-light">Cancel</a>
|
||||
@ -89,6 +89,8 @@ class CorpusList extends RessourceList {
|
||||
}
|
||||
|
||||
onPATCH(patch) {
|
||||
if (!this.isInitialized) {return;}
|
||||
|
||||
let corpusId;
|
||||
let filteredPatch;
|
||||
let match;
|
||||
|
@ -36,7 +36,6 @@ class JobList extends RessourceList {
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
constructor(listElement, options = {}) {
|
||||
super(listElement, {...JobList.options, ...options});
|
||||
}
|
||||
@ -66,7 +65,7 @@ class JobList extends RessourceList {
|
||||
<div class="modal">
|
||||
<div class="modal-content">
|
||||
<h4>Confirm job deletion</h4>
|
||||
<p>Do you really want to delete the job <b>${app.users[this.userId].jobs[jobId].title}</b>? All files will be permanently deleted!</p>
|
||||
<p>Do you really want to delete the job <b>${app.data.users[this.userId].jobs[jobId].title}</b>? All files will be permanently deleted!</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="#!" class="btn modal-close waves-effect waves-light">Cancel</a>
|
||||
@ -95,6 +94,8 @@ class JobList extends RessourceList {
|
||||
}
|
||||
|
||||
onPATCH(patch) {
|
||||
if (!this.isInitialized) {return;}
|
||||
|
||||
let filteredPatch;
|
||||
let jobId;
|
||||
let match;
|
||||
|
@ -58,6 +58,8 @@ class JobResultList extends RessourceList {
|
||||
}
|
||||
|
||||
onPATCH(patch) {
|
||||
if (!this.isInitialized) {return;}
|
||||
|
||||
let filteredPatch;
|
||||
let operation;
|
||||
let re;
|
||||
|
@ -90,12 +90,15 @@ class RessourceList {
|
||||
this.listjs.list.style.cursor = 'pointer';
|
||||
this.userId = this.listjs.listContainer.dataset.userId;
|
||||
this.listjs.list.addEventListener('click', event => this.onclick(event));
|
||||
this.isInitialized = false;
|
||||
if (this.userId) {
|
||||
app.socket.on('PATCH', (patch) => {this.onPATCH(patch);});
|
||||
app.subscribeUser(this.userId).then(
|
||||
(user) => {this.init(user);},
|
||||
(error) => {throw JSON.stringify(error);}
|
||||
);
|
||||
app.subscribeUser(this.userId).then((response) => {
|
||||
app.socket.on('PATCH', (patch) => {this.onPATCH(patch);});
|
||||
});
|
||||
app.getUser(this.userId).then((user) => {
|
||||
this.init(user);
|
||||
this.isInitialized = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ class UserList extends RessourceList {
|
||||
'id-1': user.id,
|
||||
'username': user.username,
|
||||
'email': user.email,
|
||||
'last-seen': new Date(user.last_seen).toLocaleString("en-US"),
|
||||
'last-seen': new Date(user.last_seen).toLocaleString('en-US'),
|
||||
'member-since': user.member_since,
|
||||
'role': user.role.name
|
||||
};
|
||||
|
Reference in New Issue
Block a user