Skip to content

Commit

Permalink
Merge pull request #53 from fluentci-io/feat/project-tags
Browse files Browse the repository at this point in the history
feat(graphql): add queries to edit project description and tags
  • Loading branch information
tsirysndr authored Jun 29, 2024
2 parents 4646689 + 4ca625a commit 4deded8
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 7 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ Requirements:

**Latest (Desktop):**

- `Mac`: arm64: [fluentci-studio_v0.1.4_arm64.dmg](https://github.com/fluentci-io/fluentci-studio/releases/download/v0.1.4/fluentci-studio_v0.1.4_arm64.dmg) intel: [fluentci-studio_v0.1.4_x64.dmg](https://github.com/fluentci-io/fluentci-studio/releases/download/v0.1.4/fluentci-studio_v0.1.4_x64.dmg)
- `Linux`: [fluentci-studio_v0.1.4.AppImage](https://github.com/fluentci-io/fluentci-studio/releases/download/v0.1.4/fluentci-studio_v0.1.4.AppImage)
- `Mac`: arm64: [fluentci-studio_v0.1.5_arm64.dmg](https://github.com/fluentci-io/fluentci-studio/releases/download/v0.1.5/fluentci-studio_v0.1.5_arm64.dmg) intel: [fluentci-studio_v0.1.5_x64.dmg](https://github.com/fluentci-io/fluentci-studio/releases/download/v0.1.5/fluentci-studio_v0.1.5_x64.dmg)
- `Linux`: [fluentci-studio_v0.1.5.AppImage](https://github.com/fluentci-io/fluentci-studio/releases/download/v0.1.5/fluentci-studio_v0.1.5.AppImage)

**Latest (CLI):**

Expand Down Expand Up @@ -110,7 +110,7 @@ fluentci studio
fluentci --help

Usage: fluentci [pipeline] [jobs...]
Version: 0.15.0
Version: 0.15.1

Description:

Expand Down
6 changes: 6 additions & 0 deletions src/cmd/upgrade.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { VERSION } from "../consts.ts";
import { gray, green, semver, yellow } from "../../deps.ts";
import { setupFluentCIStudio, setupFluentCIengine } from "../utils.ts";

/**
* Upgrades FluentCI by installing the latest version from the Deno registry.
Expand All @@ -18,6 +19,11 @@ async function upgrade() {
return;
}

Deno.env.set("FORCE_FLUENTCI_STUDIO_INSTALL", "1");
Deno.env.set("FORCE_FLUENTCI_ENGINE_INSTALL", "1");
await setupFluentCIengine();
await setupFluentCIStudio();

const command = new Deno.Command("deno", {
args: [
"install",
Expand Down
2 changes: 1 addition & 1 deletion src/consts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { dir } from "../deps.ts";
export const VERSION = "0.15.0";
export const VERSION = "0.15.1";

export const BASE_URL = "https://api.fluentci.io/v1";

Expand Down
9 changes: 9 additions & 0 deletions src/server/graphql/objects/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ export class Project {
id: string;
path: string;
name: string;
displayName?: string | null;
description?: string | null;
tags?: string[] | null;
createdAt: string;
logs?: Log;
cursor?: string;
Expand All @@ -19,6 +22,9 @@ export class Project {
id,
path,
name,
displayName,
description,
tags,
createdAt,
logs,
cursor,
Expand All @@ -32,6 +38,9 @@ export class Project {
this.id = id;
this.path = path;
this.name = name;
this.displayName = displayName;
this.description = description;
this.tags = tags;
this.createdAt = createdAt;
this.logs = logs;
this.cursor = cursor;
Expand Down
25 changes: 25 additions & 0 deletions src/server/graphql/resolvers/project/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,28 @@ export async function createProject(
picture: `https://img.icons8.com/color-glass/96/${icon}.png`,
});
}

export async function updateProject(
root: any,
args: any,
ctx: Context
): Promise<Project | null> {
const project = await ctx.kv.projects.get(args.id);

if (!project) {
return null;
}

const tags = _.get(args, "tags", "")
.split(",")
.map((x: string) => x.trim());

await ctx.kv.projects.save({
...project,
displayName: args.name,
description: args.description,
tags,
});

return ctx.kv.projects.get(args.id);
}
20 changes: 17 additions & 3 deletions src/server/graphql/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
getProjects,
} from "./resolvers/project/queries.ts";
import { runJob } from "./resolvers/job/mutations.ts";
import { createProject } from "./resolvers/project/mutations.ts";
import { createProject, updateProject } from "./resolvers/project/mutations.ts";
import { runPipeline } from "./resolvers/run/mutations.ts";
import { countRuns, getRun, getRuns } from "./resolvers/run/queries.ts";
import { Run } from "./objects/run.ts";
Expand Down Expand Up @@ -52,11 +52,14 @@ builder.objectType(Log, {

builder.objectType(Project, {
name: "Project",
description: "A project is a collection of actions.",
description: "A project is a collection of projects.",
fields: (t) => ({
id: t.exposeID("id"),
path: t.exposeString("path"),
path: t.exposeString("path", { nullable: true }),
name: t.exposeString("name"),
displayName: t.exposeString("displayName", { nullable: true }),
description: t.exposeString("description", { nullable: true }),
tags: t.exposeStringList("tags", { nullable: true }),
createdAt: t.exposeString("createdAt"),
logs: t.field({
type: Log,
Expand Down Expand Up @@ -228,6 +231,17 @@ builder.mutationType({
type: Project,
resolve: createProject,
}),
updateProject: t.field({
type: Project,
nullable: true,
args: {
id: t.arg.id({ required: true }),
name: t.arg.string({ required: false }),
description: t.arg.string({ required: false }),
tags: t.arg.string({ required: false }),
},
resolve: updateProject,
}),
runPipeline: t.field({
type: Run,
args: {
Expand Down

0 comments on commit 4deded8

Please sign in to comment.