mirror of
https://github.com/pawelmalak/flame.git
synced 2025-08-01 00:45:18 +02:00
Support for app categories in docker integration (#8)
* initial support for app categories in docker integration * fixed readme examples for docker integration and some fixes to integration * fix obtaining category from container label * hide edit actions for default categories (such as Docker)
This commit is contained in:
parent
14fbc7e221
commit
ccdb477ac4
8 changed files with 53 additions and 12 deletions
|
@ -5,6 +5,14 @@ const Bookmark = require('../models/Bookmark');
|
|||
const Config = require('../models/Config');
|
||||
const { Sequelize } = require('sequelize');
|
||||
|
||||
exports.dockerDefaultCategory = {
|
||||
id: -2,
|
||||
name: "Docker",
|
||||
type: "apps",
|
||||
isPinned: true,
|
||||
orderId: 99,
|
||||
};
|
||||
|
||||
// @desc Create new category
|
||||
// @route POST /api/categories
|
||||
// @access Public
|
||||
|
@ -73,6 +81,7 @@ exports.getCategories = asyncWrapper(async (req, res, next) => {
|
|||
],
|
||||
order: [[orderType, 'ASC']],
|
||||
});
|
||||
categories.push(exports.dockerDefaultCategory);
|
||||
}
|
||||
|
||||
res.status(200).json({
|
||||
|
@ -100,12 +109,16 @@ exports.getCategory = asyncWrapper(async (req, res, next) => {
|
|||
});
|
||||
|
||||
if (!category) {
|
||||
return next(
|
||||
new ErrorResponse(
|
||||
`Category with id of ${req.params.id} was not found`,
|
||||
404
|
||||
)
|
||||
);
|
||||
if (req.params.id === exports.dockerDefaultCategory.id) {
|
||||
category = exports.dockerDefaultCategory;
|
||||
} else {
|
||||
return next(
|
||||
new ErrorResponse(
|
||||
`Category with id of ${req.params.id} was not found`,
|
||||
404
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
res.status(200).json({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue