Compare commits

...

7 Commits

Author SHA1 Message Date
Andras Bacsai
48a877f160 Merge pull request #725 from coollabsio/next
v3.11.7
2022-11-11 13:33:57 +01:00
Andras Bacsai
cea894a8bd fix: dashboard error 2022-11-11 13:28:37 +01:00
Andras Bacsai
087e7b9311 Merge pull request #724 from coollabsio/next
v3.11.6
2022-11-11 11:58:46 +01:00
Andras Bacsai
39ba498293 ui: fix 2022-11-11 10:39:01 +01:00
Andras Bacsai
fe7390bd4d fix: update on mobile 2022-11-11 10:38:30 +01:00
Andras Bacsai
75af551435 ui: secrets on apps 2022-11-11 09:33:45 +01:00
Andras Bacsai
ae2d3ebb48 fix: no tags error 2022-11-11 09:25:02 +01:00
11 changed files with 127 additions and 62 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.5'; 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('.');
@@ -22,15 +27,22 @@ const compareSemanticVersions = (a: string, b: string) => {
return b1.length - a1.length; return b1.length - a1.length;
}; };
export async function getTags(type: string) { export async function getTags(type: string) {
if (type) {
const tagsPath = isDev ? './tags.json' : '/app/tags.json'; try {
const data = await fs.readFile(tagsPath, 'utf8') if (type) {
let tags = JSON.parse(data) const tagsPath = isDev ? './tags.json' : '/app/tags.json';
if (tags) { const data = await fs.readFile(tagsPath, 'utf8')
tags = tags.find((tag: any) => tag.name.includes(type)) let tags = JSON.parse(data)
tags.tags = tags.tags.sort(compareSemanticVersions).reverse(); if (tags) {
return tags tags = tags.find((tag: any) => tag.name.includes(type))
tags.tags = tags.tags.sort(compareSemanticVersions).reverse();
return tags
}
} }
} catch (error) {
return []
} }
return []
} }

View File

@@ -34,7 +34,7 @@ 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 });
const arm = isARM(process.arch); const arm = isARM(service.arch);
const { type, destinationDockerId, destinationDocker, persistentStorage, exposePort } = const { type, destinationDockerId, destinationDocker, persistentStorage, exposePort } =
service; service;
@@ -128,7 +128,6 @@ export async function startService(request: FastifyRequest<ServiceStartStop>, fa
labels: makeLabelForServices(type), labels: makeLabelForServices(type),
...defaultComposeConfiguration(network), ...defaultComposeConfiguration(network),
} }
console.log(config[s].image)
// Generate files for builds // Generate files for builds
if (template.services[s]?.files?.length > 0) { if (template.services[s]?.files?.length > 0) {

View File

@@ -1,7 +1,14 @@
<script lang="ts"> <script lang="ts">
import { dev } from '$app/env'; import { dev } from '$app/env';
import { get, post } from '$lib/api'; import { get, post } from '$lib/api';
import { addToast, appSession, features, updateLoading, isUpdateAvailable } from '$lib/store'; import {
addToast,
appSession,
features,
updateLoading,
isUpdateAvailable,
latestVersion
} from '$lib/store';
import { asyncSleep, errorNotification } from '$lib/common'; import { asyncSleep, errorNotification } from '$lib/common';
import { onMount } from 'svelte'; import { onMount } from 'svelte';
import Tooltip from './Tooltip.svelte'; import Tooltip from './Tooltip.svelte';
@@ -11,17 +18,17 @@
loading: false, loading: false,
success: null success: null
}; };
let latestVersion = 'latest';
async function update() { async function update() {
updateStatus.loading = true; updateStatus.loading = true;
try { try {
if (dev) { if (dev) {
localStorage.setItem('lastVersion', $appSession.version); localStorage.setItem('lastVersion', $appSession.version);
await asyncSleep(1000); await asyncSleep(1000);
updateStatus.loading = false;
return window.location.reload(); return window.location.reload();
} else { } else {
localStorage.setItem('lastVersion', $appSession.version); localStorage.setItem('lastVersion', $appSession.version);
await post(`/update`, { type: 'update', latestVersion }); await post(`/update`, { type: 'update', latestVersion: $latestVersion });
addToast({ addToast({
message: 'Update completed.<br><br>Waiting for the new version to start...', message: 'Update completed.<br><br>Waiting for the new version to start...',
type: 'success' type: 'success'
@@ -64,7 +71,7 @@
$updateLoading = true; $updateLoading = true;
const data = await get(`/update`); const data = await get(`/update`);
if (overrideVersion || data?.isUpdateAvailable) { if (overrideVersion || data?.isUpdateAvailable) {
latestVersion = overrideVersion || data.latestVersion; $latestVersion = overrideVersion || data.latestVersion;
if (overrideVersion) { if (overrideVersion) {
$isUpdateAvailable = true; $isUpdateAvailable = true;
} else { } else {
@@ -93,7 +100,7 @@
{#if updateStatus.loading} {#if updateStatus.loading}
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
class="lds-heart h-8 w-8" class="lds-heart h-8 w-8 mx-auto"
viewBox="0 0 24 24" viewBox="0 0 24 24"
stroke-width="1.5" stroke-width="1.5"
stroke="currentColor" stroke="currentColor"

View File

@@ -32,6 +32,7 @@ interface AddToast {
} }
export const updateLoading: Writable<boolean> = writable(false); export const updateLoading: Writable<boolean> = writable(false);
export const isUpdateAvailable: Writable<boolean> = writable(false); export const isUpdateAvailable: Writable<boolean> = writable(false);
export const latestVersion: Writable<string> = writable('latest');
export const search: any = writable('') export const search: any = writable('')
export const loginEmail: Writable<string | undefined> = writable() export const loginEmail: Writable<string | undefined> = writable()
export const appSession: Writable<AppSession> = writable({ export const appSession: Writable<AppSession> = writable({

View File

@@ -32,10 +32,10 @@
} }
</script> </script>
<div class="w-full font-bold grid grid-cols-1 lg:grid-cols-4 gap-2 pb-2"> <div class="w-full grid grid-cols-1 lg:grid-cols-4 gap-2 pb-2">
<div class="flex flex-col"> <div class="flex flex-col">
{#if index === 0 || length === 0} {#if index === 0 || length === 0}
<label for="name" class="pb-2 uppercase">name</label> <label for="name" class="pb-2 uppercase font-bold">name</label>
{/if} {/if}
<input <input
@@ -50,7 +50,7 @@
</div> </div>
<div class="flex flex-col"> <div class="flex flex-col">
{#if index === 0 || length === 0} {#if index === 0 || length === 0}
<label for="value" class="pb-2 uppercase">value</label> <label for="value" class="pb-2 uppercase font-bold">value</label>
{/if} {/if}
<CopyPasswordField <CopyPasswordField
@@ -63,9 +63,12 @@
</div> </div>
<div class="flex lg:flex-col flex-row justify-start items-center pt-3 lg:pt-0"> <div class="flex lg:flex-col flex-row justify-start items-center pt-3 lg:pt-0">
{#if index === 0 || length === 0} {#if index === 0 || length === 0}
<label for="name" class="pb-2 uppercase lg:block hidden">Need during buildtime?</label> <label for="name" class="pb-2 uppercase lg:block hidden font-bold"
>Need during buildtime?</label
>
{/if} {/if}
<label for="name" class="pb-2 uppercase lg:hidden block">Need during buildtime?</label> <label for="name" class="pb-2 uppercase lg:hidden block font-bold">Need during buildtime?</label
>
<div class="flex justify-center h-full items-center pt-0 lg:pt-0 pl-4 lg:pl-0"> <div class="flex justify-center h-full items-center pt-0 lg:pt-0 pl-4 lg:pl-0">
<button <button
@@ -114,7 +117,7 @@
</div> </div>
<div class="flex flex-row lg:flex-col lg:items-center items-start"> <div class="flex flex-row lg:flex-col lg:items-center items-start">
{#if index === 0 || length === 0} {#if index === 0 || length === 0}
<label for="name" class="pb-2 uppercase lg:block hidden">Actions</label> <label for="name" class="pb-5 uppercase lg:block hidden font-bold" />
{/if} {/if}
<div class="flex justify-center h-full items-center pt-3"> <div class="flex justify-center h-full items-center pt-3">

View File

@@ -79,10 +79,10 @@
} }
</script> </script>
<div class="w-full font-bold grid grid-cols-1 lg:grid-cols-4 gap-2 pb-2"> <div class="w-full grid grid-cols-1 lg:grid-cols-4 gap-2 pb-2">
<div class="flex flex-col"> <div class="flex flex-col">
{#if (index === 0 && !isNewSecret) || length === 0} {#if (index === 0 && !isNewSecret) || length === 0}
<label for="name" class="pb-2 uppercase">name</label> <label for="name" class="pb-2 uppercase font-bold">name</label>
{/if} {/if}
<input <input
@@ -101,7 +101,7 @@
</div> </div>
<div class="flex flex-col"> <div class="flex flex-col">
{#if (index === 0 && !isNewSecret) || length === 0} {#if (index === 0 && !isNewSecret) || length === 0}
<label for="value" class="pb-2 uppercase">value</label> <label for="value" class="pb-2 uppercase font-bold">value</label>
{/if} {/if}
<CopyPasswordField <CopyPasswordField
@@ -114,9 +114,12 @@
</div> </div>
<div class="flex lg:flex-col flex-row justify-start items-center pt-3 lg:pt-0"> <div class="flex lg:flex-col flex-row justify-start items-center pt-3 lg:pt-0">
{#if (index === 0 && !isNewSecret) || length === 0} {#if (index === 0 && !isNewSecret) || length === 0}
<label for="name" class="pb-2 uppercase lg:block hidden">Need during buildtime?</label> <label for="name" class="pb-2 uppercase lg:block hidden font-bold"
>Need during buildtime?</label
>
{/if} {/if}
<label for="name" class="pb-2 uppercase lg:hidden block">Need during buildtime?</label> <label for="name" class="pb-2 uppercase lg:hidden block font-bold">Need during buildtime?</label
>
<div class="flex justify-center h-full items-center pt-0 lg:pt-0 pl-4 lg:pl-0"> <div class="flex justify-center h-full items-center pt-0 lg:pt-0 pl-4 lg:pl-0">
<button <button
@@ -166,7 +169,7 @@
</div> </div>
<div class="flex flex-row lg:flex-col lg:items-center items-start"> <div class="flex flex-row lg:flex-col lg:items-center items-start">
{#if (index === 0 && !isNewSecret) || length === 0} {#if (index === 0 && !isNewSecret) || length === 0}
<label for="name" class="pb-2 uppercase lg:block hidden">Action</label> <label for="name" class="pb-5 uppercase lg:block hidden font-bold" />
{/if} {/if}
<div class="flex justify-center h-full items-center pt-3"> <div class="flex justify-center h-full items-center pt-3">

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

@@ -8,7 +8,7 @@
</script> </script>
{#if linkToDocs} {#if linkToDocs}
<DocLink url={template[service.id].documentation} text={`Documentation`} isExternal={true} /> <DocLink url={template[service.id]?.documentation || 'https://docs.coollabs.io'} text={`Documentation`} isExternal={true} />
{:else} {:else}
<ServiceIcons type={service.type} /> <ServiceIcons type={service.type} />
{/if} {/if}

View File

@@ -276,20 +276,25 @@
</div> </div>
<div class="grid grid-cols-2 items-center"> <div class="grid grid-cols-2 items-center">
<label for="version">Version / Tag</label> <label for="version">Version / Tag</label>
<div class="custom-select-wrapper w-full"> {#if tags.tags?.length > 0}
<Select <div class="custom-select-wrapper w-full">
form="saveForm" <Select
containerClasses={isDisabled && containerClass()} form="saveForm"
{isDisabled} containerClasses={isDisabled && containerClass()}
id="version" {isDisabled}
showIndicator={!isDisabled} id="version"
items={[...tags.tags]} showIndicator={!isDisabled}
on:select={selectTag} items={[...tags.tags]}
value={service.version} on:select={selectTag}
isClearable={false} value={service.version}
/> isClearable={false}
</div> />
</div>
{:else}
<input class="w-full border-red-500" disabled placeholder="Error getting tags...">
{/if}
</div> </div>
<div class="grid grid-cols-2 items-center"> <div class="grid grid-cols-2 items-center">
<label for="destination">{$t('application.destination')}</label> <label for="destination">{$t('application.destination')}</label>
<div> <div>

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.5", "version": "3.11.7",
"license": "Apache-2.0", "license": "Apache-2.0",
"repository": "github:coollabsio/coolify", "repository": "github:coollabsio/coolify",
"scripts": { "scripts": {