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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ env:
jobs:
build:
name: Windows
runs-on: windows-2019
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v3.1.0
Expand Down
5 changes: 1 addition & 4 deletions src/ServicePulse.Host/Hosting/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -889,10 +889,7 @@ public List<string> Parse(IEnumerable<string> arguments)
}
}

if (c.Option != null)
{
c.Option.Invoke(c);
}
c.Option?.Invoke(c);

return unprocessed;
}
Expand Down
267 changes: 7 additions & 260 deletions src/ServicePulse.Host/vue/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,271 +1,18 @@
<script setup>
import { ref, provide, computed, onMounted, watch } from "vue";
import { RouterView } from "vue-router";
import PageFooter from "./components/PageFooter.vue";
import PageHeader from "./components/PageHeader.vue";
import { useServiceControlUrls } from "./composables/serviceServiceControlUrls.js";
import {
key_ServiceControlUrl,
key_UnableToConnectToServiceControl,
key_UnableToConnectToMonitoring,
key_IsSCConnecting,
key_IsSCConnected,
key_ScConnectedAtLeastOnce,
key_UpdateConnections,
key_MonitoringUrl,
key_IsMonitoringEnabled,
key_IsSCMonitoringConnected,
key_IsSCMonitoringConnecting,
key_MonitoringVersion,
key_NewMonitoringVersion,
key_NewMonitoringVersionLink,
key_NewMonitoringVersionNumber,
key_License,
key_SPVersion,
key_NewSPVersion,
key_NewSPVersionLink,
key_NewSPVersionNumber,
key_SCVersion,
key_NewSCVersion,
key_NewSCVersionLink,
key_NewSCVersionNumber,
} from "./composables/keys.js";
import {
useServiceControlUrls,
updateServiceControlUrls,
} from "./composables/serviceServiceControlUrls.js";
import {
useServiceControlStats,
useServiceControlVersion,
isServiceControlConnecting,
isServiceControlConnected,
serviceControlConnectedAtLeastOnce,
useServiceControlMonitoringStats,
isServiceControlMonitoringConnecting,
isServiceControlMonitoringConnected,
environment,
newVersions,
useServiceControl,
} from "./composables/serviceServiceControl.js";
import {
useLicense,
useLicenseStatus,
useGetWarningMessage,
} from "./composables/serviceLicense.js";
import { useShowToast } from "./composables/toast.js";

onMounted(() => {
getLicense();
getServiceControlVersions();
getServiceControlStats();
getServiceControlMonitoringStats();
});

const { serviceControlUrl, monitoringUrl } = useServiceControlUrls();
provide(key_ServiceControlUrl, serviceControlUrl);
provide(key_MonitoringUrl, monitoringUrl);

let license = ref(null);
function getLicense() {
useLicense(serviceControlUrl.value).then((lic) => {
license.value = lic.value;
});
}

provide(key_License, license);

watch(useLicenseStatus.isExpired, async (newValue, oldValue) => {
if (newValue != oldValue) {
if (newValue) {
useShowToast(
"error",
"Error",
'Your license has expired. Please contact Particular Software support at: <a href="http://particular.net/support">http://particular.net/support</a>',
true
);
}
}
});

watch(license, async (newValue, oldValue) => {
const checkForWarnings =
oldValue !== null
? newValue && newValue.license_status != oldValue.license_status
: newValue !== null;
if (checkForWarnings) {
useGetWarningMessage(newValue.license_status, useShowToast);
}
});

let isSCConnecting = ref(true);
let isSCConnected = ref(null);
let scConnectedAtLeastOnce = ref(false);

let isSCMonitoringConnecting = ref(true);
let isSCMonitoringConnected = ref(null);
let isMonitoringEnabled = computed(() => {
return (
monitoringUrl.value !== "!" &&
monitoringUrl.value !== "" &&
monitoringUrl.value !== null &&
monitoringUrl.value !== undefined
);
});
const unableToConnectToServiceControl = computed(() => {
return isSCConnecting.value ? false : !isSCConnected.value;
});
const unableToConnectToMonitoring = computed(() => {
return isSCMonitoringConnecting.value
? false
: !isSCMonitoringConnected.value;
});

function updateConnections(urlParams, newServiceControlUrl, newMonitoringUrl) {
updateServiceControlUrls(urlParams, newServiceControlUrl, newMonitoringUrl);
}

setInterval(() => getServiceControlStats(), 5000); //NOTE is 5 seconds too often?
setInterval(() => getServiceControlMonitoringStats(), 5000); //NOTE is 5 seconds too often?

function getServiceControlStats() {
useServiceControlStats(serviceControlUrl.value).then(() => {
isSCConnecting.value = isServiceControlConnecting.value;
isSCConnected.value = isServiceControlConnected.value;
scConnectedAtLeastOnce.value = serviceControlConnectedAtLeastOnce.value;
});
}
function getServiceControlMonitoringStats() {
useServiceControlMonitoringStats(monitoringUrl.value).then(() => {
isSCMonitoringConnecting.value = isServiceControlMonitoringConnecting.value;
isSCMonitoringConnected.value = isServiceControlMonitoringConnected.value;
});
}

provide(key_UnableToConnectToServiceControl, unableToConnectToServiceControl);
provide(key_UnableToConnectToMonitoring, unableToConnectToMonitoring);
provide(key_IsSCConnecting, isSCConnecting);
provide(key_IsSCConnected, isSCConnected);
provide(key_ScConnectedAtLeastOnce, scConnectedAtLeastOnce);
provide(key_UpdateConnections, updateConnections);

provide(key_IsMonitoringEnabled, isMonitoringEnabled);
provide(key_IsSCMonitoringConnected, isSCMonitoringConnected);
provide(key_IsSCMonitoringConnecting, isSCMonitoringConnecting);

watch(isSCConnected, async (newValue, oldValue) => {
if (newValue != oldValue && !(oldValue === null && newValue === true)) {
//NOTE to eliminate success msg showing everytime the screen is refreshed
if (!newValue) {
useShowToast(
"error",
"Error",
"Could not connect to ServiceControl at " +
serviceControlUrl.value +
'. <a class="btn btn-default" href="/configuration#connections">View connection settings</a>'
);
} else {
useShowToast(
"success",
"Success",
"Connection to ServiceControl was successful at " +
serviceControlUrl.value +
"."
);
}
}
});

watch(isSCMonitoringConnected, async (newValue, oldValue) => {
if (newValue != oldValue && !(oldValue === null && newValue === true)) {
//NOTE to eliminate success msg showing everytime the screen is refreshed
if (!newValue) {
useShowToast(
"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>'
);
} else {
useShowToast(
"success",
"Success",
"Connection to ServiceControl Monitoring service was successful at " +
monitoringUrl.value +
"."
);
}
}
});

let scVersion = ref(null);
let newSCVersion = ref(null);
let newSCVersionLink = ref(null);
let newSCVersionNumber = ref(null);
let spVersion = ref(null);
let newSPVersion = ref(null);
let newSPVersionLink = ref(null);
let newSPVersionNumber = ref(null);
let monitoringVersion = ref(null);
let newmonitoringVersion = ref(null);
let newmonitoringVersionLink = ref(null);
let newmonitoringVersionNumber = ref(null);
let isCompatibleWithSC = ref(true);
let minimumSupportedSCVersion = ref(null);

watch(isCompatibleWithSC, async (newValue, oldValue) => {
if (newValue != oldValue) {
if (!newValue) {
useShowToast(
"error",
"Error",
"You are using Service Control version " +
scVersion.value +
". Please, upgrade to version " +
minimumSupportedSCVersion.value +
" or higher to unlock new functionality in ServicePulse."
);
}
}
});

setInterval(() => getServiceControlVersions(), 60000); //NOTE is this often enough or too often?

function getServiceControlVersions() {
useServiceControlVersion(serviceControlUrl.value, monitoringUrl.value).then(
() => {
scVersion.value = environment.sc_version;
newSCVersion.value = newVersions.newSCVersion.newscversion;
newSCVersionLink.value = newVersions.newSCVersion.newscversionlink;
newSCVersionNumber.value = newVersions.newSCVersion.newscversionnumber;

spVersion.value = environment.sp_version;
newSPVersion.value = newVersions.newSPVersion.newspversion;
newSPVersionLink.value = newVersions.newSPVersion.newspversionlink;
newSPVersionNumber.value = newVersions.newSPVersion.newspversionnumber;

monitoringVersion.value = environment.monitoring_version;
newmonitoringVersion.value = newVersions.newMVersion.newmversion;
newmonitoringVersionLink.value = newVersions.newMVersion.newmversionlink;
newmonitoringVersionNumber.value =
newVersions.newMVersion.newmversionnumber;
import { useLicense } from "./composables/serviceLicense.js";

isCompatibleWithSC.value = environment.is_compatible_with_sc;
minimumSupportedSCVersion.value =
environment.minimum_supported_sc_version;
}
);
}
provide(key_SCVersion, scVersion);
provide(key_NewSCVersion, newSCVersion);
provide(key_NewSCVersionLink, newSCVersionLink);
provide(key_NewSCVersionNumber, newSCVersionNumber);
provide(key_SPVersion, spVersion);
provide(key_NewSPVersion, newSPVersion);
provide(key_NewSPVersionLink, newSPVersionLink);
provide(key_NewSPVersionNumber, newSPVersionNumber);
provide(key_MonitoringVersion, monitoringVersion);
provide(key_NewMonitoringVersion, newmonitoringVersion);
provide(key_NewMonitoringVersionLink, newmonitoringVersionLink);
provide(key_NewMonitoringVersionNumber, newmonitoringVersionNumber);
useServiceControlUrls();
useServiceControl();
useServiceControlVersion();
useLicense();
</script>

<template>
Expand Down
8 changes: 3 additions & 5 deletions src/ServicePulse.Host/vue/src/components/EventItemShort.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
<script setup>
import { ref, onMounted, inject } from "vue";
import { ref, onMounted } from "vue";
import { useRouter } from "vue-router";
import { getEventLogItems } from "../composables/eventLogItems.js";
import { key_ServiceControlUrl } from "@/composables/keys";
import TimeSince from "./TimeSince.vue";

const router = useRouter();
const eventLogItems = ref([]);
const eventCount = ref(0);
onMounted(() => {
const serviceControlUrl = inject(key_ServiceControlUrl);
getEventLogItems(serviceControlUrl).then((data) => {
getEventLogItems().then((data) => {
eventCount.value = data.length;
eventLogItems.value = data.slice(0, 10);
});
Expand Down Expand Up @@ -91,7 +89,7 @@ function navigateToEvent(eventLogItem) {
window.location = "/a/#/failed-messages/groups";
break;
case "MessageRedirects":
router.push("/configuration#redirects");
router.push("/configuration#retry-redirects");
break;
default:
}
Expand Down
13 changes: 4 additions & 9 deletions src/ServicePulse.Host/vue/src/components/LicenseExpired.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
<script setup>
import { useLicenseStatus } from "./../composables/serviceLicense.js";

const isPlatformExpired = useLicenseStatus.isPlatformExpired;
const isPlatformTrialExpired = useLicenseStatus.isPlatformTrialExpired;
const isInvalidDueToUpgradeProtectionExpired =
useLicenseStatus.isInvalidDueToUpgradeProtectionExpired;
import { licenseStatus } from "./../composables/serviceLicense.js";
</script>

<template>
<template v-if="isPlatformExpired">
<template v-if="licenseStatus.isPlatformExpired">
<div class="text-center monitoring-no-data" style="max-width: 620px">
<h1>Platform license expired</h1>
<p>
Expand All @@ -22,7 +17,7 @@ const isInvalidDueToUpgradeProtectionExpired =
</div>
</div>
</template>
<template v-if="isPlatformTrialExpired">
<template v-if="licenseStatus.isPlatformTrialExpired">
<div class="text-center monitoring-no-data" style="max-width: 720px">
<h1>License expired</h1>
<p>
Expand All @@ -42,7 +37,7 @@ const isInvalidDueToUpgradeProtectionExpired =
</div>
</div>
</template>
<template v-if="isInvalidDueToUpgradeProtectionExpired">
<template v-if="licenseStatus.isInvalidDueToUpgradeProtectionExpired">
<div class="text-center monitoring-no-data" style="max-width: 620px">
<h1>Platform license expired</h1>
<p>
Expand Down
Loading