Added description to achievements #268_achievements

This commit is contained in:
2023-07-16 13:30:57 +02:00
parent 4d4320dbcd
commit fedf2f4b8b
17 changed files with 123 additions and 20 deletions

View File

@@ -9,6 +9,7 @@ export interface AchievementAttribute {
export interface Achievement extends DataWithHistory {
id?: number;
name?: string;
description?: string;
attribute?: string | AchievementAttribute;
operator?: string;
value?: string;
@@ -20,6 +21,7 @@ export interface Achievement extends DataWithHistory {
export interface AchievementFilter {
id?: number;
name?: string;
description?: string;
attribute?: string;
operator?: string;
value?: string;

View File

@@ -123,11 +123,12 @@ export class Mutations {
`;
static createAchievement = `
mutation createAchievement($name: String, $attribute: String, $operator: String, $value: String, $serverId: ID) {
mutation createAchievement($name: String, $description: String, $attribute: String, $operator: String, $value: String, $serverId: ID) {
achievement {
createAchievement(input: { name: $name, attribute: $attribute, operator: $operator, value: $value, serverId: $serverId}) {
createAchievement(input: { name: $name, description: $description, attribute: $attribute, operator: $operator, value: $value, serverId: $serverId}) {
id
name
description
attribute
operator
value
@@ -140,11 +141,12 @@ export class Mutations {
`;
static updateAchievement = `
mutation updateAchievement($id: ID, $name: String, $attribute: String, $operator: String, $value: String) {
mutation updateAchievement($id: ID, $name: String, $description: String, $attribute: String, $operator: String, $value: String) {
achievement {
updateAchievement(input: { id: $id, name: $name, attribute: $attribute, operator: $operator, value: $value}) {
updateAchievement(input: { id: $id, name: $name, description: $description, attribute: $attribute, operator: $operator, value: $value}) {
id
name
description
attribute
operator
value

View File

@@ -117,6 +117,7 @@ export class Queries {
achievements(filter: $filter, page: $page, sort: $sort) {
id
name
description
attribute
operator
value
@@ -141,6 +142,7 @@ export class Queries {
history {
id
name
description
attribute
operator
value

View File

@@ -43,6 +43,13 @@
</div>
</th>
<th pSortableColumn="description">
<div class="table-header-label">
<div class="table-header-text">{{'view.server.achievements.headers.description' | translate}}</div>
<p-sortIcon field="name" class="table-header-icon"></p-sortIcon>
</div>
</th>
<th pSortableColumn="attribute">
<div class="table-header-label">
<div class="table-header-text">{{'view.server.achievements.headers.attribute' | translate}}</div>
@@ -96,6 +103,12 @@
placeholder="{{'view.server.achievements.headers.name' | translate}}">
</form>
</th>
<th>
<form [formGroup]="filterForm">
<input type="text" pInputText formControlName="name"
placeholder="{{'view.server.achievements.headers.description' | translate}}">
</form>
</th>
<th></th>
<th></th>
<th></th>
@@ -129,6 +142,17 @@
</p-cellEditor>
</td>
<td>
<p-cellEditor>
<ng-template pTemplate="input">
<input class="table-edit-input" pInputText type="text" [(ngModel)]="achievement.description">
</ng-template>
<ng-template pTemplate="output">
{{achievement.description}}
</ng-template>
</p-cellEditor>
</td>
<td>
<p-cellEditor>
<ng-template pTemplate="input">

View File

@@ -227,6 +227,7 @@ export class AchievementComponent implements OnInit, OnDestroy {
this.spinner.showSpinner();
this.data.mutation<AchievementMutationResult>(Mutations.createAchievement, {
name: newAchievement.name,
description: newAchievement.description,
attribute: newAchievement.attribute,
operator: newAchievement.operator,
value: newAchievement.value + "",
@@ -250,6 +251,7 @@ export class AchievementComponent implements OnInit, OnDestroy {
this.data.mutation<AchievementMutationResult>(Mutations.updateAchievement, {
id: newAchievement.id,
name: newAchievement.name,
description: newAchievement.description,
attribute: newAchievement.attribute,
operator: newAchievement.operator,
value: newAchievement.value + ""

View File

@@ -326,6 +326,7 @@
"headers": {
"attribute": "Attribut",
"name": "Name",
"description": "Beschreibung",
"operator": "Operator",
"value": "Wert"
},