Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding static website application #2481

Merged
merged 20 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions packages/playground/public/info/static_website.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Static Website
zaelgohary marked this conversation as resolved.
Show resolved Hide resolved
---

Static Website is an application where a user provide a github repository url and it's automatically served using caddy. For more details, check [Static Website documentation](https://www.manual.grid.tf/documentation/dashboard/solutions/static_website.html).
6 changes: 6 additions & 0 deletions packages/playground/src/constants/deployment_list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ export const deploymentListEnvironments = {
CHAIN_ENDPOINT: "Chain Endpoint",
},

static_website: {
SSH_KEY: _ssh,
GITHUB_URL: "Cloned Repository URL",
zaelgohary marked this conversation as resolved.
Show resolved Hide resolved
ROOT: "HTML Directory",
},

taiga: {
SSH_KEY: _ssh,
DOMAIN_NAME: "Domain Name",
Expand Down
23 changes: 23 additions & 0 deletions packages/playground/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,29 @@ function createApplicationsRoutes(): RouteRecordRaw[] {
},
},
},

{
path: DashboardRoutes.Applications.StaticWebsite,
component: () => import("../views/staticwebsite_view.vue"),
meta: {
title: "Static Website",
info: { page: "info/static_website.md" },
navbarConfig: {
back: true,
path: [
{ title: "Deploy" },
{
title: "Applications",
disabled: false,
to: DashboardRoutes.Deploy.Applications,
},
{
title: "Static Website",
},
],
},
},
},
// Commented for now and will be user later.
// {
// path: DashboardRoutes.Applications.Freeflow,
Expand Down
1 change: 1 addition & 0 deletions packages/playground/src/router/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ enum OtherRoutes {
enum ApplicationRoutes {
BaseRoute = "/deploy/applications/",
Peertube = "/deploy/applications/peertube/",
StaticWebsite = "/deploy/applications/static_website/",
Funkwhale = "/deploy/applications/funkwhale/",
Mattermost = "/deploy/applications/mattermost/",
Discourse = "/deploy/applications/discourse/",
Expand Down
3 changes: 3 additions & 0 deletions packages/playground/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export enum ProjectName {
Qvm = "Qvm",
Umbrel = "Umbrel",
FreeFlow = "Freeflow",
StaticWebsite = "StaticWebsite",
}

export enum SolutionCode {
Expand All @@ -139,6 +140,7 @@ export enum SolutionCode {
qvm = "qvm",
umbrel = "um",
wordpress = "wp",
staticwebsite = "sw",
}

export const solutionType: { [key: string]: string } = {
Expand All @@ -161,6 +163,7 @@ export const solutionType: { [key: string]: string } = {
umbrel: "Umbrel",
vm: "Micro Virtual Machine",
wordpress: "Wordpress",
staticwebsite: "Static Website",
};

export interface solutionFlavor {
Expand Down
8 changes: 8 additions & 0 deletions packages/playground/src/utils/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ export function maxLength(msg: string, max: number) {
};
}

export function isGithubRepo(msg: string) {
return (value: string) => {
const githubRepoRegex = /^https:\/\/github\.com\/([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_-]+)\.git$/;
if (!githubRepoRegex.test(value)) {
return { message: msg };
}
};
}
export function equal(msg: string, length: number) {
return (value: string) => {
if (value.length !== length) {
Expand Down
7 changes: 7 additions & 0 deletions packages/playground/src/views/solutions_view.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ export default {
icon: "taiga.png",
route: DashboardRoutes.Applications.Taiga,
},
{
title: "Static Website",
excerpt:
"Static Website is an application where a user provides a Github repository url and it's automatically served using Caddy.",
icon: "static_website.png",
route: DashboardRoutes.Applications.StaticWebsite,
},
// {
// title: "Owncloud",
// excerpt:
Expand Down
26 changes: 26 additions & 0 deletions packages/playground/src/views/staticwebsite_view.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<template>
<view-layout>
<StaticWebsite />

<template #list>
<TfDeploymentList title="Static Website Instances" :project-name="name" />
</template>
</view-layout>
</template>

<script lang="ts">
import { ProjectName } from "../types";
import TfDeploymentList from "../weblets/tf_deployment_list.vue";
import StaticWebsite from "../weblets/tf_staticwebsite.vue";

export default {
name: "CaddyView",
components: {
StaticWebsite,
TfDeploymentList,
},
setup() {
return { name: ProjectName.StaticWebsite };
},
};
</script>
15 changes: 15 additions & 0 deletions packages/playground/src/weblets/tf_deployment_list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,20 @@
/>
</template>

<template #StaticWebsite-actions="{ item }">
<IconActionBtn
tooltip="Show Details"
icon="mdi-eye-outline"
@click="openDialog(tabs[activeTab].value, item)"
/>
<IconActionBtn
tooltip="Visit"
icon="mdi-web"
color="anchor"
:href="'https://' + item.value.env.STATICWEBSITE_DOMAIN"
maayarosama marked this conversation as resolved.
Show resolved Hide resolved
/>
</template>

<template #Algorand-actions="{ item }">
<IconActionBtn
tooltip="Show Details"
Expand Down Expand Up @@ -399,6 +413,7 @@ const tabs: Tab[] = [
{ title: "Umbrel", value: "Umbrel", imgPath: "images/icons/umbrel.png" },
{ title: "Freeflow", value: "Freeflow", imgPath: "images/icons/freeflow.png" },
{ title: "Wordpress", value: "Wordpress", imgPath: "images/icons/wordpress.png" },
{ title: "Static Website", value: "StaticWebsite", imgPath: "images/icons/wordpress.png" },
];

const profileManager = useProfileManager();
Expand Down
Loading
Loading