Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
reworked default quota label and added js update of users' default va…
…lue when default is changed

Signed-off-by: Harold Gray <[email protected]>
  • Loading branch information
Harold Gray committed Nov 1, 2018
commit 6cf2d2993e24f7f14f35266b9d14da34d2f3b486
20 changes: 19 additions & 1 deletion settings/src/components/userList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ import Vue from 'vue';

export default {
name: 'userList',
props: ['users', 'showConfig', 'selectedGroup', 'externalActions'],
props: ['users', 'showConfig', 'selectedGroup', 'externalActions', 'defaultQuotaValue'],
components: {
userRow,
Multiselect,
Expand Down Expand Up @@ -195,6 +195,10 @@ export default {
* Register search
*/
this.userSearch = new OCA.Search(this.search, this.resetSearch);

this.$nextTick(function () {
this.updateDefaultLabel();
});
},
computed: {
settings() {
Expand Down Expand Up @@ -274,6 +278,9 @@ export default {
this.$store.commit('resetUsers');
this.$refs.infiniteLoading.$emit('$InfiniteLoading:reset');
this.setNewUserDefaultGroup(val);
},
defaultQuotaValue: function () {
this.updateDefaultLabel();
}
},
methods: {
Expand Down Expand Up @@ -368,6 +375,17 @@ export default {
this.loading.groups = false;
});
return this.$store.getters.getGroups[this.groups.length];
},
updateDefaultLabel() {
let defaultLabel = undefined;

if (this.defaultQuotaValue.label === 'Unlimited') {
defaultLabel = '∞';
} else {
defaultLabel = this.defaultQuotaValue.label;
}

this.defaultQuota = {id: 'default', label: defaultLabel + ' (default)'};
}
}
}
Expand Down
14 changes: 4 additions & 10 deletions settings/src/components/userList/userRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -239,17 +239,11 @@ export default {
let humanQuota = OC.Util.humanFileSize(this.user.quota.quota);
let userQuota = this.quotaOptions.find(quota => quota.id === humanQuota);
return userQuota ? userQuota : {id:humanQuota, label:humanQuota};
} else if (this.settings.defaultQuota === 'none') { // unlimited
if(this.user.quota.quota === 'default') {
this.quotaOptions[0]['label'] = '∞ (default)';
return this.quotaOptions[0];
} else if (this.user.quota.quota === 'none') {
return this.quotaOptions[1];
}
} else if (this.user.quota.quota === 0 || this.user.quota.quota === 'default') {
// default quota is replaced by the proper value on load
return this.quotaOptions[0];
}

this.quotaOptions[0]['label'] = this.settings.defaultQuota + ' (default)'; // otherwise
return this.quotaOptions[0];
return this.quotaOptions[1]; // unlimited
},

/* PASSWORD POLICY? */
Expand Down
2 changes: 1 addition & 1 deletion settings/src/views/Users.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
</div>
</template>
</app-navigation>
<user-list :users="users" :showConfig="showConfig" :selectedGroup="selectedGroup" :externalActions="externalActions" />
<user-list :users="users" :showConfig="showConfig" :selectedGroup="selectedGroup" :externalActions="externalActions" :defaultQuotaValue="defaultQuota" />
</div>
</template>

Expand Down