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

feature: public namespace support different formats #3836

Merged
merged 4 commits into from
Aug 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ public AppNamespace createAppNamespaceInLocal(AppNamespace appNamespace, boolean
}

// public namespaces only allow properties format
if (appNamespace.isPublic()) {
appNamespace.setFormat(ConfigFileFormat.Properties.getValue());
}
// if (appNamespace.isPublic()) {
// appNamespace.setFormat(ConfigFileFormat.Properties.getValue());
// }

StringBuilder appNamespaceName = new StringBuilder();
//add prefix postfix
Expand Down
2 changes: 1 addition & 1 deletion apollo-portal/src/main/resources/static/namespace.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
</div>

<!--public namespace can only be properties -->
<div class="col-sm-2" ng-show="!appNamespace.isPublic">
<div class="col-sm-2">
<select class="form-control" name="format" ng-model="appNamespace.format">
<option value="properties">properties</option>
<option value="xml">xml</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ namespace_module.controller("LinkNamespaceController",
};

function shouldAppendNamespacePrefix() {
return $scope.appNamespace.isPublic ? $scope.appendNamespacePrefix : false;
//return $scope.appNamespace.isPublic ? $scope.appendNamespacePrefix : false;
return $scope.appendNamespacePrefix;
}

var selectedClusters = [];
Expand Down Expand Up @@ -150,9 +151,9 @@ namespace_module.controller("LinkNamespaceController",
}

// public namespaces only allow properties format
if ($scope.appNamespace.isPublic) {
$scope.appNamespace.format = 'properties';
}
// if ($scope.appNamespace.isPublic) {
// $scope.appNamespace.format = 'properties';
// }

$scope.submitBtnDisabled = true;
//only append namespace prefix for public app namespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ function directive($window, $translate, toastr, AppUtil, EventManager, Permissio
}

function initLinkedNamespace(namespace) {
if (!namespace.isPublic || !namespace.isLinkedNamespace || namespace.format != 'properties') {
if (!namespace.isPublic || !namespace.isLinkedNamespace) {
return;
}
//load public namespace
Expand Down Expand Up @@ -344,9 +344,15 @@ function directive($window, $translate, toastr, AppUtil, EventManager, Permissio
publicNamespace.hasPublishedItem = true;
}
});

loadParentNamespaceText(namespace);
});
}

function loadParentNamespaceText(namespace){
namespace.publicNamespaceText = "";
if(namespace.isLinkedNamespace) {
namespace.publicNamespaceText = parseModel2Text(namespace.publicNamespace)
}
}

function initNamespaceViewName(namespace) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -713,18 +713,55 @@ <h5>{{'Component.Namespace.Master.Items.Body.NoPublished.Title' | translate }}</
</div>

<!--text view-->

<div class="panel-heading" ng-show="namespace.viewType == 'text' && namespace.isLinkedNamespace">
<div class="row">
<div class="padding-top-5 col-md-4 col-sm-4">
{{'Component.Namespace.Master.Items.Body.Link.Title' | translate }}
</div>
</div>
</div>

<!--只读模式下的文本内容,不替换换行符-->
<div ui-ace="aceConfig" readonly="true" class="form-control no-radius"
rows="{{namespace.itemCnt < 10 ? 10: namespace.itemCnt>20 ? 20:namespace.itemCnt}}"
ng-show="namespace.viewType == 'text' && !namespace.isTextEditing" ng-model="namespace.text">
</div>



<!--编辑状态下的文本内容,会过滤掉换行符-->
<div ui-ace="aceConfig" class="form-control no-radius"
rows="{{namespace.itemCnt < 10 ? 10: namespace.itemCnt>20 ? 20:namespace.itemCnt}}"
ng-show="namespace.viewType == 'text' && namespace.isTextEditing" ng-disabled="!namespace.isTextEditing"
ng-model="namespace.editText">
</div>



<div class="panel-heading" ng-show="namespace.viewType == 'text' && namespace.isLinkedNamespace">
<div class="row">
<div class="padding-top-5 col-md-4 col-sm-4">
{{'Component.Namespace.Master.Items.Body.Public.Title' | translate }}
<a href="{{ '/config.html' | prefixPath }}?#/appid={{namespace.publicNamespace.baseInfo.appId}}&env={{env}}&cluster={{namespace.publicNamespace.baseInfo.clusterName}}"
target="_blank">
<small>
({{'Common.AppId' | translate }}:{{namespace.publicNamespace.baseInfo.appId}},
{{'Common.Cluster' | translate }}:{{namespace.publicNamespace.baseInfo.clusterName}})
</small>
</a>
</div>
</div>
</div>


<!--关联的 Parent Namespace 内容,只读模式,不替换换行符-->
<div ui-ace="aceConfig" readonly="true" class="form-control no-radius"
rows="{{namespace.itemCnt < 10 ? 10: namespace.itemCnt>20 ? 20:namespace.itemCnt}}"
ng-show="namespace.viewType == 'text' && namespace.isLinkedNamespace"
ng-model="namespace.publicNamespaceText">
</div>

<!--history view-->
<div class="J_historyview history-view" ng-show="namespace.viewType == 'history'">
<div class="media" ng-show="namespace.commits && namespace.commits.length"
Expand Down