Avoid inline css style

This commit is contained in:
Sukhwinder Dhillon 2024-01-11 13:10:17 +01:00
parent 72f44c326f
commit c25a66b484
12 changed files with 126 additions and 53 deletions

View File

@ -304,17 +304,21 @@ class BasketController extends ActionController
$this->translate('modified'),
'director/basket/snapshotobject',
$linkParams,
['style' => 'color: orange; font-weight: bold']
['class' => 'basket-modified']
);
} else {
$link = Html::tag('span', ['style' => 'color: green'], $this->translate('unchanged'));
$link = Html::tag(
'span',
['class' => 'basket-unchanged'],
$this->translate('unchanged')
);
}
} else {
$link = Link::create(
$this->translate('new'),
'director/basket/snapshotobject',
$linkParams,
['style' => 'color: green; font-weight: bold']
['class' => 'basket-new']
);
}
$table->addNameValueRow($key, $link);

View File

@ -376,25 +376,27 @@ class ConfigController extends ActionController
}
$baseUrl = $this->url()->without(['left', 'right']);
$this->content()->add(Html::tag('form', ['action' => (string) $baseUrl, 'method' => 'GET'], [
new HtmlString($this->view->formSelect(
'left',
$leftSum,
['class' => 'autosubmit', 'style' => 'width: 37%'],
[null => $this->translate('- please choose -')] + $configs
)),
Link::create(
Icon::create('flapping'),
$baseUrl,
['left' => $rightSum, 'right' => $leftSum]
),
new HtmlString($this->view->formSelect(
'right',
$rightSum,
['class' => 'autosubmit', 'style' => 'width: 37%'],
[null => $this->translate('- please choose -')] + $configs
)),
]));
$this->content()->add(
Html::tag('form', ['action' => (string) $baseUrl, 'method' => 'GET', 'class' => 'director-form'], [
new HtmlString($this->view->formSelect(
'left',
$leftSum,
['class' => ['autosubmit', 'config-diff']],
[null => $this->translate('- please choose -')] + $configs
)),
Link::create(
Icon::create('flapping'),
$baseUrl,
['left' => $rightSum, 'right' => $leftSum]
),
new HtmlString($this->view->formSelect(
'right',
$rightSum,
['class' => ['autosubmit', 'config-diff']],
[null => $this->translate('- please choose -')] + $configs
)),
])
);
if ($rightSum === null || $leftSum === null || ! strlen($rightSum) || ! strlen($leftSum)) {
return;

View File

@ -216,7 +216,7 @@ class DataController extends ActionController
$subTitle = $this->translate('Add a new instance');
}
$this->content()->add(Html::tag('h2', ['style' => 'margin-top: 2em'], $subTitle));
$this->content()->add(Html::tag('h2', ['class' => 'dictionary-header'], $subTitle));
$form->handleRequest($this->getRequest());
$this->content()->add($form);
if ($form->succeeded()) {
@ -326,7 +326,7 @@ class DataController extends ActionController
Table::row([
$this->translate('Key / Instance'),
$this->translate('Properties')
], ['style' => 'text-align: left'], 'th')
], ['class' => 'text-align-left'], 'th')
);
foreach ($currentValue as $key => $item) {
$table->add(Table::row([

View File

@ -380,10 +380,7 @@ class SyncruleController extends ActionController
protected function firstNames($objects, $max = 50)
{
$names = [];
$list = new UnorderedList();
$list->addAttributes([
'style' => 'list-style-type: none; marign: 0; padding: 0',
]);
$list = new UnorderedList([], ['class' => 'unordred-list']);
$total = count($objects);
$i = 0;
PrefetchCache::forget();

View File

@ -288,9 +288,7 @@ class IcingaHostForm extends DirectorObjectForm
);
}
return Html::tag('span', [
'style' => 'line-height: 2.5em; padding-left: 0.5em'
], $links);
return Html::tag('span', ['class' => 'host-group-links'], $links);
}
protected function getAppliedGroups()

View File

@ -17,10 +17,7 @@ class RemoveLinkForm extends DirectorForm
{
// Required to detect the right instance
$this->formName = 'RemoveSet' . sha1(json_encode($params));
parent::__construct([
'style' => 'float: right',
'data-base-target' => '_self'
]);
parent::__construct(['data-base-target' => '_self']);
$this->label = $label;
$this->title = $title;
foreach ($params as $name => $value) {
@ -38,7 +35,7 @@ class RemoveLinkForm extends DirectorForm
public function setup()
{
$this->setAttrib('class', 'inline');
$this->addAttribs(['class' => ['inline', 'remove-link-form']]);
$this->addHtml(Icon::create('cancel'));
$this->addSubmitButton($this->label, [
'class' => 'link-button',

View File

@ -223,7 +223,7 @@ abstract class ActionController extends Controller implements ControlsAndContent
// Hint -> $this->view->compact is the only way since v2.8.0
if ($this->view->compact || $this->getOriginalUrl()->getParam('view') === 'compact') {
if ($this->view->controls) {
$this->controls()->getAttributes()->add('style', 'display: none;');
$this->controls()->getAttributes()->add('class', 'compact');
}
}
} else {

View File

@ -219,8 +219,7 @@ class IcingaServiceSetServiceTable extends ZfQueryBasedTable
protected function createFakeRemoveLinkForReadonlyView()
{
return Html::tag('span', [
'class' => 'icon-paste',
'style' => 'float: right; font-weight: normal',
'class' => ['icon-paste', 'seviceset-obj-link'],
], $this->host->getObjectName());
}
@ -228,8 +227,7 @@ class IcingaServiceSetServiceTable extends ZfQueryBasedTable
{
$hostname = $host->getObjectName();
return Link::create($hostname, 'director/host/services', ['name' => $hostname], [
'class' => 'icon-paste',
'style' => 'float: right; font-weight: normal',
'class' => ['icon-paste', 'seviceset-obj-link'],
'data-base-target' => '_next',
'title' => sprintf(
$this->translate('This set has been inherited from %s'),

View File

@ -60,7 +60,7 @@ class TemplatesTable extends ZfQueryBasedTable implements FilterableByUsage
$name,
Html::tag(
'span',
['style' => 'font-style: italic'],
['class' => 'font-italic'],
$this->translate(' - not in use -')
)
];

View File

@ -83,8 +83,7 @@ class ActivityLogInfo extends HtmlDocument
/** @var Url $url */
$url = $url->without('checksum')->without('show');
$div = Html::tag('div', [
'class' => 'pagination-control',
'style' => 'float: right; width: 5em'
'class' => ['pagination-control', 'activity-log-control'],
]);
$ul = Html::tag('ul', ['class' => 'nav tab-nav']);

View File

@ -73,7 +73,8 @@ class DeploymentInfo extends HtmlDocument
protected function createInfoTable()
{
$dep = $this->deployment;
$table = new NameValueTable();
$table = (new NameValueTable())
->addAttributes(['class' => 'deployment-details']);
$table->addNameValuePairs([
$this->translate('Deployment time') => $dep->start_time,
$this->translate('Sent to') => $dep->peer_identity,
@ -136,16 +137,21 @@ class DeploymentInfo extends HtmlDocument
} else {
return [$this->translate('Unknown, failed to collect related information'), new Icon('help')];
}
} elseif ($dep->startup_succeeded === 'y') {
return $this->colored('green', [$this->translate('Succeeded'), new Icon('ok')]);
} else {
return $this->colored('red', [$this->translate('Failed'), new Icon('cancel')]);
}
}
$div = Html::tag('div')->setSeparator(' ');
protected function colored($color, array $content)
{
return Html::tag('div', ['style' => "color: $color;"], $content)->setSeparator(' ');
if ($dep->startup_succeeded === 'y') {
$div
->addAttributes(['class' => 'succeeded'])
->add([$this->translate('Succeeded'), new Icon('ok')]);
} else {
$div
->addAttributes(['class' => 'failed'])
->add([$this->translate('Failed'), new Icon('cancel')]);
}
return $div;
}
}
public function render()

View File

@ -49,6 +49,15 @@ div.action-bar > a {
margin-right: 1em;
}
.controls.compact {
display: none;
}
.controls > .pagination-control.activity-log-control {
float: right;
width: 5em;
}
.controls > .pagination-control li > a {
padding: 0.5em 0 0.5em 0;
}
@ -337,6 +346,10 @@ table.avp th {
left: -100%;
}
form.remove-link-form {
float: right;
}
form.director-form input[type=file] {
padding-right: 1em;
}
@ -462,6 +475,11 @@ form.director-form dl {
padding: 0;
}
form.director-form .host-group-links {
line-height: 2.5em;
padding-left: 0.5em;
}
.strike-links a, table.common-table .strike-links a {
text-decoration: line-through;
&:hover {
@ -502,6 +520,12 @@ form.director-form.editor {
}
}
ul.unordred-list {
list-style-type: none;
margin: 0;
padding: 0;
}
ul.extensible-set {
margin: 0;
padding: 0;
@ -917,6 +941,10 @@ form.director-form dd.active li.active input.related-action[type='submit'] {
}
form.director-form {
select.config-diff {
width: auto;
}
p.description {
color: @gray;
font-style: italic;
@ -1223,6 +1251,17 @@ div.content.compact table.icinga-objects thead {
display: none;
}
table.deployment-details {
.succeeded {
color: @state-ok;
}
.failed {
color: @color-critical;
}
}
table.deployment-log {
tr td:nth-child(2), tr th:nth-child(2) {
@ -1833,3 +1872,36 @@ table.table-basket-changes {
min-width: 10em;
}
}
.font-italic {
font-style: italic;
}
.table-basket-changes {
.basket-new {
color: green;
font-weight: bold
}
.basket-modified {
color: orange;
font-weight: bold
}
.basket-unchanged {
color: green;
}
}
.seviceset-obj-link {
float: right;
font-weight: normal
}
.dictionary-header {
margin-top: 2em;
}
.text-align-left {
text-align: left
}