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 { saveBuildLog } from './buildPacks/common';
import { scheduler } from './scheduler'; import { scheduler } from './scheduler';
export const version = '3.11.6'; export const version = '3.11.7';
export const isDev = process.env.NODE_ENV === 'development'; export const isDev = process.env.NODE_ENV === 'development';
const algorithm = 'aes-256-ctr'; const algorithm = 'aes-256-ctr';

View File

@ -2,11 +2,16 @@ import { isDev } from "./common";
import fs from 'fs/promises'; import fs from 'fs/promises';
export async function getTemplates() { export async function getTemplates() {
const templatePath = isDev ? './templates.json' : '/app/templates.json'; const templatePath = isDev ? './templates.json' : '/app/templates.json';
const ts = await fs.readFile(templatePath, 'utf8') const open = await fs.open(templatePath, 'r');
if (ts) { let data;
return JSON.parse(ts); 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 compareSemanticVersions = (a: string, b: string) => {
const a1 = a.split('.'); const a1 = a.split('.');

View File

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

View File

@ -90,31 +90,50 @@
return { return {
applications: applications:
!onlyOthers && !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( otherApplications: applications.filter(
(application: any) => application.teams[0].id !== $appSession.teamId (application: any) =>
application?.teams.length > 0 && application.teams[0].id !== $appSession.teamId
), ),
databases: databases:
!onlyOthers && !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( otherDatabases: databases.filter(
(database: any) => database.teams[0].id !== $appSession.teamId (database: any) => database?.teams.length > 0 && database.teams[0].id !== $appSession.teamId
), ),
services: services:
!onlyOthers && !onlyOthers &&
services.filter((service: any) => service.teams[0].id === $appSession.teamId), services.filter(
otherServices: services.filter((service: any) => service.teams[0].id !== $appSession.teamId), (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: gitSources:
!onlyOthers && !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( otherGitSources: gitSources.filter(
(gitSource: any) => gitSource.teams[0].id !== $appSession.teamId (gitSource: any) =>
gitSource?.teams.length > 0 && gitSource.teams[0].id !== $appSession.teamId
), ),
destinations: destinations:
!onlyOthers && !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( 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"> <div class="flex justify-end items-end space-x-2 h-10">
{#if application?.fqdn} {#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 <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6" class="h-6 w-6"
@ -788,7 +811,11 @@
<div class="flex justify-end items-end space-x-2 h-10"> <div class="flex justify-end items-end space-x-2 h-10">
{#if application?.fqdn} {#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 <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6" class="h-6 w-6"
@ -897,7 +924,11 @@
</div> </div>
<div class="flex justify-end items-end space-x-2 h-10"> <div class="flex justify-end items-end space-x-2 h-10">
{#if service?.fqdn} {#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 <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6" class="h-6 w-6"
@ -970,7 +1001,11 @@
</div> </div>
<div class="flex justify-end items-end space-x-2 h-10"> <div class="flex justify-end items-end space-x-2 h-10">
{#if service?.fqdn} {#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 <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6" class="h-6 w-6"

View File

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