Compare commits

...

3 commits

Author SHA1 Message Date
1893bfed44
dev: fix postgres port number in Makefile
overlooked in 881fd5f5d8
2024-01-19 19:52:45 +09:00
b28591abff
fix: shutdown gracefully 2024-01-19 19:31:06 +09:00
7ffb8e2853
style: rearrange buttons in page editor 2024-01-19 19:30:51 +09:00
4 changed files with 17 additions and 13 deletions

View file

@ -31,7 +31,7 @@ regenerate-entities:
cd packages/backend/native-utils && \ cd packages/backend/native-utils && \
sea-orm-cli generate entity \ sea-orm-cli generate entity \
--output-dir='src/model/entity' \ --output-dir='src/model/entity' \
--database-url='postgres://firefish:password@localhost/firefish_db' --database-url='postgres://firefish:password@localhost:25432/firefish_db'
.PHONY: update-index-js .PHONY: update-index-js

View file

@ -6,6 +6,7 @@
* @callback BeforeShutdownListener * @callback BeforeShutdownListener
* @param {string} [signalOrEvent] The exit signal or event name received on the process. * @param {string} [signalOrEvent] The exit signal or event name received on the process.
*/ */
type BeforeShutdownListener = (signalOrEvent: string) => PromiseLike<void>;
/** /**
* System signals the app will listen to initiate shutdown. * System signals the app will listen to initiate shutdown.
@ -24,7 +25,7 @@ const SHUTDOWN_TIMEOUT = 15000;
* down the process. * down the process.
* @type {BeforeShutdownListener[]} * @type {BeforeShutdownListener[]}
*/ */
const shutdownListeners: ((signalOrEvent: string) => void)[] = []; const shutdownListeners: BeforeShutdownListener[] = [];
/** /**
* Listen for signals and execute given `fn` function once. * Listen for signals and execute given `fn` function once.
@ -89,7 +90,9 @@ async function shutdownHandler(signalOrEvent: string) {
* @param {BeforeShutdownListener} listener The shutdown listener to register. * @param {BeforeShutdownListener} listener The shutdown listener to register.
* @returns {BeforeShutdownListener} Echoes back the supplied `listener`. * @returns {BeforeShutdownListener} Echoes back the supplied `listener`.
*/ */
export function beforeShutdown(listener: () => void) { export function beforeShutdown(
listener: BeforeShutdownListener,
): BeforeShutdownListener {
shutdownListeners.push(listener); shutdownListeners.push(listener);
return listener; return listener;
} }

View file

@ -6,4 +6,4 @@ export const activeUsersChart = new ActiveUsersChart();
// 20分おきにメモリ情報をDBに書き込み // 20分おきにメモリ情報をDBに書き込み
setInterval(() => activeUsersChart.save(), 1000 * 60 * 20); setInterval(() => activeUsersChart.save(), 1000 * 60 * 20);
beforeShutdown(async () => await new Promise(() => activeUsersChart.save())); beforeShutdown(() => activeUsersChart.save());

View file

@ -1,12 +1,14 @@
<template> <template>
<div class="cpjygsrt" :class="{ error: error != null, warn: warn != null }"> <div class="cpjygsrt" :class="{ error: error != null, warn: warn != null }">
<header> <header>
<div class="title"><slot name="header"></slot></div>
<div class="buttons"> <div class="buttons">
<slot name="func"></slot>
<button v-if="removable" class="_button" @click="remove()"> <button v-if="removable" class="_button" @click="remove()">
<i :class="icon('ph-trash')"></i> <i :class="icon('ph-trash')"></i>
</button> </button>
</div>
<div class="title"><slot name="header"></slot></div>
<div class="buttons">
<slot name="func"></slot>
<div v-if="draggable" class="drag-handle _button"> <div v-if="draggable" class="drag-handle _button">
<i :class="icon('ph-list')"></i> <i :class="icon('ph-list')"></i>
</div> </div>
@ -115,14 +117,16 @@ export default defineComponent({
} }
> header { > header {
display: flex;
padding-top: 0.5em;
> .title { > .title {
z-index: 1; z-index: 1;
margin: 0; margin: 0;
padding: 0 16px;
line-height: 42px;
font-size: 0.9em; font-size: 0.9em;
font-weight: bold; font-weight: bold;
box-shadow: 0 1px rgba(#000, 0.07); box-shadow: 0 1px rgba(#000, 0.07);
flex: 1;
> i { > i {
margin-inline-end: 6px; margin-inline-end: 6px;
@ -134,16 +138,13 @@ export default defineComponent({
} }
> .buttons { > .buttons {
position: absolute;
z-index: 2; z-index: 2;
top: 0;
inset-inline-end: 0;
> ._button { > ._button,
> :slotted(._button) {
padding: 0; padding: 0;
width: 42px; width: 42px;
font-size: 0.9em; font-size: 0.9em;
line-height: 42px;
text-align: center; text-align: center;
} }