Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
rjs_json_form
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
rjs_json_form
Commits
410e9239
Commit
410e9239
authored
Apr 05, 2019
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make getContent work while render
parent
4da4734f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
52 deletions
+36
-52
demo/xmla_connection/index.js
demo/xmla_connection/index.js
+7
-16
demo/xmla_connection/wizard.js
demo/xmla_connection/wizard.js
+16
-34
jsonform.gadget.js
jsonform.gadget.js
+13
-2
No files found.
demo/xmla_connection/index.js
View file @
410e9239
...
...
@@ -239,19 +239,15 @@
})
.
declareMethod
(
"
render
"
,
function
(
opt
)
{
var
gadget
=
this
;
gadget
.
props
.
init_value
=
opt
.
value
;
return
gadget
.
getDeclaredGadget
(
"
xmla_settings
"
)
.
push
(
function
(
g
)
{
return
g
.
render
(
opt
);
})
.
push
(
function
()
{
delete
gadget
.
props
.
init_value
;
});
})
.
declareMethod
(
"
getContent
"
,
function
()
{
.
declareMethod
(
"
getContent
"
,
function
(
sub_path
)
{
return
this
.
getDeclaredGadget
(
"
xmla_settings
"
)
.
push
(
function
(
g
)
{
return
g
.
getContent
();
return
g
.
getContent
(
sub_path
);
});
})
.
declareAcquiredMethod
(
"
notifyChange
"
,
"
notifyChange
"
)
...
...
@@ -318,18 +314,13 @@
return
print_content
(
g
);
})
.
allowPublicAcquisition
(
"
resolveExternalReference
"
,
function
(
arr
)
{
var
g
=
this
,
url
=
arr
[
0
],
var
url
=
arr
[
0
],
schema_path
=
arr
[
1
],
path
=
arr
[
2
];
path
=
arr
[
2
],
connection_path
=
path
.
split
(
'
/
'
).
slice
(
0
,
-
1
).
join
(
'
/
'
);
if
(
"
urn:jio:properties_from_xmla.connection.json
"
===
url
)
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
var
connection_path
=
path
.
split
(
'
/
'
).
slice
(
0
,
-
1
).
join
(
'
/
'
),
settings
;
if
(
g
.
props
.
init_value
)
{
settings
=
convertOnMultiLevel
(
g
.
props
.
init_value
,
connection_path
);
}
return
this
.
getContent
(
connection_path
)
.
push
(
function
(
settings
)
{
return
generateSchema
(
settings
);
});
}
...
...
demo/xmla_connection/wizard.js
View file @
410e9239
...
...
@@ -29,19 +29,7 @@
}
function
get_used_dimensions
(
g
)
{
var
q
;
if
(
g
.
props
.
init_value
)
{
q
=
RSVP
.
Queue
()
.
push
(
function
()
{
return
g
.
props
.
init_value
;
});
}
else
{
q
=
g
.
getDeclaredGadget
(
"
olap_wizard
"
)
.
push
(
function
(
gadget
)
{
return
gadget
.
getContent
();
});
}
return
q
return
g
.
getContent
()
.
push
(
function
(
v
)
{
var
dimensions
=
[],
key
,
...
...
@@ -335,19 +323,12 @@
.
allowPublicAcquisition
(
"
notifyInvalid
"
,
function
(
arr
,
scope
)
{
})
.
declareMethod
(
"
render
"
,
function
(
opt
)
{
var
g
=
this
;
g
.
props
.
init_value
=
opt
.
value
;
return
get_used_dimensions
(
g
)
.
push
(
function
(
v
)
{
g
.
props
.
used_dimensions
=
v
;
return
g
.
getDeclaredGadget
(
"
olap_wizard
"
);
})
if
(
!
opt
)
{
opt
=
{};
}
return
this
.
getDeclaredGadget
(
"
olap_wizard
"
)
.
push
(
function
(
gadget
)
{
return
gadget
.
render
(
opt
);
})
.
push
(
function
()
{
delete
g
.
props
.
init_value
;
delete
g
.
props
.
used_dimensions
;
});
})
.
declareMethod
(
"
getContent
"
,
function
(
path
)
{
...
...
@@ -494,20 +475,21 @@
if
(
"
urn:jio:choice.json
"
===
url
)
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
getConnections
();
return
RSVP
.
all
([
g
.
getRemoteSettings
(),
g
.
getContent
(
"
/connection_name
"
),
g
.
getContent
(
path
),
get_used_dimensions
(
g
)
]);
})
.
push
(
function
(
connections
)
{
.
push
(
function
(
arr
)
{
var
connection_settings
,
choice_settings
;
if
(
g
.
props
.
init_value
)
{
connection_settings
=
connections
[
convertOnMultiLevel
(
g
.
props
.
init_value
,
"
/connection_name
"
)];
if
(
path
!==
"
/columns/
"
&&
path
!==
"
/rows/
"
)
{
choice_settings
=
convertOnMultiLevel
(
g
.
props
.
init_value
,
path
);
}
return
generateChoiceSchema
(
connection_settings
,
g
.
props
.
used_dimensions
,
choice_settings
);
connection_settings
=
arr
[
0
][
arr
[
1
]];
if
(
path
!==
"
/columns/
"
&&
path
!==
"
/rows/
"
)
{
choice_settings
=
arr
[
2
];
}
return
{}
;
return
generateChoiceSchema
(
connection_settings
,
arr
[
3
],
choice_settings
)
;
});
}
throw
new
Error
(
"
urn: '
"
+
url
+
"
' not supported
"
);
...
...
jsonform.gadget.js
View file @
410e9239
...
...
@@ -898,6 +898,7 @@
if
(
json_document
!==
undefined
)
{
json_document
=
JSON
.
parse
(
json_document
);
}
g
.
props
.
init_value
=
json_document
;
if
(
g
.
state
.
schema
!==
undefined
)
{
schema
=
JSON
.
parse
(
g
.
state
.
schema
);
}
...
...
@@ -988,6 +989,7 @@
if
(
g
.
props
.
form_gadget
.
props
.
changed
.
length
>
0
)
{
g
.
notifyChange
();
}
delete
g
.
props
.
init_value
;
})
.
push
(
undefined
,
function
(
err
)
{
console
.
error
(
err
);
...
...
@@ -1045,10 +1047,19 @@
return
expandSchemaForField
(
this
,
arr
[
0
],
arr
[
1
],
arr
[
2
],
arr
[
3
]);
})
.
declareMethod
(
'
getContentMutex
'
,
function
()
{
return
this
.
props
.
form_gadget
.
getContent
();
},
{
mutex
:
'
changestate
'
})
.
declareMethod
(
'
getContent
'
,
function
(
sub_path
)
{
var
g
=
this
;
if
(
g
.
state
.
editable
)
{
return
g
.
props
.
form_gadget
.
getContent
()
return
RSVP
.
Queue
()
.
push
(
function
()
{
if
(
g
.
props
.
init_value
)
{
return
g
.
props
.
init_value
;
}
return
g
.
getContentMutex
();
})
.
push
(
function
(
value
)
{
// Change the value state in place
// This will prevent the gadget to be changed if
...
...
@@ -1068,6 +1079,6 @@
});
}
return
{};
}
,
{
mutex
:
'
changestate
'
}
);
});
}(
window
,
document
,
Blob
,
rJS
,
RSVP
,
jIO
));
\ No newline at end of file
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