move to Git event on git data, not session event

This commit is contained in:
Scott Chacon 2023-03-20 14:59:36 +01:00
parent 6299a97e73
commit ffe56ab14c
3 changed files with 15 additions and 9 deletions

View File

@ -15,6 +15,17 @@ impl Event {
}
}
pub fn git(project: &projects::Project) -> Self {
let event_name = format!("project://{}/git", project.id);
let payload = serde_json::json!({
"logs/HEAD": "updated",
});
Event {
name: event_name,
payload: payload,
}
}
pub fn detlas(
project: &projects::Project,
session: &sessions::Session,

View File

@ -108,13 +108,8 @@ fn on_file_change(
return Ok(None);
}
let repo = git2::Repository::open(project.path.clone())?;
let event = match sessions::Session::current(&repo, &project)? {
Some(current_session) => Some(events::Event::session(&project, &current_session)),
None => None,
};
Ok(event)
let event = events::Event::git(&project);
Ok(Some(event))
}
fn is_interesting_event(kind: &notify::EventKind) -> Option<String> {

View File

@ -29,8 +29,8 @@ export default async (params: { projectId: string }) => {
const store = writable(statuses);
appWindow.listen<Session>(`project://${params.projectId}/sessions`, async (event) => {
log.info(`Status: Received sessions event, projectId: ${params.projectId}`);
appWindow.listen(`project://${params.projectId}/git`, async (event) => {
log.info(`Status: Received git event, projectId: ${params.projectId}`);
const statusesGit = await listFiles(params);
const statuses = convertToStatuses(statusesGit);
store.set(statuses);