+ Available Challenge Profiles
+
+ You can create challenge profiles from the Challenges page. Select your desired challenges, choose a profile name and hit "Save Profile". Your new profile will displayed on this page.
+
-
+
+
@@ -342,6 +347,27 @@
+
+
+
+
+
+
+
Loading profiles
+
+
+
+
+
+
+
+ No profiles are currently available. To add a challenge profile, please visit the challenges page. You can select the challenges you like for your profile and afterwards save it.
+
+
+
+
@@ -371,6 +397,8 @@ export default {
areYouSure: false,
showSelected: true,
secretChallenges: null,
+ loaderIsActive: true,
+ noProfiles: false,
}
},
created: function () {
@@ -427,6 +455,11 @@ export default {
that.alert = "Profile \"" + that.profileForUpdate.name + "\" successfully deleted"
that.setProfileForUpdate(that.profiles[0])
that.showAlert("success")
+ setTimeout(function (){
+ if(!that.profiles.length){
+ that.noProfiles = true
+ }
+ }.bind(that), 5000)
}
});
},
@@ -519,25 +552,26 @@ export default {
},
setProfileForUpdate: function(profile) {
//window.console.log("Setting profileForUpdate to", profile)
- this.areYouSure = false
- const that = this
- let categories = JSON.parse(JSON.stringify(that.categories)) // Creates a copy of this.categories
- let challenges = JSON.parse(JSON.stringify(profile.challenges)) // Creates a copy of this.categories
- let name = JSON.parse(JSON.stringify(profile.name))
- let secret = JSON.parse(JSON.stringify(profile.secret))
- this.profileForUpdate = []
- this.profileForUpdate = {name: name, secret: secret, challenges: challenges, categories: categories}
- this.profileForUpdate.challenges.forEach(function(pchallenge){
- that.profileForUpdate.categories.forEach(function(category){
- let index = category.challenges.findIndex(obj => obj['name'] === pchallenge.name)
- if (index >= 0) {
- //window.console.log("Found", pchallenge.name, "in category",category,"removing them from Challenges not in profile")
- category.challenges = that.removeItem(category.challenges, 'value', pchallenge.tag)
- }
+ if(this.profiles.length) {
+ this.areYouSure = false
+ const that = this
+ let categories = JSON.parse(JSON.stringify(that.categories)) // Creates a copy of this.categories
+ let challenges = JSON.parse(JSON.stringify(profile.challenges)) // Creates a copy of this.categories
+ let name = JSON.parse(JSON.stringify(profile.name))
+ let secret = JSON.parse(JSON.stringify(profile.secret))
+ this.profileForUpdate = []
+ this.profileForUpdate = {name: name, secret: secret, challenges: challenges, categories: categories}
+ this.profileForUpdate.challenges.forEach(function (pchallenge) {
+ that.profileForUpdate.categories.forEach(function (category) {
+ let index = category.challenges.findIndex(obj => obj['name'] === pchallenge.name)
+ if (index >= 0) {
+ //window.console.log("Found", pchallenge.name, "in category",category,"removing them from Challenges not in profile")
+ category.challenges = that.removeItem(category.challenges, 'value', pchallenge.tag)
+ }
+ })
})
- })
- this.checkIfUpdateAvailable()
- // window.console.log("ProfileForUpdate is now", this.profileForUpdate)
+ this.checkIfUpdateAvailable()
+ }
},
getProfiles: function () {
const that = this
@@ -571,6 +605,13 @@ export default {
})
})
that.setProfileForUpdate(that.profiles[0])
+ if (!that.profiles.length) {
+ that.noProfiles = true
+ }
+ setTimeout(function (){
+ that.loaderIsActive = false
+ }.bind(that), 1000)
+
})
},
getCategories: function () {