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

Feature: UI to add 'user specific' status check #96

Open
fabdrol opened this issue Feb 21, 2020 · 2 comments
Open

Feature: UI to add 'user specific' status check #96

fabdrol opened this issue Feb 21, 2020 · 2 comments
Labels
acknowledged Issue has been acknowledged and fix/addition might come in the next version new feature UI ticket requires UI changes (suggestions, bugs, etc.)

Comments

@fabdrol
Copy link

fabdrol commented Feb 21, 2020

Introduction
I thought hard about adding a Service for my office's intranet (which is something we desperately need), but then I realised that such a PR may not be in the interest of the broader community (i.e. polluting the list of services with a service that only we would use). This feature request is meant as a starting point for that discussion.

Feature
Instead of adding every service known to man, it may be more useful to add a feature that enables users to create a custom status check just for themselves. The story would look something like this:

(stts user)
After opening the settings dropout
And pressing a button labelled "+"
I'd like to see a new view where I can define a status check on a website of my choosing

Discussion

Does it make more sense to build such a feature, or should I just add a Service?

@fabdrol
Copy link
Author

fabdrol commented Feb 21, 2020

PS: I'm willing to look into coding such a feature, but don't have an awful lot of experience with Mac desktop apps.

@inket
Copy link
Owner

inket commented Feb 28, 2020

Thank you for the suggestion! I have thought about this and I think it would take a considerable amount of time to implement such a feature. Though I definitely plan to add it in the future.

Are you interested in checking that your intranet is returning "200 OK" or is it using one of the cloud status providers like statuspage?

For now I would say it's easier to add the service and build the app yourself. If you need to check that your intranet is returning 200 it should be as simple as this:

// file: stts/Services/MyIntranet.swift
// make sure it's added to the project file via Xcode
// running the app will automatically add "My Local Intranet" to the services list

import Foundation

class MyIntranet: Service {
    let name = "My Local Intranet"
    let url = URL(string: "https://example.com")!

    override func updateStatus(callback: @escaping (BaseService) -> Void) {
        loadData(with: url) { [weak self] data, resp, error in
            guard let strongSelf = self else { return }

            if let response = resp as? HTTPURLResponse, response.statusCode == 200 {
                self?.status = .good
                self?.message = "Intranet up"
            } else {
                self?.status = .major
                self?.message = "Intranet down"
            }

            callback(strongSelf)
        }
    }
}

@inket inket added the UI ticket requires UI changes (suggestions, bugs, etc.) label Mar 9, 2022
@inket inket added new feature acknowledged Issue has been acknowledged and fix/addition might come in the next version labels Jun 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acknowledged Issue has been acknowledged and fix/addition might come in the next version new feature UI ticket requires UI changes (suggestions, bugs, etc.)
Projects
None yet
Development

No branches or pull requests

2 participants