Remove developerMode toggle in token ui
This commit is contained in:
@@ -114,7 +114,6 @@ angular.module('Application').service('Client', ['$http', 'md5', 'Notification',
|
||||
isDev: false,
|
||||
progress: {},
|
||||
isCustomDomain: false,
|
||||
developerMode: false,
|
||||
region: null,
|
||||
size: null,
|
||||
memory: 0
|
||||
@@ -260,20 +259,6 @@ angular.module('Application').service('Client', ['$http', 'md5', 'Notification',
|
||||
}).error(defaultErrorHandler(callback));
|
||||
};
|
||||
|
||||
Client.prototype.changeDeveloperMode = function (enabled, password, callback) {
|
||||
var that = this;
|
||||
|
||||
var data = { password: password, enabled: enabled };
|
||||
post('/api/v1/developer', data).success(function (data, status) {
|
||||
if (status !== 200) return callback(new ClientError(status, data));
|
||||
|
||||
// will get overriden after polling for config, but ensures quick UI update
|
||||
that._config.developerMode = enabled;
|
||||
|
||||
callback(null);
|
||||
}).error(defaultErrorHandler(callback));
|
||||
};
|
||||
|
||||
Client.prototype.changeCloudronAvatar = function (avatarFile, callback) {
|
||||
var fd = new FormData();
|
||||
fd.append('avatar', avatarFile);
|
||||
@@ -586,8 +571,6 @@ angular.module('Application').service('Client', ['$http', 'md5', 'Notification',
|
||||
};
|
||||
|
||||
Client.prototype.getNonApprovedApps = function (callback) {
|
||||
if (!this._config.developerMode) return callback(null, []);
|
||||
|
||||
get('/api/v1/developer/apps').success(function (data, status) {
|
||||
if (status !== 200 || typeof data !== 'object') return callback(new ClientError(status, data));
|
||||
callback(null, data.apps || []);
|
||||
|
||||
@@ -260,7 +260,7 @@
|
||||
<a href="" class="appstore-category-link" ng-click="showCategory($event);" ng-class="{'category-active': category === 'project' }" category="project"><i class="fa fa-line-chart"></i> Project Management</a>
|
||||
<a href="" class="appstore-category-link" ng-click="showCategory($event);" ng-class="{'category-active': category === 'wiki' }" category="wiki"><i class="fa fa-wikipedia-w"></i> Wiki</a>
|
||||
<br/>
|
||||
<a href="" class="appstore-category-link" ng-click="showCategory($event);" ng-class="{'category-active': category === 'testing' }" category="testing" ng-show="false && config.developerMode">Testing</a>
|
||||
<!-- <a href="" class="appstore-category-link" ng-click="showCategory($event);" ng-class="{'category-active': category === 'testing' }" category="testing" ng-show="config.developerMode">Testing</a> -->
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
@@ -1,35 +1,3 @@
|
||||
<!-- Modal developer mode -->
|
||||
<div class="modal fade" id="developerModeChangeModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" ng-hide="config.developerMode">Enable API access</h4>
|
||||
<h4 class="modal-title" ng-show="config.developerMode">Disable API access</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form name="developerModeChangeForm" role="form" novalidate ng-submit="doChangeDeveloperMode(developerModeChangeForm)" autocomplete="off">
|
||||
<fieldset>
|
||||
<input type="password" style="display: none;">
|
||||
<div class="form-group" ng-class="{ 'has-error': (!developerModeChangeForm.password.$dirty && developerModeChange.error.password) || (developerModeChangeForm.password.$dirty && developerModeChangeForm.password.$invalid) }">
|
||||
<label class="control-label" for="inputDeveloperModeChangePassword">Give your password to verify this action</label>
|
||||
<div class="control-label" ng-show="(!developerModeChangeForm.password.$dirty && developerModeChange.error.password) || (developerModeChangeForm.password.$dirty && developerModeChangeForm.password.$invalid)">
|
||||
<small ng-show=" developerModeChangeForm.password.$dirty && developerModeChangeForm.password.$invalid">A password is required</small>
|
||||
<small ng-show="!developerModeChangeForm.password.$dirty && developerModeChange.error.password">Wrong password</small>
|
||||
</div>
|
||||
<input type="password" class="form-control" ng-model="developerModeChange.password" id="inputDeveloperModeChangePassword" name="password" required autofocus>
|
||||
</div>
|
||||
<input class="ng-hide" type="submit" ng-disabled="developerModeChangeForm.$invalid"/>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||
<button type="button" class="btn btn-danger" ng-hide="config.developerMode" ng-click="doChangeDeveloperMode(developerModeChangeForm)" ng-disabled="developerModeChangeForm.$invalid || developerModeChange.busy"><i class="fa fa-circle-o-notch fa-spin" ng-show="developerModeChange.busy"></i> Enable</button>
|
||||
<button type="button" class="btn btn-success" ng-show="config.developerMode" ng-click="doChangeDeveloperMode(developerModeChangeForm)" ng-disabled="developerModeChangeForm.$invalid || developerModeChange.busy"><i class="fa fa-circle-o-notch fa-spin" ng-show="developerModeChange.busy"></i> Disable</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal add client -->
|
||||
<div class="modal fade" id="clientAddModal" tabindex="-1" role="dialog">
|
||||
@@ -124,20 +92,12 @@
|
||||
<div class="card" style="margin-bottom: 15px;" ng-show="user.admin">
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
The Cloudron <a href="https://cloudron.io/references/api.html" target="_blank">REST API</a> can be used to manage all aspects of the Cloudron like adding users and installing apps.
|
||||
<br/>
|
||||
<br/>
|
||||
You can develop apps for the Cloudron using the <a href="https://cloudron.io/references/cli.html" target="_blank">command-line tool</a>. See the <a href="{{ config.webServerOrigin }}/documentation.html" target="_blank">docs</a> for more information.
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
Status
|
||||
</div>
|
||||
<div class="col-xs-6 text-right">
|
||||
<a href="" class="text-danger" ng-show="config.developerMode" ng-click="showChangeDeveloperMode()">Enabled</a>
|
||||
<a href="" ng-hide="config.developerMode" ng-click="showChangeDeveloperMode()">Disabled</a>
|
||||
<p>
|
||||
The Cloudron <a href="https://cloudron.io/references/api.html" target="_blank">REST API</a> can be used to manage all aspects of the Cloudron like adding users and installing apps.
|
||||
<br/>
|
||||
<br/>
|
||||
You can develop apps for the Cloudron using the <a href="https://cloudron.io/references/cli.html" target="_blank">command-line tool</a>. See the <a href="{{ config.webServerOrigin }}/documentation.html" target="_blank">docs</a> for more information.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -146,7 +106,7 @@
|
||||
|
||||
<div class="section-header">
|
||||
<div class="text-left">
|
||||
<h3>Personal access tokens <button class="btn btn-xs btn-primary btn-outline pull-right" ng-click="tokenAdd.show(apiClient)"><i class="fa fa-plus"></i> New Token</button> </h3>
|
||||
<h3>Access tokens <button class="btn btn-xs btn-primary btn-outline pull-right" ng-click="tokenAdd.show(apiClient)"><i class="fa fa-plus"></i> New Token</button> </h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -7,49 +7,6 @@ angular.module('Application').controller('TokensController', ['$scope', 'Client'
|
||||
$scope.activeClients = [];
|
||||
$scope.apiClient = {};
|
||||
|
||||
$scope.developerModeChange = {
|
||||
busy: false,
|
||||
error: {},
|
||||
password: ''
|
||||
};
|
||||
|
||||
function developerModeChangeReset () {
|
||||
$scope.developerModeChange.error.password = null;
|
||||
$scope.developerModeChange.password = '';
|
||||
|
||||
$scope.developerModeChangeForm.$setPristine();
|
||||
$scope.developerModeChangeForm.$setUntouched();
|
||||
}
|
||||
|
||||
$scope.doChangeDeveloperMode = function () {
|
||||
$scope.developerModeChange.error.password = null;
|
||||
$scope.developerModeChange.busy = true;
|
||||
|
||||
Client.changeDeveloperMode(!$scope.config.developerMode, $scope.developerModeChange.password, function (error) {
|
||||
if (error) {
|
||||
if (error.statusCode === 403) {
|
||||
$scope.developerModeChange.error.password = true;
|
||||
$scope.developerModeChange.password = '';
|
||||
$scope.developerModeChangeForm.password.$setPristine();
|
||||
$('#inputDeveloperModeChangePassword').focus();
|
||||
} else {
|
||||
console.error('Unable to change developer mode.', error);
|
||||
}
|
||||
} else {
|
||||
developerModeChangeReset();
|
||||
|
||||
$('#developerModeChangeModal').modal('hide');
|
||||
}
|
||||
|
||||
$scope.developerModeChange.busy = false;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.showChangeDeveloperMode = function () {
|
||||
developerModeChangeReset();
|
||||
$('#developerModeChangeModal').modal('show');
|
||||
};
|
||||
|
||||
$scope.clientAdd = {
|
||||
busy: false,
|
||||
error: {},
|
||||
@@ -223,7 +180,7 @@ angular.module('Application').controller('TokensController', ['$scope', 'Client'
|
||||
Client.onReady(refresh);
|
||||
|
||||
// setup all the dialog focus handling
|
||||
['developerModeChangeModal', 'clientAddModal'].forEach(function (id) {
|
||||
['clientAddModal'].forEach(function (id) {
|
||||
$('#' + id).on('shown.bs.modal', function () {
|
||||
$(this).find("[autofocus]:first").focus();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user