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);
let status = '';
if (container_images.includes(images[i].RepoTags[0])) {
status = 'In use';
}
try {
if (container_images.includes(images[i].RepoTags[0])) {
status = 'In use';
}
} catch {}
let details = `
<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 name = req.header('hx-trigger-name');
let value = req.header('hx-trigger');
@ -21,9 +21,13 @@ export const settingsAction = (req, res) => {
console.log(`value: ${value}`);
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)) {
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: {
type: DataTypes.INTEGER,
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: {
type: DataTypes.INTEGER,
autoIncrement: true,