Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

Commit

Permalink
Merge pull request #105 from exceptionless/feature/fixed-in-version
Browse files Browse the repository at this point in the history
Feature/fixed in version
  • Loading branch information
niemyjski authored Jul 16, 2016
2 parents c42091d + d744084 commit bc92043
Show file tree
Hide file tree
Showing 19 changed files with 162 additions and 59 deletions.
32 changes: 0 additions & 32 deletions src/app/session/sessions-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@
return vm.events && vm.events.length > 0;
}

function hasSelection() {
return vm.selectedIds.length > 0;
}

function open(id, event) {
var openInNewTab = (event.ctrlKey || event.metaKey || event.which === 2);
$ExceptionlessClient.createFeatureUsage(source + '.open').setProperty('id', id).setProperty('_blank', openInNewTab).submit();
Expand All @@ -99,45 +95,17 @@
return get(vm.previous);
}

function save(action) {
function onSuccess() {
vm.selectedIds = [];
}

if (!hasSelection()) {
notificationService.info(null, 'Please select one or more events');
} else {
action.run(vm.selectedIds).then(onSuccess);
}
}

function updateSelection() {
if (!hasEvents())
return;

if (hasSelection())
vm.selectedIds = [];
else
vm.selectedIds = vm.events.map(function (event) {
return event.id;
});
}

vm.canRefresh = canRefresh;
vm.events = [];
vm.get = get;
vm.getDuration = getDuration;
vm.hasEvents = hasEvents;
vm.hasFilter = filterService.hasFilter;
vm.hasSelection = hasSelection;
vm.loading = true;
vm.open = open;
vm.nextPage = nextPage;
vm.previousPage = previousPage;
vm.save = save;
vm.selectedIds = [];
vm.showType = vm.settings.summary ? vm.settings.summary.showType : !filterService.getEventType();
vm.updateSelection = updateSelection;
get();
}],
controllerAs: 'vm'
Expand Down
8 changes: 5 additions & 3 deletions src/app/stack/stack-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'use strict';

angular.module('app.stack')
.controller('Stack', ['$scope', '$ExceptionlessClient', '$filter', 'hotkeys', '$state', '$stateParams', 'billingService', 'dialogs', 'dialogService', 'eventService', 'filterService', 'notificationService', 'projectService', 'stackService', 'statService', function ($scope, $ExceptionlessClient, $filter, hotkeys, $state, $stateParams, billingService, dialogs, dialogService, eventService, filterService, notificationService, projectService, stackService, statService) {
.controller('Stack', ['$scope', '$ExceptionlessClient', '$filter', 'hotkeys', '$state', '$stateParams', 'billingService', 'dialogs', 'dialogService', 'eventService', 'filterService', 'notificationService', 'projectService', 'stackDialogService', 'stackService', 'statService', function ($scope, $ExceptionlessClient, $filter, hotkeys, $state, $stateParams, billingService, dialogs, dialogService, eventService, filterService, notificationService, projectService, stackDialogService, stackService, statService) {
var source = 'app.stack.Stack';
var _stackId = $stateParams.id;
var vm = this;
Expand Down Expand Up @@ -249,7 +249,7 @@
}

function isFixed() {
return !!vm.stack.date_fixed;
return !!vm.stack.date_fixed && !isRegressed();
}

function isHidden() {
Expand Down Expand Up @@ -378,7 +378,9 @@
return stackService.markNotFixed(_stackId).then(onSuccess, onFailure);
}

return stackService.markFixed(_stackId).then(onSuccess, onFailure);
return stackDialogService.markFixed().then(function (version) {
return stackService.markFixed(_stackId, version).then(onSuccess, onFailure);
});
}

function updateIsHidden() {
Expand Down
1 change: 1 addition & 0 deletions src/app/stack/stack.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
'exceptionless.rate-limit',
'exceptionless.refresh',
'exceptionless.stack',
'exceptionless.stack-dialog',
'exceptionless.stack-trace',
'exceptionless.stat'
])
Expand Down
4 changes: 2 additions & 2 deletions src/app/stack/stack.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
Stack
<span class="labels">
<span class="label label-success" ng-if="vm.isFixed()">
<span class="hidden-xs">FIXED</span>
<span class="hidden-xs">FIXED<span ng-if="vm.stack.fixed_in_version"> IN {{vm.stack.fixed_in_version}}</span></span>
<span class="visible-xs">F</span>
</span>
<span class="label label-success" ng-if="vm.isRegressed()">
Expand All @@ -90,7 +90,7 @@
</span>

<div class="btn-toolbar pull-right hidden-print" role="toolbar" aria-label="Stack Options">
<div class="btn-group btn-group-sm" role="group">
<div class="btn-group btn-group-sm" role="group" ng-if="vm.stack.type === 'error'">
<button type="button" role="button" class="btn btn-default" title="{{vm.isFixed() ? 'Mark this stack as not fixed' : 'Mark this stack as fixed'}}" promise-button="vm.updateIsFixed()" promise-button-busy-text="{{vm.isFixed() ? 'Marking Not Fixed' : 'Marking Fixed' }}" promise-button-busy-spinner-class="fa-size-sm">
{{vm.isFixed() ? 'Mark Not Fixed' : 'Mark Fixed' }}
</button>
Expand Down
8 changes: 4 additions & 4 deletions src/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
"angular-resource": "1.5.7",
"angular-stripe": "4.2.12",
"angular-ui-router": "0.2.18",
"angular-xeditable": "0.1.12",
"angular-xeditable": "0.2.0",
"angularjs-toaster": "2.0.0",
"angulartics": "1.1.2",
"animate.css": "3.5.2",
"base64": "1.0.0",
"bootstrap": "3.3.6",
"bootstrap-daterangepicker": "2.1.23",
"checklist-model": "0.9.0",
"checklist-model": "0.10.0",
"d3": "3.5.17",
"es5-shim": "4.5.9",
"es6-shim": "0.35.1",
Expand All @@ -44,12 +44,12 @@
"less.js": "2.7.1",
"li": "1.0.1",
"lodash": "4.13.1",
"moment": "2.13.0",
"moment": "2.14.1",
"mousetrap-js": "1.6.0",
"ng-debounce": "0.1.7",
"ng-filters": "1.3.0",
"objectid.js": "1.0.1",
"query-string": "4.1.0",
"query-string": "4.2.2",
"restangular": "1.5.2",
"rickshaw": "1.5.1",
"satellizer": "0.14.1",
Expand Down
2 changes: 1 addition & 1 deletion src/components/duration/duration-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
});

// TODO: implement smarter delay logic. We shouldn't be updating stuff it the interval period is a hour, day, month, year..
var interval = $interval(setDurationText, 60 * 1000);
var interval = $interval(setDurationText, 15 * 1000);
scope.$on('$destroy', function () {
$interval.cancel(interval);
});
Expand Down
1 change: 1 addition & 0 deletions src/components/events/events-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
function get(options) {
function onSuccess(response) {
vm.events = response.data.plain();
vm.selectedIds = vm.selectedIds.filter(function(id) { return vm.events.filter(function(e) { return e.id === id; }).length > 0; });

var links = linkService.getLinksQueryParameters(response.headers('link'));
vm.previous = links['previous'];
Expand Down
28 changes: 28 additions & 0 deletions src/components/stack-dialog/mark-fixed-dialog-controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
(function () {
'use strict';

angular.module('exceptionless.stack-dialog')
.controller('MarkFixedDialog', ['$ExceptionlessClient', '$uibModalInstance', function ($ExceptionlessClient, $uibModalInstance) {
var source = 'app.stack-dialog.MarkFixedDialog';
var vm = this;

function cancel() {
$uibModalInstance.dismiss('cancel');
}

function save(isValid) {
if (isValid === false) {
return;
}

$ExceptionlessClient.createFeatureUsage(source + '.save').setProperty('version', vm.data.version).submit();
$uibModalInstance.close(vm.data.version);
}

vm.cancel = cancel;
vm.data = {};
vm.save = save;
$ExceptionlessClient.submitFeatureUsage(source);
}]);
}());

36 changes: 36 additions & 0 deletions src/components/stack-dialog/mark-fixed-dialog.tpl.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<form name="markFixedForm" role="form" class="form-validation" autocomplete="on">
<div class="modal-header dialog-header-confirm">
<button type="button" role="button" class="close" ng-click="vm.cancel()">&times;</button>
<h4 class="modal-title">
<span class="glyphicon glyphicon-check"></span>
Mark Fixed
</h4>
</div>

<div class="modal-body text-muted">
<p>Marks the stack as fixed. This will also prevent error occurrences from being displayed in the dashboard.</p>
<p>
<b>Optional:</b> Please enter the version in which the stack has been fixed. Any submitted occurrences with a lower version will
not cause a regression.
<a href="https://github.com/exceptionless/Exceptionless/wiki/Versioning" target="_blank" title="Versioning Documentation" aria-label="Versioning Documentation">
<i class="fa fa-fw fa-question-circle"></i>
</a>
</p>

<div class="form-group">
<input id="version" name="version" type="text" class="form-control input-lg" placeholder="Optional Version (Example: 1.2.3)"
ng-model="vm.data.version"
semantic-version-validator
autofocus />

<div class="error" ng-messages="markFixedForm.$error" ng-if="markFixedForm.$submitted || markFixedForm.version.$touched">
<small ng-message="semver">Invalid version.</small>
</div>
</div>
</div>

<div class="modal-footer">
<button type="button" role="button" class="btn btn-default" ng-click="vm.cancel()">Cancel</button>
<input type="submit" role="button" class="btn btn-primary" ng-click="vm.save(markFixedForm.$valid)" value="MARK FIXED" />
</div>
</form>
17 changes: 17 additions & 0 deletions src/components/stack-dialog/stack-dialog-service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
(function () {
'use strict';

angular.module('exceptionless.stack-dialog')
.factory('stackDialogService', ['dialogs', function (dialogs) {
function markFixed() {
return dialogs.create('components/stack-dialog/mark-fixed-dialog.tpl.html', 'MarkFixedDialog as vm').result;
}

var service = {
markFixed: markFixed
};

return service;
}
]);
}());
13 changes: 13 additions & 0 deletions src/components/stack-dialog/stack-dialog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
(function () {
'use strict';

angular.module('exceptionless.stack-dialog', [
'ui.bootstrap',

'dialogs.main',
'dialogs.default-translations',

'exceptionless.autofocus',
'exceptionless.validators'
]);
}());
4 changes: 2 additions & 2 deletions src/components/stack/stack-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
return Restangular.one('stacks', id).one('mark-critical').remove();
}

function markFixed(id) {
return Restangular.one('stacks', id).one('mark-fixed').post();
function markFixed(id, version) {
return Restangular.one('stacks', id).post('mark-fixed', null, { version: version });
}

function markNotFixed(id) {
Expand Down
22 changes: 12 additions & 10 deletions src/components/stacks/stacks-actions-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
'use strict';

angular.module('exceptionless.stacks')
.factory('stacksActionsService', ['$ExceptionlessClient', 'dialogService', 'stackService', 'notificationService', '$q', function ($ExceptionlessClient, dialogService, stackService, notificationService, $q) {
.factory('stacksActionsService', ['$ExceptionlessClient', 'dialogService', 'stackDialogService', 'stackService', 'notificationService', '$q', function ($ExceptionlessClient, dialogService, stackDialogService, stackService, notificationService, $q) {
var source = 'exceptionless.stacks.stacksActionsService';

function executeAction(ids, action, onSuccess, onFailure) {
Expand Down Expand Up @@ -37,17 +37,19 @@
var markFixedAction = {
name: 'Mark Fixed',
run: function (ids) {
function onSuccess() {
notificationService.info('Successfully queued the stacks to be marked as fixed.');
}
$ExceptionlessClient.createFeatureUsage(source + '.mark-fixed').setProperty('count', ids.length).submit();
return stackDialogService.markFixed().then(function (version) {
function onSuccess() {
notificationService.info('Successfully queued the stacks to be marked as fixed.');
}

function onFailure() {
$ExceptionlessClient.createFeatureUsage(source + '.mark-fixed.error').setProperty('count', ids.length).submit();
notificationService.error('An error occurred while marking stacks as fixed.');
}
function onFailure() {
$ExceptionlessClient.createFeatureUsage(source + '.mark-fixed.error').setProperty('count', ids.length).submit();
notificationService.error('An error occurred while marking stacks as fixed.');
}

$ExceptionlessClient.createFeatureUsage(source + '.mark-fixed').setProperty('count', ids.length).submit();
return executeAction(ids, stackService.markFixed, onSuccess, onFailure);
return executeAction(ids, function(ids) { return stackService.markFixed(ids, version); }, onSuccess, onFailure);
});
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/stacks/stacks-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

function get(options) {
function onSuccess(response) {
vm.selectedIds = [];
vm.stacks = response.data.plain();
vm.selectedIds = vm.selectedIds.filter(function(id) { return vm.stacks.filter(function(e) { return e.id === id; }).length > 0; });

var links = linkService.getLinksQueryParameters(response.headers('link'));
vm.previous = links['previous'];
Expand Down
1 change: 1 addition & 0 deletions src/components/stacks/stacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
'exceptionless.pagination',
'exceptionless.refresh',
'exceptionless.summary',
'exceptionless.stack-dialog',
'exceptionless.timeago'
]);
}());
2 changes: 1 addition & 1 deletion src/components/timeago/timeago-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
});

// TODO: implement smarter delay logic. We shouldn't be updating stuff it the interval period is a hour, day, month, year..
var interval = $interval(setTimeagoText, 60 * 1000);
var interval = $interval(setTimeagoText, 15 * 1000);
scope.$on('$destroy', function () {
$interval.cancel(interval);
});
Expand Down
30 changes: 30 additions & 0 deletions src/components/validators/semantic-version-validator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
(function () {
'use strict';

angular.module('exceptionless.validators')
.directive('semanticVersionValidator', ['$timeout', '$q', 'searchService', function($timeout, $q, searchService) {
return {
restrict: 'A',
require: 'ngModel',
link: function(scope, element, attrs, ngModel) {
ngModel.$validators.semver = function (modelValue, viewValue) {
if (typeof viewValue !== 'string') {
return undefined;
}

var version = viewValue.trim();
if (version.length === 0) {
return undefined;
}

if (version.length > 256) {
return false;
}

var regex = new RegExp('^v?(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\\+([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?$');
return regex.test(version);
};
}
};
}]);
}());
4 changes: 4 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@
<script src="components/simple-error/simple-error-service.js"></script>
<script src="components/simple-stack-trace/simple-stack-trace-directive.js"></script>
<script src="components/stack/stack-service.js"></script>
<script src="components/stack-dialog/stack-dialog.js"></script>
<script src="components/stack-dialog/stack-dialog-service.js"></script>
<script src="components/stack-dialog/mark-fixed-dialog-controller.js"></script>
<script src="components/stack-trace/stack-trace-directive.js"></script>
<script src="components/stacks/stacks.js"></script>
<script src="components/stacks/stacks-actions-service.js"></script>
Expand All @@ -200,6 +203,7 @@
<script src="components/validators/organization-name-available-validator.js"></script>
<script src="components/validators/project-name-available-validator.js"></script>
<script src="components/validators/search-filter-validator.js"></script>
<script src="components/validators/semantic-version-validator.js"></script>
<script src="components/web-hook/web-hook.js"></script>
<script src="components/web-hook/add-web-hook-dialog-controller.js"></script>
<script src="components/web-hook/web-hook-service.js"></script>
Expand Down
Loading

0 comments on commit bc92043

Please sign in to comment.