Skip to content
This repository was archived by the owner on Apr 19, 2023. It is now read-only.

Commit 71d889f

Browse files
✨ Add Developer categpry
1 parent 844a30e commit 71d889f

File tree

9 files changed

+117
-21
lines changed

9 files changed

+117
-21
lines changed

components/Manage.vue

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,27 @@
4848
<font-awesome-icon class="nav-icon" icon="database" fixed-width />
4949
<span>Data &amp; security</span>
5050
</nuxt-link>
51-
<nuxt-link class="item" :to="`/manage/${$route.params.team}/api-keys`">
51+
<nuxt-link
52+
class="item item--type-parent"
53+
:to="`/manage/${$route.params.team}/developer/api-keys`"
54+
>
5255
<font-awesome-icon class="nav-icon" icon="code" fixed-width />
5356
<span>Developer</span>
5457
</nuxt-link>
58+
<nav v-if="$route.path.includes('/developer/')" class="sub-nav">
59+
<nuxt-link
60+
class="sub-item"
61+
:to="`/manage/${$route.params.team}/developer/api-keys`"
62+
>
63+
<span>API keys</span>
64+
</nuxt-link>
65+
<nuxt-link
66+
class="sub-item"
67+
:to="`/manage/${$route.params.team}/developer/webhooks`"
68+
>
69+
<span>Webhooks</span>
70+
</nuxt-link>
71+
</nav>
5572
</nav>
5673
</aside>
5774
<div class="card">

components/Navbar.vue

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ import { mapGetters } from "vuex";
163163
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
164164
import { library } from "@fortawesome/fontawesome-svg-core";
165165
import Trap from "vue-focus-lock";
166-
import Feeedback from "feeedback";
166+
// import Feeedback from "feeedback";
167167
import {
168168
faBell,
169169
faQuestionCircle,
@@ -172,14 +172,14 @@ import {
172172
} from "@fortawesome/free-solid-svg-icons";
173173
import Notifications from "@/components/Notifications.vue";
174174
library.add(faBell, faQuestionCircle, faBars, faTimes);
175-
const feedback = new Feeedback({
176-
onSubmit: result =>
177-
new Promise((resolve, reject) => {
178-
if (window.agastya && typeof window.agastya.secureTrack === "function")
179-
window.agastya.secureTrack({ feedback: result });
180-
resolve();
181-
})
182-
});
175+
// const feedback = new Feeedback({
176+
// onSubmit: result =>
177+
// new Promise((resolve, reject) => {
178+
// if (window.agastya && typeof window.agastya.secureTrack === "function")
179+
// window.agastya.secureTrack({ feedback: result });
180+
// resolve();
181+
// })
182+
// });
183183
184184
@Component({
185185
computed: mapGetters({
@@ -249,7 +249,7 @@ export default class Card extends Vue {
249249
});
250250
}
251251
private feedback() {
252-
feedback.open();
252+
// feedback.open();
253253
}
254254
}
255255
</script>

locales/en.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ export default {
2828
"You don't have the permission to perform this action",
2929
"user-is-member-already": "This user is already a member",
3030
"invalid-2fa-token": "This 2FA verification code is incorrect",
31-
"oauth-no-email": "We couldn't find an account with that email"
31+
"oauth-no-email": "We couldn't find an account with that email",
32+
"domain-missing-file": "We couldn't find the verification file",
33+
"domain-missing-dns": "We didn't find the DNS record",
34+
"domain-already-verified": "This domain is already verified",
35+
"cannot-invite-domain": "You cannot invite a member from this domain"
3236
},
3337
securityEvents: {
3438
"user.created": "Created account",
@@ -76,11 +80,7 @@ export default {
7680
"billing-source-created": "Your payment method has been created",
7781
"billing-source-updated": "Your payment method has been updated",
7882
"billing-source-deleted": "Your payment method has been deleted",
79-
"domain-unable-to-verify": "We weren't able to verify your domain",
80-
"domain-missing-file": "We couldn't find the verification file",
81-
"domain-missing-dns": "We didn't find the DNS record",
82-
"domain-already-verified": "This domain is already verified",
83-
"cannot-invite-domain": "You cannot invite a member from this domain"
83+
"domain-unable-to-verify": "We weren't able to verify your domain"
8484
},
8585
membershipRoles: {
8686
1: "Owner",

pages/users/_slug/access-tokens/_key.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<div v-if="accessToken">
2929
<h2>Use access token</h2>
3030
<Input
31-
label="access token"
31+
label="Access token"
3232
:value="accessToken.jwtAccessToken"
3333
disabled
3434
/>

store/manage.ts

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ export const state = (): RootState => ({
1818
apiKeys: {},
1919
apiKey: {},
2020
domains: {},
21-
domain: {}
21+
domain: {},
22+
webhooks: {},
23+
webhook: {}
2224
});
2325

2426
export const mutations: MutationTree<RootState> = {
@@ -149,6 +151,26 @@ export const mutations: MutationTree<RootState> = {
149151
currentDomains[team][id] = { ...domain };
150152
Vue.set(state, "domain", currentDomains);
151153
},
154+
setWebhooks(state: RootState, { team, webhooks, start, next }): void {
155+
const currentWebhooks = state.webhooks;
156+
currentWebhooks[team] = currentWebhooks[team] || emptyPagination;
157+
if (start) {
158+
currentWebhooks[team].data = [
159+
...currentWebhooks[team].data,
160+
...webhooks.data
161+
];
162+
} else {
163+
currentWebhooks[team].data = webhooks.data;
164+
}
165+
currentWebhooks[team].next = next;
166+
Vue.set(state, "webhooks", currentWebhooks);
167+
},
168+
setWebhook(state: RootState, { team, webhook, id }): void {
169+
const currentWebhooks = state.webhook;
170+
currentWebhooks[team] = currentWebhooks[team] || {};
171+
currentWebhooks[team][id] = { ...webhook };
172+
Vue.set(state, "webhook", currentWebhooks);
173+
},
152174
setPricingPlans(state: RootState, pricingPlans: any): void {
153175
Vue.set(state, "pricingPlans", pricingPlans);
154176
},
@@ -172,6 +194,8 @@ export const mutations: MutationTree<RootState> = {
172194
delete state.apiKey;
173195
delete state.domains;
174196
delete state.domain;
197+
delete state.webhooks;
198+
delete state.webhook;
175199
}
176200
};
177201

@@ -413,6 +437,41 @@ export const actions: ActionTree<RootState, RootState> = {
413437
data
414438
);
415439
return dispatch("getDomain", context);
440+
},async getWebhooks({ commit }, { team, start = 0 }) {
441+
const webhooks: any = (await this.$axios.get(
442+
`/organizations/${team}/webhooks?start=${start}`
443+
)).data;
444+
commit("setWebhooks", { team, webhooks, start, next: webhooks.next });
445+
return webhooks;
446+
},
447+
async getWebhook({ commit }, { team, id }) {
448+
const webhook: any = (await this.$axios.get(
449+
`/organizations/${team}/webhooks/${id}`
450+
)).data;
451+
commit("setWebhook", { team, webhook, id });
452+
return webhook;
453+
},
454+
async createWebhook({ dispatch }, context) {
455+
const data = { ...context };
456+
delete data.team;
457+
await this.$axios.put(`/organizations/${context.team}/webhooks`, data);
458+
return dispatch("getWebhooks", { team: context.team });
459+
},
460+
async deleteWebhook({ dispatch }, context) {
461+
await this.$axios.delete(
462+
`/organizations/${context.team}/webhooks/${context.id}`
463+
);
464+
return dispatch("getWebhooks", { team: context.team });
465+
},
466+
async updateWebhook({ dispatch }, context) {
467+
const data = { ...context };
468+
delete data.team;
469+
delete data.id;
470+
await this.$axios.patch(
471+
`/organizations/${context.team}/webhooks/${context.id}`,
472+
data
473+
);
474+
return dispatch("getWebhook", context);
416475
},
417476
async getEvents({ commit, rootGetters }) {
418477
const org = rootGetters["auth/activeOrganization"];

store/users.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export const actions: ActionTree<RootState, RootState> = {
158158
},
159159
async deleteMembership({ dispatch }, context) {
160160
await this.$axios.delete(
161-
`/users/${context.slug}/memberships/${context.id}`
161+
`/${context.slug}/memberships/${context.id}`
162162
);
163163
return dispatch("getMemberships", { slug: context.slug });
164164
},

types/manage.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export interface Membership extends IdRow {
1515
export interface ApiKey extends IdRow {
1616
jwtApiKey: string;
1717
scopes: string;
18-
organizationId: number;
1918
ipRestrictions?: string;
2019
referrerRestrictions?: string;
2120
}
@@ -24,6 +23,13 @@ export interface Domain extends Row {
2423
verificationCode: string;
2524
isVerified: boolean;
2625
}
26+
export interface Webhook extends Row {
27+
url: string;
28+
event: string;
29+
secret: string;
30+
contentType: string;
31+
isActive: boolean;
32+
}
2733

2834
export interface Members extends Paginated {
2935
data: Membership[];
@@ -43,6 +49,9 @@ export interface ApiKeys extends Paginated {
4349
export interface Domains extends Paginated {
4450
data: Domain[];
4551
}
52+
export interface Webhooks extends Paginated {
53+
data: Webhook[];
54+
}
4655
export interface Address {
4756
state: string;
4857
country: string;
@@ -82,6 +91,10 @@ export interface ApiKeysKV {
8291
export interface DomainsKV {
8392
[index: string]: Domains;
8493
}
94+
export interface WebhooksKV {
95+
[index: string]: Webhooks;
96+
}
97+
8598
export interface SingleSubscriptionKV {
8699
[index: string]: {
87100
[index: string]: subscriptions.ISubscription;
@@ -107,6 +120,11 @@ export interface SingleDomainKV {
107120
[index: string]: Domain;
108121
};
109122
}
123+
export interface SingleWebhookKV {
124+
[index: string]: {
125+
[index: string]: Webhook;
126+
};
127+
}
110128

111129
export interface RootState {
112130
membership?: Membership;
@@ -123,6 +141,8 @@ export interface RootState {
123141
apiKey: SingleApiKeyKV;
124142
domains: DomainsKV;
125143
domain: SingleDomainKV;
144+
webhooks: WebhooksKV;
145+
webhook: SingleWebhookKV;
126146
pricingPlans?: any;
127147
recentEvents?: any;
128148
isDownloading: boolean;

0 commit comments

Comments
 (0)