-
-
Notifications
You must be signed in to change notification settings - Fork 281
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
[iOS] Admin Dashboard - Task Triggers, Device Management, & Device Posters #1255
Conversation
This is basically done but I have 2 outstanding items:
Outside of those 2 items, I think this is good to go. |
c745c41
to
1405d26
Compare
I've re-based on Main the only way I know how: Poorly. But this should be up to date now with the new changes included. I also wanted to emphasize setting defaults. So, when the TriggerType is changed, values are set to a default value. I am also no longer using anything other than formatStyles for getting formatting done. There is still plenty I want to cleanup but I think this is a much better second attempt having come off of #1258. Outstanding items, I want to:
|
I've started my changes but have some more to go. Some notable ones:
I haven't gotten to everything but here are some bigger things we should change:
|
…. Remove leftover EditTaskTriggerView logic. Add Results/Errors to the EditScheduledTaskView. Track Progress on EditScheduledTaskView.
… struct. Creation of a ChevronInputButton object that probably needs some love...
I think I addressed most of the items. I removed the TaskTriggerIntervals enum. I tried out a few routes. Using the DatePicker works but limits the user to 23:59 being the longest interval they can schedule to. My current implementation probably needs to go but it's just every 15 minute segment... I created a ServerTicks struct for going from seconds/minutes/hours/days to ticks and vice versa. In my mind, it's just easier to do that once than having random " / 10000000" when needed. Let me know if this isn't the way to approach this. I created a ChevronInputButton. The goal of this was to extend the existing Chevron Button but instead, when clicked, it brings up an Alert with a TextField input. It works, can take multiple input types (Int, Double, String, etc) but I also think there is room to do this better. The reason I made a new button for this is this input format now exists for the TaskTriggers > RunTimeLimit and the Customize > MaxNextUpLimit. If this exists in multiple places I think it would be good to get all the button logic done there (I think that's all there now) so it's easier to roll out changes if something comes up. Lastly, I went through some of the TODO in the TaskTriggers and added a section for In-Progress information, last run history, and errors. Those are pretty standard but let me know if there are any changes needed there. Everything should be localized and all minutes/hours/days should be using built-in functionality now. I think that's all of the more out-there changes! Let me know if there are any questions or changes I can assist with! |
|
||
import Foundation | ||
|
||
struct ServerTicks { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have thought previously about making ticks more strongly typed, but as either probably something loose like typealias Ticks = Int64
or making a stronger type like this conforming as well to ExpressibleByIntegerLiteral
with necessary functions and values like you've done below.
However, I would want this in the SDK so we can set the type for all tick
properties during generation.
This is starting to creep up in scope. I just keep seeing things that would be quick to add. Feel free let me know if this needs to be broken out in other PRs. There are couple items that I wasn't sure about that I'd be happy to change but I might need some direction:
Sorry, I know this is a lot of items! Please let me know and I can split these out into other PRs. The Devices & Posters additions were just related because I was using some of the ServerTicks items at the same time. |
|
||
deviceTask = Task { [weak self] in | ||
await MainActor.run { | ||
let _ = self?.backgroundStates.append(.gettingDevices) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be simplified a little by adding it to the states before creating the task?
|
||
// MARK: - Body | ||
|
||
// TODO: Likely want to redo this but better. Needed in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed in? Also how can it be done better in your eyes? A lot of TODOs in this project don't provide enough direction for contributors to help out (and I'd like to be a more active contributor).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Finish TODO...
Sorry about that, I meant to pull the locations that call this button.
This is called from the TimeIntervalSection of the AddScheduledTaskTriggersView and the HomeSection of the CustomizeViewSettingsView. So, it's "Needed in..." those locations.
I detail my potential issues with this and another comment on this PR. My goal with this button is we now have two locations where we are using an alert to host a TextField used to populate a binding. My hope was to consolidate that work into a single view so we're not redoing the alert logic in multiple places. My thinking is that if we can create one good instance on a button and then use that button everywhere it's easier to maintain.
Some of what I think might be issues or something I could do better:
-
I think I need more ways to Init this? That is, do I include the text field in the alert or should I make them so if you can be passed in trailing so you could pass in a textField or a picker or... whatever is needed. Frankly, a lot of what I've done in Swift has been single function so creating something like this with a bit more of a broad potential usage, I want to make sure it's flexible.
-
UI wise, do we want to use the Chevron button to display the value? Is there a better way to display this information?
-
Lastly, I like the idea of consolidating all of the alert inputs into a single button, but I want to make sure that it's not too broad to begin with. That is, are the inputs on this button going to require code work than recreating the alert system?
Let me know if any of that doesn't make sense! I'm still newer to Swift/SwiftUI so advice is always appreciated.
I've got a couple items in my list of things I want to work on for this. I'm going to take another look at this later in the week with some fresh eyes. For now, I am setting this back to draft until it's fully ready. |
… BEFORE attempting to delete. Creation of an Admin Session Indicator for showing if there are active sessions from the HomeView. Fix Day of Week localization based on jellyfin#1255 (comment) - Confirmed working! Created an activeSessions published value for usage with the Active Sessions Indicator. Migration of the ChevronInputButton to allow more input types than just TextFields. Creation of a Users section. Grid vs Row User Section. Allow for User Password Resets. Make sure the DeviceType backgrounds never clash with the SVG. General cleanup of previous work mostly labels and formatting based on changes mentioned above. Finally, migrated ALL of the UserDashboard -> AdminDashboard (Since it's admin only now) and created it's own coordinator. Now available from the ActiveSessionsIndicator.
Issue
This is an extension of #1230
Summary
This PR is kind of a mix of low hanging Admin Dashboard changes. The primary changes are:
Task Triggers
Device Management
Device Posters
Screenshots - Task Triggers
Task View
Delete Task
No Tasks
Add Task
All Task Types w/ Icons
Screenshots - Device Management
Delete Single Device
Delete All Devices
Custom Name Device
Screenshots - Device Posters
Active Device Poster Changes
Various Poster Examples