Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New release #185

Merged
merged 8 commits into from
Aug 14, 2023
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# 1.0.0 --installs on--> 2.4 IDE-EE / 3.1 IDE-CE

- [FP-2527 - Preventing the reload of a new doc when it's closed](https://movai.atlassian.net/browse/FP-2527)
- [FP-2216 - IDE- black screen after changing resolution](https://movai.atlassian.net/browse/FP-2216)
- [FP-2542 - Removed code that prevented flow validations from running](https://movai.atlassian.net/browse/FP-2542)
- [FP-2540 - Duplicated code on the new merge request](https://movai.atlassian.net/browse/FP-2540)
Expand Down
4 changes: 2 additions & 2 deletions database/Callback/backend.DataValidation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import re
try:
from dal.scopes import ScopesTree
from dal.models.scopestree import ScopesTree
except ImportError:
from movai.data import ScopesTree

Expand All @@ -21,7 +21,7 @@ def validate_configuration(config_string):

"""
try:
regex = r"^\$\(config \w+(\.\w+)*\)$"
regex = r"^\$\(config [\w-]+(\.[\w-]+)*\)"
matches = re.finditer(regex, config_string, re.MULTILINE)
matches_size = len([x for x in matches])
if matches_size == 0:
Expand Down
28 changes: 28 additions & 0 deletions scripts/import_callback.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#! /bin/bash

robot_name=$1;

if [ -z $robot_name ]
then
echo "ERROR: Robot name is required:"
echo " ./import_callback.sh <robot_name>"
exit 1
fi

backend_container="backend-${robot_name}-movai";
echo "Attempting to enter ${backend_container}";

if [ ! "$(docker ps -q -f name=${backend_container})" ]; then
echo "The container ${backend_container} is not running. Please start your robot and try again."
exit 1
fi

docker cp -a database/ ${backend_container}:/opt/mov.ai/app
docker exec -i ${backend_container} bash <<!
export PYTHONPATH=/opt/mov.ai/app
python3 -m tools.backup -a import -p database/ -r /opt/mov.ai/app/
!


echo "DONE! All callbacks were imported."
exit 0
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const useKeyValueMethods = () => {
whiteSpace: "nowrap",
overflow: "hidden"
},
render: rowData => <span data-testid="output_name">{rowData.name}</span>
render: rowData => <span data-testid="parameteres_output_name">{rowData.name}</span>
},
{
title: t("Value"),
Expand Down
7 changes: 4 additions & 3 deletions src/plugins/DocManager/DocManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ class DocManager extends IDEPlugin {
scope,
onSubmit: async action => {
switch (action) {
case SAVE_OUTDATED_DOC_ACTIONS.UPDATE_DOC:
case SAVE_OUTDATED_DOC_ACTIONS.UPDATE_DOC: {
this.discardDocChanges(modelKey);
const updatedDoc = await this.read(modelKey);

Expand All @@ -229,6 +229,7 @@ class DocManager extends IDEPlugin {

this.saveStack.delete(`${name}_${scope}`);
break;
}
case SAVE_OUTDATED_DOC_ACTIONS.OVERWRITE_DOC:
this.doSave(modelKey, callback, undefined, opts);
break;
Expand Down Expand Up @@ -289,7 +290,7 @@ class DocManager extends IDEPlugin {
});
}

callback && callback(returnMessage);
callback?.(returnMessage);
this.saveStack.delete(`${name}_${scope}`);
return returnMessage;
}
Expand Down Expand Up @@ -424,7 +425,7 @@ class DocManager extends IDEPlugin {
* Remove subscribers
* @param {Event} event
*/
onUnload = _event => {
onUnload = () => {
this.getStores().forEach(store => {
const dirtyDocs = store.getDirties();

Expand Down
24 changes: 17 additions & 7 deletions src/plugins/views/Tabs/hooks/useTabLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const useTabLayout = (props, dockRef) => {
const workspaceManager = useMemo(() => new Workspace(), []);
const activeTabId = useRef(null);
const firstLoad = useRef(true);
const preventReloadNewDoc = useRef(false);
const tabsById = useRef(new Map());
const [layout, setLayout] = useState({ ...DEFAULT_LAYOUT });
const { addTabToStack, removeTabFromStack, getNextTabFromStack } =
Expand Down Expand Up @@ -198,8 +199,9 @@ const useTabLayout = (props, dockRef) => {
const newLayout = { ...prevLayout };
const box = _getTabContainer(newLayout[location], prevTabId);
if (box) {
tabData.id = `${tabData.id.substring(0, tabData.id.lastIndexOf("/"))}/${tabData.name
}`;
tabData.id = `${tabData.id.substring(0, tabData.id.lastIndexOf("/"))}/${
tabData.name
}`;
const tabIndex = box.tabs.findIndex(_el => _el.id === prevTabId);
box.tabs[tabIndex] = tabData;
box.activeId = tabData.id;
Expand Down Expand Up @@ -305,6 +307,7 @@ const useTabLayout = (props, dockRef) => {
name,
scope,
onSubmit: action => {
preventReloadNewDoc.current = true;
const triggerAction = {
// Save changes and close document
save: () => _saveDoc(document),
Expand Down Expand Up @@ -460,7 +463,10 @@ const useTabLayout = (props, dockRef) => {
if (!docFactory) return docData;
return installTabPlugin(docFactory, docData)
.then(viewPlugin => {
const Decorated = withError(() => viewPlugin.render(docFactory.props ?? {}), dependencies);
const Decorated = withError(
() => viewPlugin.render(docFactory.props ?? {}),
dependencies
);

// Create and return tab data
const extension = docFactory.store.model.EXTENSION ?? "";
Expand Down Expand Up @@ -773,10 +779,14 @@ const useTabLayout = (props, dockRef) => {

updateTabId(doc.path.replace(`/${doc.version}`, ""), newTabData);

call(PLUGINS.DOC_MANAGER.NAME, PLUGINS.DOC_MANAGER.CALL.RELOAD_DOC, {
scope,
name
});
if (!preventReloadNewDoc.current) {
call(PLUGINS.DOC_MANAGER.NAME, PLUGINS.DOC_MANAGER.CALL.RELOAD_DOC, {
scope,
name
});
}

preventReloadNewDoc.current = false;
}
});
// Unsubscribe on unmount
Expand Down
Loading