Merge pull request #431 from rajnandan1/release/18

Release/18
This commit is contained in:
Raj Nandan Sharma
2025-06-12 09:21:40 +05:30
committed by GitHub
7 changed files with 62 additions and 10 deletions
+1
View File
@@ -108,6 +108,7 @@ COPY --chown=node:node --from=builder /app/src/lib/ ./src/lib/
COPY --chown=node:node --from=builder /app/build ./build
COPY --chown=node:node --from=builder /app/uploads ./uploads
COPY --chown=node:node --from=builder /app/database ./database
COPY --chown=node:node --from=builder /app/src/lib/server/templates ./build/server/templates
# TODO: Consider changing from copying `node_modules` to instead letting `npm ci --omit=dev` handle production dependencies. Right now, copying `node_modules` is leading to a smaller image, whereas letting `npm ci` handle the install in final image is slightly faster, but leads to larger image size. IMO, having a slightly longer build time (e.g. ~10 sec.) is better in the end to have a smaller image.
COPY --chown=node:node --from=builder /app/node_modules ./node_modules
COPY --chown=node:node --from=builder /app/migrations ./migrations
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "kener",
"version": "3.2.17",
"version": "3.2.18",
"private": false,
"license": "MIT",
"description": "Kener is a modern, open-source status page application built with Node.js. It provides real-time monitoring, uptime tracking, incident management, and beautiful dashboards. Perfect for DevOps teams, SaaS providers, and businesses needing reliable service status communication with minimal setup.",
+6 -1
View File
@@ -1629,7 +1629,7 @@ export const CreateSubscriptionTrigger = async (data) => {
} else {
await db.updateSubscriptionTrigger({
id: subscriptionTrigger.id,
subscription_trigger_status: "ACTIVE",
subscription_trigger_status: data.subscription_trigger_status || "ACTIVE",
subscription_trigger_type: subscriptionTrigger.subscription_trigger_type,
config: data.config,
});
@@ -1642,6 +1642,11 @@ export const CreateSubscriptionTrigger = async (data) => {
};
};
//updateSubscriptionTriggerStatus
export const UpdateSubscriptionTriggerStatus = async (id, status) => {
return await db.updateSubscriptionTriggerStatus(id, status);
};
// Get subscribers paginated
export const GetSubscribersPaginated = async (data) => {
const page = parseInt(data.page) || 1;
+4
View File
@@ -10,6 +10,7 @@ import {
IsLoggedInSession,
GetLocaleFromCookie,
IsEmailSetup,
GetSubscriptionTriggerByEmail,
} from "$lib/server/controllers/controller.js";
export async function load({ params, route, url, cookies, request }) {
@@ -47,6 +48,8 @@ export async function load({ params, route, url, cookies, request }) {
const query = url.searchParams;
const bgc = query.get("bgc") ? "#" + query.get("bgc") : "";
const emailSubscriptionTrigger = await GetSubscriptionTriggerByEmail();
return {
site: site,
localTz: localTz,
@@ -55,6 +58,7 @@ export async function load({ params, route, url, cookies, request }) {
selectedLang: selectedLang,
isLoggedIn: !!isLoggedIn.user,
canSendEmail: IsEmailSetup(),
canUsersSubscribe: !!emailSubscriptionTrigger && emailSubscriptionTrigger.subscription_trigger_status == "ACTIVE",
isMobile: isMobile,
};
}
+1 -1
View File
@@ -123,7 +123,7 @@
{/if}
<div class="section-actions mx-auto mb-8 flex w-full max-w-[655px] flex-1 flex-col items-center justify-center">
<div class="flex w-full flex-wrap rounded-md border shadow-sm">
{#if data.canSendEmail}
{#if data.canSendEmail && data.canUsersSubscribe}
<Button
variant="ghost"
class="dash-after relative h-10 rounded-md text-sm font-medium"
@@ -13,6 +13,7 @@ import {
InsertKeyValue,
GetMonitors,
CreateUpdateTrigger,
UpdateSubscriptionTriggerStatus,
GetAllTriggers,
UpdateTriggerData,
GetSubscriptionTriggerByEmail,
@@ -254,6 +255,8 @@ export async function POST({ request, cookies }) {
resp = await GetSubscribersPaginated(data);
} else if (action == "updateSubscriptionStatus") {
resp = await UpdateSubscriptionStatus(data.id, data.status);
} else if (action == "updateSubscriptionTriggerStatus") {
resp = await UpdateSubscriptionTriggerStatus(data.id, data.status);
}
} catch (error) {
console.log(error);
@@ -16,7 +16,7 @@
let total = 0; // Initialize total to 0
let totalPages = 0; // Initialize totalPages
let subscriptionTrigger = {
subscription_trigger_id: null,
id: null,
subscription_trigger_status: "INACTIVE",
subscription_trigger_type: "email",
config: {
@@ -122,6 +122,21 @@
});
}
function updateSubscriptionTriggerStatus(id, status) {
// Call the API to update the subscription status
fetch(base + "/manage/app/api/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
action: "updateSubscriptionTriggerStatus",
data: {
id: id,
status: status
}
})
});
}
// Reactive statement to calculate totalPages
</script>
@@ -132,6 +147,30 @@
Events Subscription
{#if pageLoading}
<Loader size="16" class="absolute right-0 top-0 animate-spin text-gray-500" />
{:else if canSendEmail && !!subscriptionTrigger.id}
<label class="absolute right-0 top-0 flex cursor-pointer items-center justify-between gap-2 text-sm">
<Label class="text-xs font-medium ">
{subscriptionTrigger.subscription_trigger_status == "ACTIVE" ? "Active" : "Inactive"}
</Label>
<input
type="checkbox"
value=""
disabled={!canSendEmail}
class="peer sr-only"
checked={subscriptionTrigger.subscription_trigger_status == "ACTIVE"}
on:change={(e) => {
subscriptionTrigger.subscription_trigger_status = e.target.checked ? "ACTIVE" : "INACTIVE";
// Call the API to update the subscription status
updateSubscriptionTriggerStatus(
subscriptionTrigger.id,
subscriptionTrigger.subscription_trigger_status
);
}}
/>
<div
class="peer relative h-6 w-11 rounded-full bg-gray-200 after:absolute after:start-[2px] after:top-[2px] after:h-5 after:w-5 after:rounded-full after:border after:border-gray-300 after:bg-white after:transition-all after:content-[''] peer-checked:bg-blue-600 peer-checked:after:translate-x-full peer-checked:after:border-white peer-focus:outline-none dark:border-gray-600 dark:bg-gray-700 dark:peer-focus:ring-blue-800 rtl:peer-checked:after:-translate-x-full"
></div>
</label>
{/if}
</Card.Title>
<Card.Description>Configure and view who have subscribed to updates for your status page.</Card.Description>
@@ -163,7 +202,7 @@
class="mr-1"
type="checkbox"
checked={subscriptionTrigger.config.createIncident}
disabled={!canSendEmail}
disabled={!canSendEmail || subscriptionTrigger.subscription_trigger_status != "ACTIVE"}
/>
Event Triggered
</label>
@@ -181,7 +220,7 @@
class="mr-1"
type="checkbox"
checked={subscriptionTrigger.config.updateIncident}
disabled={!canSendEmail}
disabled={!canSendEmail || subscriptionTrigger.subscription_trigger_status != "ACTIVE"}
/>
Event Updated
</label>
@@ -197,7 +236,7 @@
class="mr-1"
type="checkbox"
checked={subscriptionTrigger.config.insertIncidentMonitor}
disabled={!canSendEmail}
disabled={!canSendEmail || subscriptionTrigger.subscription_trigger_status != "ACTIVE"}
/>
Update Monitor in Event
</label>
@@ -215,7 +254,7 @@
class="mr-1"
type="checkbox"
checked={subscriptionTrigger.config.updateIncidentComment}
disabled={!canSendEmail}
disabled={!canSendEmail || subscriptionTrigger.subscription_trigger_status != "ACTIVE"}
/>
Update Incident Comment
</label>
@@ -233,7 +272,7 @@
class="mr-1"
type="checkbox"
checked={subscriptionTrigger.config.insertIncidentComment}
disabled={!canSendEmail}
disabled={!canSendEmail || subscriptionTrigger.subscription_trigger_status != "ACTIVE"}
/>
Insert Incident Comment
</label>
@@ -363,7 +402,7 @@
<input
type="checkbox"
value=""
disabled={!canSendEmail}
disabled={!canSendEmail || subscriptionTrigger.subscription_trigger_status != "ACTIVE"}
class="peer sr-only"
checked={user.subscriptions_status == "ACTIVE"}
on:change={(e) => {