Mark VanLandingham 30fe9289b8 Allow groups to access queries (#36)
* [WIP] group ids saving on new reports

* Add groups to default queries, and added tab connector

* group_ids set to empty array for default queries

* group reports route (in & and) action

* [WIP] created group reports show route/controller

* Find correct query in show route

* Removed empty array for group_ids in query file

* Add report show view, where users can run queries

* Removed unneeded commas from queries.rb

* Allow non-admin group members to access reports

* query-result component dynamic download url based on location

* Removed accidental changes, and corrected tab size

* Group members can add params to queries

* Specs for new QueryController actions

* remove "Inlude query plan" from group reports

* Run prettier

* return and return -> return render

Co-Authored-By: Robin Ward <robin.ward@gmail.com>

* [WIP] changes from review

* Remove weird [-1] group_ids logic, for a simply check for [] in query update action

* Added integration tests for group report access

* Using guardian for securing endpoints, and much improved specs

* Update assets/javascripts/discourse/components/group-reports-nav-item.js.es6

Co-Authored-By: Robin Ward <robin.ward@gmail.com>
2019-09-11 10:09:41 -04:00

401 lines
6.6 KiB
SCSS

table.group-reports {
width: 100%;
table-layout: fixed;
th:first-child {
width: 30%;
}
th:nth-child(2) {
width: 60%;
}
th:last-child {
width: 20%;
text-align: right;
}
tbody {
border-top: 3px solid #e3ebf2;
tr {
border-bottom: 1px solid #e3ebf2;
td {
color: #7499bd;
padding: 0.8em 0.5em;
}
td:first-child {
font-size: 16px;
}
td:last-child {
text-align: right;
}
}
}
}
.https-warning {
color: $danger;
}
.query-editor {
margin-bottom: 15px;
.panels-flex {
display: flex;
height: 400px;
border: 1px solid $primary-very-low;
}
&.no-schema {
.editor-panel {
width: 100%;
}
.right-panel {
width: 0;
button.unhide {
position: absolute;
margin-left: -53px;
z-index: 1;
}
.schema {
display: none;
}
}
}
.editor-panel {
flex-grow: 1;
.ace-wrapper {
position: relative;
height: 100%;
width: 100%;
}
.ace_editor {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
}
.right-panel {
flex-shrink: 0;
flex-grow: 0;
width: 300px;
.schema {
border-left: 1px solid $primary-low;
height: 100%;
overflow-y: scroll;
overflow-x: hidden;
color: $primary-high;
font-size: $font-down-2;
input {
padding: 4px;
margin: 3px;
// 100% - padding + margin * 2 - border - button - buttonborder
width: calc(100% - 14px - 1px - 40px - 2px);
}
.schema-table-name {
font-weight: bold;
border-bottom: 1px solid $primary-low;
padding-left: 5px;
.fa {
width: 6px;
}
}
ul {
list-style-type: none;
margin: 0;
}
dl {
margin: 0;
}
dl > div > * {
padding-top: 2px;
padding-bottom: 2px;
}
dl > div {
clear: both;
}
dt {
display: inline-block;
vertical-align: text-top;
overflow-wrap: break-word;
width: 110px;
margin-left: 5px;
&.sensitive {
color: $danger;
}
}
dd {
display: inline-block;
vertical-align: text-top;
width: 110px;
color: $tertiary;
margin: 0;
padding-left: 7px;
border-left: 1px dotted $primary-low-mid;
.schema-typenotes {
color: $primary-medium;
font-style: italic;
}
.popup-info {
color: $primary-medium;
.popup {
display: none;
}
&:hover .popup {
display: block;
}
&:focus .popup {
display: block;
}
.popup {
padding: 4px;
position: relative;
border: 1px solid;
background: $secondary;
padding-right: calc(5px + 0.5em);
}
.popup ol {
padding: 0px;
position: relative;
list-style: none;
> li:before {
content: attr(value) ": ";
}
}
}
}
}
}
.grippie {
cursor: nwse-resize;
clear: both;
font-size: $font-down-2;
-webkit-user-select: none;
color: $primary;
text-align: right;
background: $primary-very-low;
border: 1px solid $primary-very-low;
.d-icon {
transform: rotate(90deg);
}
}
}
.query-edit {
.name {
display: flex;
align-items: center;
margin-bottom: 1em;
h1 {
display: inline-block;
margin: 0 0.5em 0 0;
color: $primary;
a {
color: currentColor;
}
}
}
button.previous {
margin-right: 0.5em;
.d-icon {
margin-left: -0.15em; // fixing fontawesome horizontal alignment
}
}
.name-text-field {
width: 100%;
}
.name input,
.desc textarea {
width: 100%;
box-sizing: border-box;
margin: 0;
}
&:not(.editing) .desc {
margin: 10px 0;
}
.groups {
margin-bottom: 10px;
.label {
margin-right: 10px;
color: $primary-high;
}
.name {
display: inline;
}
}
}
.query-run {
margin-top: 25px;
.query-plan {
display: inline-block;
margin-left: 15px;
}
}
.clear {
clear: both;
}
.schema-title {
display: block;
margin: auto;
}
.query-params {
border: 1px solid $header_primary-medium;
.param > input {
margin: 9px;
}
.invalid > input {
background-color: $danger-low;
}
.invalid .ac-wrap {
background-color: $danger-low;
}
.param {
width: 300px;
display: inline-block;
overflow-x: visible;
.ac-wrap {
display: inline-block;
input {
width: 100px !important; // override an inline style
}
}
input {
width: 190px;
}
}
.param-name {
display: inline-block;
width: 70px;
}
}
.query-list,
.query-create,
.query-edit,
.query-results,
.query-params,
.https-warning {
margin: 10px 0;
}
.query-results {
table {
width: 100%;
margin-top: 10px;
td {
padding: 8px;
}
}
}
.query-list {
display: flex;
max-height: 30px;
.btn-left {
margin-right: 0.5em;
}
.btn-right {
margin-left: auto;
margin-right: 0.5em;
}
li.none {
display: none;
}
}
.recent-queries {
thead {
.created-by {
width: 15%;
}
.group-names {
width: 15%;
.group-names-header {
position: absolute;
bottom: 8px;
left: 6px;
}
}
.created-at {
width: 15%;
}
.heading {
position: relative;
color: $primary-medium;
padding: 50px 0px 0px 0px;
th.sortable {
font-weight: normal;
}
.heading-toggle {
bottom: 0;
position: absolute;
display: inline-block;
}
}
}
.query-row {
a {
width: 100%;
}
.query-name {
color: $primary;
}
.query-desc {
display: block;
color: $primary-high;
}
.query-created-by {
color: $primary-high;
}
.query-group-names {
color: $primary-high;
}
.query-created-at {
color: $primary-medium;
}
}
.query-row:hover {
background-color: inherit;
}
tr a {
color: inherit;
cursor: pointer;
display: inline-block;
}
.no-search-results {
color: $primary-medium;
}
}
.result-info {
float: left;
}
.result-about {
color: $primary-high;
float: right;
}
.result-explain {
padding-top: 1em;
margin-bottom: 0px;
}
.result-post-link {
display: block;
color: inherit !important;
}
.explorer-pad-bottom {
margin-bottom: 200px;
}