Skip to content
Draft
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/Frontend/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ declare global {
service_control_url: string;
monitoring_urls: string[];
showPendingRetry: boolean;
embedded?: boolean;
};
}
}
22 changes: 12 additions & 10 deletions src/Frontend/src/components/BackendChecksNotifications.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,19 @@ const environment = environmentStore.environment;
const primaryConnectionFailure = computed(() => connectionState.unableToConnect);
const monitoringConnectionFailure = computed(() => monitoringConnectionState.unableToConnect);

watch(primaryConnectionFailure, (newValue, oldValue) => {
//NOTE to eliminate success msg showing everytime the screen is refreshed
if (newValue !== oldValue && !(oldValue === null && newValue === false)) {
const connectionUrl = router.resolve(routeLinks.configuration.connections.link).href;
if (newValue) {
useShowToast(TYPE.ERROR, "Error", `Could not connect to ServiceControl at ${serviceControlClient.url}. <a class="btn btn-default" href="${connectionUrl}">View connection settings</a>`);
} else {
useShowToast(TYPE.SUCCESS, "Success", `Connection to ServiceControl was successful at ${serviceControlClient.url}.`);
if (!window.defaultConfig.embedded) {
watch(primaryConnectionFailure, (newValue, oldValue) => {
//NOTE to eliminate success msg showing everytime the screen is refreshed
if (newValue !== oldValue && !(oldValue === null && newValue === false)) {
const connectionUrl = router.resolve(routeLinks.configuration.connections.link).href;
if (newValue) {
useShowToast(TYPE.ERROR, "Error", `Could not connect to ServiceControl at ${serviceControlClient.url}. <a class="btn btn-default" href="${connectionUrl}">View connection settings</a>`);
} else {
useShowToast(TYPE.SUCCESS, "Success", `Connection to ServiceControl was successful at ${serviceControlClient.url}.`);
}
}
}
});
});
}

watch(monitoringConnectionFailure, (newValue, oldValue) => {
// Only watch the state change if monitoring is enabled
Expand Down
46 changes: 27 additions & 19 deletions src/Frontend/src/components/PageFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const environment = environmentAndVersionsStore.environment;
const licenseStore = useLicenseStore();
const { licenseStatus, license } = licenseStore;
const isMonitoringEnabled = monitoringClient.isMonitoringEnabled;
const isEmbedded = window.defaultConfig.embedded;

const scAddressTooltip = computed(() => {
return `ServiceControl URL ${serviceControlClient.url}`;
Expand All @@ -43,26 +44,33 @@ const { configuration } = storeToRefs(configurationStore);
<FAIcon class="footer-icon" :icon="faPlus" />
<RouterLink :to="routeLinks.configuration.endpointConnection.link">Connect new endpoint</RouterLink>
</span>

<span v-if="!newVersions.newSPVersion.newspversion && environment.sp_version"> ServicePulse v{{ environment.sp_version }} </span>
<span v-if="newVersions.newSPVersion.newspversion && environment.sp_version">
ServicePulse v{{ environment.sp_version }} (<FAIcon v-if="newVersions.newSPVersion.newspversionnumber" class="footer-icon fake-link" :icon="faArrowTurnUp" />
<a :href="newVersions.newSPVersion.newspversionlink" target="_blank">v{{ newVersions.newSPVersion.newspversionnumber }} available</a>)
</span>
<span :title="scAddressTooltip">
Service Control:
<span class="connected-status" v-if="connectionState.connected && !connectionState.connecting">
<div class="fa pa-connection-success"></div>
<span v-if="!environment.sc_version">Connected</span>
<span v-if="environment.sc_version" class="versionnumber">v{{ environment.sc_version }}</span>
<span v-if="newVersions.newSCVersion.newscversion" class="newscversion"
>(<FAIcon class="footer-icon fake-link" :icon="faArrowTurnUp" /> <a :href="newVersions.newSCVersion.newscversionlink" target="_blank">v{{ newVersions.newSCVersion.newscversionnumber }} available</a>)</span
>
<template v-if="!isEmbedded">
<span v-if="!newVersions.newSPVersion.newspversion && environment.sp_version"> ServicePulse v{{ environment.sp_version }} </span>
Copy link
Member

Choose a reason for hiding this comment

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

If may still be worthwhile to show the ServicePulse version, just not the version check.

Copy link
Member Author

Choose a reason for hiding this comment

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

well, this is something we need to think about it, at the moment the versions are the same

<span v-if="newVersions.newSPVersion.newspversion && environment.sp_version">
ServicePulse v{{ environment.sp_version }} (<FAIcon v-if="newVersions.newSPVersion.newspversionnumber" class="footer-icon fake-link" :icon="faArrowTurnUp" />
<a :href="newVersions.newSPVersion.newspversionlink" target="_blank">v{{ newVersions.newSPVersion.newspversionnumber }} available</a>)
</span>
<span v-if="!connectionState.connected && !connectionState.connecting" class="connection-failed"> <i class="fa pa-connection-failed"></i> Not connected </span>
<span v-if="connectionState.connecting" class="connection-establishing"> <i class="fa pa-connection-establishing"></i> Connecting </span>
</span>

<span :title="scAddressTooltip">
Service Control:
<span class="connected-status" v-if="connectionState.connected && !connectionState.connecting">
<div class="fa pa-connection-success"></div>
<span v-if="!environment.sc_version">Connected</span>
<span v-if="environment.sc_version" class="versionnumber">v{{ environment.sc_version }}</span>
<span v-if="newVersions.newSCVersion.newscversion" class="newscversion"
>(<FAIcon class="footer-icon fake-link" :icon="faArrowTurnUp" /> <a :href="newVersions.newSCVersion.newscversionlink" target="_blank">v{{ newVersions.newSCVersion.newscversionnumber }} available</a>)</span
>
</span>
<span v-if="!connectionState.connected && !connectionState.connecting" class="connection-failed"> <i class="fa pa-connection-failed"></i> Not connected </span>
<span v-if="connectionState.connecting" class="connection-establishing"> <i class="fa pa-connection-establishing"></i> Connecting </span>
</span>
</template>
<template v-else>
<span v-if="!newVersions.newSCVersion.newscversion && environment.sp_version"> ServicePulse v{{ environment.sp_version }} </span>
<span v-if="newVersions.newSCVersion.newscversion && environment.sp_version">
ServicePulse v{{ environment.sp_version }} (<FAIcon v-if="newVersions.newSCVersion.newscversion" class="footer-icon fake-link" :icon="faArrowTurnUp" />
<a :href="newVersions.newSCVersion.newscversionlink" target="_blank">v{{ newVersions.newSCVersion.newscversionnumber }} available</a>)
</span>
</template>
<template v-if="isMonitoringEnabled">
<span class="monitoring-connected" :title="scMonitoringAddressTooltip">
SC Monitoring:
Expand Down
3 changes: 2 additions & 1 deletion src/Frontend/src/components/ServiceControlAvailable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import serviceControlClient from "@/components/serviceControlClient";

const { store: connectionStore } = useConnectionsAndStatsAutoRefresh();
const connectionState = connectionStore.connectionState;
const isEmbedded = window.defaultConfig.embedded;
</script>

<template>
Expand All @@ -19,7 +20,7 @@ const connectionState = connectionStore.connectionState;
<span id="serviceControlUrl">{{ serviceControlClient.url }}</span
>. Please ensure that ServiceControl is running and accessible from your machine.
</p>
<div class="action-toolbar">
<div v-if="!isEmbedded" class="action-toolbar">
<RouterLink :to="routeLinks.configuration.connections.link"><span class="btn btn-default btn-primary whiteText">View Connection Details</span></RouterLink>
<a class="btn btn-default btn-secondary" href="https://docs.particular.net/monitoring/metrics/">Learn more</a>
</div>
Expand Down
21 changes: 13 additions & 8 deletions src/Frontend/src/components/configuration/PlatformConnections.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const serviceControlValid = ref<boolean | null>(null);
const testingMonitoring = ref(false);
const monitoringValid = ref<boolean | null>(null);
const connectionSaved = ref<boolean | null>(null);
const isEmbedded = window.defaultConfig.embedded;

async function testServiceControlUrl() {
if (localServiceControlUrl.value) {
Expand Down Expand Up @@ -63,21 +64,25 @@ function saveConnections() {
}

function updateServiceControlUrls() {
if (!localServiceControlUrl.value) {
throw new Error("ServiceControl URL is mandatory");
} else if (!localServiceControlUrl.value.endsWith("/")) {
localServiceControlUrl.value += "/";
const params = new URLSearchParams();

if (!isEmbedded) {
if (!localServiceControlUrl.value) {
throw new Error("ServiceControl URL is mandatory");
} else if (!localServiceControlUrl.value.endsWith("/")) {
localServiceControlUrl.value += "/";
}

params.set("scu", localServiceControlUrl.value);
}

if (!localMonitoringUrl.value) {
localMonitoringUrl.value = "!"; //disabled
} else if (!localMonitoringUrl.value.endsWith("/") && localMonitoringUrl.value !== "!") {
localMonitoringUrl.value += "/";
}

const params = new URLSearchParams();
params.set("scu", localServiceControlUrl.value);
params.set("mu", localMonitoringUrl.value);

window.location.search = `?${params.toString()}`;
}
</script>
Expand All @@ -88,7 +93,7 @@ function updateServiceControlUrls() {
<div class="row">
<div class="col-12">
<form novalidate>
<div class="row connection">
<div v-if="!isEmbedded" class="row connection">
<h3>ServiceControl</h3>
<div class="col-7 form-group">
<label for="serviceControlUrl">
Expand Down
4 changes: 4 additions & 0 deletions src/Frontend/src/components/serviceControlClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ class ServiceControlClient {
}

private getUrl() {
if (window.defaultConfig && window.defaultConfig.embedded) {
return window.defaultConfig.service_control_url;
}

const searchParams = new URLSearchParams(window.location.search);
const scu = searchParams.get("scu");
const existingScu = window.localStorage.getItem("scu");
Expand Down