File tree 2 files changed +25
-8
lines changed
library/Director/Web/Controller
2 files changed +25
-8
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,12 @@ public function setup()
29
29
{
30
30
$ isBranch = $ this ->branch && $ this ->branch ->isBranch ();
31
31
$ branchOnly = $ this ->object ->get ('id ' ) === null ;
32
- if ($ isBranch && $ this ->object instanceof IcingaObject && $ this ->object ->isTemplate ()) {
32
+
33
+ if (
34
+ $ isBranch
35
+ && $ this ->object ->isTemplate ()
36
+ && ! $ this ->object instanceof IcingaServiceSet
37
+ ) {
33
38
$ this ->addHtml (Hint::error ($ this ->translate (
34
39
'Templates cannot be cloned in Configuration Branches '
35
40
)));
@@ -149,7 +154,12 @@ public function onSuccess()
149
154
);
150
155
151
156
$ isBranch = $ this ->branch && $ this ->branch ->isBranch ();
152
- if ($ object ->isTemplate () && $ isBranch ) {
157
+
158
+ if (
159
+ $ isBranch
160
+ && $ this ->object ->isTemplate ()
161
+ && ! $ this ->object instanceof IcingaServiceSet
162
+ ) {
153
163
throw new IcingaException ('Cloning templates is not available for Branches ' );
154
164
}
155
165
@@ -218,8 +228,13 @@ public function onSuccess()
218
228
$ clone ->set ('host_id ' , $ newId );
219
229
}
220
230
} elseif ($ new instanceof IcingaServiceSet) {
221
- $ clone ->set ('service_set_id ' , $ newId );
231
+ if ($ isBranch ) {
232
+ $ clone ->set ('service_set ' , $ newName );
233
+ } else {
234
+ $ clone ->set ('service_set_id ' , $ newId );
235
+ }
222
236
}
237
+
223
238
$ store ->store ($ clone );
224
239
}
225
240
Original file line number Diff line number Diff line change @@ -218,12 +218,14 @@ public function cloneAction()
218
218
$ this ->addTitle ($ this ->translate ('Clone: %s ' ), $ object ->getObjectName ())
219
219
->addBackToObjectLink ();
220
220
221
- if ($ object ->isTemplate () && $ this ->showNotInBranch ($ this ->translate ('Cloning Templates ' ))) {
222
- return ;
223
- }
221
+ if (! $ object instanceof IcingaServiceSet) {
222
+ if ($ object ->isTemplate () && $ this ->showNotInBranch ($ this ->translate ('Cloning Templates ' ))) {
223
+ return ;
224
+ }
224
225
225
- if ($ object ->isTemplate () && $ this ->showNotInBranch ($ this ->translate ('Cloning Apply Rules ' ))) {
226
- return ;
226
+ if ($ object ->isTemplate () && $ this ->showNotInBranch ($ this ->translate ('Cloning Apply Rules ' ))) {
227
+ return ;
228
+ }
227
229
}
228
230
229
231
$ form = IcingaCloneObjectForm::load ()
You can’t perform that action at this time.
0 commit comments