mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-29 15:49:37 +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,8 @@ const Config = require('../models/Config');
|
|||
const { Sequelize } = require('sequelize');
|
||||
const axios = require('axios');
|
||||
const Logger = require('../utils/Logger');
|
||||
const Category = require('../models/Category');
|
||||
const { dockerDefaultCategory } = require('./category');
|
||||
const logger = new Logger();
|
||||
const k8s = require('@kubernetes/client-node');
|
||||
|
||||
|
@ -89,7 +91,18 @@ exports.getApps = asyncWrapper(async (req, res, next) => {
|
|||
order: [[orderType, 'ASC']],
|
||||
});
|
||||
|
||||
<<<<<<< HEAD
|
||||
containers = containers.filter((e) => Object.keys(e.Labels).length !== 0);
|
||||
=======
|
||||
const categories = await Category.findAll({
|
||||
where: {
|
||||
type: 'apps'
|
||||
},
|
||||
order: [[orderType, 'ASC']]
|
||||
});
|
||||
|
||||
containers = containers.filter(e => Object.keys(e.Labels).length !== 0);
|
||||
>>>>>>> e1a46b7 (Support for app categories in docker integration (#8))
|
||||
const dockerApps = [];
|
||||
for (const container of containers) {
|
||||
const labels = container.Labels;
|
||||
|
@ -99,6 +112,7 @@ exports.getApps = asyncWrapper(async (req, res, next) => {
|
|||
'flame.url' in labels &&
|
||||
/^app/.test(labels['flame.type'])
|
||||
) {
|
||||
<<<<<<< HEAD
|
||||
for (let i = 0; i < labels['flame.name'].split(';').length; i++) {
|
||||
const names = labels['flame.name'].split(';');
|
||||
const urls = labels['flame.url'].split(';');
|
||||
|
@ -114,6 +128,19 @@ exports.getApps = asyncWrapper(async (req, res, next) => {
|
|||
icon: icons[i] || 'docker',
|
||||
});
|
||||
}
|
||||
=======
|
||||
const app = {
|
||||
name: labels['flame.name'],
|
||||
url: labels['flame.url'],
|
||||
icon: labels['flame.icon'] || 'docker',
|
||||
categoryId: dockerDefaultCategory.id
|
||||
}
|
||||
if (labels['flame.category']) {
|
||||
const category = categories.find(category => category.name.toUpperCase() === labels['flame.category'].toUpperCase());
|
||||
app.categoryId = category ? category.id : dockerDefaultCategory.id
|
||||
}
|
||||
dockerApps.push(app);
|
||||
>>>>>>> e1a46b7 (Support for app categories in docker integration (#8))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue