Added try block for images without RepoTags

Issue #85
This commit is contained in:
lllllllillllllillll 2024-06-17 01:52:42 -07:00
parent 874615502d
commit da9692bdb1
3 changed files with 14 additions and 8 deletions

View file

@ -77,9 +77,11 @@ export const Images = async function(req, res) {
size = size.toFixed(2); size = size.toFixed(2);
let status = ''; let status = '';
if (container_images.includes(images[i].RepoTags[0])) { try {
status = 'In use'; if (container_images.includes(images[i].RepoTags[0])) {
} status = 'In use';
}
} catch {}
let details = ` let details = `
<tr> <tr>

View file

@ -11,7 +11,7 @@ export const Settings = (req, res) => {
} }
export const settingsAction = (req, res) => { export const settingsAction = async (req, res) => {
let action = req.params.action; let action = req.params.action;
let name = req.header('hx-trigger-name'); let name = req.header('hx-trigger-name');
let value = req.header('hx-trigger'); let value = req.header('hx-trigger');
@ -21,9 +21,13 @@ export const settingsAction = (req, res) => {
console.log(`value: ${value}`); console.log(`value: ${value}`);
if ((action == 'links') && (req.body.links == 'on')) { if ((action == 'links') && (req.body.links == 'on')) {
console.log('links on'); let exists = await ServerSettings.findOne({ where: {key: 'links'}});
if (!exists) { const newSetting = await ServerSettings.create({ key: 'links', value: 'on'}); }
const setting = await ServerSettings.update({value: 'on'}, {where: {key: 'links'}});
} else if ((action == 'links') && (!req.body.links)) { } else if ((action == 'links') && (!req.body.links)) {
console.log('links off'); let exists = await ServerSettings.findOne({ where: {key: 'links'}});
if (!exists) { const newSetting = await ServerSettings.create({ key: 'links', value: 'off'}); }
const setting = await ServerSettings.update({value: 'off'}, {where: {key: 'links'}});
} }

View file

@ -226,7 +226,7 @@ export const Notification = sequelize.define('Notification', {
}, },
}); });
export const ServerSettings = sequelize.define('Settings', { export const ServerSettings = sequelize.define('ServerSettings', {
id: { id: {
type: DataTypes.INTEGER, type: DataTypes.INTEGER,
autoIncrement: true, autoIncrement: true,
@ -242,7 +242,7 @@ export const ServerSettings = sequelize.define('Settings', {
} }
}); });
export const UserSettings = sequelize.define('Settings', { export const UserSettings = sequelize.define('UserSettings', {
id: { id: {
type: DataTypes.INTEGER, type: DataTypes.INTEGER,
autoIncrement: true, autoIncrement: true,