kopia lustrzana https://dev.funkwhale.audio/funkwhale/funkwhale
Can now update user quota in UI
rodzic
68540cf4ab
commit
d000a1329f
|
@ -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",
|
||||
|
|
|
@ -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 () {
|
||||
|
|
Ładowanie…
Reference in New Issue