<commit_before>Router = require 'lib/router'

State = require 'models/State'

RequestsActive = require 'collections/RequestsActive'
RequestsPaused = require 'collections/RequestsPaused'
RequestsPending = require 'collections/RequestsPending'
RequestsCleaning = require 'collections/RequestsCleaning'

TasksActive = require 'collections/TasksActive'
TasksScheduled = require 'collections/TasksScheduled'
TasksCleaning = require 'collections/TasksCleaning'

class Application

    initialize: =>
        @views = {}
        @collections = {}

        @allTasks = {}
        @allRequests = {}

        # Get users, projects, and targets, and user settings
        # before actually starting the app
        @fetchResources =>

            $('.page-loader.fixed').hide()

            @router = new Router

            Backbone.history.start
                pushState: location.hostname.substr(0, 'local'.length).toLowerCase() isnt 'local'
                root: '/singularity/'

            Object.freeze? @

    fetchResources: (success) =>
        @resolveCountdown = 0

        resolve = =>
            @resolveCountdown -= 1
            success() if @resolveCountdown is 0

        @resolveCountdown += 1
        @state = new State
        @state.fetch
            error: => vex.dialog.alert('An error occurred while trying to load the Singularity state.')
            success: -> resolve()

        resources = [{
            collection_key: 'requestsActive'
            collection: RequestsActive
            error_phrase: 'requests'
        }, {
            collection_key: 'requestsPaused'
            collection: RequestsPaused
            error_phrase: 'paused requests'
        }, {
            collection_key: 'requestsPending'
            collection: RequestsPending
            error_phrase: 'requests'
        }, {
            collection_key: 'requestsCleaning'
            collection: RequestsCleaning
            error_phrase: 'requests'<commit_msg>Improve error phrase for pending and cleaning requests<commit_after>Router = require 'lib/router'

State = require 'models/State'

RequestsActive = require 'collections/RequestsActive'
RequestsPaused = require 'collections/RequestsPaused'
RequestsPending = require 'collections/RequestsPending'
RequestsCleaning = require 'collections/RequestsCleaning'

TasksActive = require 'collections/TasksActive'
TasksScheduled = require 'collections/TasksScheduled'
TasksCleaning = require 'collections/TasksCleaning'

class Application

    initialize: =>
        @views = {}
        @collections = {}

        @allTasks = {}
        @allRequests = {}

        # Get users, projects, and targets, and user settings
        # before actually starting the app
        @fetchResources =>

            $('.page-loader.fixed').hide()

            @router = new Router

            Backbone.history.start
                pushState: location.hostname.substr(0, 'local'.length).toLowerCase() isnt 'local'
                root: '/singularity/'

            Object.freeze? @

    fetchResources: (success) =>
        @resolveCountdown = 0

        resolve = =>
            @resolveCountdown -= 1
            success() if @resolveCountdown is 0

        @resolveCountdown += 1
        @state = new State
        @state.fetch
            error: => vex.dialog.alert('An error occurred while trying to load the Singularity state.')
            success: -> resolve()

        resources = [{
            collection_key: 'requestsActive'
            collection: RequestsActive
            error_phrase: 'requests'
        }, {
            collection_key: 'requestsPaused'
            collection: RequestsPaused
            error_phrase: 'paused requests'
        }, {
            collection_key: 'requestsPending'
            collection: RequestsPending
            error_phrase: 'pending requests'
        }, {
            collection_key: 'requestsCleaning'
            collection: RequestsCleaning
            error_phrase: 'cleaning requests'
{'fraction_non_alphanumeric': 0.09095477386934674, 'fraction_numerical': 0.002512562814070352, 'mean_word_length': 2.2471451876019577, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7540164', 'n_tokens_mistral': 1009, 'n_tokens_neox': 991, 'n_words': 244}