Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#3734 - Better visual representation of suggestions in the annotation sidebar #3735

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Licensed to the Technische Universität Darmstadt under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The Technische Universität Darmstadt
* licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.tudarmstadt.ukp.clarin.webanno.api.event;

import de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument;

public interface TransientAnnotationStateChangedEvent
{
SourceDocument getDocument();

String getUser();
}
19 changes: 19 additions & 0 deletions inception/inception-diam-editor/src/main/ts/src/LabelBadge.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,27 @@
function handleClick (ev: MouseEvent) {
ajaxClient.selectAnnotation(annotation.vid, { scrollTo: true });
}

function handleAccept (ev: MouseEvent) {
ajaxClient.selectAnnotation(annotation.vid, { scrollTo: true });
}

function handleReject (ev: MouseEvent) {
ajaxClient.triggerExtensionAction(annotation.vid);
}
</script>

<!-- svelte-ignore a11y-click-events-have-key-events -->
{#if annotation.vid.toString().startsWith('rec:')}
<div class="btn-group" role="group" aria-label="Basic example">
<button type="button" class="btn btn-success py-0 px-1" on:click={handleAccept} title="Accept">
<i class="far fa-check-circle"></i>
</button>
<button type="button" class="btn btn-danger py-0 px-1" on:click={handleReject} title="Reject">
<i class="far fa-times-circle"></i>
</button>
</div>
{:else}
<span
class="badge border border-dark ms-1 fw-normal"
on:click={handleClick}
Expand All @@ -41,6 +59,7 @@
>
{showText ? annotation.label || "No label" : "\u00A0"}
</span>
{/if}

<style>
.badge {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import de.tudarmstadt.ukp.clarin.webanno.api.annotation.preferences.UserPreferencesService;
import de.tudarmstadt.ukp.clarin.webanno.api.config.RepositoryProperties;
import de.tudarmstadt.ukp.clarin.webanno.api.event.AfterCasWrittenEvent;
import de.tudarmstadt.ukp.clarin.webanno.api.event.TransientAnnotationStateChangedEvent;
import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationDocument;
import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer;
import de.tudarmstadt.ukp.clarin.webanno.model.Mode;
Expand Down Expand Up @@ -199,6 +200,13 @@ public void afterAnnotationUpdate(AfterCasWrittenEvent aEvent)
sendUpdate(aEvent.getDocument());
}

@EventListener
public void onRecommendationRejected(TransientAnnotationStateChangedEvent aEvent)
{
var doc = aEvent.getDocument();
sendUpdate(doc.getProject().getId(), doc.getId(), aEvent.getUser(), 0, MAX_VALUE);
}

@SubscribeMapping(DOCUMENT_VIEWPORT_TOPIC_TEMPLATE)
public JsonNode onSubscribeToAnnotationDocument(SimpMessageHeaderAccessor aHeaderAccessor,
Principal aPrincipal, //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@

import org.springframework.context.ApplicationEvent;

import de.tudarmstadt.ukp.clarin.webanno.api.event.TransientAnnotationStateChangedEvent;
import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature;
import de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument;

public class RecommendationRejectedEvent
extends ApplicationEvent
implements TransientAnnotationStateChangedEvent
{
private static final long serialVersionUID = 4618078923202025558L;

Expand All @@ -50,11 +52,13 @@ public RecommendationRejectedEvent(Object aSource, SourceDocument aDocument, Str
recommendedValue = aRecommendedValue;
}

@Override
public SourceDocument getDocument()
{
return document;
}

@Override
public String getUser()
{
return user;
Expand Down