Skip to content

Commit

Permalink
Merge pull request #3630 from KBVE/alpha
Browse files Browse the repository at this point in the history
Preparing Beta Branch
  • Loading branch information
h0lybyte authored Dec 26, 2024
2 parents 871ffdf + f425a1c commit 8eaa076
Show file tree
Hide file tree
Showing 10 changed files with 737 additions and 53 deletions.
3 changes: 2 additions & 1 deletion apps/kbve.com/src/content/journal/12-24.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ import { Adsense, Tasks } from '@kbve/astropad';
./kbve.sh -nx kilobase:seal --namespace=kanban --keyName=aws-config --secrets=AWS_ACCESS_KEY_I
```


The deployment went well and we got the configurations through without any issues!
Now we can switch back to the react code and figure out how to talk to the main api.
40 changes: 40 additions & 0 deletions apps/kbve.com/src/content/journal/12-25.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
title: 'Decemeber: 25th'
category: Daily
date: 2024-12-25 12:00:00
client: Self
unsplash: 1511512578047-dfb367046420
img: https://images.unsplash.com/photo-1511512578047-dfb367046420?crop=entropy&cs=srgb&fm=jpg&ixid=MnwzNjM5Nzd8MHwxfHJhbmRvbXx8fHx8fHx8fDE2ODE3NDg2ODY&ixlib=rb-4.0.3&q=85
description: Decemeber 25th.
tags:
- daily
---

import { Adsense, Tasks } from '@kbve/astropad';

## 2024

- 04:14AM

**Kanban**

Okay! We are almost done with the generic or well base kanban board.
Getting it all operational is the goal for today, then I will shift over to adding additional features.
Okay we need to push forward with some of the minor updates and get the new docker image built out!
Let me move the rust and react code up for now and loop back around, hopefully resolving the CORS issue.
The docker image of 1.02 was published, so now I am going to update the helm chart and have it deploy the new one.

- 07:33AM

**React**

Okay we got the communication between the kanban and the react component going, now we just need to figure out how to maintain that easy flow.
Right now its not pulling the right data from the api state, so I am going to focus on resolving that next.

- 02:21PM

**MerryXMas**

Happy holidays!
Forgot to include that in my notes, xD
I am thinking of redoing the whole kanban system to help keep track of the notes a bit better, maybe even expanding the item collection that would be involved.
39 changes: 39 additions & 0 deletions apps/kbve.com/src/content/journal/12-26.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: 'Decemeber: 26th'
category: Daily
date: 2024-12-26 12:00:00
client: Self
unsplash: 1511512578047-dfb367046420
img: https://images.unsplash.com/photo-1511512578047-dfb367046420?crop=entropy&cs=srgb&fm=jpg&ixid=MnwzNjM5Nzd8MHwxfHJhbmRvbXx8fHx8fHx8fDE2ODE3NDg2ODY&ixlib=rb-4.0.3&q=85
description: Decemeber 26th.
tags:
- daily
---

import { Adsense, Tasks } from '@kbve/astropad';

## 2024

- 09:30AM

**SPY**

$600 for SPY!? This is great!

- 01:05PM

**Items**

The plan is to rework the kanban data structure, so that we can expand upon it.
Once the basic saving, loading and notes are done, we can move forward with adding in the AI tools around it.
If everything can get up and running, we can move back around to the AStar pathfinding in unity.
Okay the new docker image should start the build and now I am going to update the helm chart.\


- 01:34PM

**GitOps**

We need the unity game also running, so lets go back around and make sure that rareicon game server is up and running.
To get the gameserver up and running, we need to include the repo URL, which is `https://github.com/KBVE/kbve.git` and the branch is `dev`.
Then enable self-healing and add the path, `/migrations/kube/charts/rareicon` and we should have the gameserver up and running for rareicon.
140 changes: 139 additions & 1 deletion apps/kbve.com/src/engine/kanban/KanbanBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export class KanbanBase extends Kilobase {
Record<string, { id: string; container: string }[]>
>;

private boardIdStore: WritableAtom<string | null>;

constructor() {
super();

Expand All @@ -27,6 +29,16 @@ export class KanbanBase extends Kilobase {
decode: JSON.parse,
},
);

// Persistent store for the current board_id
this.boardIdStore = persistentAtom<string | null>(
'kanBanBoardId',
null,
{
encode: JSON.stringify,
decode: JSON.parse,
},
);
}

/**
Expand Down Expand Up @@ -71,8 +83,134 @@ export class KanbanBase extends Kilobase {
console.log('Item positions reset to:', resetPositions);
}

/**
* Load board data by board_id from the API.
* Saves the fetched data to local storage.
* @param boardId - The board_id to load data for.
* @returns Promise<Record<string, { id: string; container: string }[]> | null> - The board data if found, or null if not found.
*/
async loadBoardData(
boardId: string,
): Promise<Record<string, { id: string; container: string }[]> | null> {
try {
const response = await fetch(
`https://kanban.kbve.com/api/get_board`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ board_id: boardId }),
},
);

if (!response.ok) {
console.error(
`Failed to fetch board data for board ID: ${boardId}`,
);
return null;
}

const result = await response.json();

if (
result &&
typeof result === 'object' &&
'todo' in result &&
'in_progress' in result &&
'done' in result &&
'unassigned' in result &&
'metadata' in result &&
'actions' in result
) {
// Save to local storage
const formattedResult = {
TODO: result.todo || [],
'IN-PROGRESS': result.in_progress || [],
DONE: result.done || [],
UNASSIGNED: result.unassigned || [],
};


this.itemPositionsStore.set(formattedResult);
console.log(
`Loaded and saved board data for board ID: ${boardId}`,
);

// Optionally, you could handle metadata and actions separately if needed
console.log('Metadata:', result.metadata);
console.log('Actions:', result.actions);

return formattedResult;
}

console.error(
`Invalid board data structure for board ID: ${boardId}`,
);
return null;
} catch (error) {
console.error('Error loading board data:', error);
return null;
}
}

/**
* Save board data by board_id.
* @param boardId - The board_id to save data for.
* @param data - The Kanban data to save.
* @returns Promise<void>
*/
async saveBoardData(
boardId: string,
data: Record<string, { id: string; container: string }[]>,
): Promise<void> {
try {
const currentPositions = this.itemPositionsStore.get();

// Ensure data structure matches what the API expects

const formattedData = {
board_id: boardId,
todo: currentPositions.TODO || [],
in_progress: currentPositions['IN-PROGRESS'] || [],
done: currentPositions.DONE || [],
};
console.log('Saving to API with data:', formattedData);

// Save to the API
const response = await fetch(
`https://kanban.kbve.com/api/save_board`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(formattedData),
},
);

if (!response.ok) {
throw new Error('Failed to save board data to API');
}

console.log(`Saved board data to API for ${boardId}`);
} catch (error) {
console.error('Error saving board data:', error);
throw error;
}
}

/**
* Validate the board_id by attempting to load its data.
* @param boardId - The board_id to validate.
* @returns Promise<boolean> - True if the board_id is valid, false otherwise.
*/
async validateBoardId(boardId: string): Promise<boolean> {
const boardData = await this.loadBoardData(boardId);

if (boardData) {
console.log('Validation passed for board ID:', boardId);
return true;
}

console.error('Validation failed for board ID:', boardId);
return false;
}
}

// Export a singleton instance of the extended class for use throughout the application
Expand Down
Loading

0 comments on commit 8eaa076

Please sign in to comment.