Can now update user quota in UI

environments/review-docs-funkw-78jnxn/deployments/34
Eliot Berriot 2018-09-28 20:45:31 +02:00
rodzic 68540cf4ab
commit d000a1329f
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: DD6965E2476E5C27
2 zmienionych plików z 29 dodań i 2 usunięć

Wyświetl plik

@ -93,11 +93,13 @@ class ManageUserSimpleSerializer(serializers.ModelSerializer):
"date_joined",
"last_activity",
"privacy_level",
"upload_quota",
)
class ManageUserSerializer(serializers.ModelSerializer):
permissions = PermissionsSerializer(source="*")
upload_quota = serializers.IntegerField(allow_null=True)
class Meta:
model = users_models.User
@ -113,6 +115,7 @@ class ManageUserSerializer(serializers.ModelSerializer):
"last_activity",
"permissions",
"privacy_level",
"upload_quota",
)
read_only_fields = [
"id",

Wyświetl plik

@ -78,6 +78,25 @@
</select>
</td>
</tr>
<tr>
<td>
<translate>Upload quota</translate>
<span :data-tooltip="labels.uploadQuota"><i class="question circle icon"></i></span>
</td>
<td>
<div class="ui right labeled input">
<input
class="ui input"
@change="update('upload_quota', true)"
v-model.number="object.upload_quota"
step="100"
type="number" />
<div class="ui basic label">
<translate>MB</translate>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
@ -122,8 +141,12 @@ export default {
self.isLoading = false
})
},
update (attr) {
update (attr, toNull) {
let newValue = this.object[attr]
if (toNull && !newValue) {
newValue = null
}
console.log(newValue, typeof(newValue))
let params = {}
if (attr === 'permissions') {
params['permissions'] = {}
@ -143,7 +166,8 @@ export default {
computed: {
labels () {
return {
inactive: this.$gettext('Determine if the user account is active or not. Inactive users cannot login or use the service.')
inactive: this.$gettext('Determine if the user account is active or not. Inactive users cannot login or use the service.'),
uploadQuota: this.$gettext('Determine how much content the user can upload. Leave empty to use the default value of the instance.')
}
},
allPermissions () {