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

fix: Fixed overwrite JSON type configuration being empty #4486

Merged
merged 14 commits into from
Jul 30, 2022
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ Apollo 2.1.0
* [Optimize performance of '/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces' interface queries](https://github.com/apolloconfig/apollo/pull/4473)
* [Add a new API to load items with pagination](https://github.com/apolloconfig/apollo/pull/4468)
* [fix(#4474):'openjdk:8-jre-alpine' potentially causing wrong number of cpu cores](https://github.com/apolloconfig/apollo/pull/4475)

* [fix(#4483):Fixed overwrite JSON type configuration being empty](https://github.com/apolloconfig/apollo/pull/4486)
------------------
All issues and pull requests are [here](https://github.com/apolloconfig/apollo/milestone/11?closed=1)
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,7 @@ function directive($window, $translate, toastr, AppUtil, EventManager, Permissio
}

function modifyByText(namespace) {

var model = {
configText: namespace.editText,
namespaceId: namespace.baseInfo.id,
Expand Down Expand Up @@ -816,7 +817,6 @@ function directive($window, $translate, toastr, AppUtil, EventManager, Permissio
}

function parseModel2Text(namespace) {

if (namespace.items.length == 0) {
namespace.itemCnt = 0;
return "";
Expand Down Expand Up @@ -987,6 +987,20 @@ function directive($window, $translate, toastr, AppUtil, EventManager, Permissio
minLines: 10,
maxLines: 20
})
},
onChange: function (e) {
if ((e[0].action === 'insert') && (scope.namespace.hasOwnProperty("editText")) && (scope.namespace.editText.length === 0)) {
let text = ''
for (let i = 0; i < e[0].lines.length; i++) {
if (i === 0) {
text = e[0].lines[0]
} else {
text += '\r\n' + e[0].lines[i]
}
}
scope.namespace.editText = text
}

}
};

Expand Down