import util.user.UserRule;
import static util.ItUtils.newAdminWsClient;
-import static util.ItUtils.runProjectAnalysis;
public class DashboardSharingPermissionTest {
.build();
orchestrator.executeSelenese(selenese);
}
-
- /**
- * SONAR-4136
- */
- @Test
- public void share_project_dashboard() throws Exception {
- runProjectAnalysis(orchestrator, "shared/xoo-sample");
-
- Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("project-dashboard-sharing-permission",
- "/authorisation/DashboardSharingPermissionTest/project-dashboard-sharing-allowed.html",
- "/authorisation/DashboardSharingPermissionTest/project-dashboard-sharing-denied.html")
- .build();
- orchestrator.executeSelenese(selenese);
- }
}
import util.user.UserRule;
import static util.ItUtils.newAdminWsClient;
-import static util.ItUtils.runProjectAnalysis;
public class SystemAdminPermissionTest {
"/authorisation/SystemAdminPermissionTest/change-shared-global-dashboard-owner-failure.html");
}
- /**
- * SONAR-4136
- */
- @Test
- public void should_change_ownership_of_shared_project_dashboard() throws Exception {
- runProjectAnalysis(orchestrator, "shared/xoo-sample");
-
- seleniumSuite("change-project-dashboard-ownership",
- "/authorisation/SystemAdminPermissionTest/change-shared-project-dashboard-owner.html",
- "/authorisation/SystemAdminPermissionTest/change-shared-project-dashboard-owner-failure.html");
- }
-
private void seleniumSuite(String suiteName, String... tests) {
Selenese selenese = Selenese.builder().setHtmlTestsInClasspath(suiteName, tests).build();
orchestrator.executeSelenese(selenese);
"/componentDashboard/DashboardTest/dashboard_extension/xss.html");
}
- /**
- * SONAR-3103
- */
- @Test
- public void share_dashboard() {
- seleniumSuite("share_dashboard",
- "/componentDashboard/DashboardTest/share_dashboard/follow-unfollow.html",
- "/componentDashboard/DashboardTest/share_dashboard/should-not-unshare-default-dashboard.html");
- }
-
@Test
public void configure_dashboard() {
seleniumSuite("configure_dashboard",
// SONAR-4630
"/componentDashboard/DashboardTest/global_dashboard/create-global-dashboards-error.html",
- // SONAR-3462
- "/componentDashboard/DashboardTest/global_dashboard/edit-project-dashboards.html",
-
// SONAR-3461
"/componentDashboard/DashboardTest/global_dashboard/order-project-default-dashboards.html",
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>project-dashboard-sharing-permission</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sessions/logout</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sessions/new</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=login</td>
- <td>can_share_dashboards</td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=password</td>
- <td>password</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>name=commit</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/dashboards?resource=sample</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>create-link-dashboard</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVisible</td>
- <td>css=div.modal-body</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>name</td>
- <td>My shared project dashboard</td>
-</tr>
-<tr>
- <td>storeValue</td>
- <td>name</td>
- <td>DASHBOARD_NAME</td>
-</tr>
-<tr>
- <td>click</td>
- <td>name=shared</td>
- <td></td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>save-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>assertTable</td>
- <td>css=table.data.2.0</td>
- <td>exact:${DASHBOARD_NAME}</td>
-</tr>
-<tr>
- <td>assertElementPresent</td>
- <td>dashboard-1-shared</td>
- <td></td>
-</tr>
-</tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>project-dashboard-sharing-permission</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sessions/logout</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sessions/new</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=login</td>
- <td>cannot_share_dashboards</td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=password</td>
- <td>password</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>name=commit</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/dashboards?resource=sample</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>create-link-dashboard</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVisible</td>
- <td>css=div.modal-body</td>
- <td></td>
-</tr>
-<tr>
- <td>assertElementNotPresent</td>
- <td>css=div.modal-body > div.modal.field > input#shared</td>
- <td></td>
-</tr>
-</tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>change-shared-project-dashboard-owner</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sessions/logout</td>
- <td></td>
- </tr>
- <tr>
- <td>open</td>
- <td>/sessions/new</td>
- <td></td>
- </tr>
- <tr>
- <td>type</td>
- <td>login</td>
- <td>admin</td>
- </tr>
- <tr>
- <td>type</td>
- <td>password</td>
- <td>admin</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>commit</td>
- <td></td>
- </tr>
- <tr>
- <td>open</td>
- <td>/dashboards?resource=sample</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>create-link-dashboard</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForVisible</td>
- <td>css=div.modal-body</td>
- <td></td>
- </tr>
- <tr>
- <td>type</td>
- <td>name</td>
- <td>shared-project-dashboard-fail</td>
- </tr>
- <tr>
- <td>storeValue</td>
- <td>name</td>
- <td>DASHBOARD_NAME</td>
- </tr>
- <tr>
- <td>click</td>
- <td>name=shared</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>save-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForVisible</td>
- <td>edit-${DASHBOARD_NAME}</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>edit-${DASHBOARD_NAME}</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForVisible</td>
- <td>css=div.modal-body</td>
- <td></td>
- </tr>
- <tr>
- <td>type</td>
- <td>select-dashboard-owner</td>
- <td>cannot_share</td>
- </tr>
- <tr>
- <td>click</td>
- <td>save-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForVisible</td>
- <td>css=div.modal-body > p.error</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForText</td>
- <td>css=div.modal-body > p.error</td>
- <td>glob:*User cannot own this dashboard because of insufficient rights*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>change-shared-project-dashboard-owner</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sessions/logout</td>
- <td></td>
- </tr>
- <tr>
- <td>open</td>
- <td>/sessions/new</td>
- <td></td>
- </tr>
- <tr>
- <td>type</td>
- <td>login</td>
- <td>admin</td>
- </tr>
- <tr>
- <td>type</td>
- <td>password</td>
- <td>admin</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>commit</td>
- <td></td>
- </tr>
- <tr>
- <td>open</td>
- <td>/dashboards?resource=sample</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>create-link-dashboard</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForVisible</td>
- <td>css=div.modal-body</td>
- <td></td>
- </tr>
- <tr>
- <td>type</td>
- <td>name</td>
- <td>shared-project-dashboard</td>
- </tr>
- <tr>
- <td>storeValue</td>
- <td>name</td>
- <td>DASHBOARD_NAME</td>
- </tr>
- <tr>
- <td>click</td>
- <td>name=shared</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>save-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForVisible</td>
- <td>edit-${DASHBOARD_NAME}</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>edit-${DASHBOARD_NAME}</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForVisible</td>
- <td>css=div.modal-body</td>
- <td></td>
- </tr>
- <tr>
- <td>type</td>
- <td>select-dashboard-owner</td>
- <td>can_share</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>save-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForText</td>
- <td>dashboards</td>
- <td>glob:*can_share*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>edit-project-dashboards</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <thead>
- <tr>
- <td rowspan="1" colspan="3">edit-project-dashboards</td>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>open</td>
- <td>/sessions/login</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>login</td>
- <td>admin</td>
-</tr>
-<tr>
- <td>type</td>
- <td>password</td>
- <td>admin</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>commit</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/dashboards?resource=sample</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>create-link-dashboard</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVisible</td>
- <td>css=div.modal-head > h2</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>name=name</td>
- <td>Project Shared</td>
-</tr>
-<tr>
- <td>click</td>
- <td>name=shared</td>
- <td></td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>id=save-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>create-link-dashboard</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVisible</td>
- <td>css=div.modal-head > h2</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>name=name</td>
- <td>Project Not Shared</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>id=save-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForTextPresent</td>
- <td>My Project Dashboards</td>
- <td></td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>id=unfollow-Project%20Shared</td>
- <td></td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>id=unfollow-Project%20Not%20Shared</td>
- <td></td>
-</tr>
-<tr>
- <td>assertTable</td>
- <td>id=shared-dashboards.1.0</td>
- <td>Project Not Shared</td>
-</tr>
-<tr>
- <td>assertTable</td>
- <td>id=shared-dashboards.2.0</td>
- <td>Project Shared</td>
-</tr>
-<tr>
- <td>assertElementPresent</td>
- <td>id=follow-Project%20Shared</td>
- <td></td>
-</tr>
-<tr>
- <td>assertElementPresent</td>
- <td>id=follow-Project%20Not%20Shared</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=edit-Project%20Shared</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVisible</td>
- <td>css=div.modal-head > h2</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>name=description</td>
- <td>Description Shared</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>id=save-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForTextPresent</td>
- <td>Description Shared</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=edit-Project%20Not%20Shared</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVisible</td>
- <td>css=div.modal-head > h2</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>name=description</td>
- <td>Description Not Shared</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>id=save-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForTextPresent</td>
- <td>Description Not Shared</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=delete-Project%20Shared</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVisible</td>
- <td>css=div.modal-head > h2</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>css=.modal-body</td>
- <td>Do you want to delete this dashboard?</td>
-</tr>
-<tr>
- <td>click</td>
- <td>confirm-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForElementNotPresent</td>
- <td>confirm-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVisible</td>
- <td>delete-Project%20Not%20Shared</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>delete-Project%20Not%20Shared</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVisible</td>
- <td>css=div.modal-head > h2</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>css=.modal-body</td>
- <td>Do you want to delete this dashboard?</td>
-</tr>
-<tr>
- <td>click</td>
- <td>confirm-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForElementNotPresent</td>
- <td>confirm-submit</td>
- <td></td>
-</tr>
-</tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sessions/new</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>login</td>
- <td>admin</td>
-</tr>
-<tr>
- <td>type</td>
- <td>password</td>
- <td>admin</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>commit</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/dashboards/index?resource=sample</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>dashboards</td>
- <td>glob:*Custom*</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>id=unfollow-Custom</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>shared-dashboards</td>
- <td>glob:*Custom*</td>
-</tr>
-<tr>
- <td>assertNotText</td>
- <td>dashboards</td>
- <td>glob:*Custom*</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>id=follow-Custom</td>
- <td></td>
-</tr>
-<tr>
- <td>assertNotText</td>
- <td>shared-dashboards</td>
- <td>glob:*Custom*</td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>dashboards</td>
- <td>glob:*Custom*</td>
-</tr>
-</tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sessions/new</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>login</td>
- <td>admin</td>
-</tr>
-<tr>
- <td>type</td>
- <td>password</td>
- <td>admin</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>commit</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/dashboards/index?resource=sample</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>create-link-dashboard</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVisible</td>
- <td>css=div.modal-head > h2</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>name=name</td>
- <td>IsDefault</td>
-</tr>
-<tr>
- <td>click</td>
- <td>name=shared</td>
- <td></td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>save-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/admin_dashboards/index</td>
- <td></td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>id=add-IsDefault</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>activeProject</td>
- <td>glob:*IsDefault*</td>
-</tr>
-<tr>
- <td>open</td>
- <td>/dashboards/index?resource=sample</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>edit-IsDefault</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVisible</td>
- <td>css=div.modal-head > h2</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>name=shared</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>save-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVisible</td>
- <td>css=div.modal-body > p.error</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>css=div.modal-body > p.error</td>
- <td>glob:*This dashboard can't be unshared*</td>
-</tr>
-<tr>
- <td>click</td>
- <td>save-cancel</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=delete-IsDefault</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVisible</td>
- <td>css=div.modal-head > h2</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>css=div.modal-body</td>
- <td>Do you want to delete this dashboard?</td>
-</tr>
-<tr>
- <td>click</td>
- <td>confirm-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVisible</td>
- <td>css=div.modal-body .alert-danger</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>css=div.modal-body .alert-danger</td>
- <td>glob:*This dashboard can't be deleted*</td>
-</tr>
-<tr>
- <td>open</td>
- <td>/admin_dashboards/index</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=remove-IsDefault</td>
- <td></td>
-</tr>
-<tr>
- <td>assertConfirmation</td>
- <td>Are you sure to remove it from default dashboards?</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/dashboards/index?resource=sample</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=delete-IsDefault</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVisible</td>
- <td>css=div.modal-head > h2</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>css=div.modal-body</td>
- <td>Do you want to delete this dashboard?</td>
-</tr>
-<tr>
- <td>click</td>
- <td>confirm-submit</td>
- <td></td>
-</tr>
-</tbody>
-</table>
-</body>
-</html>
return window.baseUrl + '/overview' + dashboardKey + '?id=' + encodeURIComponent(componentKey);
}
-/**
- * Generate URL for a component's dashboards management page
- * @param {string} componentKey
- * @returns {string}
- */
-export function getComponentDashboardManagementUrl (componentKey) {
- return window.baseUrl + '/dashboards?resource=' + encodeURIComponent(componentKey);
-}
-
/**
* Generate URL for a component's permissions page
* @param {string} componentKey
import _ from 'underscore';
import classNames from 'classnames';
import React from 'react';
-
import LinksMixin from '../links-mixin';
import { translate, getLocalizedDashboardName } from '../../../helpers/l10n';
import {
getComponentDashboardUrl,
- getComponentFixedDashboardUrl,
- getComponentDashboardManagementUrl
+ getComponentFixedDashboardUrl
} from '../../../helpers/urls';
const SETTINGS_URLS = [
isCustomDashboardsActive () {
const dashboards = this.props.component.dashboards;
return _.any(dashboards, this.isCustomDashboardActive) ||
- this.isDashboardManagementActive() ||
this.isDefaultDeveloperDashboardActive();
},
return this.isDeveloper() && path.indexOf(window.baseUrl + '/dashboard') === 0;
},
- isDashboardManagementActive () {
- const path = window.location.pathname;
- return path.indexOf(window.baseUrl + '/dashboards') === 0;
- },
-
renderOverviewLink() {
const url = getComponentFixedDashboardUrl(this.props.component.key, '');
const name = <i className="icon-home"/>;
renderCustomDashboards() {
const dashboards = this.props.component.dashboards.map(this.renderCustomDashboard);
const className = classNames('dropdown', { active: this.isCustomDashboardsActive() });
- const managementLink = this.renderDashboardsManagementLink();
return <li className={className}>
<a className="dropdown-toggle" data-toggle="dropdown" href="#">
{translate('layout.dashboards')}
</a>
<ul className="dropdown-menu">
{dashboards}
- {managementLink && <li className="divider"/>}
- {managementLink}
</ul>
</li>;
},
- renderDashboardsManagementLink() {
- if (!window.SS.user) {
- return null;
- }
- const key = 'dashboard-management';
- const url = getComponentDashboardManagementUrl(this.props.component.key);
- const name = translate('dashboard.manage_dashboards');
- const className = classNames('pill-right', { active: this.isDashboardManagementActive() });
- return <li key={key} className={className}>
- <a className="note" href={url}>{name}</a>
- </li>;
- },
-
renderCodeLink() {
if (this.isDeveloper()) {
return null;
before_filter :login_required
def index
- @global = !params[:resource]
+ @global = true
@actives=ActiveDashboard.user_dashboards(current_user, @global)
@shared_dashboards=Dashboard.all(:conditions => ['(shared=? or user_id=?) and is_global=?', true, current_user.id, @global])
active_ids=@actives.map(&:dashboard_id)
@shared_dashboards.reject! { |d| active_ids.include?(d.id) }
@shared_dashboards=Api::Utils.insensitive_sort(@shared_dashboards, &:name)
-
- if params[:resource]
- @resource=Project.by_key(params[:resource])
- if @resource.nil?
- # TODO display error page
- redirect_to home_path
- return false
- end
- access_denied unless has_role?(:user, @resource)
- @snapshot = @resource.last_snapshot
- @project=@resource # variable name used in old widgets
- end
end
def create_form
- @global = !params[:resource]
+ @global = true
@dashboard = Dashboard.new
- render :partial => 'create_form', :resource => params[:resource]
+ render :partial => 'create_form'
end
def create
verify_post_request
- @global = !params[:resource]
+ @global = true
@dashboard = Dashboard.new()
@dashboard.user_id = current_user.id
load_dashboard_from_params(@dashboard)
active_dashboard = current_user.active_dashboards.to_a.find { |ad| ad.name==@dashboard.name }
if active_dashboard
@dashboard.errors.add_to_base(Api::Utils.message('dashboard.error_create_existing_name'))
- render :partial => 'dashboards/create_form', :status => 400, :resource => params[:resource]
+ render :partial => 'dashboards/create_form', :status => 400
elsif @dashboard.save
add_default_dashboards_if_first_user_dashboard(@dashboard.global?)
last_index=current_user.active_dashboards.max_by(&:order_index).order_index
current_user.active_dashboards.create(:dashboard => @dashboard, :user => current_user, :order_index => (last_index+1))
render :text => CGI.escapeHTML(params[:resource]), :highlight => @dashboard.id, :status => 200
else
- render :partial => 'dashboards/create_form', :status => 400, :resource => params[:resource]
+ render :partial => 'dashboards/create_form', :status => 400
end
end
def edit_form
@dashboard = Dashboard.find(params[:id])
if @dashboard.editable_by?(current_user)
- render :partial => 'edit_form', :resource => params[:resource]
+ render :partial => 'edit_form'
else
access_denied
end
render :text => CGI.escapeHTML(params[:resource]), :status => 200
else
@dashboard.user = dashboard_owner
- render :partial => 'dashboards/edit_form', :status => 400, :resource => params[:resource]
+ render :partial => 'dashboards/edit_form', :status => 400
end
else
access_denied
def delete_form
@dashboard = Dashboard.find(params[:id])
if @dashboard.editable_by?(current_user)
- render :partial => 'delete_form', :resource => params[:resource]
+ render :partial => 'delete_form'
else
access_denied
end
render :text => CGI.escapeHTML(params[:resource]), :status => 200
else
@dashboard.errors.add(message('dashboard.error_delete_default'), ' ')
- render :partial => 'dashboards/delete_form', :status => 400, :resource => params[:resource]
+ render :partial => 'dashboards/delete_form', :status => 400
end
end
current_user.active_dashboards.create(:dashboard => dashboard, :user => current_user, :order_index => (last_active_dashboard ? last_active_dashboard.order_index+1 : 1))
end
- redirect_to :action => 'index', :resource => params[:resource]
+ redirect_to :action => 'index'
end
def unfollow
flash[:notice]=Api::Utils.message('dashboard.default_restored')
end
- redirect_to :action => 'index', :resource => params[:resource]
+ redirect_to :action => 'index'
end
end
end
- redirect_to :action => 'index', :resource => params[:resource]
+ redirect_to :action => 'index'
end
def load_dashboard_from_params(dashboard)
</tr>
<% else
@shared_dashboards.each do |dashboard| %>
- <% resource_id = @resource.id if @resource %>
<tr id="dashboard-<%= dashboard.id -%>" class="<%= cycle('even', 'odd', :name => 'shared') -%>">
<td>
- <%= link_to h(dashboard.name(true)), {:controller => :dashboard, :action => :index, :did => dashboard.id, :id => (resource_id unless dashboard.global?)},
+ <%= link_to h(dashboard.name(true)), {:controller => :dashboard, :action => :index, :did => dashboard.id},
:id => "view-#{u dashboard.name}" %>
<div class="description"><%= h dashboard.description -%></div>
</td>
<form id="create-dashboard-form" method="post" action="<%= ApplicationController.root_context -%>/dashboards/create">
- <% if @global %>
- <input type="hidden" name="global" value="true" />
- <% else %>
- <input type="hidden" name="resource" value="<%= h params[:resource] %>"/>
- <% end %>
+ <input type="hidden" name="global" value="true" />
<fieldset>
<div class="modal-head">
<h2><%= message('dashboard.new_dashboard') -%></h2>
<script>
$j("#create-dashboard-form").modalForm({success: function (data) {
- var contextParams = data.trim().length > 0 ? '?resource=' + data.trim() : '';
- window.location = window.baseUrl + '/dashboards' + contextParams;
+ window.location = window.baseUrl + '/dashboards';
}});
</script>
-
<td class="thin nowrap text-right">
- <% resource_id = @resource.id if @resource %>
<% if dashboard.editable_by?(current_user) %>
- <%= link_to message('dashboard.configure_widgets'), {:controller => :dashboard, :action => :configure, :did => dashboard.id, :id => (resource_id unless dashboard.global?)},
+ <%= link_to message('dashboard.configure_widgets'), {:controller => :dashboard, :action => :configure, :did => dashboard.id},
:id => "configure-#{u dashboard.name}", :class => 'link-action' %>
- <%= link_to message('edit'), {:action => :edit_form, :id => dashboard.id, :resource => resource_id},
+ <%= link_to message('edit'), {:action => :edit_form, :id => dashboard.id},
:id => "edit-#{u dashboard.name}", :class => 'open-modal' %>
<% if can_be_disabled %>
- <%= link_to message('delete'), {:action => :delete_form, :id => dashboard.id, :resource => resource_id},
+ <%= link_to message('delete'), {:action => :delete_form, :id => dashboard.id},
:id => "delete-#{u dashboard.name}", :class => 'open-modal text-danger' %>
<% end %>
<% end %>
<% if can_be_disabled %>
- <%= link_to message(subscription_action), {:action => subscription_action.to_sym, :id => dashboard.id, :resource => resource_id}, :method => :post,
+ <%= link_to message(subscription_action), {:action => subscription_action.to_sym, :id => dashboard.id}, :method => :post,
:id => "#{subscription_action}-#{u dashboard.name}" %>
<% end %>
</td>
<form id="delete-dashboard-form" method="post" action="<%= ApplicationController.root_context -%>/dashboards/delete">
<input type="hidden" name="id" value="<%= @dashboard.id -%>">
- <% if @dashboard.global %>
- <input type="hidden" name="global" value="true" />
- <% else %>
- <input type="hidden" name="resource" value="<%= h(params[:resource]) %>"/>
- <% end %>
+ <input type="hidden" name="global" value="true" />
<fieldset>
<div class="modal-head">
<h2><%= message 'dashboard.delete_confirm_title' -%></h2>
<script>
$j("#delete-dashboard-form").modalForm({success: function (data) {
- var contextParams = data.trim().length > 0 ? '?resource=' + data.trim() : '';
- window.location = window.baseUrl + '/dashboards' + contextParams;
+ window.location = window.baseUrl + '/dashboards';
}});
</script>
<form id="edit-dashboard-form" method="post" action="<%= ApplicationController.root_context -%>/dashboards/update">
<input type="hidden" name="id" value="<%= @dashboard.id -%>">
- <% if @dashboard.global %>
- <input type="hidden" name="global" value="true" />
- <% else %>
- <input type="hidden" name="resource" value="<%= h(params[:resource]) %>"/>
- <% end %>
+ <input type="hidden" name="global" value="true" />
<fieldset>
<div class="modal-head">
<h2><%= message('dashboard.edit_dashboard') -%></h2>
<script>
$j("#edit-dashboard-form").modalForm({success: function (data) {
- var contextParams = data.trim().length > 0 ? '?resource=' + data.trim() : '';
- window.location = window.baseUrl + '/dashboards' + contextParams;
+ window.location = window.baseUrl + '/dashboards';
}});
</script>
</tr>
<% else %>
<% @actives.map(&:dashboard).each_with_index do |dashboard, index| %>
- <% resource_id = @resource.id if @resource %>
<tr id="dashboard-<%= dashboard.id -%>" class="<%= cycle('even', 'odd', :name => 'dashboard') -%>">
<td>
- <%= link_to h(dashboard.name(true)), {:controller => :dashboard, :action => :index, :did => dashboard.id, :id => (resource_id unless dashboard.global?)},
+ <%= link_to h(dashboard.name(true)), {:controller => :dashboard, :action => :index, :did => dashboard.id},
:id => "view-#{u dashboard.name}" %>
<div class="description"><%= h dashboard.description -%></div>
</td>
</td>
<td class="order">
<% if index > 0 %>
- <%= link_to '', {:action => :up, :id => dashboard.id, :resource => resource_id}, :method => :post, :id => "up-#{u dashboard.name}", :class => "icon-move-up" %>
+ <%= link_to '', {:action => :up, :id => dashboard.id}, :method => :post, :id => "up-#{u dashboard.name}", :class => "icon-move-up" %>
<% else %>
<%= image_tag('transparent_16.gif') %>
<% end %>
<% if index < @actives.size-1 %>
- <%= link_to '', {:action => :down, :id => dashboard.id, :resource => resource_id}, :method => :post, :id => "down-#{u dashboard.name}", :class => "icon-move-down" %>
+ <%= link_to '', {:action => :down, :id => dashboard.id}, :method => :post, :id => "down-#{u dashboard.name}", :class => "icon-move-down" %>
<% else %>
<%= image_tag('transparent_16.gif') %>
<% end %>
</li>
</ul>
- <h1><%= message(@global ? 'dashboard.my_global_dashboards' : 'dashboard.my_project_dashboards') -%></h1>
+ <h1><%= message('dashboard.my_global_dashboards') -%></h1>
<%= render_partial :partial => 'my_dashboards', :locals => { :is_admin => is_admin? } %>
<h1><%= message('dashboard.available_dashboards') -%></h1>