Skip to content

Commit 0afacbf

Browse files
committed
feat: Disable person mode toggle btn when para is running
1 parent 142597b commit 0afacbf

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

zeppelin-web/src/app/notebook/notebook-actionBar.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ <h3>
7474

7575
<button type="button"
7676
class="btn btn-primary btn-xs"
77+
ng-class="isNoteRunning() ? 'disabled' : ''"
7778
ng-if="ticket.principal && ticket.principal !== 'anonymous'"
7879
ng-hide="viewOnly || note.config.personalizedMode !== 'true'"
7980
ng-click="toggleNotePersonalizedMode()"
@@ -83,6 +84,7 @@ <h3>
8384
</button>
8485
<button type="button"
8586
class="btn btn-default btn-xs"
87+
ng-class="isNoteRunning() ? 'disabled' : ''"
8688
ng-if="ticket.principal && ticket.principal !== 'anonymous'"
8789
ng-hide="viewOnly || note.config.personalizedMode === 'true'"
8890
ng-click="toggleNotePersonalizedMode()"

zeppelin-web/src/app/notebook/notebook.controller.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
* limitations under the License.
1313
*/
1414

15+
// import { ParagraphStatus } from './paragraph/paragraph.status';
16+
1517
angular.module('zeppelinWebApp').controller('NotebookCtrl', NotebookCtrl);
1618

1719
function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
@@ -342,16 +344,20 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
342344
$scope.$broadcast('closeTable');
343345
};
344346

347+
/**
348+
* @returns {boolean} true if one more paragraphs are running. otherwise return false.
349+
*/
345350
$scope.isNoteRunning = function() {
346-
var running = false;
347351
if (!$scope.note) { return false; }
348-
for (var i = 0; i < $scope.note.paragraphs.length; i++) {
349-
if ($scope.note.paragraphs[i].status === 'PENDING' || $scope.note.paragraphs[i].status === 'RUNNING') {
350-
running = true;
351-
break;
352+
353+
for (let i = 0; i < $scope.note.paragraphs.length; i++) {
354+
const status = $scope.note.paragraphs[i].status;
355+
if (status === 'PENDING' || status === 'RUNNING') {
356+
return true;
352357
}
353358
}
354-
return running;
359+
360+
return false;
355361
};
356362

357363
$scope.killSaveTimer = function() {

0 commit comments

Comments
 (0)