TMP disable edit description. Reduce memory footprint
This commit is contained in:
parent
f22944664e
commit
d8855bdfec
@ -1,37 +0,0 @@
|
||||
server {
|
||||
listen 80;
|
||||
# listen 443 ssl http2;
|
||||
server_name jirs.lvh.me;
|
||||
|
||||
charset utf-8;
|
||||
root /home/eraden/code/eraden/jirs/jirs-client/tmp;
|
||||
|
||||
# ssl_certificate /home/eraden/code/eraden/jirs/jirs-client/js/nginx-selfsigned.crt;
|
||||
# ssl_certificate_key /home/eraden/code/eraden/jirs/jirs-client/js/nginx-selfsigned.key;
|
||||
|
||||
# if ($scheme != "https") {
|
||||
# return 301 https://$host$request_uri;
|
||||
# }
|
||||
|
||||
location ~ .wasm {
|
||||
default_type application/wasm;
|
||||
}
|
||||
|
||||
location *.js {
|
||||
default_type application/javascript;
|
||||
}
|
||||
|
||||
location / {
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
error_page 404 =200 /index.html;
|
||||
|
||||
location /ws/ {
|
||||
proxy_pass http://localhost;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
}
|
@ -402,18 +402,18 @@ fn init(url: Url, orders: &mut impl Orders<Msg>) -> Model {
|
||||
});
|
||||
|
||||
{
|
||||
let sender_clone = sender.clone();
|
||||
let id = FieldId::ProjectSettings(ProjectFieldId::Description);
|
||||
model
|
||||
.distinct_key_up
|
||||
.keyup_wih_reset(id.to_str(), 20, move |ev| {
|
||||
let sender = sender_clone.clone();
|
||||
let key_ev = seed::to_keyboard_event(&ev);
|
||||
let target = key_ev.target().unwrap();
|
||||
let el = seed::to_html_el(&target);
|
||||
let value = el.inner_html();
|
||||
sender.clone()(Some(Msg::StrInputChanged(id.clone(), value)));
|
||||
});
|
||||
// let sender_clone = sender.clone();
|
||||
// let id = FieldId::ProjectSettings(ProjectFieldId::Description);
|
||||
// model
|
||||
// .distinct_key_up
|
||||
// .keyup_wih_reset(id.to_str(), 20, move |ev| {
|
||||
// let sender = sender_clone.clone();
|
||||
// let key_ev = seed::to_keyboard_event(&ev);
|
||||
// let target = key_ev.target().unwrap();
|
||||
// let el = seed::to_html_el(&target);
|
||||
// let value = el.inner_html();
|
||||
// sender.clone()(Some(Msg::StrInputChanged(id.clone(),
|
||||
// value))); });
|
||||
}
|
||||
|
||||
open_socket(&mut model, orders);
|
||||
|
@ -233,17 +233,19 @@ fn reporter_field(model: &Model, modal: &AddIssueModal) -> Node<Msg> {
|
||||
variant: SelectVariant::Normal,
|
||||
text_filter: modal.reporter_state.text_filter.as_str(),
|
||||
opened: modal.reporter_state.opened,
|
||||
options: Some(model.users.iter().map(reporter_select_option)),
|
||||
options: Some(
|
||||
model
|
||||
.user_ids
|
||||
.iter()
|
||||
.filter_map(|id| model.users_by_id.get(id))
|
||||
.map(reporter_select_option),
|
||||
),
|
||||
selected: model
|
||||
.users
|
||||
.user_ids
|
||||
.iter()
|
||||
.filter_map(|user| {
|
||||
if user.id == reporter_id {
|
||||
Some(reporter_select_option(user))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.filter(|id| **id == reporter_id)
|
||||
.filter_map(|id| model.users_by_id.get(id))
|
||||
.map(reporter_select_option)
|
||||
.collect(),
|
||||
|
||||
valid: true,
|
||||
@ -284,10 +286,17 @@ fn assignees_field(model: &Model, modal: &AddIssueModal) -> Node<Msg> {
|
||||
is_multi: true,
|
||||
text_filter: modal.assignees_state.text_filter.as_str(),
|
||||
opened: modal.assignees_state.opened,
|
||||
options: Some(model.users.iter().map(assignee_select_option)),
|
||||
options: Some(
|
||||
model
|
||||
.user_ids
|
||||
.iter()
|
||||
.filter_map(|id| model.users_by_id.get(id))
|
||||
.map(assignee_select_option),
|
||||
),
|
||||
selected: model
|
||||
.users
|
||||
.user_ids
|
||||
.iter()
|
||||
.filter_map(|id| model.users_by_id.get(id))
|
||||
.filter_map(|user| {
|
||||
if modal.user_ids.contains(&user.id) {
|
||||
Some(assignee_select_option(user))
|
||||
|
@ -452,10 +452,17 @@ fn reporters_select(
|
||||
opened: reporter_state.opened,
|
||||
variant: SelectVariant::Empty,
|
||||
text_filter: reporter_state.text_filter.as_str(),
|
||||
options: Some(model.users.iter().map(reporter_select_option)),
|
||||
options: Some(
|
||||
model
|
||||
.user_ids
|
||||
.iter()
|
||||
.filter_map(|id| model.users_by_id.get(id))
|
||||
.map(reporter_select_option),
|
||||
),
|
||||
selected: model
|
||||
.users
|
||||
.user_ids
|
||||
.iter()
|
||||
.filter_map(|id| model.users_by_id.get(id))
|
||||
.filter(|user| payload.reporter_id == user.id)
|
||||
.map(reporter_select_option)
|
||||
.collect(),
|
||||
@ -502,10 +509,17 @@ fn assignees_select(
|
||||
is_multi: true,
|
||||
opened: assignees_state.opened,
|
||||
text_filter: assignees_state.text_filter.as_str(),
|
||||
options: Some(model.users.iter().map(assignee_select_option)),
|
||||
options: Some(
|
||||
model
|
||||
.user_ids
|
||||
.iter()
|
||||
.filter_map(|id| model.users_by_id.get(id))
|
||||
.map(assignee_select_option),
|
||||
),
|
||||
selected: model
|
||||
.users
|
||||
.user_ids
|
||||
.iter()
|
||||
.filter_map(|id| model.users_by_id.get(id))
|
||||
.filter(|user| payload.user_ids.contains(&user.id))
|
||||
.map(assignee_select_option)
|
||||
.collect(),
|
||||
|
@ -235,7 +235,7 @@ pub struct Model {
|
||||
|
||||
// users
|
||||
pub user: Option<User>,
|
||||
pub users: Vec<User>,
|
||||
pub user_ids: Vec<UserId>,
|
||||
pub users_by_id: HashMap<UserId, User>,
|
||||
|
||||
// user settings
|
||||
@ -265,8 +265,7 @@ pub struct Model {
|
||||
pub epics_by_id: HashMap<EpicId, Epic>,
|
||||
|
||||
pub key_triggers: std::rc::Rc<std::cell::RefCell<HashMap<char, Box<dyn BuildMsg>>>>,
|
||||
pub distinct_key_up: crate::shared::on_event::Distinct,
|
||||
|
||||
// pub distinct_key_up: crate::shared::on_event::Distinct,
|
||||
pub show_extras: bool,
|
||||
}
|
||||
|
||||
@ -290,7 +289,7 @@ impl Model {
|
||||
about_tooltip_visible: false,
|
||||
messages_tooltip_visible: false,
|
||||
issues: vec![],
|
||||
users: vec![],
|
||||
user_ids: vec![],
|
||||
users_by_id: HashMap::with_capacity(1_000),
|
||||
user_settings: None,
|
||||
comments: vec![],
|
||||
@ -308,7 +307,7 @@ impl Model {
|
||||
modals_stack: vec![],
|
||||
modals: Modals::default(),
|
||||
key_triggers: std::rc::Rc::new(std::cell::RefCell::new(HashMap::with_capacity(20))),
|
||||
distinct_key_up: crate::shared::on_event::distinct(),
|
||||
// distinct_key_up: crate::shared::on_event::distinct(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,11 @@ pub fn update(msg: Msg, model: &mut crate::model::Model, orders: &mut impl Order
|
||||
Some(JqlPart::Field(FieldOption::Assignee))
|
||||
) =>
|
||||
{
|
||||
let u = match model.users.get(n as usize) {
|
||||
let id = match model.user_ids.get(n as usize) {
|
||||
Some(idx) => idx,
|
||||
_ => return,
|
||||
};
|
||||
let u = match model.users_by_id.get(id) {
|
||||
Some(u) => u,
|
||||
_ => return,
|
||||
};
|
||||
|
@ -70,8 +70,9 @@ fn options<'l, 'm: 'l>(model: &'m Model, jql: &Jql) -> Vec<StyledSelectOption<'l
|
||||
if matches!(jql.field(), Some(JqlPart::Field(FieldOption::Assignee))) =>
|
||||
{
|
||||
model
|
||||
.users
|
||||
.user_ids
|
||||
.iter()
|
||||
.filter_map(|id| model.users_by_id.get(id))
|
||||
.map(|u| StyledSelectOption {
|
||||
name: Some("user"),
|
||||
icon: None,
|
||||
|
@ -73,8 +73,9 @@ pub fn avatars_filters(model: &Model) -> Node<Msg> {
|
||||
};
|
||||
let active_avatar_filters = &project_page.active_avatar_filters;
|
||||
let avatars: Vec<Node<Msg>> = model
|
||||
.users
|
||||
.user_ids
|
||||
.iter()
|
||||
.filter_map(|id| model.users_by_id.get(id))
|
||||
.enumerate()
|
||||
.map(|(idx, user)| {
|
||||
let user_id = user.id;
|
||||
|
@ -358,8 +358,9 @@ fn parse_description(model: &Model, desc: &str) -> Node<Msg> {
|
||||
let child = parse_email(word)
|
||||
.and_then(|email| {
|
||||
model
|
||||
.users
|
||||
.user_ids
|
||||
.iter()
|
||||
.filter_map(|id| model.users_by_id.get(id))
|
||||
.enumerate()
|
||||
.find(|(_, user)| user.email == email)
|
||||
})
|
||||
|
@ -177,9 +177,6 @@ pub fn update(msg: &mut WsMsg, model: &mut Model, orders: &mut impl Orders<Msg>)
|
||||
if let Some(user) = model.users_by_id.get_mut(&id) {
|
||||
user.avatar_url = Some(url.clone());
|
||||
}
|
||||
if let Some(user) = model.users.iter_mut().find(|u| u.id == *id) {
|
||||
user.avatar_url = Some(url.clone());
|
||||
}
|
||||
orders.send_msg(Msg::ResourceChanged(
|
||||
ResourceKind::User,
|
||||
OperationKind::SingleModified,
|
||||
@ -308,7 +305,7 @@ pub fn update(msg: &mut WsMsg, model: &mut Model, orders: &mut impl Orders<Msg>)
|
||||
}
|
||||
// users
|
||||
WsMsg::Project(WsMsgProject::ProjectUsersLoaded(v)) => {
|
||||
model.users = v.clone();
|
||||
model.user_ids = v.iter().map(|u| u.id).collect();
|
||||
model.users_by_id.clear();
|
||||
for user in v {
|
||||
model.users_by_id.insert(user.id, user.clone());
|
||||
|
Loading…
Reference in New Issue
Block a user