Skip to content
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
1 change: 1 addition & 0 deletions src/ServicePulse.Host/vue/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ module.exports = {
eqeqeq: ["error", "smart"],
"unused-imports/no-unused-imports": "error",
"import/no-duplicates": "error",
"no-throw-literal": "error",
},
};
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script setup lang="ts">
import { computed } from "vue";
import { license, licenseStatus } from "../../composables/serviceLicense";
import { license, licenseStatus } from "@/composables/serviceLicense";
import ServiceControlNotAvailable from "../ServiceControlNotAvailable.vue";
import { connectionState } from "../../composables/serviceServiceControl";
import { connectionState } from "@/composables/serviceServiceControl";
import BusyIndicator from "../BusyIndicator.vue";
import ExclamationMark from "./../../components/ExclamationMark.vue";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ async function saveEditedRedirect(redirect) {
getRedirect();
} else {
redirectSaveSuccessful.value = false;
if (result.status === "409" || result.status === 409) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this is TypeScript telling us this can only be a number

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes I typed the status to be a number

if (result.status === 409) {
useShowToast("error", "Error", "Failed to update a redirect, can not create redirect to a queue" + redirect.targetQueue + " as it already has a redirect. Provide a different queue or end the redirect.");
} else {
useShowToast("error", "Error", result.message);
Expand All @@ -94,9 +94,9 @@ async function saveCreatedRedirect(redirect) {
getRedirect();
} else {
redirectSaveSuccessful.value = false;
if ((result.status === "409" || result.status === 409) && result.statusText === "Duplicate") {
if (result.status === 409 && result.statusText === "Duplicate") {
useShowToast("error", "Error", "Failed to create a redirect, can not create more than one redirect for queue: " + redirect.sourceQueue);
} else if ((result.status === "409" || result.status === 409) && result.statusText === "Dependents") {
} else if (result.status === 409 && result.statusText === "Dependents") {
useShowToast("error", "Error", "Failed to create a redirect, can not create a redirect to a queue that already has a redirect or is a target of a redirect.");
} else {
useShowToast("error", "Error", result.message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ onMounted(async () => {
<button
type="button"
class="btn btn-link btn-sm"
:disabled="group.count == 0 || isBeingRestored(group.workflow_state.status)"
:disabled="group.count === 0 || isBeingRestored(group.workflow_state.status)"
@mouseenter="group.hover3 = true"
@mouseleave="group.hover3 = false"
v-if="archiveGroups.length > 0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function removeHeadersMarkedAsRemoved() {
async function retryEditedMessage() {
removeHeadersMarkedAsRemoved();
try {
await useRetryEditedMessage([id.value], localMessage);
await useRetryEditedMessage(id.value, localMessage);
localMessage.value.retried = true;
return emit("retried", settings);
} catch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ async function saveDeleteNote(group, hideToastMessage) {
if (result.message === "success") {
noteSaveSuccessful.value = true;
if (!hideToastMessage) {
useShowToast("info", "Info", "Note deleted succesfully");
useShowToast("info", "Info", "Note deleted successfully");
}

loadFailedMessageGroups(); //reload the groups
Expand Down Expand Up @@ -244,9 +244,9 @@ const acknowledgeGroup = async function (group) {
const result = await useAcknowledgeArchiveGroup(group.id);
if (result.message === "success") {
if (group.operation_status === "ArchiveCompleted") {
useShowToast("info", "Info", "Group deleted succesfully");
useShowToast("info", "Info", "Group deleted successfully");
} else {
useShowToast("info", "Info", "Group retried succesfully");
useShowToast("info", "Info", "Group retried successfully");
}
loadFailedMessageGroups(); //reload the groups
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,44 +85,21 @@ function updateMessageDeleteDate() {
async function archiveMessage() {
useShowToast("info", "Info", `Deleting the message ${id.value} ...`);
changeRefreshInterval(1000); // We've started an archive, so increase the polling frequency
try {
const response = await useArchiveMessage([id.value]);
if (response !== undefined) {
failedMessage.value.archiving = true;
return;
}
return false;
} catch (err) {
console.log(err);
return false;
}
await useArchiveMessage([id.value]);
failedMessage.value.archiving = true;
}

async function unarchiveMessage() {
changeRefreshInterval(1000); // We've started an unarchive, so increase the polling frequency
try {
const response = await useUnarchiveMessage([id.value]);

if (response !== undefined) {
failedMessage.value.restoring = true;
}
return false;
} catch (err) {
console.log(err);
return false;
}
await useUnarchiveMessage([id.value]);
failedMessage.value.restoring = true;
}

async function retryMessage() {
useShowToast("info", "Info", `Retrying the message ${id.value} ...`);
changeRefreshInterval(1000); // We've started a retry, so increase the polling frequency
try {
await useRetryMessages([id.value]);
failedMessage.value.retried = true;
} catch (err) {
console.log(err);
return false;
}
await useRetryMessages([id.value]);
failedMessage.value.retried = true;
}

async function downloadHeadersAndBody() {
Expand Down
59 changes: 0 additions & 59 deletions src/ServicePulse.Host/vue/src/composables/serviceFailedMessage.js

This file was deleted.

34 changes: 34 additions & 0 deletions src/ServicePulse.Host/vue/src/composables/serviceFailedMessage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { usePatchToServiceControl, usePostToServiceControl } from "./serviceServiceControlUrls";
import type { Ref } from "vue";

export async function useUnarchiveMessage(ids: string[]) {
const response = await usePatchToServiceControl("errors/unarchive/", ids);
if (!response.ok) {
throw response.statusText;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added rule and updated code accordingly

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but you missed this line?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did!

}
}

export async function useArchiveMessage(ids: string[]) {
const response = await usePatchToServiceControl("errors/archive/", ids);
if (!response.ok) {
throw new Error(response.statusText);
}
}

export async function useRetryMessages(ids: string[]) {
await usePostToServiceControl("errors/retry", ids);
}

export async function useRetryEditedMessage(
id: string,
editedMessage: Ref<{
messageBody: string;
headers: unknown[];
}>
) {
const payload = { message_body: editedMessage.value.messageBody, message_headers: editedMessage.value.headers };
const response = await usePostToServiceControl(`edit/${id}`, payload);
if (!response.ok) {
throw new Error(response.statusText);
}
}
150 changes: 0 additions & 150 deletions src/ServicePulse.Host/vue/src/composables/serviceMessageGroup.js

This file was deleted.

Loading