2023-01-12 13:02:26 +01:00
|
|
|
<template>
|
|
|
|
<div class="_gaps">
|
|
|
|
<MkInput v-model="name" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.name }}</template>
|
|
|
|
</MkInput>
|
|
|
|
|
|
|
|
<MkTextarea v-model="description" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.description }}</template>
|
|
|
|
</MkTextarea>
|
|
|
|
|
|
|
|
<MkInput v-model="color">
|
|
|
|
<template #label>{{ i18n.ts.color }}</template>
|
|
|
|
<template #caption>#RRGGBB</template>
|
|
|
|
</MkInput>
|
|
|
|
|
2023-01-13 00:23:52 +01:00
|
|
|
<MkSelect v-model="rolePermission" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.permission }}</template>
|
2023-01-13 03:03:54 +01:00
|
|
|
<template #caption><div v-html="i18n.ts._role.descriptionOfPermission.replaceAll('\n', '<br>')"></div></template>
|
2023-01-13 00:22:23 +01:00
|
|
|
<option value="normal">{{ i18n.ts.normalUser }}</option>
|
2023-01-12 13:02:26 +01:00
|
|
|
<option value="moderator">{{ i18n.ts.moderator }}</option>
|
|
|
|
<option value="administrator">{{ i18n.ts.administrator }}</option>
|
|
|
|
</MkSelect>
|
|
|
|
|
2023-01-13 03:03:54 +01:00
|
|
|
<MkSelect v-model="target" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.assignTarget }}</template>
|
|
|
|
<template #caption><div v-html="i18n.ts._role.descriptionOfAssignTarget.replaceAll('\n', '<br>')"></div></template>
|
|
|
|
<option value="manual">{{ i18n.ts._role.manual }}</option>
|
|
|
|
<option value="conditional">{{ i18n.ts._role.conditional }}</option>
|
|
|
|
</MkSelect>
|
|
|
|
|
|
|
|
<MkFolder v-if="target === 'conditional'" default-open>
|
|
|
|
<template #label>{{ i18n.ts._role.condition }}</template>
|
|
|
|
<div class="_gaps">
|
|
|
|
<RolesEditorFormula v-model="condFormula"/>
|
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
2023-01-12 13:02:26 +01:00
|
|
|
<FormSlot>
|
|
|
|
<template #label>{{ i18n.ts._role.options }}</template>
|
|
|
|
<div class="_gaps_s">
|
2023-01-15 08:52:12 +01:00
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.rateLimitFactor }}</template>
|
2023-01-15 11:10:39 +01:00
|
|
|
<template #suffix>{{ options.rateLimitFactor.useDefault ? i18n.ts._role.useBaseValue : `${Math.floor(options.rateLimitFactor.value * 100)}%` }} <i :class="getPriorityIcon(options.rateLimitFactor)"></i></template>
|
2023-01-15 08:52:12 +01:00
|
|
|
<div class="_gaps">
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkSwitch v-model="options.rateLimitFactor.useDefault" :readonly="readonly">
|
2023-01-15 08:52:12 +01:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkRange :model-value="options.rateLimitFactor.value * 100" :min="30" :max="300" :step="10" :text-converter="(v) => `${v}%`" @update:model-value="v => options.rateLimitFactor.value = (v / 100)">
|
|
|
|
<template #label>{{ i18n.ts._role._options.rateLimitFactor }}</template>
|
2023-01-15 08:52:12 +01:00
|
|
|
<template #caption>{{ i18n.ts._role._options.descriptionOfRateLimitFactor }}</template>
|
|
|
|
</MkRange>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkRange v-model="options.rateLimitFactor.priority" :min="0" :max="2" :step="1" easing :text-converter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-15 08:52:12 +01:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
2023-01-12 13:02:26 +01:00
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.gtlAvailable }}</template>
|
2023-01-15 11:10:39 +01:00
|
|
|
<template #suffix>{{ options.gtlAvailable.useDefault ? i18n.ts._role.useBaseValue : (options.gtlAvailable.value ? i18n.ts.yes : i18n.ts.no) }} <i :class="getPriorityIcon(options.gtlAvailable)"></i></template>
|
2023-01-12 13:02:26 +01:00
|
|
|
<div class="_gaps">
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkSwitch v-model="options.gtlAvailable.useDefault" :readonly="readonly">
|
2023-01-12 13:02:26 +01:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkSwitch v-model="options.gtlAvailable.value" :disabled="options.gtlAvailable.useDefault" :readonly="readonly">
|
2023-01-12 13:02:26 +01:00
|
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
|
|
</MkSwitch>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkRange v-model="options.gtlAvailable.priority" :min="0" :max="2" :step="1" easing :text-converter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-12 13:02:26 +01:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.ltlAvailable }}</template>
|
2023-01-15 11:10:39 +01:00
|
|
|
<template #suffix>{{ options.ltlAvailable.useDefault ? i18n.ts._role.useBaseValue : (options.ltlAvailable.value ? i18n.ts.yes : i18n.ts.no) }} <i :class="getPriorityIcon(options.ltlAvailable)"></i></template>
|
2023-01-12 13:02:26 +01:00
|
|
|
<div class="_gaps">
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkSwitch v-model="options.ltlAvailable.useDefault" :readonly="readonly">
|
2023-01-12 13:02:26 +01:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkSwitch v-model="options.ltlAvailable.value" :disabled="options.ltlAvailable.useDefault" :readonly="readonly">
|
2023-01-12 13:02:26 +01:00
|
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
|
|
</MkSwitch>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkRange v-model="options.ltlAvailable.priority" :min="0" :max="2" :step="1" easing :text-converter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-12 13:02:26 +01:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.canPublicNote }}</template>
|
2023-01-15 11:10:39 +01:00
|
|
|
<template #suffix>{{ options.canPublicNote.useDefault ? i18n.ts._role.useBaseValue : (options.canPublicNote.value ? i18n.ts.yes : i18n.ts.no) }} <i :class="getPriorityIcon(options.canPublicNote)"></i></template>
|
2023-01-12 13:02:26 +01:00
|
|
|
<div class="_gaps">
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkSwitch v-model="options.canPublicNote.useDefault" :readonly="readonly">
|
2023-01-12 13:02:26 +01:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkSwitch v-model="options.canPublicNote.value" :disabled="options.canPublicNote.useDefault" :readonly="readonly">
|
2023-01-12 13:02:26 +01:00
|
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
|
|
</MkSwitch>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkRange v-model="options.canPublicNote.priority" :min="0" :max="2" :step="1" easing :text-converter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-12 13:02:26 +01:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
2023-01-13 06:22:53 +01:00
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.canInvite }}</template>
|
2023-01-15 11:10:39 +01:00
|
|
|
<template #suffix>{{ options.canInvite.useDefault ? i18n.ts._role.useBaseValue : (options.canInvite.value ? i18n.ts.yes : i18n.ts.no) }} <i :class="getPriorityIcon(options.canInvite)"></i></template>
|
2023-01-13 06:22:53 +01:00
|
|
|
<div class="_gaps">
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkSwitch v-model="options.canInvite.useDefault" :readonly="readonly">
|
2023-01-13 06:22:53 +01:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkSwitch v-model="options.canInvite.value" :disabled="options.canInvite.useDefault" :readonly="readonly">
|
2023-01-13 06:22:53 +01:00
|
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
|
|
</MkSwitch>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkRange v-model="options.canInvite.priority" :min="0" :max="2" :step="1" easing :text-converter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-13 06:22:53 +01:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
2023-01-13 06:58:27 +01:00
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.canManageCustomEmojis }}</template>
|
2023-01-15 11:10:39 +01:00
|
|
|
<template #suffix>{{ options.canManageCustomEmojis.useDefault ? i18n.ts._role.useBaseValue : (options.canManageCustomEmojis.value ? i18n.ts.yes : i18n.ts.no) }} <i :class="getPriorityIcon(options.canManageCustomEmojis)"></i></template>
|
2023-01-13 06:58:27 +01:00
|
|
|
<div class="_gaps">
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkSwitch v-model="options.canManageCustomEmojis.useDefault" :readonly="readonly">
|
2023-01-13 06:58:27 +01:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkSwitch v-model="options.canManageCustomEmojis.value" :disabled="options.canManageCustomEmojis.useDefault" :readonly="readonly">
|
2023-01-13 06:58:27 +01:00
|
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
|
|
</MkSwitch>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkRange v-model="options.canManageCustomEmojis.priority" :min="0" :max="2" :step="1" easing :text-converter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-13 06:58:27 +01:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
2023-01-12 13:02:26 +01:00
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.driveCapacity }}</template>
|
2023-01-15 11:10:39 +01:00
|
|
|
<template #suffix>{{ options.driveCapacityMb.useDefault ? i18n.ts._role.useBaseValue : (options.driveCapacityMb.value + 'MB') }} <i :class="getPriorityIcon(options.driveCapacityMb)"></i></template>
|
2023-01-12 13:02:26 +01:00
|
|
|
<div class="_gaps">
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkSwitch v-model="options.driveCapacityMb.useDefault" :readonly="readonly">
|
2023-01-12 13:02:26 +01:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkInput v-model="options.driveCapacityMb.value" :disabled="options.driveCapacityMb.useDefault" type="number" :readonly="readonly">
|
2023-01-12 13:02:26 +01:00
|
|
|
<template #suffix>MB</template>
|
|
|
|
</MkInput>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkRange v-model="options.driveCapacityMb.priority" :min="0" :max="2" :step="1" easing :text-converter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-12 13:02:26 +01:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
2023-01-14 10:04:56 +01:00
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.pinMax }}</template>
|
2023-01-15 11:10:39 +01:00
|
|
|
<template #suffix>{{ options.pinLimit.useDefault ? i18n.ts._role.useBaseValue : (options.pinLimit.value) }} <i :class="getPriorityIcon(options.pinLimit)"></i></template>
|
2023-01-14 10:04:56 +01:00
|
|
|
<div class="_gaps">
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkSwitch v-model="options.pinLimit.useDefault" :readonly="readonly">
|
2023-01-14 10:04:56 +01:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkInput v-model="options.pinLimit.value" :disabled="options.pinLimit.useDefault" type="number" :readonly="readonly">
|
2023-01-14 10:04:56 +01:00
|
|
|
</MkInput>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkRange v-model="options.pinLimit.priority" :min="0" :max="2" :step="1" easing :text-converter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-14 10:04:56 +01:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
2023-01-12 13:02:26 +01:00
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.antennaMax }}</template>
|
2023-01-15 11:10:39 +01:00
|
|
|
<template #suffix>{{ options.antennaLimit.useDefault ? i18n.ts._role.useBaseValue : (options.antennaLimit.value) }} <i :class="getPriorityIcon(options.antennaLimit)"></i></template>
|
2023-01-12 13:02:26 +01:00
|
|
|
<div class="_gaps">
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkSwitch v-model="options.antennaLimit.useDefault" :readonly="readonly">
|
2023-01-12 13:02:26 +01:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkInput v-model="options.antennaLimit.value" :disabled="options.antennaLimit.useDefault" type="number" :readonly="readonly">
|
2023-01-12 13:02:26 +01:00
|
|
|
</MkInput>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkRange v-model="options.antennaLimit.priority" :min="0" :max="2" :step="1" easing :text-converter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-12 13:02:26 +01:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
2023-01-14 00:04:38 +01:00
|
|
|
|
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.wordMuteMax }}</template>
|
2023-01-15 11:10:39 +01:00
|
|
|
<template #suffix>{{ options.wordMuteLimit.useDefault ? i18n.ts._role.useBaseValue : (options.wordMuteLimit.value) }} <i :class="getPriorityIcon(options.wordMuteLimit)"></i></template>
|
2023-01-14 00:04:38 +01:00
|
|
|
<div class="_gaps">
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkSwitch v-model="options.wordMuteLimit.useDefault" :readonly="readonly">
|
2023-01-14 00:04:38 +01:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkInput v-model="options.wordMuteLimit.value" :disabled="options.wordMuteLimit.useDefault" type="number" :readonly="readonly">
|
2023-01-14 00:04:38 +01:00
|
|
|
<template #suffix>chars</template>
|
|
|
|
</MkInput>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkRange v-model="options.wordMuteLimit.priority" :min="0" :max="2" :step="1" easing :text-converter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-14 00:04:38 +01:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
2023-01-14 02:48:11 +01:00
|
|
|
|
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.webhookMax }}</template>
|
2023-01-15 11:10:39 +01:00
|
|
|
<template #suffix>{{ options.webhookLimit.useDefault ? i18n.ts._role.useBaseValue : (options.webhookLimit.value) }} <i :class="getPriorityIcon(options.webhookLimit)"></i></template>
|
2023-01-14 02:48:11 +01:00
|
|
|
<div class="_gaps">
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkSwitch v-model="options.webhookLimit.useDefault" :readonly="readonly">
|
2023-01-14 02:48:11 +01:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkInput v-model="options.webhookLimit.value" :disabled="options.webhookLimit.useDefault" type="number" :readonly="readonly">
|
2023-01-14 02:48:11 +01:00
|
|
|
</MkInput>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkRange v-model="options.webhookLimit.priority" :min="0" :max="2" :step="1" easing :text-converter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-14 02:48:11 +01:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
2023-01-14 08:14:24 +01:00
|
|
|
|
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.clipMax }}</template>
|
2023-01-15 11:10:39 +01:00
|
|
|
<template #suffix>{{ options.clipLimit.useDefault ? i18n.ts._role.useBaseValue : (options.clipLimit.value) }} <i :class="getPriorityIcon(options.clipLimit)"></i></template>
|
2023-01-14 08:14:24 +01:00
|
|
|
<div class="_gaps">
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkSwitch v-model="options.clipLimit.useDefault" :readonly="readonly">
|
2023-01-14 08:14:24 +01:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkInput v-model="options.clipLimit.value" :disabled="options.clipLimit.useDefault" type="number" :readonly="readonly">
|
2023-01-14 08:14:24 +01:00
|
|
|
</MkInput>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkRange v-model="options.clipLimit.priority" :min="0" :max="2" :step="1" easing :text-converter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-14 08:14:24 +01:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.noteEachClipsMax }}</template>
|
2023-01-15 11:10:39 +01:00
|
|
|
<template #suffix>{{ options.noteEachClipsLimit.useDefault ? i18n.ts._role.useBaseValue : (options.noteEachClipsLimit.value) }} <i :class="getPriorityIcon(options.noteEachClipsLimit)"></i></template>
|
2023-01-14 08:14:24 +01:00
|
|
|
<div class="_gaps">
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkSwitch v-model="options.noteEachClipsLimit.useDefault" :readonly="readonly">
|
2023-01-14 08:14:24 +01:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkInput v-model="options.noteEachClipsLimit.value" :disabled="options.noteEachClipsLimit.useDefault" type="number" :readonly="readonly">
|
2023-01-14 08:14:24 +01:00
|
|
|
</MkInput>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkRange v-model="options.noteEachClipsLimit.priority" :min="0" :max="2" :step="1" easing :text-converter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-14 08:14:24 +01:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
2023-01-14 09:38:16 +01:00
|
|
|
|
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.userListMax }}</template>
|
2023-01-15 11:10:39 +01:00
|
|
|
<template #suffix>{{ options.userListLimit.useDefault ? i18n.ts._role.useBaseValue : (options.userListLimit.value) }} <i :class="getPriorityIcon(options.userListLimit)"></i></template>
|
2023-01-14 09:38:16 +01:00
|
|
|
<div class="_gaps">
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkSwitch v-model="options.userListLimit.useDefault" :readonly="readonly">
|
2023-01-14 09:38:16 +01:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkInput v-model="options.userListLimit.value" :disabled="options.userListLimit.useDefault" type="number" :readonly="readonly">
|
2023-01-14 09:38:16 +01:00
|
|
|
</MkInput>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkRange v-model="options.userListLimit.priority" :min="0" :max="2" :step="1" easing :text-converter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-14 09:38:16 +01:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.userEachUserListsMax }}</template>
|
2023-01-15 11:10:39 +01:00
|
|
|
<template #suffix>{{ options.userEachUserListsLimit.useDefault ? i18n.ts._role.useBaseValue : (options.userEachUserListsLimit.value) }} <i :class="getPriorityIcon(options.userEachUserListsLimit)"></i></template>
|
2023-01-14 09:38:16 +01:00
|
|
|
<div class="_gaps">
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkSwitch v-model="options.userEachUserListsLimit.useDefault" :readonly="readonly">
|
2023-01-14 09:38:16 +01:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkInput v-model="options.userEachUserListsLimit.value" :disabled="options.userEachUserListsLimit.useDefault" type="number" :readonly="readonly">
|
2023-01-14 09:38:16 +01:00
|
|
|
</MkInput>
|
2023-01-15 11:10:39 +01:00
|
|
|
<MkRange v-model="options.userEachUserListsLimit.priority" :min="0" :max="2" :step="1" easing :text-converter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
|
|
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
|
|
|
</MkRange>
|
2023-01-14 09:38:16 +01:00
|
|
|
</div>
|
|
|
|
</MkFolder>
|
2023-01-12 13:02:26 +01:00
|
|
|
</div>
|
|
|
|
</FormSlot>
|
|
|
|
|
|
|
|
<MkSwitch v-model="canEditMembersByModerator" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.canEditMembersByModerator }}</template>
|
|
|
|
<template #caption>{{ i18n.ts._role.descriptionOfCanEditMembersByModerator }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
|
|
|
|
<MkSwitch v-model="isPublic" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.isPublic }}</template>
|
|
|
|
<template #caption>{{ i18n.ts._role.descriptionOfIsPublic }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
|
|
|
|
<div v-if="!readonly" class="_buttons">
|
|
|
|
<MkButton primary rounded @click="save"><i class="ti ti-check"></i> {{ role ? i18n.ts.save : i18n.ts.create }}</MkButton>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2023-01-15 11:10:39 +01:00
|
|
|
import { computed, reactive, watch } from 'vue';
|
2023-01-13 03:03:54 +01:00
|
|
|
import { v4 as uuid } from 'uuid';
|
|
|
|
import RolesEditorFormula from './RolesEditorFormula.vue';
|
2023-01-12 13:02:26 +01:00
|
|
|
import MkInput from '@/components/MkInput.vue';
|
|
|
|
import MkSelect from '@/components/MkSelect.vue';
|
|
|
|
import MkTextarea from '@/components/MkTextarea.vue';
|
|
|
|
import MkFolder from '@/components/MkFolder.vue';
|
|
|
|
import MkSwitch from '@/components/MkSwitch.vue';
|
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2023-01-15 08:52:12 +01:00
|
|
|
import MkRange from '@/components/MkRange.vue';
|
2023-01-12 13:02:26 +01:00
|
|
|
import FormSlot from '@/components/form/slot.vue';
|
|
|
|
import * as os from '@/os';
|
|
|
|
import { i18n } from '@/i18n';
|
2023-01-15 08:52:12 +01:00
|
|
|
import { instance } from '@/instance';
|
2023-01-12 13:02:26 +01:00
|
|
|
|
2023-01-15 11:10:39 +01:00
|
|
|
const ROLE_OPTIONS = [
|
|
|
|
'gtlAvailable',
|
|
|
|
'ltlAvailable',
|
|
|
|
'canPublicNote',
|
|
|
|
'canInvite',
|
|
|
|
'canManageCustomEmojis',
|
|
|
|
'driveCapacityMb',
|
|
|
|
'pinLimit',
|
|
|
|
'antennaLimit',
|
|
|
|
'wordMuteLimit',
|
|
|
|
'webhookLimit',
|
|
|
|
'clipLimit',
|
|
|
|
'noteEachClipsLimit',
|
|
|
|
'userListLimit',
|
|
|
|
'userEachUserListsLimit',
|
|
|
|
'rateLimitFactor',
|
|
|
|
] as const;
|
|
|
|
|
2023-01-12 13:02:26 +01:00
|
|
|
const emit = defineEmits<{
|
|
|
|
(ev: 'created', payload: any): void;
|
|
|
|
(ev: 'updated'): void;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
role?: any;
|
|
|
|
readonly?: boolean;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const role = props.role;
|
|
|
|
|
|
|
|
let name = $ref(role?.name ?? 'New Role');
|
|
|
|
let description = $ref(role?.description ?? '');
|
2023-01-13 00:23:52 +01:00
|
|
|
let rolePermission = $ref(role?.isAdministrator ? 'administrator' : role?.isModerator ? 'moderator' : 'normal');
|
2023-01-12 13:02:26 +01:00
|
|
|
let color = $ref(role?.color ?? null);
|
2023-01-13 03:03:54 +01:00
|
|
|
let target = $ref(role?.target ?? 'manual');
|
|
|
|
let condFormula = $ref(role?.condFormula ?? { id: uuid(), type: 'isRemote' });
|
2023-01-12 13:02:26 +01:00
|
|
|
let isPublic = $ref(role?.isPublic ?? false);
|
|
|
|
let canEditMembersByModerator = $ref(role?.canEditMembersByModerator ?? false);
|
2023-01-15 11:10:39 +01:00
|
|
|
|
|
|
|
const options = reactive<Record<typeof ROLE_OPTIONS[number], { useDefault: boolean; priority: number; value: any; }>>({});
|
|
|
|
for (const ROLE_OPTION of ROLE_OPTIONS) {
|
|
|
|
const _options = role?.options ?? {};
|
|
|
|
options[ROLE_OPTION] = {
|
|
|
|
useDefault: _options[ROLE_OPTION]?.useDefault ?? true,
|
|
|
|
priority: _options[ROLE_OPTION]?.priority ?? 0,
|
|
|
|
value: _options[ROLE_OPTION]?.value ?? instance.baseRole[ROLE_OPTION],
|
|
|
|
};
|
|
|
|
}
|
2023-01-12 13:02:26 +01:00
|
|
|
|
2023-01-13 03:04:58 +01:00
|
|
|
if (_DEV_) {
|
|
|
|
watch($$(condFormula), () => {
|
|
|
|
console.log(JSON.parse(JSON.stringify(condFormula)));
|
|
|
|
}, { deep: true });
|
|
|
|
}
|
2023-01-13 03:03:54 +01:00
|
|
|
|
2023-01-15 11:10:39 +01:00
|
|
|
function getPriorityIcon(option) {
|
|
|
|
if (option.priority === 2) return 'ti ti-arrows-up';
|
|
|
|
if (option.priority === 1) return 'ti ti-arrow-narrow-up';
|
|
|
|
return 'ti ti-point';
|
2023-01-12 13:02:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
async function save() {
|
|
|
|
if (props.readonly) return;
|
|
|
|
if (role) {
|
|
|
|
os.apiWithDialog('admin/roles/update', {
|
|
|
|
roleId: role.id,
|
|
|
|
name,
|
|
|
|
description,
|
|
|
|
color: color === '' ? null : color,
|
2023-01-13 03:03:54 +01:00
|
|
|
target,
|
|
|
|
condFormula,
|
2023-01-13 00:23:52 +01:00
|
|
|
isAdministrator: rolePermission === 'administrator',
|
|
|
|
isModerator: rolePermission === 'moderator',
|
2023-01-12 13:02:26 +01:00
|
|
|
isPublic,
|
|
|
|
canEditMembersByModerator,
|
2023-01-15 11:10:39 +01:00
|
|
|
options,
|
2023-01-12 13:02:26 +01:00
|
|
|
});
|
|
|
|
emit('updated');
|
|
|
|
} else {
|
|
|
|
const created = await os.apiWithDialog('admin/roles/create', {
|
|
|
|
name,
|
|
|
|
description,
|
|
|
|
color: color === '' ? null : color,
|
2023-01-13 03:03:54 +01:00
|
|
|
target,
|
|
|
|
condFormula,
|
2023-01-13 00:23:52 +01:00
|
|
|
isAdministrator: rolePermission === 'administrator',
|
|
|
|
isModerator: rolePermission === 'moderator',
|
2023-01-12 13:02:26 +01:00
|
|
|
isPublic,
|
|
|
|
canEditMembersByModerator,
|
2023-01-15 11:10:39 +01:00
|
|
|
options,
|
2023-01-12 13:02:26 +01:00
|
|
|
});
|
|
|
|
emit('created', created);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" module>
|
|
|
|
|
|
|
|
</style>
|