mirror of
https://github.com/enso-org/enso.git
synced 2024-11-22 03:32:23 +03:00
Consistent naming of visualization (#7124)
This commit is contained in:
parent
ae4666c4d3
commit
4e5cb9cca6
@ -33,7 +33,7 @@
|
||||
|
||||
Enso is an award-winning interactive programming language with dual visual and
|
||||
textual representations. It is a tool that spans the entire stack, going from
|
||||
high-level visualisation and communication to the nitty-gritty of backend
|
||||
high-level visualization and communication to the nitty-gritty of backend
|
||||
services, all in a single language. Watch the following introduction video to
|
||||
learn what Enso is, and how it helps companies build data workflows in minutes
|
||||
instead of weeks.
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
Enso is an award-winning interactive programming language with dual visual and
|
||||
textual representations. It is a tool that spans the entire stack, going from
|
||||
high-level visualisation and communication to the nitty-gritty of backend
|
||||
high-level visualization and communication to the nitty-gritty of backend
|
||||
services, all in a single language. Watch the following introduction video to
|
||||
learn what Enso is, and how it helps companies build data workflows in minutes
|
||||
instead of weeks.
|
||||
|
@ -8,7 +8,7 @@ use crate::binary::message::FromServerPayloadOwned;
|
||||
use crate::binary::message::MessageFromServerOwned;
|
||||
use crate::binary::message::MessageToServerRef;
|
||||
use crate::binary::message::ToServerPayload;
|
||||
use crate::binary::message::VisualisationContext;
|
||||
use crate::binary::message::VisualizationContext;
|
||||
use crate::common::error::UnexpectedMessage;
|
||||
use crate::handler::Disposition;
|
||||
use crate::handler::Handler;
|
||||
@ -44,7 +44,7 @@ pub enum Notification {
|
||||
/// A new data has been sent for a visualization.
|
||||
VisualizationUpdate {
|
||||
/// Identifies the specific visualization.
|
||||
context: VisualisationContext,
|
||||
context: VisualizationContext,
|
||||
/// Data to be passed to the visualization.
|
||||
data: Vec<u8>,
|
||||
},
|
||||
@ -371,7 +371,7 @@ mod tests {
|
||||
fixture.executor.run_until_stalled();
|
||||
event_fut.expect_pending();
|
||||
|
||||
let context = VisualisationContext {
|
||||
let context = VisualizationContext {
|
||||
visualization_id: Uuid::new_v4(),
|
||||
expression_id: Uuid::new_v4(),
|
||||
context_id: Uuid::new_v4(),
|
||||
|
@ -62,7 +62,7 @@ impl<T> MessageFromServer<T> {
|
||||
/// Identifies the visualization in the update message.
|
||||
#[allow(missing_docs)]
|
||||
#[derive(Clone, Debug, Copy, PartialEq, Eq)]
|
||||
pub struct VisualisationContext {
|
||||
pub struct VisualizationContext {
|
||||
pub visualization_id: Uuid,
|
||||
pub context_id: Uuid,
|
||||
pub expression_id: Uuid,
|
||||
@ -110,7 +110,7 @@ pub enum ToServerPayloadOwned {
|
||||
pub enum FromServerPayloadOwned {
|
||||
Error { code: i32, message: String, data: Option<ErrorPayload> },
|
||||
Success {},
|
||||
VisualizationUpdate { context: VisualisationContext, data: Vec<u8> },
|
||||
VisualizationUpdate { context: VisualizationContext, data: Vec<u8> },
|
||||
FileContentsReply { contents: Vec<u8> },
|
||||
WriteBytesReply { checksum: EnsoDigest },
|
||||
ReadBytesReply { checksum: EnsoDigest, bytes: Vec<u8> },
|
||||
@ -149,7 +149,7 @@ pub enum ToServerPayload<'a> {
|
||||
pub enum FromServerPayload<'a> {
|
||||
Error { code: i32, message: &'a str, data: Option<ErrorPayload> },
|
||||
Success {},
|
||||
VisualizationUpdate { context: VisualisationContext, data: &'a [u8] },
|
||||
VisualizationUpdate { context: VisualizationContext, data: &'a [u8] },
|
||||
FileContentsReply { contents: &'a [u8] },
|
||||
WriteBytesReply { checksum: EnsoDigest },
|
||||
ReadBytesReply { checksum: EnsoDigest, bytes: &'a [u8] },
|
||||
|
@ -77,22 +77,22 @@ impl<'a> SerializableDeserializableObject<'a> for Vec<String> {
|
||||
}
|
||||
|
||||
|
||||
// === impl VisualisationContext ===
|
||||
// === impl VisualizationContext ===
|
||||
|
||||
impl<'a> SerializableDeserializableObject<'a> for message::VisualisationContext {
|
||||
type Out = VisualisationContext<'a>;
|
||||
impl<'a> SerializableDeserializableObject<'a> for message::VisualizationContext {
|
||||
type Out = VisualizationContext<'a>;
|
||||
fn serialize(&self, builder: &mut FlatBufferBuilder<'a>) -> WIPOffset<Self::Out> {
|
||||
VisualisationContext::create(builder, &VisualisationContextArgs {
|
||||
visualisationId: Some(&self.visualization_id.into()),
|
||||
VisualizationContext::create(builder, &VisualizationContextArgs {
|
||||
visualizationId: Some(&self.visualization_id.into()),
|
||||
expressionId: Some(&self.expression_id.into()),
|
||||
contextId: Some(&self.context_id.into()),
|
||||
})
|
||||
}
|
||||
|
||||
fn deserialize(fbs: Self::Out) -> Result<Self, DeserializationError> {
|
||||
Ok(message::VisualisationContext {
|
||||
Ok(message::VisualizationContext {
|
||||
context_id: fbs.contextId().into(),
|
||||
visualization_id: fbs.visualisationId().into(),
|
||||
visualization_id: fbs.visualizationId().into(),
|
||||
expression_id: fbs.expressionId().into(),
|
||||
})
|
||||
}
|
||||
@ -325,9 +325,9 @@ impl SerializableUnion for FromServerPayloadOwned {
|
||||
FromServerPayloadOwned::VisualizationUpdate { data, context } => {
|
||||
let data = builder.create_vector(data);
|
||||
let context = context.serialize(builder);
|
||||
VisualisationUpdate::create(builder, &VisualisationUpdateArgs {
|
||||
VisualizationUpdate::create(builder, &VisualizationUpdateArgs {
|
||||
data: Some(data),
|
||||
visualisationContext: Some(context),
|
||||
visualizationContext: Some(context),
|
||||
})
|
||||
.as_union_value()
|
||||
}
|
||||
@ -362,7 +362,7 @@ impl SerializableUnion for FromServerPayloadOwned {
|
||||
FromServerPayloadOwned::FileContentsReply { .. } =>
|
||||
OutboundPayload::FILE_CONTENTS_REPLY,
|
||||
FromServerPayloadOwned::VisualizationUpdate { .. } =>
|
||||
OutboundPayload::VISUALISATION_UPDATE,
|
||||
OutboundPayload::VISUALIZATION_UPDATE,
|
||||
FromServerPayloadOwned::WriteBytesReply { .. } => OutboundPayload::WRITE_BYTES_REPLY,
|
||||
FromServerPayloadOwned::ReadBytesReply { .. } => OutboundPayload::READ_BYTES_REPLY,
|
||||
FromServerPayloadOwned::ChecksumBytesReply { .. } =>
|
||||
@ -424,12 +424,12 @@ impl<'a> DeserializableUnionField<'a, OutboundMessage<'a>> for FromServerPayload
|
||||
})
|
||||
}
|
||||
OutboundPayload::SUCCESS => Ok(FromServerPayload::Success {}),
|
||||
OutboundPayload::VISUALISATION_UPDATE => {
|
||||
let payload = message.payload_as_visualisation_update().unwrap();
|
||||
let context = payload.visualisationContext();
|
||||
OutboundPayload::VISUALIZATION_UPDATE => {
|
||||
let payload = message.payload_as_visualization_update().unwrap();
|
||||
let context = payload.visualizationContext();
|
||||
Ok(FromServerPayload::VisualizationUpdate {
|
||||
data: payload.data(),
|
||||
context: message::VisualisationContext::deserialize(context)?,
|
||||
context: message::VisualizationContext::deserialize(context)?,
|
||||
})
|
||||
}
|
||||
OutboundPayload::WRITE_BYTES_REPLY => {
|
||||
@ -531,12 +531,12 @@ impl<'a> DeserializableUnionField<'a, OutboundMessage<'a>> for FromServerPayload
|
||||
})
|
||||
}
|
||||
OutboundPayload::SUCCESS => Ok(FromServerPayloadOwned::Success {}),
|
||||
OutboundPayload::VISUALISATION_UPDATE => {
|
||||
let payload = message.payload_as_visualisation_update().unwrap();
|
||||
let context = payload.visualisationContext();
|
||||
OutboundPayload::VISUALIZATION_UPDATE => {
|
||||
let payload = message.payload_as_visualization_update().unwrap();
|
||||
let context = payload.visualizationContext();
|
||||
Ok(FromServerPayloadOwned::VisualizationUpdate {
|
||||
data: Vec::from(payload.data()),
|
||||
context: message::VisualisationContext::deserialize(context)?,
|
||||
context: message::VisualizationContext::deserialize(context)?,
|
||||
})
|
||||
}
|
||||
OutboundPayload::WRITE_BYTES_REPLY => {
|
||||
|
@ -131,7 +131,7 @@ pub mod org {
|
||||
NONE = 0,
|
||||
ERROR = 1,
|
||||
SUCCESS = 2,
|
||||
VISUALISATION_UPDATE = 3,
|
||||
VISUALIZATION_UPDATE = 3,
|
||||
FILE_CONTENTS_REPLY = 4,
|
||||
WRITE_BYTES_REPLY = 5,
|
||||
READ_BYTES_REPLY = 6,
|
||||
@ -177,7 +177,7 @@ pub mod org {
|
||||
OutboundPayload::NONE,
|
||||
OutboundPayload::ERROR,
|
||||
OutboundPayload::SUCCESS,
|
||||
OutboundPayload::VISUALISATION_UPDATE,
|
||||
OutboundPayload::VISUALIZATION_UPDATE,
|
||||
OutboundPayload::FILE_CONTENTS_REPLY,
|
||||
OutboundPayload::WRITE_BYTES_REPLY,
|
||||
OutboundPayload::READ_BYTES_REPLY,
|
||||
@ -189,7 +189,7 @@ pub mod org {
|
||||
"NONE",
|
||||
"ERROR",
|
||||
"SUCCESS",
|
||||
"VISUALISATION_UPDATE",
|
||||
"VISUALIZATION_UPDATE",
|
||||
"FILE_CONTENTS_REPLY",
|
||||
"WRITE_BYTES_REPLY",
|
||||
"READ_BYTES_REPLY",
|
||||
@ -629,12 +629,12 @@ pub mod org {
|
||||
|
||||
#[inline]
|
||||
#[allow(non_snake_case)]
|
||||
pub fn payload_as_visualisation_update(
|
||||
pub fn payload_as_visualization_update(
|
||||
&self,
|
||||
) -> Option<VisualisationUpdate<'a>> {
|
||||
if self.payload_type() == OutboundPayload::VISUALISATION_UPDATE {
|
||||
) -> Option<VisualizationUpdate<'a>> {
|
||||
if self.payload_type() == OutboundPayload::VISUALIZATION_UPDATE {
|
||||
let u = self.payload();
|
||||
Some(VisualisationUpdate::init_from_table(u))
|
||||
Some(VisualizationUpdate::init_from_table(u))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
@ -1115,179 +1115,179 @@ pub mod org {
|
||||
}
|
||||
}
|
||||
|
||||
pub enum VisualisationContextOffset {}
|
||||
pub enum VisualizationContextOffset {}
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
|
||||
pub struct VisualisationContext<'a> {
|
||||
pub struct VisualizationContext<'a> {
|
||||
pub _tab: flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Follow<'a> for VisualisationContext<'a> {
|
||||
type Inner = VisualisationContext<'a>;
|
||||
impl<'a> flatbuffers::Follow<'a> for VisualizationContext<'a> {
|
||||
type Inner = VisualizationContext<'a>;
|
||||
#[inline]
|
||||
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: flatbuffers::Table { buf, loc } }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> VisualisationContext<'a> {
|
||||
impl<'a> VisualizationContext<'a> {
|
||||
#[inline]
|
||||
pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
|
||||
VisualisationContext { _tab: table }
|
||||
VisualizationContext { _tab: table }
|
||||
}
|
||||
#[allow(unused_mut)]
|
||||
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
|
||||
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
|
||||
args: &'args VisualisationContextArgs<'args>,
|
||||
) -> flatbuffers::WIPOffset<VisualisationContext<'bldr>>
|
||||
args: &'args VisualizationContextArgs<'args>,
|
||||
) -> flatbuffers::WIPOffset<VisualizationContext<'bldr>>
|
||||
{
|
||||
let mut builder = VisualisationContextBuilder::new(_fbb);
|
||||
let mut builder = VisualizationContextBuilder::new(_fbb);
|
||||
if let Some(x) = args.expressionId {
|
||||
builder.add_expressionId(x);
|
||||
}
|
||||
if let Some(x) = args.contextId {
|
||||
builder.add_contextId(x);
|
||||
}
|
||||
if let Some(x) = args.visualisationId {
|
||||
builder.add_visualisationId(x);
|
||||
if let Some(x) = args.visualizationId {
|
||||
builder.add_visualizationId(x);
|
||||
}
|
||||
builder.finish()
|
||||
}
|
||||
|
||||
pub const VT_VISUALISATIONID: flatbuffers::VOffsetT = 4;
|
||||
pub const VT_VISUALIZATIONID: flatbuffers::VOffsetT = 4;
|
||||
pub const VT_CONTEXTID: flatbuffers::VOffsetT = 6;
|
||||
pub const VT_EXPRESSIONID: flatbuffers::VOffsetT = 8;
|
||||
|
||||
#[inline]
|
||||
pub fn visualisationId(&self) -> &'a EnsoUUID {
|
||||
pub fn visualizationId(&self) -> &'a EnsoUUID {
|
||||
self._tab
|
||||
.get::<EnsoUUID>(VisualisationContext::VT_VISUALISATIONID, None)
|
||||
.get::<EnsoUUID>(VisualizationContext::VT_VISUALIZATIONID, None)
|
||||
.unwrap()
|
||||
}
|
||||
#[inline]
|
||||
pub fn contextId(&self) -> &'a EnsoUUID {
|
||||
self._tab
|
||||
.get::<EnsoUUID>(VisualisationContext::VT_CONTEXTID, None)
|
||||
.get::<EnsoUUID>(VisualizationContext::VT_CONTEXTID, None)
|
||||
.unwrap()
|
||||
}
|
||||
#[inline]
|
||||
pub fn expressionId(&self) -> &'a EnsoUUID {
|
||||
self._tab
|
||||
.get::<EnsoUUID>(VisualisationContext::VT_EXPRESSIONID, None)
|
||||
.get::<EnsoUUID>(VisualizationContext::VT_EXPRESSIONID, None)
|
||||
.unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct VisualisationContextArgs<'a> {
|
||||
pub visualisationId: Option<&'a EnsoUUID>,
|
||||
pub struct VisualizationContextArgs<'a> {
|
||||
pub visualizationId: Option<&'a EnsoUUID>,
|
||||
pub contextId: Option<&'a EnsoUUID>,
|
||||
pub expressionId: Option<&'a EnsoUUID>,
|
||||
}
|
||||
impl<'a> Default for VisualisationContextArgs<'a> {
|
||||
impl<'a> Default for VisualizationContextArgs<'a> {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
VisualisationContextArgs {
|
||||
visualisationId: None, // required field
|
||||
VisualizationContextArgs {
|
||||
visualizationId: None, // required field
|
||||
contextId: None, // required field
|
||||
expressionId: None, // required field
|
||||
}
|
||||
}
|
||||
}
|
||||
pub struct VisualisationContextBuilder<'a: 'b, 'b> {
|
||||
pub struct VisualizationContextBuilder<'a: 'b, 'b> {
|
||||
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
|
||||
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
|
||||
}
|
||||
impl<'a: 'b, 'b> VisualisationContextBuilder<'a, 'b> {
|
||||
impl<'a: 'b, 'b> VisualizationContextBuilder<'a, 'b> {
|
||||
#[inline]
|
||||
pub fn add_visualisationId(&mut self, visualisationId: &'b EnsoUUID) {
|
||||
pub fn add_visualizationId(&mut self, visualizationId: &'b EnsoUUID) {
|
||||
self.fbb_.push_slot_always::<&EnsoUUID>(
|
||||
VisualisationContext::VT_VISUALISATIONID,
|
||||
visualisationId,
|
||||
VisualizationContext::VT_VISUALIZATIONID,
|
||||
visualizationId,
|
||||
);
|
||||
}
|
||||
#[inline]
|
||||
pub fn add_contextId(&mut self, contextId: &'b EnsoUUID) {
|
||||
self.fbb_.push_slot_always::<&EnsoUUID>(
|
||||
VisualisationContext::VT_CONTEXTID,
|
||||
VisualizationContext::VT_CONTEXTID,
|
||||
contextId,
|
||||
);
|
||||
}
|
||||
#[inline]
|
||||
pub fn add_expressionId(&mut self, expressionId: &'b EnsoUUID) {
|
||||
self.fbb_.push_slot_always::<&EnsoUUID>(
|
||||
VisualisationContext::VT_EXPRESSIONID,
|
||||
VisualizationContext::VT_EXPRESSIONID,
|
||||
expressionId,
|
||||
);
|
||||
}
|
||||
#[inline]
|
||||
pub fn new(
|
||||
_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>,
|
||||
) -> VisualisationContextBuilder<'a, 'b> {
|
||||
) -> VisualizationContextBuilder<'a, 'b> {
|
||||
let start = _fbb.start_table();
|
||||
VisualisationContextBuilder { fbb_: _fbb, start_: start }
|
||||
VisualizationContextBuilder { fbb_: _fbb, start_: start }
|
||||
}
|
||||
#[inline]
|
||||
pub fn finish(self) -> flatbuffers::WIPOffset<VisualisationContext<'a>> {
|
||||
pub fn finish(self) -> flatbuffers::WIPOffset<VisualizationContext<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
self.fbb_.required(
|
||||
o,
|
||||
VisualisationContext::VT_VISUALISATIONID,
|
||||
"visualisation_id",
|
||||
VisualizationContext::VT_VISUALIZATIONID,
|
||||
"visualization_id",
|
||||
);
|
||||
self.fbb_.required(o, VisualisationContext::VT_CONTEXTID, "context_id");
|
||||
self.fbb_.required(o, VisualizationContext::VT_CONTEXTID, "context_id");
|
||||
self.fbb_.required(
|
||||
o,
|
||||
VisualisationContext::VT_EXPRESSIONID,
|
||||
VisualizationContext::VT_EXPRESSIONID,
|
||||
"expression_id",
|
||||
);
|
||||
flatbuffers::WIPOffset::new(o.value())
|
||||
}
|
||||
}
|
||||
|
||||
pub enum VisualisationUpdateOffset {}
|
||||
pub enum VisualizationUpdateOffset {}
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
|
||||
pub struct VisualisationUpdate<'a> {
|
||||
pub struct VisualizationUpdate<'a> {
|
||||
pub _tab: flatbuffers::Table<'a>,
|
||||
}
|
||||
|
||||
impl<'a> flatbuffers::Follow<'a> for VisualisationUpdate<'a> {
|
||||
type Inner = VisualisationUpdate<'a>;
|
||||
impl<'a> flatbuffers::Follow<'a> for VisualizationUpdate<'a> {
|
||||
type Inner = VisualizationUpdate<'a>;
|
||||
#[inline]
|
||||
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
||||
Self { _tab: flatbuffers::Table { buf, loc } }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> VisualisationUpdate<'a> {
|
||||
impl<'a> VisualizationUpdate<'a> {
|
||||
#[inline]
|
||||
pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
|
||||
VisualisationUpdate { _tab: table }
|
||||
VisualizationUpdate { _tab: table }
|
||||
}
|
||||
#[allow(unused_mut)]
|
||||
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
|
||||
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
|
||||
args: &'args VisualisationUpdateArgs<'args>,
|
||||
) -> flatbuffers::WIPOffset<VisualisationUpdate<'bldr>>
|
||||
args: &'args VisualizationUpdateArgs<'args>,
|
||||
) -> flatbuffers::WIPOffset<VisualizationUpdate<'bldr>>
|
||||
{
|
||||
let mut builder = VisualisationUpdateBuilder::new(_fbb);
|
||||
let mut builder = VisualizationUpdateBuilder::new(_fbb);
|
||||
if let Some(x) = args.data {
|
||||
builder.add_data(x);
|
||||
}
|
||||
if let Some(x) = args.visualisationContext {
|
||||
builder.add_visualisationContext(x);
|
||||
if let Some(x) = args.visualizationContext {
|
||||
builder.add_visualizationContext(x);
|
||||
}
|
||||
builder.finish()
|
||||
}
|
||||
|
||||
pub const VT_VISUALISATIONCONTEXT: flatbuffers::VOffsetT = 4;
|
||||
pub const VT_VISUALIZATIONCONTEXT: flatbuffers::VOffsetT = 4;
|
||||
pub const VT_DATA: flatbuffers::VOffsetT = 6;
|
||||
|
||||
#[inline]
|
||||
pub fn visualisationContext(&self) -> VisualisationContext<'a> {
|
||||
pub fn visualizationContext(&self) -> VisualizationContext<'a> {
|
||||
self._tab
|
||||
.get::<flatbuffers::ForwardsUOffset<VisualisationContext<'a>>>(
|
||||
VisualisationUpdate::VT_VISUALISATIONCONTEXT,
|
||||
.get::<flatbuffers::ForwardsUOffset<VisualizationContext<'a>>>(
|
||||
VisualizationUpdate::VT_VISUALIZATIONCONTEXT,
|
||||
None,
|
||||
)
|
||||
.unwrap()
|
||||
@ -1296,7 +1296,7 @@ pub mod org {
|
||||
pub fn data(&self) -> &'a [u8] {
|
||||
self._tab
|
||||
.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(
|
||||
VisualisationUpdate::VT_DATA,
|
||||
VisualizationUpdate::VT_DATA,
|
||||
None,
|
||||
)
|
||||
.map(|v| v.safe_slice())
|
||||
@ -1304,34 +1304,34 @@ pub mod org {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct VisualisationUpdateArgs<'a> {
|
||||
pub visualisationContext:
|
||||
Option<flatbuffers::WIPOffset<VisualisationContext<'a>>>,
|
||||
pub struct VisualizationUpdateArgs<'a> {
|
||||
pub visualizationContext:
|
||||
Option<flatbuffers::WIPOffset<VisualizationContext<'a>>>,
|
||||
pub data: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u8>>>,
|
||||
}
|
||||
impl<'a> Default for VisualisationUpdateArgs<'a> {
|
||||
impl<'a> Default for VisualizationUpdateArgs<'a> {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
VisualisationUpdateArgs {
|
||||
visualisationContext: None, // required field
|
||||
VisualizationUpdateArgs {
|
||||
visualizationContext: None, // required field
|
||||
data: None, // required field
|
||||
}
|
||||
}
|
||||
}
|
||||
pub struct VisualisationUpdateBuilder<'a: 'b, 'b> {
|
||||
pub struct VisualizationUpdateBuilder<'a: 'b, 'b> {
|
||||
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
|
||||
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
|
||||
}
|
||||
impl<'a: 'b, 'b> VisualisationUpdateBuilder<'a, 'b> {
|
||||
impl<'a: 'b, 'b> VisualizationUpdateBuilder<'a, 'b> {
|
||||
#[inline]
|
||||
pub fn add_visualisationContext(
|
||||
pub fn add_visualizationContext(
|
||||
&mut self,
|
||||
visualisationContext: flatbuffers::WIPOffset<VisualisationContext<'b>>,
|
||||
visualizationContext: flatbuffers::WIPOffset<VisualizationContext<'b>>,
|
||||
) {
|
||||
self.fbb_
|
||||
.push_slot_always::<flatbuffers::WIPOffset<VisualisationContext>>(
|
||||
VisualisationUpdate::VT_VISUALISATIONCONTEXT,
|
||||
visualisationContext,
|
||||
.push_slot_always::<flatbuffers::WIPOffset<VisualizationContext>>(
|
||||
VisualizationUpdate::VT_VISUALIZATIONCONTEXT,
|
||||
visualizationContext,
|
||||
);
|
||||
}
|
||||
#[inline]
|
||||
@ -1340,26 +1340,26 @@ pub mod org {
|
||||
data: flatbuffers::WIPOffset<flatbuffers::Vector<'b, u8>>,
|
||||
) {
|
||||
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(
|
||||
VisualisationUpdate::VT_DATA,
|
||||
VisualizationUpdate::VT_DATA,
|
||||
data,
|
||||
);
|
||||
}
|
||||
#[inline]
|
||||
pub fn new(
|
||||
_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>,
|
||||
) -> VisualisationUpdateBuilder<'a, 'b> {
|
||||
) -> VisualizationUpdateBuilder<'a, 'b> {
|
||||
let start = _fbb.start_table();
|
||||
VisualisationUpdateBuilder { fbb_: _fbb, start_: start }
|
||||
VisualizationUpdateBuilder { fbb_: _fbb, start_: start }
|
||||
}
|
||||
#[inline]
|
||||
pub fn finish(self) -> flatbuffers::WIPOffset<VisualisationUpdate<'a>> {
|
||||
pub fn finish(self) -> flatbuffers::WIPOffset<VisualizationUpdate<'a>> {
|
||||
let o = self.fbb_.end_table(self.start_);
|
||||
self.fbb_.required(
|
||||
o,
|
||||
VisualisationUpdate::VT_VISUALISATIONCONTEXT,
|
||||
"visualisation_context",
|
||||
VisualizationUpdate::VT_VISUALIZATIONCONTEXT,
|
||||
"visualization_context",
|
||||
);
|
||||
self.fbb_.required(o, VisualisationUpdate::VT_DATA, "data");
|
||||
self.fbb_.required(o, VisualizationUpdate::VT_DATA, "data");
|
||||
flatbuffers::WIPOffset::new(o.value())
|
||||
}
|
||||
}
|
||||
|
@ -132,24 +132,24 @@ trait API {
|
||||
#[MethodInput=PopFromExecutionContextInput, rpc_name="executionContext/pop"]
|
||||
fn pop_from_execution_context(&self, context_id: ContextId) -> ();
|
||||
|
||||
/// Attach a visualisation, potentially preprocessed by some arbitrary Enso code, to a given
|
||||
/// Attach a visualization, potentially preprocessed by some arbitrary Enso code, to a given
|
||||
/// node in the program.
|
||||
#[MethodInput=AttachVisualisationInput, rpc_name="executionContext/attachVisualisation"]
|
||||
fn attach_visualisation
|
||||
#[MethodInput=AttachVisualizationInput, rpc_name="executionContext/attachVisualization"]
|
||||
fn attach_visualization
|
||||
( &self
|
||||
, visualisation_id : Uuid
|
||||
, visualization_id : Uuid
|
||||
, expression_id : Uuid
|
||||
, visualisation_config : VisualisationConfiguration) -> ();
|
||||
, visualization_config : VisualizationConfiguration) -> ();
|
||||
|
||||
/// Detach a visualisation from the executing code.
|
||||
#[MethodInput=DetachVisualisationInput, rpc_name="executionContext/detachVisualisation"]
|
||||
fn detach_visualisation
|
||||
(&self, context_id: Uuid, visualisation_id: Uuid, expression_id: Uuid) -> ();
|
||||
/// Detach a visualization from the executing code.
|
||||
#[MethodInput=DetachVisualizationInput, rpc_name="executionContext/detachVisualization"]
|
||||
fn detach_visualization
|
||||
(&self, context_id: Uuid, visualization_id: Uuid, expression_id: Uuid) -> ();
|
||||
|
||||
/// Modify the configuration for an existing visualisation.
|
||||
#[MethodInput=ModifyVisualisationInput, rpc_name="executionContext/modifyVisualisation"]
|
||||
fn modify_visualisation
|
||||
(&self, visualisation_id: Uuid, visualisation_config: VisualisationConfiguration) -> ();
|
||||
/// Modify the configuration for an existing visualization.
|
||||
#[MethodInput=ModifyVisualizationInput, rpc_name="executionContext/modifyVisualization"]
|
||||
fn modify_visualization
|
||||
(&self, visualization_id: Uuid, visualization_config: VisualizationConfiguration) -> ();
|
||||
|
||||
/// Interrupt the program execution.
|
||||
#[MethodInput=InterruptInput, rpc_name="executionContext/interrupt"]
|
||||
@ -256,7 +256,7 @@ mod test {
|
||||
let error = RpcError::RemoteError(msg).into();
|
||||
assert!(is_timeout_error(&error));
|
||||
|
||||
let text = r#"{"code":2007,"message":"Evaluation of the visualisation expression failed"}"#;
|
||||
let text = r#"{"code":2007,"message":"Evaluation of the visualization expression failed"}"#;
|
||||
let msg = serde_json::from_str::<json_rpc::messages::Error>(text).unwrap();
|
||||
let error = RpcError::RemoteError(msg).into();
|
||||
assert!(!is_timeout_error(&error));
|
||||
|
@ -423,7 +423,7 @@ fn test_execution_context() {
|
||||
unit_json.clone(),
|
||||
(),
|
||||
);
|
||||
let visualisation_id = Uuid::default();
|
||||
let visualization_id = Uuid::default();
|
||||
let expression_id = Uuid::default();
|
||||
let visualization_function = "foo";
|
||||
let visualization_module = "[Foo.Bar.Baz]";
|
||||
@ -433,20 +433,20 @@ fn test_execution_context() {
|
||||
name: visualization_function.to_string(),
|
||||
};
|
||||
let positional_arguments_expressions = vec![1, 2, 3].iter().map(|x| x.to_string()).collect();
|
||||
let visualisation_config = VisualisationConfiguration {
|
||||
let visualization_config = VisualizationConfiguration {
|
||||
execution_context_id: context_id,
|
||||
expression,
|
||||
positional_arguments_expressions,
|
||||
};
|
||||
test_request(
|
||||
|client| {
|
||||
client.attach_visualisation(&visualisation_id, &expression_id, &visualisation_config)
|
||||
client.attach_visualization(&visualization_id, &expression_id, &visualization_config)
|
||||
},
|
||||
"executionContext/attachVisualisation",
|
||||
"executionContext/attachVisualization",
|
||||
json!({
|
||||
"visualisationId" : "00000000-0000-0000-0000-000000000000",
|
||||
"visualizationId" : "00000000-0000-0000-0000-000000000000",
|
||||
"expressionId" : "00000000-0000-0000-0000-000000000000",
|
||||
"visualisationConfig" : {
|
||||
"visualizationConfig" : {
|
||||
"executionContextId" : "00000000-0000-0000-0000-000000000000",
|
||||
"expression" : {
|
||||
"module" : "[Foo.Bar.Baz]",
|
||||
@ -460,11 +460,11 @@ fn test_execution_context() {
|
||||
(),
|
||||
);
|
||||
test_request(
|
||||
|client| client.detach_visualisation(&context_id, &visualisation_id, &expression_id),
|
||||
"executionContext/detachVisualisation",
|
||||
|client| client.detach_visualization(&context_id, &visualization_id, &expression_id),
|
||||
"executionContext/detachVisualization",
|
||||
json!({
|
||||
"contextId" : "00000000-0000-0000-0000-000000000000",
|
||||
"visualisationId" : "00000000-0000-0000-0000-000000000000",
|
||||
"visualizationId" : "00000000-0000-0000-0000-000000000000",
|
||||
"expressionId" : "00000000-0000-0000-0000-000000000000"
|
||||
}),
|
||||
unit_json.clone(),
|
||||
@ -478,17 +478,17 @@ fn test_execution_context() {
|
||||
name: visualization_function.to_string(),
|
||||
};
|
||||
let positional_arguments_expressions = vec!["foo"].iter().map(|x| x.to_string()).collect();
|
||||
let visualisation_config = VisualisationConfiguration {
|
||||
let visualization_config = VisualizationConfiguration {
|
||||
execution_context_id: context_id,
|
||||
expression,
|
||||
positional_arguments_expressions,
|
||||
};
|
||||
test_request(
|
||||
|client| client.modify_visualisation(&visualisation_id, &visualisation_config),
|
||||
"executionContext/modifyVisualisation",
|
||||
|client| client.modify_visualization(&visualization_id, &visualization_config),
|
||||
"executionContext/modifyVisualization",
|
||||
json!({
|
||||
"visualisationId" : "00000000-0000-0000-0000-000000000000",
|
||||
"visualisationConfig" : {
|
||||
"visualizationId" : "00000000-0000-0000-0000-000000000000",
|
||||
"visualizationConfig" : {
|
||||
"executionContextId" : "00000000-0000-0000-0000-000000000000",
|
||||
"expression" : {
|
||||
"module" : "[Foo.Bar.Baz]",
|
||||
|
@ -166,9 +166,9 @@ pub enum Notification {
|
||||
ContentRootRemoved { id: Uuid },
|
||||
|
||||
/// Sent from server to the client to inform about a failure during execution of a
|
||||
/// visualisation.
|
||||
#[serde(rename = "executionContext/visualisationEvaluationFailed")]
|
||||
VisualisationEvaluationFailed(VisualisationEvaluationFailed),
|
||||
/// visualization.
|
||||
#[serde(rename = "executionContext/visualizationEvaluationFailed")]
|
||||
VisualizationEvaluationFailed(VisualizationEvaluationFailed),
|
||||
}
|
||||
|
||||
/// Sent from the server to the client to inform about a failure during execution of an execution
|
||||
@ -181,13 +181,13 @@ pub struct ExecutionFailed {
|
||||
pub message: String,
|
||||
}
|
||||
|
||||
/// Sent from server to the client to inform about a failure during execution of a visualisation.
|
||||
/// Sent from server to the client to inform about a failure during execution of a visualization.
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize, Eq)]
|
||||
#[allow(missing_docs)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct VisualisationEvaluationFailed {
|
||||
pub struct VisualizationEvaluationFailed {
|
||||
pub context_id: ContextId,
|
||||
pub visualisation_id: Uuid,
|
||||
pub visualization_id: Uuid,
|
||||
pub expression_id: ExpressionId,
|
||||
pub message: String,
|
||||
pub diagnostic: Option<Diagnostic>,
|
||||
@ -708,11 +708,11 @@ pub type ContextId = Uuid;
|
||||
/// Execution context expression ID.
|
||||
pub type ExpressionId = Uuid;
|
||||
|
||||
/// A configuration object for properties of the visualisation.
|
||||
/// A configuration object for properties of the visualization.
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[allow(missing_docs)]
|
||||
pub struct VisualisationConfiguration {
|
||||
pub struct VisualizationConfiguration {
|
||||
/// An execution context of the visualization.
|
||||
pub execution_context_id: ContextId,
|
||||
/// An enso function that will transform the data into expected format.
|
||||
|
@ -2,7 +2,7 @@
|
||||
//!
|
||||
//! This controller provides operations on a specific graph with some execution context - these
|
||||
//! operations usually involves retrieving values on nodes: that's are i.e. operations on
|
||||
//! visualisations, retrieving types on ports, etc.
|
||||
//! visualizations, retrieving types on ports, etc.
|
||||
|
||||
use crate::prelude::*;
|
||||
|
||||
|
@ -11,7 +11,7 @@ use engine_protocol::language_server::ExecutionEnvironment;
|
||||
use engine_protocol::language_server::ExpressionUpdate;
|
||||
use engine_protocol::language_server::ExpressionUpdatePayload;
|
||||
use engine_protocol::language_server::MethodPointer;
|
||||
use engine_protocol::language_server::VisualisationConfiguration;
|
||||
use engine_protocol::language_server::VisualizationConfiguration;
|
||||
use ensogl::data::color;
|
||||
use flo_stream::Subscriber;
|
||||
use mockall::automock;
|
||||
@ -341,11 +341,11 @@ impl Visualization {
|
||||
Visualization { id, expression_id, method_pointer, arguments }
|
||||
}
|
||||
|
||||
/// Creates a `VisualisationConfiguration` that is used in communication with language server.
|
||||
pub fn config(&self, execution_context_id: Uuid) -> VisualisationConfiguration {
|
||||
/// Creates a `VisualizationConfiguration` that is used in communication with language server.
|
||||
pub fn config(&self, execution_context_id: Uuid) -> VisualizationConfiguration {
|
||||
let expression = self.method_pointer.clone().into();
|
||||
let positional_arguments_expressions = self.arguments.clone();
|
||||
VisualisationConfiguration {
|
||||
VisualizationConfiguration {
|
||||
execution_context_id,
|
||||
expression,
|
||||
positional_arguments_expressions,
|
||||
|
@ -13,7 +13,7 @@ use crate::model::execution_context::VisualizationUpdateData;
|
||||
|
||||
use engine_protocol::language_server::ExecutionEnvironment;
|
||||
use engine_protocol::language_server::MethodPointer;
|
||||
use engine_protocol::language_server::VisualisationConfiguration;
|
||||
use engine_protocol::language_server::VisualizationConfiguration;
|
||||
use futures::future::LocalBoxFuture;
|
||||
use std::cmp::Ordering;
|
||||
|
||||
@ -99,13 +99,13 @@ impl ExecutionContext {
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a `VisualisationConfiguration` for the visualization with given id. It may be used
|
||||
/// Creates a `VisualizationConfiguration` for the visualization with given id. It may be used
|
||||
/// in communication with language server.
|
||||
pub fn visualization_config(
|
||||
&self,
|
||||
id: VisualizationId,
|
||||
execution_context_id: Uuid,
|
||||
) -> FallibleResult<VisualisationConfiguration> {
|
||||
) -> FallibleResult<VisualizationConfiguration> {
|
||||
let err = || InvalidVisualizationId(id);
|
||||
let visualizations = self.visualizations.borrow();
|
||||
Ok(visualizations.get(&id).ok_or_else(err)?.visualization.config(execution_context_id))
|
||||
|
@ -137,7 +137,7 @@ impl ExecutionContext {
|
||||
let ast_id = vis.expression_id;
|
||||
let ls = self.language_server.clone_ref();
|
||||
info!("About to detach visualization by id: {vis_id}.");
|
||||
ls.detach_visualisation(&exe_id, &vis_id, &ast_id).await?;
|
||||
ls.detach_visualization(&exe_id, &vis_id, &ast_id).await?;
|
||||
if let Err(err) = self.model.detach_visualization(vis_id) {
|
||||
warn!("Failed to update model after detaching visualization: {err:?}.")
|
||||
}
|
||||
@ -244,7 +244,7 @@ impl model::execution_context::API for ExecutionContext {
|
||||
async move {
|
||||
let result = self
|
||||
.language_server
|
||||
.attach_visualisation(&vis.id, &vis.expression_id, &config)
|
||||
.attach_visualization(&vis.id, &vis.expression_id, &config)
|
||||
.await;
|
||||
if let Err(e) = result {
|
||||
self.model.detach_visualization(vis.id)?;
|
||||
@ -277,7 +277,7 @@ impl model::execution_context::API for ExecutionContext {
|
||||
let new_config = self.model.visualization_config(id, self.id);
|
||||
async move {
|
||||
result?;
|
||||
self.language_server.modify_visualisation(&id, &new_config?).await?;
|
||||
self.language_server.modify_visualization(&id, &new_config?).await?;
|
||||
Ok(())
|
||||
}
|
||||
.boxed_local()
|
||||
@ -542,8 +542,8 @@ pub mod test {
|
||||
let ast_id = vis.expression_id;
|
||||
let config = vis.config(exe_id);
|
||||
|
||||
expect_call!(ls.attach_visualisation(vis_id,ast_id,config) => Ok(()));
|
||||
expect_call!(ls.detach_visualisation(exe_id,vis_id,ast_id) => Ok(()));
|
||||
expect_call!(ls.attach_visualization(vis_id,ast_id,config) => Ok(()));
|
||||
expect_call!(ls.detach_visualization(exe_id,vis_id,ast_id) => Ok(()));
|
||||
});
|
||||
|
||||
test.run_task(async move {
|
||||
@ -595,10 +595,10 @@ pub mod test {
|
||||
let config = vis.config(exe_id);
|
||||
let config2 = vis2.config(exe_id);
|
||||
|
||||
expect_call!(ls.attach_visualisation(vis_id,ast_id,config) => Ok(()));
|
||||
expect_call!(ls.attach_visualisation(vis2_id,ast_id,config2) => Ok(()));
|
||||
expect_call!(ls.detach_visualisation(exe_id,vis_id,ast_id) => Ok(()));
|
||||
expect_call!(ls.detach_visualisation(exe_id,vis2_id,ast_id) => Ok(()));
|
||||
expect_call!(ls.attach_visualization(vis_id,ast_id,config) => Ok(()));
|
||||
expect_call!(ls.attach_visualization(vis2_id,ast_id,config2) => Ok(()));
|
||||
expect_call!(ls.detach_visualization(exe_id,vis_id,ast_id) => Ok(()));
|
||||
expect_call!(ls.detach_visualization(exe_id,vis2_id,ast_id) => Ok(()));
|
||||
});
|
||||
test.run_task(async move {
|
||||
// We discard visualization update streams -- they are covered by a separate test.
|
||||
@ -632,14 +632,14 @@ pub mod test {
|
||||
let ast_id = vis.expression_id;
|
||||
let config = vis.config(exe_id);
|
||||
|
||||
let expected_config = language_server::types::VisualisationConfiguration {
|
||||
let expected_config = language_server::types::VisualizationConfiguration {
|
||||
execution_context_id: data.context_id,
|
||||
expression: new_expression.clone().into(),
|
||||
positional_arguments_expressions: arguments.clone(),
|
||||
};
|
||||
|
||||
expect_call!(ls.attach_visualisation(vis_id,ast_id,config) => Ok(()));
|
||||
expect_call!(ls.modify_visualisation(vis_id,expected_config) => Ok(()));
|
||||
expect_call!(ls.attach_visualization(vis_id,ast_id,config) => Ok(()));
|
||||
expect_call!(ls.modify_visualization(vis_id,expected_config) => Ok(()));
|
||||
});
|
||||
|
||||
test.run_task(async move {
|
||||
|
@ -12,7 +12,7 @@ use crate::transport::web::WebSocket;
|
||||
|
||||
use double_representation::name::project;
|
||||
use engine_protocol::binary;
|
||||
use engine_protocol::binary::message::VisualisationContext;
|
||||
use engine_protocol::binary::message::VisualizationContext;
|
||||
use engine_protocol::common::error::code;
|
||||
use engine_protocol::language_server;
|
||||
use engine_protocol::language_server::response;
|
||||
@ -80,7 +80,7 @@ impl ExecutionContextsRegistry {
|
||||
/// Route the visualization update into the appropriate execution context.
|
||||
pub fn dispatch_visualization_update(
|
||||
&self,
|
||||
context: VisualisationContext,
|
||||
context: VisualizationContext,
|
||||
data: VisualizationUpdateData,
|
||||
) -> FallibleResult {
|
||||
self.with_context(context.context_id, |ctx| {
|
||||
@ -577,12 +577,12 @@ impl Project {
|
||||
content_roots.remove(id);
|
||||
}
|
||||
}
|
||||
Event::Notification(Notification::VisualisationEvaluationFailed(update)) => {
|
||||
Event::Notification(Notification::VisualizationEvaluationFailed(update)) => {
|
||||
error!(
|
||||
"Visualisation evaluation failed in context {} for visualisation {} of \
|
||||
"Visualization evaluation failed in context {} for visualization {} of \
|
||||
expression {}. Error: {}",
|
||||
update.context_id,
|
||||
update.visualisation_id,
|
||||
update.visualization_id,
|
||||
update.expression_id,
|
||||
update.message
|
||||
);
|
||||
|
@ -60,7 +60,7 @@ Number.foo = x ->
|
||||
[[{"index": {"value": 98}, "size": {"value": 5}}, "5fc0c11d-bd83-4ca3-b847-b8e362f7658c"],[{"index": {"value": 81}, "size": {"value": 8}}, "1cda3676-bd62-41f8-b6a1-a1e1b7c73d18"],[{"index": {"value": 42}, "size": {"value": 5}}, "899a11e5-4d2b-43dc-a867-2f2ef2d2ba62"],[{"index": {"value": 26}, "size": {"value": 7}}, "37f284d4-c593-4e65-a4be-4948fbd2adfb"],[{"index": {"value": 16}, "size": {"value": 1}}, "c553533e-a2b9-4305-9f12-b8fe7781f933"]]
|
||||
[]"#;
|
||||
|
||||
const VISUALISATION_CODE: &str = r#"
|
||||
const VISUALIZATION_CODE: &str = r#"
|
||||
encode = x -> x.to_text
|
||||
|
||||
incAndEncode = x -> here.encode x+1
|
||||
@ -84,10 +84,10 @@ async fn ls_text_protocol_test() {
|
||||
let result = client.write_file(&file, &contents).await;
|
||||
result.expect("Couldn't write main code file.");
|
||||
|
||||
let visualisation_file = Path::new(root_id, &["src", "Visualisation.enso"]);
|
||||
let contents = VISUALISATION_CODE.to_string();
|
||||
let response = client.write_file(&visualisation_file, &contents).await;
|
||||
response.expect("Couldn't write visualisation file.");
|
||||
let visualization_file = Path::new(root_id, &["src", "Visualization.enso"]);
|
||||
let contents = VISUALIZATION_CODE.to_string();
|
||||
let response = client.write_file(&visualization_file, &contents).await;
|
||||
response.expect("Couldn't write visualization file.");
|
||||
|
||||
let package_file = Path::new(root_id, &["package.yaml"]);
|
||||
let contents = PACKAGE_YAML.to_string();
|
||||
@ -125,45 +125,45 @@ async fn ls_text_protocol_test() {
|
||||
|
||||
|
||||
// Setting visualization.
|
||||
let visualisation_id = uuid::Uuid::new_v4();
|
||||
let visualization_id = uuid::Uuid::new_v4();
|
||||
let expression_id = uuid::Uuid::parse_str("c553533e-a2b9-4305-9f12-b8fe7781f933");
|
||||
let expression_id = expression_id.expect("Couldn't parse expression ID.");
|
||||
let visualization_function = "foo".to_string();
|
||||
let visualization_module = "Test.Visualisation";
|
||||
let visualization_module = "Test.Visualization";
|
||||
let expression = MethodPointer {
|
||||
module: visualization_module.to_string(),
|
||||
defined_on_type: visualization_module.to_string(),
|
||||
name: visualization_function,
|
||||
};
|
||||
let positional_arguments_expressions = vec!["1".to_owned()];
|
||||
let visualisation_config = VisualisationConfiguration {
|
||||
let visualization_config = VisualizationConfiguration {
|
||||
execution_context_id,
|
||||
expression,
|
||||
positional_arguments_expressions,
|
||||
};
|
||||
let response =
|
||||
client.attach_visualisation(&visualisation_id, &expression_id, &visualisation_config);
|
||||
response.await.expect("Couldn't attach visualisation.");
|
||||
client.attach_visualization(&visualization_id, &expression_id, &visualization_config);
|
||||
response.await.expect("Couldn't attach visualization.");
|
||||
|
||||
let visualization_function = "bar".to_string();
|
||||
let visualization_module = "Test.Visualisation";
|
||||
let visualization_module = "Test.Visualization";
|
||||
let expression = MethodPointer {
|
||||
module: visualization_module.to_string(),
|
||||
defined_on_type: visualization_module.to_string(),
|
||||
name: visualization_function,
|
||||
};
|
||||
let positional_arguments_expressions = vec!["1".to_owned(), "2".to_owned()];
|
||||
let visualisation_config = VisualisationConfiguration {
|
||||
let visualization_config = VisualizationConfiguration {
|
||||
execution_context_id,
|
||||
expression,
|
||||
positional_arguments_expressions,
|
||||
};
|
||||
let response = client.modify_visualisation(&visualisation_id, &visualisation_config).await;
|
||||
response.expect("Couldn't modify visualisation.");
|
||||
let response = client.modify_visualization(&visualization_id, &visualization_config).await;
|
||||
response.expect("Couldn't modify visualization.");
|
||||
|
||||
let response =
|
||||
client.detach_visualisation(&execution_context_id, &visualisation_id, &expression_id).await;
|
||||
response.expect("Couldn't detach visualisation.");
|
||||
client.detach_visualization(&execution_context_id, &visualization_id, &expression_id).await;
|
||||
response.expect("Couldn't detach visualization.");
|
||||
|
||||
let response = client.destroy_execution_context(&execution_context_id).await;
|
||||
response.expect("Couldn't destroy execution context.");
|
||||
|
@ -41,7 +41,7 @@ class Heatmap extends Visualization {
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether this visualisation has been initialised.
|
||||
* Indicates whether this visualization has been initialised.
|
||||
*/
|
||||
isInitialised() {
|
||||
ok(this.svg)
|
||||
|
@ -76,7 +76,7 @@ class Histogram extends Visualization {
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether this visualisation has been initialised.
|
||||
* Indicates whether this visualization has been initialised.
|
||||
*/
|
||||
isInitialised() {
|
||||
ok(this.svg)
|
||||
|
@ -12,4 +12,4 @@ pub mod text_visualization;
|
||||
|
||||
pub use bubble_chart::BubbleChart;
|
||||
pub use error::Error;
|
||||
pub use text_visualization::TextVisualisation;
|
||||
pub use text_visualization::TextVisualization;
|
||||
|
@ -1,4 +1,4 @@
|
||||
//! Bubble Chart visualisation implemented using the native shape system.
|
||||
//! Bubble Chart visualization implemented using the native shape system.
|
||||
|
||||
use crate::component::visualization::*;
|
||||
use crate::prelude::*;
|
||||
|
@ -1,4 +1,4 @@
|
||||
//! Example visualisation showing the provided data as text.
|
||||
//! Example visualization showing the provided data as text.
|
||||
|
||||
use crate::component::visualization::*;
|
||||
use crate::prelude::*;
|
||||
@ -35,12 +35,12 @@ const PADDING_TEXT: f32 = 10.0;
|
||||
|
||||
/// The module containing the `PREPROCESSOR_FUNCTION`. See there.
|
||||
// NOTE: contents of this const need to be kept in sync with Scala test in
|
||||
// RuntimeVisualisationsTest.scala, used to verify the snippet's correctness
|
||||
// RuntimeVisualizationsTest.scala, used to verify the snippet's correctness
|
||||
const PREPROCESSOR_MODULE: &str = "Standard.Visualization.Preprocessor";
|
||||
|
||||
/// The method name of the error preprocessor.
|
||||
// NOTE: contents of this const need to be kept in sync with Scala test in
|
||||
// RuntimeVisualisationsTest.scala, used to verify the snippet's correctness
|
||||
// RuntimeVisualizationsTest.scala, used to verify the snippet's correctness
|
||||
const PREPROCESSOR_METHOD: &str = "error_preprocessor";
|
||||
|
||||
/// The list of arguments passed to the error preprocessor.
|
||||
|
@ -1,8 +1,8 @@
|
||||
//! Text visualisation that can show text based data from the backend. If the text is larger than
|
||||
//! Text visualization that can show text based data from the backend. If the text is larger than
|
||||
//! the available space, it will use lazy loading to request only a subset of the data to
|
||||
//! display. This is useful for large texts to avoid overwhelming the visualisation.
|
||||
//! display. This is useful for large texts to avoid overwhelming the visualization.
|
||||
//!
|
||||
//! The visualisation is made up of text `chunks` that are cached and will be requested form the
|
||||
//! The visualization is made up of text `chunks` that are cached and will be requested form the
|
||||
//! backend. The size of the chunks is determined by the `chunk_size` parameter and each hunk is
|
||||
//! shown as a cell in a grid.
|
||||
//!
|
||||
@ -52,10 +52,10 @@ use text_provider::TextProvider;
|
||||
|
||||
/// Number of characters that can be displayed in one grid cell and will be requested together from
|
||||
/// the engine. Also referred to as `chunk`. This value can be changed to tweak the size of the
|
||||
/// messages sent to the visualisation as well as the caching performance. A larger value will
|
||||
/// result in fewer, smaller messages, but the visualisation might have to load more data that is
|
||||
/// messages sent to the visualization as well as the caching performance. A larger value will
|
||||
/// result in fewer, smaller messages, but the visualization might have to load more data that is
|
||||
/// not needed, as it will be cropped. For example, a value of 100, would mean that the
|
||||
/// visualisation would request 100 characters per chunk, even if it can only show 10 characters at
|
||||
/// visualization would request 100 characters per chunk, even if it can only show 10 characters at
|
||||
/// once in the available viewport.
|
||||
const CHARS_PER_CHUNK: usize = 20;
|
||||
/// Extra chunks to load around the visible grid to ensure smooth scrolling. Extra chunks are
|
||||
@ -480,22 +480,22 @@ impl FontLoadedNotifier {
|
||||
|
||||
|
||||
// ===========================
|
||||
// === Visualisation Types ===
|
||||
// === Visualization Types ===
|
||||
// ===========================
|
||||
|
||||
/// A text grid backed by a `String`. Used for testing and backend agnostic development and demos.
|
||||
/// Should not be used in production as it is not optimized for performance.
|
||||
pub type DebugTextGridVisualisation = TextGrid<String>;
|
||||
pub type DebugTextGridVisualization = TextGrid<String>;
|
||||
/// A text grid backed by a the engine. Requests data from the engine on demand and renders it.
|
||||
pub type TextVisualisation = TextGrid<BackendTextProvider>;
|
||||
pub type TextVisualization = TextGrid<BackendTextProvider>;
|
||||
|
||||
/// Return definition of a lazy text visualisation.
|
||||
pub fn text_visualisation() -> visualization::Definition {
|
||||
/// Return definition of a lazy text visualization.
|
||||
pub fn text_visualization() -> visualization::Definition {
|
||||
let path = visualization::Path::builtin("JSON");
|
||||
visualization::Definition::new(
|
||||
visualization::Signature::new_for_any_type(path, visualization::Format::Json),
|
||||
|app| {
|
||||
let grid = TextVisualisation::new(app.clone_ref());
|
||||
let grid = TextVisualization::new(app.clone_ref());
|
||||
grid.set_text_provider(BackendTextProvider::new(
|
||||
grid.frp.inputs.send_data.clone_ref(),
|
||||
grid.frp.preprocessor_change.clone_ref(),
|
||||
|
@ -222,7 +222,7 @@ ensogl::define_endpoints_2! {
|
||||
/// visualization state is explicitly changed by the user. The preview looks the same as
|
||||
/// normal visualization, but its state is not persisted in the node's metadata.
|
||||
show_preview (),
|
||||
/// Indicate whether preview visualisations should be delayed or immediate.
|
||||
/// Indicate whether preview visualizations should be delayed or immediate.
|
||||
quick_preview_vis (bool),
|
||||
set_view_mode (view::Mode),
|
||||
set_profiling_min_global_duration (f32),
|
||||
@ -769,7 +769,7 @@ impl Node {
|
||||
|
||||
visualization.set_view_state <+ action_bar.user_action_visibility.on_false().constant(visualization::ViewState::Disabled);
|
||||
|
||||
// Show preview visualisation after some delay, depending on whether we show an error
|
||||
// Show preview visualization after some delay, depending on whether we show an error
|
||||
// or are in quick preview mode. Also, omit the preview if we don't have an
|
||||
// expression.
|
||||
has_tooltip <- model.output.frp.tooltip.map(|tt| tt.has_content());
|
||||
|
@ -1,12 +1,12 @@
|
||||
//! This module defines the `Container` struct and related functionality. This represent the view
|
||||
//! a visualisation in the graph editor and includes a visual box that contains the visualisation,
|
||||
//! and action bar that allows setting the visualisation type.
|
||||
//! a visualization in the graph editor and includes a visual box that contains the visualization,
|
||||
//! and action bar that allows setting the visualization type.
|
||||
//!
|
||||
//! The `[Container]` struct is responsible for managing the visualisation and action bar and
|
||||
//! providing a unified interface to the graph editor. This includes ensuring that the visualisation
|
||||
//! The `[Container]` struct is responsible for managing the visualization and action bar and
|
||||
//! providing a unified interface to the graph editor. This includes ensuring that the visualization
|
||||
//! is correctly positioned, sized and layouted in its different [ViewState]s (which include the
|
||||
//! `Enabled`, `Fullscreen` and `Preview` states). Importantly, this also includes EnsoGL layer
|
||||
//! management to ensure correct occlusion of the visualisation with respect to other scene objects.
|
||||
//! management to ensure correct occlusion of the visualization with respect to other scene objects.
|
||||
|
||||
// FIXME There is a serious performance problem in this implementation. It assumes that the
|
||||
// FIXME visualization is a child of the container. However, this is very inefficient. Consider a
|
||||
@ -53,7 +53,7 @@ pub mod visualization_chooser;
|
||||
// === Constants ===
|
||||
// =================
|
||||
|
||||
/// Default width and height of the visualisation container.
|
||||
/// Default width and height of the visualization container.
|
||||
pub const DEFAULT_SIZE: (f32, f32) = (200.0, 200.0);
|
||||
const PADDING: f32 = 20.0;
|
||||
const CORNER_RADIUS: f32 = super::super::node::CORNER_RADIUS;
|
||||
@ -65,7 +65,7 @@ const ACTION_BAR_HEIGHT: f32 = 2.0 * CORNER_RADIUS;
|
||||
// === Shape ===
|
||||
// =============
|
||||
|
||||
/// Container overlay shape definition. Used to capture events over the visualisation within the
|
||||
/// Container overlay shape definition. Used to capture events over the visualization within the
|
||||
/// container.
|
||||
pub mod overlay {
|
||||
use super::*;
|
||||
@ -134,32 +134,32 @@ pub mod background {
|
||||
// === Frp ===
|
||||
// ===========
|
||||
|
||||
/// Indicates the visibility state of the visualisation.
|
||||
/// Indicates the visibility state of the visualization.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Derivative)]
|
||||
#[derivative(Default)]
|
||||
pub enum ViewState {
|
||||
/// Visualisation is permanently enabled and visible in the graph editor. It is attached to a
|
||||
/// Visualization is permanently enabled and visible in the graph editor. It is attached to a
|
||||
/// single node and can be moved and interacted with when selected.
|
||||
Enabled,
|
||||
/// Visualisation is disabled and hidden in the graph editor.
|
||||
/// Visualization is disabled and hidden in the graph editor.
|
||||
#[derivative(Default)]
|
||||
Disabled,
|
||||
/// Visualisation is temporarily enabled and visible in the graph editor. It should be placed
|
||||
/// Visualization is temporarily enabled and visible in the graph editor. It should be placed
|
||||
/// above other scene elements to allow quick inspection.
|
||||
Preview,
|
||||
/// Visualisation is enabled and visible in the graph editor in fullscreen mode. It occludes
|
||||
/// Visualization is enabled and visible in the graph editor in fullscreen mode. It occludes
|
||||
/// the whole graph and can be interacted with.
|
||||
Fullscreen,
|
||||
}
|
||||
|
||||
impl ViewState {
|
||||
/// Indicates whether the visualisation is visible in the graph editor. It is always visible
|
||||
/// Indicates whether the visualization is visible in the graph editor. It is always visible
|
||||
/// when not disabled.
|
||||
pub fn is_visible(&self) -> bool {
|
||||
!matches!(self, ViewState::Disabled)
|
||||
}
|
||||
|
||||
/// Indicates whether the visualisation is fullscreen mode.
|
||||
/// Indicates whether the visualization is fullscreen mode.
|
||||
pub fn is_fullscreen(&self) -> bool {
|
||||
matches!(self, ViewState::Fullscreen)
|
||||
}
|
||||
@ -179,7 +179,7 @@ ensogl::define_endpoints_2! {
|
||||
}
|
||||
Output {
|
||||
preprocessor (PreprocessorConfiguration),
|
||||
visualisation (Option<visualization::Definition>),
|
||||
visualization (Option<visualization::Definition>),
|
||||
visualization_path (Option<visualization::Path>),
|
||||
size (Vector2),
|
||||
is_selected (bool),
|
||||
@ -304,7 +304,7 @@ impl display::Object for View {
|
||||
#[allow(missing_docs)]
|
||||
pub struct ContainerModel {
|
||||
display_object: display::object::Instance,
|
||||
/// Internal root for all sub-objects. Will be moved when the visualisation
|
||||
/// Internal root for all sub-objects. Will be moved when the visualization
|
||||
/// container position is changed by dragging.
|
||||
drag_root: display::object::Instance,
|
||||
visualization: RefCell<Option<visualization::Instance>>,
|
||||
@ -569,28 +569,28 @@ impl Container {
|
||||
output.visible <+ output.view_state.map(|state| state.is_visible()).on_change();
|
||||
output.size <+ input.set_size.on_change();
|
||||
|
||||
visualisation_not_selected <- input.set_visualization.map(|t| t.is_none());
|
||||
visualization_not_selected <- input.set_visualization.map(|t| t.is_none());
|
||||
input_type_not_set <- input.set_vis_input_type.is_some().not();
|
||||
uninitialised <- visualisation_not_selected && input_type_not_set;
|
||||
set_default_visualisation <- uninitialised.on_change().on_true().map(|_| {
|
||||
Some(visualization::Registry::default_visualisation())
|
||||
uninitialised <- visualization_not_selected && input_type_not_set;
|
||||
set_default_visualization <- uninitialised.on_change().on_true().map(|_| {
|
||||
Some(visualization::Registry::default_visualization())
|
||||
});
|
||||
vis_input_type_changed <- input.set_vis_input_type.on_change();
|
||||
vis_input_type_changed_without_selection <-
|
||||
vis_input_type_changed.gate(&visualisation_not_selected).unwrap();
|
||||
set_default_visualisation_for_type <- vis_input_type_changed_without_selection.map(f!((tp) {
|
||||
vis_input_type_changed.gate(&visualization_not_selected).unwrap();
|
||||
set_default_visualization_for_type <- vis_input_type_changed_without_selection.map(f!((tp) {
|
||||
registry.default_visualization_for_type(tp)
|
||||
}));
|
||||
set_default_visualisation <- any(
|
||||
&set_default_visualisation, &set_default_visualisation_for_type);
|
||||
set_default_visualization <- any(
|
||||
&set_default_visualization, &set_default_visualization_for_type);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// === Visualisation Chooser Bindings ===
|
||||
// === Visualization Chooser Bindings ===
|
||||
|
||||
frp::extend! { network
|
||||
selected_definition <- action_bar.visualisation_selection.map(f!([registry](path)
|
||||
selected_definition <- action_bar.visualization_selection.map(f!([registry](path)
|
||||
path.as_ref().and_then(|path| registry.definition_from_path(path))
|
||||
));
|
||||
action_bar.hide_icons <+ selected_definition.constant(());
|
||||
@ -603,7 +603,7 @@ impl Container {
|
||||
// === Cycling Visualizations ===
|
||||
|
||||
frp::extend! { network
|
||||
vis_after_cycling <- input.cycle_visualization.map3(&output.visualisation, &output.vis_input_type,
|
||||
vis_after_cycling <- input.cycle_visualization.map3(&output.visualization, &output.vis_input_type,
|
||||
f!(((),vis,input_type) model.next_visualization(vis,input_type))
|
||||
);
|
||||
}
|
||||
@ -616,10 +616,10 @@ impl Container {
|
||||
input.set_visualization,
|
||||
selected_definition,
|
||||
vis_after_cycling,
|
||||
set_default_visualisation);
|
||||
set_default_visualization);
|
||||
new_vis_definition <- vis_definition_set.on_change();
|
||||
let preprocessor = &output.preprocessor;
|
||||
output.visualisation <+ new_vis_definition.map2(&output.view_state, f!(
|
||||
output.visualization <+ new_vis_definition.map2(&output.view_state, f!(
|
||||
[model,action_bar,app,preprocessor](vis_definition, view_state) {
|
||||
|
||||
if let Some(definition) = vis_definition {
|
||||
@ -637,15 +637,15 @@ impl Container {
|
||||
vis_definition.clone()
|
||||
}));
|
||||
|
||||
output.visualization_path <+ output.visualisation.map(|definition| {
|
||||
output.visualization_path <+ output.visualization.map(|definition| {
|
||||
definition.as_ref().map(|def| def.signature.path.clone_ref())
|
||||
});
|
||||
}
|
||||
|
||||
// === Visualisation Loading Spinner ===
|
||||
// === Visualization Loading Spinner ===
|
||||
|
||||
frp::extend! { network
|
||||
eval_ output.visualisation ( model.view.show_waiting_screen() );
|
||||
eval_ output.visualization ( model.view.show_waiting_screen() );
|
||||
eval_ input.set_data ( model.view.disable_waiting_screen() );
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@ ensogl::define_endpoints! {
|
||||
}
|
||||
|
||||
Output {
|
||||
visualisation_selection (Option<visualization::Path>),
|
||||
visualization_selection (Option<visualization::Path>),
|
||||
mouse_over (),
|
||||
mouse_out (),
|
||||
on_container_reset_position (),
|
||||
@ -333,7 +333,7 @@ impl display::Object for Model {
|
||||
// ==================
|
||||
|
||||
/// UI for executing actions on a node. Consists of label indicating the active visualization
|
||||
/// and a drop-down menu for selecting a new visualisation.
|
||||
/// and a drop-down menu for selecting a new visualization.
|
||||
///
|
||||
/// Layout
|
||||
/// ------
|
||||
@ -391,10 +391,10 @@ impl ActionBar {
|
||||
hide <- any(mouse_out_no_menu,remote_click);
|
||||
eval_ hide (model.hide());
|
||||
|
||||
// The action bar does not allow to deselect the visualisation, so we prohibit these
|
||||
// The action bar does not allow to deselect the visualization, so we prohibit these
|
||||
// events, which can occur on re-initialization.
|
||||
has_selection <- visualization_chooser.chosen_entry.is_some();
|
||||
frp.source.visualisation_selection
|
||||
frp.source.visualization_selection
|
||||
<+ visualization_chooser.chosen_entry.gate(&has_selection);
|
||||
|
||||
let reset_position_icon = &model.icons.reset_position_icon.events_deprecated;
|
||||
@ -411,7 +411,7 @@ impl ActionBar {
|
||||
eval show_reset_icon((visibility) model.icons.set_reset_icon_visibility(*visibility));
|
||||
|
||||
|
||||
// === Visualisation Chooser ===
|
||||
// === Visualization Chooser ===
|
||||
|
||||
// Note: we only want to update the chooser if it is visible, or when it becomes
|
||||
// visible. During startup we get the type information for every node, and propagate
|
||||
|
@ -1,4 +1,4 @@
|
||||
//! UI entity that allows for the selection of a visualisation. Uses the
|
||||
//! UI entity that allows for the selection of a visualization. Uses the
|
||||
//! `drop_down_menu::DropDownMenu` but provides convenience functionality to extract map the
|
||||
//! indices of the `DropDownMenu` to `Path` values.
|
||||
//!
|
||||
@ -83,10 +83,10 @@ impl display::Object for Model {
|
||||
|
||||
|
||||
// ============================
|
||||
// === VisualisationChooser ===
|
||||
// === VisualizationChooser ===
|
||||
// ============================
|
||||
|
||||
/// UI entity that shows a button that opens a list of visualisations that can be selected from.
|
||||
/// UI entity that shows a button that opens a list of visualizations that can be selected from.
|
||||
#[allow(missing_docs)]
|
||||
#[derive(Clone, CloneRef, Debug)]
|
||||
pub struct VisualizationChooser {
|
||||
@ -122,7 +122,7 @@ impl VisualizationChooser {
|
||||
entries.iter().position(|item| item == s)
|
||||
);
|
||||
if selected.is_some() && selected_ix.is_none() {
|
||||
warn!("Invalid visualisation selected {selected:?} from available {entries:?}");
|
||||
warn!("Invalid visualization selected {selected:?} from available {entries:?}");
|
||||
};
|
||||
selected_ix
|
||||
});
|
||||
@ -146,7 +146,7 @@ impl VisualizationChooser {
|
||||
if let Some(entry) = entry{
|
||||
let event = "graph_editor::visualization_chooser::vis_selected";
|
||||
let name:&str = entry.name.as_ref();
|
||||
let field = "visualisation_name";
|
||||
let field = "visualization_name";
|
||||
let data = analytics::AnonymousData(|| name.to_string());
|
||||
analytics::remote_log_value(event,field,data);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ impl Json {
|
||||
// === Data Format ===
|
||||
// ====================
|
||||
|
||||
/// Data formats that can be used in a visualisation.
|
||||
/// Data formats that can be used in a visualization.
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
|
||||
#[allow(missing_docs)]
|
||||
pub enum Format {
|
||||
|
@ -98,7 +98,7 @@ pub type InstantiationResult = Result<visualization::Instance, InstantiationErro
|
||||
|
||||
// === Errors ===
|
||||
|
||||
/// Indicates that instantiating a `Visualisation` from a `Definition` has failed.
|
||||
/// Indicates that instantiating a `Visualization` from a `Definition` has failed.
|
||||
#[derive(Debug)]
|
||||
#[allow(missing_docs)]
|
||||
pub enum InstantiationError {
|
||||
@ -109,7 +109,7 @@ impl Display for InstantiationError {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
InstantiationError::ConstructorError(value) => f.write_fmt(format_args!(
|
||||
"Could not construct visualisation because of error: {value:?}"
|
||||
"Could not construct visualization because of error: {value:?}"
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ impl JsConsArgs {
|
||||
self.theme.clone()
|
||||
}
|
||||
|
||||
/// Helper method to emit an preprocessor change event from the visualisation.
|
||||
/// Helper method to emit an preprocessor change event from the visualization.
|
||||
pub fn emit_preprocessor_change(
|
||||
&self,
|
||||
module: Option<String>,
|
||||
|
@ -118,7 +118,7 @@ impl InstanceModel {
|
||||
Ok(root_node)
|
||||
}
|
||||
|
||||
/// We need to provide a closure to the Visualisation on the JS side, which we then later
|
||||
/// We need to provide a closure to the Visualization on the JS side, which we then later
|
||||
/// can hook up to the FRP. Here we create a `PreprocessorCallbackCell`, which can hold a
|
||||
/// closure, and a `PreprocessorCallback` which holds a weak reference to the closure inside of
|
||||
/// the `PreprocessorCallbackCell`. This allows us to pass the `PreprocessorCallback` to the
|
||||
@ -161,7 +161,7 @@ impl InstanceModel {
|
||||
Ok(java_script::binding::Visualization::new())
|
||||
}
|
||||
|
||||
/// Tries to create a InstanceModel from the given visualisation class.
|
||||
/// Tries to create a InstanceModel from the given visualization class.
|
||||
pub fn from_class(class: &JsValue, scene: &Scene) -> result::Result<Self, Error> {
|
||||
let root_node = Self::create_root(scene)?;
|
||||
let (preprocessor_change, closure) = Self::preprocessor_change_callback();
|
||||
|
@ -1,4 +1,4 @@
|
||||
//! Functionality that allows one to manage occlusion/layers of visualisations in the scene.
|
||||
//! Functionality that allows one to manage occlusion/layers of visualizations in the scene.
|
||||
|
||||
use ensogl::display::DomSymbol;
|
||||
use ensogl::display::Scene;
|
||||
@ -9,14 +9,14 @@ use ensogl::display::Scene;
|
||||
// === Layer ===
|
||||
// =============
|
||||
|
||||
/// Indicates where the visualisation should be displayed.
|
||||
/// Indicates where the visualization should be displayed.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum Layer {
|
||||
/// Display the visualisation as part of the scene.
|
||||
/// Display the visualization as part of the scene.
|
||||
Default,
|
||||
/// Display the visualisation over the scene.
|
||||
/// Display the visualization over the scene.
|
||||
Front,
|
||||
/// Display the visualisation in fullscreen mode.
|
||||
/// Display the visualization in fullscreen mode.
|
||||
Fullscreen,
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ impl Registry {
|
||||
&self,
|
||||
tp: &enso::Type,
|
||||
) -> Option<visualization::Definition> {
|
||||
// TODO[MM]: Visualisations are order by "matching the type" first, followed by and then
|
||||
// TODO[MM]: Visualizations are order by "matching the type" first, followed by and then
|
||||
// "matching any type". So we just take the first one, which should be the most appropriate
|
||||
// one. This should be replaced with the proper solution described in
|
||||
// https://github.com/enso-org/enso/issues/5195
|
||||
@ -106,10 +106,10 @@ impl Registry {
|
||||
|
||||
/// Add default visualizations to the registry.
|
||||
pub fn add_default_visualizations(&self) {
|
||||
// Note that the order is important. Visualisations that are added first will be
|
||||
// Note that the order is important. Visualizations that are added first will be
|
||||
// prioritised as default (as long as they have a matching type to the value they will
|
||||
// represent.
|
||||
self.add(builtin::visualization::native::text_visualization::text_visualisation());
|
||||
self.add(builtin::visualization::native::text_visualization::text_visualization());
|
||||
self.try_add_java_script(builtin::visualization::java_script::table_visualization());
|
||||
self.try_add_java_script(builtin::visualization::java_script::scatter_plot_visualization());
|
||||
self.try_add_java_script(builtin::visualization::java_script::histogram_visualization());
|
||||
@ -120,9 +120,9 @@ impl Registry {
|
||||
self.try_add_java_script(builtin::visualization::java_script::warnings_visualization());
|
||||
}
|
||||
|
||||
/// Return a default visualisation definition.
|
||||
pub fn default_visualisation() -> visualization::Definition {
|
||||
builtin::visualization::native::text_visualization::text_visualisation()
|
||||
/// Return a default visualization definition.
|
||||
pub fn default_visualization() -> visualization::Definition {
|
||||
builtin::visualization::native::text_visualization::text_visualization()
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
fn assert_no_duplicate_default_visualisations() {
|
||||
fn assert_no_duplicate_default_visualizations() {
|
||||
let registry = Registry::new();
|
||||
registry.add_default_visualizations();
|
||||
|
||||
|
@ -589,8 +589,8 @@ ensogl::define_endpoints_2! {
|
||||
// === Scene Navigation ===
|
||||
|
||||
/// Stop the scene camera from moving around, locking the scene in place.
|
||||
/// Can be used, e.g., if there is a fullscreen visualisation active, or navigation should
|
||||
///only work for a selected visualisation.
|
||||
/// Can be used, e.g., if there is a fullscreen visualization active, or navigation should
|
||||
///only work for a selected visualization.
|
||||
set_navigator_disabled(bool),
|
||||
|
||||
|
||||
@ -655,9 +655,9 @@ ensogl::define_endpoints_2! {
|
||||
reset_visualization_registry (),
|
||||
/// Reload visualization registry
|
||||
reload_visualization_registry(),
|
||||
/// Show visualisation previews on nodes without delay.
|
||||
/// Show visualization previews on nodes without delay.
|
||||
enable_quick_visualization_preview(),
|
||||
/// Show visualisation previews on nodes with delay.
|
||||
/// Show visualization previews on nodes with delay.
|
||||
disable_quick_visualization_preview(),
|
||||
|
||||
/// Drop an edge that is being dragged.
|
||||
@ -720,7 +720,7 @@ ensogl::define_endpoints_2! {
|
||||
visualization_update_error ((NodeId, String)),
|
||||
|
||||
on_visualization_select (Switch<NodeId>),
|
||||
some_visualisation_selected (bool),
|
||||
some_visualization_selected (bool),
|
||||
navigator_active (bool),
|
||||
|
||||
widgets_requested (NodeId, ast::Id, ast::Id),
|
||||
@ -1458,15 +1458,15 @@ struct Edges {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, CloneRef, Default)]
|
||||
struct Visualisations {
|
||||
/// This keeps track of the currently selected visualisation. There should only ever be one
|
||||
/// visualisations selected, however due to the way that the selection is determined, it can
|
||||
/// happen that while the FRP is resolved, temporarily, we have multiple visualisation in this
|
||||
struct Visualizations {
|
||||
/// This keeps track of the currently selected visualization. There should only ever be one
|
||||
/// visualizations selected, however due to the way that the selection is determined, it can
|
||||
/// happen that while the FRP is resolved, temporarily, we have multiple visualization in this
|
||||
/// set. This happens because the selection status is determined bottom up from each
|
||||
/// visualisation and the reported via FRP to the graph editor. That means if the status
|
||||
/// we might see the new selection status for a visualisation getting set before we see the
|
||||
/// previously selected visualisation report its deselection. If we ever have more than one
|
||||
/// visualisation in this set after the status updates have been resolved, that is a bug.
|
||||
/// visualization and the reported via FRP to the graph editor. That means if the status
|
||||
/// we might see the new selection status for a visualization getting set before we see the
|
||||
/// previously selected visualization report its deselection. If we ever have more than one
|
||||
/// visualization in this set after the status updates have been resolved, that is a bug.
|
||||
selected: SharedHashSet<NodeId>,
|
||||
}
|
||||
|
||||
@ -1776,9 +1776,9 @@ impl GraphEditorModel {
|
||||
|
||||
// === Visualizations ===
|
||||
|
||||
let visualisation = node.visualization();
|
||||
visualization_shown <- visualisation.visible.on_true();
|
||||
visualization_hidden <- visualisation.visible.on_false();
|
||||
let visualization = node.visualization();
|
||||
visualization_shown <- visualization.visible.on_true();
|
||||
visualization_hidden <- visualization.visible.on_false();
|
||||
|
||||
let vis_is_selected = node_model.visualization.frp.is_selected.clone_ref();
|
||||
|
||||
@ -1797,10 +1797,10 @@ impl GraphEditorModel {
|
||||
metadata <- any(...);
|
||||
metadata <+ node_model.visualization.frp.preprocessor.map(visualization::Metadata::new);
|
||||
|
||||
// Ensure the graph editor knows about internal changes to the visualisation. If the
|
||||
// visualisation changes that should indicate that the old one has been disabled and a
|
||||
// Ensure the graph editor knows about internal changes to the visualization. If the
|
||||
// visualization changes that should indicate that the old one has been disabled and a
|
||||
// new one has been enabled.
|
||||
// TODO: Create a better API for updating the controller about visualisation changes
|
||||
// TODO: Create a better API for updating the controller about visualization changes
|
||||
// (see #896)
|
||||
out.visualization_hidden <+ visualization_hidden.constant(node_id);
|
||||
out.visualization_shown <+
|
||||
@ -1808,7 +1808,7 @@ impl GraphEditorModel {
|
||||
|
||||
init <- source::<()>();
|
||||
enabled_visualization_path <- init.all_with3(
|
||||
&visualisation.visible, &visualisation.visualization_path,
|
||||
&visualization.visible, &visualization.visualization_path,
|
||||
move |_init, is_enabled, path| (node_id, is_enabled.and_option(path.clone()))
|
||||
);
|
||||
out.enabled_visualization_path <+ enabled_visualization_path;
|
||||
@ -1866,7 +1866,7 @@ pub struct GraphEditorModel {
|
||||
pub add_node_button: Rc<component::add_node_button::AddNodeButton>,
|
||||
tooltip: Tooltip,
|
||||
touch_state: TouchState,
|
||||
visualisations: Visualisations,
|
||||
visualizations: Visualizations,
|
||||
frp: api::Private,
|
||||
frp_public: api::Public,
|
||||
profiling_statuses: profiling::Statuses,
|
||||
@ -1889,7 +1889,7 @@ impl GraphEditorModel {
|
||||
let nodes = Nodes::new();
|
||||
let edges = RefCell::new(Edges::default());
|
||||
let vis_registry = visualization::Registry::with_default_visualizations();
|
||||
let visualisations = default();
|
||||
let visualizations = default();
|
||||
let touch_state = TouchState::new(network, scene);
|
||||
let breadcrumbs = component::Breadcrumbs::new(app.clone_ref());
|
||||
let execution_environment_selector =
|
||||
@ -1922,7 +1922,7 @@ impl GraphEditorModel {
|
||||
drop_manager,
|
||||
tooltip,
|
||||
touch_state,
|
||||
visualisations,
|
||||
visualizations,
|
||||
navigator,
|
||||
profiling_statuses,
|
||||
add_node_button,
|
||||
@ -2911,7 +2911,7 @@ fn init_remaining_graph_editor_frp(
|
||||
// ========================
|
||||
|
||||
frp::extend! { network
|
||||
navigator_disabled <- out.some_visualisation_selected.or(&inputs.set_navigator_disabled);
|
||||
navigator_disabled <- out.some_visualization_selected.or(&inputs.set_navigator_disabled);
|
||||
model.navigator.frp.set_enabled <+ navigator_disabled.not();
|
||||
out.navigator_active <+ model.navigator.frp.enabled;
|
||||
}
|
||||
@ -3281,14 +3281,14 @@ fn init_remaining_graph_editor_frp(
|
||||
frp::extend! { network
|
||||
eval out.on_visualization_select ([model](switch) {
|
||||
if switch.is_on() {
|
||||
model.visualisations.selected.insert(switch.value);
|
||||
model.visualizations.selected.insert(switch.value);
|
||||
} else {
|
||||
model.visualisations.selected.remove(&switch.value);
|
||||
model.visualizations.selected.remove(&switch.value);
|
||||
}
|
||||
});
|
||||
|
||||
out.some_visualisation_selected <+ out.on_visualization_select.map(f_!([model] {
|
||||
!model.visualisations.selected.is_empty()
|
||||
out.some_visualization_selected <+ out.on_visualization_select.map(f_!([model] {
|
||||
!model.visualizations.selected.is_empty()
|
||||
}));
|
||||
};
|
||||
|
||||
@ -3339,7 +3339,7 @@ fn init_remaining_graph_editor_frp(
|
||||
// it was a key hold and we want to enter preview mode.
|
||||
let long_enough = diff > VIZ_PREVIEW_MODE_TOGGLE_TIME_MS;
|
||||
// We also check the number of passed frames, since the time measure can be misleading, if
|
||||
// there were dropped frames. The visualisation might have just appeared while more than
|
||||
// there were dropped frames. The visualization might have just appeared while more than
|
||||
// the threshold time has passed.
|
||||
let enough_frames = if let Some(counter) = counter {
|
||||
let frames = counter.frames_since_start();
|
||||
@ -3477,9 +3477,9 @@ fn init_remaining_graph_editor_frp(
|
||||
eval selection_controller.area_selection ((area_selection) model.nodes.show_quick_actions(!area_selection));
|
||||
}
|
||||
|
||||
// === Visualisation + Selection ===
|
||||
// === Visualization + Selection ===
|
||||
|
||||
// Do not allow area selection while we show a fullscreen visualisation.
|
||||
// Do not allow area selection while we show a fullscreen visualization.
|
||||
frp::extend! { network
|
||||
allow_area_selection <- out.is_fs_visualization_displayed.not();
|
||||
eval allow_area_selection ((area_selection)
|
||||
|
@ -6,8 +6,8 @@ from Standard.Table import Table, Column
|
||||
import Standard.Table.Data.Row.Row
|
||||
|
||||
import project.Id.Id
|
||||
from project.Text import get_lazy_visualisation_text_window
|
||||
import project.Table as Table_Visualisation
|
||||
from project.Text import get_lazy_visualization_text_window
|
||||
import project.Table as Table_Visualization
|
||||
|
||||
## PRIVATE
|
||||
Specifies that the builtin JSON visualization should be used for any type,
|
||||
@ -220,37 +220,37 @@ Column.is_numeric self =
|
||||
self.value_type.is_numeric
|
||||
|
||||
## PRIVATE
|
||||
Returns the data requested to render a lazy view of the default visualisation. Decides
|
||||
Returns the data requested to render a lazy view of the default visualization. Decides
|
||||
whether to return a simplified version of the lazy data format.
|
||||
make_lazy_visualisation_data : Text -> Vector Integer -> Vector Integer -> Integer -> Text
|
||||
make_lazy_visualisation_data text text_window_position text_window_size chunk_size =
|
||||
make_lazy_visualization_data : Text -> Vector Integer -> Vector Integer -> Integer -> Text
|
||||
make_lazy_visualization_data text text_window_position text_window_size chunk_size =
|
||||
min_length_for_laziness = chunk_size * (text_window_size.first) * (text_window_size.second)
|
||||
if text.length < min_length_for_laziness then text else
|
||||
get_lazy_visualisation_text_window text text_window_position text_window_size chunk_size
|
||||
get_lazy_visualization_text_window text text_window_position text_window_size chunk_size
|
||||
|
||||
## PRIVATE
|
||||
Returns the data requested to render a lazy view of the default visualisation.
|
||||
Returns the data requested to render a lazy view of the default visualization.
|
||||
Any.to_lazy_visualization_data : Vector Integer -> Vector Integer -> Integer -> Text
|
||||
Any.to_lazy_visualization_data self text_window_position text_window_size chunk_size =
|
||||
## Workaround so that the JS String is converted to a Text
|
||||
https://www.pivotaltracker.com/story/show/184061302
|
||||
"" + make_lazy_visualisation_data self.to_default_visualization_data text_window_position text_window_size chunk_size
|
||||
"" + make_lazy_visualization_data self.to_default_visualization_data text_window_position text_window_size chunk_size
|
||||
|
||||
## PRIVATE
|
||||
Returns the data requested to render a lazy view of the default visualisation.
|
||||
Returns the data requested to render a lazy view of the default visualization.
|
||||
Text.to_default_visualization_data : Text
|
||||
Text.to_default_visualization_data self =
|
||||
self.to_lazy_visualization_data [0,0] [10,10] 20
|
||||
|
||||
## PRIVATE
|
||||
Returns the data requested to render a lazy view of the default visualisation.
|
||||
Returns the data requested to render a lazy view of the default visualization.
|
||||
Text.to_lazy_visualization_data : Vector Integer -> Vector Integer -> Integer -> Text
|
||||
Text.to_lazy_visualization_data self text_window_position text_window_size chunk_size =
|
||||
min_length_for_laziness = chunk_size * (text_window_size.first) * (text_window_size.second)
|
||||
if self.length < min_length_for_laziness then "" + self.to_json else
|
||||
## Workaround so that the JS String is converted to a Text
|
||||
https://www.pivotaltracker.com/story/show/184061302
|
||||
"" + get_lazy_visualisation_text_window self text_window_position text_window_size chunk_size
|
||||
"" + get_lazy_visualization_text_window self text_window_position text_window_size chunk_size
|
||||
|
||||
## PRIVATE
|
||||
Shows a JSON serialization of a truncated version of this column, for the
|
||||
@ -279,7 +279,7 @@ Row.to_default_visualization_data self =
|
||||
self.to_vector.to_default_visualization_data
|
||||
|
||||
## PRIVATE
|
||||
Returns the data requested to render a lazy view of the default visualisation.
|
||||
Returns the data requested to render a lazy view of the default visualization.
|
||||
Table.to_lazy_visualization_data : Vector Integer -> Vector Integer -> Vector Integer -> Integer -> Text
|
||||
Table.to_lazy_visualization_data self table_cell_position text_window_position text_window_size chunk_size =
|
||||
Table_Visualisation.get_lazy_visualisation_data self table_cell_position text_window_position text_window_size chunk_size
|
||||
Table_Visualization.get_lazy_visualization_data self table_cell_position text_window_position text_window_size chunk_size
|
||||
|
@ -10,7 +10,7 @@ import project.Helpers
|
||||
Prepares the database table for visualization.
|
||||
|
||||
Arguments:
|
||||
- x: The database table to prepare for visualisation.
|
||||
- x: The database table to prepare for visualization.
|
||||
|
||||
For each interpolation it provides its value, its actual type name, its
|
||||
expected SQL type name and if it was possible to infer it, its expected Enso
|
||||
|
@ -39,15 +39,15 @@ type Table_Update
|
||||
Return a sub-window of a table. The window is defined by a cell row/col and line/chunk
|
||||
coordinate as origin and the extent of the window in text chunks and lines. The size of
|
||||
a chunk (the characters in it) is defined by `chunk_width`. The output is formatted as a message
|
||||
that can be sent to the IDE's lazy text visualisation.
|
||||
get_lazy_visualisation_data : Table_Module.Table -> Vector Integer -> Vector Integer -> Vector Integer -> Integer -> Text
|
||||
get_lazy_visualisation_data table table_cell_position text_window_position text_window_size chunk_size =
|
||||
that can be sent to the IDE's lazy text visualization.
|
||||
get_lazy_visualization_data : Table_Module.Table -> Vector Integer -> Vector Integer -> Vector Integer -> Integer -> Text
|
||||
get_lazy_visualization_data table table_cell_position text_window_position text_window_size chunk_size =
|
||||
update = compute_table_update table table_cell_position text_window_position text_window_size chunk_size
|
||||
update.to_json
|
||||
|
||||
## PRIVATE
|
||||
|
||||
Compute the table visualisation update. The table update contains information about the table
|
||||
Compute the table visualization update. The table update contains information about the table
|
||||
layout and the table content.
|
||||
compute_table_update table table_cell_position text_window_position text_window_size chunk_size =
|
||||
text_window_width = text_window_size.get 0
|
||||
|
@ -16,7 +16,7 @@ import project.Helpers
|
||||
Prepares a table or column for visualization.
|
||||
|
||||
Arguments:
|
||||
- x: The table to prepare for visualisation.
|
||||
- x: The table to prepare for visualization.
|
||||
- max_rows: The maximum number of rows to display.
|
||||
|
||||
In case of Database backed data, it materializes a fragment of the data.
|
||||
|
@ -19,8 +19,8 @@ type Message
|
||||
## PRIVATE
|
||||
Return a sub-window of a string. The window is defined by line/chunk coordinates. The size of
|
||||
a chunk is defined by `chunk_width`. The output is formatted as a message that can be sent to
|
||||
the IDE's lazy text visualisation.
|
||||
get_lazy_visualisation_text_window text pos size chunk_width =
|
||||
the IDE's lazy text visualization.
|
||||
get_lazy_visualization_text_window text pos size chunk_width =
|
||||
get_text_chunk = get_item_from text chunk_width
|
||||
lines = text.lines.length
|
||||
pos_x = Math.max pos.first 0
|
||||
@ -33,11 +33,11 @@ get_lazy_visualisation_text_window text pos size chunk_width =
|
||||
chunks = coordinates.map (ix -> [ix, (get_text_chunk ix)])
|
||||
active_lines = y_range.map text.lines.at
|
||||
max_line_length = (active_lines.map (line -> line.length)).fold 0 (l -> r -> Math.max l r)
|
||||
make_grid_visualisation_response chunks lines max_line_length
|
||||
make_grid_visualization_response chunks lines max_line_length
|
||||
|
||||
## PRIVATE
|
||||
Format a chunk of text and meta information for the lazy visualisation.
|
||||
make_grid_visualisation_response chunks lines max_line_length =
|
||||
Format a chunk of text and meta information for the lazy visualization.
|
||||
make_grid_visualization_response chunks lines max_line_length =
|
||||
message = Message.Value chunks lines max_line_length
|
||||
message.to_json + ""
|
||||
|
||||
|
@ -799,7 +799,7 @@ Below are options uses by the Language Server:
|
||||
Default value is 127.0.0.1
|
||||
- `--rpc-port <port>`: RPC port for processing all incoming connections. Default
|
||||
value is 8080.
|
||||
- `--data-port <port>`: Data port for visualisation protocol. Default value
|
||||
- `--data-port <port>`: Data port for visualization protocol. Default value
|
||||
is 8081.
|
||||
|
||||
To run the Language Server on 127.0.0.1:8080 type:
|
||||
|
@ -143,7 +143,7 @@ domain requires a highly tailored toolbox for working with such data, and Enso
|
||||
provides a coherent and unified foundation for building such toolboxes, on top
|
||||
of a growing library of existing ones. At its core, Enso delivers a powerful
|
||||
environment for the modelling of data flows, with extensive inbuilt capabilities
|
||||
for data visualisation and manipulation.
|
||||
for data visualization and manipulation.
|
||||
|
||||
## Tenets of Enso
|
||||
|
||||
@ -162,7 +162,7 @@ the cognitive load for users. They are elucidated below
|
||||
- **Unified Syntax:** The language syntax should be simple, concise, and be
|
||||
usable on both the type and term levels.
|
||||
- **Visual Communication:** A pure and functional language that lends itself
|
||||
easily to visualisation of data-flows.
|
||||
easily to visualization of data-flows.
|
||||
- **One Right Way:** There should, overwhelmingly, be only one way to perform a
|
||||
given task. Limited choice breeds simplicity.
|
||||
- **Help the User:** Enso should do its utmost to make things easier for the
|
||||
@ -225,10 +225,10 @@ between _too many_ and _not enough_ syntactic constructs.
|
||||
|
||||
Humans are inherently visual creatures, and Enso is designed to enable a
|
||||
_visual_ style of communication. When designing new language features, it is
|
||||
overwhelmingly important to consider their impact on Enso's visualisation
|
||||
overwhelmingly important to consider their impact on Enso's visualization
|
||||
functionality.
|
||||
|
||||
- _How_ they impact the existing visualisation capabilities.
|
||||
- _How_ they impact the existing visualization capabilities.
|
||||
- _How_ they can be visualised themselves.
|
||||
|
||||
### One Right Way
|
||||
|
@ -47,7 +47,7 @@ please see [the protocol message specifications](./README.md).
|
||||
- [Binary Protocol Communication Patterns](#binary-protocol-communication-patterns)
|
||||
- [Binary Protocol Transport](#binary-protocol-transport)
|
||||
- [Binary Protocol Functionality](#binary-protocol-functionality)
|
||||
- [Displaying Visualisations](#displaying-visualisations)
|
||||
- [Displaying Visualizations](#displaying-visualizations)
|
||||
- [Service Connection Setup](#service-connection-setup)
|
||||
- [Service Connection Teardown](#service-connection-teardown)
|
||||
|
||||
@ -191,7 +191,7 @@ format is already defined for us.
|
||||
[JSON-RPC](https://en.wikipedia.org/wiki/JSON-RPC) over a WebSocket connection
|
||||
(as defined in the LSP spec).
|
||||
- As a protocol extension we also negotiate a secondary binary WebSocket
|
||||
connection for sending visualisation data. This transport is independent of
|
||||
connection for sending visualization data. This transport is independent of
|
||||
the LSP spec, and hence is defined entirely by us.
|
||||
|
||||
> The actionables for this section are:
|
||||
@ -208,7 +208,7 @@ LSP messages. The following notes apply:
|
||||
|
||||
- Textual messages should be sent as LSP messages or extensions to them.
|
||||
- We have a hybrid extension to the protocol to allow us to send binary data
|
||||
(for visualisations) over a second WebSocket connection.
|
||||
(for visualizations) over a second WebSocket connection.
|
||||
|
||||
This means that we have two pipes: one is the textual WebSocket defined by LSP,
|
||||
and the other is a binary WebSocket.
|
||||
@ -403,10 +403,10 @@ great to know which epoch is running).
|
||||
- This could be achieved by a special kind of Monadic context (similar to
|
||||
writer, but mutable buffer based).
|
||||
- This would allow the function to log values without needing to return.
|
||||
- These would be sent as visualisations for use in the IDE.
|
||||
- These would be sent as visualizations for use in the IDE.
|
||||
|
||||
LSP provides an inbuilt mechanism for reporting progress, but that will not work
|
||||
with visualisations. As a result that should be reserved for reporting progress
|
||||
with visualizations. As a result that should be reserved for reporting progress
|
||||
of long-running operations within the _language server_ rather than in user
|
||||
code.
|
||||
|
||||
@ -482,7 +482,7 @@ and will be expanded upon as necessary in the future.
|
||||
These should include (but may not be limited to) the renaming, moving,
|
||||
extraction and inlining of entities. In future this could be expanded to
|
||||
include refactoring hints a la IntelliJ.
|
||||
- **Arbitrary Visualisation Code:** Visualisations should be able to be defined
|
||||
- **Arbitrary Visualization Code:** Visualizations should be able to be defined
|
||||
using Enso code and will require additional support.
|
||||
- **IO Manager:** The ability to do sophisticated IO monitoring, such as
|
||||
watching for file changes, in order to support minimal re-execution of
|
||||
@ -570,7 +570,7 @@ namespace org.enso.languageserver.protocol.binary;
|
||||
union OutboundPayload {
|
||||
ERROR: Error,
|
||||
SUCCESS: Success,
|
||||
VISUALISATION_UPDATE: VisualisationUpdate,
|
||||
VISUALIZATION_UPDATE: VisualizationUpdate,
|
||||
FILE_CONTENTS_REPLY: FileContentsReply
|
||||
}
|
||||
|
||||
@ -630,33 +630,33 @@ for the protocol transport format. This choice has been made for a few reasons:
|
||||
The binary protocol exists in order to serve the high-bandwidth data transfer
|
||||
requirements of the engine and the GUI.
|
||||
|
||||
### Displaying Visualisations
|
||||
### Displaying Visualizations
|
||||
|
||||
A major part of Enso Studio's functionality is the rich embedded visualisations
|
||||
A major part of Enso Studio's functionality is the rich embedded visualizations
|
||||
that it supports. This means that the following functionality is necessary:
|
||||
|
||||
- Execution of an arbitrary Enso expression on a cached value designated by a
|
||||
source location.
|
||||
- The ability to create and destroy visualisation subscriptions with an
|
||||
- The ability to create and destroy visualization subscriptions with an
|
||||
arbitrary piece of Enso code as the preprocessing function.
|
||||
- The ability to update _existing_ subscriptions with a new preprocessing
|
||||
function.
|
||||
|
||||
Visualisations in Enso are able to output arbitrary data for display in the GUI,
|
||||
Visualizations in Enso are able to output arbitrary data for display in the GUI,
|
||||
which requires a mechanism for transferring arbitrary data between the engine
|
||||
and the GUI. These visualisations can output data in common formats, which will
|
||||
and the GUI. These visualizations can output data in common formats, which will
|
||||
be serialised by the transport (e.g. text), but they can also write arbitrary
|
||||
binary data that can then be interpreted by the visualisation component itself
|
||||
binary data that can then be interpreted by the visualization component itself
|
||||
in any language that can be used from within the IDE.
|
||||
|
||||
From the implementation perspective:
|
||||
|
||||
- This will need to be an entirely separate set of protocol messages that should
|
||||
be specified in detail in this document.
|
||||
- Visualisations should work on a pub/sub model, where an update is sent every
|
||||
- Visualizations should work on a pub/sub model, where an update is sent every
|
||||
time the underlying data is recomputed.
|
||||
- Protocol responses must contain a pointer into the binary pipe carrying the
|
||||
visualisation data to identify an update.
|
||||
visualization data to identify an update.
|
||||
|
||||
## Service Connection Setup
|
||||
|
||||
|
@ -27,8 +27,8 @@ transport formats, please look [here](./protocol-architecture).
|
||||
- [`ProfilingInfo`](#profilinginfo)
|
||||
- [`ExpressionUpdate`](#expressionupdate)
|
||||
- [`ExpressionUpdatePayload`](#expressionupdatepayload)
|
||||
- [`VisualisationConfiguration`](#visualisationconfiguration)
|
||||
- [`VisualisationExpression`](#visualisationexpression)
|
||||
- [`VisualizationConfiguration`](#visualizationconfiguration)
|
||||
- [`VisualizationExpression`](#visualizationexpression)
|
||||
- [`SuggestionEntryArgument`](#suggestionentryargument)
|
||||
- [`SuggestionEntry`](#suggestionentry)
|
||||
- [`SuggestionEntryType`](#suggestionentrytype)
|
||||
@ -142,11 +142,11 @@ transport formats, please look [here](./protocol-architecture).
|
||||
- [`executionContext/executionComplete`](#executioncontextexecutioncomplete)
|
||||
- [`executionContext/executionStatus`](#executioncontextexecutionstatus)
|
||||
- [`executionContext/executeExpression`](#executioncontextexecuteexpression)
|
||||
- [`executionContext/attachVisualisation`](#executioncontextattachvisualisation)
|
||||
- [`executionContext/detachVisualisation`](#executioncontextdetachvisualisation)
|
||||
- [`executionContext/modifyVisualisation`](#executioncontextmodifyvisualisation)
|
||||
- [`executionContext/visualisationUpdate`](#executioncontextvisualisationupdate)
|
||||
- [`executionContext/visualisationEvaluationFailed`](#executioncontextvisualisationevaluationfailed)
|
||||
- [`executionContext/attachVisualization`](#executioncontextattachvisualization)
|
||||
- [`executionContext/detachVisualization`](#executioncontextdetachvisualization)
|
||||
- [`executionContext/modifyVisualization`](#executioncontextmodifyvisualization)
|
||||
- [`executionContext/visualizationUpdate`](#executioncontextvisualizationupdate)
|
||||
- [`executionContext/visualizationEvaluationFailed`](#executioncontextvisualizationevaluationfailed)
|
||||
- [Search Operations](#search-operations)
|
||||
- [Suggestions Database Example](#suggestions-database-example)
|
||||
- [`search/getSuggestionsDatabase`](#searchgetsuggestionsdatabase)
|
||||
@ -197,8 +197,8 @@ transport formats, please look [here](./protocol-architecture).
|
||||
- [`EmptyStackError`](#emptystackerror)
|
||||
- [`InvalidStackItemError`](#invalidstackitemerror)
|
||||
- [`ModuleNotFoundError`](#modulenotfounderror)
|
||||
- [`VisualisationNotFoundError`](#visualisationnotfounderror)
|
||||
- [`VisualisationExpressionError`](#visualisationexpressionerror)
|
||||
- [`VisualizationNotFoundError`](#visualizationnotfounderror)
|
||||
- [`VisualizationExpressionError`](#visualizationexpressionerror)
|
||||
- [`FileNotOpenedError`](#filenotopenederror)
|
||||
- [`TextEditValidationError`](#texteditvalidationerror)
|
||||
- [`InvalidVersionError`](#invalidversionerror)
|
||||
@ -443,22 +443,22 @@ interface Warnings {
|
||||
}
|
||||
```
|
||||
|
||||
### `VisualisationConfiguration`
|
||||
### `VisualizationConfiguration`
|
||||
|
||||
A configuration object for properties of the visualisation.
|
||||
A configuration object for properties of the visualization.
|
||||
|
||||
```typescript
|
||||
interface VisualisationConfiguration {
|
||||
/** An execution context of the visualisation. */
|
||||
interface VisualizationConfiguration {
|
||||
/** An execution context of the visualization. */
|
||||
executionContextId: UUID;
|
||||
|
||||
/**
|
||||
* A qualified name of the module containing the expression which creates
|
||||
* visualisation.
|
||||
* visualization.
|
||||
*/
|
||||
visualisationModule?: String;
|
||||
visualizationModule?: String;
|
||||
|
||||
/** An expression that creates a visualisation. */
|
||||
/** An expression that creates a visualization. */
|
||||
expression: String | MethodPointer;
|
||||
|
||||
/** A list of arguments to pass to the visualization expression. */
|
||||
@ -1815,11 +1815,11 @@ destroying the context.
|
||||
- [`executionContext/push`](#executioncontextpush)
|
||||
- [`executionContext/pop`](#executioncontextpop)
|
||||
- [`executionContext/executeExpression`](#executioncontextexecuteexpression)
|
||||
- [`executionContext/attachVisualisation`](#executioncontextattachvisualisation)
|
||||
- [`executionContext/modifyVisualisation`](#executioncontextmodifyvisualisation)
|
||||
- [`executionContext/detachVisualisation`](#executioncontextdetachvisualisation)
|
||||
- [`executionContext/visualisationUpdate`](#executioncontextvisualisationupdate)
|
||||
- [`executionContext/visualisationEvaluationFailed`](#executioncontextvisualisationevaluationfailed)
|
||||
- [`executionContext/attachVisualization`](#executioncontextattachvisualization)
|
||||
- [`executionContext/modifyVisualization`](#executioncontextmodifyvisualization)
|
||||
- [`executionContext/detachVisualization`](#executioncontextdetachvisualization)
|
||||
- [`executionContext/visualizationUpdate`](#executioncontextvisualizationupdate)
|
||||
- [`executionContext/visualizationEvaluationFailed`](#executioncontextvisualizationevaluationfailed)
|
||||
|
||||
#### Disables
|
||||
|
||||
@ -3893,8 +3893,8 @@ None
|
||||
|
||||
This message allows the client to execute an arbitrary expression on a given
|
||||
node. It behaves like oneshot
|
||||
[`executionContext/attachVisualisation`](#executioncontextattachvisualisation)
|
||||
visualisation request, meaning that the visualisation expression will be
|
||||
[`executionContext/attachVisualization`](#executioncontextattachvisualization)
|
||||
visualization request, meaning that the visualization expression will be
|
||||
executed only once.
|
||||
|
||||
- **Type:** Request
|
||||
@ -3906,9 +3906,9 @@ executed only once.
|
||||
|
||||
```typescript
|
||||
interface ExecuteExpressionRequest {
|
||||
visualisationId: UUID;
|
||||
visualizationId: UUID;
|
||||
expressionId: UUID;
|
||||
visualisationConfig: VisualisationConfiguration;
|
||||
visualizationConfig: VisualizationConfiguration;
|
||||
}
|
||||
```
|
||||
|
||||
@ -3925,14 +3925,14 @@ null;
|
||||
- [`ContextNotFoundError`](#contextnotfounderror) when context can not be found
|
||||
by provided id.
|
||||
- [`ModuleNotFoundError`](#modulenotfounderror) to signal that the module with
|
||||
the visualisation cannot be found.
|
||||
- [`VisualisationExpressionError`](#visualisationexpressionerror) to signal that
|
||||
the expression specified in the `VisualisationConfiguration` cannot be
|
||||
the visualization cannot be found.
|
||||
- [`VisualizationExpressionError`](#visualizationexpressionerror) to signal that
|
||||
the expression specified in the `VisualizationConfiguration` cannot be
|
||||
evaluated.
|
||||
|
||||
### `executionContext/attachVisualisation`
|
||||
### `executionContext/attachVisualization`
|
||||
|
||||
This message allows the client to attach a visualisation, potentially
|
||||
This message allows the client to attach a visualization, potentially
|
||||
preprocessed by some arbitrary Enso code, to a given node in the program.
|
||||
|
||||
- **Type:** Request
|
||||
@ -3943,10 +3943,10 @@ preprocessed by some arbitrary Enso code, to a given node in the program.
|
||||
#### Parameters
|
||||
|
||||
```typescript
|
||||
interface AttachVisualisationRequest {
|
||||
visualisationId: UUID;
|
||||
interface AttachVisualizationRequest {
|
||||
visualizationId: UUID;
|
||||
expressionId: UUID;
|
||||
visualisationConfig: VisualisationConfiguration;
|
||||
visualizationConfig: VisualizationConfiguration;
|
||||
}
|
||||
```
|
||||
|
||||
@ -3963,14 +3963,14 @@ null;
|
||||
- [`ContextNotFoundError`](#contextnotfounderror) when context can not be found
|
||||
by provided id.
|
||||
- [`ModuleNotFoundError`](#modulenotfounderror) to signal that the module with
|
||||
the visualisation cannot be found.
|
||||
- [`VisualisationExpressionError`](#visualisationexpressionerror) to signal that
|
||||
the expression specified in the `VisualisationConfiguration` cannot be
|
||||
the visualization cannot be found.
|
||||
- [`VisualizationExpressionError`](#visualizationexpressionerror) to signal that
|
||||
the expression specified in the `VisualizationConfiguration` cannot be
|
||||
evaluated.
|
||||
|
||||
### `executionContext/detachVisualisation`
|
||||
### `executionContext/detachVisualization`
|
||||
|
||||
This message allows a client to detach a visualisation from the executing code.
|
||||
This message allows a client to detach a visualization from the executing code.
|
||||
|
||||
- **Type:** Request
|
||||
- **Direction:** Client -> Server
|
||||
@ -3980,9 +3980,9 @@ This message allows a client to detach a visualisation from the executing code.
|
||||
#### Parameters
|
||||
|
||||
```typescript
|
||||
interface DetachVisualisationRequest {
|
||||
interface DetachVisualizationRequest {
|
||||
executionContextId: UUID;
|
||||
visualisationId: UUID;
|
||||
visualizationId: UUID;
|
||||
expressionId: UUID;
|
||||
}
|
||||
```
|
||||
@ -3999,13 +3999,13 @@ null;
|
||||
`executionContext/canModify` capability for this context.
|
||||
- [`ContextNotFoundError`](#contextnotfounderror) when context can not be found
|
||||
by provided id.
|
||||
- [`VisualisationNotFoundError`](#visualisationnotfounderror) when a
|
||||
visualisation can not be found.
|
||||
- [`VisualizationNotFoundError`](#visualizationnotfounderror) when a
|
||||
visualization can not be found.
|
||||
|
||||
### `executionContext/modifyVisualisation`
|
||||
### `executionContext/modifyVisualization`
|
||||
|
||||
This message allows a client to modify the configuration for an existing
|
||||
visualisation.
|
||||
visualization.
|
||||
|
||||
A successful response means that the new visualization configuration has been
|
||||
applied. In case of an error response, the visualization state does not change.
|
||||
@ -4018,9 +4018,9 @@ applied. In case of an error response, the visualization state does not change.
|
||||
#### Parameters
|
||||
|
||||
```typescript
|
||||
interface ModifyVisualisationRequest {
|
||||
visualisationId: UUID;
|
||||
visualisationConfig: VisualisationConfiguration;
|
||||
interface ModifyVisualizationRequest {
|
||||
visualizationId: UUID;
|
||||
visualizationConfig: VisualizationConfiguration;
|
||||
}
|
||||
```
|
||||
|
||||
@ -4037,16 +4037,16 @@ null;
|
||||
- [`ContextNotFoundError`](#contextnotfounderror) when context can not be found
|
||||
by provided id.
|
||||
- [`ModuleNotFoundError`](#modulenotfounderror) to signal that the module with
|
||||
the visualisation cannot be found.
|
||||
- [`VisualisationExpressionError`](#visualisationexpressionerror) to signal that
|
||||
the expression specified in the `VisualisationConfiguration` cannot be
|
||||
the visualization cannot be found.
|
||||
- [`VisualizationExpressionError`](#visualizationexpressionerror) to signal that
|
||||
the expression specified in the `VisualizationConfiguration` cannot be
|
||||
evaluated.
|
||||
- [`VisualisationNotFoundError`](#visualisationnotfounderror) when a
|
||||
visualisation can not be found.
|
||||
- [`VisualizationNotFoundError`](#visualizationnotfounderror) when a
|
||||
visualization can not be found.
|
||||
|
||||
### `executionContext/visualisationUpdate`
|
||||
### `executionContext/visualizationUpdate`
|
||||
|
||||
This message is responsible for providing a visualisation data update to the
|
||||
This message is responsible for providing a visualization data update to the
|
||||
client.
|
||||
|
||||
- **Type:** Notification
|
||||
@ -4054,7 +4054,7 @@ client.
|
||||
- **Connection:** Data
|
||||
- **Visibility:** Public
|
||||
|
||||
The `visualisationData` component of the table definition _must_ be
|
||||
The `visualizationData` component of the table definition _must_ be
|
||||
pre-serialized before being inserted into this message. As far as this level of
|
||||
transport is concerned, it is just a binary blob.
|
||||
|
||||
@ -4063,11 +4063,11 @@ transport is concerned, it is just a binary blob.
|
||||
```idl
|
||||
namespace org.enso.languageserver.protocol.binary;
|
||||
|
||||
//A visualisation context identifying a concrete visualisation.
|
||||
table VisualisationContext {
|
||||
//A visualization context identifying a concrete visualization.
|
||||
table VisualizationContext {
|
||||
|
||||
//A visualisation identifier.
|
||||
visualisationId: EnsoUUID (required);
|
||||
//A visualization identifier.
|
||||
visualizationId: EnsoUUID (required);
|
||||
|
||||
//A context identifier.
|
||||
contextId: EnsoUUID (required);
|
||||
@ -4077,27 +4077,27 @@ table VisualisationContext {
|
||||
|
||||
}
|
||||
|
||||
//An event signaling visualisation update.
|
||||
table VisualisationUpdate {
|
||||
//An event signaling visualization update.
|
||||
table VisualizationUpdate {
|
||||
|
||||
//A visualisation context identifying a concrete visualisation.
|
||||
visualisationContext: VisualisationContext (required);
|
||||
//A visualization context identifying a concrete visualization.
|
||||
visualizationContext: VisualizationContext (required);
|
||||
|
||||
//A visualisation data.
|
||||
//A visualization data.
|
||||
data: [ubyte] (required);
|
||||
|
||||
}
|
||||
|
||||
root_type VisualisationUpdate;
|
||||
root_type VisualizationUpdate;
|
||||
```
|
||||
|
||||
#### Errors
|
||||
|
||||
N/A
|
||||
|
||||
### `executionContext/visualisationEvaluationFailed`
|
||||
### `executionContext/visualizationEvaluationFailed`
|
||||
|
||||
Signals that an evaluation of a visualisation expression on the computed value
|
||||
Signals that an evaluation of a visualization expression on the computed value
|
||||
has failed.
|
||||
|
||||
- **Type:** Notification
|
||||
@ -4108,16 +4108,16 @@ has failed.
|
||||
#### Parameters
|
||||
|
||||
```typescript
|
||||
interface VisualisationEvaluationFailed {
|
||||
interface VisualizationEvaluationFailed {
|
||||
/**
|
||||
* An execution context identifier.
|
||||
*/
|
||||
contextId: ContextId;
|
||||
|
||||
/**
|
||||
* A visualisation identifier.
|
||||
* A visualization identifier.
|
||||
*/
|
||||
visualisationId: UUID;
|
||||
visualizationId: UUID;
|
||||
|
||||
/**
|
||||
* An identifier of a visualised expression.
|
||||
@ -5404,27 +5404,27 @@ It signals that the given module cannot be found.
|
||||
}
|
||||
```
|
||||
|
||||
### `VisualisationNotFoundError`
|
||||
### `VisualizationNotFoundError`
|
||||
|
||||
It signals that the visualisation cannot be found.
|
||||
It signals that the visualization cannot be found.
|
||||
|
||||
```typescript
|
||||
"error" : {
|
||||
"code" : 2006,
|
||||
"message" : "Visualisation not found"
|
||||
"message" : "Visualization not found"
|
||||
}
|
||||
```
|
||||
|
||||
### `VisualisationExpressionError`
|
||||
### `VisualizationExpressionError`
|
||||
|
||||
It signals that the expression specified in the `VisualisationConfiguration`
|
||||
It signals that the expression specified in the `VisualizationConfiguration`
|
||||
cannot be evaluated. The error contains an optional `data` field of type
|
||||
[`Diagnostic`](#diagnostic) providing error details.
|
||||
|
||||
```typescript
|
||||
"error" : {
|
||||
"code" : 2007,
|
||||
"message" : "Evaluation of the visualisation expression failed [i is not defined]"
|
||||
"message" : "Evaluation of the visualization expression failed [i is not defined]"
|
||||
"payload" : {
|
||||
"kind" : "Error",
|
||||
"message" : "i is not defined",
|
||||
|
@ -348,20 +348,20 @@ evicted, which is costly.
|
||||
|
||||
### Lazy Visualization Support
|
||||
|
||||
Currently, IDE visualisations are evaluated eagerly on their candidate data.
|
||||
Currently, IDE visualizations are evaluated eagerly on their candidate data.
|
||||
This is a nightmare when working with huge amounts of data (e.g. tables with
|
||||
millions of rows), and can easily lock up both the runtime and IDE. The current
|
||||
solution artificially limits the amount of data sent to the IDE.
|
||||
|
||||
In the future, we want to support the ability to cache inside visualisation code
|
||||
In the future, we want to support the ability to cache inside visualization code
|
||||
such that the preprocessor doesn't have to be recomputed every time the IDE
|
||||
changes the parameters. This will enable the ability to view the full data in
|
||||
the IDE without having to send it all at once, or recompute potentially costly
|
||||
preprocessors.
|
||||
|
||||
- Implement caching support for the visualisation expression processing.
|
||||
- Implement caching support for the visualization expression processing.
|
||||
- This cache should, much like the IDE's introspection cache, track and save the
|
||||
values of all top-level bindings in the visualisation preprocessor.
|
||||
values of all top-level bindings in the visualization preprocessor.
|
||||
|
||||
## Parser
|
||||
|
||||
|
@ -19,10 +19,10 @@ import org.enso.languageserver.protocol.binary.factory.{
|
||||
ErrorFactory,
|
||||
OutboundMessageFactory,
|
||||
SuccessReplyFactory,
|
||||
VisualisationUpdateFactory
|
||||
VisualizationUpdateFactory
|
||||
}
|
||||
import org.enso.languageserver.requesthandler.file._
|
||||
import org.enso.languageserver.runtime.ContextRegistryProtocol.VisualisationUpdate
|
||||
import org.enso.languageserver.runtime.ContextRegistryProtocol.VisualizationUpdate
|
||||
import org.enso.languageserver.session.BinarySession
|
||||
import org.enso.languageserver.util.UnhandledLogging
|
||||
import org.enso.languageserver.util.binary.DecodingFailure
|
||||
@ -113,8 +113,8 @@ class BinaryConnectionController(
|
||||
)
|
||||
}
|
||||
|
||||
case update: VisualisationUpdate =>
|
||||
val updatePacket = convertVisualisationUpdateToOutPacket(update)
|
||||
case update: VisualizationUpdate =>
|
||||
val updatePacket = convertVisualizationUpdateToOutPacket(update)
|
||||
outboundChannel ! updatePacket
|
||||
}
|
||||
|
||||
@ -157,15 +157,15 @@ class BinaryConnectionController(
|
||||
ErrorFactory.createServiceError()
|
||||
}
|
||||
|
||||
private def convertVisualisationUpdateToOutPacket(
|
||||
update: VisualisationUpdate
|
||||
private def convertVisualizationUpdateToOutPacket(
|
||||
update: VisualizationUpdate
|
||||
): ByteBuffer = {
|
||||
implicit val builder: FlatBufferBuilder = new FlatBufferBuilder(1024)
|
||||
val event = VisualisationUpdateFactory.create(update)
|
||||
val event = VisualizationUpdateFactory.create(update)
|
||||
val msg = OutboundMessageFactory.create(
|
||||
UUID.randomUUID(),
|
||||
None,
|
||||
OutboundPayload.VISUALISATION_UPDATE,
|
||||
OutboundPayload.VISUALIZATION_UPDATE,
|
||||
event
|
||||
)
|
||||
|
||||
|
@ -2,62 +2,62 @@ package org.enso.languageserver.protocol.binary.factory
|
||||
|
||||
import com.google.flatbuffers.FlatBufferBuilder
|
||||
import org.enso.languageserver.protocol.binary.{
|
||||
VisualisationContext => BinaryVisualisationContext,
|
||||
VisualisationUpdate => BinaryVisualisationUpdate
|
||||
VisualizationContext => BinaryVisualizationContext,
|
||||
VisualizationUpdate => BinaryVisualizationUpdate
|
||||
}
|
||||
import org.enso.languageserver.runtime.ContextRegistryProtocol.{
|
||||
VisualisationContext,
|
||||
VisualisationUpdate
|
||||
VisualizationContext,
|
||||
VisualizationUpdate
|
||||
}
|
||||
|
||||
object VisualisationUpdateFactory {
|
||||
object VisualizationUpdateFactory {
|
||||
|
||||
/** Creates a [[VisualisationUpdate]] inside a [[FlatBufferBuilder]].
|
||||
/** Creates a [[VisualizationUpdate]] inside a [[FlatBufferBuilder]].
|
||||
*
|
||||
* @param update a visualisation update
|
||||
* @param update a visualization update
|
||||
* @param builder a class that helps build a FlatBuffer representation of
|
||||
* complex objects
|
||||
* @return an offset pointing to the FlatBuffer representation of the
|
||||
* created object
|
||||
*/
|
||||
def create(update: VisualisationUpdate)(implicit
|
||||
def create(update: VisualizationUpdate)(implicit
|
||||
builder: FlatBufferBuilder
|
||||
): Int = {
|
||||
val ctx = createVisualisationCtx(update.visualisationContext)
|
||||
val ctx = createVisualizationCtx(update.visualizationContext)
|
||||
val data =
|
||||
BinaryVisualisationUpdate.createDataVector(builder, update.data)
|
||||
BinaryVisualisationUpdate.createVisualisationUpdate(
|
||||
BinaryVisualizationUpdate.createDataVector(builder, update.data)
|
||||
BinaryVisualizationUpdate.createVisualizationUpdate(
|
||||
builder,
|
||||
ctx,
|
||||
data
|
||||
)
|
||||
}
|
||||
|
||||
/** Creates a [[VisualisationContext]] inside a [[FlatBufferBuilder]].
|
||||
/** Creates a [[VisualizationContext]] inside a [[FlatBufferBuilder]].
|
||||
*
|
||||
* @param ctx a VisualisationContext
|
||||
* @param ctx a VisualizationContext
|
||||
* @param builder a class that helps build a FlatBuffer representation of
|
||||
* complex objects
|
||||
* @return an offset pointing to the FlatBuffer representation of the
|
||||
* created object
|
||||
*/
|
||||
def createVisualisationCtx(ctx: VisualisationContext)(implicit
|
||||
def createVisualizationCtx(ctx: VisualizationContext)(implicit
|
||||
builder: FlatBufferBuilder
|
||||
): Int = {
|
||||
BinaryVisualisationContext.startVisualisationContext(builder)
|
||||
BinaryVisualisationContext.addContextId(
|
||||
BinaryVisualizationContext.startVisualizationContext(builder)
|
||||
BinaryVisualizationContext.addContextId(
|
||||
builder,
|
||||
EnsoUuidFactory.create(ctx.contextId)
|
||||
)
|
||||
BinaryVisualisationContext.addExpressionId(
|
||||
BinaryVisualizationContext.addExpressionId(
|
||||
builder,
|
||||
EnsoUuidFactory.create(ctx.expressionId)
|
||||
)
|
||||
BinaryVisualisationContext.addVisualisationId(
|
||||
BinaryVisualizationContext.addVisualizationId(
|
||||
builder,
|
||||
EnsoUuidFactory.create(ctx.visualisationId)
|
||||
EnsoUuidFactory.create(ctx.visualizationId)
|
||||
)
|
||||
BinaryVisualisationContext.endVisualisationContext(builder)
|
||||
BinaryVisualizationContext.endVisualizationContext(builder)
|
||||
}
|
||||
|
||||
}
|
@ -42,20 +42,20 @@ import org.enso.languageserver.requesthandler.monitoring.{
|
||||
}
|
||||
import org.enso.languageserver.requesthandler.refactoring.RenameProjectHandler
|
||||
import org.enso.languageserver.requesthandler.text._
|
||||
import org.enso.languageserver.requesthandler.visualisation.{
|
||||
AttachVisualisationHandler,
|
||||
DetachVisualisationHandler,
|
||||
import org.enso.languageserver.requesthandler.visualization.{
|
||||
AttachVisualizationHandler,
|
||||
DetachVisualizationHandler,
|
||||
ExecuteExpressionHandler,
|
||||
ModifyVisualisationHandler
|
||||
ModifyVisualizationHandler
|
||||
}
|
||||
import org.enso.languageserver.requesthandler.workspace.ProjectInfoHandler
|
||||
import org.enso.languageserver.runtime.ContextRegistryProtocol
|
||||
import org.enso.languageserver.runtime.ExecutionApi._
|
||||
import org.enso.languageserver.runtime.VisualisationApi.{
|
||||
AttachVisualisation,
|
||||
DetachVisualisation,
|
||||
import org.enso.languageserver.runtime.VisualizationApi.{
|
||||
AttachVisualization,
|
||||
DetachVisualization,
|
||||
ExecuteExpression,
|
||||
ModifyVisualisation
|
||||
ModifyVisualization
|
||||
}
|
||||
import org.enso.languageserver.search.SearchApi._
|
||||
import org.enso.languageserver.search.{SearchApi, SearchProtocol}
|
||||
@ -348,18 +348,18 @@ class JsonConnectionController(
|
||||
ExecutionContextExecutionStatus.Params(contextId, diagnostics)
|
||||
)
|
||||
|
||||
case ContextRegistryProtocol.VisualisationEvaluationFailed(
|
||||
case ContextRegistryProtocol.VisualizationEvaluationFailed(
|
||||
contextId,
|
||||
visualisationId,
|
||||
visualizationId,
|
||||
expressionId,
|
||||
message,
|
||||
diagnostic
|
||||
) =>
|
||||
webActor ! Notification(
|
||||
VisualisationEvaluationFailed,
|
||||
VisualisationEvaluationFailed.Params(
|
||||
VisualizationEvaluationFailed,
|
||||
VisualizationEvaluationFailed.Params(
|
||||
contextId,
|
||||
visualisationId,
|
||||
visualizationId,
|
||||
expressionId,
|
||||
message,
|
||||
diagnostic
|
||||
@ -508,11 +508,11 @@ class JsonConnectionController(
|
||||
.props(requestTimeout, suggestionsHandler),
|
||||
ExecuteExpression -> ExecuteExpressionHandler
|
||||
.props(rpcSession.clientId, requestTimeout, contextRegistry),
|
||||
AttachVisualisation -> AttachVisualisationHandler
|
||||
AttachVisualization -> AttachVisualizationHandler
|
||||
.props(rpcSession.clientId, requestTimeout, contextRegistry),
|
||||
DetachVisualisation -> DetachVisualisationHandler
|
||||
DetachVisualization -> DetachVisualizationHandler
|
||||
.props(rpcSession.clientId, requestTimeout, contextRegistry),
|
||||
ModifyVisualisation -> ModifyVisualisationHandler
|
||||
ModifyVisualization -> ModifyVisualizationHandler
|
||||
.props(rpcSession.clientId, requestTimeout, contextRegistry),
|
||||
RedirectStandardOutput -> RedirectStdOutHandler
|
||||
.props(stdOutController, rpcSession.clientId),
|
||||
|
@ -20,7 +20,7 @@ import org.enso.languageserver.monitoring.MonitoringApi.{InitialPing, Ping}
|
||||
import org.enso.languageserver.refactoring.RefactoringApi.RenameProject
|
||||
import org.enso.languageserver.runtime.ExecutionApi._
|
||||
import org.enso.languageserver.search.SearchApi._
|
||||
import org.enso.languageserver.runtime.VisualisationApi._
|
||||
import org.enso.languageserver.runtime.VisualizationApi._
|
||||
import org.enso.languageserver.session.SessionApi.InitProtocolConnection
|
||||
import org.enso.languageserver.text.TextApi._
|
||||
import org.enso.languageserver.libraries.LibraryApi._
|
||||
@ -73,9 +73,9 @@ object JsonRpc {
|
||||
.registerRequest(ExecutionContextInterrupt)
|
||||
.registerRequest(ExecutionContextGetComponentGroups)
|
||||
.registerRequest(ExecuteExpression)
|
||||
.registerRequest(AttachVisualisation)
|
||||
.registerRequest(DetachVisualisation)
|
||||
.registerRequest(ModifyVisualisation)
|
||||
.registerRequest(AttachVisualization)
|
||||
.registerRequest(DetachVisualization)
|
||||
.registerRequest(ModifyVisualization)
|
||||
.registerRequest(GetSuggestionsDatabase)
|
||||
.registerRequest(GetSuggestionsDatabaseVersion)
|
||||
.registerRequest(InvalidateSuggestionsDatabase)
|
||||
@ -115,5 +115,5 @@ object JsonRpc {
|
||||
.registerNotification(StandardErrorAppended)
|
||||
.registerNotification(WaitingForStandardInput)
|
||||
.registerNotification(SuggestionsDatabaseUpdates)
|
||||
.registerNotification(VisualisationEvaluationFailed)
|
||||
.registerNotification(VisualizationEvaluationFailed)
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
package org.enso.languageserver.requesthandler.visualisation
|
||||
package org.enso.languageserver.requesthandler.visualization
|
||||
|
||||
import akka.actor.{Actor, ActorRef, Cancellable, Props}
|
||||
import com.typesafe.scalalogging.LazyLogging
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.data.ClientId
|
||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||
import org.enso.languageserver.runtime.VisualisationApi.AttachVisualisation
|
||||
import org.enso.languageserver.runtime.VisualizationApi.AttachVisualization
|
||||
import org.enso.languageserver.runtime.{
|
||||
ContextRegistryProtocol,
|
||||
RuntimeFailureMapper
|
||||
@ -14,13 +14,13 @@ import org.enso.languageserver.util.UnhandledLogging
|
||||
|
||||
import scala.concurrent.duration.FiniteDuration
|
||||
|
||||
/** A request handler for `executionContext/attachVisualisation` commands.
|
||||
/** A request handler for `executionContext/attachVisualization` commands.
|
||||
*
|
||||
* @param clientId an unique identifier of the client
|
||||
* @param timeout request timeout
|
||||
* @param contextRegistry a reference to the context registry.
|
||||
*/
|
||||
class AttachVisualisationHandler(
|
||||
class AttachVisualizationHandler(
|
||||
clientId: ClientId,
|
||||
timeout: FiniteDuration,
|
||||
contextRegistry: ActorRef
|
||||
@ -33,12 +33,12 @@ class AttachVisualisationHandler(
|
||||
override def receive: Receive = requestStage
|
||||
|
||||
private def requestStage: Receive = {
|
||||
case Request(AttachVisualisation, id, params: AttachVisualisation.Params) =>
|
||||
contextRegistry ! ContextRegistryProtocol.AttachVisualisation(
|
||||
case Request(AttachVisualization, id, params: AttachVisualization.Params) =>
|
||||
contextRegistry ! ContextRegistryProtocol.AttachVisualization(
|
||||
clientId,
|
||||
params.visualisationId,
|
||||
params.visualizationId,
|
||||
params.expressionId,
|
||||
params.visualisationConfig
|
||||
params.visualizationConfig
|
||||
)
|
||||
val cancellable =
|
||||
context.system.scheduler.scheduleOnce(timeout, self, RequestTimeout)
|
||||
@ -55,8 +55,8 @@ class AttachVisualisationHandler(
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case ContextRegistryProtocol.VisualisationAttached =>
|
||||
replyTo ! ResponseResult(AttachVisualisation, id, Unused)
|
||||
case ContextRegistryProtocol.VisualizationAttached =>
|
||||
replyTo ! ResponseResult(AttachVisualization, id, Unused)
|
||||
cancellable.cancel()
|
||||
context.stop(self)
|
||||
|
||||
@ -68,9 +68,9 @@ class AttachVisualisationHandler(
|
||||
|
||||
}
|
||||
|
||||
object AttachVisualisationHandler {
|
||||
object AttachVisualizationHandler {
|
||||
|
||||
/** Creates configuration object used to create a [[AttachVisualisationHandler]].
|
||||
/** Creates configuration object used to create a [[AttachVisualizationHandler]].
|
||||
*
|
||||
* @param clientId an unique identifier of the client
|
||||
* @param timeout request timeout
|
||||
@ -81,6 +81,6 @@ object AttachVisualisationHandler {
|
||||
timeout: FiniteDuration,
|
||||
runtime: ActorRef
|
||||
): Props =
|
||||
Props(new AttachVisualisationHandler(clientId, timeout, runtime))
|
||||
Props(new AttachVisualizationHandler(clientId, timeout, runtime))
|
||||
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
package org.enso.languageserver.requesthandler.visualisation
|
||||
package org.enso.languageserver.requesthandler.visualization
|
||||
|
||||
import akka.actor.{Actor, ActorRef, Cancellable, Props}
|
||||
import com.typesafe.scalalogging.LazyLogging
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.data.ClientId
|
||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||
import org.enso.languageserver.runtime.VisualisationApi.DetachVisualisation
|
||||
import org.enso.languageserver.runtime.VisualizationApi.DetachVisualization
|
||||
import org.enso.languageserver.runtime.{
|
||||
ContextRegistryProtocol,
|
||||
RuntimeFailureMapper
|
||||
@ -14,13 +14,13 @@ import org.enso.languageserver.util.UnhandledLogging
|
||||
|
||||
import scala.concurrent.duration.FiniteDuration
|
||||
|
||||
/** A request handler for `executionContext/detachVisualisation` commands.
|
||||
/** A request handler for `executionContext/detachVisualization` commands.
|
||||
*
|
||||
* @param clientId an unique identifier of the client
|
||||
* @param timeout request timeout
|
||||
* @param contextRegistry a reference to the context registry.
|
||||
*/
|
||||
class DetachVisualisationHandler(
|
||||
class DetachVisualizationHandler(
|
||||
clientId: ClientId,
|
||||
timeout: FiniteDuration,
|
||||
contextRegistry: ActorRef
|
||||
@ -33,11 +33,11 @@ class DetachVisualisationHandler(
|
||||
override def receive: Receive = requestStage
|
||||
|
||||
private def requestStage: Receive = {
|
||||
case Request(DetachVisualisation, id, params: DetachVisualisation.Params) =>
|
||||
contextRegistry ! ContextRegistryProtocol.DetachVisualisation(
|
||||
case Request(DetachVisualization, id, params: DetachVisualization.Params) =>
|
||||
contextRegistry ! ContextRegistryProtocol.DetachVisualization(
|
||||
clientId,
|
||||
params.contextId,
|
||||
params.visualisationId,
|
||||
params.visualizationId,
|
||||
params.expressionId
|
||||
)
|
||||
val cancellable =
|
||||
@ -55,8 +55,8 @@ class DetachVisualisationHandler(
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case ContextRegistryProtocol.VisualisationDetached =>
|
||||
replyTo ! ResponseResult(DetachVisualisation, id, Unused)
|
||||
case ContextRegistryProtocol.VisualizationDetached =>
|
||||
replyTo ! ResponseResult(DetachVisualization, id, Unused)
|
||||
cancellable.cancel()
|
||||
context.stop(self)
|
||||
|
||||
@ -68,9 +68,9 @@ class DetachVisualisationHandler(
|
||||
|
||||
}
|
||||
|
||||
object DetachVisualisationHandler {
|
||||
object DetachVisualizationHandler {
|
||||
|
||||
/** Creates configuration object used to create a [[DetachVisualisationHandler]].
|
||||
/** Creates configuration object used to create a [[DetachVisualizationHandler]].
|
||||
*
|
||||
* @param clientId an unique identifier of the client
|
||||
* @param timeout request timeout
|
||||
@ -81,6 +81,6 @@ object DetachVisualisationHandler {
|
||||
timeout: FiniteDuration,
|
||||
runtime: ActorRef
|
||||
): Props =
|
||||
Props(new DetachVisualisationHandler(clientId, timeout, runtime))
|
||||
Props(new DetachVisualizationHandler(clientId, timeout, runtime))
|
||||
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
package org.enso.languageserver.requesthandler.visualisation
|
||||
package org.enso.languageserver.requesthandler.visualization
|
||||
|
||||
import akka.actor.{Actor, ActorRef, Cancellable, Props}
|
||||
import com.typesafe.scalalogging.LazyLogging
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.data.ClientId
|
||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||
import org.enso.languageserver.runtime.VisualisationApi.ExecuteExpression
|
||||
import org.enso.languageserver.runtime.VisualizationApi.ExecuteExpression
|
||||
import org.enso.languageserver.runtime.{
|
||||
ContextRegistryProtocol,
|
||||
RuntimeFailureMapper
|
||||
@ -40,9 +40,9 @@ class ExecuteExpressionHandler(
|
||||
) =>
|
||||
contextRegistry ! ContextRegistryProtocol.ExecuteExpression(
|
||||
clientId,
|
||||
params.visualisationId,
|
||||
params.visualizationId,
|
||||
params.expressionId,
|
||||
params.visualisationConfig
|
||||
params.visualizationConfig
|
||||
)
|
||||
val cancellable =
|
||||
context.system.scheduler.scheduleOnce(timeout, self, RequestTimeout)
|
||||
@ -59,7 +59,7 @@ class ExecuteExpressionHandler(
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case ContextRegistryProtocol.VisualisationAttached =>
|
||||
case ContextRegistryProtocol.VisualizationAttached =>
|
||||
replyTo ! ResponseResult(ExecuteExpression, id, Unused)
|
||||
cancellable.cancel()
|
||||
context.stop(self)
|
@ -1,11 +1,11 @@
|
||||
package org.enso.languageserver.requesthandler.visualisation
|
||||
package org.enso.languageserver.requesthandler.visualization
|
||||
|
||||
import akka.actor.{Actor, ActorRef, Cancellable, Props}
|
||||
import com.typesafe.scalalogging.LazyLogging
|
||||
import org.enso.jsonrpc._
|
||||
import org.enso.languageserver.data.ClientId
|
||||
import org.enso.languageserver.requesthandler.RequestTimeout
|
||||
import org.enso.languageserver.runtime.VisualisationApi.ModifyVisualisation
|
||||
import org.enso.languageserver.runtime.VisualizationApi.ModifyVisualization
|
||||
import org.enso.languageserver.runtime.{
|
||||
ContextRegistryProtocol,
|
||||
RuntimeFailureMapper
|
||||
@ -14,13 +14,13 @@ import org.enso.languageserver.util.UnhandledLogging
|
||||
|
||||
import scala.concurrent.duration.FiniteDuration
|
||||
|
||||
/** A request handler for `executionContext/modifyVisualisation` commands.
|
||||
/** A request handler for `executionContext/modifyVisualization` commands.
|
||||
*
|
||||
* @param clientId an unique identifier of the client
|
||||
* @param timeout request timeout
|
||||
* @param contextRegistry a reference to the context registry.
|
||||
*/
|
||||
class ModifyVisualisationHandler(
|
||||
class ModifyVisualizationHandler(
|
||||
clientId: ClientId,
|
||||
timeout: FiniteDuration,
|
||||
contextRegistry: ActorRef
|
||||
@ -33,11 +33,11 @@ class ModifyVisualisationHandler(
|
||||
override def receive: Receive = requestStage
|
||||
|
||||
private def requestStage: Receive = {
|
||||
case Request(ModifyVisualisation, id, params: ModifyVisualisation.Params) =>
|
||||
contextRegistry ! ContextRegistryProtocol.ModifyVisualisation(
|
||||
case Request(ModifyVisualization, id, params: ModifyVisualization.Params) =>
|
||||
contextRegistry ! ContextRegistryProtocol.ModifyVisualization(
|
||||
clientId,
|
||||
params.visualisationId,
|
||||
params.visualisationConfig
|
||||
params.visualizationId,
|
||||
params.visualizationConfig
|
||||
)
|
||||
val cancellable =
|
||||
context.system.scheduler.scheduleOnce(timeout, self, RequestTimeout)
|
||||
@ -54,8 +54,8 @@ class ModifyVisualisationHandler(
|
||||
replyTo ! ResponseError(Some(id), Errors.RequestTimeout)
|
||||
context.stop(self)
|
||||
|
||||
case ContextRegistryProtocol.VisualisationModified =>
|
||||
replyTo ! ResponseResult(ModifyVisualisation, id, Unused)
|
||||
case ContextRegistryProtocol.VisualizationModified =>
|
||||
replyTo ! ResponseResult(ModifyVisualization, id, Unused)
|
||||
cancellable.cancel()
|
||||
context.stop(self)
|
||||
|
||||
@ -67,9 +67,9 @@ class ModifyVisualisationHandler(
|
||||
|
||||
}
|
||||
|
||||
object ModifyVisualisationHandler {
|
||||
object ModifyVisualizationHandler {
|
||||
|
||||
/** Creates configuration object used to create a [[ModifyVisualisationHandler]].
|
||||
/** Creates configuration object used to create a [[ModifyVisualizationHandler]].
|
||||
*
|
||||
* @param clientId an unique identifier of the client
|
||||
* @param timeout request timeout
|
||||
@ -80,6 +80,6 @@ object ModifyVisualisationHandler {
|
||||
timeout: FiniteDuration,
|
||||
runtime: ActorRef
|
||||
): Props =
|
||||
Props(new ModifyVisualisationHandler(clientId, timeout, runtime))
|
||||
Props(new ModifyVisualizationHandler(clientId, timeout, runtime))
|
||||
|
||||
}
|
@ -5,10 +5,10 @@ import akka.pattern.pipe
|
||||
import cats.implicits._
|
||||
import com.typesafe.scalalogging.LazyLogging
|
||||
import org.enso.languageserver.runtime.ContextRegistryProtocol.{
|
||||
DetachVisualisation,
|
||||
RegisterOneshotVisualisation,
|
||||
VisualisationContext,
|
||||
VisualisationUpdate
|
||||
DetachVisualization,
|
||||
RegisterOneshotVisualization,
|
||||
VisualizationContext,
|
||||
VisualizationUpdate
|
||||
}
|
||||
import org.enso.languageserver.runtime.ExecutionApi.ContextId
|
||||
import org.enso.languageserver.session.JsonSession
|
||||
@ -60,49 +60,49 @@ final class ContextEventsListener(
|
||||
override def receive: Receive = withState(Set(), Vector())
|
||||
|
||||
private def withState(
|
||||
oneshotVisualisations: Set[Api.VisualisationContext],
|
||||
oneshotVisualizations: Set[Api.VisualizationContext],
|
||||
expressionUpdates: Vector[Api.ExpressionUpdate]
|
||||
): Receive = {
|
||||
|
||||
case RegisterOneshotVisualisation(
|
||||
case RegisterOneshotVisualization(
|
||||
contextId,
|
||||
visualisationId,
|
||||
visualizationId,
|
||||
expressionId
|
||||
) =>
|
||||
val visualisationContext =
|
||||
Api.VisualisationContext(
|
||||
visualisationId,
|
||||
val visualizationContext =
|
||||
Api.VisualizationContext(
|
||||
visualizationId,
|
||||
contextId,
|
||||
expressionId
|
||||
)
|
||||
context.become(
|
||||
withState(
|
||||
oneshotVisualisations + visualisationContext,
|
||||
oneshotVisualizations + visualizationContext,
|
||||
expressionUpdates
|
||||
)
|
||||
)
|
||||
|
||||
case Api.VisualisationUpdate(ctx, data) if ctx.contextId == contextId =>
|
||||
case Api.VisualizationUpdate(ctx, data) if ctx.contextId == contextId =>
|
||||
val payload =
|
||||
VisualisationUpdate(
|
||||
VisualisationContext(
|
||||
ctx.visualisationId,
|
||||
VisualizationUpdate(
|
||||
VisualizationContext(
|
||||
ctx.visualizationId,
|
||||
ctx.contextId,
|
||||
ctx.expressionId
|
||||
),
|
||||
data
|
||||
)
|
||||
sessionRouter ! DeliverToBinaryController(rpcSession.clientId, payload)
|
||||
if (oneshotVisualisations.contains(ctx)) {
|
||||
context.parent ! DetachVisualisation(
|
||||
if (oneshotVisualizations.contains(ctx)) {
|
||||
context.parent ! DetachVisualization(
|
||||
rpcSession.clientId,
|
||||
contextId,
|
||||
ctx.visualisationId,
|
||||
ctx.visualizationId,
|
||||
ctx.expressionId
|
||||
)
|
||||
context.become(
|
||||
withState(
|
||||
oneshotVisualisations - ctx,
|
||||
oneshotVisualizations - ctx,
|
||||
expressionUpdates
|
||||
)
|
||||
)
|
||||
@ -110,7 +110,7 @@ final class ContextEventsListener(
|
||||
|
||||
case Api.ExpressionUpdates(`contextId`, apiUpdates) =>
|
||||
context.become(
|
||||
withState(oneshotVisualisations, expressionUpdates :++ apiUpdates)
|
||||
withState(oneshotVisualizations, expressionUpdates :++ apiUpdates)
|
||||
)
|
||||
|
||||
case Api.ExecutionFailed(`contextId`, error) =>
|
||||
@ -144,9 +144,9 @@ final class ContextEventsListener(
|
||||
|
||||
message.pipeTo(sessionRouter)
|
||||
|
||||
case Api.VisualisationEvaluationFailed(
|
||||
case Api.VisualizationEvaluationFailed(
|
||||
`contextId`,
|
||||
visualisationId,
|
||||
visualizationId,
|
||||
expressionId,
|
||||
message,
|
||||
diagnostic
|
||||
@ -156,9 +156,9 @@ final class ContextEventsListener(
|
||||
.map(runtimeFailureMapper.toProtocolDiagnostic)
|
||||
.sequence
|
||||
payload =
|
||||
ContextRegistryProtocol.VisualisationEvaluationFailed(
|
||||
ContextRegistryProtocol.VisualizationEvaluationFailed(
|
||||
contextId,
|
||||
visualisationId,
|
||||
visualizationId,
|
||||
expressionId,
|
||||
message,
|
||||
diagnostic
|
||||
@ -169,7 +169,7 @@ final class ContextEventsListener(
|
||||
|
||||
case RunExpressionUpdates if expressionUpdates.nonEmpty =>
|
||||
runExpressionUpdates(expressionUpdates)
|
||||
context.become(withState(oneshotVisualisations, Vector()))
|
||||
context.become(withState(oneshotVisualizations, Vector()))
|
||||
|
||||
case RunExpressionUpdates if expressionUpdates.isEmpty =>
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ final class ContextRegistry(
|
||||
context.system.eventStream
|
||||
.subscribe(self, classOf[Api.ExpressionUpdates])
|
||||
context.system.eventStream
|
||||
.subscribe(self, classOf[Api.VisualisationUpdate])
|
||||
.subscribe(self, classOf[Api.VisualizationUpdate])
|
||||
context.system.eventStream
|
||||
.subscribe(self, classOf[Api.ExecutionFailed])
|
||||
context.system.eventStream
|
||||
@ -83,7 +83,7 @@ final class ContextRegistry(
|
||||
context.system.eventStream
|
||||
.subscribe(self, classOf[Api.ExecutionUpdate])
|
||||
context.system.eventStream
|
||||
.subscribe(self, classOf[Api.VisualisationEvaluationFailed])
|
||||
.subscribe(self, classOf[Api.VisualizationEvaluationFailed])
|
||||
}
|
||||
|
||||
override def receive: Receive =
|
||||
@ -98,9 +98,9 @@ final class ContextRegistry(
|
||||
case update: Api.ExpressionUpdates =>
|
||||
store.getListener(update.contextId).foreach(_ ! update)
|
||||
|
||||
case update: Api.VisualisationUpdate =>
|
||||
case update: Api.VisualizationUpdate =>
|
||||
store
|
||||
.getListener(update.visualisationContext.contextId)
|
||||
.getListener(update.visualizationContext.contextId)
|
||||
.foreach(_ ! update)
|
||||
|
||||
case update: Api.ExecutionFailed =>
|
||||
@ -112,7 +112,7 @@ final class ContextRegistry(
|
||||
case update: Api.ExecutionUpdate =>
|
||||
store.getListener(update.contextId).foreach(_ ! update)
|
||||
|
||||
case update: Api.VisualisationEvaluationFailed =>
|
||||
case update: Api.VisualizationEvaluationFailed =>
|
||||
store.getListener(update.contextId).foreach(_ ! update)
|
||||
|
||||
case CreateContextRequest(client, contextIdOpt) =>
|
||||
@ -261,26 +261,26 @@ final class ContextRegistry(
|
||||
sender() ! AccessDenied
|
||||
}
|
||||
|
||||
case ExecuteExpression(clientId, visualisationId, expressionId, cfg) =>
|
||||
case ExecuteExpression(clientId, visualizationId, expressionId, cfg) =>
|
||||
val contextId = cfg.executionContextId
|
||||
if (store.hasContext(clientId, contextId)) {
|
||||
store.getListener(contextId).foreach { listener =>
|
||||
listener ! RegisterOneshotVisualisation(
|
||||
listener ! RegisterOneshotVisualization(
|
||||
contextId,
|
||||
visualisationId,
|
||||
visualizationId,
|
||||
expressionId
|
||||
)
|
||||
}
|
||||
val handler = context.actorOf(
|
||||
AttachVisualisationHandler.props(
|
||||
AttachVisualizationHandler.props(
|
||||
runtimeFailureMapper,
|
||||
timeout,
|
||||
runtime
|
||||
)
|
||||
)
|
||||
handler.forward(
|
||||
Api.AttachVisualisation(
|
||||
visualisationId,
|
||||
Api.AttachVisualization(
|
||||
visualizationId,
|
||||
expressionId,
|
||||
cfg.toApi
|
||||
)
|
||||
@ -289,18 +289,18 @@ final class ContextRegistry(
|
||||
sender() ! AccessDenied
|
||||
}
|
||||
|
||||
case AttachVisualisation(clientId, visualisationId, expressionId, cfg) =>
|
||||
case AttachVisualization(clientId, visualizationId, expressionId, cfg) =>
|
||||
if (store.hasContext(clientId, cfg.executionContextId)) {
|
||||
val handler = context.actorOf(
|
||||
AttachVisualisationHandler.props(
|
||||
AttachVisualizationHandler.props(
|
||||
runtimeFailureMapper,
|
||||
timeout,
|
||||
runtime
|
||||
)
|
||||
)
|
||||
handler.forward(
|
||||
Api.AttachVisualisation(
|
||||
visualisationId,
|
||||
Api.AttachVisualization(
|
||||
visualizationId,
|
||||
expressionId,
|
||||
cfg.toApi
|
||||
)
|
||||
@ -309,31 +309,31 @@ final class ContextRegistry(
|
||||
sender() ! AccessDenied
|
||||
}
|
||||
|
||||
case DetachVisualisation(
|
||||
case DetachVisualization(
|
||||
clientId,
|
||||
contextId,
|
||||
visualisationId,
|
||||
visualizationId,
|
||||
expressionId
|
||||
) =>
|
||||
if (store.hasContext(clientId, contextId)) {
|
||||
val handler = context.actorOf(
|
||||
DetachVisualisationHandler.props(
|
||||
DetachVisualizationHandler.props(
|
||||
runtimeFailureMapper,
|
||||
timeout,
|
||||
runtime
|
||||
)
|
||||
)
|
||||
handler.forward(
|
||||
Api.DetachVisualisation(contextId, visualisationId, expressionId)
|
||||
Api.DetachVisualization(contextId, visualizationId, expressionId)
|
||||
)
|
||||
} else {
|
||||
sender() ! AccessDenied
|
||||
}
|
||||
|
||||
case ModifyVisualisation(clientId, visualisationId, cfg) =>
|
||||
case ModifyVisualization(clientId, visualizationId, cfg) =>
|
||||
if (store.hasContext(clientId, cfg.executionContextId)) {
|
||||
val handler = context.actorOf(
|
||||
ModifyVisualisationHandler.props(
|
||||
ModifyVisualizationHandler.props(
|
||||
runtimeFailureMapper,
|
||||
timeout,
|
||||
runtime
|
||||
@ -341,7 +341,7 @@ final class ContextRegistry(
|
||||
)
|
||||
|
||||
handler.forward(
|
||||
Api.ModifyVisualisation(visualisationId, cfg.toApi)
|
||||
Api.ModifyVisualization(visualizationId, cfg.toApi)
|
||||
)
|
||||
} else {
|
||||
sender() ! AccessDenied
|
||||
|
@ -401,137 +401,137 @@ object ContextRegistryProtocol {
|
||||
)
|
||||
|
||||
/** Requests the language server to execute an expression provided in the
|
||||
* `visualisationConfig` on an expression specified by `expressionId`.
|
||||
* `visualizationConfig` on an expression specified by `expressionId`.
|
||||
*
|
||||
* @param clientId the requester id
|
||||
* @param visualisationId an identifier of a visualisation
|
||||
* @param visualizationId an identifier of a visualization
|
||||
* @param expressionId an identifier of an expression which is visualised
|
||||
* @param visualisationConfig a configuration object for properties of the
|
||||
* visualisation
|
||||
* @param visualizationConfig a configuration object for properties of the
|
||||
* visualization
|
||||
*/
|
||||
case class ExecuteExpression(
|
||||
clientId: ClientId,
|
||||
visualisationId: UUID,
|
||||
visualizationId: UUID,
|
||||
expressionId: UUID,
|
||||
visualisationConfig: VisualisationConfiguration
|
||||
visualizationConfig: VisualizationConfiguration
|
||||
) extends ToLogString {
|
||||
|
||||
/** @inheritdoc */
|
||||
override def toLogString(shouldMask: Boolean): String =
|
||||
"ExecuteExpression(" +
|
||||
s"clientId=$clientId," +
|
||||
s"visualisationId=$visualisationId," +
|
||||
s"expressionId=$expressionId,visualisationConfig=" +
|
||||
visualisationConfig.toLogString(shouldMask) +
|
||||
s"visualizationId=$visualizationId," +
|
||||
s"expressionId=$expressionId,visualizationConfig=" +
|
||||
visualizationConfig.toLogString(shouldMask) +
|
||||
")"
|
||||
}
|
||||
|
||||
/** Registers a oneshot visualisation that will be detached after the first
|
||||
/** Registers a oneshot visualization that will be detached after the first
|
||||
* execution.
|
||||
*
|
||||
* @param contextId execution context identifier
|
||||
* @param visualisationId an identifier of a visualisation
|
||||
* @param visualizationId an identifier of a visualization
|
||||
* @param expressionId an identifier of an expression which is visualised
|
||||
*/
|
||||
case class RegisterOneshotVisualisation(
|
||||
case class RegisterOneshotVisualization(
|
||||
contextId: ContextId,
|
||||
visualisationId: UUID,
|
||||
visualizationId: UUID,
|
||||
expressionId: UUID
|
||||
)
|
||||
|
||||
/** Requests the language server to attach a visualisation to the expression
|
||||
/** Requests the language server to attach a visualization to the expression
|
||||
* specified by `expressionId`.
|
||||
*
|
||||
* @param clientId the requester id
|
||||
* @param visualisationId an identifier of a visualisation
|
||||
* @param visualizationId an identifier of a visualization
|
||||
* @param expressionId an identifier of an expression which is visualised
|
||||
* @param visualisationConfig a configuration object for properties of the
|
||||
* visualisation
|
||||
* @param visualizationConfig a configuration object for properties of the
|
||||
* visualization
|
||||
*/
|
||||
case class AttachVisualisation(
|
||||
case class AttachVisualization(
|
||||
clientId: ClientId,
|
||||
visualisationId: UUID,
|
||||
visualizationId: UUID,
|
||||
expressionId: UUID,
|
||||
visualisationConfig: VisualisationConfiguration
|
||||
visualizationConfig: VisualizationConfiguration
|
||||
) extends ToLogString {
|
||||
|
||||
/** @inheritdoc */
|
||||
override def toLogString(shouldMask: Boolean): String =
|
||||
"AttachVisualisation(" +
|
||||
"AttachVisualization(" +
|
||||
s"clientId=$clientId," +
|
||||
s"visualisationId=$visualisationId," +
|
||||
s"expressionId=$expressionId,visualisationConfig=" +
|
||||
visualisationConfig.toLogString(shouldMask) +
|
||||
s"visualizationId=$visualizationId," +
|
||||
s"expressionId=$expressionId,visualizationConfig=" +
|
||||
visualizationConfig.toLogString(shouldMask) +
|
||||
")"
|
||||
}
|
||||
|
||||
/** Signals that attaching a visualisation has succeeded. */
|
||||
case object VisualisationAttached
|
||||
/** Signals that attaching a visualization has succeeded. */
|
||||
case object VisualizationAttached
|
||||
|
||||
/** Requests the language server to detach a visualisation from the expression
|
||||
/** Requests the language server to detach a visualization from the expression
|
||||
* specified by `expressionId`.
|
||||
*
|
||||
* @param clientId the requester id
|
||||
* @param contextId an execution context identifier
|
||||
* @param visualisationId an identifier of a visualisation
|
||||
* @param visualizationId an identifier of a visualization
|
||||
* @param expressionId an identifier of an expression which is visualised
|
||||
*/
|
||||
case class DetachVisualisation(
|
||||
case class DetachVisualization(
|
||||
clientId: ClientId,
|
||||
contextId: UUID,
|
||||
visualisationId: UUID,
|
||||
visualizationId: UUID,
|
||||
expressionId: UUID
|
||||
)
|
||||
|
||||
/** Signals that detaching a visualisation has succeeded.
|
||||
/** Signals that detaching a visualization has succeeded.
|
||||
*/
|
||||
case object VisualisationDetached
|
||||
case object VisualizationDetached
|
||||
|
||||
/** Requests the language server to modify a visualisation.
|
||||
/** Requests the language server to modify a visualization.
|
||||
*
|
||||
* @param clientId the requester id
|
||||
* @param visualisationId an identifier of a visualisation
|
||||
* @param visualisationConfig a configuration object for properties of the
|
||||
* visualisation
|
||||
* @param visualizationId an identifier of a visualization
|
||||
* @param visualizationConfig a configuration object for properties of the
|
||||
* visualization
|
||||
*/
|
||||
case class ModifyVisualisation(
|
||||
case class ModifyVisualization(
|
||||
clientId: ClientId,
|
||||
visualisationId: UUID,
|
||||
visualisationConfig: VisualisationConfiguration
|
||||
visualizationId: UUID,
|
||||
visualizationConfig: VisualizationConfiguration
|
||||
) extends ToLogString {
|
||||
|
||||
/** @inheritdoc */
|
||||
override def toLogString(shouldMask: Boolean): String =
|
||||
"ModifyVisualisation(" +
|
||||
"ModifyVisualization(" +
|
||||
s"clientId=$clientId," +
|
||||
s"visualisationId=$visualisationId,visualisationConfig=" +
|
||||
visualisationConfig.toLogString(shouldMask) +
|
||||
s"visualizationId=$visualizationId,visualizationConfig=" +
|
||||
visualizationConfig.toLogString(shouldMask) +
|
||||
")"
|
||||
}
|
||||
|
||||
/** Signals that a visualisation modification has succeeded.
|
||||
/** Signals that a visualization modification has succeeded.
|
||||
*/
|
||||
case object VisualisationModified
|
||||
case object VisualizationModified
|
||||
|
||||
/** Represents a visualisation context.
|
||||
/** Represents a visualization context.
|
||||
*
|
||||
* @param visualisationId a visualisation identifier
|
||||
* @param visualizationId a visualization identifier
|
||||
* @param contextId a context identifier
|
||||
* @param expressionId an expression identifier
|
||||
*/
|
||||
case class VisualisationContext(
|
||||
visualisationId: UUID,
|
||||
case class VisualizationContext(
|
||||
visualizationId: UUID,
|
||||
contextId: UUID,
|
||||
expressionId: UUID
|
||||
)
|
||||
|
||||
/** An event signaling a visualisation update.
|
||||
/** An event signaling a visualization update.
|
||||
*
|
||||
* @param visualisationContext a visualisation context
|
||||
* @param data a visualisation data
|
||||
* @param visualizationContext a visualization context
|
||||
* @param data a visualization data
|
||||
*/
|
||||
case class VisualisationUpdate(
|
||||
visualisationContext: VisualisationContext,
|
||||
case class VisualizationUpdate(
|
||||
visualizationContext: VisualizationContext,
|
||||
data: Array[Byte]
|
||||
)
|
||||
|
||||
@ -541,33 +541,33 @@ object ContextRegistryProtocol {
|
||||
*/
|
||||
case class ModuleNotFound(moduleName: String) extends Failure
|
||||
|
||||
/** Signals that visualisation cannot be found.
|
||||
/** Signals that visualization cannot be found.
|
||||
*/
|
||||
case object VisualisationNotFound extends Failure
|
||||
case object VisualizationNotFound extends Failure
|
||||
|
||||
/** Signals that an expression specified in a [[AttachVisualisation]] or
|
||||
* a [[ModifyVisualisation]] cannot be evaluated.
|
||||
/** Signals that an expression specified in a [[AttachVisualization]] or
|
||||
* a [[ModifyVisualization]] cannot be evaluated.
|
||||
*
|
||||
* @param message the reason of the failure
|
||||
* @param diagnostic the detailed information about the failure
|
||||
*/
|
||||
case class VisualisationExpressionFailed(
|
||||
case class VisualizationExpressionFailed(
|
||||
message: String,
|
||||
diagnostic: Option[ExecutionDiagnostic]
|
||||
) extends Failure
|
||||
|
||||
/** Signals that an evaluation of a code responsible for generating
|
||||
* visualisation data failed.
|
||||
* visualization data failed.
|
||||
*
|
||||
* @param contextId a context identifier
|
||||
* @param visualisationId a visualisation identifier
|
||||
* @param visualizationId a visualization identifier
|
||||
* @param expressionId an identifier of a visualised expression
|
||||
* @param message the reason of the failure
|
||||
* @param diagnostic the detailed information about the error
|
||||
*/
|
||||
case class VisualisationEvaluationFailed(
|
||||
case class VisualizationEvaluationFailed(
|
||||
contextId: UUID,
|
||||
visualisationId: UUID,
|
||||
visualizationId: UUID,
|
||||
expressionId: UUID,
|
||||
message: String,
|
||||
diagnostic: Option[ExecutionDiagnostic]
|
||||
|
@ -18,7 +18,7 @@ object ExecutionApi {
|
||||
|
||||
type ContextId = UUID
|
||||
type ExpressionId = UUID
|
||||
type VisualisationId = UUID
|
||||
type VisualizationId = UUID
|
||||
|
||||
case object ExecutionContextCreate extends Method("executionContext/create") {
|
||||
|
||||
@ -212,21 +212,21 @@ object ExecutionApi {
|
||||
}
|
||||
}
|
||||
|
||||
case object VisualisationEvaluationFailed
|
||||
extends Method("executionContext/visualisationEvaluationFailed") {
|
||||
case object VisualizationEvaluationFailed
|
||||
extends Method("executionContext/visualizationEvaluationFailed") {
|
||||
|
||||
case class Params(
|
||||
contextId: ContextId,
|
||||
visualisationId: VisualisationId,
|
||||
visualizationId: VisualizationId,
|
||||
expressionId: ExpressionId,
|
||||
message: String,
|
||||
diagnostic: Option[ExecutionDiagnostic]
|
||||
)
|
||||
|
||||
implicit val hasParams
|
||||
: HasParams.Aux[this.type, VisualisationEvaluationFailed.Params] =
|
||||
: HasParams.Aux[this.type, VisualizationEvaluationFailed.Params] =
|
||||
new HasParams[this.type] {
|
||||
type Params = VisualisationEvaluationFailed.Params
|
||||
type Params = VisualizationEvaluationFailed.Params
|
||||
}
|
||||
}
|
||||
|
||||
@ -261,15 +261,15 @@ object ExecutionApi {
|
||||
case class ModuleNotFoundError(moduleName: String)
|
||||
extends Error(2005, s"Module not found [$moduleName]")
|
||||
|
||||
case object VisualisationNotFoundError
|
||||
extends Error(2006, s"Visualisation not found")
|
||||
case object VisualizationNotFoundError
|
||||
extends Error(2006, s"Visualization not found")
|
||||
|
||||
case class VisualisationExpressionError(
|
||||
case class VisualizationExpressionError(
|
||||
msg: String,
|
||||
diagnostic: Option[ContextRegistryProtocol.ExecutionDiagnostic]
|
||||
) extends Error(
|
||||
2007,
|
||||
s"Evaluation of the visualisation expression failed [$msg]"
|
||||
s"Evaluation of the visualization expression failed [$msg]"
|
||||
) {
|
||||
|
||||
override def payload: Option[Json] =
|
||||
|
@ -37,14 +37,14 @@ final class RuntimeFailureMapper(contentRootManager: ContentRootManager) {
|
||||
ContextRegistryProtocol.InvalidStackItemError(contextId)
|
||||
case Api.ModuleNotFound(moduleName) =>
|
||||
ContextRegistryProtocol.ModuleNotFound(moduleName)
|
||||
case Api.VisualisationExpressionFailed(message, result) =>
|
||||
case Api.VisualizationExpressionFailed(message, result) =>
|
||||
for (diagnostic <- result.map(toProtocolDiagnostic).sequence)
|
||||
yield ContextRegistryProtocol.VisualisationExpressionFailed(
|
||||
yield ContextRegistryProtocol.VisualizationExpressionFailed(
|
||||
message,
|
||||
diagnostic
|
||||
)
|
||||
case Api.VisualisationNotFound() =>
|
||||
ContextRegistryProtocol.VisualisationNotFound
|
||||
case Api.VisualizationNotFound() =>
|
||||
ContextRegistryProtocol.VisualizationNotFound
|
||||
}
|
||||
}
|
||||
|
||||
@ -160,11 +160,11 @@ object RuntimeFailureMapper {
|
||||
EmptyStackError
|
||||
case ContextRegistryProtocol.InvalidStackItemError(_) =>
|
||||
InvalidStackItemError
|
||||
case ContextRegistryProtocol.VisualisationNotFound =>
|
||||
VisualisationNotFoundError
|
||||
case ContextRegistryProtocol.VisualizationNotFound =>
|
||||
VisualizationNotFoundError
|
||||
case ContextRegistryProtocol.ModuleNotFound(name) =>
|
||||
ModuleNotFoundError(name)
|
||||
case ContextRegistryProtocol.VisualisationExpressionFailed(msg, result) =>
|
||||
VisualisationExpressionError(msg, result)
|
||||
case ContextRegistryProtocol.VisualizationExpressionFailed(msg, result) =>
|
||||
VisualizationExpressionError(msg, result)
|
||||
}
|
||||
}
|
||||
|
@ -4,19 +4,19 @@ import java.util.UUID
|
||||
|
||||
import org.enso.jsonrpc.{HasParams, HasResult, Method, Unused}
|
||||
|
||||
/** The visualisation JSON RPC API provided by the language server.
|
||||
/** The visualization JSON RPC API provided by the language server.
|
||||
*
|
||||
* @see [[https://github.com/enso-org/enso/blob/develop/docs/language-server/README.md]]
|
||||
*/
|
||||
object VisualisationApi {
|
||||
object VisualizationApi {
|
||||
|
||||
case object ExecuteExpression
|
||||
extends Method("executionContext/executeExpression") {
|
||||
|
||||
case class Params(
|
||||
visualisationId: UUID,
|
||||
visualizationId: UUID,
|
||||
expressionId: UUID,
|
||||
visualisationConfig: VisualisationConfiguration
|
||||
visualizationConfig: VisualizationConfiguration
|
||||
)
|
||||
|
||||
implicit val hasParams: HasParams.Aux[this.type, ExecuteExpression.Params] =
|
||||
@ -29,19 +29,19 @@ object VisualisationApi {
|
||||
}
|
||||
}
|
||||
|
||||
case object AttachVisualisation
|
||||
extends Method("executionContext/attachVisualisation") {
|
||||
case object AttachVisualization
|
||||
extends Method("executionContext/attachVisualization") {
|
||||
|
||||
case class Params(
|
||||
visualisationId: UUID,
|
||||
visualizationId: UUID,
|
||||
expressionId: UUID,
|
||||
visualisationConfig: VisualisationConfiguration
|
||||
visualizationConfig: VisualizationConfiguration
|
||||
)
|
||||
|
||||
implicit
|
||||
val hasParams: HasParams.Aux[this.type, AttachVisualisation.Params] =
|
||||
val hasParams: HasParams.Aux[this.type, AttachVisualization.Params] =
|
||||
new HasParams[this.type] {
|
||||
type Params = AttachVisualisation.Params
|
||||
type Params = AttachVisualization.Params
|
||||
}
|
||||
implicit val hasResult: HasResult.Aux[this.type, Unused.type] =
|
||||
new HasResult[this.type] {
|
||||
@ -49,19 +49,19 @@ object VisualisationApi {
|
||||
}
|
||||
}
|
||||
|
||||
case object DetachVisualisation
|
||||
extends Method("executionContext/detachVisualisation") {
|
||||
case object DetachVisualization
|
||||
extends Method("executionContext/detachVisualization") {
|
||||
|
||||
case class Params(
|
||||
contextId: UUID,
|
||||
visualisationId: UUID,
|
||||
visualizationId: UUID,
|
||||
expressionId: UUID
|
||||
)
|
||||
|
||||
implicit
|
||||
val hasParams: HasParams.Aux[this.type, DetachVisualisation.Params] =
|
||||
val hasParams: HasParams.Aux[this.type, DetachVisualization.Params] =
|
||||
new HasParams[this.type] {
|
||||
type Params = DetachVisualisation.Params
|
||||
type Params = DetachVisualization.Params
|
||||
}
|
||||
implicit val hasResult: HasResult.Aux[this.type, Unused.type] =
|
||||
new HasResult[this.type] {
|
||||
@ -69,18 +69,18 @@ object VisualisationApi {
|
||||
}
|
||||
}
|
||||
|
||||
case object ModifyVisualisation
|
||||
extends Method("executionContext/modifyVisualisation") {
|
||||
case object ModifyVisualization
|
||||
extends Method("executionContext/modifyVisualization") {
|
||||
|
||||
case class Params(
|
||||
visualisationId: UUID,
|
||||
visualisationConfig: VisualisationConfiguration
|
||||
visualizationId: UUID,
|
||||
visualizationConfig: VisualizationConfiguration
|
||||
)
|
||||
|
||||
implicit
|
||||
val hasParams: HasParams.Aux[this.type, ModifyVisualisation.Params] =
|
||||
val hasParams: HasParams.Aux[this.type, ModifyVisualization.Params] =
|
||||
new HasParams[this.type] {
|
||||
type Params = ModifyVisualisation.Params
|
||||
type Params = ModifyVisualization.Params
|
||||
}
|
||||
implicit val hasResult: HasResult.Aux[this.type, Unused.type] =
|
||||
new HasResult[this.type] {
|
@ -8,69 +8,69 @@ import org.enso.polyglot.runtime.Runtime.Api
|
||||
|
||||
import java.util.UUID
|
||||
|
||||
/** A configuration object for properties of the visualisation.
|
||||
/** A configuration object for properties of the visualization.
|
||||
*
|
||||
* @param executionContextId an execution context of the visualisation
|
||||
* @param expression an expression that creates a visualisation
|
||||
* @param executionContextId an execution context of the visualization
|
||||
* @param expression an expression that creates a visualization
|
||||
*/
|
||||
case class VisualisationConfiguration(
|
||||
case class VisualizationConfiguration(
|
||||
executionContextId: UUID,
|
||||
expression: VisualisationExpression
|
||||
expression: VisualizationExpression
|
||||
) extends ToLogString {
|
||||
|
||||
/** A qualified module name containing the expression. */
|
||||
def visualisationModule: String =
|
||||
def visualizationModule: String =
|
||||
expression.module
|
||||
|
||||
/** @inheritdoc */
|
||||
override def toLogString(shouldMask: Boolean): String =
|
||||
s"VisualisationConfiguration(" +
|
||||
s"VisualizationConfiguration(" +
|
||||
s"executionContextId=$executionContextId," +
|
||||
s"expression=${expression.toLogString(shouldMask)})"
|
||||
|
||||
/** Convert to corresponding [[Api]] message. */
|
||||
def toApi: Api.VisualisationConfiguration =
|
||||
Api.VisualisationConfiguration(
|
||||
def toApi: Api.VisualizationConfiguration =
|
||||
Api.VisualizationConfiguration(
|
||||
executionContextId = executionContextId,
|
||||
expression = expression.toApi
|
||||
)
|
||||
|
||||
}
|
||||
object VisualisationConfiguration {
|
||||
object VisualizationConfiguration {
|
||||
|
||||
/** Create a visualisation configuration.
|
||||
/** Create a visualization configuration.
|
||||
*
|
||||
* @param contextId an execution context of the visualisation
|
||||
* @param module a qualified module name containing the visualisation
|
||||
* @param expression a visualisation expression
|
||||
* @return an instance of [[VisualisationConfiguration]]
|
||||
* @param contextId an execution context of the visualization
|
||||
* @param module a qualified module name containing the visualization
|
||||
* @param expression a visualization expression
|
||||
* @return an instance of [[VisualizationConfiguration]]
|
||||
*/
|
||||
def apply(
|
||||
contextId: UUID,
|
||||
module: String,
|
||||
expression: String
|
||||
): VisualisationConfiguration =
|
||||
new VisualisationConfiguration(
|
||||
): VisualizationConfiguration =
|
||||
new VisualizationConfiguration(
|
||||
contextId,
|
||||
VisualisationExpression.Text(module, expression)
|
||||
VisualizationExpression.Text(module, expression)
|
||||
)
|
||||
|
||||
/** Create a visualisation configuration.
|
||||
/** Create a visualization configuration.
|
||||
*
|
||||
* @param contextId an execution context of the visualisation
|
||||
* @param expression a visualisation expression
|
||||
* @param contextId an execution context of the visualization
|
||||
* @param expression a visualization expression
|
||||
* @param positionalArgumentsExpressions the list of arguments that will
|
||||
* be passed to the visualisation expression
|
||||
* @return an instance of [[VisualisationConfiguration]]
|
||||
* be passed to the visualization expression
|
||||
* @return an instance of [[VisualizationConfiguration]]
|
||||
*/
|
||||
def apply(
|
||||
contextId: UUID,
|
||||
expression: MethodPointer,
|
||||
positionalArgumentsExpressions: Vector[String]
|
||||
): VisualisationConfiguration =
|
||||
new VisualisationConfiguration(
|
||||
): VisualizationConfiguration =
|
||||
new VisualizationConfiguration(
|
||||
contextId,
|
||||
VisualisationExpression.ModuleMethod(
|
||||
VisualizationExpression.ModuleMethod(
|
||||
expression,
|
||||
positionalArgumentsExpressions
|
||||
)
|
||||
@ -84,11 +84,11 @@ object VisualisationConfiguration {
|
||||
|
||||
val ExecutionContextId = "executionContextId"
|
||||
|
||||
val VisualisationModule = "visualisationModule"
|
||||
val VisualizationModule = "visualizationModule"
|
||||
}
|
||||
|
||||
/** Json decoder that supports both old and new formats. */
|
||||
implicit val decoder: Decoder[VisualisationConfiguration] =
|
||||
implicit val decoder: Decoder[VisualizationConfiguration] =
|
||||
Decoder.instance { cursor =>
|
||||
cursor.downField(CodecField.Expression).as[String] match {
|
||||
case Left(_) =>
|
||||
@ -102,7 +102,7 @@ object VisualisationConfiguration {
|
||||
arguments <- cursor
|
||||
.downField(CodecField.Arguments)
|
||||
.as[Option[Vector[String]]]
|
||||
} yield VisualisationConfiguration(
|
||||
} yield VisualizationConfiguration(
|
||||
contextId,
|
||||
expression,
|
||||
arguments.getOrElse(Vector())
|
||||
@ -113,28 +113,28 @@ object VisualisationConfiguration {
|
||||
contextId <- cursor
|
||||
.downField(CodecField.ExecutionContextId)
|
||||
.as[UUID]
|
||||
visualisationModule <- cursor
|
||||
.downField(CodecField.VisualisationModule)
|
||||
visualizationModule <- cursor
|
||||
.downField(CodecField.VisualizationModule)
|
||||
.as[String]
|
||||
} yield VisualisationConfiguration(
|
||||
} yield VisualizationConfiguration(
|
||||
contextId,
|
||||
visualisationModule,
|
||||
visualizationModule,
|
||||
expression
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** A visualisation expression. */
|
||||
sealed trait VisualisationExpression extends ToLogString {
|
||||
/** A visualization expression. */
|
||||
sealed trait VisualizationExpression extends ToLogString {
|
||||
|
||||
/** A qualified module name. */
|
||||
def module: String
|
||||
|
||||
/** Convert to corresponding [[Api]] message. */
|
||||
def toApi: Api.VisualisationExpression
|
||||
def toApi: Api.VisualizationExpression
|
||||
}
|
||||
object VisualisationExpression {
|
||||
object VisualizationExpression {
|
||||
|
||||
/** Visualization expression represented as a text.
|
||||
*
|
||||
@ -142,11 +142,11 @@ object VisualisationExpression {
|
||||
* @param expression an expression that creates a visualization
|
||||
*/
|
||||
case class Text(module: String, expression: String)
|
||||
extends VisualisationExpression {
|
||||
extends VisualizationExpression {
|
||||
|
||||
/** @inheritdoc */
|
||||
override def toApi: Api.VisualisationExpression =
|
||||
Api.VisualisationExpression.Text(module, expression)
|
||||
override def toApi: Api.VisualizationExpression =
|
||||
Api.VisualizationExpression.Text(module, expression)
|
||||
|
||||
/** @inheritdoc */
|
||||
override def toLogString(shouldMask: Boolean): String =
|
||||
@ -165,14 +165,14 @@ object VisualisationExpression {
|
||||
case class ModuleMethod(
|
||||
methodPointer: MethodPointer,
|
||||
positionalArgumentsExpressions: Vector[String]
|
||||
) extends VisualisationExpression {
|
||||
) extends VisualizationExpression {
|
||||
|
||||
/** @inheritdoc */
|
||||
override val module: String = methodPointer.module
|
||||
|
||||
/** @inheritdoc */
|
||||
override def toApi: Api.VisualisationExpression =
|
||||
Api.VisualisationExpression.ModuleMethod(
|
||||
override def toApi: Api.VisualizationExpression =
|
||||
Api.VisualizationExpression.ModuleMethod(
|
||||
methodPointer.toApi,
|
||||
positionalArgumentsExpressions
|
||||
)
|
||||
@ -196,29 +196,29 @@ object VisualisationExpression {
|
||||
val ModuleMethod = "ModuleMethod"
|
||||
}
|
||||
|
||||
implicit val encoder: Encoder[VisualisationExpression] =
|
||||
Encoder.instance[VisualisationExpression] {
|
||||
case text: VisualisationExpression.Text =>
|
||||
Encoder[VisualisationExpression.Text]
|
||||
implicit val encoder: Encoder[VisualizationExpression] =
|
||||
Encoder.instance[VisualizationExpression] {
|
||||
case text: VisualizationExpression.Text =>
|
||||
Encoder[VisualizationExpression.Text]
|
||||
.apply(text)
|
||||
.deepMerge(Json.obj(CodecField.Type -> PayloadType.Text.asJson))
|
||||
|
||||
case moduleMethod: VisualisationExpression.ModuleMethod =>
|
||||
Encoder[VisualisationExpression.ModuleMethod]
|
||||
case moduleMethod: VisualizationExpression.ModuleMethod =>
|
||||
Encoder[VisualizationExpression.ModuleMethod]
|
||||
.apply(moduleMethod)
|
||||
.deepMerge(
|
||||
Json.obj(CodecField.Type -> PayloadType.ModuleMethod.asJson)
|
||||
)
|
||||
}
|
||||
|
||||
implicit val decoder: Decoder[VisualisationExpression] =
|
||||
implicit val decoder: Decoder[VisualizationExpression] =
|
||||
Decoder.instance { cursor =>
|
||||
cursor.downField(CodecField.Type).as[String].flatMap {
|
||||
case PayloadType.Text =>
|
||||
Decoder[VisualisationExpression.Text].tryDecode(cursor)
|
||||
Decoder[VisualizationExpression.Text].tryDecode(cursor)
|
||||
|
||||
case PayloadType.ModuleMethod =>
|
||||
Decoder[VisualisationExpression.ModuleMethod].tryDecode(cursor)
|
||||
Decoder[VisualizationExpression.ModuleMethod].tryDecode(cursor)
|
||||
}
|
||||
}
|
||||
|
@ -14,13 +14,13 @@ import org.enso.polyglot.runtime.Runtime.Api
|
||||
import java.util.UUID
|
||||
import scala.concurrent.duration.FiniteDuration
|
||||
|
||||
/** A request handler for attach visualisation commands.
|
||||
/** A request handler for attach visualization commands.
|
||||
*
|
||||
* @param runtimeFailureMapper mapper for runtime failures
|
||||
* @param timeout request timeout
|
||||
* @param runtime reference to the runtime connector
|
||||
*/
|
||||
class AttachVisualisationHandler(
|
||||
class AttachVisualizationHandler(
|
||||
runtimeFailureMapper: RuntimeFailureMapper,
|
||||
timeout: FiniteDuration,
|
||||
runtime: ActorRef
|
||||
@ -32,7 +32,7 @@ class AttachVisualisationHandler(
|
||||
|
||||
override def receive: Receive = requestStage
|
||||
|
||||
private def requestStage: Receive = { case msg: Api.AttachVisualisation =>
|
||||
private def requestStage: Receive = { case msg: Api.AttachVisualization =>
|
||||
runtime ! Api.Request(UUID.randomUUID(), msg)
|
||||
val cancellable =
|
||||
context.system.scheduler.scheduleOnce(timeout, self, RequestTimeout)
|
||||
@ -47,8 +47,8 @@ class AttachVisualisationHandler(
|
||||
replyTo ! RequestTimeout
|
||||
context.stop(self)
|
||||
|
||||
case Api.Response(_, Api.VisualisationAttached()) =>
|
||||
replyTo ! ContextRegistryProtocol.VisualisationAttached
|
||||
case Api.Response(_, Api.VisualizationAttached()) =>
|
||||
replyTo ! ContextRegistryProtocol.VisualizationAttached
|
||||
cancellable.cancel()
|
||||
context.stop(self)
|
||||
|
||||
@ -60,9 +60,9 @@ class AttachVisualisationHandler(
|
||||
|
||||
}
|
||||
|
||||
object AttachVisualisationHandler {
|
||||
object AttachVisualizationHandler {
|
||||
|
||||
/** Creates configuration object used to create a [[AttachVisualisationHandler]].
|
||||
/** Creates configuration object used to create a [[AttachVisualizationHandler]].
|
||||
*
|
||||
* @param runtimeFailureMapper mapper for runtime failures
|
||||
* @param timeout request timeout
|
||||
@ -74,7 +74,7 @@ object AttachVisualisationHandler {
|
||||
runtime: ActorRef
|
||||
): Props =
|
||||
Props(
|
||||
new AttachVisualisationHandler(runtimeFailureMapper, timeout, runtime)
|
||||
new AttachVisualizationHandler(runtimeFailureMapper, timeout, runtime)
|
||||
)
|
||||
|
||||
}
|
@ -14,13 +14,13 @@ import org.enso.polyglot.runtime.Runtime.Api
|
||||
import java.util.UUID
|
||||
import scala.concurrent.duration.FiniteDuration
|
||||
|
||||
/** A request handler for detach visualisation commands.
|
||||
/** A request handler for detach visualization commands.
|
||||
*
|
||||
* @param runtimeFailureMapper mapper for runtime failures
|
||||
* @param timeout request timeout
|
||||
* @param runtime reference to the runtime connector
|
||||
*/
|
||||
class DetachVisualisationHandler(
|
||||
class DetachVisualizationHandler(
|
||||
runtimeFailureMapper: RuntimeFailureMapper,
|
||||
timeout: FiniteDuration,
|
||||
runtime: ActorRef
|
||||
@ -32,7 +32,7 @@ class DetachVisualisationHandler(
|
||||
|
||||
override def receive: Receive = requestStage
|
||||
|
||||
private def requestStage: Receive = { case msg: Api.DetachVisualisation =>
|
||||
private def requestStage: Receive = { case msg: Api.DetachVisualization =>
|
||||
runtime ! Api.Request(UUID.randomUUID(), msg)
|
||||
val cancellable =
|
||||
context.system.scheduler.scheduleOnce(timeout, self, RequestTimeout)
|
||||
@ -47,8 +47,8 @@ class DetachVisualisationHandler(
|
||||
replyTo ! RequestTimeout
|
||||
context.stop(self)
|
||||
|
||||
case Api.Response(_, Api.VisualisationDetached()) =>
|
||||
replyTo ! ContextRegistryProtocol.VisualisationDetached
|
||||
case Api.Response(_, Api.VisualizationDetached()) =>
|
||||
replyTo ! ContextRegistryProtocol.VisualizationDetached
|
||||
cancellable.cancel()
|
||||
context.stop(self)
|
||||
|
||||
@ -60,9 +60,9 @@ class DetachVisualisationHandler(
|
||||
|
||||
}
|
||||
|
||||
object DetachVisualisationHandler {
|
||||
object DetachVisualizationHandler {
|
||||
|
||||
/** Creates configuration object used to create a [[DetachVisualisationHandler]].
|
||||
/** Creates configuration object used to create a [[DetachVisualizationHandler]].
|
||||
*
|
||||
* @param runtimeFailureMapper mapper for runtime failures
|
||||
* @param timeout request timeout
|
||||
@ -74,7 +74,7 @@ object DetachVisualisationHandler {
|
||||
runtime: ActorRef
|
||||
): Props =
|
||||
Props(
|
||||
new DetachVisualisationHandler(runtimeFailureMapper, timeout, runtime)
|
||||
new DetachVisualizationHandler(runtimeFailureMapper, timeout, runtime)
|
||||
)
|
||||
|
||||
}
|
@ -14,13 +14,13 @@ import org.enso.polyglot.runtime.Runtime.Api
|
||||
import java.util.UUID
|
||||
import scala.concurrent.duration.FiniteDuration
|
||||
|
||||
/** A request handler for modify visualisation commands.
|
||||
/** A request handler for modify visualization commands.
|
||||
*
|
||||
* @param runtimeFailureMapper mapper for runtime failures
|
||||
* @param timeout request timeout
|
||||
* @param runtime reference to the runtime connector
|
||||
*/
|
||||
class ModifyVisualisationHandler(
|
||||
class ModifyVisualizationHandler(
|
||||
runtimeFailureMapper: RuntimeFailureMapper,
|
||||
timeout: FiniteDuration,
|
||||
runtime: ActorRef
|
||||
@ -32,7 +32,7 @@ class ModifyVisualisationHandler(
|
||||
|
||||
override def receive: Receive = requestStage
|
||||
|
||||
private def requestStage: Receive = { case msg: Api.ModifyVisualisation =>
|
||||
private def requestStage: Receive = { case msg: Api.ModifyVisualization =>
|
||||
runtime ! Api.Request(UUID.randomUUID(), msg)
|
||||
val cancellable =
|
||||
context.system.scheduler.scheduleOnce(timeout, self, RequestTimeout)
|
||||
@ -47,8 +47,8 @@ class ModifyVisualisationHandler(
|
||||
replyTo ! RequestTimeout
|
||||
context.stop(self)
|
||||
|
||||
case Api.Response(_, Api.VisualisationModified()) =>
|
||||
replyTo ! ContextRegistryProtocol.VisualisationModified
|
||||
case Api.Response(_, Api.VisualizationModified()) =>
|
||||
replyTo ! ContextRegistryProtocol.VisualizationModified
|
||||
cancellable.cancel()
|
||||
context.stop(self)
|
||||
|
||||
@ -60,9 +60,9 @@ class ModifyVisualisationHandler(
|
||||
|
||||
}
|
||||
|
||||
object ModifyVisualisationHandler {
|
||||
object ModifyVisualizationHandler {
|
||||
|
||||
/** Creates configuration object used to create a [[ModifyVisualisationHandler]].
|
||||
/** Creates configuration object used to create a [[ModifyVisualizationHandler]].
|
||||
*
|
||||
* @param runtimeFailureMapper mapper for runtime failures
|
||||
* @param timeout request timeout
|
||||
@ -74,7 +74,7 @@ object ModifyVisualisationHandler {
|
||||
runtime: ActorRef
|
||||
): Props =
|
||||
Props(
|
||||
new ModifyVisualisationHandler(runtimeFailureMapper, timeout, runtime)
|
||||
new ModifyVisualizationHandler(runtimeFailureMapper, timeout, runtime)
|
||||
)
|
||||
|
||||
}
|
@ -26,7 +26,7 @@ table InboundMessage {
|
||||
union OutboundPayload {
|
||||
ERROR: Error,
|
||||
SUCCESS: Success,
|
||||
VISUALISATION_UPDATE: VisualisationUpdate,
|
||||
VISUALIZATION_UPDATE: VisualizationUpdate,
|
||||
FILE_CONTENTS_REPLY: FileContentsReply,
|
||||
WRITE_BYTES_REPLY: WriteBytesReply,
|
||||
READ_BYTES_REPLY: ReadBytesReply,
|
||||
@ -94,10 +94,10 @@ table InitSessionCommand {
|
||||
|
||||
root_type InitSessionCommand;
|
||||
|
||||
// A visualisation context identifying a concrete visualisation.
|
||||
table VisualisationContext {
|
||||
// A visualisation identifier.
|
||||
visualisationId: EnsoUUID (required);
|
||||
// A visualization context identifying a concrete visualization.
|
||||
table VisualizationContext {
|
||||
// A visualization identifier.
|
||||
visualizationId: EnsoUUID (required);
|
||||
|
||||
// A context identifier.
|
||||
contextId: EnsoUUID (required);
|
||||
@ -107,12 +107,12 @@ table VisualisationContext {
|
||||
|
||||
}
|
||||
|
||||
// An event signaling visualisation update.
|
||||
table VisualisationUpdate {
|
||||
// A visualisation context identifying a concrete visualisation.
|
||||
visualisationContext: VisualisationContext (required);
|
||||
// An event signaling visualization update.
|
||||
table VisualizationUpdate {
|
||||
// A visualization context identifying a concrete visualization.
|
||||
visualizationContext: VisualizationContext (required);
|
||||
|
||||
// A visualisation data.
|
||||
// A visualization data.
|
||||
data: [ubyte] (required);
|
||||
|
||||
}
|
||||
|
@ -234,26 +234,26 @@ class ContextEventsListenerSpec
|
||||
|
||||
"register oneshot visualization" taggedAs Retry in withEventsListener {
|
||||
(clientId, contextId, router, registry, listener) =>
|
||||
val ctx = Api.VisualisationContext(
|
||||
val ctx = Api.VisualizationContext(
|
||||
UUID.randomUUID(),
|
||||
contextId,
|
||||
UUID.randomUUID()
|
||||
)
|
||||
|
||||
listener ! RegisterOneshotVisualisation(
|
||||
listener ! RegisterOneshotVisualization(
|
||||
ctx.contextId,
|
||||
ctx.visualisationId,
|
||||
ctx.visualizationId,
|
||||
ctx.expressionId
|
||||
)
|
||||
|
||||
val data1 = Array[Byte](1, 2, 3)
|
||||
listener ! Api.VisualisationUpdate(ctx, data1)
|
||||
listener ! Api.VisualizationUpdate(ctx, data1)
|
||||
router.expectMsg(
|
||||
DeliverToBinaryController(
|
||||
clientId,
|
||||
VisualisationUpdate(
|
||||
VisualisationContext(
|
||||
ctx.visualisationId,
|
||||
VisualizationUpdate(
|
||||
VisualizationContext(
|
||||
ctx.visualizationId,
|
||||
ctx.contextId,
|
||||
ctx.expressionId
|
||||
),
|
||||
@ -262,22 +262,22 @@ class ContextEventsListenerSpec
|
||||
)
|
||||
)
|
||||
registry.expectMsg(
|
||||
DetachVisualisation(
|
||||
DetachVisualization(
|
||||
clientId,
|
||||
ctx.contextId,
|
||||
ctx.visualisationId,
|
||||
ctx.visualizationId,
|
||||
ctx.expressionId
|
||||
)
|
||||
)
|
||||
|
||||
val data2 = Array[Byte](2, 3, 4)
|
||||
listener ! Api.VisualisationUpdate(ctx, data2)
|
||||
listener ! Api.VisualizationUpdate(ctx, data2)
|
||||
router.expectMsg(
|
||||
DeliverToBinaryController(
|
||||
clientId,
|
||||
VisualisationUpdate(
|
||||
VisualisationContext(
|
||||
ctx.visualisationId,
|
||||
VisualizationUpdate(
|
||||
VisualizationContext(
|
||||
ctx.visualizationId,
|
||||
ctx.contextId,
|
||||
ctx.expressionId
|
||||
),
|
||||
@ -290,20 +290,20 @@ class ContextEventsListenerSpec
|
||||
|
||||
"send visualization updates" taggedAs Retry in withEventsListener {
|
||||
(clientId, contextId, router, registry, listener) =>
|
||||
val ctx = Api.VisualisationContext(
|
||||
val ctx = Api.VisualizationContext(
|
||||
UUID.randomUUID(),
|
||||
contextId,
|
||||
UUID.randomUUID()
|
||||
)
|
||||
|
||||
val data1 = Array[Byte](1, 2, 3)
|
||||
listener ! Api.VisualisationUpdate(ctx, data1)
|
||||
listener ! Api.VisualizationUpdate(ctx, data1)
|
||||
router.expectMsg(
|
||||
DeliverToBinaryController(
|
||||
clientId,
|
||||
VisualisationUpdate(
|
||||
VisualisationContext(
|
||||
ctx.visualisationId,
|
||||
VisualizationUpdate(
|
||||
VisualizationContext(
|
||||
ctx.visualizationId,
|
||||
ctx.contextId,
|
||||
ctx.expressionId
|
||||
),
|
||||
@ -314,13 +314,13 @@ class ContextEventsListenerSpec
|
||||
registry.expectNoMessage()
|
||||
|
||||
val data2 = Array[Byte](2, 3, 4)
|
||||
listener ! Api.VisualisationUpdate(ctx, data2)
|
||||
listener ! Api.VisualizationUpdate(ctx, data2)
|
||||
router.expectMsg(
|
||||
DeliverToBinaryController(
|
||||
clientId,
|
||||
VisualisationUpdate(
|
||||
VisualisationContext(
|
||||
ctx.visualisationId,
|
||||
VisualizationUpdate(
|
||||
VisualizationContext(
|
||||
ctx.visualizationId,
|
||||
ctx.contextId,
|
||||
ctx.expressionId
|
||||
),
|
||||
@ -393,14 +393,14 @@ class ContextEventsListenerSpec
|
||||
)
|
||||
}
|
||||
|
||||
"send visualisation evaluation failed notification" taggedAs Retry in withEventsListener {
|
||||
"send visualization evaluation failed notification" taggedAs Retry in withEventsListener {
|
||||
(clientId, contextId, router, _, listener) =>
|
||||
val message = "Test visualisation evaluation failed"
|
||||
val visualisationId = UUID.randomUUID()
|
||||
val message = "Test visualization evaluation failed"
|
||||
val visualizationId = UUID.randomUUID()
|
||||
val expressionId = UUID.randomUUID()
|
||||
listener ! Api.VisualisationEvaluationFailed(
|
||||
listener ! Api.VisualizationEvaluationFailed(
|
||||
contextId,
|
||||
visualisationId,
|
||||
visualizationId,
|
||||
expressionId,
|
||||
message,
|
||||
None
|
||||
@ -409,9 +409,9 @@ class ContextEventsListenerSpec
|
||||
router.expectMsg(
|
||||
DeliverToJsonController(
|
||||
clientId,
|
||||
VisualisationEvaluationFailed(
|
||||
VisualizationEvaluationFailed(
|
||||
contextId,
|
||||
visualisationId,
|
||||
visualizationId,
|
||||
expressionId,
|
||||
message,
|
||||
None
|
||||
|
@ -6,17 +6,17 @@ import java.util.UUID
|
||||
import org.enso.languageserver.protocol.binary.{
|
||||
OutboundMessage,
|
||||
OutboundPayload,
|
||||
VisualisationUpdate => BinaryVisualisationUpdate
|
||||
VisualizationUpdate => BinaryVisualizationUpdate
|
||||
}
|
||||
import org.enso.languageserver.runtime.ContextRegistryProtocol.{
|
||||
VisualisationContext,
|
||||
VisualisationUpdate
|
||||
VisualizationContext,
|
||||
VisualizationUpdate
|
||||
}
|
||||
import org.enso.languageserver.util.binary.BinaryDecoder
|
||||
import org.enso.testkit.FlakySpec
|
||||
import org.scalatest.concurrent.Eventually
|
||||
|
||||
class VisualisationProtocolTest
|
||||
class VisualizationProtocolTest
|
||||
extends BaseBinaryServerTest
|
||||
with Eventually
|
||||
with FlakySpec {
|
||||
@ -24,13 +24,13 @@ class VisualisationProtocolTest
|
||||
implicit private val decoder: BinaryDecoder[OutboundMessage] =
|
||||
OutboundMessageDecoder
|
||||
|
||||
"A visualisation binary protocol" must {
|
||||
"A visualization binary protocol" must {
|
||||
|
||||
"push visualisation updates when controller receives notification" taggedAs Flaky in {
|
||||
"push visualization updates when controller receives notification" taggedAs Flaky in {
|
||||
//given
|
||||
val client = newWsClient()
|
||||
val data = Array[Byte](1, 2, 3)
|
||||
val ctx = VisualisationContext(
|
||||
val ctx = VisualizationContext(
|
||||
UUID.randomUUID(),
|
||||
UUID.randomUUID(),
|
||||
UUID.randomUUID()
|
||||
@ -38,38 +38,38 @@ class VisualisationProtocolTest
|
||||
client.send(createSessionInitCmd())
|
||||
client.expectFrame()
|
||||
//when
|
||||
lastConnectionController ! VisualisationUpdate(ctx, data)
|
||||
lastConnectionController ! VisualizationUpdate(ctx, data)
|
||||
val Right(msg) = client.receiveMessage[OutboundMessage]()
|
||||
//then
|
||||
msg.payloadType() shouldBe OutboundPayload.VISUALISATION_UPDATE
|
||||
msg.payloadType() shouldBe OutboundPayload.VISUALIZATION_UPDATE
|
||||
val payload = msg
|
||||
.payload(new BinaryVisualisationUpdate)
|
||||
.asInstanceOf[BinaryVisualisationUpdate]
|
||||
.payload(new BinaryVisualizationUpdate)
|
||||
.asInstanceOf[BinaryVisualizationUpdate]
|
||||
payload.dataAsByteBuffer().compareTo(ByteBuffer.wrap(data)) shouldBe 0
|
||||
payload
|
||||
.visualisationContext()
|
||||
.visualizationContext()
|
||||
.contextId()
|
||||
.leastSigBits() shouldBe ctx.contextId.getLeastSignificantBits
|
||||
payload
|
||||
.visualisationContext()
|
||||
.visualizationContext()
|
||||
.contextId()
|
||||
.mostSigBits() shouldBe ctx.contextId.getMostSignificantBits
|
||||
payload
|
||||
.visualisationContext()
|
||||
.visualizationContext()
|
||||
.expressionId()
|
||||
.leastSigBits() shouldBe ctx.expressionId.getLeastSignificantBits
|
||||
payload
|
||||
.visualisationContext()
|
||||
.visualizationContext()
|
||||
.expressionId()
|
||||
.mostSigBits() shouldBe ctx.expressionId.getMostSignificantBits
|
||||
payload
|
||||
.visualisationContext()
|
||||
.visualisationId()
|
||||
.leastSigBits() shouldBe ctx.visualisationId.getLeastSignificantBits
|
||||
.visualizationContext()
|
||||
.visualizationId()
|
||||
.leastSigBits() shouldBe ctx.visualizationId.getLeastSignificantBits
|
||||
payload
|
||||
.visualisationContext()
|
||||
.visualisationId()
|
||||
.mostSigBits() shouldBe ctx.visualisationId.getMostSignificantBits
|
||||
.visualizationContext()
|
||||
.visualizationId()
|
||||
.mostSigBits() shouldBe ctx.visualizationId.getMostSignificantBits
|
||||
}
|
||||
|
||||
}
|
@ -3,7 +3,7 @@ package org.enso.languageserver.websocket.json
|
||||
import io.circe.literal._
|
||||
import org.enso.languageserver.runtime.{
|
||||
TestComponentGroups,
|
||||
VisualisationConfiguration
|
||||
VisualizationConfiguration
|
||||
}
|
||||
import org.enso.languageserver.websocket.json.{
|
||||
ExecutionContextJsonMessages => json
|
||||
@ -628,15 +628,15 @@ class ContextRegistryTest extends BaseServerTest {
|
||||
)
|
||||
client.expectJson(json.executionContextCreateResponse(1, contextId))
|
||||
|
||||
// attach visualisation
|
||||
val visualisationId = UUID.randomUUID()
|
||||
// attach visualization
|
||||
val visualizationId = UUID.randomUUID()
|
||||
val expressionId = UUID.randomUUID()
|
||||
val config =
|
||||
VisualisationConfiguration(contextId, "Test.Main", ".to_json.to_text")
|
||||
VisualizationConfiguration(contextId, "Test.Main", ".to_json.to_text")
|
||||
client.send(
|
||||
json.executionContextExecuteExpressionRequest(
|
||||
2,
|
||||
visualisationId,
|
||||
visualizationId,
|
||||
expressionId,
|
||||
config
|
||||
)
|
||||
@ -645,8 +645,8 @@ class ContextRegistryTest extends BaseServerTest {
|
||||
runtimeConnectorProbe.receiveN(1).head match {
|
||||
case Api.Request(
|
||||
requestId,
|
||||
Api.AttachVisualisation(
|
||||
`visualisationId`,
|
||||
Api.AttachVisualization(
|
||||
`visualizationId`,
|
||||
`expressionId`,
|
||||
_
|
||||
)
|
||||
@ -657,7 +657,7 @@ class ContextRegistryTest extends BaseServerTest {
|
||||
}
|
||||
runtimeConnectorProbe.lastSender ! Api.Response(
|
||||
requestId2,
|
||||
Api.VisualisationAttached()
|
||||
Api.VisualizationAttached()
|
||||
)
|
||||
client.expectJson(json.ok(2))
|
||||
}
|
||||
@ -680,15 +680,15 @@ class ContextRegistryTest extends BaseServerTest {
|
||||
)
|
||||
client.expectJson(json.executionContextCreateResponse(1, contextId))
|
||||
|
||||
// attach visualisation
|
||||
val visualisationId = UUID.randomUUID()
|
||||
// attach visualization
|
||||
val visualizationId = UUID.randomUUID()
|
||||
val expressionId = UUID.randomUUID()
|
||||
val config =
|
||||
VisualisationConfiguration(contextId, "Test.Main", ".to_json.to_text")
|
||||
VisualizationConfiguration(contextId, "Test.Main", ".to_json.to_text")
|
||||
client.send(
|
||||
json.executionContextExecuteExpressionRequest(
|
||||
2,
|
||||
visualisationId,
|
||||
visualizationId,
|
||||
expressionId,
|
||||
config
|
||||
)
|
||||
@ -697,8 +697,8 @@ class ContextRegistryTest extends BaseServerTest {
|
||||
runtimeConnectorProbe.receiveN(1).head match {
|
||||
case Api.Request(
|
||||
requestId,
|
||||
Api.AttachVisualisation(
|
||||
`visualisationId`,
|
||||
Api.AttachVisualization(
|
||||
`visualizationId`,
|
||||
`expressionId`,
|
||||
_
|
||||
)
|
||||
@ -709,17 +709,17 @@ class ContextRegistryTest extends BaseServerTest {
|
||||
}
|
||||
runtimeConnectorProbe.lastSender ! Api.Response(
|
||||
requestId2,
|
||||
Api.ModuleNotFound(config.visualisationModule)
|
||||
Api.ModuleNotFound(config.visualizationModule)
|
||||
)
|
||||
client.expectJson(
|
||||
json.executionContextModuleNotFound(
|
||||
2,
|
||||
config.visualisationModule
|
||||
config.visualizationModule
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
"successfully attach visualisation" in {
|
||||
"successfully attach visualization" in {
|
||||
val client = getInitialisedWsClient()
|
||||
|
||||
// create context
|
||||
@ -737,15 +737,15 @@ class ContextRegistryTest extends BaseServerTest {
|
||||
)
|
||||
client.expectJson(json.executionContextCreateResponse(1, contextId))
|
||||
|
||||
// attach visualisation
|
||||
val visualisationId = UUID.randomUUID()
|
||||
// attach visualization
|
||||
val visualizationId = UUID.randomUUID()
|
||||
val expressionId = UUID.randomUUID()
|
||||
val config =
|
||||
VisualisationConfiguration(contextId, "Test.Main", ".to_json.to_text")
|
||||
VisualizationConfiguration(contextId, "Test.Main", ".to_json.to_text")
|
||||
client.send(
|
||||
json.executionContextAttachVisualisationRequest(
|
||||
json.executionContextAttachVisualizationRequest(
|
||||
2,
|
||||
visualisationId,
|
||||
visualizationId,
|
||||
expressionId,
|
||||
config
|
||||
)
|
||||
@ -754,8 +754,8 @@ class ContextRegistryTest extends BaseServerTest {
|
||||
runtimeConnectorProbe.receiveN(1).head match {
|
||||
case Api.Request(
|
||||
requestId,
|
||||
Api.AttachVisualisation(
|
||||
`visualisationId`,
|
||||
Api.AttachVisualization(
|
||||
`visualizationId`,
|
||||
`expressionId`,
|
||||
_
|
||||
)
|
||||
@ -766,12 +766,12 @@ class ContextRegistryTest extends BaseServerTest {
|
||||
}
|
||||
runtimeConnectorProbe.lastSender ! Api.Response(
|
||||
requestId2,
|
||||
Api.VisualisationAttached()
|
||||
Api.VisualizationAttached()
|
||||
)
|
||||
client.expectJson(json.ok(2))
|
||||
}
|
||||
|
||||
"return ModuleNotFound error when attaching visualisation" in {
|
||||
"return ModuleNotFound error when attaching visualization" in {
|
||||
val client = getInitialisedWsClient()
|
||||
|
||||
// create context
|
||||
@ -789,15 +789,15 @@ class ContextRegistryTest extends BaseServerTest {
|
||||
)
|
||||
client.expectJson(json.executionContextCreateResponse(1, contextId))
|
||||
|
||||
// attach visualisation
|
||||
val visualisationId = UUID.randomUUID()
|
||||
// attach visualization
|
||||
val visualizationId = UUID.randomUUID()
|
||||
val expressionId = UUID.randomUUID()
|
||||
val config =
|
||||
VisualisationConfiguration(contextId, "Test.Main", ".to_json.to_text")
|
||||
VisualizationConfiguration(contextId, "Test.Main", ".to_json.to_text")
|
||||
client.send(
|
||||
json.executionContextAttachVisualisationRequest(
|
||||
json.executionContextAttachVisualizationRequest(
|
||||
2,
|
||||
visualisationId,
|
||||
visualizationId,
|
||||
expressionId,
|
||||
config
|
||||
)
|
||||
@ -806,8 +806,8 @@ class ContextRegistryTest extends BaseServerTest {
|
||||
runtimeConnectorProbe.receiveN(1).head match {
|
||||
case Api.Request(
|
||||
requestId,
|
||||
Api.AttachVisualisation(
|
||||
`visualisationId`,
|
||||
Api.AttachVisualization(
|
||||
`visualizationId`,
|
||||
`expressionId`,
|
||||
_
|
||||
)
|
||||
@ -818,17 +818,17 @@ class ContextRegistryTest extends BaseServerTest {
|
||||
}
|
||||
runtimeConnectorProbe.lastSender ! Api.Response(
|
||||
requestId2,
|
||||
Api.ModuleNotFound(config.visualisationModule)
|
||||
Api.ModuleNotFound(config.visualizationModule)
|
||||
)
|
||||
client.expectJson(
|
||||
json.executionContextModuleNotFound(
|
||||
2,
|
||||
config.visualisationModule
|
||||
config.visualizationModule
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
"return VisualisationExpressionFailed error when attaching visualisation" in {
|
||||
"return VisualizationExpressionFailed error when attaching visualization" in {
|
||||
val client = getInitialisedWsClient()
|
||||
|
||||
// create context
|
||||
@ -846,16 +846,16 @@ class ContextRegistryTest extends BaseServerTest {
|
||||
)
|
||||
client.expectJson(json.executionContextCreateResponse(1, contextId))
|
||||
|
||||
// attach visualisation
|
||||
val visualisationId = UUID.randomUUID()
|
||||
// attach visualization
|
||||
val visualizationId = UUID.randomUUID()
|
||||
val expressionId = UUID.randomUUID()
|
||||
val config =
|
||||
VisualisationConfiguration(contextId, "Test.Main", ".to_json.to_text")
|
||||
VisualizationConfiguration(contextId, "Test.Main", ".to_json.to_text")
|
||||
val expressionFailureMessage = "Method `to_json` could not be found."
|
||||
client.send(
|
||||
json.executionContextAttachVisualisationRequest(
|
||||
json.executionContextAttachVisualizationRequest(
|
||||
2,
|
||||
visualisationId,
|
||||
visualizationId,
|
||||
expressionId,
|
||||
config
|
||||
)
|
||||
@ -864,8 +864,8 @@ class ContextRegistryTest extends BaseServerTest {
|
||||
runtimeConnectorProbe.receiveN(1).head match {
|
||||
case Api.Request(
|
||||
requestId,
|
||||
Api.AttachVisualisation(
|
||||
`visualisationId`,
|
||||
Api.AttachVisualization(
|
||||
`visualizationId`,
|
||||
`expressionId`,
|
||||
_
|
||||
)
|
||||
@ -876,17 +876,17 @@ class ContextRegistryTest extends BaseServerTest {
|
||||
}
|
||||
runtimeConnectorProbe.lastSender ! Api.Response(
|
||||
requestId2,
|
||||
Api.VisualisationExpressionFailed(expressionFailureMessage, None)
|
||||
Api.VisualizationExpressionFailed(expressionFailureMessage, None)
|
||||
)
|
||||
client.expectJson(
|
||||
json.executionContextVisualisationExpressionFailed(
|
||||
json.executionContextVisualizationExpressionFailed(
|
||||
2,
|
||||
expressionFailureMessage
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
"successfully detach visualisation" in {
|
||||
"successfully detach visualization" in {
|
||||
val client = getInitialisedWsClient()
|
||||
|
||||
// create context
|
||||
@ -904,14 +904,14 @@ class ContextRegistryTest extends BaseServerTest {
|
||||
)
|
||||
client.expectJson(json.executionContextCreateResponse(1, contextId))
|
||||
|
||||
// detach visualisation
|
||||
val visualisationId = UUID.randomUUID()
|
||||
// detach visualization
|
||||
val visualizationId = UUID.randomUUID()
|
||||
val expressionId = UUID.randomUUID()
|
||||
client.send(
|
||||
json.executionContextDetachVisualisationRequest(
|
||||
json.executionContextDetachVisualizationRequest(
|
||||
2,
|
||||
contextId,
|
||||
visualisationId,
|
||||
visualizationId,
|
||||
expressionId
|
||||
)
|
||||
)
|
||||
@ -919,9 +919,9 @@ class ContextRegistryTest extends BaseServerTest {
|
||||
runtimeConnectorProbe.receiveN(1).head match {
|
||||
case Api.Request(
|
||||
requestId,
|
||||
Api.DetachVisualisation(
|
||||
Api.DetachVisualization(
|
||||
`contextId`,
|
||||
`visualisationId`,
|
||||
`visualizationId`,
|
||||
`expressionId`
|
||||
)
|
||||
) =>
|
||||
@ -931,12 +931,12 @@ class ContextRegistryTest extends BaseServerTest {
|
||||
}
|
||||
runtimeConnectorProbe.lastSender ! Api.Response(
|
||||
requestId2,
|
||||
Api.VisualisationDetached()
|
||||
Api.VisualizationDetached()
|
||||
)
|
||||
client.expectJson(json.ok(2))
|
||||
}
|
||||
|
||||
"successfully modify visualisation" in {
|
||||
"successfully modify visualization" in {
|
||||
val client = getInitialisedWsClient()
|
||||
|
||||
// create context
|
||||
@ -954,14 +954,14 @@ class ContextRegistryTest extends BaseServerTest {
|
||||
)
|
||||
client.expectJson(json.executionContextCreateResponse(1, contextId))
|
||||
|
||||
// modify visualisation
|
||||
val visualisationId = UUID.randomUUID()
|
||||
// modify visualization
|
||||
val visualizationId = UUID.randomUUID()
|
||||
val config =
|
||||
VisualisationConfiguration(contextId, "Test.Main", ".to_json.to_text")
|
||||
VisualizationConfiguration(contextId, "Test.Main", ".to_json.to_text")
|
||||
client.send(
|
||||
json.executionContextModifyVisualisationRequest(
|
||||
json.executionContextModifyVisualizationRequest(
|
||||
2,
|
||||
visualisationId,
|
||||
visualizationId,
|
||||
config
|
||||
)
|
||||
)
|
||||
@ -969,8 +969,8 @@ class ContextRegistryTest extends BaseServerTest {
|
||||
runtimeConnectorProbe.receiveN(1).head match {
|
||||
case Api.Request(
|
||||
requestId,
|
||||
Api.ModifyVisualisation(
|
||||
`visualisationId`,
|
||||
Api.ModifyVisualization(
|
||||
`visualizationId`,
|
||||
_
|
||||
)
|
||||
) =>
|
||||
@ -980,12 +980,12 @@ class ContextRegistryTest extends BaseServerTest {
|
||||
}
|
||||
runtimeConnectorProbe.lastSender ! Api.Response(
|
||||
requestId2,
|
||||
Api.VisualisationModified()
|
||||
Api.VisualizationModified()
|
||||
)
|
||||
client.expectJson(json.ok(2))
|
||||
}
|
||||
|
||||
"return VisualisationNotFound error when modifying visualisation" in {
|
||||
"return VisualizationNotFound error when modifying visualization" in {
|
||||
val client = getInitialisedWsClient()
|
||||
|
||||
// create context
|
||||
@ -1003,14 +1003,14 @@ class ContextRegistryTest extends BaseServerTest {
|
||||
)
|
||||
client.expectJson(json.executionContextCreateResponse(1, contextId))
|
||||
|
||||
// modify visualisation
|
||||
val visualisationId = UUID.randomUUID()
|
||||
// modify visualization
|
||||
val visualizationId = UUID.randomUUID()
|
||||
val config =
|
||||
VisualisationConfiguration(contextId, "Test.Main", ".to_json.to_text")
|
||||
VisualizationConfiguration(contextId, "Test.Main", ".to_json.to_text")
|
||||
client.send(
|
||||
json.executionContextModifyVisualisationRequest(
|
||||
json.executionContextModifyVisualizationRequest(
|
||||
2,
|
||||
visualisationId,
|
||||
visualizationId,
|
||||
config
|
||||
)
|
||||
)
|
||||
@ -1018,8 +1018,8 @@ class ContextRegistryTest extends BaseServerTest {
|
||||
runtimeConnectorProbe.receiveN(1).head match {
|
||||
case Api.Request(
|
||||
requestId,
|
||||
Api.ModifyVisualisation(
|
||||
`visualisationId`,
|
||||
Api.ModifyVisualization(
|
||||
`visualizationId`,
|
||||
_
|
||||
)
|
||||
) =>
|
||||
@ -1029,9 +1029,9 @@ class ContextRegistryTest extends BaseServerTest {
|
||||
}
|
||||
runtimeConnectorProbe.lastSender ! Api.Response(
|
||||
requestId2,
|
||||
Api.VisualisationNotFound()
|
||||
Api.VisualizationNotFound()
|
||||
)
|
||||
client.expectJson(json.executionContextVisualisationNotFound(2))
|
||||
client.expectJson(json.executionContextVisualizationNotFound(2))
|
||||
}
|
||||
|
||||
"get component groups" in {
|
||||
|
@ -3,8 +3,8 @@ package org.enso.languageserver.websocket.json
|
||||
import org.enso.polyglot.runtime.Runtime.Api
|
||||
import io.circe.literal._
|
||||
import org.enso.languageserver.runtime.{
|
||||
VisualisationConfiguration,
|
||||
VisualisationExpression
|
||||
VisualizationConfiguration,
|
||||
VisualizationExpression
|
||||
}
|
||||
|
||||
object ExecutionContextJsonMessages {
|
||||
@ -109,36 +109,36 @@ object ExecutionContextJsonMessages {
|
||||
|
||||
def executionContextExecuteExpressionRequest(
|
||||
reqId: Int,
|
||||
visualisationId: Api.VisualisationId,
|
||||
visualizationId: Api.VisualizationId,
|
||||
expressionId: Api.ExpressionId,
|
||||
configuration: VisualisationConfiguration
|
||||
configuration: VisualizationConfiguration
|
||||
) =
|
||||
configuration.expression match {
|
||||
case VisualisationExpression.Text(module, expression) =>
|
||||
case VisualizationExpression.Text(module, expression) =>
|
||||
json"""
|
||||
{ "jsonrpc": "2.0",
|
||||
"method": "executionContext/executeExpression",
|
||||
"id": $reqId,
|
||||
"params": {
|
||||
"visualisationId": $visualisationId,
|
||||
"visualizationId": $visualizationId,
|
||||
"expressionId": $expressionId,
|
||||
"visualisationConfig": {
|
||||
"visualizationConfig": {
|
||||
"executionContextId": ${configuration.executionContextId},
|
||||
"visualisationModule": $module,
|
||||
"visualizationModule": $module,
|
||||
"expression": $expression
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
case VisualisationExpression.ModuleMethod(methodPointer, Vector()) =>
|
||||
case VisualizationExpression.ModuleMethod(methodPointer, Vector()) =>
|
||||
json"""
|
||||
{ "jsonrpc": "2.0",
|
||||
"method": "executionContext/executeExpression",
|
||||
"id": $reqId,
|
||||
"params": {
|
||||
"visualisationId": $visualisationId,
|
||||
"visualizationId": $visualizationId,
|
||||
"expressionId": $expressionId,
|
||||
"visualisationConfig": {
|
||||
"visualizationConfig": {
|
||||
"executionContextId": ${configuration.executionContextId},
|
||||
"expression": {
|
||||
"module": ${methodPointer.module},
|
||||
@ -149,15 +149,15 @@ object ExecutionContextJsonMessages {
|
||||
}
|
||||
}
|
||||
"""
|
||||
case VisualisationExpression.ModuleMethod(methodPointer, arguments) =>
|
||||
case VisualizationExpression.ModuleMethod(methodPointer, arguments) =>
|
||||
json"""
|
||||
{ "jsonrpc": "2.0",
|
||||
"method": "executionContext/executeExpression",
|
||||
"id": $reqId,
|
||||
"params": {
|
||||
"visualisationId": $visualisationId,
|
||||
"visualizationId": $visualizationId,
|
||||
"expressionId": $expressionId,
|
||||
"visualisationConfig": {
|
||||
"visualizationConfig": {
|
||||
"executionContextId": ${configuration.executionContextId},
|
||||
"expression": {
|
||||
"module": ${methodPointer.module},
|
||||
@ -171,38 +171,38 @@ object ExecutionContextJsonMessages {
|
||||
"""
|
||||
}
|
||||
|
||||
def executionContextAttachVisualisationRequest(
|
||||
def executionContextAttachVisualizationRequest(
|
||||
reqId: Int,
|
||||
visualisationId: Api.VisualisationId,
|
||||
visualizationId: Api.VisualizationId,
|
||||
expressionId: Api.ExpressionId,
|
||||
configuration: VisualisationConfiguration
|
||||
configuration: VisualizationConfiguration
|
||||
) = {
|
||||
configuration.expression match {
|
||||
case VisualisationExpression.Text(module, expression) =>
|
||||
case VisualizationExpression.Text(module, expression) =>
|
||||
json"""
|
||||
{ "jsonrpc": "2.0",
|
||||
"method": "executionContext/attachVisualisation",
|
||||
"method": "executionContext/attachVisualization",
|
||||
"id": $reqId,
|
||||
"params": {
|
||||
"visualisationId": $visualisationId,
|
||||
"visualizationId": $visualizationId,
|
||||
"expressionId": $expressionId,
|
||||
"visualisationConfig": {
|
||||
"visualizationConfig": {
|
||||
"executionContextId": ${configuration.executionContextId},
|
||||
"visualisationModule": $module,
|
||||
"visualizationModule": $module,
|
||||
"expression": $expression
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
case VisualisationExpression.ModuleMethod(methodPointer, Vector()) =>
|
||||
case VisualizationExpression.ModuleMethod(methodPointer, Vector()) =>
|
||||
json"""
|
||||
{ "jsonrpc": "2.0",
|
||||
"method": "executionContext/attachVisualisation",
|
||||
"method": "executionContext/attachVisualization",
|
||||
"id": $reqId,
|
||||
"params": {
|
||||
"visualisationId": $visualisationId,
|
||||
"visualizationId": $visualizationId,
|
||||
"expressionId": $expressionId,
|
||||
"visualisationConfig": {
|
||||
"visualizationConfig": {
|
||||
"executionContextId": ${configuration.executionContextId},
|
||||
"expression": {
|
||||
"module": ${methodPointer.module},
|
||||
@ -213,15 +213,15 @@ object ExecutionContextJsonMessages {
|
||||
}
|
||||
}
|
||||
"""
|
||||
case VisualisationExpression.ModuleMethod(methodPointer, arguments) =>
|
||||
case VisualizationExpression.ModuleMethod(methodPointer, arguments) =>
|
||||
json"""
|
||||
{ "jsonrpc": "2.0",
|
||||
"method": "executionContext/attachVisualisation",
|
||||
"method": "executionContext/attachVisualization",
|
||||
"id": $reqId,
|
||||
"params": {
|
||||
"visualisationId": $visualisationId,
|
||||
"visualizationId": $visualizationId,
|
||||
"expressionId": $expressionId,
|
||||
"visualisationConfig": {
|
||||
"visualizationConfig": {
|
||||
"executionContextId": ${configuration.executionContextId},
|
||||
"expression": {
|
||||
"module": ${methodPointer.module},
|
||||
@ -253,23 +253,23 @@ object ExecutionContextJsonMessages {
|
||||
"""
|
||||
}
|
||||
|
||||
def executionContextVisualisationNotFound(reqId: Int) =
|
||||
def executionContextVisualizationNotFound(reqId: Int) =
|
||||
json"""
|
||||
{ "jsonrpc": "2.0",
|
||||
"id": $reqId,
|
||||
"error": {
|
||||
"code": 2006,
|
||||
"message": "Visualisation not found"
|
||||
"message": "Visualization not found"
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
def executionContextVisualisationExpressionFailed(
|
||||
def executionContextVisualizationExpressionFailed(
|
||||
reqId: Int,
|
||||
message: String
|
||||
) = {
|
||||
val errorMessage =
|
||||
s"Evaluation of the visualisation expression failed [$message]"
|
||||
s"Evaluation of the visualization expression failed [$message]"
|
||||
json"""
|
||||
{ "jsonrpc": "2.0",
|
||||
"id": $reqId,
|
||||
@ -281,53 +281,53 @@ object ExecutionContextJsonMessages {
|
||||
"""
|
||||
}
|
||||
|
||||
def executionContextDetachVisualisationRequest(
|
||||
def executionContextDetachVisualizationRequest(
|
||||
reqId: Int,
|
||||
contextId: Api.ContextId,
|
||||
visualisationId: Api.VisualisationId,
|
||||
visualizationId: Api.VisualizationId,
|
||||
expressionId: Api.ExpressionId
|
||||
) =
|
||||
json"""
|
||||
{ "jsonrpc": "2.0",
|
||||
"method": "executionContext/detachVisualisation",
|
||||
"method": "executionContext/detachVisualization",
|
||||
"id": $reqId,
|
||||
"params": {
|
||||
"contextId": $contextId,
|
||||
"visualisationId": $visualisationId,
|
||||
"visualizationId": $visualizationId,
|
||||
"expressionId": $expressionId
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
def executionContextModifyVisualisationRequest(
|
||||
def executionContextModifyVisualizationRequest(
|
||||
reqId: Int,
|
||||
visualisationId: Api.VisualisationId,
|
||||
configuration: VisualisationConfiguration
|
||||
visualizationId: Api.VisualizationId,
|
||||
configuration: VisualizationConfiguration
|
||||
) = {
|
||||
configuration.expression match {
|
||||
case VisualisationExpression.Text(module, expression) =>
|
||||
case VisualizationExpression.Text(module, expression) =>
|
||||
json"""
|
||||
{ "jsonrpc": "2.0",
|
||||
"method": "executionContext/modifyVisualisation",
|
||||
"method": "executionContext/modifyVisualization",
|
||||
"id": $reqId,
|
||||
"params": {
|
||||
"visualisationId": $visualisationId,
|
||||
"visualisationConfig": {
|
||||
"visualizationId": $visualizationId,
|
||||
"visualizationConfig": {
|
||||
"executionContextId": ${configuration.executionContextId},
|
||||
"visualisationModule": $module,
|
||||
"visualizationModule": $module,
|
||||
"expression": $expression
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
case VisualisationExpression.ModuleMethod(methodPointer, Vector()) =>
|
||||
case VisualizationExpression.ModuleMethod(methodPointer, Vector()) =>
|
||||
json"""
|
||||
{ "jsonrpc": "2.0",
|
||||
"method": "executionContext/modifyVisualisation",
|
||||
"method": "executionContext/modifyVisualization",
|
||||
"id": $reqId,
|
||||
"params": {
|
||||
"visualisationId": $visualisationId,
|
||||
"visualisationConfig": {
|
||||
"visualizationId": $visualizationId,
|
||||
"visualizationConfig": {
|
||||
"executionContextId": ${configuration.executionContextId},
|
||||
"expression": {
|
||||
"module": ${methodPointer.module},
|
||||
@ -338,14 +338,14 @@ object ExecutionContextJsonMessages {
|
||||
}
|
||||
}
|
||||
"""
|
||||
case VisualisationExpression.ModuleMethod(methodPointer, arguments) =>
|
||||
case VisualizationExpression.ModuleMethod(methodPointer, arguments) =>
|
||||
json"""
|
||||
{ "jsonrpc": "2.0",
|
||||
"method": "executionContext/modifyVisualisation",
|
||||
"method": "executionContext/modifyVisualization",
|
||||
"id": $reqId,
|
||||
"params": {
|
||||
"visualisationId": $visualisationId,
|
||||
"visualisationConfig": {
|
||||
"visualizationId": $visualizationId,
|
||||
"visualizationConfig": {
|
||||
"executionContextId": ${configuration.executionContextId},
|
||||
"expression": {
|
||||
"module": ${methodPointer.module},
|
||||
|
@ -3,29 +3,29 @@ import java.util.UUID
|
||||
import io.circe.literal._
|
||||
import org.enso.languageserver.runtime.{
|
||||
MethodPointer,
|
||||
VisualisationConfiguration
|
||||
VisualizationConfiguration
|
||||
}
|
||||
import org.enso.polyglot.runtime.Runtime.Api
|
||||
import org.enso.text.editing.model
|
||||
|
||||
class VisualisationOperationsTest extends BaseServerTest {
|
||||
class VisualizationOperationsTest extends BaseServerTest {
|
||||
|
||||
"executionContext/attachVisualisation" must {
|
||||
"executionContext/attachVisualization" must {
|
||||
|
||||
"return an empty response when the operation succeeds" in {
|
||||
val visualisationId = UUID.randomUUID()
|
||||
val visualizationId = UUID.randomUUID()
|
||||
val expressionId = UUID.randomUUID()
|
||||
|
||||
val client = getInitialisedWsClient()
|
||||
val contextId = createExecutionContext(client)
|
||||
val visualisationConfig =
|
||||
VisualisationConfiguration(contextId, "Foo.Bar.baz", "a=x+y")
|
||||
val visualizationConfig =
|
||||
VisualizationConfiguration(contextId, "Foo.Bar.baz", "a=x+y")
|
||||
client.send(
|
||||
ExecutionContextJsonMessages.executionContextAttachVisualisationRequest(
|
||||
ExecutionContextJsonMessages.executionContextAttachVisualizationRequest(
|
||||
1,
|
||||
visualisationId,
|
||||
visualizationId,
|
||||
expressionId,
|
||||
visualisationConfig
|
||||
visualizationConfig
|
||||
)
|
||||
)
|
||||
|
||||
@ -33,15 +33,15 @@ class VisualisationOperationsTest extends BaseServerTest {
|
||||
runtimeConnectorProbe.receiveN(1).head match {
|
||||
case Api.Request(
|
||||
requestId,
|
||||
Api.AttachVisualisation(
|
||||
`visualisationId`,
|
||||
Api.AttachVisualization(
|
||||
`visualizationId`,
|
||||
`expressionId`,
|
||||
config
|
||||
)
|
||||
) =>
|
||||
config.expression shouldBe visualisationConfig.expression.toApi
|
||||
config.visualisationModule shouldBe visualisationConfig.visualisationModule
|
||||
config.executionContextId shouldBe visualisationConfig.executionContextId
|
||||
config.expression shouldBe visualizationConfig.expression.toApi
|
||||
config.visualizationModule shouldBe visualizationConfig.visualizationModule
|
||||
config.executionContextId shouldBe visualizationConfig.executionContextId
|
||||
requestId
|
||||
|
||||
case msg =>
|
||||
@ -50,36 +50,36 @@ class VisualisationOperationsTest extends BaseServerTest {
|
||||
|
||||
runtimeConnectorProbe.lastSender ! Api.Response(
|
||||
requestId,
|
||||
Api.VisualisationAttached()
|
||||
Api.VisualizationAttached()
|
||||
)
|
||||
client.expectJson(ExecutionContextJsonMessages.ok(1))
|
||||
}
|
||||
|
||||
"allow attaching method pointer without arguments as a visualisation expression" in {
|
||||
val visualisationId = UUID.randomUUID()
|
||||
"allow attaching method pointer without arguments as a visualization expression" in {
|
||||
val visualizationId = UUID.randomUUID()
|
||||
val expressionId = UUID.randomUUID()
|
||||
|
||||
val client = getInitialisedWsClient()
|
||||
val contextId = createExecutionContext(client)
|
||||
val visualisationModule = "Foo.Bar"
|
||||
val visualisationMethod = "baz"
|
||||
val visualisationConfig =
|
||||
VisualisationConfiguration(
|
||||
val visualizationModule = "Foo.Bar"
|
||||
val visualizationMethod = "baz"
|
||||
val visualizationConfig =
|
||||
VisualizationConfiguration(
|
||||
contextId,
|
||||
MethodPointer(
|
||||
visualisationModule,
|
||||
visualisationModule,
|
||||
visualisationMethod
|
||||
visualizationModule,
|
||||
visualizationModule,
|
||||
visualizationMethod
|
||||
),
|
||||
Vector()
|
||||
)
|
||||
|
||||
client.send(
|
||||
ExecutionContextJsonMessages.executionContextAttachVisualisationRequest(
|
||||
ExecutionContextJsonMessages.executionContextAttachVisualizationRequest(
|
||||
1,
|
||||
visualisationId,
|
||||
visualizationId,
|
||||
expressionId,
|
||||
visualisationConfig
|
||||
visualizationConfig
|
||||
)
|
||||
)
|
||||
|
||||
@ -87,15 +87,15 @@ class VisualisationOperationsTest extends BaseServerTest {
|
||||
runtimeConnectorProbe.receiveN(1).head match {
|
||||
case Api.Request(
|
||||
requestId,
|
||||
Api.AttachVisualisation(
|
||||
`visualisationId`,
|
||||
Api.AttachVisualization(
|
||||
`visualizationId`,
|
||||
`expressionId`,
|
||||
config
|
||||
)
|
||||
) =>
|
||||
config.expression shouldBe visualisationConfig.expression.toApi
|
||||
config.visualisationModule shouldBe visualisationConfig.visualisationModule
|
||||
config.executionContextId shouldBe visualisationConfig.executionContextId
|
||||
config.expression shouldBe visualizationConfig.expression.toApi
|
||||
config.visualizationModule shouldBe visualizationConfig.visualizationModule
|
||||
config.executionContextId shouldBe visualizationConfig.executionContextId
|
||||
requestId
|
||||
|
||||
case msg =>
|
||||
@ -104,36 +104,36 @@ class VisualisationOperationsTest extends BaseServerTest {
|
||||
|
||||
runtimeConnectorProbe.lastSender ! Api.Response(
|
||||
requestId,
|
||||
Api.VisualisationAttached()
|
||||
Api.VisualizationAttached()
|
||||
)
|
||||
client.expectJson(ExecutionContextJsonMessages.ok(1))
|
||||
}
|
||||
|
||||
"allow attaching method pointer with arguments as a visualisation expression" in {
|
||||
val visualisationId = UUID.randomUUID()
|
||||
"allow attaching method pointer with arguments as a visualization expression" in {
|
||||
val visualizationId = UUID.randomUUID()
|
||||
val expressionId = UUID.randomUUID()
|
||||
|
||||
val client = getInitialisedWsClient()
|
||||
val contextId = createExecutionContext(client)
|
||||
val visualisationModule = "Foo.Bar"
|
||||
val visualisationMethod = "baz"
|
||||
val visualisationConfig =
|
||||
VisualisationConfiguration(
|
||||
val visualizationModule = "Foo.Bar"
|
||||
val visualizationMethod = "baz"
|
||||
val visualizationConfig =
|
||||
VisualizationConfiguration(
|
||||
contextId,
|
||||
MethodPointer(
|
||||
visualisationModule,
|
||||
visualisationModule,
|
||||
visualisationMethod
|
||||
visualizationModule,
|
||||
visualizationModule,
|
||||
visualizationMethod
|
||||
),
|
||||
Vector("1", "2", "3")
|
||||
)
|
||||
|
||||
client.send(
|
||||
ExecutionContextJsonMessages.executionContextAttachVisualisationRequest(
|
||||
ExecutionContextJsonMessages.executionContextAttachVisualizationRequest(
|
||||
1,
|
||||
visualisationId,
|
||||
visualizationId,
|
||||
expressionId,
|
||||
visualisationConfig
|
||||
visualizationConfig
|
||||
)
|
||||
)
|
||||
|
||||
@ -141,15 +141,15 @@ class VisualisationOperationsTest extends BaseServerTest {
|
||||
runtimeConnectorProbe.receiveN(1).head match {
|
||||
case Api.Request(
|
||||
requestId,
|
||||
Api.AttachVisualisation(
|
||||
`visualisationId`,
|
||||
Api.AttachVisualization(
|
||||
`visualizationId`,
|
||||
`expressionId`,
|
||||
config
|
||||
)
|
||||
) =>
|
||||
config.expression shouldBe visualisationConfig.expression.toApi
|
||||
config.visualisationModule shouldBe visualisationConfig.visualisationModule
|
||||
config.executionContextId shouldBe visualisationConfig.executionContextId
|
||||
config.expression shouldBe visualizationConfig.expression.toApi
|
||||
config.visualizationModule shouldBe visualizationConfig.visualizationModule
|
||||
config.executionContextId shouldBe visualizationConfig.executionContextId
|
||||
requestId
|
||||
|
||||
case msg =>
|
||||
@ -158,24 +158,24 @@ class VisualisationOperationsTest extends BaseServerTest {
|
||||
|
||||
runtimeConnectorProbe.lastSender ! Api.Response(
|
||||
requestId,
|
||||
Api.VisualisationAttached()
|
||||
Api.VisualizationAttached()
|
||||
)
|
||||
client.expectJson(ExecutionContextJsonMessages.ok(1))
|
||||
}
|
||||
|
||||
"reply with AccessDenied when context doesn't belong to client" in {
|
||||
val visualisationId = UUID.randomUUID()
|
||||
val visualizationId = UUID.randomUUID()
|
||||
val expressionId = UUID.randomUUID()
|
||||
val contextId = UUID.randomUUID()
|
||||
val client = getInitialisedWsClient()
|
||||
val visualisationConfig =
|
||||
VisualisationConfiguration(contextId, "Foo.Bar.baz", "a=x+y")
|
||||
val visualizationConfig =
|
||||
VisualizationConfiguration(contextId, "Foo.Bar.baz", "a=x+y")
|
||||
client.send(
|
||||
ExecutionContextJsonMessages.executionContextAttachVisualisationRequest(
|
||||
ExecutionContextJsonMessages.executionContextAttachVisualizationRequest(
|
||||
1,
|
||||
visualisationId,
|
||||
visualizationId,
|
||||
expressionId,
|
||||
visualisationConfig
|
||||
visualizationConfig
|
||||
)
|
||||
)
|
||||
client.expectJson(json"""
|
||||
@ -189,20 +189,20 @@ class VisualisationOperationsTest extends BaseServerTest {
|
||||
""")
|
||||
}
|
||||
|
||||
"reply with ModuleNotFound error when attaching a visualisation" in {
|
||||
val visualisationId = UUID.randomUUID()
|
||||
"reply with ModuleNotFound error when attaching a visualization" in {
|
||||
val visualizationId = UUID.randomUUID()
|
||||
val expressionId = UUID.randomUUID()
|
||||
|
||||
val client = getInitialisedWsClient()
|
||||
val contextId = createExecutionContext(client)
|
||||
val visualisationConfig =
|
||||
VisualisationConfiguration(contextId, "Foo.Bar", "_")
|
||||
val visualizationConfig =
|
||||
VisualizationConfiguration(contextId, "Foo.Bar", "_")
|
||||
client.send(
|
||||
ExecutionContextJsonMessages.executionContextAttachVisualisationRequest(
|
||||
ExecutionContextJsonMessages.executionContextAttachVisualizationRequest(
|
||||
1,
|
||||
visualisationId,
|
||||
visualizationId,
|
||||
expressionId,
|
||||
visualisationConfig
|
||||
visualizationConfig
|
||||
)
|
||||
)
|
||||
|
||||
@ -210,15 +210,15 @@ class VisualisationOperationsTest extends BaseServerTest {
|
||||
runtimeConnectorProbe.receiveN(1).head match {
|
||||
case Api.Request(
|
||||
requestId,
|
||||
Api.AttachVisualisation(
|
||||
`visualisationId`,
|
||||
Api.AttachVisualization(
|
||||
`visualizationId`,
|
||||
`expressionId`,
|
||||
config
|
||||
)
|
||||
) =>
|
||||
config.expression shouldBe visualisationConfig.expression.toApi
|
||||
config.visualisationModule shouldBe visualisationConfig.visualisationModule
|
||||
config.executionContextId shouldBe visualisationConfig.executionContextId
|
||||
config.expression shouldBe visualizationConfig.expression.toApi
|
||||
config.visualizationModule shouldBe visualizationConfig.visualizationModule
|
||||
config.executionContextId shouldBe visualizationConfig.executionContextId
|
||||
requestId
|
||||
|
||||
case msg =>
|
||||
@ -227,31 +227,31 @@ class VisualisationOperationsTest extends BaseServerTest {
|
||||
|
||||
runtimeConnectorProbe.lastSender ! Api.Response(
|
||||
requestId,
|
||||
Api.ModuleNotFound(visualisationConfig.visualisationModule)
|
||||
Api.ModuleNotFound(visualizationConfig.visualizationModule)
|
||||
)
|
||||
client.expectJson(
|
||||
ExecutionContextJsonMessages.executionContextModuleNotFound(
|
||||
1,
|
||||
visualisationConfig.visualisationModule
|
||||
visualizationConfig.visualizationModule
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
"reply with VisualisationExpressionFailed error when attaching a visualisation" in {
|
||||
val visualisationId = UUID.randomUUID()
|
||||
"reply with VisualizationExpressionFailed error when attaching a visualization" in {
|
||||
val visualizationId = UUID.randomUUID()
|
||||
val expressionId = UUID.randomUUID()
|
||||
|
||||
val client = getInitialisedWsClient()
|
||||
val contextId = createExecutionContext(client)
|
||||
val visualisationConfig =
|
||||
VisualisationConfiguration(contextId, "Foo.Bar", "_")
|
||||
val visualizationConfig =
|
||||
VisualizationConfiguration(contextId, "Foo.Bar", "_")
|
||||
val expressionFailureMessage = "Method `to_json` could not be found."
|
||||
client.send(
|
||||
ExecutionContextJsonMessages.executionContextAttachVisualisationRequest(
|
||||
ExecutionContextJsonMessages.executionContextAttachVisualizationRequest(
|
||||
1,
|
||||
visualisationId,
|
||||
visualizationId,
|
||||
expressionId,
|
||||
visualisationConfig
|
||||
visualizationConfig
|
||||
)
|
||||
)
|
||||
|
||||
@ -259,15 +259,15 @@ class VisualisationOperationsTest extends BaseServerTest {
|
||||
runtimeConnectorProbe.receiveN(1).head match {
|
||||
case Api.Request(
|
||||
requestId,
|
||||
Api.AttachVisualisation(
|
||||
`visualisationId`,
|
||||
Api.AttachVisualization(
|
||||
`visualizationId`,
|
||||
`expressionId`,
|
||||
config
|
||||
)
|
||||
) =>
|
||||
config.expression shouldBe visualisationConfig.expression.toApi
|
||||
config.visualisationModule shouldBe visualisationConfig.visualisationModule
|
||||
config.executionContextId shouldBe visualisationConfig.executionContextId
|
||||
config.expression shouldBe visualizationConfig.expression.toApi
|
||||
config.visualizationModule shouldBe visualizationConfig.visualizationModule
|
||||
config.executionContextId shouldBe visualizationConfig.executionContextId
|
||||
requestId
|
||||
|
||||
case msg =>
|
||||
@ -276,7 +276,7 @@ class VisualisationOperationsTest extends BaseServerTest {
|
||||
|
||||
runtimeConnectorProbe.lastSender ! Api.Response(
|
||||
requestId,
|
||||
Api.VisualisationExpressionFailed(
|
||||
Api.VisualizationExpressionFailed(
|
||||
expressionFailureMessage,
|
||||
Some(
|
||||
Api.ExecutionResult.Diagnostic.error(
|
||||
@ -290,7 +290,7 @@ class VisualisationOperationsTest extends BaseServerTest {
|
||||
)
|
||||
)
|
||||
val errorMessage =
|
||||
s"Evaluation of the visualisation expression failed [$expressionFailureMessage]"
|
||||
s"Evaluation of the visualization expression failed [$expressionFailureMessage]"
|
||||
client.expectJson(
|
||||
json"""
|
||||
{ "jsonrpc" : "2.0",
|
||||
@ -323,18 +323,18 @@ class VisualisationOperationsTest extends BaseServerTest {
|
||||
|
||||
}
|
||||
|
||||
"executionContext/detachVisualisation" must {
|
||||
"executionContext/detachVisualization" must {
|
||||
|
||||
"return an empty response when the operation succeeds" in {
|
||||
val visualisationId = UUID.randomUUID()
|
||||
val visualizationId = UUID.randomUUID()
|
||||
val expressionId = UUID.randomUUID()
|
||||
val client = getInitialisedWsClient()
|
||||
val contextId = createExecutionContext(client)
|
||||
client.send(
|
||||
ExecutionContextJsonMessages.executionContextDetachVisualisationRequest(
|
||||
ExecutionContextJsonMessages.executionContextDetachVisualizationRequest(
|
||||
1,
|
||||
contextId,
|
||||
visualisationId,
|
||||
visualizationId,
|
||||
expressionId
|
||||
)
|
||||
)
|
||||
@ -342,9 +342,9 @@ class VisualisationOperationsTest extends BaseServerTest {
|
||||
runtimeConnectorProbe.receiveN(1).head match {
|
||||
case Api.Request(
|
||||
requestId,
|
||||
Api.DetachVisualisation(
|
||||
Api.DetachVisualization(
|
||||
`contextId`,
|
||||
`visualisationId`,
|
||||
`visualizationId`,
|
||||
`expressionId`
|
||||
)
|
||||
) =>
|
||||
@ -356,21 +356,21 @@ class VisualisationOperationsTest extends BaseServerTest {
|
||||
|
||||
runtimeConnectorProbe.lastSender ! Api.Response(
|
||||
requestId,
|
||||
Api.VisualisationDetached()
|
||||
Api.VisualizationDetached()
|
||||
)
|
||||
client.expectJson(ExecutionContextJsonMessages.ok(1))
|
||||
}
|
||||
|
||||
"reply with AccessDenied when context doesn't belong to client" in {
|
||||
val visualisationId = UUID.randomUUID()
|
||||
val visualizationId = UUID.randomUUID()
|
||||
val expressionId = UUID.randomUUID()
|
||||
val contextId = UUID.randomUUID()
|
||||
val client = getInitialisedWsClient()
|
||||
client.send(
|
||||
ExecutionContextJsonMessages.executionContextDetachVisualisationRequest(
|
||||
ExecutionContextJsonMessages.executionContextDetachVisualizationRequest(
|
||||
1,
|
||||
contextId,
|
||||
visualisationId,
|
||||
visualizationId,
|
||||
expressionId
|
||||
)
|
||||
)
|
||||
@ -387,19 +387,19 @@ class VisualisationOperationsTest extends BaseServerTest {
|
||||
|
||||
}
|
||||
|
||||
"executionContext/modifyVisualisation" must {
|
||||
"executionContext/modifyVisualization" must {
|
||||
|
||||
"return an empty response when the operation succeeds" in {
|
||||
val visualisationId = UUID.randomUUID()
|
||||
val visualizationId = UUID.randomUUID()
|
||||
val client = getInitialisedWsClient()
|
||||
val contextId = createExecutionContext(client)
|
||||
val visualisationConfig =
|
||||
VisualisationConfiguration(contextId, "Foo.Bar.baz", "a=x+y")
|
||||
val visualizationConfig =
|
||||
VisualizationConfiguration(contextId, "Foo.Bar.baz", "a=x+y")
|
||||
client.send(
|
||||
ExecutionContextJsonMessages.executionContextModifyVisualisationRequest(
|
||||
ExecutionContextJsonMessages.executionContextModifyVisualizationRequest(
|
||||
1,
|
||||
visualisationId,
|
||||
visualisationConfig
|
||||
visualizationId,
|
||||
visualizationConfig
|
||||
)
|
||||
)
|
||||
|
||||
@ -407,11 +407,11 @@ class VisualisationOperationsTest extends BaseServerTest {
|
||||
runtimeConnectorProbe.receiveN(1).head match {
|
||||
case Api.Request(
|
||||
requestId,
|
||||
Api.ModifyVisualisation(`visualisationId`, config)
|
||||
Api.ModifyVisualization(`visualizationId`, config)
|
||||
) =>
|
||||
config.expression shouldBe visualisationConfig.expression.toApi
|
||||
config.visualisationModule shouldBe visualisationConfig.visualisationModule
|
||||
config.executionContextId shouldBe visualisationConfig.executionContextId
|
||||
config.expression shouldBe visualizationConfig.expression.toApi
|
||||
config.visualizationModule shouldBe visualizationConfig.visualizationModule
|
||||
config.executionContextId shouldBe visualizationConfig.executionContextId
|
||||
requestId
|
||||
|
||||
case msg =>
|
||||
@ -420,23 +420,23 @@ class VisualisationOperationsTest extends BaseServerTest {
|
||||
|
||||
runtimeConnectorProbe.lastSender ! Api.Response(
|
||||
requestId,
|
||||
Api.VisualisationModified()
|
||||
Api.VisualizationModified()
|
||||
)
|
||||
client.expectJson(ExecutionContextJsonMessages.ok(1))
|
||||
}
|
||||
|
||||
"reply with AccessDenied when context doesn't belong to client" in {
|
||||
val visualisationId = UUID.randomUUID()
|
||||
val visualizationId = UUID.randomUUID()
|
||||
val contextId = UUID.randomUUID()
|
||||
val client = getInitialisedWsClient()
|
||||
val visualisationConfig =
|
||||
VisualisationConfiguration(contextId, "Foo.Bar.baz", "a=x+y")
|
||||
val visualizationConfig =
|
||||
VisualizationConfiguration(contextId, "Foo.Bar.baz", "a=x+y")
|
||||
|
||||
client.send(
|
||||
ExecutionContextJsonMessages.executionContextModifyVisualisationRequest(
|
||||
ExecutionContextJsonMessages.executionContextModifyVisualizationRequest(
|
||||
1,
|
||||
visualisationId,
|
||||
visualisationConfig
|
||||
visualizationId,
|
||||
visualizationConfig
|
||||
)
|
||||
)
|
||||
client.expectJson(json"""
|
@ -204,7 +204,7 @@ object LauncherApplication {
|
||||
.optionalParameter[Int](
|
||||
"data-port",
|
||||
"PORT",
|
||||
"Data port for visualisation protocol. Defaults to 8081."
|
||||
"Data port for visualization protocol. Defaults to 8081."
|
||||
)
|
||||
.withDefault(8081)
|
||||
val additionalArgs = Opts.additionalArguments()
|
||||
|
@ -109,32 +109,32 @@ object Runtime {
|
||||
name = "closeFileNotification"
|
||||
),
|
||||
new JsonSubTypes.Type(
|
||||
value = classOf[Api.VisualisationUpdate],
|
||||
name = "visualisationUpdate"
|
||||
value = classOf[Api.VisualizationUpdate],
|
||||
name = "visualizationUpdate"
|
||||
),
|
||||
new JsonSubTypes.Type(
|
||||
value = classOf[Api.AttachVisualisation],
|
||||
name = "attachVisualisation"
|
||||
value = classOf[Api.AttachVisualization],
|
||||
name = "attachVisualization"
|
||||
),
|
||||
new JsonSubTypes.Type(
|
||||
value = classOf[Api.VisualisationAttached],
|
||||
name = "visualisationAttached"
|
||||
value = classOf[Api.VisualizationAttached],
|
||||
name = "visualizationAttached"
|
||||
),
|
||||
new JsonSubTypes.Type(
|
||||
value = classOf[Api.DetachVisualisation],
|
||||
name = "detachVisualisation"
|
||||
value = classOf[Api.DetachVisualization],
|
||||
name = "detachVisualization"
|
||||
),
|
||||
new JsonSubTypes.Type(
|
||||
value = classOf[Api.VisualisationDetached],
|
||||
name = "visualisationDetached"
|
||||
value = classOf[Api.VisualizationDetached],
|
||||
name = "visualizationDetached"
|
||||
),
|
||||
new JsonSubTypes.Type(
|
||||
value = classOf[Api.ModifyVisualisation],
|
||||
name = "modifyVisualisation"
|
||||
value = classOf[Api.ModifyVisualization],
|
||||
name = "modifyVisualization"
|
||||
),
|
||||
new JsonSubTypes.Type(
|
||||
value = classOf[Api.VisualisationModified],
|
||||
name = "visualisationModified"
|
||||
value = classOf[Api.VisualizationModified],
|
||||
name = "visualizationModified"
|
||||
),
|
||||
new JsonSubTypes.Type(
|
||||
value = classOf[Api.ExpressionUpdates],
|
||||
@ -173,16 +173,16 @@ object Runtime {
|
||||
name = "executionSuccessful"
|
||||
),
|
||||
new JsonSubTypes.Type(
|
||||
value = classOf[Api.VisualisationExpressionFailed],
|
||||
name = "visualisationExpressionFailed"
|
||||
value = classOf[Api.VisualizationExpressionFailed],
|
||||
name = "visualizationExpressionFailed"
|
||||
),
|
||||
new JsonSubTypes.Type(
|
||||
value = classOf[Api.VisualisationEvaluationFailed],
|
||||
name = "visualisationEvaluationFailed"
|
||||
value = classOf[Api.VisualizationEvaluationFailed],
|
||||
name = "visualizationEvaluationFailed"
|
||||
),
|
||||
new JsonSubTypes.Type(
|
||||
value = classOf[Api.VisualisationNotFound],
|
||||
name = "visualisationNotFound"
|
||||
value = classOf[Api.VisualizationNotFound],
|
||||
name = "visualizationNotFound"
|
||||
),
|
||||
new JsonSubTypes.Type(
|
||||
value = classOf[Api.InvalidStackItemError],
|
||||
@ -301,7 +301,7 @@ object Runtime {
|
||||
type ContextId = UUID
|
||||
type ExpressionId = UUID
|
||||
type RequestId = UUID
|
||||
type VisualisationId = UUID
|
||||
type VisualizationId = UUID
|
||||
|
||||
/** Indicates error response.
|
||||
*/
|
||||
@ -541,14 +541,14 @@ object Runtime {
|
||||
updates: Set[ExpressionUpdate]
|
||||
) extends ApiNotification
|
||||
|
||||
/** Represents a visualisation context.
|
||||
/** Represents a visualization context.
|
||||
*
|
||||
* @param visualisationId a visualisation identifier
|
||||
* @param visualizationId a visualization identifier
|
||||
* @param contextId a context identifier
|
||||
* @param expressionId an expression identifier
|
||||
*/
|
||||
case class VisualisationContext(
|
||||
visualisationId: VisualisationId,
|
||||
case class VisualizationContext(
|
||||
visualizationId: VisualizationId,
|
||||
contextId: ContextId,
|
||||
expressionId: ExpressionId
|
||||
)
|
||||
@ -558,19 +558,19 @@ object Runtime {
|
||||
@JsonSubTypes(
|
||||
Array(
|
||||
new JsonSubTypes.Type(
|
||||
value = classOf[VisualisationExpression.Text],
|
||||
name = "visualisationExpressionText"
|
||||
value = classOf[VisualizationExpression.Text],
|
||||
name = "visualizationExpressionText"
|
||||
),
|
||||
new JsonSubTypes.Type(
|
||||
value = classOf[VisualisationExpression.ModuleMethod],
|
||||
name = "visualisationExpressionModuleMethod"
|
||||
value = classOf[VisualizationExpression.ModuleMethod],
|
||||
name = "visualizationExpressionModuleMethod"
|
||||
)
|
||||
)
|
||||
)
|
||||
sealed trait VisualisationExpression extends ToLogString {
|
||||
sealed trait VisualizationExpression extends ToLogString {
|
||||
def module: String
|
||||
}
|
||||
object VisualisationExpression {
|
||||
object VisualizationExpression {
|
||||
|
||||
/** Visualization expression represented as a text.
|
||||
*
|
||||
@ -578,7 +578,7 @@ object Runtime {
|
||||
* @param expression an expression that creates a visualization
|
||||
*/
|
||||
case class Text(module: String, expression: String)
|
||||
extends VisualisationExpression {
|
||||
extends VisualizationExpression {
|
||||
|
||||
/** @inheritdoc */
|
||||
override def toLogString(shouldMask: Boolean): String =
|
||||
@ -597,7 +597,7 @@ object Runtime {
|
||||
case class ModuleMethod(
|
||||
methodPointer: MethodPointer,
|
||||
positionalArgumentsExpressions: Vector[String]
|
||||
) extends VisualisationExpression {
|
||||
) extends VisualizationExpression {
|
||||
|
||||
/** @inheritdoc */
|
||||
override val module: String = methodPointer.module
|
||||
@ -611,23 +611,23 @@ object Runtime {
|
||||
}
|
||||
}
|
||||
|
||||
/** A configuration object for properties of the visualisation.
|
||||
/** A configuration object for properties of the visualization.
|
||||
*
|
||||
* @param executionContextId an execution context of the visualisation
|
||||
* @param expression the expression that creates a visualisation
|
||||
* @param executionContextId an execution context of the visualization
|
||||
* @param expression the expression that creates a visualization
|
||||
*/
|
||||
case class VisualisationConfiguration(
|
||||
case class VisualizationConfiguration(
|
||||
executionContextId: ContextId,
|
||||
expression: VisualisationExpression
|
||||
expression: VisualizationExpression
|
||||
) extends ToLogString {
|
||||
|
||||
/** A qualified module name containing the expression. */
|
||||
def visualisationModule: String =
|
||||
def visualizationModule: String =
|
||||
expression.module
|
||||
|
||||
/** @inheritdoc */
|
||||
override def toLogString(shouldMask: Boolean): String =
|
||||
s"VisualisationConfiguration(" +
|
||||
s"VisualizationConfiguration(" +
|
||||
s"executionContextId=$executionContextId," +
|
||||
s"expression=${expression.toLogString(shouldMask)})"
|
||||
}
|
||||
@ -1108,20 +1108,20 @@ object Runtime {
|
||||
")"
|
||||
}
|
||||
|
||||
/** An event signaling a visualisation update.
|
||||
/** An event signaling a visualization update.
|
||||
*
|
||||
* @param visualisationContext a visualisation context
|
||||
* @param data a visualisation data
|
||||
* @param visualizationContext a visualization context
|
||||
* @param data a visualization data
|
||||
*/
|
||||
final case class VisualisationUpdate(
|
||||
visualisationContext: VisualisationContext,
|
||||
final case class VisualizationUpdate(
|
||||
visualizationContext: VisualizationContext,
|
||||
data: Array[Byte]
|
||||
) extends ApiNotification
|
||||
with ToLogString {
|
||||
|
||||
override def toLogString(shouldMask: Boolean): String = {
|
||||
"VisualisationUpdate(" +
|
||||
s"visualisationContext=$visualisationContext,data=" +
|
||||
"VisualizationUpdate(" +
|
||||
s"visualizationContext=$visualizationContext,data=" +
|
||||
(if (shouldMask) STUB else data.toString()) +
|
||||
")"
|
||||
}
|
||||
@ -1320,13 +1320,13 @@ object Runtime {
|
||||
final case class ExecutionComplete(contextId: ContextId)
|
||||
extends ApiNotification
|
||||
|
||||
/** Signals that an expression specified in a [[AttachVisualisation]] or
|
||||
* a [[ModifyVisualisation]] cannot be evaluated.
|
||||
/** Signals that an expression specified in a [[AttachVisualization]] or
|
||||
* a [[ModifyVisualization]] cannot be evaluated.
|
||||
*
|
||||
* @param message the reason of the failure
|
||||
* @param failure the detailed information about the failure
|
||||
*/
|
||||
final case class VisualisationExpressionFailed(
|
||||
final case class VisualizationExpressionFailed(
|
||||
message: String,
|
||||
failure: Option[ExecutionResult.Diagnostic]
|
||||
) extends Error
|
||||
@ -1334,24 +1334,24 @@ object Runtime {
|
||||
|
||||
/** @inheritdoc */
|
||||
override def toLogString(shouldMask: Boolean): String =
|
||||
"VisualisationExpressionFailed(" +
|
||||
"VisualizationExpressionFailed(" +
|
||||
s"message=${MaskedString(message).toLogString(shouldMask)}," +
|
||||
s"failure=${failure.map(_.toLogString(shouldMask))}" +
|
||||
")"
|
||||
}
|
||||
|
||||
/** Signals that an evaluation of a code responsible for generating
|
||||
* visualisation data failed.
|
||||
* visualization data failed.
|
||||
*
|
||||
* @param contextId the context's id.
|
||||
* @param visualisationId the visualisation identifier
|
||||
* @param visualizationId the visualization identifier
|
||||
* @param expressionId the identifier of a visualised expression
|
||||
* @param message the reason of the failure
|
||||
* @param diagnostic the detailed information about the failure
|
||||
*/
|
||||
final case class VisualisationEvaluationFailed(
|
||||
final case class VisualizationEvaluationFailed(
|
||||
contextId: ContextId,
|
||||
visualisationId: VisualisationId,
|
||||
visualizationId: VisualizationId,
|
||||
expressionId: ExpressionId,
|
||||
message: String,
|
||||
diagnostic: Option[ExecutionResult.Diagnostic]
|
||||
@ -1360,17 +1360,17 @@ object Runtime {
|
||||
|
||||
/** @inheritdoc */
|
||||
override def toLogString(shouldMask: Boolean): String =
|
||||
"VisualisationEvaluationFailed(" +
|
||||
"VisualizationEvaluationFailed(" +
|
||||
s"contextId=$contextId," +
|
||||
s"visualisationId=$visualisationId," +
|
||||
s"visualizationId=$visualizationId," +
|
||||
s"expressionId=$expressionId," +
|
||||
s"message=${MaskedString(message).toLogString(shouldMask)}," +
|
||||
s"diagnostic=${diagnostic.map(_.toLogString(shouldMask))}" +
|
||||
")"
|
||||
}
|
||||
|
||||
/** Signals that visualisation cannot be found. */
|
||||
final case class VisualisationNotFound() extends Error
|
||||
/** Signals that visualization cannot be found. */
|
||||
final case class VisualizationNotFound() extends Error
|
||||
|
||||
/** An error response signifying that stack is empty.
|
||||
*
|
||||
@ -1472,74 +1472,74 @@ object Runtime {
|
||||
final case class InitializedNotification() extends ApiResponse
|
||||
|
||||
/** A request sent from the client to the runtime server, to create a new
|
||||
* visualisation for an expression identified by `expressionId`.
|
||||
* visualization for an expression identified by `expressionId`.
|
||||
*
|
||||
* @param visualisationId an identifier of a visualisation
|
||||
* @param visualizationId an identifier of a visualization
|
||||
* @param expressionId an identifier of an expression which is visualised
|
||||
* @param visualisationConfig a configuration object for properties of the
|
||||
* visualisation
|
||||
* @param visualizationConfig a configuration object for properties of the
|
||||
* visualization
|
||||
*/
|
||||
final case class AttachVisualisation(
|
||||
visualisationId: VisualisationId,
|
||||
final case class AttachVisualization(
|
||||
visualizationId: VisualizationId,
|
||||
expressionId: ExpressionId,
|
||||
visualisationConfig: VisualisationConfiguration
|
||||
visualizationConfig: VisualizationConfiguration
|
||||
) extends ApiRequest
|
||||
with ToLogString {
|
||||
|
||||
/** @inheritdoc */
|
||||
override def toLogString(shouldMask: Boolean): String =
|
||||
s"AttachVisualisation(" +
|
||||
s"visualisationId=$visualisationId," +
|
||||
s"expressionId=$expressionId,visualisationConfig=" +
|
||||
visualisationConfig.toLogString(shouldMask) +
|
||||
s"AttachVisualization(" +
|
||||
s"visualizationId=$visualizationId," +
|
||||
s"expressionId=$expressionId,visualizationConfig=" +
|
||||
visualizationConfig.toLogString(shouldMask) +
|
||||
")"
|
||||
}
|
||||
|
||||
/** Signals that attaching a visualisation has succeeded.
|
||||
/** Signals that attaching a visualization has succeeded.
|
||||
*/
|
||||
final case class VisualisationAttached() extends ApiResponse
|
||||
final case class VisualizationAttached() extends ApiResponse
|
||||
|
||||
/** A request sent from the client to the runtime server, to detach a
|
||||
* visualisation from an expression identified by `expressionId`.
|
||||
* visualization from an expression identified by `expressionId`.
|
||||
*
|
||||
* @param contextId an execution context identifier
|
||||
* @param visualisationId an identifier of a visualisation
|
||||
* @param visualizationId an identifier of a visualization
|
||||
* @param expressionId an identifier of an expression which is visualised
|
||||
*/
|
||||
final case class DetachVisualisation(
|
||||
final case class DetachVisualization(
|
||||
contextId: ContextId,
|
||||
visualisationId: VisualisationId,
|
||||
visualizationId: VisualizationId,
|
||||
expressionId: ExpressionId
|
||||
) extends ApiRequest
|
||||
|
||||
/** Signals that detaching a visualisation has succeeded.
|
||||
/** Signals that detaching a visualization has succeeded.
|
||||
*/
|
||||
final case class VisualisationDetached() extends ApiResponse
|
||||
final case class VisualizationDetached() extends ApiResponse
|
||||
|
||||
/** A request sent from the client to the runtime server, to modify a
|
||||
* visualisation identified by `visualisationId`.
|
||||
* visualization identified by `visualizationId`.
|
||||
*
|
||||
* @param visualisationId an identifier of a visualisation
|
||||
* @param visualisationConfig a configuration object for properties of the
|
||||
* visualisation
|
||||
* @param visualizationId an identifier of a visualization
|
||||
* @param visualizationConfig a configuration object for properties of the
|
||||
* visualization
|
||||
*/
|
||||
final case class ModifyVisualisation(
|
||||
visualisationId: VisualisationId,
|
||||
visualisationConfig: VisualisationConfiguration
|
||||
final case class ModifyVisualization(
|
||||
visualizationId: VisualizationId,
|
||||
visualizationConfig: VisualizationConfiguration
|
||||
) extends ToLogString
|
||||
with ApiRequest {
|
||||
|
||||
/** @inheritdoc */
|
||||
override def toLogString(shouldMask: Boolean): String =
|
||||
"ModifyVisualisation(" +
|
||||
s"visualisationId=$visualisationId,visualisationConfig=" +
|
||||
visualisationConfig.toLogString(shouldMask) +
|
||||
"ModifyVisualization(" +
|
||||
s"visualizationId=$visualizationId,visualizationConfig=" +
|
||||
visualizationConfig.toLogString(shouldMask) +
|
||||
")"
|
||||
}
|
||||
|
||||
/** Signals that a visualisation modification has succeeded.
|
||||
/** Signals that a visualization modification has succeeded.
|
||||
*/
|
||||
final case class VisualisationModified() extends ApiResponse
|
||||
final case class VisualizationModified() extends ApiResponse
|
||||
|
||||
/** A request to shut down the runtime server.
|
||||
*/
|
||||
|
@ -213,7 +213,7 @@ object Main {
|
||||
.hasArg(true)
|
||||
.numberOfArgs(1)
|
||||
.argName("data-port")
|
||||
.desc("Data port for visualisation protocol")
|
||||
.desc("Data port for visualization protocol")
|
||||
.build()
|
||||
val uuidOption = CliOption.builder
|
||||
.hasArg(true)
|
||||
|
@ -35,13 +35,13 @@ import java.util.UUID;
|
||||
* method pointers are tracked separately from the expressions state because they have
|
||||
* different invalidation rules. E.g., they should always be re-sent when the execution item
|
||||
* is popped from the stack.
|
||||
* <li>Visualisations state. Tracks the state of visualisation updates.
|
||||
* <li>Visualizations state. Tracks the state of visualization updates.
|
||||
* </ul>
|
||||
*/
|
||||
public class UpdatesSynchronizationState {
|
||||
|
||||
private final Set<UUID> expressionsState = new HashSet<>();
|
||||
private final Set<UUID> visualisationsState = new HashSet<>();
|
||||
private final Set<UUID> visualizationsState = new HashSet<>();
|
||||
private final Set<UUID> methodPointersState = new HashSet<>();
|
||||
|
||||
@Override
|
||||
@ -49,8 +49,8 @@ public class UpdatesSynchronizationState {
|
||||
return "UpdatesSynchronizationState{"
|
||||
+ "expressionsState="
|
||||
+ expressionsState
|
||||
+ ", visualisationsState="
|
||||
+ visualisationsState
|
||||
+ ", visualizationsState="
|
||||
+ visualizationsState
|
||||
+ ", methodPointersState="
|
||||
+ methodPointersState
|
||||
+ '}';
|
||||
@ -64,7 +64,7 @@ public class UpdatesSynchronizationState {
|
||||
public void invalidate(UUID key) {
|
||||
synchronized (this) {
|
||||
expressionsState.remove(key);
|
||||
visualisationsState.remove(key);
|
||||
visualizationsState.remove(key);
|
||||
methodPointersState.remove(key);
|
||||
}
|
||||
}
|
||||
@ -106,40 +106,40 @@ public class UpdatesSynchronizationState {
|
||||
}
|
||||
}
|
||||
|
||||
/* Visualisations */
|
||||
/* Visualizations */
|
||||
|
||||
/**
|
||||
* Checks if the given visualisation update is synchronized.
|
||||
* Checks if the given visualization update is synchronized.
|
||||
*
|
||||
* @param key the expression id.
|
||||
* @return {@code true} if the visualisation update is synchronized.
|
||||
* @return {@code true} if the visualization update is synchronized.
|
||||
*/
|
||||
public boolean isVisualisationSync(UUID key) {
|
||||
synchronized (visualisationsState) {
|
||||
return visualisationsState.contains(key);
|
||||
public boolean isVisualizationSync(UUID key) {
|
||||
synchronized (visualizationsState) {
|
||||
return visualizationsState.contains(key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks the given visualisation update as unsynchronized.
|
||||
* Marks the given visualization update as unsynchronized.
|
||||
*
|
||||
* @param key the expression id.
|
||||
*/
|
||||
@CompilerDirectives.TruffleBoundary
|
||||
public void setVisualisationUnsync(UUID key) {
|
||||
synchronized (visualisationsState) {
|
||||
visualisationsState.remove(key);
|
||||
public void setVisualizationUnsync(UUID key) {
|
||||
synchronized (visualizationsState) {
|
||||
visualizationsState.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks the given visualisation update as synchronized.
|
||||
* Marks the given visualization update as synchronized.
|
||||
*
|
||||
* @param key the expression id.
|
||||
*/
|
||||
public void setVisualisationSync(UUID key) {
|
||||
synchronized (visualisationsState) {
|
||||
visualisationsState.add(key);
|
||||
public void setVisualizationSync(UUID key) {
|
||||
synchronized (visualizationsState) {
|
||||
visualizationsState.add(key);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,36 +125,36 @@ object CacheInvalidation {
|
||||
): Unit =
|
||||
instructions.foreach(run(stack, _))
|
||||
|
||||
/** Run a sequence of invalidation instructions on all visualisations.
|
||||
/** Run a sequence of invalidation instructions on all visualizations.
|
||||
*
|
||||
* @param visualisations the list of available visualisations
|
||||
* @param visualizations the list of available visualizations
|
||||
* @param instructions the list of cache invalidation instructions
|
||||
*/
|
||||
def runAllVisualisations(
|
||||
visualisations: Iterable[Visualisation],
|
||||
def runAllVisualizations(
|
||||
visualizations: Iterable[Visualization],
|
||||
instructions: Iterable[CacheInvalidation]
|
||||
): Unit =
|
||||
instructions.foreach { instruction =>
|
||||
runVisualisations(
|
||||
visualisations,
|
||||
runVisualizations(
|
||||
visualizations,
|
||||
instruction.command,
|
||||
instruction.indexes
|
||||
)
|
||||
}
|
||||
|
||||
/** Run cache invalidation of a multiple visualisations
|
||||
/** Run cache invalidation of a multiple visualizations
|
||||
*
|
||||
* @param visualisations visualisations cache should be invalidated
|
||||
* @param visualizations visualizations cache should be invalidated
|
||||
* @param command the invalidation instruction
|
||||
* @param indexes the list of indexes to invalidate
|
||||
*/
|
||||
def runVisualisations(
|
||||
visualisations: Iterable[Visualisation],
|
||||
def runVisualizations(
|
||||
visualizations: Iterable[Visualization],
|
||||
command: Command,
|
||||
indexes: Set[IndexSelector] = Set()
|
||||
): Unit =
|
||||
visualisations.foreach { visualisation =>
|
||||
run(visualisation.cache, command, indexes)
|
||||
visualizations.foreach { visualization =>
|
||||
run(visualization.cache, command, indexes)
|
||||
}
|
||||
|
||||
/** Run a cache invalidation instruction on an execution stack.
|
||||
|
@ -5,7 +5,7 @@ import org.enso.polyglot.runtime.Runtime.Api.{
|
||||
ContextId,
|
||||
ExpressionId,
|
||||
StackItem,
|
||||
VisualisationId
|
||||
VisualizationId
|
||||
}
|
||||
|
||||
import scala.collection.mutable
|
||||
@ -102,104 +102,104 @@ class ExecutionContextManager {
|
||||
contexts.contains(contextId)
|
||||
}
|
||||
|
||||
/** Upserts a visualisation for the specified context.
|
||||
/** Upserts a visualization for the specified context.
|
||||
*
|
||||
* @param contextId the identifier of the execution context
|
||||
* @param visualisation the visualisation to upsert
|
||||
* @param visualization the visualization to upsert
|
||||
*/
|
||||
def upsertVisualisation(
|
||||
def upsertVisualization(
|
||||
contextId: ContextId,
|
||||
visualisation: Visualisation
|
||||
visualization: Visualization
|
||||
): Unit =
|
||||
synchronized {
|
||||
val state = contexts(contextId)
|
||||
state.visualisations.upsert(visualisation)
|
||||
state.visualizations.upsert(visualization)
|
||||
}
|
||||
|
||||
/** Get visualizations of all execution contexts. */
|
||||
def getAllVisualisations: Iterable[Visualisation] =
|
||||
def getAllVisualizations: Iterable[Visualization] =
|
||||
synchronized {
|
||||
contexts.values.flatMap(_.visualisations.getAll)
|
||||
contexts.values.flatMap(_.visualizations.getAll)
|
||||
}
|
||||
|
||||
/** Get visualisations defined in the module.
|
||||
/** Get visualizations defined in the module.
|
||||
*
|
||||
* @param module the qualified module name
|
||||
* @return the list of matching visualisations
|
||||
* @return the list of matching visualizations
|
||||
*/
|
||||
def getVisualisations(module: QualifiedName): Iterable[Visualisation] =
|
||||
def getVisualizations(module: QualifiedName): Iterable[Visualization] =
|
||||
synchronized {
|
||||
contexts.values.flatMap(_.visualisations.findByModule(module))
|
||||
contexts.values.flatMap(_.visualizations.findByModule(module))
|
||||
}
|
||||
|
||||
/** Returns a visualisation with the provided id.
|
||||
/** Returns a visualization with the provided id.
|
||||
*
|
||||
* @param contextId the identifier of the execution context
|
||||
* @param visualisationId the identifier of visualisation
|
||||
* @return an option with visualisation
|
||||
* @param visualizationId the identifier of visualization
|
||||
* @return an option with visualization
|
||||
*/
|
||||
def getVisualisationById(
|
||||
def getVisualizationById(
|
||||
contextId: ContextId,
|
||||
visualisationId: VisualisationId
|
||||
): Option[Visualisation] =
|
||||
visualizationId: VisualizationId
|
||||
): Option[Visualization] =
|
||||
synchronized {
|
||||
for {
|
||||
state <- contexts.get(contextId)
|
||||
visualisation <- state.visualisations.getById(visualisationId)
|
||||
} yield visualisation
|
||||
visualization <- state.visualizations.getById(visualizationId)
|
||||
} yield visualization
|
||||
}
|
||||
|
||||
/** Finds all visualisations attached to an expression.
|
||||
/** Finds all visualizations attached to an expression.
|
||||
*
|
||||
* @param contextId the identifier of the execution context
|
||||
* @param expressionId the unique identifier of the expression
|
||||
* @return a list of matching visualisation
|
||||
* @return a list of matching visualization
|
||||
*/
|
||||
def findVisualisationForExpression(
|
||||
def findVisualizationForExpression(
|
||||
contextId: ContextId,
|
||||
expressionId: ExpressionId
|
||||
): List[Visualisation] =
|
||||
): List[Visualization] =
|
||||
synchronized {
|
||||
for {
|
||||
state <- contexts.get(contextId).toList
|
||||
visualisation <- state.visualisations.find(expressionId)
|
||||
} yield visualisation
|
||||
visualization <- state.visualizations.find(expressionId)
|
||||
} yield visualization
|
||||
}
|
||||
|
||||
/** Get all visualisations invalidated by the provided list of expressions.
|
||||
/** Get all visualizations invalidated by the provided list of expressions.
|
||||
*
|
||||
* @param module the module containing the visualisations
|
||||
* @param module the module containing the visualizations
|
||||
* @param invalidatedExpressions the list of invalidated expressions
|
||||
* @return a list of matching visualisation
|
||||
* @return a list of matching visualization
|
||||
*/
|
||||
def getInvalidatedVisualisations(
|
||||
def getInvalidatedVisualizations(
|
||||
module: QualifiedName,
|
||||
invalidatedExpressions: Set[ExpressionId]
|
||||
): Iterable[Visualisation] = {
|
||||
): Iterable[Visualization] = {
|
||||
for {
|
||||
state <- contexts.values
|
||||
visualisation <- state.visualisations.findByModule(module)
|
||||
if visualisation.visualisationExpressionId.exists(
|
||||
visualization <- state.visualizations.findByModule(module)
|
||||
if visualization.visualizationExpressionId.exists(
|
||||
invalidatedExpressions.contains
|
||||
)
|
||||
} yield visualisation
|
||||
} yield visualization
|
||||
}
|
||||
|
||||
/** Removes a visualisation from the holder.
|
||||
/** Removes a visualization from the holder.
|
||||
*
|
||||
* @param contextId the identifier of the execution context
|
||||
* @param visualisationId the visualisation identifier
|
||||
* @param expressionId the id of expression that the visualisation is
|
||||
* @param visualizationId the visualization identifier
|
||||
* @param expressionId the id of expression that the visualization is
|
||||
* attached to
|
||||
*/
|
||||
def removeVisualisation(
|
||||
def removeVisualization(
|
||||
contextId: ContextId,
|
||||
expressionId: ExpressionId,
|
||||
visualisationId: VisualisationId
|
||||
visualizationId: VisualizationId
|
||||
): Unit =
|
||||
synchronized {
|
||||
val state = contexts(contextId)
|
||||
state.visualisations.remove(visualisationId, expressionId)
|
||||
state.visualizations.remove(visualizationId, expressionId)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,12 +7,12 @@ import scala.collection.mutable
|
||||
/** Represents a state of an execution context.
|
||||
*
|
||||
* @param stack the current call stack for the execution context
|
||||
* @param visualisations the holder of all visualisations attached to the
|
||||
* @param visualizations the holder of all visualizations attached to the
|
||||
* execution context
|
||||
*/
|
||||
case class ExecutionContextState(
|
||||
stack: mutable.Stack[InstrumentFrame],
|
||||
visualisations: VisualisationHolder
|
||||
visualizations: VisualizationHolder
|
||||
)
|
||||
|
||||
object ExecutionContextState {
|
||||
@ -20,7 +20,7 @@ object ExecutionContextState {
|
||||
/** Returns empty state.
|
||||
*/
|
||||
def empty: ExecutionContextState =
|
||||
ExecutionContextState(mutable.Stack.empty, VisualisationHolder.empty)
|
||||
ExecutionContextState(mutable.Stack.empty, VisualizationHolder.empty)
|
||||
}
|
||||
|
||||
/** Stack frame of the context.
|
||||
|
@ -1,74 +0,0 @@
|
||||
package org.enso.interpreter.instrument
|
||||
|
||||
import org.enso.pkg.QualifiedName
|
||||
import org.enso.polyglot.runtime.Runtime.Api.{ExpressionId, VisualisationId}
|
||||
|
||||
import scala.collection.mutable
|
||||
|
||||
/** A mutable holder of all visualisations attached to an execution context.
|
||||
*/
|
||||
class VisualisationHolder() {
|
||||
|
||||
private val visualisationMap: mutable.Map[ExpressionId, List[Visualisation]] =
|
||||
mutable.Map.empty.withDefaultValue(List.empty)
|
||||
|
||||
/** Upserts a visualisation.
|
||||
*
|
||||
* @param visualisation the visualisation to upsert
|
||||
*/
|
||||
def upsert(visualisation: Visualisation): Unit = {
|
||||
val visualisations = visualisationMap(visualisation.expressionId)
|
||||
val rest = visualisations.filterNot(_.id == visualisation.id)
|
||||
visualisationMap.update(visualisation.expressionId, visualisation :: rest)
|
||||
}
|
||||
|
||||
/** Removes a visualisation from the holder.
|
||||
*
|
||||
* @param visualisationId the visualisation identifier
|
||||
* @param expressionId the id of expression that the visualisation is
|
||||
* attached to
|
||||
*/
|
||||
def remove(
|
||||
visualisationId: VisualisationId,
|
||||
expressionId: ExpressionId
|
||||
): Unit = {
|
||||
val visualisations = visualisationMap(expressionId)
|
||||
val rest = visualisations.filterNot(_.id == visualisationId)
|
||||
visualisationMap.update(expressionId, rest)
|
||||
}
|
||||
|
||||
/** Finds all visualisations attached to an expression.
|
||||
*
|
||||
* @param expressionId the unique identifier of the expression
|
||||
* @return a list of matching visualisation
|
||||
*/
|
||||
def find(expressionId: ExpressionId): List[Visualisation] =
|
||||
visualisationMap(expressionId)
|
||||
|
||||
/** Finds all visualisations in a given module.
|
||||
*
|
||||
* @param module the qualified module name
|
||||
* @return a list of matching visualisation
|
||||
*/
|
||||
def findByModule(module: QualifiedName): Iterable[Visualisation] =
|
||||
visualisationMap.values.flatten.filter(_.module.getName == module)
|
||||
|
||||
/** Returns a visualisation with the provided id.
|
||||
*
|
||||
* @param visualisationId the identifier of visualisation
|
||||
* @return an option with visualisation
|
||||
*/
|
||||
def getById(visualisationId: VisualisationId): Option[Visualisation] =
|
||||
visualisationMap.values.flatten.find(_.id == visualisationId)
|
||||
|
||||
/** @return all available visualisations. */
|
||||
def getAll: Iterable[Visualisation] =
|
||||
visualisationMap.values.flatten
|
||||
}
|
||||
|
||||
object VisualisationHolder {
|
||||
|
||||
/** Returns an empty visualisation holder. */
|
||||
def empty = new VisualisationHolder()
|
||||
|
||||
}
|
@ -3,24 +3,24 @@ package org.enso.interpreter.instrument
|
||||
import org.enso.interpreter.runtime.Module
|
||||
import org.enso.polyglot.runtime.Runtime.Api.{
|
||||
ExpressionId,
|
||||
VisualisationConfiguration,
|
||||
VisualisationId
|
||||
VisualizationConfiguration,
|
||||
VisualizationId
|
||||
}
|
||||
|
||||
/** An object containing visualisation data.
|
||||
/** An object containing visualization data.
|
||||
*
|
||||
* @param id the unique identifier of visualisation
|
||||
* @param expressionId the identifier of expression that the visualisation is
|
||||
* @param id the unique identifier of visualization
|
||||
* @param expressionId the identifier of expression that the visualization is
|
||||
* attached to
|
||||
* @param callback the callable expression used to generate visualisation data
|
||||
* @param callback the callable expression used to generate visualization data
|
||||
*/
|
||||
case class Visualisation(
|
||||
id: VisualisationId,
|
||||
case class Visualization(
|
||||
id: VisualizationId,
|
||||
expressionId: ExpressionId,
|
||||
cache: RuntimeCache,
|
||||
module: Module,
|
||||
config: VisualisationConfiguration,
|
||||
visualisationExpressionId: Option[ExpressionId],
|
||||
config: VisualizationConfiguration,
|
||||
visualizationExpressionId: Option[ExpressionId],
|
||||
callback: AnyRef,
|
||||
arguments: Vector[AnyRef]
|
||||
)
|
@ -0,0 +1,74 @@
|
||||
package org.enso.interpreter.instrument
|
||||
|
||||
import org.enso.pkg.QualifiedName
|
||||
import org.enso.polyglot.runtime.Runtime.Api.{ExpressionId, VisualizationId}
|
||||
|
||||
import scala.collection.mutable
|
||||
|
||||
/** A mutable holder of all visualizations attached to an execution context.
|
||||
*/
|
||||
class VisualizationHolder() {
|
||||
|
||||
private val visualizationMap: mutable.Map[ExpressionId, List[Visualization]] =
|
||||
mutable.Map.empty.withDefaultValue(List.empty)
|
||||
|
||||
/** Upserts a visualization.
|
||||
*
|
||||
* @param visualization the visualization to upsert
|
||||
*/
|
||||
def upsert(visualization: Visualization): Unit = {
|
||||
val visualizations = visualizationMap(visualization.expressionId)
|
||||
val rest = visualizations.filterNot(_.id == visualization.id)
|
||||
visualizationMap.update(visualization.expressionId, visualization :: rest)
|
||||
}
|
||||
|
||||
/** Removes a visualization from the holder.
|
||||
*
|
||||
* @param visualizationId the visualization identifier
|
||||
* @param expressionId the id of expression that the visualization is
|
||||
* attached to
|
||||
*/
|
||||
def remove(
|
||||
visualizationId: VisualizationId,
|
||||
expressionId: ExpressionId
|
||||
): Unit = {
|
||||
val visualizations = visualizationMap(expressionId)
|
||||
val rest = visualizations.filterNot(_.id == visualizationId)
|
||||
visualizationMap.update(expressionId, rest)
|
||||
}
|
||||
|
||||
/** Finds all visualizations attached to an expression.
|
||||
*
|
||||
* @param expressionId the unique identifier of the expression
|
||||
* @return a list of matching visualization
|
||||
*/
|
||||
def find(expressionId: ExpressionId): List[Visualization] =
|
||||
visualizationMap(expressionId)
|
||||
|
||||
/** Finds all visualizations in a given module.
|
||||
*
|
||||
* @param module the qualified module name
|
||||
* @return a list of matching visualization
|
||||
*/
|
||||
def findByModule(module: QualifiedName): Iterable[Visualization] =
|
||||
visualizationMap.values.flatten.filter(_.module.getName == module)
|
||||
|
||||
/** Returns a visualization with the provided id.
|
||||
*
|
||||
* @param visualizationId the identifier of visualization
|
||||
* @return an option with visualization
|
||||
*/
|
||||
def getById(visualizationId: VisualizationId): Option[Visualization] =
|
||||
visualizationMap.values.flatten.find(_.id == visualizationId)
|
||||
|
||||
/** @return all available visualizations. */
|
||||
def getAll: Iterable[Visualization] =
|
||||
visualizationMap.values.flatten
|
||||
}
|
||||
|
||||
object VisualizationHolder {
|
||||
|
||||
/** Returns an empty visualization holder. */
|
||||
def empty = new VisualizationHolder()
|
||||
|
||||
}
|
@ -1,20 +1,20 @@
|
||||
package org.enso.interpreter.instrument.command
|
||||
|
||||
import org.enso.interpreter.instrument.execution.RuntimeContext
|
||||
import org.enso.interpreter.instrument.job.{ExecuteJob, UpsertVisualisationJob}
|
||||
import org.enso.interpreter.instrument.job.{ExecuteJob, UpsertVisualizationJob}
|
||||
import org.enso.polyglot.runtime.Runtime.Api
|
||||
|
||||
import java.util.logging.Level
|
||||
import scala.concurrent.{ExecutionContext, Future}
|
||||
|
||||
/** A command that attaches a visualisation to an expression.
|
||||
/** A command that attaches a visualization to an expression.
|
||||
*
|
||||
* @param maybeRequestId an option with request id
|
||||
* @param request a request for a service
|
||||
*/
|
||||
class AttachVisualisationCmd(
|
||||
class AttachVisualizationCmd(
|
||||
maybeRequestId: Option[Api.RequestId],
|
||||
request: Api.AttachVisualisation
|
||||
request: Api.AttachVisualization
|
||||
) extends AsynchronousCommand(maybeRequestId) {
|
||||
|
||||
/** @inheritdoc */
|
||||
@ -23,11 +23,11 @@ class AttachVisualisationCmd(
|
||||
ec: ExecutionContext
|
||||
): Future[Unit] = {
|
||||
val logger = ctx.executionService.getLogger
|
||||
val contextId = request.visualisationConfig.executionContextId
|
||||
val contextId = request.visualizationConfig.executionContextId
|
||||
val lockTimestamp = ctx.locking.acquireContextLock(contextId)
|
||||
try {
|
||||
if (doesContextExist) {
|
||||
attachVisualisation()
|
||||
attachVisualization()
|
||||
} else {
|
||||
replyWithContextNotExistError()
|
||||
}
|
||||
@ -35,31 +35,31 @@ class AttachVisualisationCmd(
|
||||
ctx.locking.releaseContextLock(contextId)
|
||||
logger.log(
|
||||
Level.FINEST,
|
||||
s"Kept context lock [AttachVisualisationCmd] for ${System.currentTimeMillis() - lockTimestamp} milliseconds"
|
||||
s"Kept context lock [AttachVisualizationCmd] for ${System.currentTimeMillis() - lockTimestamp} milliseconds"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private def doesContextExist(implicit ctx: RuntimeContext): Boolean = {
|
||||
ctx.contextManager.contains(
|
||||
request.visualisationConfig.executionContextId
|
||||
request.visualizationConfig.executionContextId
|
||||
)
|
||||
}
|
||||
|
||||
private def attachVisualisation()(implicit
|
||||
private def attachVisualization()(implicit
|
||||
ctx: RuntimeContext,
|
||||
ec: ExecutionContext
|
||||
): Future[Unit] = {
|
||||
ctx.endpoint.sendToClient(
|
||||
Api.Response(maybeRequestId, Api.VisualisationAttached())
|
||||
Api.Response(maybeRequestId, Api.VisualizationAttached())
|
||||
)
|
||||
val maybeFutureExecutable =
|
||||
ctx.jobProcessor.run(
|
||||
new UpsertVisualisationJob(
|
||||
new UpsertVisualizationJob(
|
||||
maybeRequestId,
|
||||
request.visualisationId,
|
||||
request.visualizationId,
|
||||
request.expressionId,
|
||||
request.visualisationConfig
|
||||
request.visualizationConfig
|
||||
)
|
||||
)
|
||||
|
||||
@ -75,13 +75,13 @@ class AttachVisualisationCmd(
|
||||
): Future[Unit] = {
|
||||
Future {
|
||||
reply(
|
||||
Api.ContextNotExistError(request.visualisationConfig.executionContextId)
|
||||
Api.ContextNotExistError(request.visualizationConfig.executionContextId)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override def toString: String = {
|
||||
"AttachVisualizationCmd(visualizationId: " + request.visualisationId + ",expressionId=" + request.expressionId + ")"
|
||||
"AttachVisualizationCmd(visualizationId: " + request.visualizationId + ",expressionId=" + request.expressionId + ")"
|
||||
}
|
||||
|
||||
}
|
@ -34,14 +34,14 @@ object CommandFactory {
|
||||
case _: Api.GetComponentGroupsRequest =>
|
||||
new GetComponentGroupsCmd(request.requestId)
|
||||
|
||||
case payload: Api.AttachVisualisation =>
|
||||
new AttachVisualisationCmd(request.requestId, payload)
|
||||
case payload: Api.AttachVisualization =>
|
||||
new AttachVisualizationCmd(request.requestId, payload)
|
||||
|
||||
case payload: Api.DetachVisualisation =>
|
||||
new DetachVisualisationCmd(request.requestId, payload)
|
||||
case payload: Api.DetachVisualization =>
|
||||
new DetachVisualizationCmd(request.requestId, payload)
|
||||
|
||||
case payload: Api.ModifyVisualisation =>
|
||||
new ModifyVisualisationCmd(request.requestId, payload)
|
||||
case payload: Api.ModifyVisualization =>
|
||||
new ModifyVisualizationCmd(request.requestId, payload)
|
||||
|
||||
case payload: Api.RenameProject =>
|
||||
new RenameProjectCmd(request.requestId, payload)
|
||||
|
@ -1,21 +1,21 @@
|
||||
package org.enso.interpreter.instrument.command
|
||||
|
||||
import org.enso.interpreter.instrument.execution.RuntimeContext
|
||||
import org.enso.interpreter.instrument.job.DetachVisualisationJob
|
||||
import org.enso.interpreter.instrument.job.DetachVisualizationJob
|
||||
import org.enso.polyglot.runtime.Runtime.Api
|
||||
import org.enso.polyglot.runtime.Runtime.Api.RequestId
|
||||
|
||||
import java.util.logging.Level
|
||||
import scala.concurrent.{ExecutionContext, Future}
|
||||
|
||||
/** A command that detaches a visualisation from the expression.
|
||||
/** A command that detaches a visualization from the expression.
|
||||
*
|
||||
* @param maybeRequestId an option with request id
|
||||
* @param request a request for a service
|
||||
*/
|
||||
class DetachVisualisationCmd(
|
||||
class DetachVisualizationCmd(
|
||||
maybeRequestId: Option[RequestId],
|
||||
request: Api.DetachVisualisation
|
||||
request: Api.DetachVisualization
|
||||
) extends AsynchronousCommand(maybeRequestId) {
|
||||
|
||||
/** @inheritdoc */
|
||||
@ -35,7 +35,7 @@ class DetachVisualisationCmd(
|
||||
ctx.locking.releaseContextLock(request.contextId)
|
||||
logger.log(
|
||||
Level.FINEST,
|
||||
s"Kept context lock [DetachVisualisationCmd] for ${System.currentTimeMillis() - lockTimestamp} milliseconds"
|
||||
s"Kept context lock [DetachVisualizationCmd] for ${System.currentTimeMillis() - lockTimestamp} milliseconds"
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -48,11 +48,11 @@ class DetachVisualisationCmd(
|
||||
ctx: RuntimeContext
|
||||
): Future[Unit] = {
|
||||
ctx.endpoint.sendToClient(
|
||||
Api.Response(maybeRequestId, Api.VisualisationDetached())
|
||||
Api.Response(maybeRequestId, Api.VisualizationDetached())
|
||||
)
|
||||
ctx.jobProcessor.run(
|
||||
new DetachVisualisationJob(
|
||||
request.visualisationId,
|
||||
new DetachVisualizationJob(
|
||||
request.visualizationId,
|
||||
request.expressionId,
|
||||
request.contextId
|
||||
)
|
@ -5,7 +5,7 @@ import org.enso.interpreter.instrument.job.{
|
||||
EnsureCompiledJob,
|
||||
ExecuteJob,
|
||||
Job,
|
||||
UpsertVisualisationJob
|
||||
UpsertVisualizationJob
|
||||
}
|
||||
import org.enso.polyglot.runtime.Runtime.Api
|
||||
import org.enso.polyglot.runtime.Runtime.Api.ExpressionId
|
||||
@ -13,14 +13,14 @@ import org.enso.polyglot.runtime.Runtime.Api.ExpressionId
|
||||
import java.util.logging.Level
|
||||
import scala.concurrent.{ExecutionContext, Future}
|
||||
|
||||
/** A command that modifies a visualisation.
|
||||
/** A command that modifies a visualization.
|
||||
*
|
||||
* @param maybeRequestId an option with request id
|
||||
* @param request a request for a service
|
||||
*/
|
||||
class ModifyVisualisationCmd(
|
||||
class ModifyVisualizationCmd(
|
||||
maybeRequestId: Option[Api.RequestId],
|
||||
request: Api.ModifyVisualisation
|
||||
request: Api.ModifyVisualization
|
||||
) extends AsynchronousCommand(maybeRequestId) {
|
||||
|
||||
/** @inheritdoc */
|
||||
@ -29,11 +29,11 @@ class ModifyVisualisationCmd(
|
||||
ec: ExecutionContext
|
||||
): Future[Unit] = {
|
||||
val logger = ctx.executionService.getLogger
|
||||
val contextId = request.visualisationConfig.executionContextId
|
||||
val contextId = request.visualizationConfig.executionContextId
|
||||
val lockTimestamp = ctx.locking.acquireContextLock(contextId)
|
||||
try {
|
||||
if (doesContextExist) {
|
||||
modifyVisualisation()
|
||||
modifyVisualization()
|
||||
} else {
|
||||
replyWithContextNotExistError()
|
||||
}
|
||||
@ -41,47 +41,47 @@ class ModifyVisualisationCmd(
|
||||
ctx.locking.releaseContextLock(contextId)
|
||||
logger.log(
|
||||
Level.FINEST,
|
||||
s"Kept context lock [UpsertVisualisationJob] for ${System.currentTimeMillis() - lockTimestamp} milliseconds"
|
||||
s"Kept context lock [UpsertVisualizationJob] for ${System.currentTimeMillis() - lockTimestamp} milliseconds"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private def modifyVisualisation()(implicit
|
||||
private def modifyVisualization()(implicit
|
||||
ctx: RuntimeContext,
|
||||
ec: ExecutionContext
|
||||
): Future[Unit] = {
|
||||
val existingVisualisation = ctx.contextManager.getVisualisationById(
|
||||
request.visualisationConfig.executionContextId,
|
||||
request.visualisationId
|
||||
val existingVisualization = ctx.contextManager.getVisualizationById(
|
||||
request.visualizationConfig.executionContextId,
|
||||
request.visualizationId
|
||||
)
|
||||
val visualisationPresent: Option[ExpressionId] =
|
||||
existingVisualisation.map(_.expressionId).orElse {
|
||||
val visualizationPresent: Option[ExpressionId] =
|
||||
existingVisualization.map(_.expressionId).orElse {
|
||||
val jobFilter: PartialFunction[Job[_], Option[ExpressionId]] = {
|
||||
case upsert: UpsertVisualisationJob
|
||||
if upsert.getVisualizationId() == request.visualisationId =>
|
||||
case upsert: UpsertVisualizationJob
|
||||
if upsert.getVisualizationId() == request.visualizationId =>
|
||||
Some(upsert.key)
|
||||
}
|
||||
ctx.jobControlPlane.jobInProgress(jobFilter)
|
||||
}
|
||||
visualisationPresent match {
|
||||
visualizationPresent match {
|
||||
case None =>
|
||||
Future {
|
||||
ctx.endpoint.sendToClient(
|
||||
Api.Response(maybeRequestId, Api.VisualisationNotFound())
|
||||
Api.Response(maybeRequestId, Api.VisualizationNotFound())
|
||||
)
|
||||
}
|
||||
|
||||
case Some(expressionId) =>
|
||||
ctx.endpoint.sendToClient(
|
||||
Api.Response(maybeRequestId, Api.VisualisationModified())
|
||||
Api.Response(maybeRequestId, Api.VisualizationModified())
|
||||
)
|
||||
val maybeFutureExecutable =
|
||||
ctx.jobProcessor.run(
|
||||
new UpsertVisualisationJob(
|
||||
new UpsertVisualizationJob(
|
||||
maybeRequestId,
|
||||
request.visualisationId,
|
||||
request.visualizationId,
|
||||
expressionId,
|
||||
request.visualisationConfig
|
||||
request.visualizationConfig
|
||||
)
|
||||
)
|
||||
maybeFutureExecutable flatMap {
|
||||
@ -101,7 +101,7 @@ class ModifyVisualisationCmd(
|
||||
|
||||
private def doesContextExist(implicit ctx: RuntimeContext): Boolean = {
|
||||
ctx.contextManager.contains(
|
||||
request.visualisationConfig.executionContextId
|
||||
request.visualizationConfig.executionContextId
|
||||
)
|
||||
}
|
||||
|
||||
@ -111,13 +111,13 @@ class ModifyVisualisationCmd(
|
||||
): Future[Unit] = {
|
||||
Future {
|
||||
reply(
|
||||
Api.ContextNotExistError(request.visualisationConfig.executionContextId)
|
||||
Api.ContextNotExistError(request.visualizationConfig.executionContextId)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override def toString: String = {
|
||||
"ModifyVisualisationCmd(visualizationId: " + request.visualisationId + ")"
|
||||
"ModifyVisualizationCmd(visualizationId: " + request.visualizationId + ")"
|
||||
}
|
||||
|
||||
}
|
@ -4,19 +4,19 @@ import org.enso.interpreter.instrument.execution.RuntimeContext
|
||||
import org.enso.polyglot.runtime.Runtime.Api.{
|
||||
ContextId,
|
||||
ExpressionId,
|
||||
VisualisationId
|
||||
VisualizationId
|
||||
}
|
||||
|
||||
import java.util.logging.Level
|
||||
|
||||
/** A job that detaches a visualisation.
|
||||
/** A job that detaches a visualization.
|
||||
*
|
||||
* @param visualisationId an identifier of visualisation
|
||||
* @param visualizationId an identifier of visualization
|
||||
* @param expressionId an identifier of expression
|
||||
* @param contextId an execution context id
|
||||
*/
|
||||
class DetachVisualisationJob(
|
||||
visualisationId: VisualisationId,
|
||||
class DetachVisualizationJob(
|
||||
visualizationId: VisualizationId,
|
||||
expressionId: ExpressionId,
|
||||
contextId: ContextId
|
||||
) extends UniqueJob[Unit](expressionId, List(contextId), false) {
|
||||
@ -26,16 +26,16 @@ class DetachVisualisationJob(
|
||||
val logger = ctx.executionService.getLogger
|
||||
val lockTimestamp = ctx.locking.acquireContextLock(contextId)
|
||||
try {
|
||||
ctx.contextManager.removeVisualisation(
|
||||
ctx.contextManager.removeVisualization(
|
||||
contextId,
|
||||
expressionId,
|
||||
visualisationId
|
||||
visualizationId
|
||||
)
|
||||
} finally {
|
||||
ctx.locking.releaseContextLock(contextId)
|
||||
logger.log(
|
||||
Level.FINEST,
|
||||
s"Kept context lock [DetachVisualisationJob] for ${System.currentTimeMillis() - lockTimestamp} milliseconds"
|
||||
s"Kept context lock [DetachVisualizationJob] for ${System.currentTimeMillis() - lockTimestamp} milliseconds"
|
||||
)
|
||||
}
|
||||
}
|
@ -17,7 +17,7 @@ import org.enso.interpreter.instrument.execution.{
|
||||
import org.enso.interpreter.instrument.{
|
||||
CacheInvalidation,
|
||||
InstrumentFrame,
|
||||
Visualisation
|
||||
Visualization
|
||||
}
|
||||
import org.enso.interpreter.runtime.Module
|
||||
import org.enso.interpreter.service.error.ModuleNotFoundForFileException
|
||||
@ -359,23 +359,23 @@ final class EnsureCompiledJob(protected val files: Iterable[File])
|
||||
CacheInvalidation.runAll(stack, invalidationCommands)
|
||||
}
|
||||
}
|
||||
CacheInvalidation.runAllVisualisations(
|
||||
ctx.contextManager.getVisualisations(module.getName),
|
||||
CacheInvalidation.runAllVisualizations(
|
||||
ctx.contextManager.getVisualizations(module.getName),
|
||||
invalidationCommands
|
||||
)
|
||||
|
||||
val invalidatedVisualisations =
|
||||
ctx.contextManager.getInvalidatedVisualisations(
|
||||
val invalidatedVisualizations =
|
||||
ctx.contextManager.getInvalidatedVisualizations(
|
||||
module.getName,
|
||||
changeset.invalidated
|
||||
)
|
||||
invalidatedVisualisations.foreach { visualisation =>
|
||||
UpsertVisualisationJob.upsertVisualisation(visualisation)
|
||||
invalidatedVisualizations.foreach { visualization =>
|
||||
UpsertVisualizationJob.upsertVisualization(visualization)
|
||||
}
|
||||
if (invalidatedVisualisations.nonEmpty) {
|
||||
if (invalidatedVisualizations.nonEmpty) {
|
||||
ctx.executionService.getLogger.log(
|
||||
Level.FINEST,
|
||||
s"Invalidated visualisations [${invalidatedVisualisations.map(_.id)}]"
|
||||
s"Invalidated visualizations [${invalidatedVisualizations.map(_.id)}]"
|
||||
)
|
||||
}
|
||||
|
||||
@ -450,10 +450,10 @@ final class EnsureCompiledJob(protected val files: Iterable[File])
|
||||
)
|
||||
}
|
||||
}
|
||||
val visualisations = ctx.contextManager.getAllVisualisations
|
||||
visualisations.flatMap(getCacheMetadata).foreach { metadata =>
|
||||
CacheInvalidation.runVisualisations(
|
||||
visualisations,
|
||||
val visualizations = ctx.contextManager.getAllVisualizations
|
||||
visualizations.flatMap(getCacheMetadata).foreach { metadata =>
|
||||
CacheInvalidation.runVisualizations(
|
||||
visualizations,
|
||||
CacheInvalidation.Command.SetMetadata(metadata)
|
||||
)
|
||||
}
|
||||
@ -476,9 +476,9 @@ final class EnsureCompiledJob(protected val files: Iterable[File])
|
||||
}
|
||||
|
||||
private def getCacheMetadata(
|
||||
visualisation: Visualisation
|
||||
visualization: Visualization
|
||||
): Option[CachePreferenceAnalysis.Metadata] = {
|
||||
val module = visualisation.module
|
||||
val module = visualization.module
|
||||
module.getIr.getMetadata(CachePreferenceAnalysis)
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ object ProgramExecutionSupport {
|
||||
if (callStack.isEmpty) {
|
||||
logger.log(Level.FINEST, s"ON_CACHED_VALUE ${value.getExpressionId}")
|
||||
sendExpressionUpdate(contextId, executionFrame.syncState, value)
|
||||
sendVisualisationUpdates(contextId, executionFrame.syncState, value)
|
||||
sendVisualizationUpdates(contextId, executionFrame.syncState, value)
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ object ProgramExecutionSupport {
|
||||
if (callStack.isEmpty) {
|
||||
logger.log(Level.FINEST, s"ON_COMPUTED ${value.getExpressionId}")
|
||||
sendExpressionUpdate(contextId, executionFrame.syncState, value)
|
||||
sendVisualisationUpdates(contextId, executionFrame.syncState, value)
|
||||
sendVisualizationUpdates(contextId, executionFrame.syncState, value)
|
||||
}
|
||||
}
|
||||
|
||||
@ -406,7 +406,7 @@ object ProgramExecutionSupport {
|
||||
}
|
||||
}
|
||||
|
||||
/** Find visualisations for the provided expression value, compute and send
|
||||
/** Find visualizations for the provided expression value, compute and send
|
||||
* the updates.
|
||||
*
|
||||
* @param contextId the identifier of an execution context
|
||||
@ -414,22 +414,22 @@ object ProgramExecutionSupport {
|
||||
* @param ctx the runtime context
|
||||
*/
|
||||
@com.oracle.truffle.api.CompilerDirectives.TruffleBoundary
|
||||
private def sendVisualisationUpdates(
|
||||
private def sendVisualizationUpdates(
|
||||
contextId: ContextId,
|
||||
syncState: UpdatesSynchronizationState,
|
||||
value: ExpressionValue
|
||||
)(implicit ctx: RuntimeContext): Unit = {
|
||||
if (!syncState.isVisualisationSync(value.getExpressionId)) {
|
||||
val visualisations =
|
||||
ctx.contextManager.findVisualisationForExpression(
|
||||
if (!syncState.isVisualizationSync(value.getExpressionId)) {
|
||||
val visualizations =
|
||||
ctx.contextManager.findVisualizationForExpression(
|
||||
contextId,
|
||||
value.getExpressionId
|
||||
)
|
||||
visualisations.foreach { visualisation =>
|
||||
sendVisualisationUpdate(
|
||||
visualizations.foreach { visualization =>
|
||||
sendVisualizationUpdate(
|
||||
contextId,
|
||||
syncState,
|
||||
visualisation,
|
||||
visualization,
|
||||
value.getExpressionId,
|
||||
value.getValue
|
||||
)
|
||||
@ -437,41 +437,41 @@ object ProgramExecutionSupport {
|
||||
}
|
||||
}
|
||||
|
||||
/** Compute the visualisation of the expression value and send an update.
|
||||
/** Compute the visualization of the expression value and send an update.
|
||||
*
|
||||
* @param contextId an identifier of an execution context
|
||||
* @param visualisation the visualisation data
|
||||
* @param visualization the visualization data
|
||||
* @param expressionId the id of expression to visualise
|
||||
* @param expressionValue the value of expression to visualise
|
||||
* @param ctx the runtime context
|
||||
*/
|
||||
def sendVisualisationUpdate(
|
||||
def sendVisualizationUpdate(
|
||||
contextId: ContextId,
|
||||
syncState: UpdatesSynchronizationState,
|
||||
visualisation: Visualisation,
|
||||
visualization: Visualization,
|
||||
expressionId: UUID,
|
||||
expressionValue: AnyRef
|
||||
)(implicit ctx: RuntimeContext): Unit = {
|
||||
val errorOrVisualisationData =
|
||||
val errorOrVisualizationData =
|
||||
Either
|
||||
.catchNonFatal {
|
||||
ctx.executionService.getLogger.log(
|
||||
Level.FINE,
|
||||
s"Executing visualisation ${visualisation.expressionId}"
|
||||
s"Executing visualization ${visualization.expressionId}"
|
||||
)
|
||||
ctx.executionService.callFunctionWithInstrument(
|
||||
visualisation.cache,
|
||||
visualisation.module,
|
||||
visualisation.callback,
|
||||
expressionValue +: visualisation.arguments: _*
|
||||
visualization.cache,
|
||||
visualization.module,
|
||||
visualization.callback,
|
||||
expressionValue +: visualization.arguments: _*
|
||||
)
|
||||
}
|
||||
.flatMap(visualizationResultToBytes)
|
||||
val result = errorOrVisualisationData match {
|
||||
val result = errorOrVisualizationData match {
|
||||
case Left(_: ThreadInterruptedException) =>
|
||||
ctx.executionService.getLogger.log(
|
||||
Level.FINE,
|
||||
s"Visualisation thread interrupted ${visualisation.expressionId}."
|
||||
s"Visualization thread interrupted ${visualization.expressionId}."
|
||||
)
|
||||
Completion.Interrupted
|
||||
|
||||
@ -480,13 +480,13 @@ object ProgramExecutionSupport {
|
||||
Option(error.getMessage).getOrElse(error.getClass.getSimpleName)
|
||||
ctx.executionService.getLogger.log(
|
||||
Level.WARNING,
|
||||
s"Visualisation evaluation failed: $message."
|
||||
s"Visualization evaluation failed: $message."
|
||||
)
|
||||
ctx.endpoint.sendToClient(
|
||||
Api.Response(
|
||||
Api.VisualisationEvaluationFailed(
|
||||
Api.VisualizationEvaluationFailed(
|
||||
contextId,
|
||||
visualisation.id,
|
||||
visualization.id,
|
||||
expressionId,
|
||||
message,
|
||||
getDiagnosticOutcome.lift(error)
|
||||
@ -498,13 +498,13 @@ object ProgramExecutionSupport {
|
||||
case Right(data) =>
|
||||
ctx.executionService.getLogger.log(
|
||||
Level.FINEST,
|
||||
s"Visualisation computed ${visualisation.expressionId}."
|
||||
s"Visualization computed ${visualization.expressionId}."
|
||||
)
|
||||
ctx.endpoint.sendToClient(
|
||||
Api.Response(
|
||||
Api.VisualisationUpdate(
|
||||
Api.VisualisationContext(
|
||||
visualisation.id,
|
||||
Api.VisualizationUpdate(
|
||||
Api.VisualizationContext(
|
||||
visualization.id,
|
||||
contextId,
|
||||
expressionId
|
||||
),
|
||||
@ -515,7 +515,7 @@ object ProgramExecutionSupport {
|
||||
Completion.Done
|
||||
}
|
||||
if (result != Completion.Interrupted) {
|
||||
syncState.setVisualisationSync(expressionId)
|
||||
syncState.setVisualizationSync(expressionId)
|
||||
}
|
||||
}
|
||||
|
||||
@ -527,9 +527,9 @@ object ProgramExecutionSupport {
|
||||
*/
|
||||
private def visualizationResultToBytes(
|
||||
value: AnyRef
|
||||
): Either[VisualisationException, Array[Byte]] = {
|
||||
): Either[VisualizationException, Array[Byte]] = {
|
||||
Option(VisualizationResult.visualizationResultToBytes(value)).toRight(
|
||||
new VisualisationException(
|
||||
new VisualizationException(
|
||||
s"Cannot encode ${value.getClass} to byte array."
|
||||
)
|
||||
)
|
||||
|
@ -8,7 +8,7 @@ import org.enso.compiler.pass.analyse.{
|
||||
DataflowAnalysis
|
||||
}
|
||||
import org.enso.interpreter.instrument.execution.{Executable, RuntimeContext}
|
||||
import org.enso.interpreter.instrument.job.UpsertVisualisationJob.{
|
||||
import org.enso.interpreter.instrument.job.UpsertVisualizationJob.{
|
||||
EvaluationFailed,
|
||||
EvaluationResult,
|
||||
ModuleNotFound
|
||||
@ -17,7 +17,7 @@ import org.enso.interpreter.instrument.{
|
||||
CacheInvalidation,
|
||||
InstrumentFrame,
|
||||
RuntimeCache,
|
||||
Visualisation
|
||||
Visualization
|
||||
}
|
||||
import org.enso.interpreter.runtime.Module
|
||||
import org.enso.interpreter.runtime.control.ThreadInterruptedException
|
||||
@ -27,29 +27,29 @@ import org.enso.polyglot.runtime.Runtime.Api
|
||||
|
||||
import java.util.logging.Level
|
||||
|
||||
/** A job that upserts a visualisation.
|
||||
/** A job that upserts a visualization.
|
||||
*
|
||||
* @param requestId maybe a request id
|
||||
* @param visualisationId an identifier of visualisation
|
||||
* @param visualizationId an identifier of visualization
|
||||
* @param expressionId an identifier of expression
|
||||
* @param config a visualisation config
|
||||
* @param config a visualization config
|
||||
*/
|
||||
class UpsertVisualisationJob(
|
||||
class UpsertVisualizationJob(
|
||||
requestId: Option[Api.RequestId],
|
||||
visualisationId: Api.VisualisationId,
|
||||
visualizationId: Api.VisualizationId,
|
||||
expressionId: Api.ExpressionId,
|
||||
config: Api.VisualisationConfiguration
|
||||
config: Api.VisualizationConfiguration
|
||||
) extends UniqueJob[Option[Executable]](
|
||||
expressionId,
|
||||
List(config.executionContextId),
|
||||
false
|
||||
) {
|
||||
|
||||
/** Return the id of the visualisation associated with this job
|
||||
/** Return the id of the visualization associated with this job
|
||||
*
|
||||
* @return visualisation id
|
||||
* @return visualization id
|
||||
*/
|
||||
def getVisualizationId(): Api.VisualisationId = visualisationId
|
||||
def getVisualizationId(): Api.VisualizationId = visualizationId
|
||||
|
||||
/** @inheritdoc */
|
||||
override def run(implicit ctx: RuntimeContext): Option[Executable] = {
|
||||
@ -58,7 +58,7 @@ class UpsertVisualisationJob(
|
||||
ctx.locking.acquireContextLock(config.executionContextId)
|
||||
try {
|
||||
val maybeCallable =
|
||||
UpsertVisualisationJob.evaluateVisualisationExpression(
|
||||
UpsertVisualizationJob.evaluateVisualizationExpression(
|
||||
config.expression
|
||||
)
|
||||
|
||||
@ -72,9 +72,9 @@ class UpsertVisualisationJob(
|
||||
None
|
||||
|
||||
case Right(EvaluationResult(module, callable, arguments)) =>
|
||||
val visualisation =
|
||||
UpsertVisualisationJob.updateVisualisation(
|
||||
visualisationId,
|
||||
val visualization =
|
||||
UpsertVisualizationJob.updateVisualization(
|
||||
visualizationId,
|
||||
expressionId,
|
||||
module,
|
||||
config,
|
||||
@ -84,16 +84,16 @@ class UpsertVisualisationJob(
|
||||
val stack = ctx.contextManager.getStack(config.executionContextId)
|
||||
val cachedValue = stack.headOption
|
||||
.flatMap(frame => Option(frame.cache.get(expressionId)))
|
||||
UpsertVisualisationJob.requireVisualisationSynchronization(
|
||||
UpsertVisualizationJob.requireVisualizationSynchronization(
|
||||
stack,
|
||||
expressionId
|
||||
)
|
||||
cachedValue match {
|
||||
case Some(value) =>
|
||||
ProgramExecutionSupport.sendVisualisationUpdate(
|
||||
ProgramExecutionSupport.sendVisualizationUpdate(
|
||||
config.executionContextId,
|
||||
stack.headOption.get.syncState,
|
||||
visualisation,
|
||||
visualization,
|
||||
expressionId,
|
||||
value
|
||||
)
|
||||
@ -106,7 +106,7 @@ class UpsertVisualisationJob(
|
||||
ctx.locking.releaseContextLock(config.executionContextId)
|
||||
logger.log(
|
||||
Level.FINEST,
|
||||
s"Kept context lock [UpsertVisualisationJob] for ${System.currentTimeMillis() - lockTimestamp} milliseconds"
|
||||
s"Kept context lock [UpsertVisualizationJob] for ${System.currentTimeMillis() - lockTimestamp} milliseconds"
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -118,7 +118,7 @@ class UpsertVisualisationJob(
|
||||
ctx.endpoint.sendToClient(
|
||||
Api.Response(
|
||||
requestId,
|
||||
Api.VisualisationExpressionFailed(message, executionResult)
|
||||
Api.VisualizationExpressionFailed(message, executionResult)
|
||||
)
|
||||
)
|
||||
}
|
||||
@ -130,7 +130,7 @@ class UpsertVisualisationJob(
|
||||
}
|
||||
}
|
||||
|
||||
object UpsertVisualisationJob {
|
||||
object UpsertVisualizationJob {
|
||||
|
||||
/** The number of times to retry the expression evaluation. */
|
||||
val MaxEvaluationRetryCount: Int = 5
|
||||
@ -168,32 +168,32 @@ object UpsertVisualisationJob {
|
||||
arguments: Vector[AnyRef]
|
||||
)
|
||||
|
||||
/** Upsert the provided visualisation.
|
||||
/** Upsert the provided visualization.
|
||||
*
|
||||
* @param visualisation the visualisation to update
|
||||
* @param visualization the visualization to update
|
||||
* @param ctx the runtime context
|
||||
*/
|
||||
def upsertVisualisation(
|
||||
visualisation: Visualisation
|
||||
def upsertVisualization(
|
||||
visualization: Visualization
|
||||
)(implicit ctx: RuntimeContext, logger: TruffleLogger): Unit = {
|
||||
val visualisationConfig = visualisation.config
|
||||
val expressionId = visualisation.expressionId
|
||||
val visualisationId = visualisation.id
|
||||
val visualizationConfig = visualization.config
|
||||
val expressionId = visualization.expressionId
|
||||
val visualizationId = visualization.id
|
||||
val maybeCallable =
|
||||
evaluateVisualisationExpression(visualisation.config.expression)
|
||||
evaluateVisualizationExpression(visualization.config.expression)
|
||||
|
||||
maybeCallable.foreach { result =>
|
||||
updateVisualisation(
|
||||
visualisationId,
|
||||
updateVisualization(
|
||||
visualizationId,
|
||||
expressionId,
|
||||
result.module,
|
||||
visualisationConfig,
|
||||
visualizationConfig,
|
||||
result.callback,
|
||||
result.arguments
|
||||
)
|
||||
val stack =
|
||||
ctx.contextManager.getStack(visualisationConfig.executionContextId)
|
||||
requireVisualisationSynchronization(stack, expressionId)
|
||||
ctx.contextManager.getStack(visualizationConfig.executionContextId)
|
||||
requireVisualizationSynchronization(stack, expressionId)
|
||||
}
|
||||
}
|
||||
|
||||
@ -213,17 +213,17 @@ object UpsertVisualisationJob {
|
||||
else Left(ModuleNotFound(moduleName))
|
||||
}
|
||||
|
||||
/** Evaluate the visualisation expression in a given module.
|
||||
/** Evaluate the visualization expression in a given module.
|
||||
*
|
||||
* @param module the module where to evaluate the expression
|
||||
* @param expression the visualisation expression
|
||||
* @param expression the visualization expression
|
||||
* @param retryCount the number of attempted retries
|
||||
* @param ctx the runtime context
|
||||
* @return either the evaluation result or an evaluation failure
|
||||
*/
|
||||
private def evaluateModuleExpression(
|
||||
module: Module,
|
||||
expression: Api.VisualisationExpression,
|
||||
expression: Api.VisualizationExpression,
|
||||
retryCount: Int = 0
|
||||
)(implicit
|
||||
ctx: RuntimeContext
|
||||
@ -231,14 +231,14 @@ object UpsertVisualisationJob {
|
||||
Either
|
||||
.catchNonFatal {
|
||||
val (callback, arguments) = expression match {
|
||||
case Api.VisualisationExpression.Text(_, expression) =>
|
||||
case Api.VisualizationExpression.Text(_, expression) =>
|
||||
val callback = ctx.executionService.evaluateExpression(
|
||||
module,
|
||||
expression
|
||||
)
|
||||
val arguments = Vector()
|
||||
(callback, arguments)
|
||||
case Api.VisualisationExpression.ModuleMethod(
|
||||
case Api.VisualizationExpression.ModuleMethod(
|
||||
Api.MethodPointer(_, definedOnType, name),
|
||||
argumentExpressions
|
||||
) =>
|
||||
@ -259,7 +259,7 @@ object UpsertVisualisationJob {
|
||||
if retryCount < MaxEvaluationRetryCount =>
|
||||
ctx.executionService.getLogger.log(
|
||||
Level.FINE,
|
||||
s"Evaluation of visualisation was interrupted. Retrying [${retryCount + 1}]."
|
||||
s"Evaluation of visualization was interrupted. Retrying [${retryCount + 1}]."
|
||||
)
|
||||
evaluateModuleExpression(module, expression, retryCount + 1)
|
||||
|
||||
@ -295,14 +295,14 @@ object UpsertVisualisationJob {
|
||||
)
|
||||
}
|
||||
|
||||
/** Evaluate the visualisation expression.
|
||||
/** Evaluate the visualization expression.
|
||||
*
|
||||
* @param expression the visualisation expression to evaluate
|
||||
* @param expression the visualization expression to evaluate
|
||||
* @param ctx the runtime context
|
||||
* @return either the evaluation result or an evaluation error
|
||||
*/
|
||||
private def evaluateVisualisationExpression(
|
||||
expression: Api.VisualisationExpression
|
||||
private def evaluateVisualizationExpression(
|
||||
expression: Api.VisualizationExpression
|
||||
)(implicit
|
||||
ctx: RuntimeContext
|
||||
): Either[EvaluationFailure, EvaluationResult] = {
|
||||
@ -312,66 +312,66 @@ object UpsertVisualisationJob {
|
||||
} yield expression
|
||||
}
|
||||
|
||||
/** Update the visualisation state.
|
||||
/** Update the visualization state.
|
||||
*
|
||||
* @param visualisationId the visualisation identifier
|
||||
* @param expressionId the expression to which the visualisation is applied
|
||||
* @param module the module containing the visualisation
|
||||
* @param visualisationConfig the visualisation configuration
|
||||
* @param callback the visualisation callback function
|
||||
* @param visualizationId the visualization identifier
|
||||
* @param expressionId the expression to which the visualization is applied
|
||||
* @param module the module containing the visualization
|
||||
* @param visualizationConfig the visualization configuration
|
||||
* @param callback the visualization callback function
|
||||
* @param arguments the list of arugments that will be passed to the callback
|
||||
* @param ctx the runtime context
|
||||
* @return the re-evaluated visualisation
|
||||
* @return the re-evaluated visualization
|
||||
*/
|
||||
private def updateVisualisation(
|
||||
visualisationId: Api.VisualisationId,
|
||||
private def updateVisualization(
|
||||
visualizationId: Api.VisualizationId,
|
||||
expressionId: Api.ExpressionId,
|
||||
module: Module,
|
||||
visualisationConfig: Api.VisualisationConfiguration,
|
||||
visualizationConfig: Api.VisualizationConfiguration,
|
||||
callback: AnyRef,
|
||||
arguments: Vector[AnyRef]
|
||||
)(implicit ctx: RuntimeContext, logger: TruffleLogger): Visualisation = {
|
||||
val visualisationExpressionId =
|
||||
findVisualisationExpressionId(module, visualisationConfig.expression)
|
||||
val visualisation = Visualisation(
|
||||
visualisationId,
|
||||
)(implicit ctx: RuntimeContext, logger: TruffleLogger): Visualization = {
|
||||
val visualizationExpressionId =
|
||||
findVisualizationExpressionId(module, visualizationConfig.expression)
|
||||
val visualization = Visualization(
|
||||
visualizationId,
|
||||
expressionId,
|
||||
new RuntimeCache(),
|
||||
module,
|
||||
visualisationConfig,
|
||||
visualisationExpressionId,
|
||||
visualizationConfig,
|
||||
visualizationExpressionId,
|
||||
callback,
|
||||
arguments
|
||||
)
|
||||
val writeLockTimestamp = ctx.locking.acquireWriteCompilationLock()
|
||||
try {
|
||||
invalidateCaches(visualisation)
|
||||
invalidateCaches(visualization)
|
||||
} finally {
|
||||
ctx.locking.releaseWriteCompilationLock()
|
||||
logger.log(
|
||||
Level.FINEST,
|
||||
s"Kept write compilation lock [UpsertVisualisationJob] for ${System.currentTimeMillis() - writeLockTimestamp} milliseconds"
|
||||
s"Kept write compilation lock [UpsertVisualizationJob] for ${System.currentTimeMillis() - writeLockTimestamp} milliseconds"
|
||||
)
|
||||
}
|
||||
ctx.contextManager.upsertVisualisation(
|
||||
visualisationConfig.executionContextId,
|
||||
visualisation
|
||||
ctx.contextManager.upsertVisualization(
|
||||
visualizationConfig.executionContextId,
|
||||
visualization
|
||||
)
|
||||
visualisation
|
||||
visualization
|
||||
}
|
||||
|
||||
/** Find the expressionId of visualisation function.
|
||||
/** Find the expressionId of visualization function.
|
||||
*
|
||||
* @param module the module environment
|
||||
* @param visualisationExpression the visualisation expression
|
||||
* @return the expression id of required visualisation function
|
||||
* @param visualizationExpression the visualization expression
|
||||
* @return the expression id of required visualization function
|
||||
*/
|
||||
private def findVisualisationExpressionId(
|
||||
private def findVisualizationExpressionId(
|
||||
module: Module,
|
||||
visualisationExpression: Api.VisualisationExpression
|
||||
visualizationExpression: Api.VisualizationExpression
|
||||
): Option[Api.ExpressionId] =
|
||||
visualisationExpression match {
|
||||
case Api.VisualisationExpression.ModuleMethod(methodPointer, _) =>
|
||||
visualizationExpression match {
|
||||
case Api.VisualizationExpression.ModuleMethod(methodPointer, _) =>
|
||||
module.getIr.bindings
|
||||
.collect { case method: IR.Module.Scope.Definition.Method =>
|
||||
val methodReference = method.methodReference
|
||||
@ -390,14 +390,14 @@ object UpsertVisualisationJob {
|
||||
.flatten
|
||||
.headOption
|
||||
|
||||
case _: Api.VisualisationExpression.Text => None
|
||||
case _: Api.VisualizationExpression.Text => None
|
||||
}
|
||||
|
||||
/** Update the caches. */
|
||||
private def invalidateCaches(
|
||||
visualisation: Visualisation
|
||||
visualization: Visualization
|
||||
)(implicit ctx: RuntimeContext): Unit = {
|
||||
setCacheWeights(visualisation)
|
||||
setCacheWeights(visualization)
|
||||
val stacks = ctx.contextManager.getAllContexts.values
|
||||
/* The invalidation of the first cached dependent node is required for
|
||||
* attaching the visualizations to sub-expressions. Consider the example
|
||||
@ -412,8 +412,8 @@ object UpsertVisualisationJob {
|
||||
* visualized expression is a sub-expression and invalidate the first parent
|
||||
* expression accordingly.
|
||||
*/
|
||||
if (!stacks.exists(isExpressionCached(visualisation.expressionId, _))) {
|
||||
invalidateFirstDependent(visualisation.expressionId)
|
||||
if (!stacks.exists(isExpressionCached(visualization.expressionId, _))) {
|
||||
invalidateFirstDependent(visualization.expressionId)
|
||||
}
|
||||
}
|
||||
|
||||
@ -432,15 +432,15 @@ object UpsertVisualisationJob {
|
||||
}
|
||||
}
|
||||
|
||||
/** Set the cache weights for the provided visualisation.
|
||||
/** Set the cache weights for the provided visualization.
|
||||
*
|
||||
* @param visualisation the visualisation to update
|
||||
* @param visualization the visualization to update
|
||||
*/
|
||||
private def setCacheWeights(visualisation: Visualisation): Unit = {
|
||||
visualisation.module.getIr.getMetadata(CachePreferenceAnalysis).foreach {
|
||||
private def setCacheWeights(visualization: Visualization): Unit = {
|
||||
visualization.module.getIr.getMetadata(CachePreferenceAnalysis).foreach {
|
||||
metadata =>
|
||||
CacheInvalidation.runVisualisations(
|
||||
Seq(visualisation),
|
||||
CacheInvalidation.runVisualizations(
|
||||
Seq(visualization),
|
||||
CacheInvalidation.Command.SetMetadata(metadata)
|
||||
)
|
||||
}
|
||||
@ -495,15 +495,15 @@ object UpsertVisualisationJob {
|
||||
}
|
||||
}
|
||||
|
||||
/** Require to send the visualisation update.
|
||||
/** Require to send the visualization update.
|
||||
*
|
||||
* @param stack the execution stack
|
||||
* @param expressionId the expression id to which the visualisation is applied
|
||||
* @param expressionId the expression id to which the visualization is applied
|
||||
*/
|
||||
private def requireVisualisationSynchronization(
|
||||
private def requireVisualizationSynchronization(
|
||||
stack: Iterable[InstrumentFrame],
|
||||
expressionId: Api.ExpressionId
|
||||
): Unit =
|
||||
stack.foreach(_.syncState.setVisualisationUnsync(expressionId))
|
||||
stack.foreach(_.syncState.setVisualizationUnsync(expressionId))
|
||||
|
||||
}
|
@ -264,7 +264,7 @@ public class IdExecutionInstrument extends TruffleInstrument implements IdExecut
|
||||
new ExpressionValue(
|
||||
nodeId, result, resultType, cachedType, call, cachedCall, profilingInfo, false);
|
||||
syncState.setExpressionUnsync(nodeId);
|
||||
syncState.setVisualisationUnsync(nodeId);
|
||||
syncState.setVisualizationUnsync(nodeId);
|
||||
|
||||
// Panics are not cached because a panic can be fixed by changing seemingly unrelated code,
|
||||
// like imports, and the invalidation mechanism can not always track those changes and
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,14 +1,14 @@
|
||||
package org.enso.interpreter.service.error;
|
||||
|
||||
/** Thrown when the execution of the visualisation expression fails. */
|
||||
public class VisualisationException extends RuntimeException implements ServiceException {
|
||||
/** Thrown when the execution of the visualization expression fails. */
|
||||
public class VisualizationException extends RuntimeException implements ServiceException {
|
||||
|
||||
/**
|
||||
* Create new instance of this error.
|
||||
*
|
||||
* @param message the error message.
|
||||
*/
|
||||
public VisualisationException(String message) {
|
||||
public VisualizationException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
@ -220,10 +220,10 @@ impl display::Object for Model {
|
||||
|
||||
|
||||
// ============================
|
||||
// === VisualisationChooser ===
|
||||
// === VisualizationChooser ===
|
||||
// ============================
|
||||
|
||||
/// UI entity that shows a button that opens a list of visualisations that can be selected from.
|
||||
/// UI entity that shows a button that opens a list of visualizations that can be selected from.
|
||||
#[allow(missing_docs)]
|
||||
#[derive(Clone, CloneRef, Debug)]
|
||||
pub struct DropDownMenu {
|
||||
|
@ -232,7 +232,7 @@ impl FlameGraph {
|
||||
&self.marks
|
||||
}
|
||||
|
||||
/// Add an additional activity block to the visualisation.
|
||||
/// Add an additional activity block to the visualization.
|
||||
pub fn add_block<BlockType: IntoThemePath>(
|
||||
&mut self,
|
||||
block: profiler_flame_graph::Block<BlockType>,
|
||||
@ -243,7 +243,7 @@ impl FlameGraph {
|
||||
self.blocks.push(shape);
|
||||
}
|
||||
|
||||
/// Add additional mark to the visualisation.
|
||||
/// Add additional mark to the visualization.
|
||||
pub fn add_mark(&mut self, mark: profiler_flame_graph::Mark) {
|
||||
let mark = align_mark(mark, self.origin_x);
|
||||
let shape = shape_from_mark(mark, &self.app);
|
||||
|
@ -206,9 +206,9 @@ impl display::Object for Model {
|
||||
}
|
||||
}
|
||||
|
||||
/// A visualisation of messages passed between different actors.
|
||||
/// A visualization of messages passed between different actors.
|
||||
///
|
||||
/// This visualisation renders a horizontal line for each actor and shows an arrow for each message.
|
||||
/// This visualization renders a horizontal line for each actor and shows an arrow for each message.
|
||||
/// The arrow will point from the sender of the message to the receive of the message. Hovering
|
||||
/// over a actor line will show the name of the actor as a tooltip, hovering over a message will
|
||||
/// show the name of the message as a tooltip.
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Demo scene showing a sample flame graph. Can be used to display a log file, if you have one.
|
||||
//! To do so, set a query parameter in the url to contain `file=<name _of_log_file>` and it
|
||||
//! will be used for rendering the visualisation. Note that the log file needs to be located in
|
||||
//! will be used for rendering the visualization. Note that the log file needs to be located in
|
||||
//! the assets subdirectory that is served by the webserver, i.e. `enso/dist/content` or
|
||||
//! `app/ide-desktop/lib/content/assets`. If no name is given a file named `profile.json` will
|
||||
//! be loaded by default. If that file is not present, some dummy data will be displayed.
|
||||
|
@ -12,7 +12,7 @@ spec =
|
||||
type_name = Meta.get_qualified_type_name value . to_text
|
||||
type_name . should_equal <| expected_text
|
||||
|
||||
Test.group "Type Names of Visualisation Defaults" <|
|
||||
Test.group "Type Names of Visualization Defaults" <|
|
||||
""" IMPORTANT: When updating this, also update the default values in
|
||||
app/gui/view/graph-editor/src/builtin/visualization/java_script/table.js:18 as this
|
||||
verifies that the type names do not go out of sync. Should be removed once
|
||||
|
@ -3,7 +3,7 @@ from Standard.Visualization import all
|
||||
from Standard.Table import Table
|
||||
|
||||
import Standard.Examples
|
||||
import Standard.Visualization.Table as Table_Visualisation
|
||||
import Standard.Visualization.Table as Table_Visualization
|
||||
import Standard.Visualization.Preprocessor as Preprocessor
|
||||
|
||||
from Standard.Test import Test
|
||||
@ -28,10 +28,10 @@ long_table =
|
||||
|
||||
spec = Test.group "Lazy Table Visualization" <|
|
||||
Test.specify "Fold Map" <|
|
||||
(Table_Visualisation.fold_map 0 (acc -> item -> [acc + item, acc + item]) [1,2,3]).should_equal [1,3,6]
|
||||
(Table_Visualization.fold_map 0 (acc -> item -> [acc + item, acc + item]) [1,2,3]).should_equal [1,3,6]
|
||||
|
||||
Test.specify "Should return correct update" <|
|
||||
update = Table_Visualisation.compute_table_update sample_table [0,0] [0,0] [3,2] 5
|
||||
update = Table_Visualization.compute_table_update sample_table [0,0] [0,0] [3,2] 5
|
||||
update.chunks.contains [[[0,0], [0,0]], "12345"] . should_be_true
|
||||
update.chunks.contains [[[0,0], [1,0]], "6789"] . should_be_true
|
||||
update.chunks.contains [[[0, 1], [0, 0]], "23456"] . should_be_true
|
||||
@ -40,7 +40,7 @@ spec = Test.group "Lazy Table Visualization" <|
|
||||
update.chunks.contains [[[1, 1], [0, 0]], "5"] . should_be_true
|
||||
|
||||
Test.specify "Should return correct update" <|
|
||||
update = Table_Visualisation.compute_table_update sample_table [0,0] [1,0] [3,2] 5
|
||||
update = Table_Visualization.compute_table_update sample_table [0,0] [1,0] [3,2] 5
|
||||
## update.should_equal []
|
||||
update.chunks.contains [[[0,0], [1,0]], "6789"] . should_be_true
|
||||
update.chunks.contains [[[0, 1], [1, 0]], "789"] . should_be_true
|
||||
@ -51,44 +51,44 @@ spec = Test.group "Lazy Table Visualization" <|
|
||||
|
||||
|
||||
Test.specify "Find end column helper should return correct column index" <|
|
||||
(Table_Visualisation.find_end_column sample_table 0 0 1).should_equal 0
|
||||
(Table_Visualisation.find_end_column sample_table 0 2 1).should_equal 0
|
||||
(Table_Visualisation.find_end_column sample_table 0 3 5).should_equal 2
|
||||
(Table_Visualisation.find_end_column sample_table 1 4 5).should_equal 5
|
||||
(Table_Visualisation.find_end_column sample_table 0 9999 5).should_equal 6
|
||||
(Table_Visualization.find_end_column sample_table 0 0 1).should_equal 0
|
||||
(Table_Visualization.find_end_column sample_table 0 2 1).should_equal 0
|
||||
(Table_Visualization.find_end_column sample_table 0 3 5).should_equal 2
|
||||
(Table_Visualization.find_end_column sample_table 1 4 5).should_equal 5
|
||||
(Table_Visualization.find_end_column sample_table 0 9999 5).should_equal 6
|
||||
|
||||
Test.specify "Find end row helper should return correct row index" <|
|
||||
(Table_Visualisation.find_end_row sample_table 1 4).should_equal 2
|
||||
(Table_Visualisation.find_end_row sample_table 0 0).should_equal 0
|
||||
(Table_Visualisation.find_end_row sample_table 1 0).should_equal 1
|
||||
(Table_Visualisation.find_end_row long_table 1 2).should_equal 3
|
||||
(Table_Visualisation.find_end_row long_table 1 1).should_equal 2
|
||||
(Table_Visualisation.find_end_row long_table 50 10).should_equal 60
|
||||
(Table_Visualization.find_end_row sample_table 1 4).should_equal 2
|
||||
(Table_Visualization.find_end_row sample_table 0 0).should_equal 0
|
||||
(Table_Visualization.find_end_row sample_table 1 0).should_equal 1
|
||||
(Table_Visualization.find_end_row long_table 1 2).should_equal 3
|
||||
(Table_Visualization.find_end_row long_table 1 1).should_equal 2
|
||||
(Table_Visualization.find_end_row long_table 50 10).should_equal 60
|
||||
|
||||
|
||||
Test.specify "Get column width helper should return correct colum width" <|
|
||||
(Table_Visualisation.get_column_width (sample_table.columns.at 0)).should_equal 9
|
||||
(Table_Visualisation.get_column_width (sample_table.columns.at 1)).should_equal 1
|
||||
(Table_Visualisation.get_column_width (sample_table.columns.at 3)).should_equal 2
|
||||
(Table_Visualization.get_column_width (sample_table.columns.at 0)).should_equal 9
|
||||
(Table_Visualization.get_column_width (sample_table.columns.at 1)).should_equal 1
|
||||
(Table_Visualization.get_column_width (sample_table.columns.at 3)).should_equal 2
|
||||
|
||||
Test.specify "Get row height helper should return correct row height" <|
|
||||
(Table_Visualisation.get_row_height sample_table 0).should_equal 1
|
||||
(Table_Visualization.get_row_height sample_table 0).should_equal 1
|
||||
|
||||
Test.specify "Get map_to_cumulative_sum helper should return correct result" <|
|
||||
(Table_Visualisation.map_to_cumulative_sum [1,2,3]).should_equal [1,3,6]
|
||||
(Table_Visualisation.map_to_cumulative_sum [1,1,1,1,1,1]).should_equal [1,2,3,4,5,6]
|
||||
(Table_Visualization.map_to_cumulative_sum [1,2,3]).should_equal [1,3,6]
|
||||
(Table_Visualization.map_to_cumulative_sum [1,1,1,1,1,1]).should_equal [1,2,3,4,5,6]
|
||||
|
||||
Test.specify "Get find_first_over_cum_sum helper should return correct result" <|
|
||||
(Table_Visualisation.find_first_over_cum_sum [1,2,3] 2).should_equal 1
|
||||
(Table_Visualisation.find_first_over_cum_sum [1,1,1,1,1,1,1,1] 4).should_equal 4
|
||||
(Table_Visualization.find_first_over_cum_sum [1,2,3] 2).should_equal 1
|
||||
(Table_Visualization.find_first_over_cum_sum [1,1,1,1,1,1,1,1] 4).should_equal 4
|
||||
|
||||
Test.specify "Get enumerate helper should return correct result" <|
|
||||
(Table_Visualisation.enumerate ["A","B","C"]).should_equal [[0, "A"],[1,"B"],[2,"C"]]
|
||||
(Table_Visualization.enumerate ["A","B","C"]).should_equal [[0, "A"],[1,"B"],[2,"C"]]
|
||||
|
||||
Test.specify "get_chunks_for_row helper should return correct result" <|
|
||||
(Table_Visualisation.get_chunks_for_row sample_table 0 0 0 (1.up_to 4) 5 3).should_equal [[[1,0], "4"], [[2,0], "7"], [[3,0], "10"]]
|
||||
(Table_Visualisation.get_chunks_for_row sample_table 0 0 0 (0.up_to 4) 5 3).should_equal [[[0, 0], "12345"], [[0,1], "6789"], [[1,0], "4"]]
|
||||
(Table_Visualization.get_chunks_for_row sample_table 0 0 0 (1.up_to 4) 5 3).should_equal [[[1,0], "4"], [[2,0], "7"], [[3,0], "10"]]
|
||||
(Table_Visualization.get_chunks_for_row sample_table 0 0 0 (0.up_to 4) 5 3).should_equal [[[0, 0], "12345"], [[0,1], "6789"], [[1,0], "4"]]
|
||||
|
||||
Test.specify "compute_vertical_indices helper should return correct result" <|
|
||||
(Table_Visualisation.compute_vertical_indices sample_table 0 2 0 2).should_equal [[0, 0], [1, 0]]
|
||||
(Table_Visualisation.compute_vertical_indices sample_table 0 2 1 2).should_equal [[1, 0], [2, 0]]
|
||||
(Table_Visualization.compute_vertical_indices sample_table 0 2 0 2).should_equal [[0, 0], [1, 0]]
|
||||
(Table_Visualization.compute_vertical_indices sample_table 0 2 1 2).should_equal [[1, 0], [2, 0]]
|
||||
|
@ -3,5 +3,5 @@
|
||||
[org.enso.languageserver.runtime.RuntimeConnector] received handled Request(None,EditFileNotification
|
||||
[enso] Executing command: EditFileCmd...
|
||||
[enso] Job EnsureCompiledJob finished
|
||||
[enso] Visualisation computed
|
||||
[org.enso.languageserver.runtime.ContextRegistry] received handled VisualisationUpdate
|
||||
[enso] Visualization computed
|
||||
[org.enso.languageserver.runtime.ContextRegistry] received handled VisualizationUpdate
|
||||
|
@ -3,5 +3,5 @@
|
||||
[org.enso.languageserver.runtime.RuntimeConnector] received handled Request(None,SetExpressionValueNotification
|
||||
[enso] Executing command: SetExpressionValueCmd
|
||||
[enso] Job EnsureCompiledJob finished
|
||||
[enso] Visualisation computed
|
||||
[org.enso.languageserver.runtime.ContextRegistry] received handled VisualisationUpdate
|
||||
[enso] Visualization computed
|
||||
[org.enso.languageserver.runtime.ContextRegistry] received handled VisualizationUpdate
|
||||
|
@ -57,8 +57,8 @@ avg [min..max] (of 100 records)
|
||||
1ms [0..2] [org.enso.languageserver.runtime.RuntimeConnector] received handled Request(None
|
||||
0ms [0..1] [enso] Executing command: EditFileCmd...
|
||||
14ms [11..24] [enso] Job EnsureCompiledJob finished in 23 ms.
|
||||
1ms [1..9] [enso] Visualisation computed 524dd815-b652-4bbe-b9f2-26b35d17993a.
|
||||
0ms [0..1] [org.enso.languageserver.runtime.ContextRegistry] received handled Visualisation
|
||||
1ms [1..9] [enso] Visualization computed 524dd815-b652-4bbe-b9f2-26b35d17993a.
|
||||
0ms [0..1] [org.enso.languageserver.runtime.ContextRegistry] received handled Visualization
|
||||
0ms [0..1] [main] wstest handled response [<binary>]
|
||||
17ms [15..33] Total
|
||||
```
|
||||
|
@ -4,4 +4,4 @@ t|{"jsonrpc":"2.0","id":3,"method":"text/openBuffer","params":{"path":{"rootId":
|
||||
t|{"jsonrpc":"2.0","id":5,"method":"executionContext/create","params":{"contextId":"1949b079-81e2-46b7-91be-5c5072aaba12"}}
|
||||
t|{ "jsonrpc": "2.0", "method": "text/applyEdit", "id": 7, "params": { "edit": { "path": { "rootId": "6f7d58dd-8ee8-44cf-9ab7-9f0454033641", "segments": [ "src", "V.enso" ] }, "oldVersion": "6b4e03423667dbb73b6e15454f0eb1abd4597f9a1b078e3f5b5a6bc7", "newVersion": "30651038cbc6feac5b3f8e056ef144a133afdfbb5b724ad74106f08f", "edits": [ { "range": { "start": { "line": 0, "character": 0 }, "end": { "line": 0, "character": 0 } }, "text": "to_vis x = x.to_text" } ] } } }
|
||||
t|{"jsonrpc":"2.0","id":9,"method":"executionContext/push","params":{"contextId":"1949b079-81e2-46b7-91be-5c5072aaba12","stackItem":{"methodPointer":{"definedOnType":"local.Unnamed.Main","module":"local.Unnamed.Main","name":"main"},"positionalArgumentsExpressions":[],"thisArgumentExpression":null,"type":"ExplicitCall"}}}
|
||||
b|{ "jsonrpc": "2.0", "method": "executionContext/attachVisualisation", "id": 13, "params": { "visualisationId": "a1cced79-1e4b-47f6-a85d-73f766325372", "expressionId": "524dd815-b652-4bbe-b9f2-26b35d17993a", "visualisationConfig": { "executionContextId": "1949b079-81e2-46b7-91be-5c5072aaba12", "expression": { "module": "local.Unnamed.V", "definedOnType": "local.Unnamed.V", "name": "to_vis" } } } }
|
||||
b|{ "jsonrpc": "2.0", "method": "executionContext/attachVisualization", "id": 13, "params": { "visualizationId": "a1cced79-1e4b-47f6-a85d-73f766325372", "expressionId": "524dd815-b652-4bbe-b9f2-26b35d17993a", "visualizationConfig": { "executionContextId": "1949b079-81e2-46b7-91be-5c5072aaba12", "expression": { "module": "local.Unnamed.V", "definedOnType": "local.Unnamed.V", "name": "to_vis" } } } }
|
||||
|
@ -63,8 +63,8 @@ avg [min..max] (of 150 records)
|
||||
1ms [0..2] [org.enso.languageserver.runtime.RuntimeConnector] received handled Request(None
|
||||
0ms [0..2] [enso] Executing command: SetExpressionValueCmd...
|
||||
5ms [3..16] [enso] Job EnsureCompiledJob finished in 5 ms.
|
||||
1ms [0..9] [enso] Visualisation computed 524dd815-b652-4bbe-b9f2-26b35d17993a.
|
||||
0ms [0..1] [org.enso.languageserver.runtime.ContextRegistry] received handled Visualisation
|
||||
1ms [0..9] [enso] Visualization computed 524dd815-b652-4bbe-b9f2-26b35d17993a.
|
||||
0ms [0..1] [org.enso.languageserver.runtime.ContextRegistry] received handled Visualization
|
||||
1ms [0..1] [main] wstest handled response [<binary>]
|
||||
8ms [7..22] Total
|
||||
```
|
||||
|
@ -2,4 +2,4 @@ t|{ "jsonrpc": "2.0", "method": "session/initProtocolConnection", "id": 0, "para
|
||||
t|{"jsonrpc":"2.0","id":1,"method":"text/openFile","params":{"path":{"rootId":"6f7d58dd-8ee8-44cf-9ab7-9f0454033641","segments":["src","Main.enso"]}}}
|
||||
t|{"jsonrpc":"2.0","id":3,"method":"executionContext/create","params":{"contextId":"1949b079-81e2-46b7-91be-5c5072aaba12"}}
|
||||
t|{"jsonrpc":"2.0","id":5,"method":"executionContext/push","params":{"contextId":"1949b079-81e2-46b7-91be-5c5072aaba12","stackItem":{"methodPointer":{"definedOnType":"local.Unnamed.Main","module":"local.Unnamed.Main","name":"main"},"positionalArgumentsExpressions":[],"thisArgumentExpression":null,"type":"ExplicitCall"}}}
|
||||
b|{"jsonrpc": "2.0", "id": 7, "method": "executionContext/attachVisualisation", "params": { "expressionId": "524dd815-b652-4bbe-b9f2-26b35d17993a", "visualisationConfig": { "executionContextId": "1949b079-81e2-46b7-91be-5c5072aaba12", "expression": "x -> x.to_text", "visualisationModule": "local.Unnamed.Main" }, "visualisationId": "a1cced79-1e4b-47f6-a85d-73f766325372" } }
|
||||
b|{"jsonrpc": "2.0", "id": 7, "method": "executionContext/attachVisualization", "params": { "expressionId": "524dd815-b652-4bbe-b9f2-26b35d17993a", "visualizationConfig": { "executionContextId": "1949b079-81e2-46b7-91be-5c5072aaba12", "expression": "x -> x.to_text", "visualizationModule": "local.Unnamed.Main" }, "visualizationId": "a1cced79-1e4b-47f6-a85d-73f766325372" } }
|
||||
|
Loading…
Reference in New Issue
Block a user