Fix LXD container install: PATH, socket proxy, DNS
Some checks failed
BotServer CI / build (push) Failing after 7m36s
Some checks failed
BotServer CI / build (push) Failing after 7m36s
This commit is contained in:
parent
6c139fdf63
commit
03fe5bc94d
3 changed files with 48 additions and 8 deletions
|
|
@ -10,7 +10,7 @@ features = ["database", "i18n"]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
# ===== DEFAULT =====
|
# ===== DEFAULT =====
|
||||||
default = ["chat", "people", "automation", "drive", "tasks", "cache", "directory", "llm", "crawler", "browser", "terminal", "editor", "mail", "whatsapp", "designer", "marketing"]
|
default = ["chat", "people", "automation", "drive", "tasks", "cache", "directory", "llm", "crawler", "browser", "terminal", "editor", "mail", "whatsapp", "designer", "marketing", "goals", "analytics"]
|
||||||
|
|
||||||
browser = ["automation", "drive", "cache"]
|
browser = ["automation", "drive", "cache"]
|
||||||
terminal = ["automation", "drive", "cache"]
|
terminal = ["automation", "drive", "cache"]
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,7 @@ pub struct Objective {
|
||||||
pub id: Uuid,
|
pub id: Uuid,
|
||||||
pub organization_id: Uuid,
|
pub organization_id: Uuid,
|
||||||
pub owner_id: Uuid,
|
pub owner_id: Uuid,
|
||||||
|
pub owner_name: Option<String>,
|
||||||
pub parent_id: Option<Uuid>,
|
pub parent_id: Option<Uuid>,
|
||||||
pub title: String,
|
pub title: String,
|
||||||
pub description: String,
|
pub description: String,
|
||||||
|
|
@ -402,6 +403,7 @@ pub struct CreateObjectiveRequest {
|
||||||
pub parent_id: Option<Uuid>,
|
pub parent_id: Option<Uuid>,
|
||||||
pub visibility: Option<Visibility>,
|
pub visibility: Option<Visibility>,
|
||||||
pub tags: Option<Vec<String>>,
|
pub tags: Option<Vec<String>>,
|
||||||
|
pub owner_id: Option<Uuid>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
|
@ -465,6 +467,7 @@ fn record_to_objective(record: ObjectiveRecord) -> Objective {
|
||||||
id: record.id,
|
id: record.id,
|
||||||
organization_id: record.org_id,
|
organization_id: record.org_id,
|
||||||
owner_id: record.owner_id,
|
owner_id: record.owner_id,
|
||||||
|
owner_name: None,
|
||||||
parent_id: record.parent_id,
|
parent_id: record.parent_id,
|
||||||
title: record.title,
|
title: record.title,
|
||||||
description: record.description.unwrap_or_default(),
|
description: record.description.unwrap_or_default(),
|
||||||
|
|
@ -589,11 +592,13 @@ pub async fn list_objectives(
|
||||||
|
|
||||||
pub async fn create_objective(
|
pub async fn create_objective(
|
||||||
State(state): State<Arc<AppState>>,
|
State(state): State<Arc<AppState>>,
|
||||||
|
user: crate::security::auth::AuthenticatedUser,
|
||||||
Json(req): Json<CreateObjectiveRequest>,
|
Json(req): Json<CreateObjectiveRequest>,
|
||||||
) -> Result<Json<Objective>, GoalsError> {
|
) -> Result<Json<Objective>, GoalsError> {
|
||||||
let pool = state.conn.clone();
|
let pool = state.conn.clone();
|
||||||
let (org_id, bot_id) = get_bot_context();
|
let (org_id, bot_id) = get_bot_context();
|
||||||
let owner_id = Uuid::nil();
|
let owner_id = req.owner_id.unwrap_or(user.user_id);
|
||||||
|
let owner_name = Some(user.username.clone());
|
||||||
let now = Utc::now();
|
let now = Utc::now();
|
||||||
|
|
||||||
let tags: Vec<Option<String>> = req.tags.unwrap_or_default().into_iter().map(Some).collect();
|
let tags: Vec<Option<String>> = req.tags.unwrap_or_default().into_iter().map(Some).collect();
|
||||||
|
|
@ -632,7 +637,9 @@ pub async fn create_objective(
|
||||||
.map_err(|e| GoalsError::Database(e.to_string()))??;
|
.map_err(|e| GoalsError::Database(e.to_string()))??;
|
||||||
|
|
||||||
info!("Created objective: {} ({})", record.title, record.id);
|
info!("Created objective: {} ({})", record.title, record.id);
|
||||||
Ok(Json(record_to_objective(record)))
|
let mut obj = record_to_objective(record);
|
||||||
|
obj.owner_name = owner_name;
|
||||||
|
Ok(Json(obj))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_objective(
|
pub async fn get_objective(
|
||||||
|
|
@ -760,12 +767,13 @@ pub async fn list_key_results(
|
||||||
|
|
||||||
pub async fn create_key_result(
|
pub async fn create_key_result(
|
||||||
State(state): State<Arc<AppState>>,
|
State(state): State<Arc<AppState>>,
|
||||||
|
user: crate::security::auth::AuthenticatedUser,
|
||||||
Path(objective_id): Path<Uuid>,
|
Path(objective_id): Path<Uuid>,
|
||||||
Json(req): Json<CreateKeyResultRequest>,
|
Json(req): Json<CreateKeyResultRequest>,
|
||||||
) -> Result<Json<KeyResult>, GoalsError> {
|
) -> Result<Json<KeyResult>, GoalsError> {
|
||||||
let pool = state.conn.clone();
|
let pool = state.conn.clone();
|
||||||
let (org_id, bot_id) = get_bot_context();
|
let (org_id, bot_id) = get_bot_context();
|
||||||
let owner_id = Uuid::nil();
|
let owner_id = user.user_id;
|
||||||
let now = Utc::now();
|
let now = Utc::now();
|
||||||
|
|
||||||
let start_value = req.start_value.unwrap_or(0.0);
|
let start_value = req.start_value.unwrap_or(0.0);
|
||||||
|
|
@ -889,12 +897,13 @@ pub async fn delete_key_result(
|
||||||
|
|
||||||
pub async fn create_check_in(
|
pub async fn create_check_in(
|
||||||
State(state): State<Arc<AppState>>,
|
State(state): State<Arc<AppState>>,
|
||||||
|
user: crate::security::auth::AuthenticatedUser,
|
||||||
Path(key_result_id): Path<Uuid>,
|
Path(key_result_id): Path<Uuid>,
|
||||||
Json(req): Json<CreateCheckInRequest>,
|
Json(req): Json<CreateCheckInRequest>,
|
||||||
) -> Result<Json<CheckIn>, GoalsError> {
|
) -> Result<Json<CheckIn>, GoalsError> {
|
||||||
let pool = state.conn.clone();
|
let pool = state.conn.clone();
|
||||||
let (org_id, bot_id) = get_bot_context();
|
let (org_id, bot_id) = get_bot_context();
|
||||||
let user_id = Uuid::nil();
|
let user_id = user.user_id;
|
||||||
let now = Utc::now();
|
let now = Utc::now();
|
||||||
|
|
||||||
let pool_clone = pool.clone();
|
let pool_clone = pool.clone();
|
||||||
|
|
|
||||||
|
|
@ -288,8 +288,32 @@ pub async fn dashboard_stats(State(state): State<Arc<AppState>>) -> Html<String>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn new_objective_form() -> Html<String> {
|
pub async fn new_objective_form(
|
||||||
Html(r##"<div class="modal-header">
|
State(state): State<Arc<AppState>>,
|
||||||
|
) -> Html<String> {
|
||||||
|
use crate::core::shared::models::schema::users;
|
||||||
|
use diesel::prelude::*;
|
||||||
|
|
||||||
|
let pool = state.conn.clone();
|
||||||
|
let users_list = tokio::task::spawn_blocking(move || {
|
||||||
|
let mut conn = pool.get().ok()?;
|
||||||
|
users::table
|
||||||
|
.select((users::id, users::username))
|
||||||
|
.order(users::username.asc())
|
||||||
|
.load::<(uuid::Uuid, String)>(&mut conn)
|
||||||
|
.ok()
|
||||||
|
})
|
||||||
|
.await
|
||||||
|
.ok()
|
||||||
|
.flatten()
|
||||||
|
.unwrap_or_default();
|
||||||
|
|
||||||
|
let owner_options: String = users_list
|
||||||
|
.iter()
|
||||||
|
.map(|(id, name)| format!(r#"<option value="{id}">{name}</option>"#))
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
Html(format!(r##"<div class="modal-header">
|
||||||
<h3>New Objective</h3>
|
<h3>New Objective</h3>
|
||||||
<button class="btn-close" onclick="closeModal()">×</button>
|
<button class="btn-close" onclick="closeModal()">×</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -302,6 +326,13 @@ pub async fn new_objective_form() -> Html<String> {
|
||||||
<label>Description</label>
|
<label>Description</label>
|
||||||
<textarea name="description" rows="3" placeholder="Describe the objective in detail"></textarea>
|
<textarea name="description" rows="3" placeholder="Describe the objective in detail"></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Owner</label>
|
||||||
|
<select name="owner_id">
|
||||||
|
<option value="">Assign to me (default)</option>
|
||||||
|
{owner_options}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Period</label>
|
<label>Period</label>
|
||||||
<select name="period" required>
|
<select name="period" required>
|
||||||
|
|
@ -336,7 +367,7 @@ pub async fn new_objective_form() -> Html<String> {
|
||||||
<button type="button" class="btn btn-secondary" onclick="closeModal()">Cancel</button>
|
<button type="button" class="btn btn-secondary" onclick="closeModal()">Cancel</button>
|
||||||
<button type="submit" class="btn btn-primary">Create Objective</button>
|
<button type="submit" class="btn btn-primary">Create Objective</button>
|
||||||
</div>
|
</div>
|
||||||
</form>"##.to_string())
|
</form>"##))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn recent_checkins(State(state): State<Arc<AppState>>) -> Html<String> {
|
pub async fn recent_checkins(State(state): State<Arc<AppState>>) -> Html<String> {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue