setup-your-mac / Setup-Your-Mac

Setup Your Mac aims to simplify initial device configuration by leveraging swiftDialog and Jamf Pro Policy Custom Events to allow end-users to self-complete Mac setup post-enrollment.
https://snelson.us/sym
MIT License
246 stars 54 forks source link

Streamline Modifying Department List #23

Closed rougegoat closed 1 year ago

rougegoat commented 1 year ago

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.

dan-snelson commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

@rougegoat:

Please validate 1.10.0-rc8.

rougegoat commented 1 year ago

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 commented 1 year ago

Thanks for the quick feedback.

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