mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-11 02:43:45 +02:00
Minor changes
Changes CopyOnClick to allow any. Allows database information to be copied on click. Changes layouts on database/backups to match the network tab. Changes text to lighten it one level from 400 to 300 for easier visibility. Moves database api endpoints to their own folder for some organization.
This commit is contained in:
31
resources/scripts/api/server/databases/getServerDatabases.ts
Normal file
31
resources/scripts/api/server/databases/getServerDatabases.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import http from '@/api/http';
|
||||
|
||||
export interface ServerDatabase {
|
||||
id: string;
|
||||
name: string;
|
||||
username: string;
|
||||
connectionString: string;
|
||||
allowConnectionsFrom: string;
|
||||
password?: string;
|
||||
}
|
||||
|
||||
export const rawDataToServerDatabase = (data: any): ServerDatabase => ({
|
||||
id: data.id,
|
||||
name: data.name,
|
||||
username: data.username,
|
||||
connectionString: `${data.host.address}:${data.host.port}`,
|
||||
allowConnectionsFrom: data.connections_from,
|
||||
password: data.relationships && data.relationships.password ? data.relationships.password.attributes.password : undefined,
|
||||
});
|
||||
|
||||
export default (uuid: string, includePassword = true): Promise<ServerDatabase[]> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
http.get(`/api/client/servers/${uuid}/databases`, {
|
||||
params: includePassword ? { include: 'password' } : undefined,
|
||||
})
|
||||
.then(response => resolve(
|
||||
(response.data.data || []).map((item: any) => rawDataToServerDatabase(item.attributes))
|
||||
))
|
||||
.catch(reject);
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user