Skip to content

Commit dca39fc

Browse files
commiting prod build
2 parents ac61719 + 6d48aaf commit dca39fc

56 files changed

Lines changed: 318 additions & 101 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/Http/Controllers/Api/DatabasesController.php

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,53 @@ public function deleteDatabase(Request $request)
404404
}
405405
}
406406

407+
/**
408+
* Run command against a database
409+
*
410+
* URL: /api/databases/{database}/command
411+
* Method: POST
412+
* Description: Return the results of a database command
413+
* ToDo: setup a method to analyse the result before returning
414+
*
415+
* @param Request $request
416+
* @param $database
417+
* @return mixed
418+
*
419+
* @throws MongoDB\Driver\Exception\Exception
420+
*/
421+
public function databaseCommand(Request $request, $database)
422+
{
423+
try {
424+
// primitive validation
425+
if ($request->get('database') == $database) {
426+
// create the database Todo: !! may not be required !!
427+
//$db = $this->mongo->connectClientDb($database);
428+
429+
// connect the manager
430+
$this->mongo->connectManager();
431+
/** @var MongoDB\Driver\Manager $manager */
432+
$manager = $this->mongo->getManager();
433+
$params = $request->get('params');
434+
$command = json_decode($params['command'], true);
435+
436+
/** @var MongoDB\Collection $coll */
437+
$command = new MongoDB\Driver\Command($command);
438+
439+
// ToDo !! analyse results and act accordingly !!
440+
$results = $manager->executeCommand($database, $command);
441+
442+
// be good be good! - Johnny !!
443+
return response()->success('success', array('results' => $results->toArray()[0] ));
444+
445+
} else {
446+
return response()->error('failed', array('error' => 'database names mismatched'));
447+
}
448+
}
449+
catch (\Exception $e) {
450+
return response()->error('failed', array('error' => $e->getMessage()));
451+
}
452+
}
453+
407454
/**
408455
*
409456
* @inheritDoc

app/Http/Controllers/Api/ServerController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ private function getVersion()
134134
{
135135
try {
136136
$protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http';
137-
$url = $protocol . '://' . $_SERVER['HTTP_HOST'] . '/version.php';
137+
//$url = $protocol . '://' . $_SERVER['HTTP_HOST'] . '/version.php';
138+
$url = './version.php'; // this handles a relative PATH
138139
// initialise curl
139140
$ch = curl_init();
140141

public/img/icon/delete.png

1.43 KB
Loading

public/js/app.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/js/api/database.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,18 @@ export default {
5959
names: names,
6060
_token: window.axios.defaults.headers.common['X-CSRF-TOKEN']
6161
});
62+
},
63+
64+
/*
65+
* Run a command against a database
66+
* POST /api/v1/database/{database}/command
67+
*/
68+
databaseCommand: ( data ) => {
69+
return axios.post( MONGO_CONFIG.API_URL + '/databases/' + data.database + '/command',
70+
{
71+
database: data.database,
72+
params: data.params,
73+
_token: window.axios.defaults.headers.common['X-CSRF-TOKEN']
74+
});
6275
}
6376
}

resources/js/app.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,11 @@ if (currentLang) {
106106
locale = currentLang;
107107
}
108108
if (!currentLang) {
109-
axios.get( MONGO_CONFIG.WEB_URL + '/js/acceptLang.js' )
109+
/*axios.get( MONGO_CONFIG.WEB_URL + '/js/acceptLang.js' )
110+
.then( (response) => {
111+
locale = userLang === response.data ? userLang : response.data;
112+
});*/
113+
axios.get( 'js/acceptLang.js' )
110114
.then( (response) => {
111115
locale = userLang === response.data ? userLang : response.data;
112116
});

resources/js/components/admin/ListCard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
}
7777
7878
.image-rating-container.over {
79-
background: $white url("/img/thumbs-color-over.jpg") no-repeat scroll 0 0;
79+
background: $white url("./img/thumbs-color-over.jpg") no-repeat scroll 0 0;
8080
}
8181
}
8282

resources/js/components/admin/NoResultsFound.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
<transition name="slide-in-top">
5454
<div class="no-results-notification-container" v-show="show">
5555
<div class="noresult-notification">
56-
<img src="/img/error.svg"/> {{ errorMessage }}
56+
<img src="img/error.svg"/> {{ errorMessage }}
5757
</div>
5858
</div>
5959
</transition>

resources/js/components/admin/database/DatabaseView.vue

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,19 @@
133133
</style>
134134

135135
<template>
136-
<div ref="pmaDatabaseView" id="pma-databases-view" class="pma-database-view align-left" v-show="show">
136+
<div ref="pmaDatabaseView" id="pma-database-view" class="pma-database-view align-left" v-show="show">
137137
<database-top-view></database-top-view>
138138
<database-card v-bind:db="getDatabase"></database-card>
139-
<NewCollection></NewCollection>
139+
<new-collection></new-collection>
140+
<commands></commands>
141+
<execute></execute>
142+
<transfer></transfer>
143+
<import></import>
144+
<export></export>
145+
<profile></profile>
146+
<repair></repair>
147+
<authentication></authentication>
148+
<drop></drop>
140149
</div>
141150
</template>
142151

@@ -152,6 +161,15 @@
152161
import DatabaseTopView from "./top/DatabaseTopView";
153162
import DatabaseCard from "./DatabaseCard";
154163
import NewCollection from "./collection/NewCollection";
164+
import Commands from "./database/Command";
165+
import Execute from "./database/Execute";
166+
import Transfer from "./database/Transfer";
167+
import Import from "./database/Import";
168+
import Export from "./database/Export";
169+
import Profile from "./database/Profile";
170+
import Repair from "./database/Repair";
171+
import Authentication from "./database/Authentication";
172+
import Drop from "./database/Drop";
155173
156174
export default {
157175
/*
@@ -160,7 +178,16 @@
160178
components: {
161179
DatabaseTopView,
162180
DatabaseCard,
163-
NewCollection
181+
NewCollection,
182+
Commands,
183+
Execute,
184+
Transfer,
185+
Import,
186+
Export,
187+
Profile,
188+
Repair,
189+
Authentication,
190+
Drop
164191
},
165192
166193
/*

resources/js/components/admin/database/collection/CollectionCard.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
130130
.panel-modal-inner {
131131
/* background: $white; */
132-
background: $white url("/img/white-bg.jpg") repeat center center;
132+
background: $white url('/img/white-bg.jpg') repeat center center;
133133
background-size: cover;
134134
box-shadow: 0 0 4px 0 rgba(0,0,0,0.12), 0 4px 4px 0 rgba(0,0,0,0.24);
135135
border-left: 5px solid $orange;
@@ -378,13 +378,13 @@
378378
</tr>
379379
</table>
380380
<div ref="query-fields-list" class="fields-menu">
381-
<span class="fields-control"><span class="pma-link" title="Click to close" v-on:click="closeQueryFields()"><img alt="Select" src="/img/icon/accept.png" /></span></span>
381+
<span class="fields-control"><span class="pma-link" title="Click to close" v-on:click="closeQueryFields()"><img alt="Select" src="img/icon/accept.png" /></span></span>
382382
<ul>
383383
<!-- to do fields list -->
384384
</ul>
385385
</div>
386386
<div ref="query-hints-list" class="fields-menu">
387-
<span class="fields-control"><span class="pma-link" title="Click to close" v-on:click="closeQueryHints()"><img alt="Select" src="/img/icon/accept.png" /></span></span>
387+
<span class="fields-control"><span class="pma-link" title="Click to close" v-on:click="closeQueryHints()"><img alt="Select" src="img/icon/accept.png" /></span></span>
388388
<ul>
389389
<!-- to do hints list -->
390390
</ul>

0 commit comments

Comments
 (0)