mirror of
https://github.com/portainer/portainer.git
synced 2025-07-25 00:09:40 +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:
parent
6663073be1
commit
cf5056d9c0
714 changed files with 31228 additions and 28305 deletions
|
@ -3,6 +3,6 @@ angular.module('portainer.docker').component('networkMacvlanForm', {
|
|||
controller: 'NetworkMacvlanFormController',
|
||||
bindings: {
|
||||
data: '=',
|
||||
applicationState: '<'
|
||||
}
|
||||
});
|
||||
applicationState: '<',
|
||||
},
|
||||
});
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
</span>
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<div class="form-group" style="margin-bottom: 0">
|
||||
<div class="form-group" style="margin-bottom: 0;">
|
||||
<div class="boxselector_wrapper">
|
||||
<div>
|
||||
<input type="radio" id="network_config" ng-model="$ctrl.data.Scope" value="local">
|
||||
<input type="radio" id="network_config" ng-model="$ctrl.data.Scope" value="local" />
|
||||
<label for="network_config">
|
||||
<div class="boxselector_header">
|
||||
<i class="fa fa-cog" aria-hidden="true" style="margin-right: 2px;"></i>
|
||||
|
@ -23,7 +23,7 @@
|
|||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<input type="radio" id="network_deploy" ng-model="$ctrl.data.Scope" value="swarm" ng-disabled="$ctrl.availableNetworks.length === 0">
|
||||
<input type="radio" id="network_deploy" ng-model="$ctrl.data.Scope" value="swarm" ng-disabled="$ctrl.availableNetworks.length === 0" />
|
||||
<label for="network_deploy" ng-class="$ctrl.availableNetworks.length === 0 ? 'boxselector_disabled' : ''">
|
||||
<div class="boxselector_header">
|
||||
<i class="fa fa-sitemap" aria-hidden="true" style="margin-right: 2px;"></i>
|
||||
|
@ -44,15 +44,20 @@
|
|||
<div class="form-group">
|
||||
<label for="network_card" class="col-sm-3 col-lg-2 control-label text-left">Parent network card</label>
|
||||
<div class="col-sm-9 col-lg-10">
|
||||
<input type="text" class="form-control" name="network_card" ng-model="$ctrl.data.ParentNetworkCard" placeholder="e.g. eth0 or ens160 ..."
|
||||
ng-required="$ctrl.data.Scope === 'local' && !$ctrl.data.ParentNetworkCard">
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
name="network_card"
|
||||
ng-model="$ctrl.data.ParentNetworkCard"
|
||||
placeholder="e.g. eth0 or ens160 ..."
|
||||
ng-required="$ctrl.data.Scope === 'local' && !$ctrl.data.ParentNetworkCard"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" ng-show="macvlanConfigurationForm.network_card.$invalid">
|
||||
<div class="col-sm-12 small text-warning">
|
||||
<div ng-messages="macvlanConfigurationForm.network_card.$error">
|
||||
<p ng-message="required">
|
||||
<i class="fa fa-exclamation-triangle" aria-hidden="true"></i> Parent network card must be specified.</p>
|
||||
<p ng-message="required"> <i class="fa fa-exclamation-triangle" aria-hidden="true"></i> Parent network card must be specified.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -61,17 +66,25 @@
|
|||
<div ng-if="$ctrl.applicationState.endpoint.mode.agentProxy && $ctrl.applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE'">
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<macvlan-nodes-datatable title-text="Select the nodes where you want to deploy the local configuration" title-icon="fa-hdd"
|
||||
dataset="$ctrl.nodes" table-key="nodes" state="$ctrl.data.DatatableState" order-by="Hostname" show-ip-address-column="$ctrl.applicationState.endpoint.apiVersion >= 1.25"
|
||||
access-to-node-details="!$ctrl.applicationState.application.authentication || $ctrl.isAdmin" name="node_selector"
|
||||
ng-model="tmp" ng-required="$ctrl.requiredNodeSelection()"></macvlan-nodes-datatable>
|
||||
<macvlan-nodes-datatable
|
||||
title-text="Select the nodes where you want to deploy the local configuration"
|
||||
title-icon="fa-hdd"
|
||||
dataset="$ctrl.nodes"
|
||||
table-key="nodes"
|
||||
state="$ctrl.data.DatatableState"
|
||||
order-by="Hostname"
|
||||
show-ip-address-column="$ctrl.applicationState.endpoint.apiVersion >= 1.25"
|
||||
access-to-node-details="!$ctrl.applicationState.application.authentication || $ctrl.isAdmin"
|
||||
name="node_selector"
|
||||
ng-model="tmp"
|
||||
ng-required="$ctrl.requiredNodeSelection()"
|
||||
></macvlan-nodes-datatable>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" ng-show="macvlanConfigurationForm.node_selector.$invalid">
|
||||
<div class="col-sm-12 small text-warning">
|
||||
<div ng-messages="macvlanConfigurationForm.node_selector.$error">
|
||||
<p ng-message="required">
|
||||
<i class="fa fa-exclamation-triangle" aria-hidden="true"></i> At least one node must be selected.</p>
|
||||
<p ng-message="required"> <i class="fa fa-exclamation-triangle" aria-hidden="true"></i> At least one node must be selected.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -86,8 +99,13 @@
|
|||
<div class="form-group">
|
||||
<label for="config_network" class="col-sm-2 col-lg-1 control-label text-left">Configuration</label>
|
||||
<div class="col-sm-9">
|
||||
<select class="form-control" ng-options="net.Name for net in $ctrl.availableNetworks" ng-model="$ctrl.data.SelectedNetworkConfig"
|
||||
name="config_network" ng-required="$ctrl.requiredConfigSelection()">
|
||||
<select
|
||||
class="form-control"
|
||||
ng-options="net.Name for net in $ctrl.availableNetworks"
|
||||
ng-model="$ctrl.data.SelectedNetworkConfig"
|
||||
name="config_network"
|
||||
ng-required="$ctrl.requiredConfigSelection()"
|
||||
>
|
||||
<option selected disabled hidden value="">Select a network</option>
|
||||
</select>
|
||||
</div>
|
||||
|
@ -96,8 +114,7 @@
|
|||
<div class="form-group" ng-show="macvlanConfigurationForm.config_network.$invalid">
|
||||
<div class="col-sm-12 small text-warning">
|
||||
<div ng-messages="macvlanConfigurationForm.config_network.$error">
|
||||
<p ng-message="required">
|
||||
<i class="fa fa-exclamation-triangle" aria-hidden="true"></i> Select a configuration network.</p>
|
||||
<p ng-message="required"> <i class="fa fa-exclamation-triangle" aria-hidden="true"></i> Select a configuration network.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -105,4 +122,4 @@
|
|||
</div>
|
||||
<!-- deploy-inputs -->
|
||||
</ng-form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,50 +1,51 @@
|
|||
angular.module('portainer.docker')
|
||||
.controller('NetworkMacvlanFormController', ['$q', 'NodeService', 'NetworkService', 'Notifications', 'StateManager', 'Authentication',
|
||||
function ($q, NodeService, NetworkService, Notifications, StateManager, Authentication) {
|
||||
var ctrl = this;
|
||||
angular.module('portainer.docker').controller('NetworkMacvlanFormController', [
|
||||
'$q',
|
||||
'NodeService',
|
||||
'NetworkService',
|
||||
'Notifications',
|
||||
'StateManager',
|
||||
'Authentication',
|
||||
function ($q, NodeService, NetworkService, Notifications, StateManager, Authentication) {
|
||||
var ctrl = this;
|
||||
|
||||
ctrl.requiredNodeSelection = function () {
|
||||
if (ctrl.data.Scope !== 'local' || ctrl.data.DatatableState === undefined) {
|
||||
return false;
|
||||
}
|
||||
return ctrl.data.DatatableState.selectedItemCount === 0;
|
||||
};
|
||||
|
||||
ctrl.requiredConfigSelection = function () {
|
||||
if (ctrl.data.Scope !== 'swarm') {
|
||||
return false;
|
||||
}
|
||||
return !ctrl.data.SelectedNetworkConfig;
|
||||
};
|
||||
|
||||
function initComponent() {
|
||||
if (StateManager.getState().application.authentication) {
|
||||
var isAdmin = Authentication.isAdmin();
|
||||
ctrl.isAdmin = isAdmin;
|
||||
}
|
||||
var provider = ctrl.applicationState.endpoint.mode.provider;
|
||||
var apiVersion = ctrl.applicationState.endpoint.apiVersion;
|
||||
$q.all({
|
||||
nodes: provider !== 'DOCKER_SWARM_MODE' || NodeService.nodes(),
|
||||
networks: NetworkService.networks(
|
||||
provider === 'DOCKER_STANDALONE' || provider === 'DOCKER_SWARM_MODE',
|
||||
false,
|
||||
provider === 'DOCKER_SWARM_MODE' && apiVersion >= 1.25
|
||||
)
|
||||
})
|
||||
.then(function success(data) {
|
||||
if (data.nodes !== true) {
|
||||
ctrl.nodes = data.nodes;
|
||||
}
|
||||
ctrl.availableNetworks = data.networks.filter(function (item) {
|
||||
return item.ConfigOnly === true;
|
||||
});
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to retrieve informations for macvlan');
|
||||
});
|
||||
ctrl.requiredNodeSelection = function () {
|
||||
if (ctrl.data.Scope !== 'local' || ctrl.data.DatatableState === undefined) {
|
||||
return false;
|
||||
}
|
||||
return ctrl.data.DatatableState.selectedItemCount === 0;
|
||||
};
|
||||
|
||||
initComponent();
|
||||
ctrl.requiredConfigSelection = function () {
|
||||
if (ctrl.data.Scope !== 'swarm') {
|
||||
return false;
|
||||
}
|
||||
return !ctrl.data.SelectedNetworkConfig;
|
||||
};
|
||||
|
||||
function initComponent() {
|
||||
if (StateManager.getState().application.authentication) {
|
||||
var isAdmin = Authentication.isAdmin();
|
||||
ctrl.isAdmin = isAdmin;
|
||||
}
|
||||
var provider = ctrl.applicationState.endpoint.mode.provider;
|
||||
var apiVersion = ctrl.applicationState.endpoint.apiVersion;
|
||||
$q.all({
|
||||
nodes: provider !== 'DOCKER_SWARM_MODE' || NodeService.nodes(),
|
||||
networks: NetworkService.networks(provider === 'DOCKER_STANDALONE' || provider === 'DOCKER_SWARM_MODE', false, provider === 'DOCKER_SWARM_MODE' && apiVersion >= 1.25),
|
||||
})
|
||||
.then(function success(data) {
|
||||
if (data.nodes !== true) {
|
||||
ctrl.nodes = data.nodes;
|
||||
}
|
||||
ctrl.availableNetworks = data.networks.filter(function (item) {
|
||||
return item.ConfigOnly === true;
|
||||
});
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to retrieve informations for macvlan');
|
||||
});
|
||||
}
|
||||
]);
|
||||
|
||||
initComponent();
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -2,7 +2,7 @@ export function MacvlanFormData() {
|
|||
this.Scope = 'local';
|
||||
this.SelectedNetworkConfig = '';
|
||||
this.DatatableState = {
|
||||
selectedItems: []
|
||||
selectedItems: [],
|
||||
};
|
||||
this.ParentNetworkCard = '';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue