Skip to content

Commit

Permalink
Merge pull request #1594 from finos/expr-edit-persist
Browse files Browse the repository at this point in the history
Persist edited expressions and add 'Reset' button
  • Loading branch information
texodus authored Oct 31, 2021
2 parents a8d631a + 8712ca7 commit 88c75aa
Show file tree
Hide file tree
Showing 20 changed files with 337 additions and 232 deletions.
12 changes: 10 additions & 2 deletions rust/perspective-viewer/src/less/expression-editor.less
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
opacity: 0.5;
}

&#psp-expression-editor-button-save {
&#psp-expression-editor-button-save,
&#psp-expression-editor-button-reset {
color: inherit;
font-family: inherit;
font-weight: 300;
Expand All @@ -85,13 +86,20 @@
margin-right: 6px;
font-size: 14px;
font-family: "Material Icons";
content: "save";
}

&:hover {
background-color: rgba(0, 0, 0, 0.05);
transition: none;
}
}

&#psp-expression-editor-button-save:before {
content: "save";
}

&#psp-expression-editor-button-reset:before {
content: "refresh";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,11 @@ impl Component for ColumnSelector {
}
ColumnSelectorMsg::OpenExpressionEditor => {
let on_save = self.link.callback(ColumnSelectorMsg::SaveExpression);
let mut element =
ExpressionEditorElement::new(self.props.session.clone(), on_save);
let mut element = ExpressionEditorElement::new(
self.props.session.clone(),
on_save,
None,
);

let target = self.add_expression_ref.cast::<HtmlElement>().unwrap();
element.open(target);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ impl Component for ConfigSelector {

fn update(&mut self, msg: Self::Message) -> ShouldRender {
match msg {
ConfigSelectorMsg::DragStart(_)
| ConfigSelectorMsg::ViewCreated => true,
ConfigSelectorMsg::DragStart(_) | ConfigSelectorMsg::ViewCreated => true,
ConfigSelectorMsg::DragEnd => true,
ConfigSelectorMsg::DragOverRowPivots(index) => {
self.props.dragdrop.drag_enter(DropAction::RowPivots, index)
Expand Down Expand Up @@ -279,9 +278,7 @@ impl Component for ConfigSelector {
// web_sys::console::log_1(&"redraw".into());
let dragend = Callback::from({
let dragdrop = self.props.dragdrop.clone();
move |_event| {
dragdrop.drag_end()
}
move |_event| dragdrop.drag_end()
});

html! {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ where
.cloned();

if !self.props.allow_duplicates {
columns.retain(|x| x.1 .1.as_ref().unwrap().props.get_item() != *column);
columns.retain(|x| {
x.1 .1.as_ref().unwrap().props.get_item() != *column
});
}

// If inserting into the middle of the list, use
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ where
html! {
<>
<label>{ "weighted mean" }</label>
<div
<div
class="dropdown-width-container"
data-value={ format!("{}", self.props.selected) }>
{ select }
Expand All @@ -176,7 +176,7 @@ where
}
} else {
html! {
<div
<div
class="dropdown-width-container"
data-value={ format!("{}", self.props.selected) }>
{ select }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl Drop for ResizingState {
/// Without this, the `Closure` objects would not leak, but the document will
/// continue to call them, causing runtime exceptions.
fn drop(&mut self) {
let result = maybe! {
let result: Result<(), JsValue> = maybe! {
let document = web_sys::window().unwrap().document().unwrap();
let body = document.body().unwrap();
let mousemove = self.mousemove.as_ref().unchecked_ref();
Expand Down
Loading

0 comments on commit 88c75aa

Please sign in to comment.