<commit_before><link rel="import" href="../../bower_components/polymer/polymer.html">

<dom-module id="issues-page">

    <template>
        <form id="form">
            <label class="ms-fontWeight-semibold">Issues graph</label>
            <div class="ms-TextField">
                <label class="ms-Label">Repository URL</label>
                <input  id="repositoryURL" value="{{repo::input}}" class="ms-TextField-field">
            </div>
            <div class="ms-TextField">
                <label class="ms-Label">Start Date</label>
                <input  id="startDate" type = "date" placeholder="DD/MM/YYYY" class="ms-TextField-field">
            </div>
            <div class="ms-TextField">
                <label class="ms-Label">End Date</label>
                <input  id="endDate" type = "date" placeholder="DD/MM/YYYY" class="ms-TextField-field">
            </div>
            <div>
                <label class="ms-Label">Opened/Closed</label>
                <select id = "mode" name="contributionType">
                    <option value="combined">Combined</option>
                    <option value="opened">Opened</option>
                    <option value="closed">Closed</option>
                </select>
            </div>
            <div>
                <label class="ms-Label">Users</label>
                <select id = "userSelect" name="userSelect">
                    <option value="combined">All users</option>
                    <option value="singleUser">Single User</option>
                </select>
            </div>
            <div>
                <input  id="selectedUser" placeholder="eg, joeoh" class="ms-TextField-field">
            </div>
            <button-pair></button-pair>
        </form>
    </template>

    <script>
        Polymer({
            is: "issues-page",
            listeners: {
                "button-pair-insert": "insert"
            },
            insert: function() {
                var url = this.$.repositoryURL.value
                console.log("!url: " + !url)
                console.log(url)
                var startDate = this.$.startDate.value
                console.log(startDate)
                var endDate = this.$.endDate.value
                console.log(endDate)
                var mode = this.$.mode.value
                console.log(mode)
                //singleUser is boolean true if dropdown selection is singleUser
                // otherwise calculate graph for all users
                var singleUser = this.$.userSelect.value == "singleUser"
                console.log(singleUser)
                var selectedUser = this.$.selectedUser.value
                console.log(selectedUser)

                // Make sure the fields are filled in correctly.
                if (!url) {
                    this.fire("showErrorMessage", {text: "Please enter a URL."});
                    return;
                }
                if (!startDate) {
                    this.fire("showErrorMessage", {text: "Invalid Start Date.<br>Please enter another date."});
                    return;
                }
                if (!endDate) {
                    this.fire("showErrorMessage", {text: "Invalid End Date.<br>Please enter another date."});
                    return;
                }
				if (singleUser && !selectedUser) {
					this.fire("showErrorMessage", {text: "Please enter a username in the 'Users' field <br>or select 'All Users' from the dropdown"});
                    return;
                }
				console.log("time to isnert a graph")
            }
        });
    </script>

</dom-module><commit_msg>Issues "single user" field now behaves like contributions and is hidden unless dropdown single user is selected.<commit_after><link rel="import" href="../../bower_components/polymer/polymer.html">

<dom-module id="issues-page">

    <template>
        <form id="form">
            <label class="ms-fontWeight-semibold">Issues graph</label>
            <div class="ms-TextField">
                <label class="ms-Label">Repository URL</label>
                <input  id="repositoryURL" value="{{repo::input}}" class="ms-TextField-field">
            </div>
            <div class="ms-TextField">
                <label class="ms-Label">Start Date</label>
                <input  id="startDate" type = "date" placeholder="DD/MM/YYYY" class="ms-TextField-field">
            </div>
            <div class="ms-TextField">
                <label class="ms-Label">End Date</label>
                <input  id="endDate" type = "date" placeholder="DD/MM/YYYY" class="ms-TextField-field">
            </div>
            <div>
                <label class="ms-Label">Opened/Closed</label>
                <select id = "mode" name="contributionType">
                    <option value="combined">Combined</option>
                    <option value="opened">Opened</option>
                    <option value="closed">Closed</option>
                </select>
            </div>
            <div>
                <label class="ms-Label">Users</label>
                <select id = "userSelect" name="userSelect" on-change="userSelectChange">
                    <option value="combined">All users</option>
                    <option value="singleUser">Single User</option>
                </select>
            </div>
            <template is="dom-if" if="{{showUserInput}}" >
                <input id="selectedUser" placeholder="joeoh" class="ms-TextField-field">
            </template>
            <button-pair></button-pair>
        </form>
    </template>

    <script>
        Polymer({
            is: "issues-page",
            listeners: {
                "button-pair-insert": "insert"
            },
            properties: {
                showUserInput: {
                    type: Boolean,
                    value: false
                }
            },
            insert: function() {
                var url = this.$.repositoryURL.value
                console.log("!url: " + !url)
                console.log(url)
                var startDate = this.$.startDate.value
                console.log(startDate)
                var endDate = this.$.endDate.value
                console.log(endDate)
                var mode = this.$.mode.value
                console.log(mode)
                //singleUser is boolean true if dropdown selection is singleUser
                // otherwise calculate graph for all users
                var singleUser = this.$.userSelect.value == "singleUser"
                console.log(singleUser)
                var selectedUser = this.$.selectedUser.value
                console.log(selectedUser)

                // Make sure the fields are filled in correctly.
                if (!url) {
                    this.fire("showErrorMessage", {text: "Please enter a URL."});
                    return;
                }
                if (!startDate) {
                    this.fire("showErrorMessage", {text: "Invalid Start Date.<br>Please enter another date."});
                    return;
                }
                if (!endDate) {
                    this.fire("showErrorMessage", {text: "Invalid End Date.<br>Please enter another date."});
                    return;
                }
				if (singleUser && !selectedUser) {
					this.fire("showErrorMessage", {text: "Please enter a username in the 'Users' field <br>or select 'All Users' from the dropdown"});
                    return;
                }
				console.log("time to isnert a graph")
            },
            // Show or hide the user input field depending on the value of the
            // #userSelect dropdown.
            userSelectChange: function() {
                this.showUserInput = this.$.userSelect.value == "singleUser"
            }
        });
    </script>

</dom-module>
{'fraction_non_alphanumeric': 0.12694564940035724, 'fraction_numerical': 0.0, 'mean_word_length': 1.4799114204365706, 'pattern_counts': {'":': 2, '<': 115, '<?xml version=': 0, '>': 115, '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': '6321721', 'n_tokens_mistral': 2064, 'n_tokens_neox': 1915, 'n_words': 449}