1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 14:00:56 +01:00

Allow Almanac Bindings to be enabled/disabled via API and support the "properties" attachment

Summary:
Depends on D19340. Ref T12414. Ref T13120. See T12414 for some discussion about direction here.

Since I think retaining "enabled/disabled" as a simple flag is reasonable, expose it via the API for readers and writers.

Also expose binding properties.

Test Plan:
  - Searched for bindings and properties with "alamanc.binding.search".
  - Enabled and disabled bindings with "almanac.binding.edit".

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13120, T12414

Differential Revision: https://secure.phabricator.com/D19341
This commit is contained in:
epriestley 2018-04-11 07:11:28 -07:00
parent 208504a5e3
commit d56a37b636
2 changed files with 22 additions and 1 deletions

View file

@ -152,6 +152,19 @@ final class AlmanacBindingEditEngine
->setConduitDescription(pht('Set the interface to bind.'))
->setConduitTypeDescription(pht('Interface PHID.'))
->setValue($object->getInterfacePHID()),
id(new PhabricatorBoolEditField())
->setKey('disabled')
->setLabel(pht('Disabled'))
->setIsConduitOnly(true)
->setTransactionType(
AlmanacBindingDisableTransaction::TRANSACTIONTYPE)
->setDescription(pht('Disable or enable the binding.'))
->setConduitDescription(pht('Disable or enable the binding.'))
->setConduitTypeDescription(pht('True to disable the binding.'))
->setValue($object->getIsDisabled())
->setOptions(
pht('Enable Binding'),
pht('Disable Binding')),
);
}

View file

@ -244,6 +244,10 @@ final class AlmanacBinding
->setKey('interfacePHID')
->setType('phid')
->setDescription(pht('The interface the service is bound to.')),
id(new PhabricatorConduitSearchFieldSpecification())
->setKey('disabled')
->setType('bool')
->setDescription(pht('Interface status.')),
);
}
@ -252,11 +256,15 @@ final class AlmanacBinding
'servicePHID' => $this->getServicePHID(),
'devicePHID' => $this->getDevicePHID(),
'interfacePHID' => $this->getInterfacePHID(),
'disabled' => (bool)$this->getIsDisabled(),
);
}
public function getConduitSearchAttachments() {
return array();
return array(
id(new AlmanacPropertiesSearchEngineAttachment())
->setAttachmentKey('properties'),
);
}
}