Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
a00b5547
Commit
a00b5547
authored
Jun 12, 2014
by
Romain Courteaud
🐙
Committed by
Jérome Perrin
Aug 11, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate run knowledge extraction button.
parent
4309aa4a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
107 additions
and
69 deletions
+107
-69
dream/platform/__init__.py
dream/platform/__init__.py
+1
-1
dream/platform/src/index.html
dream/platform/src/index.html
+0
-3
dream/platform/src/src/dream.js
dream/platform/src/src/dream.js
+0
-18
dream/platform/src/src/dream_launcher.js
dream/platform/src/src/dream_launcher.js
+0
-19
dream/platform/src2/dream/manage_document.html
dream/platform/src2/dream/manage_document.html
+5
-0
dream/platform/src2/dream/manage_document.js
dream/platform/src2/dream/manage_document.js
+101
-28
No files found.
dream/platform/__init__.py
View file @
a00b5547
...
...
@@ -152,7 +152,7 @@ def getConfigurationDict():
@
app
.
route
(
"/runKnowledgeExtraction"
,
methods
=
[
"POST"
,
"OPTIONS"
])
def
runKnowledgeExtraction
():
parameter_dict
=
request
.
json
[
'json'
]
parameter_dict
=
request
.
json
try
:
timeout
=
int
(
parameter_dict
[
'general'
][
'processTimeout'
])
except
(
KeyError
,
ValueError
,
TypeError
):
...
...
dream/platform/src/index.html
View file @
a00b5547
...
...
@@ -27,9 +27,6 @@
<a
id=
"layout_graph"
><i
class=
"fa fa-sitemap"
></i>
Layout Graph
</a>
<a
id=
"zoom_in"
><i
class=
"fa fa-plus"
></i>
Zoom +
</a>
<a
id=
"zoom_out"
><i
class=
"fa fa-minus"
></i>
Zoom -
</a>
<a
id=
"run_knowledge_extraction"
>
<i
class=
"fa fa-spinner fa-spin"
id=
"ke_loading_spinner"
style=
"display:none"
></i>
Run Knowledge Extraction
</a>
</div>
</div>
...
...
dream/platform/src/src/dream.js
View file @
a00b5547
...
...
@@ -322,24 +322,6 @@
that
.
setGeneralProperties
(
properties
);
}
/** Runs the knowledge extraction, and call the callback with results once the
* KE is finished.
*/
that
.
runKnowledgeExtraction
=
function
(
callback
)
{
that
.
readGeneralPropertiesDialog
()
$
.
ajax
(
'
../runKnowledgeExtraction
'
,
{
data
:
JSON
.
stringify
({
json
:
that
.
getData
()
}),
contentType
:
'
application/json
'
,
type
:
'
POST
'
,
success
:
function
(
data
,
textStatus
,
jqXHR
)
{
callback
(
data
);
}
});
};
that
.
displayResult
=
function
(
idx
,
result
)
{
// the list of available widgets, in the same order that in html
var
available_widget_list
=
[
...
...
dream/platform/src/src/dream_launcher.js
View file @
a00b5547
...
...
@@ -159,25 +159,6 @@
});
});
// Enable "Run Knowledge Extraction" button
$
(
"
#run_knowledge_extraction
"
).
button
().
click
(
function
(
e
)
{
$
(
"
#ke_loading_spinner
"
).
show
();
$
(
"
#run_knowledge_extraction
"
).
button
(
'
disable
'
);
$
(
'
#error
'
).
empty
();
dream_instance
.
runKnowledgeExtraction
(
function
(
data
)
{
$
(
"
#ke_loading_spinner
"
).
hide
();
$
(
"
#run_knowledge_extraction
"
).
button
(
'
enable
'
);
if
(
data
[
'
success
'
])
{
loadData
(
data
.
data
);
}
else
{
$
(
"
#error
"
).
text
(
data
[
"
error
"
]).
show
().
effect
(
'
shake
'
,
50
);
console
.
error
(
data
[
'
error
'
])
}
});
});
// // Enable "Run Simulation" button
// $("#run_simulation").button().click(
// function (e) {
...
...
dream/platform/src2/dream/manage_document.html
View file @
a00b5547
...
...
@@ -6,12 +6,17 @@
<title>
Manage document
</title>
<script
src=
"../<%= copy.rsvp.relative_dest %>"
type=
"text/javascript"
></script>
<script
src=
"../<%= copy.renderjs.relative_dest %>"
type=
"text/javascript"
></script>
<script
src=
"../<%= curl.jquery.relative_dest %>"
type=
"text/javascript"
></script>
<script
src=
"../<%= curl.jquerymobilejs.relative_dest %>"
type=
"text/javascript"
></script>
<script
src=
"document_page_mixin.js"
type=
"text/javascript"
></script>
<script
src=
"manage_document.js"
type=
"text/javascript"
></script>
</head>
<body>
<a
class=
"export_link ui-btn ui-btn-inline ui-icon-action ui-btn-icon-right"
>
Export
</a>
<form
class=
"knowledge_form"
>
<button
type=
"submit"
class=
"ui-btn ui-btn-b ui-btn-inline ui-icon-refresh ui-btn-icon-right"
>
Run Knowledge Extraction
</button>
</form>
<form
class=
"delete_form"
>
<button
type=
"submit"
class=
"ui-btn ui-btn-b ui-btn-inline ui-icon-delete ui-btn-icon-right"
>
Delete
</button>
</form>
...
...
dream/platform/src2/dream/manage_document.js
View file @
a00b5547
/*global console, rJS, RSVP, initDocumentPageMixin */
(
function
(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
)
{
/*global console, rJS, RSVP, initDocumentPageMixin
, jQuery
*/
(
function
(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
,
$
)
{
"
use strict
"
;
function
datatouri
(
data
,
mime_type
)
{
...
...
@@ -35,6 +35,96 @@
return
new
RSVP
.
Promise
(
resolver
,
canceller
);
}
function
disableAllButtons
(
gadget
)
{
// Prevent double click
var
i
,
button_list
=
gadget
.
props
.
element
.
getElementsByClassName
(
"
ui-btn
"
);
for
(
i
=
0
;
i
<
button_list
.
length
;
i
+=
1
)
{
button_list
[
i
].
disabled
=
true
;
}
}
function
waitForKnowledgeExtraction
(
gadget
)
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
promiseEventListener
(
gadget
.
props
.
element
.
getElementsByClassName
(
"
knowledge_form
"
)[
0
],
'
submit
'
,
false
);
})
.
push
(
function
()
{
disableAllButtons
(
gadget
);
return
gadget
.
aq_getAttachment
({
"
_id
"
:
gadget
.
props
.
jio_key
,
"
_attachment
"
:
"
body.json
"
});
})
.
push
(
function
(
body_json
)
{
$
.
mobile
.
loading
(
'
show
'
);
// XXX Hardcoded relative URL
return
gadget
.
aq_ajax
({
url
:
"
../../runKnowledgeExtraction
"
,
type
:
"
POST
"
,
data
:
body_json
,
headers
:
{
"
Content-Type
"
:
'
application/json
'
}
});
})
.
push
(
undefined
,
function
(
error
)
{
// Always drop the loader
$
.
mobile
.
loading
(
'
hide
'
);
throw
error
;
})
.
push
(
function
(
evt
)
{
$
.
mobile
.
loading
(
'
hide
'
);
var
json_data
=
JSON
.
parse
(
evt
.
target
.
responseText
);
if
(
json_data
.
success
!==
true
)
{
throw
new
Error
(
json_data
.
error
);
}
return
gadget
.
aq_putAttachment
({
"
_id
"
:
gadget
.
props
.
jio_key
,
"
_attachment
"
:
"
body.json
"
,
"
_data
"
:
JSON
.
stringify
(
json_data
.
data
,
null
,
2
),
"
_mimetype
"
:
"
application/json
"
});
})
.
push
(
function
()
{
return
gadget
.
whoWantToDisplayThisDocument
(
gadget
.
props
.
jio_key
);
})
.
push
(
function
(
url
)
{
return
gadget
.
pleaseRedirectMyHash
(
url
);
});
}
function
waitForDeletion
(
gadget
)
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
promiseEventListener
(
gadget
.
props
.
element
.
getElementsByClassName
(
"
delete_form
"
)[
0
],
'
submit
'
,
false
);
})
.
push
(
function
()
{
disableAllButtons
(
gadget
);
// Delete jIO document
return
gadget
.
aq_remove
({
"
_id
"
:
gadget
.
props
.
jio_key
});
})
.
push
(
function
(
result
)
{
return
gadget
.
whoWantToDisplayHome
();
})
.
push
(
function
(
url
)
{
return
gadget
.
pleaseRedirectMyHash
(
url
);
});
}
var
gadget_klass
=
rJS
(
window
);
initDocumentPageMixin
(
gadget_klass
);
gadget_klass
...
...
@@ -59,8 +149,12 @@
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
aq_remove
"
,
"
jio_remove
"
)
.
declareAcquiredMethod
(
"
aq_getAttachment
"
,
"
jio_getAttachment
"
)
.
declareAcquiredMethod
(
"
aq_putAttachment
"
,
"
jio_putAttachment
"
)
.
declareAcquiredMethod
(
"
aq_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
aq_ajax
"
,
"
jio_ajax
"
)
.
declareAcquiredMethod
(
"
pleaseRedirectMyHash
"
,
"
pleaseRedirectMyHash
"
)
.
declareAcquiredMethod
(
"
whoWantToDisplayThisDocument
"
,
"
whoWantToDisplayThisDocument
"
)
.
declareAcquiredMethod
(
"
whoWantToDisplayHome
"
,
"
whoWantToDisplayHome
"
)
...
...
@@ -92,30 +186,9 @@
})
.
declareMethod
(
"
startService
"
,
function
()
{
var
gadget
=
this
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
promiseEventListener
(
gadget
.
props
.
element
.
getElementsByClassName
(
"
delete_form
"
)[
0
],
'
submit
'
,
false
);
})
.
push
(
function
()
{
// Prevent double click
gadget
.
props
.
element
.
getElementsByClassName
(
"
ui-btn
"
)[
0
].
disabled
=
true
;
// Delete jIO document
return
gadget
.
aq_remove
({
"
_id
"
:
gadget
.
props
.
jio_key
});
})
.
push
(
function
(
result
)
{
return
gadget
.
whoWantToDisplayHome
();
})
.
push
(
function
(
url
)
{
return
gadget
.
pleaseRedirectMyHash
(
url
);
});
return
RSVP
.
all
([
waitForDeletion
(
this
),
waitForKnowledgeExtraction
(
this
)
]);
});
}(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
));
}(
window
,
rJS
,
RSVP
,
initDocumentPageMixin
,
jQuery
));
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment