Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

731 multiple support queues #67

Merged
merged 28 commits into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4da1c42
Release 2022.4.4
whorka Apr 6, 2022
338bab9
Merge branch 'canary' into stable
whorka Apr 6, 2022
4bda905
Release 2022.4.5
whorka Apr 6, 2022
7e5f003
Merge branch 'canary' into stable
whorka Apr 6, 2022
26324eb
Release 2022.4.6
whorka Apr 6, 2022
3e8403c
Merge branch 'canary' into stable
whorka Apr 7, 2022
4adc9a0
Release 2022.4.7
whorka Apr 7, 2022
5ac8236
Merge branch 'canary' into stable
whorka Apr 7, 2022
96180f4
Release 2022.4.8
whorka Apr 7, 2022
05a6ef7
Merge branch 'canary' into stable
whorka Apr 7, 2022
8c3224e
fix(build): gh #698 manually clean up CHANGELOG.md
whorka Apr 7, 2022
c0ead9d
Release 2022.4.9
whorka Apr 7, 2022
4f7b0e8
fix(build): gh #698 manually clean up CHANGELOG.md
whorka Apr 8, 2022
a5536ec
Release 2022.4.10
whorka Apr 8, 2022
59b11c3
Merge branch 'canary' into stable
abujeda Apr 19, 2022
ef6ddbf
Release 2022.4.11
Apr 19, 2022
94070a7
Merge branch 'canary' into stable
whorka Apr 27, 2022
f04615c
Release 2022.4.12
whorka Apr 27, 2022
06d1333
Merge branch 'canary' into stable
whorka May 6, 2022
eb1c552
Release 2022.5.1
whorka May 6, 2022
09318d1
fix(dashboard): make verify_ssl=true by default for RT client, and re…
whorka May 17, 2022
742eea2
feat(dashboard): gh #731 support specifying more than one queue in RT…
whorka May 17, 2022
a0655cb
feat(dashboard): gh #731 allow selecting between multiple support tic…
whorka May 19, 2022
15b63b1
feat(testing): gh #731 direct automated testing tickets to the Intern…
whorka May 19, 2022
f02fbd8
fix(testing): gh #731 skip the entirety of the support ticket test if…
whorka May 20, 2022
5518434
fix(dashboard): gh #731 add more logging and validation of queue sele…
whorka May 23, 2022
1653517
fix(dashboard): gh #731 move queue param from RequestTrackerService t…
whorka May 23, 2022
fc2982f
fix(dashboard): gh #731 removed alternative queue from local rt_confi…
abujeda May 23, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,99 @@
## [2022.5.1](https://github.com/hmdc/sid2/compare/2022.4.12...2022.5.1) (2022-05-06)



## [2022.5.1-dev.1](https://github.com/hmdc/sid2/compare/2022.4.12...2022.5.1) (2022-05-06)


### Bug Fixes

* **testing:** gh [#706](https://github.com/hmdc/sid2/issues/706) Run Cypress tests using command line tool ([#65](https://github.com/hmdc/sid2/issues/65)) ([d49b400](https://github.com/hmdc/sid2/commit/d49b400ebe6e689a37514e0dfec83335e25ccf0d))

## [2022.4.12](https://github.com/hmdc/sid2/compare/2022.4.11...2022.4.12) (2022-04-27)



## [2022.4.26-dev.1](https://github.com/hmdc/sid2/compare/2022.4.11...2022.4.12) (2022-04-20)


### Features

* **dashboard:** gh [#660](https://github.com/hmdc/sid2/issues/660) Re-add session terminate session feature with race condition fix ([#64](https://github.com/hmdc/sid2/issues/64)) ([264bbb2](https://github.com/hmdc/sid2/commit/264bbb24371da4da1d8d5ce840712dd4599af856))



## [2022.4.25-dev.1](https://github.com/hmdc/sid2/compare/2022.4.11...2022.4.12) (2022-04-20)


### Reverts

* Revert "feat(dashboard): gh #660 Added terminate session feature (#60)" (#63) ([aa8f4c9](https://github.com/hmdc/sid2/commit/aa8f4c901ff1f8a39b135d8b3dccdf4caf75cecf)), closes [#660](https://github.com/hmdc/sid2/issues/660) [#60](https://github.com/hmdc/sid2/issues/60) [#63](https://github.com/hmdc/sid2/issues/63)



## [2022.4.24-dev.1](https://github.com/hmdc/sid2/compare/2022.4.11...2022.4.12) (2022-04-19)


### Features

* **dashboard:** gh [#660](https://github.com/hmdc/sid2/issues/660) Added terminate session feature ([#60](https://github.com/hmdc/sid2/issues/60)) ([4bfa1ed](https://github.com/hmdc/sid2/commit/4bfa1ed3ba57645a8b344384e5334a1d4abe77c6))

## [2022.4.11](https://github.com/hmdc/sid2/compare/2022.4.10...2022.4.11) (2022-04-19)



## [2022.4.23-dev.1](https://github.com/hmdc/sid2/compare/2022.4.10...2022.4.11) (2022-04-19)


### Bug Fixes

* **build:** gh [#698](https://github.com/hmdc/sid2/issues/698) empty commit for QA ([#61](https://github.com/hmdc/sid2/issues/61)) ([76474f0](https://github.com/hmdc/sid2/commit/76474f085c4adf3e18da1d332e5d118a4302f1d6))



## [2022.4.22-dev.1](https://github.com/hmdc/sid2/compare/2022.4.10...2022.4.11) (2022-04-11)


### Bug Fixes

* **build:** gh [#669](https://github.com/hmdc/sid2/issues/669) Added check to run automated tests only when previous build succeeds ([d1b3e87](https://github.com/hmdc/sid2/commit/d1b3e874f89ca193a94c91b791d8bd8827a2823e))



## [2022.4.21-dev.1](https://github.com/hmdc/sid2/compare/2022.4.10...2022.4.11) (2022-04-11)


### Bug Fixes

* **build:** gh [#669](https://github.com/hmdc/sid2/issues/669) empty commit to test ci ([00b0e8d](https://github.com/hmdc/sid2/commit/00b0e8d950d220d5ed636a95a7209260a5038123))



## [2022.4.20-dev.1](https://github.com/hmdc/sid2/compare/2022.4.10...2022.4.11) (2022-04-11)


### Bug Fixes

* **build:** gh [#669](https://github.com/hmdc/sid2/issues/669) Fixed typo on automated tests GitHub action yaml ([e7524ab](https://github.com/hmdc/sid2/commit/e7524ab5e2f97b7ee9281db4a7e6ead5785c64c9))



## [2022.4.19-dev.1](https://github.com/hmdc/sid2/compare/2022.4.10...2022.4.11) (2022-04-08)


### Bug Fixes

* **build:** gh [#698](https://github.com/hmdc/sid2/issues/698) manually clean up CHANGELOG-dev.md ([22a12d5](https://github.com/hmdc/sid2/commit/22a12d5d1c9865284563046f655c09f800da2b0e))



## [2022.4.18-dev.1](https://github.com/hmdc/sid2/compare/2022.4.10...2022.4.11) (2022-04-08)


### Bug Fixes

* **testing:** gh [#669](https://github.com/hmdc/sid2/issues/669) Fixed failing automated tests + Added to github release process ([#58](https://github.com/hmdc/sid2/issues/58)) ([d5c920c](https://github.com/hmdc/sid2/commit/d5c920cfc998e164fc7239a1ec777444224fbd77))

## [2022.4.10](https://github.com/hmdc/sid2/compare/2022.4.9...2022.4.10) (2022-04-08)


Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2022.4.10
2022.5.1
3 changes: 2 additions & 1 deletion automated-testing/cypress.env.json.prod-cannon
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
{"token": "Stata", "name": "Stata"},
{"token": "SAS", "name": "SAS"},
{"token": "Matlab", "name": "Matlab"}
]
],
"support_ticket": {"creationEnabled": true, "queue": "Internal:Logging"}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but since these are site-specific values, I prefer that they go in configuration files.

}
3 changes: 2 additions & 1 deletion automated-testing/cypress.env.json.prod-fasse
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
{"token": "Stata", "name": "Stata"},
{"token": "SAS", "name": "SAS"},
{"token": "Matlab", "name": "Matlab"}
]
],
"support_ticket": {"creationEnabled": true, "queue": "Internal:Logging"}
}
2 changes: 1 addition & 1 deletion automated-testing/cypress.env.json.remote-dev
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
{"token": "SAS", "name": "SAS"},
{"token": "Matlab", "name": "Matlab"}
],
"support_ticket": {"creationEnabled": false}
"support_ticket": {"creationEnabled": true, "queue": "Internal:Logging"}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

creation enabled in remote-dev will require the production rt_config file to be added manually to the dashboard folder before deploying.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is documented in detail here, which is referred to here.

}
3 changes: 2 additions & 1 deletion automated-testing/cypress.env.json.staging-cannon
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
{"token": "Stata", "name": "Stata"},
{"token": "SAS", "name": "SAS"},
{"token": "Matlab", "name": "Matlab"}
]
],
"support_ticket": {"creationEnabled": true, "queue": "Internal:Logging"}
}
3 changes: 2 additions & 1 deletion automated-testing/cypress.env.json.staging-fasse
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
{"token": "Stata", "name": "Stata"},
{"token": "SAS", "name": "SAS"},
{"token": "Matlab", "name": "Matlab"}
]
],
"support_ticket": {"creationEnabled": true, "queue": "Internal:Logging"}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,32 @@ describe('Sid Dashboard - Support Ticket', () => {
cy.get('div#cc_error').invoke('text').should('match', /the cc format is invalid. expected a valid email/i)
})

it('Should create support ticket', () => {
it('Should show queue field validation errors', () => {
cy.visit(`${rootPath}/support`, { auth })
// Submit an otherwise-valid form
cy.get('form#new_support_ticket input#email').type('[email protected]')
cy.get('form#new_support_ticket input#subject').type('TEST: Sid automated test')
cy.get('form#new_support_ticket input#queue').then(elem => {
elem.val('Not_A_Queue')
})
cy.get('form#new_support_ticket input[type="submit"]').click()
cy.task('log', `Support Ticket creationEnabled=${supportTicket.creationEnabled}`)

cy.get('div.alert-danger').contains(/invalid queue selection/i).should($messageElement => {
expect($messageElement.text()).to.match(/invalid queue selection/i)
})
})

it('Should create support ticket', () => {
cy.task('log', `Support Ticket creationEnabled=${supportTicket.creationEnabled} queue=${supportTicket.queue}`)

if (supportTicket.creationEnabled) {
cy.visit(`${rootPath}/support`, { auth })
cy.get('form#new_support_ticket input#email').type('[email protected]')
cy.get('form#new_support_ticket input#subject').type('TEST: Sid automated test')
cy.get('form#new_support_ticket input#queue').then(elem => {
elem.val(supportTicket.queue)
})
cy.get('form#new_support_ticket input[type="submit"]').click()
cy.get('div.alert-success').should($messageElement => {
//GENERIC MESSAGE IS DISPLAYED
expect($messageElement.text()).to.match(/support ticket created/i)
Expand All @@ -81,4 +99,4 @@ describe('Sid Dashboard - Support Ticket', () => {

})

})
})
3 changes: 2 additions & 1 deletion automated-testing/cypress/support/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ cy.sid = {
// SPECIFIC CONFIG FOR SUPPORT TICKET FEATURE
supportTicket: {
//NOT ALL ENVIRONMENTS SUPPORT TICKET CREATION
creationEnabled: true
creationEnabled: true,
queue: ""
},

// SCREEN RESOLUTIONS => TO TEST IN DIFFERENT SCREEN SIZES
Expand Down
1 change: 0 additions & 1 deletion dashboard/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
/application/public/assets

/deployment/sid_passenger/files/application
/application/config/rt_config.yml
VERSION
84 changes: 45 additions & 39 deletions dashboard/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sid2
# Sid Dashboard for Open OnDemand

## Launching the Sid Dashboard development environment

Expand Down Expand Up @@ -34,7 +34,7 @@ Docker images are used to create the local development environment. Information
### Launching

- Run `make` from checkout. The build process is finished when the `ood` container stops generating output, and the `slurmctld` container goes into an output loop.
- The entire directory/checkout is mapped into the OOD and slurm containers. Changes made to code will immediately reflect within OOD (with the exception of CSS/JS changes which requires a rake, see Caveats.)
- The entire `application` build directory is mapped into the OOD and slurm containers. Changes made to code will immediately reflect within OOD (with the exception of CSS/JS changes which requires a rake, see Caveats.)

### Connecting

Expand Down Expand Up @@ -66,18 +66,23 @@ Docker images are used to create the local development environment. Information

To thoroughly purge your Docker environment, also run `docker volume prune; docker system prune -a` and restart Docker.

## Deploying to remote development (your FASRC account)
## Deploying to remote development

- Run `make remote-dev`. `make remote-dev` builds all required OOD/Ruby libs locally and exports built artifacts to FASRC. This task will prompt you for your FASRC SSH credentials (password and pin) twice as it creates/validates the pre-requisite directory structure as setup in your home directory.
The Sid Dashboard can be deployed to a "remote development" environment, i.e. a directory on an Open OnDemand server that has been [configured to support running development-mode apps](https://osc.github.io/ood-documentation/latest/app-development/enabling-development-mode.html).

The default remote development deployment destination is your home directory on Harvard FASRC Cannon. For detailed deployment instructions see https://wiki.harvard.edu/confluence/display/HMDC/Deploying+Sid2+to+Remote+Dev . Deploying to other Open OnDemand installations will require editing the `Makefile`.

- Run `make remote-dev`. `make remote-dev` builds all required OOD/Ruby libs locally and exports built artifacts to the remote development server. This task will prompt you for your SSH credentials (password and pin) twice as it creates/validates the pre-requisite directory structure as setup in your home directory.

- Once completed, visit:
## Support Ticket Feature

https://vdi.rc.fas.harvard.edu
The Sid Dashboard supports creating tickets in Request Tracker using a simple point-and-click interface which collects contextual information about the relevant session and includes it in the ticket.

and go through the same Validation process as for the development environment.
### Ticket attachment limitations

## Support ticket attachments
There are restrictions in place for the attachments. There is client side validation:
There are restrictions in place for the attachments. These limits should be set lower than the limits configured in the Request Tracker server.

There is client side validation:
* Attachment files cannot be bigger than 5MB
* Number of attachment files cannot be bigger than 5
* To update: [application/app/assets/javascripts/support_ticket.js#L6](application/app/assets/javascripts/support_ticket.js#L6)
Expand All @@ -89,50 +94,51 @@ And there is back-end validation:

## RT server configuration

RT is deployed locally using a Docker image. The version of RT is controlled by the version of the Docker image. The versions supported can be found: [https://hub.docker.com/r/netsandbox/request-tracker/](https://hub.docker.com/r/netsandbox/request-tracker/)
To upgrade the RT version, simple update the version in the Docker compose file: [docker-compose.yml](docker-compose.yml)
In the local development environment, RT is deployed using a Docker image. The version of RT is controlled by the version of the Docker image. The versions supported can be found at [https://hub.docker.com/r/netsandbox/request-tracker/](https://hub.docker.com/r/netsandbox/request-tracker/) .

To upgrade the RT version, simply update the version in the Docker compose file: [docker-compose.yml](docker-compose.yml)

```
services:
rt:
image: netsandbox/request-tracker:4.4
```
Configuration file: `config/rt_config.yml`, eg:

Configure the RT client in the file: `application/config/rt_config.yml`, eg:
```
server: "https://rt.iqss.com"
server: "https://rt.example.com"
user: "test"
pass: "password"
auth_token:
timeout: 99
auth_token: "secret"
timeout: 30
verify_ssl: true
proxy: "http://proxy.server.com:8080"
priority: "4"
queue_name: "General"
proxy: "http://proxy.example.com:8080"
priority: 4
queues:
- "General"
- "Incoming"
```

Configuration environment variables:
**WARNING**: The information in the RT client configuration file will be visible to all Sid Dashboard users, so be sure to use an account that does not have privileges to do anything more than what ticket requestors should be allowed to do in RT.

As follows:
- `server`: URL for the RT server (required)
- `user`: RT API username
- `pass`: RT API password
- `auth_token`: RT API [auth token](https://github.com/bestpractical/rt-authen-token), preferred instead of username and password.
- `timeout`: Connection and read timeout in seconds. Defaults to 30.
- `verify_ssl`: Whether or not the client should validate SSL certificates. Defaults to true.
- `proxy`: Proxy server URL. Defaults to no proxy.
- `priority`: The [priority](https://rt-wiki.bestpractical.com/wiki/Priority) for the ticket. Defaults to 4.
- `queues`: An array of the names of the queues from which the user can select to submit a ticket. The first item in the list will be the default selection. Defaults to [ "General" ].

```
RT_SERVER: URL for the RT server, eg: https://rt.iqss.com.
RT_USER: API username.
RT_PASSWORD: API password.
RT_AUTH_TOKEN: API auth token, use instead of username and password.
RT_TIMEOUT: Connection and read timeout in seconds. Defaults to 30
RT_VERIFY_SSL: Whether or not the client should validate SSL certificates. Defaults to false
RT_PROXY: Proxy server URL, eg: http://rt.proxy.com:8080
RT_QUEUE: The name of the queue where tickets will be added to. Defaults to General
RT_PRIORITY: The priority for the ticket. Defaults to 4
```
### RT configuration for remote-dev
To test the support ticket creation in `remote-dev`, we need to configure the RT client. We need to manually add the RT configuration before executing the `remote-dev` deployment.
Create the configuration file `config/rt_config.yml` with the following contents below.
username and password are available in Lastpass
```
server: "https://help.hmdc.harvard.edu"
user: "username"
pass: "password"
queue_name: "IQSS_FASRC_support"
```

To test the support ticket creation in `remote-dev`, we need to manually add the configuration for the RT client before executing the `remote-dev` deployment.

Create the configuration file `application/config/rt_config.yml` with the appropriate credentials for your remote development RT server.

For detailed deployment instructions for Harvard FASRC Cannon, see https://wiki.harvard.edu/confluence/display/HMDC/Deploying+Sid2+to+Remote+Dev .

## Launcher button configuration

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def create

rts = RequestTrackerService.new ::Configuration.request_tracker_config
ticket_id = rts.create_ticket(@support_ticket)
logger.info "action=createSupportTicket result=success user=#{@user} subject=#{@support_ticket.subject} ticket=#{ticket_id}"
logger.info "action=createSupportTicket result=success user=#{@user} subject=#{@support_ticket.subject} ticket=#{ticket_id} queue=#{@support_ticket.queue}"
redirect_to root_url, :flash => { :notice => "Support ticket created - Ticket id: #{ticket_id}" }

rescue => error
Expand Down
2 changes: 1 addition & 1 deletion dashboard/application/app/models/support_ticket.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class SupportTicket
include ActiveModel::Model

attr_accessor :username, :email, :cc, :subject, :session_id, :description, :attachments
attr_accessor :username, :email, :cc, :subject, :session_id, :description, :attachments, :queue
validates :username, :email, :subject, :description, presence: { message: 'is required' }
validates :email, :cc, format: { with: URI::MailTo::EMAIL_REGEXP, allow_blank: true, message: 'format is invalid' }
validates :attachments, attachments: true
Expand Down
20 changes: 15 additions & 5 deletions dashboard/application/app/services/request_tracker_service.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
class RequestTrackerService

def initialize(config)
@queue = config[:queue_name]
@queues = config[:queues]
@priority = config[:priority]

if !@queue || !@priority
raise ArgumentError, "queue_name and priority are required options for RT service"
if !@queues || @queues.empty? || !@priority
raise ArgumentError, "queues and priority are required options for RT service"
end
end

Expand All @@ -28,8 +28,18 @@ def create_ticket(support_ticket_request)
private

def create_payload(support_ticket_request, ticket_text)
# default to first configured queue
queue = @queues[0]
if support_ticket_request.queue && support_ticket_request.queue!=""
if @queues.include?(support_ticket_request.queue)
queue = support_ticket_request.queue
else
raise ArgumentError, "invalid queue selection"
end
end

payload = {
Queue: @queue,
Queue: queue,
Requestor: support_ticket_request.email,
Cc: support_ticket_request.cc,
Priority: @priority,
Expand All @@ -40,4 +50,4 @@ def create_payload(support_ticket_request, ticket_text)
return payload
end

end
end
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<div class="form-container">
<form id="new_support_ticket" role="form" action="<%= support_path %>" accept-charset="UTF-8" method="post" enctype="multipart/form-data">
<input type="hidden" name="<%= request_forgery_protection_token %>" value="<%= form_authenticity_token %>" />
<input type="hidden" id="queue" name="support_ticket[queue]" value="" />

<div class="form-group">
<label class="control-label" for="username">User name</label>
Expand Down
Loading