Skip to content

Conversation

@PhilBastian
Copy link
Contributor

@PhilBastian PhilBastian commented Oct 22, 2025

part of #1905

message: response.ok ? "success" : `error:${responseStatusText(response)}`,
};
} catch (err) {
console.log(err);
Copy link
Member

Choose a reason for hiding this comment

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

Should this beconsole.log?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it was log where this function existed before... are you suggesting it should be .error? It still shows as an error in the console due to logging an exception

Copy link
Member

Choose a reason for hiding this comment

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

it would be more correct, also we do that in other places

const [, data] = await serviceControlStore.fetchTypedFromServiceControl<EmailNotifications>("notifications/email");
result = data;
} catch (err) {
console.log(err);
Copy link
Member

Choose a reason for hiding this comment

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

Should this beconsole.log?

async function saveDeletedRedirect() {
const result = handleResponse(await deleteFromServiceControl(`redirects/${selectedRedirect.value.message_redirect_id}`));
const result = handleResponse(await serviceControlStore.deleteFromServiceControl(`redirects/${selectedRedirect.value.message_redirect_id}`));
Copy link
Member

Choose a reason for hiding this comment

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

we have a redirectsStore, I think the "delete" should be part of it

showEdit.value = false;
const result = handleResponse(
await postToServiceControl("redirects", {
await serviceControlStore.postToServiceControl("redirects", {
Copy link
Member

Choose a reason for hiding this comment

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

we have a redirectsStore, I think the "post" should be part of it

async function loadEndpoints() {
const [, data] = await useTypedFetchFromServiceControl<QueueAddress[]>("errors/queues/addresses");
const [, data] = await serviceControlStore.fetchTypedFromServiceControl<QueueAddress[]>("errors/queues/addresses");
Copy link
Member

Choose a reason for hiding this comment

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

should this method calls be part of the errorsStore?

return {
configuration,
loadConfig,
refresh,
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to expose refresh given that we have the watch and serviceControlUrl is the only state that would trigger a change?

async function removeEndpoint(endpointName: string, instance: ExtendedEndpointInstance) {
try {
await useDeleteFromMonitoring("monitored-instance/" + endpointName + "/" + instance.id);
await serviceControlStore.deleteFromMonitoring("monitored-instance/" + endpointName + "/" + instance.id);
Copy link
Member

Choose a reason for hiding this comment

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

this should be moved to the monitoringStore

async function getIsRemovingEndpointEnabled() {
try {
const response = await useOptionsFromMonitoring();
const response = await serviceControlStore.optionsFromMonitoring();
Copy link
Member

Choose a reason for hiding this comment

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

this should be moved to the monitoringStore


setActivePinia(createTestingPinia({ stubActions: false }));
const serviceControlStore = useServiceControlStore();
serviceControlStore.refresh();
Copy link
Member

Choose a reason for hiding this comment

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

This is just an observation.
There is a bit of repetition in tests always setting this up, we may need to come up with a "base" to do all this eventually.

setActivePinia(createTestingPinia({ stubActions: false }));
const serviceControlStore = useServiceControlStore();
serviceControlStore.refresh();


// eslint-disable-next-line promise/catch-or-return,promise/prefer-await-to-then,promise/valid-params
Promise.all([editRetryStore.loadConfig(), configStore.loadConfig()]).then();
Promise.all([editRetryStore.loadConfig(), configStore.refresh()]).then();
Copy link
Member

Choose a reason for hiding this comment

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

with the refactor done in configStore, I am unsure we need to call the refresh here?


// eslint-disable-next-line promise/catch-or-return,promise/prefer-await-to-then,promise/valid-params
Promise.all([editRetryStore.loadConfig(), configStore.loadConfig()]).then();
Promise.all([editRetryStore.loadConfig(), configStore.refresh()]).then();
Copy link
Member

Choose a reason for hiding this comment

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

it seems that editRetryStore is only used by this store, which begs the question whether we need a sub store at all?

emailToggleSuccessful.value = true;
} else {
emailToggleSuccessful.value = false;
console.log(result.message);
Copy link
Member

Choose a reason for hiding this comment

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

is this for debugging?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not really; it just seemed strange to me that there's code to craft these meaningful failure messages and those messages are never used

Copy link
Member

Choose a reason for hiding this comment

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

maybe raise a bug/improvement about it?

{ immediate: true }
);
const endpointColor = hexToCSSFilter("#929E9E").filter;
const endpointColor = hexToCSSFilter("#777F7F").filter;
Copy link
Member

Choose a reason for hiding this comment

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

why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

at some stage this colour got out of sync with the other icons

Copy link
Member

Choose a reason for hiding this comment

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

is it possible to address that? using a variable maybe?

Copy link
Member

Choose a reason for hiding this comment

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

I have just done a full search on the code base, and there are usages of hexToCSSFilter("#929E9E"), so why are you saying this code got out of sync?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i'll check and fix the remaining filter references. We can't use CSS variables here, since it's done in code rather than styles, so if other styles change then the author needs to remember to change the relevant filters.
It is possible to achieve what we're doing here with styles, but at the moment Safari doesn't render it correctly

// if Audit connection test fails, we will return true.
// the connection test will return true if there are no Audit instances configured.
if (!testResults.value?.audit_connection_result.connection_successful) {
//TODO: should this be a warning rather than an error?
Copy link
Member

Choose a reason for hiding this comment

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

we have no concept of warning in this scenario

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we can create one though... we have the warning triangle used elsewhere in the app

Copy link
Member

Choose a reason for hiding this comment

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

we can raise an issue about it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants