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

Streamline Modifying Department List #23

Closed
rougegoat opened this issue Apr 12, 2023 · 5 comments
Closed

Streamline Modifying Department List #23

rougegoat opened this issue Apr 12, 2023 · 5 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers waiting feedback Waiting on feedback from requestor
Milestone

Comments

@rougegoat
Copy link
Contributor

Note: While all requests are welcome, finding available cycles to custom-code a feature we won't use in our production environment is always challenging.

Is your feature request related to a problem? Please describe.
Modifying the list of departments presented to the user can be a bit frustrating in the current approach.

Describe the solution you'd like
If we move the list of departments from the welcomeJSON section up to the top, we can make it a bit easier to update without having to dig through the rest of the script. For example

departmentList="Asset Management
Australia Area Office
Marketing
Board of Directors"
departmentList=$( echo "${departmentList}" | tr ',' '\n' | sort -f | sed 's/^/\"/' | sed 's/$/\",/' | sed '$ s/.$//' )

will automatically alphabetize the department list and format it for the json field to insert later on. Then, we would just replace the Department section of the welcomeJSON with

        {   "title" : "Department",
            "default" : "Please select your department",
            "values" : [
                "Please select your department",
                '${departmentList}'
           ]
         }

That should make it a bit easier to modify the department list down the line, either for new departments or for other people using this script.

Describe alternatives you've considered
This process can be done manually, but if you have a large number of departments to add it can be cumbersome.

@rougegoat rougegoat added the enhancement New feature or request label Apr 12, 2023
@dan-snelson dan-snelson added this to the 1.10.0 milestone Apr 12, 2023
@dan-snelson
Copy link
Collaborator

Thanks for the FR, @rougegoat!

Do you have cycles to submit a Pull Request against the development branch, or would you prefer I implement your suggestions from above?

@rougegoat
Copy link
Contributor Author

I do not have anything up in GitHub right now. My example code works, but I'm not sure if there's a more streamlined version than that. If it looks good, feel free to use it.

dan-snelson referenced this issue Apr 13, 2023
…uplicates — is converted to a sorted, unique, JSON-compatible 'departmentList' variable (Addresses Issue No. 23; thanks @rougegoat)

Signed-off-by: Dan K. Snelson <[email protected]>
@dan-snelson
Copy link
Collaborator

@rougegoat:

Please validate 1.10.0-rc8.

@dan-snelson dan-snelson added good first issue Good for newcomers waiting feedback Waiting on feedback from requestor labels Apr 13, 2023
@rougegoat
Copy link
Contributor Author

That works perfectly, and looks like it works with both new line lists and comma separated lists.

On an unrelated note, I noticed that Rosetta's local test reports back "Running" instead of "Installed". Guessing it's just a copy/paste mixup on line 1613.

@dan-snelson
Copy link
Collaborator

Thanks for the quick feedback.

Running is a keyword; see: Setup Your Mac: “Live” Jamf Pro Policy Validation and Line 1764.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers waiting feedback Waiting on feedback from requestor
Projects
None yet
Development

No branches or pull requests

2 participants