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

Migrated last Components and Configuration area #1708

Merged
merged 15 commits into from
Mar 5, 2024
Merged

Conversation

johnsimons
Copy link
Member

@johnsimons johnsimons commented Feb 9, 2024

This PR pretty much migrates all remaining areas with the exception of "Failed Messages" area.

As part of this PR, I also removed the calls to initialise certain services from App.vue, which means we rely on modules to execute them.
Reverted ☝️

@johnsimons johnsimons self-assigned this Feb 9, 2024

function confirm() {
emit("confirm", settings);
emit("confirm");
Copy link
Member Author

Choose a reason for hiding this comment

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

the settings were not used, so I removed them


const baseUrl = window.defaultConfig.base_url;

function subIsActive(input, exact) {
const paths = Array.isArray(input) ? input : [input];
Copy link
Member Author

Choose a reason for hiding this comment

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

nothing was passing an array, so removed that code

// The event is only actually emitted on the RetryRedirects.vue component
// but if we don't include it, the console will show warnings about not being able to
// subscribe to this event
defineEmits(["redirectCountUpdated"]);
Copy link
Member Author

Choose a reason for hiding this comment

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

using a reactive exported const instead

@@ -20,36 +18,36 @@ const enable_tls = ref(settings.enable_tls);
const from = ref(settings.from);
const to = ref(settings.to);

const emailRe = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
const emailRe = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
Copy link
Member Author

Choose a reason for hiding this comment

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

unnecessary escape


const isExpired = licenseStatus.isExpired;

const emit = defineEmits(["redirectCountUpdated"]);
Copy link
Member Author

Choose a reason for hiding this comment

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

this now in redirectCountUpdated

@johnsimons johnsimons marked this pull request as ready for review February 9, 2024 08:18
@soujay soujay self-requested a review February 21, 2024 22:54
@cquirosj cquirosj changed the base branch from master to merge_monitoring_master February 27, 2024 20:50
@cquirosj cquirosj changed the base branch from merge_monitoring_master to master February 27, 2024 21:52
@@ -252,11 +247,13 @@ async function getServiceControlConnection() {

async function getMonitoringConnection() {
try {
const [, data] = await useTypedFetchFromMonitoring<{ Metrics: MetricsConnectionDetails }>("connection");
return data;
if (!useIsMonitoringDisabled()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

not required, is in useTypedFetchFromMonitoring, which will return an undefined response and data

Copy link
Member Author

Choose a reason for hiding this comment

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

removed

} catch {
connections.monitoring.errors = [`Error SC Monitoring instance at ${monitoringUrl.value}connection`];
return null;
return undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

does not returning anything also return undefined implicitly? That's what's happening currently if the if clause above returns false

Copy link
Contributor

Choose a reason for hiding this comment

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

also in getServiceControlConnection this same pattern is returning null rather than undefined, should be consistent

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed, anything else @PhilBastian ?

} catch {
return null;
}
} catch {}
Copy link
Contributor

Choose a reason for hiding this comment

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

remove try/catch

Copy link
Contributor

Choose a reason for hiding this comment

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

should we rename the function? It's not getting the monitoring version, it's setting it in the environment settings

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed and renamed

@@ -63,6 +77,8 @@ function edit() {
function close() {
emit("cancel");
}

function save() {}
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.

need to figure that one out!

Copy link
Member Author

Choose a reason for hiding this comment

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

This seems to be broken in master

<form name="redirectForm" novalidate @submit.prevent="save">

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 actually think this fix is ok, it seems the logic is in the onclick of the buttons.
Thoughts @PhilBastian ?

Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't the call save on submit logic be removed? I would guess whomever migrated this originally intended to have it have form submit functionality (which isn't in angular), and then forgot

}

interface MetricsConnectionDetails {
Enabled: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

should be camelCase

Copy link
Member Author

Choose a reason for hiding this comment

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

The payload from the server is not camelCase, see https://particularsoftware.slack.com/archives/C368VHCTT/p1706660541812479

Copy link
Contributor

Choose a reason for hiding this comment

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

could use https://www.npmjs.com/package/camelcase-keys on the API response (on all API responses to be consistent)

Copy link
Member Author

Choose a reason for hiding this comment

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

possibly, or we fix the server side 😄

//NOTE to eliminate success msg showing everytime the screen is refreshed
if (newValue !== oldValue) {
if (newValue) {
useShowToast(TYPE.ERROR, "Error", "Could not connect to ServiceControl at " + serviceControlUrl.value + '. <a class="btn btn-default" href="/#/configuration/connections">View connection settings</a>');
Copy link
Contributor

Choose a reason for hiding this comment

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

convert to interpolation

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

//NOTE to eliminate success msg showing everytime the screen is refreshed
if (newValue !== oldValue) {
if (newValue) {
useShowToast(TYPE.ERROR, "Error", "Could not connect to the ServiceControl Monitoring service at " + monitoringUrl.value + '. <a class="btn btn-default" href="/#/configuration/connections">View connection settings</a>');
Copy link
Contributor

Choose a reason for hiding this comment

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

convert to interpolation

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@johnsimons johnsimons merged commit d7c4ae0 into master Mar 5, 2024
5 checks passed
@johnsimons johnsimons deleted the john/cheese branch March 5, 2024 23:41
@cquirosj cquirosj added this to the 1.38.2 milestone Mar 20, 2024
@TravisNickels TravisNickels added Type: Refactoring Type: Refactoring Type: Improvement Type: Improvement labels Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Improvement Type: Improvement Type: Refactoring Type: Refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants