Skip to content

Commit

Permalink
Support grayscale feature for non-properties namespaces(#4316) (#4952)
Browse files Browse the repository at this point in the history
* Support grayscale feature for non-properties namespaces(#4316)

* Update the display style of the popup(#4316)

* Modify the code style(#4316)

* add modal to compare differences

* add button

* add comparison function

* update code style

* update code style

* Support grayscale feature for non-properties namespaces(#4316)

* Support grayscale feature for non-properties namespaces(#4316)

* Support grayscale feature for non-properties namespaces(#4316)

* Support grayscale feature for non-properties namespaces(#4316)

* Support grayscale feature for non-properties namespaces(#4316)

* Support grayscale feature for non-properties namespaces(#4316)

* Support grayscale feature for non-properties namespaces(#4316)

* Support grayscale feature for non-properties namespaces(#4316)
  • Loading branch information
ywy-github authored Sep 20, 2023
1 parent a23b3a8 commit 57cca96
Show file tree
Hide file tree
Showing 16 changed files with 52 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Apollo 2.2.0
* [Fix the issue that env special case handling is missing in some case](https://github.com/apolloconfig/apollo/pull/4887)
* [Fix the issue that namespace content being cleared when identical content is pasted into the namespace](https://github.com/apolloconfig/apollo/pull/4922)
* [feat(openapi): allow user create app via openapi](https://github.com/apolloconfig/apollo/pull/4954)
* [Support grayscale feature for non-properties namespaces](https://github.com/apolloconfig/apollo/pull/4952)

------------------
All issues and pull requests are [here](https://github.com/apolloconfig/apollo/milestone/13?closed=1)
2 changes: 2 additions & 0 deletions apollo-portal/src/main/resources/static/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@
"Component.Publish.AllPublish": "Full Release",
"Component.Publish.AllPublishTips": "(Full release configurations are applied to all instances)",
"Component.Publish.ToSeeChange": "View changes",
"Component.Publish.CompareWithMasterValue": "Compare with master",
"Component.Publish.CompareWithPublishedValue": "Compare with grayscale",
"Component.Publish.PublishedValue": "Released values",
"Component.Publish.Changes": "Changes",
"Component.Publish.Key": "Key",
Expand Down
4 changes: 3 additions & 1 deletion apollo-portal/src/main/resources/static/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,9 @@
"Component.Publish.AllPublish": "全量发布",
"Component.Publish.AllPublishTips": "(全量发布的配置会作用于全部的实例)",
"Component.Publish.ToSeeChange": "查看变更",
"Component.Publish.PublishedValue": "发布的值",
"Component.Publish.CompareWithMasterValue": "与主版本对比",
"Component.Publish.CompareWithPublishedValue": "与灰度版本对比",
"Component.Publish.PublishedValue": "待发布的值",
"Component.Publish.Changes": "Changes",
"Component.Publish.Key": "Key",
"Component.Publish.NoPublishedValue": "未发布的值",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,4 +418,3 @@ function controller($rootScope, $scope, $translate, toastr, AppUtil, EventManage

}


Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ directive_module.directive('apollodiff',
var oldStr = scope.oldStr == undefined ? '' : scope.oldStr;
var newStr = scope.newStr == undefined ? '' : scope.newStr;

var diff = JsDiff.diffLines(oldStr, newStr),
var oldStrRes = oldStr.replace(/\r/g, "");
var diff = JsDiff.diffLines(oldStrRes, newStr),
fragment = document.createDocumentFragment();

diff.forEach(function (part) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,6 @@ function directive($window, $translate, toastr, AppUtil, EventManager, Permissio

//normal release and gray release
function publish(namespace) {

if (!namespace.hasReleasePermission) {
AppUtil.showModal('#releaseNoPermissionDialog');
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function releaseModalDirective($translate, toastr, AppUtil, EventManager, Releas
scope.release = release;

scope.releaseBtnDisabled = false;
scope.releaseChangeViewType = 'change';
scope.releaseChangeViewType = 'compareWithPublishedValue';
scope.releaseComment = '';
scope.isEmergencyPublish = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3974,7 +3974,7 @@ tbody.collapse.in {
}

.btn-group .btn + .btn, .btn-group .btn + .btn-group, .btn-group .btn-group + .btn, .btn-group .btn-group + .btn-group {
margin-left: -1px
margin-left: 0px
}

.btn-toolbar {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ <h4 class="modal-title">
</label>
<div class="col-sm-10" valdr-form-group>
<input type="text" name="key" class="form-control" ng-model="item.key" tabindex="1"
ng-required="true" ng-disabled="item.tableViewOperType != 'create'" />
ng-required="true" ng-disabled="item.tableViewOperType == 'update' || !toOperationNamespace.isPropertiesFormat" />
</div>
</div>
<div class="form-group">
Expand All @@ -48,7 +48,7 @@ <h4 class="modal-title">
{{'Component.ConfigItem.ItemTypeName' | translate }}
</label>
<div class="col-sm-10" valdr-form-group>
<select class="form-control" name="type" ng-model="item.type" ng-change="changeType()">
<select class="form-control" name="type" ng-model="item.type" ng-change="changeType()" ng-disabled="!toOperationNamespace.isPropertiesFormat">
<option value="0">{{'Component.ConfigItem.ItemTypeString' | translate }}</option>
<option value="1">{{'Component.ConfigItem.ItemTypeNumber' | translate }}</option>
<option value="2">{{'Component.ConfigItem.ItemTypeBoolean' | translate }}</option>
Expand Down Expand Up @@ -86,9 +86,9 @@ <h4 class="modal-title">

</div>
<div class="form-group">
<label class="col-sm-2 control-label">{{'Component.ConfigItem.ItemComment' | translate }}</label>
<label class="col-sm-2 control-label" ng-show="toOperationNamespace.isPropertiesFormat">{{'Component.ConfigItem.ItemComment' | translate }}</label>
<div class="col-sm-10" valdr-form-group>
<textarea class="form-control" name="comment" ng-model="item.comment" tabindex="3" rows="2">
<textarea class="form-control" name="comment" ng-model="item.comment" tabindex="3" rows="2" ng-show="toOperationNamespace.isPropertiesFormat">
</textarea>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@
<div class="row">
<div class="col-md-12 pull-left">
<ul class="nav nav-tabs">
<li role="presentation" ng-click="switchView(namespace.branch, 'table')"
ng-show="namespace.isPropertiesFormat">
<li role="presentation" ng-click="switchView(namespace.branch, 'table')">
<a ng-class="{node_active:namespace.branch.viewType == 'table'}">
<img src="img/table.png">
{{'Component.Namespace.Branch.Tab.Configuration' | translate }}
Expand Down Expand Up @@ -111,7 +110,7 @@
<div class="panel-heading">
{{'Component.Namespace.Branch.Body.Item' | translate }}
<button type="button" class="btn btn-primary btn-sm pull-right" style="margin-top: -4px;"
ng-show="namespace.hasModifyPermission" ng-click="createItem(namespace.branch)">
ng-show="namespace.isPropertiesFormat && namespace.hasModifyPermission" ng-click="createItem(namespace.branch)">
<img src="img/plus.png">
{{'Component.Namespace.Branch.Body.AddedItem' | translate }}
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@

<a type="button" class="btn btn-default btn-sm" data-tooltip="tooltip" data-placement="bottom"
title="{{'Component.Namespace.Master.Items.GrayscaleTips' | translate }}"
ng-show="!namespace.hasBranch && namespace.isPropertiesFormat && namespace.hasModifyPermission"
ng-show="!namespace.hasBranch && namespace.hasModifyPermission"
ng-click="preCreateBranch(namespace)">
<img src="img/test.png">
{{'Component.Namespace.Master.Items.Grayscale' | translate }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,15 @@ <h4 class="modal-title" ng-show="toReleaseNamespace.isBranch && toReleaseNamespa

<div class="form-group pre-scrollable">
<div class="col-sm-2 control-label" ng-if="!toReleaseNamespace.isPropertiesFormat">
<div class="row">
<div class="btn-group btn-group-xs" style="padding-right: 10px" role="group">
<div class="btn-group-vertical">
<div class="btn-group btn-group-xs" role="group">
<button type="button" class="btn btn-default" ng-if="toReleaseNamespace.isBranch"
ng-class="{active:releaseChangeViewType=='compareWithMasterValue'}"
ng-click="switchReleaseChangeViewType('compareWithMasterValue')">{{'Component.Publish.CompareWithMasterValue' | translate }}
</button>
<button type="button" class="btn btn-default"
ng-class="{active:releaseChangeViewType=='change'}"
ng-click="switchReleaseChangeViewType('change')">{{'Component.Publish.ToSeeChange' | translate }}
ng-class="{active:releaseChangeViewType=='compareWithPublishedValue'}"
ng-click="switchReleaseChangeViewType('compareWithPublishedValue')">{{'Component.Publish.CompareWithPublishedValue' | translate }}
</button>
<button type="button" class="btn btn-default"
ng-class="{active:releaseChangeViewType=='release'}"
Expand Down Expand Up @@ -216,9 +220,14 @@ <h4 class="modal-title" ng-show="toReleaseNamespace.isBranch && toReleaseNamespa
</table>

<!--file format -->
<div ng-repeat="config in toReleaseNamespace.branchItems" ng-if="!toReleaseNamespace.isPropertiesFormat&&toReleaseNamespace.isBranch"
ng-show="releaseChangeViewType=='compareWithMasterValue'">
<apollodiff old-str="config.masterReleaseValue" new-str="config.newValue" apollo-id="'releaseStrDiffWithMasterValue'">
</apollodiff>
</div>
<div ng-repeat="item in toReleaseNamespace.items" ng-if="!toReleaseNamespace.isPropertiesFormat"
ng-show="releaseChangeViewType=='change'">
<apollodiff old-str="item.oldValue" new-str="item.newValue" apollo-id="'releaseStrDiff'">
ng-show="releaseChangeViewType=='compareWithPublishedValue'">
<apollodiff old-str="item.oldValue" new-str="item.newValue" apollo-id="'releaseStrDiffWithPublishedValue'">
</apollodiff>
</div>
<div ng-repeat="item in toReleaseNamespace.items" ng-if="!toReleaseNamespace.isPropertiesFormat"
Expand Down
Binary file added doc/images/gray-release/click-gray-release.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions docs/en/usage/apollo-user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,16 @@ Fill in the popup box with the value to be grayed out: 3000 and click Submit.

![gray-release-config-submitted](https://cdn.jsdelivr.net/gh/apolloconfig/apollo@master/doc/images/gray-release/gray-release-config-submitted.png)

After the grayscale configuration, confirm the grayscale configuration and the major version configuration.

Click on the `Grayscale Publish` button.

![](../../../doc/images/gray-release/click-gray-release.png)

Confirm the grayscale configuration to be released by comparing the value of the major version and the published value of the grayscale version.

![](../../../doc/images/gray-release/gray-release-diff-items.png)

## 5.4 Configuring grayscale rules

Switch to the `Gray Rule` Tab and click the `Add Rule` button
Expand Down
10 changes: 10 additions & 0 deletions docs/zh/usage/apollo-user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,16 @@ Apollo目前提供Java客户端,具体信息请点击[Java客户端使用文

![gray-release-config-submitted](https://cdn.jsdelivr.net/gh/apolloconfig/apollo@master/doc/images/gray-release/gray-release-config-submitted.png)

灰度配置完成后,确认灰度的配置和主版本配置

点击`灰度发布`按钮

![](../../../doc/images/gray-release/click-gray-release.png)

与主版本的值和灰度版本已发布的值对比,确认将要发布的灰度配置

![](../../../doc/images/gray-release/gray-release-diff-items.png)

## 5.4 配置灰度规则
切换到`灰度规则`Tab,点击`新增规则`按钮

Expand Down

0 comments on commit 57cca96

Please sign in to comment.