Skip to content

Commit 5228499

Browse files
committed
Remove notifications for ServiceControl url
1 parent e0baf36 commit 5228499

File tree

5 files changed

+13
-134
lines changed

5 files changed

+13
-134
lines changed

frontend/src/components/BackendChecksNotifications.vue

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,15 @@ import { useServiceControlStore } from "@/stores/ServiceControlStore";
1111
import { storeToRefs } from "pinia";
1212
1313
const router = useRouter();
14-
1514
const { store: connectionStore } = useConnectionsAndStatsAutoRefresh();
16-
const connectionState = connectionStore.connectionState;
1715
const monitoringConnectionState = connectionStore.monitoringConnectionState;
1816
const { store: environmentStore } = useEnvironmentAndVersionsAutoRefresh();
1917
const environment = environmentStore.environment;
2018
const serviceControlStore = useServiceControlStore();
21-
const { monitoringUrl, serviceControlUrl, isMonitoringDisabled } = storeToRefs(serviceControlStore);
19+
const { monitoringUrl, isMonitoringDisabled } = storeToRefs(serviceControlStore);
2220
23-
const primaryConnectionFailure = computed(() => connectionState.unableToConnect);
2421
const monitoringConnectionFailure = computed(() => monitoringConnectionState.unableToConnect);
2522
26-
watch(primaryConnectionFailure, (newValue, oldValue) => {
27-
//NOTE to eliminate success msg showing everytime the screen is refreshed
28-
if (newValue !== oldValue && !(oldValue === null && newValue === false)) {
29-
const connectionUrl = router.resolve(routeLinks.configuration.connections.link).href;
30-
if (newValue) {
31-
useShowToast(TYPE.ERROR, "Error", `Could not connect to ServiceControl at ${serviceControlUrl.value}. <a class="btn btn-default" href="${connectionUrl}">View connection settings</a>`);
32-
} else {
33-
useShowToast(TYPE.SUCCESS, "Success", `Connection to ServiceControl was successful at ${serviceControlUrl.value}.`);
34-
}
35-
}
36-
});
37-
3823
watch(monitoringConnectionFailure, (newValue, oldValue) => {
3924
// Only watch the state change if monitoring is enabled
4025
if (isMonitoringDisabled.value) {

frontend/src/components/PageFooter.vue

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,19 @@ import { useConfigurationStore } from "@/stores/ConfigurationStore";
1212
import { useLicenseStore } from "@/stores/LicenseStore";
1313
1414
const { store: connectionStore } = useConnectionsAndStatsAutoRefresh();
15-
const connectionState = connectionStore.connectionState;
1615
const monitoringConnectionState = connectionStore.monitoringConnectionState;
1716
const { store: environmentAndVersionsStore } = useEnvironmentAndVersionsAutoRefresh();
1817
const newVersions = environmentAndVersionsStore.newVersions;
1918
const environment = environmentAndVersionsStore.environment;
2019
const serviceControlStore = useServiceControlStore();
21-
const { serviceControlUrl, monitoringUrl } = storeToRefs(serviceControlStore);
20+
const { monitoringUrl } = storeToRefs(serviceControlStore);
2221
const licenseStore = useLicenseStore();
2322
const { licenseStatus, license } = licenseStore;
2423
2524
const isMonitoringEnabled = computed(() => {
2625
return monitoringUrl.value !== "!" && monitoringUrl.value !== "" && monitoringUrl.value !== null && monitoringUrl.value !== undefined;
2726
});
2827
29-
const scAddressTooltip = computed(() => {
30-
return `ServiceControl URL ${serviceControlUrl.value}`;
31-
});
32-
3328
const scMonitoringAddressTooltip = computed(() => {
3429
return `Monitoring URL ${monitoringUrl.value}`;
3530
});
@@ -48,25 +43,11 @@ const { configuration } = storeToRefs(configurationStore);
4843
<RouterLink :to="routeLinks.configuration.endpointConnection.link">Connect new endpoint</RouterLink>
4944
</span>
5045

51-
<span v-if="!newVersions.newSPVersion.newspversion && environment.sp_version"> ServicePulse v{{ environment.sp_version }} </span>
52-
<span v-if="newVersions.newSPVersion.newspversion && environment.sp_version">
53-
ServicePulse v{{ environment.sp_version }} (<FAIcon v-if="newVersions.newSPVersion.newspversionnumber" class="footer-icon fake-link" :icon="faArrowTurnUp" />
54-
<a :href="newVersions.newSPVersion.newspversionlink" target="_blank">v{{ newVersions.newSPVersion.newspversionnumber }} available</a>)
46+
<span v-if="!newVersions.newSCVersion.newscversion && environment.sp_version"> ServicePulse v{{ environment.sp_version }} </span>
47+
<span v-if="newVersions.newSCVersion.newscversion && environment.sp_version">
48+
ServicePulse v{{ environment.sp_version }} (<FAIcon v-if="newVersions.newSCVersion.newscversion" class="footer-icon fake-link" :icon="faArrowTurnUp" />
49+
<a :href="newVersions.newSCVersion.newscversionlink" target="_blank">v{{ newVersions.newSCVersion.newscversionnumber }} available</a>)
5550
</span>
56-
<span :title="scAddressTooltip">
57-
Service Control:
58-
<span class="connected-status" v-if="connectionState.connected && !connectionState.connecting">
59-
<div class="fa pa-connection-success"></div>
60-
<span v-if="!environment.sc_version">Connected</span>
61-
<span v-if="environment.sc_version" class="versionnumber">v{{ environment.sc_version }}</span>
62-
<span v-if="newVersions.newSCVersion.newscversion" class="newscversion"
63-
>(<FAIcon class="footer-icon fake-link" :icon="faArrowTurnUp" /> <a :href="newVersions.newSCVersion.newscversionlink" target="_blank">v{{ newVersions.newSCVersion.newscversionnumber }} available</a>)</span
64-
>
65-
</span>
66-
<span v-if="!connectionState.connected && !connectionState.connecting" class="connection-failed"> <i class="fa pa-connection-failed"></i> Not connected </span>
67-
<span v-if="connectionState.connecting" class="connection-establishing"> <i class="fa pa-connection-establishing"></i> Connecting </span>
68-
</span>
69-
7051
<template v-if="isMonitoringEnabled">
7152
<span class="monitoring-connected" :title="scMonitoringAddressTooltip">
7253
SC Monitoring:

frontend/src/components/ServiceControlAvailable.vue

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<script setup lang="ts">
22
import ConditionalRender from "@/components/ConditionalRender.vue";
3-
import routeLinks from "@/router/routeLinks";
43
import useConnectionsAndStatsAutoRefresh from "@/composables/useConnectionsAndStatsAutoRefresh";
54
import { useServiceControlStore } from "@/stores/ServiceControlStore";
65
import { storeToRefs } from "pinia";
@@ -22,10 +21,6 @@ const { serviceControlUrl } = storeToRefs(serviceControlStore);
2221
<span id="serviceControlUrl">{{ serviceControlUrl }}</span
2322
>. Please ensure that ServiceControl is running and accessible from your machine.
2423
</p>
25-
<div class="action-toolbar">
26-
<RouterLink :to="routeLinks.configuration.connections.link"><span class="btn btn-default btn-primary whiteText">View Connection Details</span></RouterLink>
27-
<a class="btn btn-default btn-secondary" href="https://docs.particular.net/monitoring/metrics/">Learn more</a>
28-
</div>
2924
</div>
3025
</template>
3126
<slot />

frontend/src/components/configuration/PlatformConnections.vue

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,15 @@ import { useServiceControlStore } from "@/stores/ServiceControlStore";
77
import { storeToRefs } from "pinia";
88
99
const { store: connectionStore } = useConnectionsAndStatsAutoRefresh();
10-
const connectionState = connectionStore.connectionState;
1110
const monitoringConnectionState = connectionStore.monitoringConnectionState;
12-
1311
const serviceControlStore = useServiceControlStore();
14-
serviceControlStore.refresh();
15-
const localServiceControlUrl = ref(serviceControlStore.serviceControlUrl);
1612
const localMonitoringUrl = ref(serviceControlStore.monitoringUrl);
1713
const { isMonitoringDisabled } = storeToRefs(serviceControlStore);
18-
19-
const testingServiceControl = ref(false);
20-
const serviceControlValid = ref<boolean | null>(null);
21-
2214
const testingMonitoring = ref(false);
2315
const monitoringValid = ref<boolean | null>(null);
24-
2516
const connectionSaved = ref<boolean | null>(null);
2617
27-
async function testServiceControlUrl() {
28-
if (localServiceControlUrl.value) {
29-
testingServiceControl.value = true;
30-
try {
31-
const response = await fetch(localServiceControlUrl.value);
32-
serviceControlValid.value = response.ok && response.headers.has("X-Particular-Version");
33-
} catch {
34-
serviceControlValid.value = false;
35-
} finally {
36-
testingServiceControl.value = false;
37-
}
38-
}
39-
}
18+
serviceControlStore.refresh();
4019
4120
async function testMonitoringUrl() {
4221
if (localMonitoringUrl.value) {
@@ -67,23 +46,16 @@ function saveConnections() {
6746
}
6847
6948
function updateServiceControlUrls() {
70-
if (!localServiceControlUrl.value) {
71-
throw new Error("ServiceControl URL is mandatory");
72-
} else if (!localServiceControlUrl.value.endsWith("/")) {
73-
localServiceControlUrl.value += "/";
74-
}
75-
7649
if (!localMonitoringUrl.value) {
7750
localMonitoringUrl.value = "!"; //disabled
7851
} else if (!localMonitoringUrl.value.endsWith("/") && localMonitoringUrl.value !== "!") {
7952
localMonitoringUrl.value += "/";
8053
}
8154
8255
//values have changed. They'll be reset after page reloads
83-
window.localStorage.removeItem("scu");
8456
window.localStorage.removeItem("mu");
8557
86-
const newSearch = `?scu=${localServiceControlUrl.value}&mu=${localMonitoringUrl.value}`;
58+
const newSearch = `?mu=${localMonitoringUrl.value}`;
8759
console.debug("updateConnections - new query string: ", newSearch);
8860
window.location.search = newSearch;
8961
}
@@ -95,26 +67,6 @@ function updateServiceControlUrls() {
9567
<div class="row">
9668
<div class="col-12">
9769
<form novalidate>
98-
<div class="row connection">
99-
<h3>ServiceControl</h3>
100-
<div class="col-7 form-group">
101-
<label for="serviceControlUrl">
102-
CONNECTION URL
103-
<template v-if="connectionState.unableToConnect">
104-
<span class="failed-validation"><FAIcon :icon="faExclamationTriangle" /> Unable to connect </span>
105-
</template>
106-
</label>
107-
<input type="text" id="serviceControlUrl" name="serviceControlUrl" v-model="localServiceControlUrl" class="form-control" style="color: #000" required />
108-
</div>
109-
110-
<div class="col-5 no-side-padding">
111-
<button class="btn btn-default btn-secondary btn-connection-test" :class="{ disabled: !localServiceControlUrl }" type="button" @click="testServiceControlUrl">Test</button>
112-
<span class="connection-test connection-testing" v-if="testingServiceControl"> <i class="glyphicon glyphicon-refresh rotate"></i>Testing </span>
113-
<span class="connection-test connection-successful" v-if="serviceControlValid === true && !testingServiceControl"><FAIcon :icon="faCheck" /> Connection successful </span>
114-
<span class="connection-test connection-failed" v-if="serviceControlValid === false && !testingServiceControl"><FAIcon :icon="faExclamationTriangle" /> Connection failed </span>
115-
</div>
116-
</div>
117-
11870
<div class="row connection">
11971
<h3>ServiceControl Monitoring</h3>
12072
<div class="col-7 form-group">

frontend/src/stores/ServiceControlStore.ts

Lines changed: 5 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,18 @@ export const useServiceControlStore = defineStore("ServiceControlStore", () => {
2424
}
2525

2626
function refresh() {
27-
const params = getParams();
28-
const scu = getParameter(params, "scu");
29-
const mu = getParameter(params, "mu");
30-
31-
if (scu) {
32-
serviceControlUrl.value = scu.value;
33-
window.localStorage.setItem("scu", serviceControlUrl.value);
34-
console.debug(`ServiceControl Url found in QS and stored in local storage: ${serviceControlUrl.value}`);
35-
} else if (window.localStorage.getItem("scu")) {
36-
serviceControlUrl.value = window.localStorage.getItem("scu");
37-
console.debug(`ServiceControl Url, not in QS, found in local storage: ${serviceControlUrl.value}`);
38-
} else if (window.defaultConfig && window.defaultConfig.service_control_url) {
27+
const params = new URLSearchParams(window.location.search);
28+
const mu = params.get("mu");
29+
30+
if (window.defaultConfig && window.defaultConfig.service_control_url) {
3931
serviceControlUrl.value = window.defaultConfig.service_control_url;
4032
console.debug(`setting ServiceControl Url to its default value: ${window.defaultConfig.service_control_url}`);
4133
} else {
4234
console.warn("ServiceControl Url is not defined.");
4335
}
4436

4537
if (mu) {
46-
monitoringUrl.value = mu.value;
38+
monitoringUrl.value = mu;
4739
window.localStorage.setItem("mu", monitoringUrl.value);
4840
console.debug(`Monitoring Url found in QS and stored in local storage: ${monitoringUrl.value}`);
4941
} else if (window.localStorage.getItem("mu")) {
@@ -163,32 +155,6 @@ export const useServiceControlStore = defineStore("ServiceControlStore", () => {
163155
};
164156
});
165157

166-
interface Param {
167-
name: string;
168-
value: string;
169-
}
170-
171-
function getParams() {
172-
const params: Param[] = [];
173-
174-
if (!window.location.search) return params;
175-
176-
const searchParams = window.location.search.split("&");
177-
178-
searchParams.forEach((p) => {
179-
p = p.startsWith("?") ? p.substring(1, p.length) : p;
180-
const singleParam = p.split("=");
181-
params.push({ name: singleParam[0], value: singleParam[1] });
182-
});
183-
return params;
184-
}
185-
186-
function getParameter(params: Param[], key: string) {
187-
return params.find((param) => {
188-
return param.name === key;
189-
});
190-
}
191-
192158
if (import.meta.hot) {
193159
import.meta.hot.accept(acceptHMRUpdate(useServiceControlStore, import.meta.hot));
194160
}

0 commit comments

Comments
 (0)