Improve admin UI (#2802)
This commit is contained in:
parent
7e50e03cfb
commit
7d11c8b767
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="qldxjjsrseehkusjuoooapmsprvfrxyl mk-admin-card">
|
<div class="qldxjjsrseehkusjuoooapmsprvfrxyl mk-admin-card">
|
||||||
<header>%i18n:@announcements%</header>
|
<header>%i18n:@announcements%</header>
|
||||||
<textarea v-model="broadcasts"></textarea>
|
<textarea v-model="broadcasts" placeholder='[ { "title": "Title1", "text": "Text1" }, { "title": "Title2", "text": "Text2" } ]'></textarea>
|
||||||
<button class="ui" @click="save">%i18n:@save%</button>
|
<button class="ui" @click="save">%i18n:@save%</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -22,8 +22,21 @@ export default Vue.extend({
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
save() {
|
save() {
|
||||||
|
let json;
|
||||||
|
|
||||||
|
try {
|
||||||
|
json = JSON.parse(this.broadcasts);
|
||||||
|
} catch (e) {
|
||||||
|
(this as any).os.apis.dialog({ text: `Failed: ${e}` });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
(this as any).api('admin/update-meta', {
|
(this as any).api('admin/update-meta', {
|
||||||
broadcasts: JSON.parse(this.broadcasts)
|
broadcasts: json
|
||||||
|
}).then(() => {
|
||||||
|
(this as any).os.apis.dialog({ text: `Saved` });
|
||||||
|
}.catch(e => {
|
||||||
|
(this as any).os.apis.dialog({ text: `Failed ${e}` });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<x-cpu-memory :connection="connection"/>
|
<x-cpu-memory :connection="connection"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form">
|
<div v-if="this.$store.state.i && this.$store.state.i.isAdmin" class="form">
|
||||||
<div>
|
<div>
|
||||||
<label>
|
<label>
|
||||||
<p>%i18n:@banner-url%</p>
|
<p>%i18n:@banner-url%</p>
|
||||||
@ -81,6 +81,8 @@ export default Vue.extend({
|
|||||||
invite() {
|
invite() {
|
||||||
(this as any).api('admin/invite').then(x => {
|
(this as any).api('admin/invite').then(x => {
|
||||||
this.inviteCode = x.code;
|
this.inviteCode = x.code;
|
||||||
|
}).catch(e => {
|
||||||
|
(this as any).os.apis.dialog({ text: `Failed ${e}` });
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
updateMeta() {
|
updateMeta() {
|
||||||
@ -88,6 +90,10 @@ export default Vue.extend({
|
|||||||
disableRegistration: this.disableRegistration,
|
disableRegistration: this.disableRegistration,
|
||||||
disableLocalTimeline: this.disableLocalTimeline,
|
disableLocalTimeline: this.disableLocalTimeline,
|
||||||
bannerUrl: this.bannerUrl
|
bannerUrl: this.bannerUrl
|
||||||
|
}).then(() => {
|
||||||
|
(this as any).os.apis.dialog({ text: `Saved` });
|
||||||
|
}).catch(e => {
|
||||||
|
(this as any).os.apis.dialog({ text: `Failed ${e}` });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,10 @@ export default Vue.extend({
|
|||||||
save() {
|
save() {
|
||||||
(this as any).api('admin/update-meta', {
|
(this as any).api('admin/update-meta', {
|
||||||
hidedTags: this.hidedTags.split('\n')
|
hidedTags: this.hidedTags.split('\n')
|
||||||
|
}).then(() => {
|
||||||
|
(this as any).os.apis.dialog({ text: `Saved` });
|
||||||
|
}).catch(e => {
|
||||||
|
(this as any).os.apis.dialog({ text: `Failed ${e}` });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,18 +21,24 @@ export default Vue.extend({
|
|||||||
async suspendUser() {
|
async suspendUser() {
|
||||||
this.suspending = true;
|
this.suspending = true;
|
||||||
|
|
||||||
const user = await (this as any).os.api(
|
const process = async () => {
|
||||||
"users/show",
|
const user = await (this as any).os.api(
|
||||||
parseAcct(this.username)
|
"users/show",
|
||||||
);
|
parseAcct(this.username)
|
||||||
|
);
|
||||||
|
|
||||||
await (this as any).os.api("admin/suspend-user", {
|
await (this as any).os.api("admin/suspend-user", {
|
||||||
userId: user.id
|
userId: user.id
|
||||||
|
});
|
||||||
|
|
||||||
|
(this as any).os.apis.dialog({ text: "%i18n:@suspended%" });
|
||||||
|
};
|
||||||
|
|
||||||
|
await process().catch(e => {
|
||||||
|
(this as any).os.apis.dialog({ text: `Failed: ${e}` });
|
||||||
});
|
});
|
||||||
|
|
||||||
this.suspending = false;
|
this.suspending = false;
|
||||||
|
|
||||||
(this as any).os.apis.dialog({ text: "%i18n:@suspended%" });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -21,18 +21,25 @@ export default Vue.extend({
|
|||||||
async unsuspendUser() {
|
async unsuspendUser() {
|
||||||
this.unsuspending = true;
|
this.unsuspending = true;
|
||||||
|
|
||||||
const user = await (this as any).os.api(
|
const process = async () => {
|
||||||
"users/show",
|
const user = await (this as any).os.api(
|
||||||
parseAcct(this.username)
|
"users/show",
|
||||||
);
|
parseAcct(this.username)
|
||||||
|
);
|
||||||
|
|
||||||
await (this as any).os.api("admin/unsuspend-user", {
|
await (this as any).os.api("admin/unsuspend-user", {
|
||||||
userId: user.id
|
userId: user.id
|
||||||
|
});
|
||||||
|
|
||||||
|
(this as any).os.apis.dialog({ text: "%i18n:@unsuspended%" });
|
||||||
|
};
|
||||||
|
|
||||||
|
await process().catch(e => {
|
||||||
|
(this as any).os.apis.dialog({ text: `Failed: ${e}` });
|
||||||
});
|
});
|
||||||
|
|
||||||
this.unsuspending = false;
|
this.unsuspending = false;
|
||||||
|
|
||||||
(this as any).os.apis.dialog({ text: "%i18n:@unsuspended%" });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -21,18 +21,24 @@ export default Vue.extend({
|
|||||||
async unverifyUser() {
|
async unverifyUser() {
|
||||||
this.unverifying = true;
|
this.unverifying = true;
|
||||||
|
|
||||||
const user = await (this as any).os.api(
|
const process = async () => {
|
||||||
"users/show",
|
const user = await (this as any).os.api(
|
||||||
parseAcct(this.username)
|
"users/show",
|
||||||
);
|
parseAcct(this.username)
|
||||||
|
);
|
||||||
|
|
||||||
await (this as any).os.api("admin/unverify-user", {
|
await (this as any).os.api("admin/unverify-user", {
|
||||||
userId: user.id
|
userId: user.id
|
||||||
|
});
|
||||||
|
|
||||||
|
(this as any).os.apis.dialog({ text: "%i18n:@unverified%" });
|
||||||
|
};
|
||||||
|
|
||||||
|
await process().catch(e => {
|
||||||
|
(this as any).os.apis.dialog({ text: `Failed: ${e}` });
|
||||||
});
|
});
|
||||||
|
|
||||||
this.unverifying = false;
|
this.unverifying = false;
|
||||||
|
|
||||||
(this as any).os.apis.dialog({ text: "%i18n:@unverified%" });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -21,18 +21,24 @@ export default Vue.extend({
|
|||||||
async verifyUser() {
|
async verifyUser() {
|
||||||
this.verifying = true;
|
this.verifying = true;
|
||||||
|
|
||||||
const user = await (this as any).os.api(
|
const process = async () => {
|
||||||
"users/show",
|
const user = await (this as any).os.api(
|
||||||
parseAcct(this.username)
|
"users/show",
|
||||||
);
|
parseAcct(this.username)
|
||||||
|
);
|
||||||
|
|
||||||
await (this as any).os.api("admin/verify-user", {
|
await (this as any).os.api("admin/verify-user", {
|
||||||
userId: user.id
|
userId: user.id
|
||||||
|
});
|
||||||
|
|
||||||
|
(this as any).os.apis.dialog({ text: "%i18n:@verified%" });
|
||||||
|
};
|
||||||
|
|
||||||
|
await process().catch(e => {
|
||||||
|
(this as any).os.apis.dialog({ text: `Failed: ${e}` });
|
||||||
});
|
});
|
||||||
|
|
||||||
this.verifying = false;
|
this.verifying = false;
|
||||||
|
|
||||||
(this as any).os.apis.dialog({ text: "%i18n:@verified%" });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -3,9 +3,15 @@
|
|||||||
<nav>
|
<nav>
|
||||||
<ul>
|
<ul>
|
||||||
<li @click="nav('dashboard')" :class="{ active: page == 'dashboard' }">%fa:chalkboard .fw%%i18n:@dashboard%</li>
|
<li @click="nav('dashboard')" :class="{ active: page == 'dashboard' }">%fa:chalkboard .fw%%i18n:@dashboard%</li>
|
||||||
<li @click="nav('users')" :class="{ active: page == 'users' }">%fa:users .fw%%i18n:@users%</li>
|
|
||||||
<li @click="nav('announcements')" :class="{ active: page == 'announcements' }">%fa:broadcast-tower .fw%%i18n:@announcements%</li>
|
<li v-if="this.$store.state.i && this.$store.state.i.isAdmin"
|
||||||
<li @click="nav('hashtags')" :class="{ active: page == 'hashtags' }">%fa:hashtag .fw%%i18n:@hashtags%</li>
|
@click="nav('users')" :class="{ active: page == 'users' }">%fa:users .fw%%i18n:@users%</li>
|
||||||
|
|
||||||
|
<li v-if="this.$store.state.i && this.$store.state.i.isAdmin"
|
||||||
|
@click="nav('announcements')" :class="{ active: page == 'announcements' }">%fa:broadcast-tower .fw%%i18n:@announcements%</li>
|
||||||
|
|
||||||
|
<li v-if="this.$store.state.i && this.$store.state.i.isAdmin"
|
||||||
|
@click="nav('hashtags')" :class="{ active: page == 'hashtags' }">%fa:hashtag .fw%%i18n:@hashtags%</li>
|
||||||
|
|
||||||
<!-- <li @click="nav('drive')" :class="{ active: page == 'drive' }">%fa:cloud .fw%%i18n:@drive%</li> -->
|
<!-- <li @click="nav('drive')" :class="{ active: page == 'drive' }">%fa:cloud .fw%%i18n:@drive%</li> -->
|
||||||
<!-- <li @click="nav('update')" :class="{ active: page == 'update' }">%i18n:@update%</li> -->
|
<!-- <li @click="nav('update')" :class="{ active: page == 'update' }">%i18n:@update%</li> -->
|
||||||
|
Loading…
Reference in New Issue
Block a user