4848 <span class =" real" >{{ key.apiKey }}</span >
4949 </span >
5050 </td >
51- <td >read-only </td >
51+ <td >{{ key.type }} </td >
5252 <td >{{ key.description }}</td >
5353 <td >{{ key.expires }}</td >
5454 <td class =" text-center" >
8080 <label for =" api-key-description" class =" col-form-label" >Description</label >
8181 <input v-model =" apiKeyDescription" class =" form-control" id =" api-key-description" />
8282 </div >
83+ <div class =" mb-3" >
84+ <label for =" api-key-type" class =" col-form-label" >Type</label >
85+ <select v-model =" apiKeyType" class =" form-select" id =" api-key-type" >
86+ <option value =" read-only" >Read-Only</option >
87+ <option value =" read-write" >Read-Write</option >
88+ </select >
89+ </div >
8390 <div class =" mb-3" >
8491 <label for =" api-key-expires" class =" col-form-label" >Expires</label >
8592 <input v-model =" apiKeyExpires" type =" datetime-local" class =" form-control" id =" api-key-expires" />
@@ -117,6 +124,7 @@ export default {
117124 addApiKeyUrl: ' /api_keys' ,
118125 apiKeys: null ,
119126 apiKeyDescription: ' User API Key' ,
127+ apiKeyType: ' read-only' ,
120128 apiKeyExpires: new moment ().add (365 , ' days' ).format (' YYYY-MM-DDTHH:mm' ),
121129 lastCopied: null ,
122130 refreshUrl: ' /api_keys/meta'
@@ -132,7 +140,8 @@ export default {
132140 },
133141 async addApiKey () {
134142 const ua = new UserAgent ({baseURL: window .location .href });
135- await ua .post (this .addApiKeyUrl , {form: {description: this .apiKeyDescription , expires: this .apiKeyExpires }});
143+ const form = {description: this .apiKeyDescription , type: this .apiKeyType , expires: this .apiKeyExpires };
144+ await ua .post (this .addApiKeyUrl , {form});
136145 this .doApiRefresh ();
137146 },
138147 async deleteApiKey (key ) {
@@ -147,6 +156,7 @@ export default {
147156 id: key .id ,
148157 apiKey: key .api_key ,
149158 description: key .description ,
159+ type: key .write_access ? ' read-write' : ' read-only' ,
150160 expires: moment (key .expires_epoch * 1000 ).fromNow (),
151161 removeUrl: ` /api_keys/${ key .id } `
152162 });
0 commit comments