-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6676e3a
commit 61de022
Showing
8 changed files
with
102 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.dashboard-custom-dialog-branch.dashboard-custom-branch-selected { | ||
background-color: #ffff00 !important; | ||
} | ||
|
||
.dashboard-custom-dialog-branch { | ||
cursor: pointer; | ||
} |
67 changes: 53 additions & 14 deletions
67
ontrack-web/src/main/webapp/static/js/app/dashboard-custom.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,65 @@ | ||
define(['jquery','ajax','dialog','dynamic'], function ($, ajax, dialog, dynamic) { | ||
define(['jquery', 'ajax', 'dialog', 'dynamic'], function ($, ajax, dialog, dynamic) { | ||
|
||
// Dashboard creation | ||
function createDashboard() { | ||
dialog.show({ | ||
title: 'dashboard.custom'.loc(), | ||
templateId: 'dashboard-custom-dialog', | ||
submitFn: function (config) { | ||
ajax.post({ | ||
url: 'ui/manage/dashboard', | ||
function createDashboard(btn) { | ||
ajax.get({ | ||
url: 'ui/manage/branch', | ||
loading: { | ||
el: $(btn) | ||
}, | ||
successFn: function (branches) { | ||
dialog.show({ | ||
title: 'dashboard.custom'.loc(), | ||
templateId: 'dashboard-custom-dialog', | ||
data: { | ||
name: $('#dashboard-custom-name').val() | ||
branches: branches | ||
}, | ||
successFn: function () { | ||
config.closeFn(); | ||
dynamic.reloadSection('dashboard-custom'); | ||
initFn: function (config) { | ||
config.form.find('.dashboard-custom-dialog-branch').each(function (i, tr) { | ||
var branchId = $(tr).attr('id'); | ||
// TODO Initial state | ||
// TODO Checks for authz | ||
// Selection of branches | ||
$(tr).click(function () { | ||
$(tr).data('branch-selected', !$(tr).data('branch-selected')); | ||
if ($(tr).data('branch-selected')) { | ||
$(tr).addClass('dashboard-custom-branch-selected'); | ||
} else { | ||
$(tr).removeClass('dashboard-custom-branch-selected'); | ||
} | ||
}) | ||
}) | ||
}, | ||
errorFn: ajax.simpleAjaxErrorFn(config.errorFn) | ||
submitFn: function (config) { | ||
// Selected branches | ||
var branches = []; | ||
config.form.find('.dashboard-custom-dialog-branch').each(function (i, tr) { | ||
var branchId = $(tr).attr('id'); | ||
if ($(tr).data('branch-selected')) { | ||
branches.push(branchId); | ||
} | ||
}); | ||
// Posting the creation | ||
ajax.post({ | ||
url: 'ui/manage/dashboard', | ||
data: { | ||
name: $('#dashboard-custom-name').val(), | ||
branches: branches | ||
}, | ||
successFn: function () { | ||
config.closeFn(); | ||
dynamic.reloadSection('dashboard-custom'); | ||
}, | ||
errorFn: ajax.simpleAjaxErrorFn(config.errorFn) | ||
}); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
|
||
$('#dashboard-custom-create').click(createDashboard); | ||
$('#dashboard-custom-create').click(function () { | ||
createDashboard(this); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters