Skip to content
Snippets Groups Projects
Verified Commit 0afff857 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Provide tag information for Celery progress messages via GraphQL

parent 6efe2f65
No related branches found
No related tags found
1 merge request!1098Resolve "Make progress page and search bar use GraphQL"
Pipeline #96479 passed with warnings
......@@ -21,7 +21,7 @@
v-if="data"
v-for="(message, idx) in progress.messages"
dense
:type="STYLE_CLASSES[message.level]"
:type="message.tag"
transition="slide-x-transition"
:key="idx"
>
......@@ -66,21 +66,6 @@
import BackButton from "./BackButton.vue";
import MessageBox from "./MessageBox.vue";
const STYLE_CLASSES = {
10: 'info',
20: 'info',
25: 'success',
30: 'warning',
40: 'error',
};
const ICONS = {
10: 'mdi-information',
20: 'mdi-information',
25: 'mdi-check-circle',
30: 'mdi-alert-outline',
40: 'mdi-alert-octagon-outline',
};
export default {
name: 'CeleryProgress',
components: {BackButton, MessageBox},
......@@ -95,12 +80,6 @@ export default {
pollInterval: 1000,
}
},
data() {
return {
STYLE_CLASSES,
ICONS,
};
},
computed: {
progress() {
return this.celeryProgressByTaskId;
......
......@@ -11,6 +11,7 @@ query($taskId: String!){
messages {
level
message
tag
}
meta {
title
......
from django.conf import settings
from django.contrib.messages.constants import DEFAULT_TAGS
from django.utils import translation
import graphene
......@@ -61,6 +62,7 @@ class SystemPropertiesType(graphene.ObjectType):
class CeleryProgressMessage(ObjectType):
message = graphene.String(required=True)
level = graphene.Int(required=True)
tag = graphene.String(required=True)
def resolve_message(root, info, **kwargs):
return root[1]
......@@ -68,6 +70,9 @@ class CeleryProgressMessage(ObjectType):
def resolve_level(root, info, **kwargs):
return root[0]
def resolve_tag(root, info, **kwargs):
return DEFAULT_TAGS.get(root[0], "info")
class CeleryProgressAdditionalButtonType(ObjectType):
title = graphene.String(required=True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment