1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-02 20:35:25 +02:00

chore(project): add prettier for code format (#3645)

* chore(project): install prettier and lint-staged

* chore(project): apply prettier to html too

* chore(project): git ignore eslintcache

* chore(project): add a comment about format script

* chore(prettier): update printWidth

* chore(prettier): remove useTabs option

* chore(prettier): add HTML validation

* refactor(prettier): fix closing tags

* feat(prettier): define angular parser for html templates

* style(prettier): run prettier on codebase

Co-authored-by: Anthony Lapenna <lapenna.anthony@gmail.com>
This commit is contained in:
Chaim Lev-Ari 2020-04-11 00:54:53 +03:00 committed by GitHub
parent 6663073be1
commit cf5056d9c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
714 changed files with 31228 additions and 28305 deletions

View file

@ -1,18 +1,22 @@
<rd-widget>
<rd-widget-header icon="fa-plus" title-text="Create snapshot">
</rd-widget-header>
<rd-widget-header icon="fa-plus" title-text="Create snapshot"> </rd-widget-header>
<rd-widget-body>
<form class="form-horizontal">
<div class="form-group">
<label for="description" class="col-sm-3 col-lg-2 control-label text-left">Description</label>
<div class="col-sm-9 col-lg-10">
<input type="text" class="form-control" id="description" ng-model="$ctrl.formValues.Description">
<input type="text" class="form-control" id="description" ng-model="$ctrl.formValues.Description" />
</div>
</div>
<div class="form-group">
<div class="col-sm-12">
<button type="button" class="btn btn-primary btn-sm" ng-disabled="$ctrl.state.actionInProgress"
ng-click="$ctrl.createSnapshot()" button-spinner="$ctrl.state.actionInProgress">
<button
type="button"
class="btn btn-primary btn-sm"
ng-disabled="$ctrl.state.actionInProgress"
ng-click="$ctrl.createSnapshot()"
button-spinner="$ctrl.state.actionInProgress"
>
<span ng-hide="$ctrl.state.actionInProgress">Create snapshot</span>
<span ng-show="$ctrl.state.actionInProgress">Creating snapshot...</span>
</button>

View file

@ -2,6 +2,6 @@ angular.module('portainer.docker').component('storidgeSnapshotCreation', {
templateUrl: './storidgeSnapshotCreation.html',
controller: 'StoridgeSnapshotCreationController',
bindings: {
volumeId: '<'
}
volumeId: '<',
},
});

View file

@ -1,26 +1,28 @@
angular.module('portainer.docker')
.controller('StoridgeSnapshotCreationController', ['StoridgeSnapshotService', 'Notifications', '$state',
function (StoridgeSnapshotService, Notifications, $state) {
var ctrl = this;
angular.module('portainer.docker').controller('StoridgeSnapshotCreationController', [
'StoridgeSnapshotService',
'Notifications',
'$state',
function (StoridgeSnapshotService, Notifications, $state) {
var ctrl = this;
this.formValues = {};
this.state = {
actionInProgress: false
};
this.formValues = {};
this.state = {
actionInProgress: false,
};
this.createSnapshot = function () {
ctrl.state.actionInProgress = true;
StoridgeSnapshotService.create(ctrl.volumeId, ctrl.formValues.Description)
.then(function success() {
Notifications.success('Success', 'Snapshot successfully created');
$state.reload();
})
.catch(function error(err) {
Notifications.error('Failure', err, 'Unable to create snapshot');
})
.finally(function final() {
ctrl.state.actionInProgress = false;
});
};
}]);
this.createSnapshot = function () {
ctrl.state.actionInProgress = true;
StoridgeSnapshotService.create(ctrl.volumeId, ctrl.formValues.Description)
.then(function success() {
Notifications.success('Success', 'Snapshot successfully created');
$state.reload();
})
.catch(function error(err) {
Notifications.error('Failure', err, 'Unable to create snapshot');
})
.finally(function final() {
ctrl.state.actionInProgress = false;
});
};
},
]);