Skip to content

Commit

Permalink
Merge remote-tracking branch 'couchbase/unstable' into HEAD
Browse files Browse the repository at this point in the history
http: //ci-eventing.northscale.in/eventing-19.10.2020-15.34.pass.html
Change-Id: Ib7b897556d642cad68f55d64e1a2da6d7501e2ff
  • Loading branch information
AnkitPrabhu committed Oct 20, 2020
2 parents 19c54b5 + d91ca36 commit d85754f
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 12 deletions.
14 changes: 11 additions & 3 deletions service_manager/http_handlers.go
Expand Up @@ -1949,10 +1949,18 @@ func (m *ServiceMgr) savePrimaryStore(app *application) (info *runtimeInfo) {
return
}

if app.DeploymentConfig.SourceBucket == app.DeploymentConfig.MetadataBucket {
sourceKeyspace := common.Keyspace{BucketName: app.DeploymentConfig.SourceBucket,
ScopeName: app.DeploymentConfig.SourceScope,
CollectionName: app.DeploymentConfig.SourceCollection}

metadataKeyspace := common.Keyspace{BucketName: app.DeploymentConfig.MetadataBucket,
ScopeName: app.DeploymentConfig.MetadataScope,
CollectionName: app.DeploymentConfig.MetadataCollection}

if sourceKeyspace == metadataKeyspace {
info.Code = m.statusCodes.errSrcMbSame.Code
info.Info = fmt.Sprintf("Function: %s source bucket same as metadata bucket. source_bucket : %s metadata_bucket : %s",
app.Name, app.DeploymentConfig.SourceBucket, app.DeploymentConfig.MetadataBucket)
info.Info = fmt.Sprintf("Function: %s source keyspace same as metadata keyspace. source : %s metadata : %s",
app.Name, sourceKeyspace, metadataKeyspace)
logging.Errorf("%s %s", logPrefix, info.Info)
return
}
Expand Down
25 changes: 18 additions & 7 deletions service_manager/manager.go
Expand Up @@ -405,11 +405,27 @@ func (m *ServiceMgr) settingChangeCallback(path string, value []byte, rev interf
return nil
}

if value == nil {
m.fnMu.Lock()
defer m.fnMu.Unlock()
functionName := pathTokens[len(pathTokens)-1]
cfg, ok := m.fnsInPrimaryStore[functionName]

if !ok {
return nil
}

functionName := pathTokens[len(pathTokens)-1]
if value == nil {
source := common.Keyspace{BucketName: cfg.SourceBucket,
ScopeName: cfg.SourceScope,
CollectionName: cfg.SourceCollection,
}
delete(m.bucketFunctionMap[source], functionName)
if len(m.bucketFunctionMap[source]) == 0 {
delete(m.bucketFunctionMap, source)
}

return nil
}

settings := make(map[string]interface{})
err := json.Unmarshal(value, &settings)
Expand All @@ -433,11 +449,6 @@ func (m *ServiceMgr) settingChangeCallback(path string, value []byte, rev interf
return nil
}

m.fnMu.Lock()
defer m.fnMu.Unlock()

cfg := m.fnsInPrimaryStore[functionName]

source, _ := m.getSourceAndDestinationsFromDepCfg(&cfg)
if processingStatus == false {
m.graph.removeEdges(functionName)
Expand Down
2 changes: 1 addition & 1 deletion service_manager/status.go
Expand Up @@ -330,7 +330,7 @@ func (m *ServiceMgr) initErrCodes() {
{
Name: m.statusCodes.errSrcMbSame.Name,
Code: m.statusCodes.errSrcMbSame.Code,
Description: "Source bucket same as metadata bucket",
Description: "Source keyspace same as metadata keyspace",
},
{
Name: m.statusCodes.errInvalidExt.Name,
Expand Down
16 changes: 15 additions & 1 deletion ui/eventing-ui/ui-current/eventing.js
Expand Up @@ -1261,6 +1261,12 @@ angular.module('eventing', [
console.log(err);
});

var config = require("ace/config");
$scope.searchInCode = function() {
config.loadModule("ace/ext/cb-searchbox",
function(e) {if ($scope.editor) e.Search($scope.editor, true, true)});
}

self.handler = app.appcode;
self.pristineHandler = app.appcode;
self.debugToolTip = "Displays a URL that connects the Chrome Dev-Tools with the application handler. Code must be deployed and debugger must be enabled in the settings in order to debug";
Expand All @@ -1279,6 +1285,14 @@ angular.module('eventing', [
// TODO : Figure out how to add N1QL grammar to ace editor.
editor.getSession().setUseWorker(false);

$scope.editor = editor;
$scope.editor.commands.addCommand({
name: "Search Pop Up.",
exec: $scope.searchInCode,
bindKey: {mac: "cmd-f", win: "ctrl-f"},
readOnly: true
});

// Allow editor to load fully and add annotations
var showAnnotations = function() {
// compilation errors
Expand Down Expand Up @@ -2096,7 +2110,7 @@ angular.module('eventing', [
form.appname.$error.required = form.appname.$viewValue === '' ||
form.appname.$viewValue === undefined;

form.timer_context_size.$error.isnan = isNaN(form.timer_context_size.$error.isnum.$viewValue)
form.timer_context_size.$error.isnan = isNaN(form.timer_context_size.$viewValue) || (form.timer_context_size.$viewValue == null);

return form.appname.$error.required ||
form.appname.$error.appExists ||
Expand Down
1 change: 1 addition & 0 deletions ui/eventing-ui/ui-current/fragments/app-settings.html
Expand Up @@ -295,6 +295,7 @@ <h2 ng-show="!formCtrl.isDialog">Function Settings</h2>
type="number"
name="timer_context_size"
ng-model="appModel.settings.timer_context_size"
ng-init="appModel.settings.timer_context_size = appModel.settings.timer_context_size ? appModel.settings.timer_context_size : 1024"
min="20"
max="20971520">
<div
Expand Down
1 change: 1 addition & 0 deletions ui/eventing-ui/ui-current/fragments/handler-editor.html
Expand Up @@ -38,6 +38,7 @@
<span class="icon fa-circle-thin fa-stack-2x"></span>
<span class="icon fa-info fa-stack-1x"></span>
</span>
<span class="icon fa-search fa-lg fa-stack" ng-click="searchInCode()"></span>
</div>
<div>
<a ui-sref="app.admin.eventing.summary">
Expand Down

0 comments on commit d85754f

Please sign in to comment.