fix: dashboard error

This commit is contained in:
Andras Bacsai 2022-11-11 13:28:37 +01:00
parent 39ba498293
commit cea894a8bd
5 changed files with 60 additions and 21 deletions

View File

@ -17,7 +17,7 @@ import { day } from './dayjs';
import { saveBuildLog } from './buildPacks/common';
import { scheduler } from './scheduler';
export const version = '3.11.6';
export const version = '3.11.7';
export const isDev = process.env.NODE_ENV === 'development';
const algorithm = 'aes-256-ctr';

View File

@ -2,11 +2,16 @@ import { isDev } from "./common";
import fs from 'fs/promises';
export async function getTemplates() {
const templatePath = isDev ? './templates.json' : '/app/templates.json';
const ts = await fs.readFile(templatePath, 'utf8')
if (ts) {
return JSON.parse(ts);
const open = await fs.open(templatePath, 'r');
let data;
try {
data = await open.readFile({ encoding: 'utf-8' });
return JSON.parse(data);
} catch (error) {
return []
} finally {
await open?.close()
}
return [];
}
const compareSemanticVersions = (a: string, b: string) => {
const a1 = a.split('.');

View File

@ -34,7 +34,6 @@ export async function startService(request: FastifyRequest<ServiceStartStop>, fa
const { id } = request.params;
const teamId = request.user.teamId;
const service = await getServiceFromDB({ id, teamId });
console.log({service})
const arm = isARM(service.arch);
const { type, destinationDockerId, destinationDocker, persistentStorage, exposePort } =
service;

View File

@ -90,31 +90,50 @@
return {
applications:
!onlyOthers &&
applications.filter((application: any) => application.teams[0].id === $appSession.teamId),
applications.filter(
(application: any) =>
application?.teams.length > 0 && application.teams[0].id === $appSession.teamId
),
otherApplications: applications.filter(
(application: any) => application.teams[0].id !== $appSession.teamId
(application: any) =>
application?.teams.length > 0 && application.teams[0].id !== $appSession.teamId
),
databases:
!onlyOthers &&
databases.filter((database: any) => database.teams[0].id === $appSession.teamId),
databases.filter(
(database: any) =>
database?.teams.length > 0 && database.teams[0].id === $appSession.teamId
),
otherDatabases: databases.filter(
(database: any) => database.teams[0].id !== $appSession.teamId
(database: any) => database?.teams.length > 0 && database.teams[0].id !== $appSession.teamId
),
services:
!onlyOthers &&
services.filter((service: any) => service.teams[0].id === $appSession.teamId),
otherServices: services.filter((service: any) => service.teams[0].id !== $appSession.teamId),
services.filter(
(service: any) => service?.teams.length > 0 && service.teams[0].id === $appSession.teamId
),
otherServices: services.filter(
(service: any) => service?.teams.length > 0 && service.teams[0].id !== $appSession.teamId
),
gitSources:
!onlyOthers &&
gitSources.filter((gitSource: any) => gitSource.teams[0].id === $appSession.teamId),
gitSources.filter(
(gitSource: any) =>
gitSource?.teams.length > 0 && gitSource.teams[0].id === $appSession.teamId
),
otherGitSources: gitSources.filter(
(gitSource: any) => gitSource.teams[0].id !== $appSession.teamId
(gitSource: any) =>
gitSource?.teams.length > 0 && gitSource.teams[0].id !== $appSession.teamId
),
destinations:
!onlyOthers &&
destinations.filter((destination: any) => destination.teams[0].id === $appSession.teamId),
destinations.filter(
(destination: any) =>
destination?.teams.length > 0 && destination.teams[0].id === $appSession.teamId
),
otherDestinations: destinations.filter(
(destination: any) => destination.teams[0].id !== $appSession.teamId
(destination: any) =>
destination?.teams.length > 0 && destination.teams[0].id !== $appSession.teamId
)
};
}
@ -682,7 +701,11 @@
<div class="flex justify-end items-end space-x-2 h-10">
{#if application?.fqdn}
<a href={application?.fqdn} target="_blank noreferrer" class="icons hover:bg-green-500">
<a
href={application?.fqdn}
target="_blank noreferrer"
class="icons hover:bg-green-500"
>
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6"
@ -788,7 +811,11 @@
<div class="flex justify-end items-end space-x-2 h-10">
{#if application?.fqdn}
<a href={application?.fqdn} target="_blank noreferrer" class="icons hover:bg-green-500">
<a
href={application?.fqdn}
target="_blank noreferrer"
class="icons hover:bg-green-500"
>
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6"
@ -897,7 +924,11 @@
</div>
<div class="flex justify-end items-end space-x-2 h-10">
{#if service?.fqdn}
<a href={service?.fqdn} target="_blank noreferrer" class="icons hover:bg-pink-500">
<a
href={service?.fqdn}
target="_blank noreferrer"
class="icons hover:bg-pink-500"
>
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6"
@ -970,7 +1001,11 @@
</div>
<div class="flex justify-end items-end space-x-2 h-10">
{#if service?.fqdn}
<a href={service?.fqdn} target="_blank noreferrer" class="icons hover:bg-pink-500">
<a
href={service?.fqdn}
target="_blank noreferrer"
class="icons hover:bg-pink-500"
>
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6"

View File

@ -1,7 +1,7 @@
{
"name": "coolify",
"description": "An open-source & self-hostable Heroku / Netlify alternative.",
"version": "3.11.6",
"version": "3.11.7",
"license": "Apache-2.0",
"repository": "github:coollabsio/coolify",
"scripts": {