Skip to content

Commit

Permalink
#1299 schema upload routine outline, backend missing
Browse files Browse the repository at this point in the history
  • Loading branch information
dk1844 committed Jun 16, 2020
1 parent 65dd4c7 commit 1e71722
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
30 changes: 29 additions & 1 deletion menas/ui/components/schema/schemaDetail.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ sap.ui.define([

this._model.setProperty("/topicNameStem", "");
this._model.setProperty("/topicMergeWithKey", false);
console.log(this._model);
},

onEntityUpdated: function (sTopic, sEvent, oData) {
Expand Down Expand Up @@ -168,6 +167,35 @@ sap.ui.define([
}
},

handleTopicSubmit: function (oParams) {
const schema = this._model.getProperty("/currentSchema");
const topicStem = this._model.getProperty("/topicNameStem");
const mergeWithKey = this._model.getProperty("/topicMergeWithKey");


sap.ui.core.BusyIndicator.show();

let data = {
"format": "avro", // the only supported Schema registry type
"topicStem": topicStem,
"mergeWithKey": mergeWithKey,
"name": schema.name,
"version": schema.version
};

jQuery.ajax({
url: "api/schema/topic",
type: 'POST',
data: $.param(data),
contentType: 'application/x-www-form-urlencoded',
context: this, // becomes the result of "this" in handleRemoteLoadComplete
headers: {
'X-CSRF-TOKEN': localStorage.getItem("csrfToken")
},
complete: this.handleRemoteLoadComplete /* todo create a different handler specific to topic load or generalize the routine */
});
},

handleRemoteUrlSubmit: function (oParams) {
if (this.validateSchemaRemoteLoad()) { // marks errors or shows prompt if form not valid
this.submitRemoteUrl();
Expand Down
4 changes: 2 additions & 2 deletions menas/ui/components/schema/schemaDetail.view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
</Input>
<Button text="Submit URL" press="handleRemoteUrlSubmit"/>
</HBox>
<Label text="Load avro schema based on topic-name:" labelFor="topicNameBase"/>
<Label text="Load avro schema based on topic:" labelFor="topicNameBase"/>
<VBox width="35em">
<Input id="topicNameBase" type="Text" placeholder="Enter topic name basis, e.g. myName123"
value="{/topicNameStem}" valueLiveUpdate="true">
Expand All @@ -85,7 +85,7 @@
{path: '/topicMergeWithKey'}
],
formatter: '.topicFormatter'
}" press="handleRemoteUrlSubmit"/> <!-- todo change to a custom processing routine -->
}" press="handleTopicSubmit"/>
</VBox>
</IconTabFilter>
<IconTabFilter id="UsedIn" icon="sap-icon://detail-view" text="Used In">
Expand Down

0 comments on commit 1e71722

Please sign in to comment.