forked from cerc-io/snowballtools-base
Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"id": 1,
|
||||
"projectid": 1,
|
||||
"name": "randomurl.snowballtools.xyz",
|
||||
"name": "example.snowballtools.xyz",
|
||||
"status": "live",
|
||||
"record": null,
|
||||
"isRedirectedto": false
|
||||
@@ -10,7 +10,7 @@
|
||||
{
|
||||
"id": 2,
|
||||
"projectid": 1,
|
||||
"name": "saugatt.com",
|
||||
"name": "example.org",
|
||||
"status": "pending",
|
||||
"record": {
|
||||
"type": "A",
|
||||
@@ -22,7 +22,7 @@
|
||||
{
|
||||
"id": 3,
|
||||
"projectid": 1,
|
||||
"name": "www.saugatt.com",
|
||||
"name": "www.example.org",
|
||||
"status": "pending",
|
||||
"record": {
|
||||
"type": "CNAME",
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
[
|
||||
{
|
||||
"name": "Saugat Yadav",
|
||||
"email": "saugaty@airfoil.studio",
|
||||
"id": 1
|
||||
},
|
||||
{
|
||||
"name": "Gideon Low",
|
||||
"email": "gideonl@airfoil.studio",
|
||||
"id": 2
|
||||
},
|
||||
{
|
||||
"name": "Sushan Yadav",
|
||||
"email": "sushany@airfoil.studio",
|
||||
"id": 3
|
||||
}
|
||||
]
|
||||
@@ -1,6 +1,6 @@
|
||||
[
|
||||
"[20:50:03.502] Running build in Washington, D.C., USA (East) – iad1",
|
||||
"[20:50:03.641] Cloning github.com/saugatyadav11/nextjs2 (Branch: main, Commit: 4a5f47f)",
|
||||
"[20:50:03.641] Cloning github.com/cerc-io/nextjs2 (Branch: main, Commit: 4a5f47f)",
|
||||
"[20:50:04.004] Previous build cache not available",
|
||||
"[20:50:04.118] Cloning completed: 480.574ms",
|
||||
"[20:50:04.382] Running 'vercel build'",
|
||||
|
||||
@@ -1,190 +0,0 @@
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"icon": "^",
|
||||
"name": "iglootools",
|
||||
"title": "Iglootools",
|
||||
"domain": null,
|
||||
"organization": "Airfoil",
|
||||
"url": "iglootools.co",
|
||||
"createdAt": "2023-12-07T04:20:00",
|
||||
"createdBy": "Alice",
|
||||
"deployment": "iglootools.snowballtools.co",
|
||||
"source": "feature/add-remote-control",
|
||||
"latestCommit": {
|
||||
"message": "subscription added",
|
||||
"createdAt": "2023-12-11T04:20:00",
|
||||
"branch": "main"
|
||||
},
|
||||
"repositoryId": 1,
|
||||
"members": [
|
||||
{
|
||||
"id": 1,
|
||||
"permissions": []
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"permissions": ["view", "edit"]
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"permissions": ["view"]
|
||||
}
|
||||
],
|
||||
"ownerId": 1
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"icon": "^",
|
||||
"name": "snowball-starter-kit",
|
||||
"title": "Snowball Starter Kit",
|
||||
"domain": null,
|
||||
"organization": "Snowball",
|
||||
"url": "starterkit.snowballtools.com",
|
||||
"createdAt": "2023-12-04T04:20:00",
|
||||
"createdBy": "Bob",
|
||||
"deployment": "deploy.snowballtools.com",
|
||||
"source": "prod/add-docker-compose",
|
||||
"latestCommit": {
|
||||
"message": "component updates",
|
||||
"createdAt": "2023-12-11T04:20:00",
|
||||
"branch": "staging"
|
||||
},
|
||||
"repositoryId": 1,
|
||||
"members": [
|
||||
{
|
||||
"id": 2,
|
||||
"permissions": []
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"permissions": ["view"]
|
||||
}
|
||||
],
|
||||
"ownerId": 2
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"icon": "^",
|
||||
"name": "web3-android",
|
||||
"title": "Web3 Android",
|
||||
"domain": null,
|
||||
"organization": "Personal",
|
||||
"url": "web3fordroids.com",
|
||||
"createdAt": "2023-12-01T04:20:00",
|
||||
"createdBy": "Charlie",
|
||||
"deployment": "deploy.web3fordroids.com",
|
||||
"source": "dev/style-page",
|
||||
"latestCommit": {
|
||||
"message": "No repo connected",
|
||||
"createdAt": "2023-12-01T04:20:00",
|
||||
"branch": "main"
|
||||
},
|
||||
"repositoryId": 1,
|
||||
"members": [
|
||||
{
|
||||
"id": 1,
|
||||
"permissions": []
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"permissions": ["view", "edit"]
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"permissions": ["view"]
|
||||
}
|
||||
],
|
||||
"ownerId": 1
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"icon": "^",
|
||||
"name": "passkeys-demo",
|
||||
"title": "Passkeys Demo",
|
||||
"domain": null,
|
||||
"organization": "Airfoil",
|
||||
"url": "passkeys.iglootools.xyz",
|
||||
"createdAt": "2023-12-01T04:20:00",
|
||||
"createdBy": "David",
|
||||
"deployment": "demo.passkeys.xyz",
|
||||
"source": "dev/style-page",
|
||||
"latestCommit": {
|
||||
"message": "hello world",
|
||||
"createdAt": "2023-12-01T04:20:00",
|
||||
"branch": "main"
|
||||
},
|
||||
"repositoryId": 1,
|
||||
"members": [
|
||||
{
|
||||
"id": 1,
|
||||
"permissions": []
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"permissions": ["view", "edit"]
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"permissions": ["view"]
|
||||
}
|
||||
],
|
||||
"ownerId": 1
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"icon": "^",
|
||||
"name": "iglootools",
|
||||
"title": "Iglootools",
|
||||
"domain": null,
|
||||
"organization": "Airfoil",
|
||||
"url": "iglootools.xyz",
|
||||
"createdAt": "2023-12-11T04:20:00",
|
||||
"createdBy": "Erin",
|
||||
"deployment": "staging.snowballtools.com",
|
||||
"source": "prod/fix-error",
|
||||
"latestCommit": {
|
||||
"message": "404 added",
|
||||
"createdAt": "2023-12-09T04:20:00",
|
||||
"branch": "main"
|
||||
},
|
||||
"repositoryId": 1,
|
||||
"members": [
|
||||
{
|
||||
"id": 3,
|
||||
"permissions": []
|
||||
}
|
||||
],
|
||||
"ownerId": 3
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"icon": "^",
|
||||
"name": "iglootools",
|
||||
"title": "Iglootools",
|
||||
"domain": null,
|
||||
"organization": "Airfoil",
|
||||
"url": "iglootools.xyz",
|
||||
"createdAt": "2023-12-11T04:20:00",
|
||||
"createdBy": "Frank",
|
||||
"deployment": "iglootools.snowballtools.com",
|
||||
"source": "prod/fix-error",
|
||||
"latestCommit": {
|
||||
"message": "design system integrated",
|
||||
"createdAt": "2023-12-09T04:20:00",
|
||||
"branch": "prod"
|
||||
},
|
||||
"repositoryId": 1,
|
||||
"members": [
|
||||
{
|
||||
"id": 2,
|
||||
"permissions": []
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"permissions": ["view"]
|
||||
}
|
||||
],
|
||||
"ownerId": 2
|
||||
}
|
||||
]
|
||||
@@ -3,11 +3,12 @@ import { Octokit } from 'octokit';
|
||||
import assert from 'assert';
|
||||
import { useDebounce } from 'usehooks-ts';
|
||||
|
||||
import { Button, Typography, Option, Select } from '@material-tailwind/react';
|
||||
import { Button, Typography, Option } from '@material-tailwind/react';
|
||||
|
||||
import SearchBar from '../../SearchBar';
|
||||
import ProjectRepoCard from './ProjectRepoCard';
|
||||
import { GitOrgDetails, GitRepositoryDetails } from '../../../types';
|
||||
import AsyncSelect from '../../shared/AsyncSelect';
|
||||
|
||||
const DEFAULT_SEARCHED_REPO = '';
|
||||
const REPOS_PER_PAGE = 5;
|
||||
@@ -109,8 +110,7 @@ const RepositoryList = ({ octokit }: RepositoryListProps) => {
|
||||
<div className="p-4">
|
||||
<div className="flex gap-2 mb-2">
|
||||
<div className="basis-1/3">
|
||||
{/* TODO: Fix selection of Git user at start */}
|
||||
<Select
|
||||
<AsyncSelect
|
||||
value={selectedAccount}
|
||||
onChange={(value) => setSelectedAccount(value!)}
|
||||
>
|
||||
@@ -119,7 +119,7 @@ const RepositoryList = ({ octokit }: RepositoryListProps) => {
|
||||
^ {account.login}
|
||||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
</AsyncSelect>
|
||||
</div>
|
||||
<div className="basis-2/3">
|
||||
<SearchBar
|
||||
|
||||
+5
-7
@@ -90,7 +90,9 @@ const DeploymentDetailsCard = ({
|
||||
<div className="grid grid-cols-4 gap-2 border-b border-gray-300 p-3 my-2">
|
||||
<div className="col-span-2">
|
||||
<div className="flex">
|
||||
<Typography className=" basis-3/4">{deployment.url}</Typography>
|
||||
{deployment.url && (
|
||||
<Typography className=" basis-3/4">{deployment.url}</Typography>
|
||||
)}
|
||||
<Chip
|
||||
value={deployment.status}
|
||||
color={STATUS_COLORS[deployment.status] ?? 'gray'}
|
||||
@@ -120,12 +122,8 @@ const DeploymentDetailsCard = ({
|
||||
<button className="self-start">...</button>
|
||||
</MenuHandler>
|
||||
<MenuList>
|
||||
<a
|
||||
href={'https://' + deployment.url}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
<MenuItem>^ Visit</MenuItem>
|
||||
<a href={deployment.url} target="_blank" rel="noreferrer">
|
||||
<MenuItem disabled={!Boolean(deployment.url)}>^ Visit</MenuItem>
|
||||
</a>
|
||||
<MenuItem
|
||||
onClick={() => setAssignDomainDialog(!assignDomainDialog)}
|
||||
|
||||
+5
-3
@@ -28,9 +28,11 @@ const DeploymentDialogBodyCard = ({
|
||||
color={chip.color}
|
||||
/>
|
||||
)}
|
||||
<Typography variant="small" className="text-black">
|
||||
{deployment.url}
|
||||
</Typography>
|
||||
{deployment.url && (
|
||||
<Typography variant="small" className="text-black">
|
||||
{deployment.url}
|
||||
</Typography>
|
||||
)}
|
||||
<Typography variant="small">
|
||||
^ {deployment.branch} ^{' '}
|
||||
{deployment.commitHash.substring(0, SHORT_COMMIT_HASH_LENGTH)}{' '}
|
||||
|
||||
@@ -12,7 +12,6 @@ import {
|
||||
Card,
|
||||
} from '@material-tailwind/react';
|
||||
|
||||
import { RepositoryDetails } from '../../../../types';
|
||||
import ConfirmDialog from '../../../shared/ConfirmDialog';
|
||||
import EditDomainDialog from './EditDomainDialog';
|
||||
import { useGQLClient } from '../../../../context/GQLClientContext';
|
||||
@@ -27,7 +26,7 @@ enum RefreshStatus {
|
||||
interface DomainCardProps {
|
||||
domains: Domain[];
|
||||
domain: Domain;
|
||||
repo: RepositoryDetails;
|
||||
branches: string[];
|
||||
project: Project;
|
||||
onUpdate: () => Promise<void>;
|
||||
}
|
||||
@@ -44,7 +43,7 @@ const DOMAIN_RECORD = {
|
||||
const DomainCard = ({
|
||||
domains,
|
||||
domain,
|
||||
repo,
|
||||
branches,
|
||||
project,
|
||||
onUpdate,
|
||||
}: DomainCardProps) => {
|
||||
@@ -188,7 +187,7 @@ const DomainCard = ({
|
||||
domains={domains}
|
||||
open={editDialogOpen}
|
||||
domain={domain}
|
||||
repo={repo}
|
||||
branches={branches}
|
||||
onUpdate={onUpdate}
|
||||
/>
|
||||
</>
|
||||
|
||||
@@ -15,7 +15,6 @@ import {
|
||||
Option,
|
||||
} from '@material-tailwind/react';
|
||||
|
||||
import { RepositoryDetails } from '../../../../types';
|
||||
import { useGQLClient } from '../../../../context/GQLClientContext';
|
||||
|
||||
const DEFAULT_REDIRECT_OPTIONS = ['none'];
|
||||
@@ -25,7 +24,7 @@ interface EditDomainDialogProp {
|
||||
open: boolean;
|
||||
handleOpen: () => void;
|
||||
domain: Domain;
|
||||
repo: RepositoryDetails;
|
||||
branches: string[];
|
||||
onUpdate: () => Promise<void>;
|
||||
}
|
||||
|
||||
@@ -40,7 +39,7 @@ const EditDomainDialog = ({
|
||||
open,
|
||||
handleOpen,
|
||||
domain,
|
||||
repo,
|
||||
branches,
|
||||
onUpdate,
|
||||
}: EditDomainDialogProp) => {
|
||||
const client = useGQLClient();
|
||||
@@ -120,7 +119,7 @@ const EditDomainDialog = ({
|
||||
branch: domain.branch,
|
||||
redirectedTo: getRedirectUrl(domain),
|
||||
});
|
||||
}, [domain, repo]);
|
||||
}, [domain]);
|
||||
|
||||
return (
|
||||
<Dialog open={open} handler={handleOpen}>
|
||||
@@ -166,9 +165,13 @@ const EditDomainDialog = ({
|
||||
<Input
|
||||
crossOrigin={undefined}
|
||||
{...register('branch', {
|
||||
validate: (value) => repo.branch.includes(value),
|
||||
validate: (value) =>
|
||||
Boolean(branches.length) ? branches.includes(value) : true,
|
||||
})}
|
||||
disabled={watch('redirectedTo') !== DEFAULT_REDIRECT_OPTIONS[0]}
|
||||
disabled={
|
||||
!Boolean(branches.length) ||
|
||||
watch('redirectedTo') !== DEFAULT_REDIRECT_OPTIONS[0]
|
||||
}
|
||||
/>
|
||||
{!isValid && (
|
||||
<Typography variant="small" className="text-red-500">
|
||||
|
||||
@@ -14,13 +14,13 @@ import { useGQLClient } from './GQLClientContext';
|
||||
const UNAUTHORIZED_ERROR_CODE = 401;
|
||||
|
||||
interface ContextValue {
|
||||
octokit: Octokit | null;
|
||||
octokit: Octokit;
|
||||
isAuth: boolean;
|
||||
updateAuth: () => void;
|
||||
}
|
||||
|
||||
const OctokitContext = createContext<ContextValue>({
|
||||
octokit: null,
|
||||
octokit: new Octokit(),
|
||||
isAuth: false,
|
||||
updateAuth: () => {},
|
||||
});
|
||||
|
||||
@@ -24,7 +24,7 @@ const NewProject = () => {
|
||||
})}
|
||||
</div>
|
||||
<h5 className="mt-4 ml-4">Import a repository</h5>
|
||||
<RepositoryList octokit={octokit!} />
|
||||
<RepositoryList octokit={octokit} />
|
||||
</>
|
||||
) : (
|
||||
<ConnectAccount onAuth={updateAuth} />
|
||||
|
||||
@@ -66,8 +66,10 @@ const DeploymentsTabPanel = () => {
|
||||
|
||||
const dateMatch =
|
||||
!filterValue.updateAtRange ||
|
||||
(new Date(deployment.updatedAt) >= filterValue.updateAtRange!.from! &&
|
||||
new Date(deployment.updatedAt) <= filterValue.updateAtRange!.to!);
|
||||
(new Date(Number(deployment.createdAt)) >=
|
||||
filterValue.updateAtRange!.from! &&
|
||||
new Date(Number(deployment.createdAt)) <=
|
||||
filterValue.updateAtRange!.to!);
|
||||
|
||||
return branchMatch && statusMatch && dateMatch;
|
||||
});
|
||||
|
||||
@@ -24,10 +24,6 @@ const OverviewTabPanel = () => {
|
||||
const { project } = useOutletContext<OutletContextType>();
|
||||
|
||||
useEffect(() => {
|
||||
if (!octokit) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Save repo commits in DB and avoid using GitHub API in frontend
|
||||
// TODO: Figure out fetching latest commits for all branches
|
||||
const fetchRepoActivity = async () => {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { RequestError } from 'octokit';
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import { Link, useOutletContext } from 'react-router-dom';
|
||||
import { Domain } from 'gql-client';
|
||||
|
||||
@@ -6,14 +7,41 @@ import { Button, Typography } from '@material-tailwind/react';
|
||||
|
||||
import DomainCard from '../../../../../components/projects/project/settings/DomainCard';
|
||||
import { useGQLClient } from '../../../../../context/GQLClientContext';
|
||||
import repositories from '../../../../../assets/repositories.json';
|
||||
import { OutletContextType } from '../../../../../types';
|
||||
import { useOctokit } from '../../../../../context/OctokitContext';
|
||||
|
||||
const Domains = () => {
|
||||
const client = useGQLClient();
|
||||
const { octokit } = useOctokit();
|
||||
const { project } = useOutletContext<OutletContextType>();
|
||||
|
||||
const [domains, setDomains] = useState<Domain[]>([]);
|
||||
const [branches, setBranches] = useState<string[]>([]);
|
||||
|
||||
const fetchBranches = useCallback(async () => {
|
||||
const [owner, repo] = project.repository.split('/');
|
||||
|
||||
try {
|
||||
const result = await octokit.rest.repos.listBranches({
|
||||
owner,
|
||||
repo,
|
||||
});
|
||||
|
||||
const branches = result.data.map((repo) => repo.name);
|
||||
|
||||
setBranches(branches);
|
||||
} catch (err) {
|
||||
if (!(err instanceof RequestError && err.status === 404)) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
console.error(err);
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
fetchBranches();
|
||||
}, []);
|
||||
|
||||
const fetchDomains = async () => {
|
||||
if (project === undefined) {
|
||||
@@ -46,7 +74,7 @@ const Domains = () => {
|
||||
domain={domain}
|
||||
key={domain.id}
|
||||
// TODO: Use github API for getting linked repository
|
||||
repo={repositories[0]!}
|
||||
branches={branches}
|
||||
project={project}
|
||||
onUpdate={fetchDomains}
|
||||
/>
|
||||
|
||||
@@ -171,7 +171,8 @@ export const EnvironmentVariablesTabPanel = () => {
|
||||
>
|
||||
+ Add variable
|
||||
</Button>
|
||||
<Button variant="outlined" size="sm">
|
||||
{/* TODO: Implement import environment varible functionality */}
|
||||
<Button variant="outlined" size="sm" disabled>
|
||||
^ Import .env
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -6,15 +6,6 @@ export interface GitOrgDetails {
|
||||
avatar_url: string;
|
||||
}
|
||||
|
||||
// TODO: Use GitRepositoryDetails
|
||||
export interface RepositoryDetails {
|
||||
title: string;
|
||||
updatedAt: string;
|
||||
user: string;
|
||||
private: boolean;
|
||||
branch: string[];
|
||||
}
|
||||
|
||||
export interface GitRepositoryDetails {
|
||||
id: number;
|
||||
name: string;
|
||||
|
||||
Reference in New Issue
Block a user